objc2_core_media/generated/
CMTag.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6use objc2_core_foundation::*;
7
8use crate::*;
9
10/// The OSStatus errors returned from the CMTag routines.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtagerror?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct CMTagError(pub OSStatus);
17impl CMTagError {
18    #[doc(alias = "kCMTagError_ParamErr")]
19    pub const ParamErr: Self = Self(-15730);
20    #[doc(alias = "kCMTagError_AllocationFailed")]
21    pub const AllocationFailed: Self = Self(-15731);
22}
23
24#[cfg(feature = "objc2")]
25unsafe impl Encode for CMTagError {
26    const ENCODING: Encoding = OSStatus::ENCODING;
27}
28
29#[cfg(feature = "objc2")]
30unsafe impl RefEncode for CMTagError {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// An enum indicating the available CMTagCategory identifiers that can be used to distinguish the tag from other kinds.
35///
36/// Different kinds of CMTags may be defined or registered. Each will be associated with a category. CMTags with the same CMTagCategory will have the same kinds of values. The category serves as a namespace.
37///
38/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtagcategory?language=objc)
39// NS_ENUM
40#[repr(transparent)]
41#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
42pub struct CMTagCategory(pub FourCharCode);
43impl CMTagCategory {
44    #[doc(alias = "kCMTagCategory_Undefined")]
45    pub const Undefined: Self = Self(0);
46    #[doc(alias = "kCMTagCategory_MediaType")]
47    pub const MediaType: Self = Self(0x6d646961);
48    #[doc(alias = "kCMTagCategory_MediaSubType")]
49    pub const MediaSubType: Self = Self(0x6d737562);
50    #[doc(alias = "kCMTagCategory_TrackID")]
51    pub const TrackID: Self = Self(0x7472616b);
52    #[doc(alias = "kCMTagCategory_ChannelID")]
53    pub const ChannelID: Self = Self(0x7663686e);
54    #[doc(alias = "kCMTagCategory_VideoLayerID")]
55    pub const VideoLayerID: Self = Self(0x766c6179);
56    #[doc(alias = "kCMTagCategory_PixelFormat")]
57    pub const PixelFormat: Self = Self(0x70697866);
58    #[doc(alias = "kCMTagCategory_PackingType")]
59    pub const PackingType: Self = Self(0x7061636b);
60    #[doc(alias = "kCMTagCategory_ProjectionType")]
61    pub const ProjectionType: Self = Self(0x70726f6a);
62    #[doc(alias = "kCMTagCategory_StereoView")]
63    pub const StereoView: Self = Self(0x65796573);
64    #[doc(alias = "kCMTagCategory_StereoViewInterpretation")]
65    pub const StereoViewInterpretation: Self = Self(0x65796970);
66}
67
68#[cfg(feature = "objc2")]
69unsafe impl Encode for CMTagCategory {
70    const ENCODING: Encoding = FourCharCode::ENCODING;
71}
72
73#[cfg(feature = "objc2")]
74unsafe impl RefEncode for CMTagCategory {
75    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
76}
77
78/// The data type for the value of the CMTag.
79///
80/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtagdatatype?language=objc)
81// NS_ENUM
82#[repr(transparent)]
83#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
84pub struct CMTagDataType(pub u32);
85impl CMTagDataType {
86    #[doc(alias = "kCMTagDataType_Invalid")]
87    pub const Invalid: Self = Self(0);
88    #[doc(alias = "kCMTagDataType_SInt64")]
89    pub const SInt64: Self = Self(2);
90    #[doc(alias = "kCMTagDataType_Float64")]
91    pub const Float64: Self = Self(3);
92    #[doc(alias = "kCMTagDataType_OSType")]
93    pub const OSType: Self = Self(5);
94    #[doc(alias = "kCMTagDataType_Flags")]
95    pub const Flags: Self = Self(7);
96}
97
98#[cfg(feature = "objc2")]
99unsafe impl Encode for CMTagDataType {
100    const ENCODING: Encoding = u32::ENCODING;
101}
102
103#[cfg(feature = "objc2")]
104unsafe impl RefEncode for CMTagDataType {
105    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
106}
107
108/// 64-bit value interpreted within the context of the CMTagCategory.
109///
110/// The 64-bit value can be one of several data types fitting within that range and holding a category-specific value. Data types include numeric and non-numeric types. Examples of numeric include a signed 64-bit integer and a 64-bit floating point value. Non-numeric types include a single OSType and an OSType pair. The value may hold values including discrete values, bit flags, enums representable as a signed 64-bit integer or float and values encoding any of these.
111///
112/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtagvalue?language=objc)
113pub type CMTagValue = u64;
114
115/// An efficient structure used to label something about a resource or other media construct.
116///
117/// A structure holding a CMTagCategory, CMTagDataType, and a CMTagValue serving to represent a particular tag that might be assigned to or associated with another resource. There is only one of each of the category, the dataType and the value so any notion of "has" is about the respective singular element.  CMTags are a value type. No lifetime management such as allocation or retain and release semantics are needed. CMTags can be passed by value, returned by value and stored in other structures or arrays or on the stack.  CMTags carry a single value that can be carried in 64 bits. This can include data types such as signed 64-bit integers, floating point values fitting in 64 bits, up to 64 bit of flags, and other data types fitting within 64 bits. Signaling of the data type is carried in the CMTagDataType. The data types can be extended through registration with the CoreMedia team.  A CMTag value should not be used to carry pointers. If such a reference is needed, it is okay to carry an index into an out-of-band data structure that itself has a memory reference or an object reference.
118/// Field: category CMTagCategory for the tag.
119/// Field: dataType CMTagDataType for the tag indicating the data type of the value.
120/// Field: value CMTagValue for the value of the CMTag (e.g., a signed 64-bit integer.)
121///
122/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtag?language=objc)
123#[repr(C)]
124#[derive(Clone, Copy, Debug, PartialEq)]
125pub struct CMTag {
126    pub category: CMTagCategory,
127    pub dataType: CMTagDataType,
128    pub value: CMTagValue,
129}
130
131#[cfg(feature = "objc2")]
132unsafe impl Encode for CMTag {
133    const ENCODING: Encoding = Encoding::Struct(
134        "CMTag",
135        &[
136            <CMTagCategory>::ENCODING,
137            <CMTagDataType>::ENCODING,
138            <CMTagValue>::ENCODING,
139        ],
140    );
141}
142
143#[cfg(feature = "objc2")]
144unsafe impl RefEncode for CMTag {
145    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
146}
147
148impl CMTag {
149    // TODO: pub fn CMTagIsValid(tag: CMTag,) -> Boolean;
150
151    /// Returns the dataType field of the CMTag.
152    ///
153    /// Parameter `tag`: CMTag from which to extract the data type.
154    ///
155    /// Returns: kCMTagDataType_* value.
156    #[doc(alias = "CMTagGetValueDataType")]
157    #[inline]
158    pub unsafe fn value_data_type(self) -> CMTagDataType {
159        extern "C-unwind" {
160            fn CMTagGetValueDataType(tag: CMTag) -> CMTagDataType;
161        }
162        unsafe { CMTagGetValueDataType(self) }
163    }
164}
165
166extern "C" {
167    /// CMTag with an unspecified or "null" value.
168    ///
169    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtaginvalid?language=objc)
170    pub static kCMTagInvalid: CMTag;
171}
172
173extern "C" {
174    /// A CMTag of category kCMTagCategory_MediaType and the value kCMMediaType_Video (OSType).
175    ///
176    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagmediatypevideo?language=objc)
177    pub static kCMTagMediaTypeVideo: CMTag;
178}
179
180extern "C" {
181    /// A CMTag of category kCMTagCategory_MediaType and the value kCMMetadataFormatType_Boxed (OSType).
182    ///
183    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagmediasubtypemebx?language=objc)
184    pub static kCMTagMediaSubTypeMebx: CMTag;
185}
186
187extern "C" {
188    /// A CMTag of category kCMTagCategory_MediaType and the value kCMMediaType_Audio (OSType).
189    ///
190    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagmediatypeaudio?language=objc)
191    pub static kCMTagMediaTypeAudio: CMTag;
192}
193
194extern "C" {
195    /// A CMTag of category kCMTagCategory_MediaType and the value kCMMediaType_Metadata (OSType).
196    ///
197    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagmediatypemetadata?language=objc)
198    pub static kCMTagMediaTypeMetadata: CMTag;
199}
200
201/// Flags used with kCMTagCategory_StereoView tags to signal the nature of the stereo views carried in a buffer or channel.
202///
203/// A "stereo eye" is either for the left eye or for the right eye. A CMTag signaling of stereo views can indicate the presence of one "stereo eye", both stereo eyes or no stereo eyes. A CMTag having a CMTagCategory of kCMTagCategory_StereoView has a value that is a set of kCMTagStereoViewComponent_* flags (see CMTagMakeWithFlagsValue()) that can be set to indicate the stereo eyes carried.  If neither the left nor the right stereo eye is signaled, this can be interpreted to mean that this is not stereo view related and is instead monoscopic video. If it is not stereo related, a kCMTagCategory_StereoView CMTag need not be associated with the buffer or channel.  kCMTagCategory_StereoView does not prescribe how the stereo views are carried. It might be contained in some kind of multiview carriage or might be frame packed in some way. The kCMTagCategory_PackingType will typically be available if frame packing of stereo views is used. The presence of a CMTag with kCMTagCategory_StereoView alone is insufficient to imply if there is some kind of packing or other mechanism required. Additional CMTags with other CMTagCategories may be necessary.  One or more kCMTagCategory_StereoView tags may be present in a collection. When considering which stereo eyes are represented by the collection, the same semantic can be expressed in more than one way in the collection. Specifying the same CMTag more than once has no meaning as the first occurrence indicates the stereo eye or stereo eyes are present.
204/// Here are compatible semantics expressed by one or more CMTags:
205/// - a single CMTag with kCMTagStereoViewsOption_LeftEye bitwise ORed with kCMTagStereoViewsOption_RightEye.
206/// - two kCMTagCategory_StereoView CMTags with one CMTag having the value kCMTagStereoViewsOption_LeftEye and the other CMTag having the value kCMTagStereoViewsOption_RightEye.
207/// - three or more CMTags made up of a CMTag with kCMTagStereoViewsOption_LeftEye bitwise ORed with kCMTagStereoViewsOption_RightEye and both a CMTag with only kCMTagStereoViewsOption_LeftEye and a CMTag with kCMTagStereoViewsOption_RightEye.
208/// Likewise, if a collection contains only one or more CMTags with one stereo eye (e.g., kCMTagStereoViewsOption_LeftEye), only that stereo eye should be considered present.  The absence of a kCMTagCategory_StereoView CMTag is meant to indicate there is no stereo view present. If this signaling of no stereo eyes is associated with a buffer or channel that carries stereo eye views, the buffer or channel should be configured to present only a monoscopic view. This might be in the form of some fallback to a default view corresponding to a stereo eye or even to some other view it includes or can synthesize.
209///
210/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmstereoviewcomponents?language=objc)
211// NS_OPTIONS
212#[repr(transparent)]
213#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
214pub struct CMStereoViewComponents(pub u64);
215bitflags::bitflags! {
216    impl CMStereoViewComponents: u64 {
217        #[doc(alias = "kCMStereoView_None")]
218        const None = 0;
219        #[doc(alias = "kCMStereoView_LeftEye")]
220        const LeftEye = 1<<0;
221        #[doc(alias = "kCMStereoView_RightEye")]
222        const RightEye = 1<<1;
223    }
224}
225
226#[cfg(feature = "objc2")]
227unsafe impl Encode for CMStereoViewComponents {
228    const ENCODING: Encoding = u64::ENCODING;
229}
230
231#[cfg(feature = "objc2")]
232unsafe impl RefEncode for CMStereoViewComponents {
233    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
234}
235
236extern "C" {
237    /// A CMTag of category kCMTagCategory_StereoView and the value kCMTagStereoViewComponent_LeftEye (Flags).
238    ///
239    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagstereolefteye?language=objc)
240    pub static kCMTagStereoLeftEye: CMTag;
241}
242
243extern "C" {
244    /// A CMTag of category kCMTagCategory_StereoView and the value kCMTagStereoViewComponent_RightEye (Flags).
245    ///
246    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagstereorighteye?language=objc)
247    pub static kCMTagStereoRightEye: CMTag;
248}
249
250extern "C" {
251    /// A CMTag of category kCMTagCategory_StereoView and the value of the bitwise OR of kCMTagStereoViewComponent_LeftEye and kCMTagStereoViewComponent_RightEye (Flags).
252    ///
253    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagstereoleftandrighteye?language=objc)
254    pub static kCMTagStereoLeftAndRightEye: CMTag;
255}
256
257extern "C" {
258    /// A CMTag of category kCMTagCategory_StereoView and the value of kCMTagStereoViewComponent_None. (Flags)
259    ///
260    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagstereonone?language=objc)
261    pub static kCMTagStereoNone: CMTag;
262}
263
264/// Flags used with kCMTagCategory_StereoViewInterpretation tags to signal additional information that may be important to the interpretation of stereo views carried in a buffer or channel.
265///
266/// A buffer or channel may carry one or more stereo eye views. The signaling of the presence of individual stereo eye views can be done using CMTags with a kCMTagCategory_StereoView category and correspondng kCMTagStereoViewComponent_* constants. There may however be additional signaling that is valuable beyond the presence of a stereo eye. The kCMTagCategory_StereoViewInterpretation category allows additional signaling that may be relevant for interpretation of storage, ordering or other details regarding the stereo views.  A CMTag having a CMTagCategory of kCMTagCategory_StereoViewInterpretation has a value that is a set of kCMStereoViewInterpretation_* flags (see CMTagMakeWithFlagsValue()) that can be set to indicate additional aspects of the stereo view or stereo views. The absence of a flag indicates the default interpretation of that feature or aspect should occur. If a flag is set, the semantic of that feature and only that feature should be inferred.  Two stereo view interpretations are currently defined.  One is that the order of stereo views is the reverse of the default of left then right. Here, order can be the geometric order such as in frame packed video or in something such as storage order.  The second is that buffers or channels contain views other than the left stereo eye view and the right stereo eye view. Such a view might be used as an alternative when perhaps monoscopic view is to be used instead of selecting the left or right stereo view or synthesizing something based upon the left and right stereo eye views.  The absence of a kCMTagCategory_StereoViewInterpretation CMTag is meant to indicate defaults are used.  Specifying kCMStereoViewInterpretation_Default is equivalent to the absence of a CMTag with category kCMTagCategory_StereoViewInterpretation.
267///
268/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmstereoviewinterpretationoptions?language=objc)
269// NS_OPTIONS
270#[repr(transparent)]
271#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
272pub struct CMStereoViewInterpretationOptions(pub u64);
273bitflags::bitflags! {
274    impl CMStereoViewInterpretationOptions: u64 {
275        #[doc(alias = "kCMStereoViewInterpretation_Default")]
276        const Default = 0;
277        #[doc(alias = "kCMStereoViewInterpretation_StereoOrderReversed")]
278        const StereoOrderReversed = 1<<0;
279        #[doc(alias = "kCMStereoViewInterpretation_AdditionalViews")]
280        const AdditionalViews = 1<<1;
281    }
282}
283
284#[cfg(feature = "objc2")]
285unsafe impl Encode for CMStereoViewInterpretationOptions {
286    const ENCODING: Encoding = u64::ENCODING;
287}
288
289#[cfg(feature = "objc2")]
290unsafe impl RefEncode for CMStereoViewInterpretationOptions {
291    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
292}
293
294extern "C" {
295    /// A CMTag of category kCMTagCategory_StereoViewInterpretation and the value of kCMStereoViewInterpretation_StereoOrderReversed (Flags).
296    ///
297    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagstereointerpretationorderreversed?language=objc)
298    pub static kCMTagStereoInterpretationOrderReversed: CMTag;
299}
300
301/// Constants used with kCMTagCategory_ProjectionType to signal the nature of a video projection carried in a buffer or channel.
302///
303/// A video projection can be one of several types. Examples include 360 degree equirectangular, 180 degree half equirectangular, or a fisheye.  A CMTag having a CMTagCategory of kCMTagCategory_ProjectionType has a value that is an OSType indicating the kind of projection using a kCMProjectionType_* constant.  The kCMProjectionType_Rectangular projection type can signal that there is no projection other than the default 2D view. This is provided so it is possible to still signal a kCMTagCategory_ProjectionType CMTag but indicates it has no effect.     The kCMProjectionType_ParametricImmersive projection type indicates a projection described mathematically by a model of camera lens calibration parameters. Parameters may be found in lens calibration metadata in kCMFormatDescriptionExtension_CameraCalibrationDataLensCollection with algorithm_kind parametric. If a kCMTagCategory_ProjectionType CMTag is not signaled, a rectangular projection is implied.  The kCMTagCategory_ProjectionType tag may be associated with other tags if projection related parameters are also signaled. What is carried will be defined for the specific type of projection.
304///
305/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmprojectiontype?language=objc)
306// NS_ENUM
307#[repr(transparent)]
308#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
309pub struct CMProjectionType(pub u64);
310impl CMProjectionType {
311    #[doc(alias = "kCMProjectionType_Rectangular")]
312    pub const Rectangular: Self = Self(0x72656374);
313    #[doc(alias = "kCMProjectionType_Equirectangular")]
314    pub const Equirectangular: Self = Self(0x65717569);
315    #[doc(alias = "kCMProjectionType_HalfEquirectangular")]
316    pub const HalfEquirectangular: Self = Self(0x68657175);
317    #[doc(alias = "kCMProjectionType_Fisheye")]
318    pub const Fisheye: Self = Self(0x66697368);
319    #[doc(alias = "kCMProjectionType_ParametricImmersive")]
320    pub const ParametricImmersive: Self = Self(0x7072696d);
321}
322
323#[cfg(feature = "objc2")]
324unsafe impl Encode for CMProjectionType {
325    const ENCODING: Encoding = u64::ENCODING;
326}
327
328#[cfg(feature = "objc2")]
329unsafe impl RefEncode for CMProjectionType {
330    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
331}
332
333extern "C" {
334    /// A CMTag of category kCMTagCategory_ProjectionType and the value kCMTagProjectionType_Rectangular (OSType).
335    ///
336    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagprojectiontyperectangular?language=objc)
337    pub static kCMTagProjectionTypeRectangular: CMTag;
338}
339
340extern "C" {
341    /// A CMTag of category kCMTagCategory_ProjectionType and the value kCMTagProjectionType_Equirectangular (OSType).
342    ///
343    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagprojectiontypeequirectangular?language=objc)
344    pub static kCMTagProjectionTypeEquirectangular: CMTag;
345}
346
347extern "C" {
348    /// A CMTag of category kCMTagCategory_ProjectionType and the value kCMProjectionType_HalfEquirectangular (OSType).
349    ///
350    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagprojectiontypehalfequirectangular?language=objc)
351    pub static kCMTagProjectionTypeHalfEquirectangular: CMTag;
352}
353
354extern "C" {
355    /// A CMTag of category kCMTagCategory_ProjectionType and the value kCMTagProjectionType_Fisheye (OSType).
356    ///
357    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagprojectiontypefisheye?language=objc)
358    pub static kCMTagProjectionTypeFisheye: CMTag;
359}
360
361extern "C" {
362    /// A CMTag of category kCMTagCategory_ProjectionType and the value kCMTagProjectionType_ParametricImmersive (OSType).
363    ///
364    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagprojectiontypeparametricimmersive?language=objc)
365    pub static kCMTagProjectionTypeParametricImmersive: CMTag;
366}
367
368/// Constants used with kCMTagCategory_PackingType to signal the nature of any packing applied in a buffer or channel.
369///
370/// A video packing can be one of several types including frame-packing for stereo views or texture atlasing. A CMTag having a CMTagCategory of kCMTagCategory_PackingType has a value that is an OSType indicating the kind of packing using a kCMPackingType_* constant.  Examples of frame-packing include side-by-side and over-under packing, There may be related CMTags if a kind of packing requires additional parameters. The requirements will be documented with the specific kind of packing.
371///
372/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmpackingtype?language=objc)
373// NS_ENUM
374#[repr(transparent)]
375#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
376pub struct CMPackingType(pub u64);
377impl CMPackingType {
378    #[doc(alias = "kCMPackingType_None")]
379    pub const None: Self = Self(0x6e6f6e65);
380    #[doc(alias = "kCMPackingType_SideBySide")]
381    pub const SideBySide: Self = Self(0x73696465);
382    #[doc(alias = "kCMPackingType_OverUnder")]
383    pub const OverUnder: Self = Self(0x6f766572);
384}
385
386#[cfg(feature = "objc2")]
387unsafe impl Encode for CMPackingType {
388    const ENCODING: Encoding = u64::ENCODING;
389}
390
391#[cfg(feature = "objc2")]
392unsafe impl RefEncode for CMPackingType {
393    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
394}
395
396extern "C" {
397    /// A CMTag of category kCMTagCategory_PackingType and the value kCMTagPackingType_None (OStype).
398    ///
399    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagpackingtypenone?language=objc)
400    pub static kCMTagPackingTypeNone: CMTag;
401}
402
403extern "C" {
404    /// A CMTag of category kCMTagCategory_PackingType and the value kCMTagPackingType_SideBySide (OStype).
405    ///
406    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagpackingtypesidebyside?language=objc)
407    pub static kCMTagPackingTypeSideBySide: CMTag;
408}
409
410extern "C" {
411    /// A CMTag of category kCMTagCategory_PackingType and the value kCMTagPackingType_OverUnder (OStype).
412    ///
413    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagpackingtypeoverunder?language=objc)
414    pub static kCMTagPackingTypeOverUnder: CMTag;
415}
416
417impl CMTag {
418    // TODO: pub fn CMTagGetCategory(tag: CMTag,) -> CMTagCategory;
419}
420
421impl CMTagCategory {
422    // TODO: pub fn CMTagCategoryEqualToTagCategory(tag1: CMTag,tag2: CMTag,) -> Boolean;
423}
424
425impl CMTag {
426    // TODO: pub fn CMTagGetValue(tag: CMTag,) -> CMTagValue;
427
428    // TODO: pub fn CMTagHasCategory(tag: CMTag,category: CMTagCategory,) -> Boolean;
429
430    /// Checks if the tag represents a signed 64-bit value.
431    ///
432    /// Parameter `tag`: CMTag to evaluate.
433    ///
434    /// Returns: Returns true if the CMTag carries a signed 64-bit value indicated by a data type of kCMTagDataType_SInt64, false otherwise.
435    #[doc(alias = "CMTagHasSInt64Value")]
436    #[inline]
437    pub unsafe fn has_s_int64_value(self) -> bool {
438        extern "C-unwind" {
439            fn CMTagHasSInt64Value(tag: CMTag) -> Boolean;
440        }
441        let ret = unsafe { CMTagHasSInt64Value(self) };
442        ret != 0
443    }
444
445    /// Returns the signed 64-bit value carried by the CMTag.
446    ///
447    /// This should only be called on a CMTag with a data type of kCMTagDataType_SInt64. Calling it with a CMTag having another data type is undefined.
448    ///
449    /// Parameter `tag`: CMTag to evaluate.
450    ///
451    /// Returns: Signed 64-bit integer.
452    #[doc(alias = "CMTagGetSInt64Value")]
453    #[inline]
454    pub unsafe fn s_int64_value(self) -> i64 {
455        extern "C-unwind" {
456            fn CMTagGetSInt64Value(tag: CMTag) -> i64;
457        }
458        unsafe { CMTagGetSInt64Value(self) }
459    }
460
461    /// Checks if the tag represents a 64-bit float value.
462    ///
463    /// Parameter `tag`: CMTag to evaluate.
464    ///
465    /// Returns: Returns true if the CMTag carries a 64-bit float indicated by a data type of kCMTagDataType_Float64, false otherwise.
466    #[doc(alias = "CMTagHasFloat64Value")]
467    #[inline]
468    pub unsafe fn has_float64_value(self) -> bool {
469        extern "C-unwind" {
470            fn CMTagHasFloat64Value(tag: CMTag) -> Boolean;
471        }
472        let ret = unsafe { CMTagHasFloat64Value(self) };
473        ret != 0
474    }
475
476    /// Returns the 64-bit floating point value carried by the CMTag.
477    ///
478    /// This should only be called on a CMTag with a data type of kCMTagDataType_Float64. Calling it with a CMTag having another data type is undefined.
479    ///
480    /// Parameter `tag`: CMTag to evaluate.
481    ///
482    /// Returns: 64-bit float.
483    #[doc(alias = "CMTagGetFloat64Value")]
484    #[inline]
485    pub unsafe fn float64_value(self) -> f64 {
486        extern "C-unwind" {
487            fn CMTagGetFloat64Value(tag: CMTag) -> f64;
488        }
489        unsafe { CMTagGetFloat64Value(self) }
490    }
491
492    /// Checks if the tag represents an OSType value.
493    ///
494    /// Parameter `tag`: CMTag to evaluate.
495    ///
496    /// Returns: Returns true if the CMTag carries an OSType indicated by a data type of kCMTagDataType_OSType, false otherwise.
497    #[doc(alias = "CMTagHasOSTypeValue")]
498    #[inline]
499    pub unsafe fn has_os_type_value(self) -> bool {
500        extern "C-unwind" {
501            fn CMTagHasOSTypeValue(tag: CMTag) -> Boolean;
502        }
503        let ret = unsafe { CMTagHasOSTypeValue(self) };
504        ret != 0
505    }
506
507    /// Returns the single OSType value carried by the CMTag.
508    ///
509    /// This should only be called on a CMTag with a data type of kCMTagDataType_OSType. Calling it with a CMTag having another data type is undefined.
510    ///
511    /// Parameter `tag`: CMTag to evaluate.
512    ///
513    /// Returns: OSType.
514    #[doc(alias = "CMTagGetOSTypeValue")]
515    #[inline]
516    pub unsafe fn os_type_value(self) -> OSType {
517        extern "C-unwind" {
518            fn CMTagGetOSTypeValue(tag: CMTag) -> OSType;
519        }
520        unsafe { CMTagGetOSTypeValue(self) }
521    }
522
523    /// Checks if the tag represents an flags value.
524    ///
525    /// Parameter `tag`: CMTag to evaluate.
526    ///
527    /// Returns: Returns true if the CMTag carries 64 bits of flags indicated by a data type of kCMTagDataType_Flags, false otherwise.
528    #[doc(alias = "CMTagHasFlagsValue")]
529    #[inline]
530    pub unsafe fn has_flags_value(self) -> bool {
531        extern "C-unwind" {
532            fn CMTagHasFlagsValue(tag: CMTag) -> Boolean;
533        }
534        let ret = unsafe { CMTagHasFlagsValue(self) };
535        ret != 0
536    }
537
538    /// Returns the 64 bits of flags as an unsigned 64-bit integer carried by the CMTag.
539    ///
540    /// This should only be called on a CMTag with a data type of kCMTagDataType_Flags. Calling it with a CMTag having another data type is undefined.
541    ///
542    /// Parameter `tag`: CMTag to evaluate.
543    ///
544    /// Returns: Unsigned 64-bit integer holding the flags value.
545    #[doc(alias = "CMTagGetFlagsValue")]
546    #[inline]
547    pub unsafe fn flags_value(self) -> u64 {
548        extern "C-unwind" {
549            fn CMTagGetFlagsValue(tag: CMTag) -> u64;
550        }
551        unsafe { CMTagGetFlagsValue(self) }
552    }
553
554    /// Create a CMTag holding a signed 64-bit integer.
555    ///
556    /// This function creates a valid CMTag with the data type kCMTagDataType_SInt64 and have a signed 64-bit integer value.
557    ///
558    /// Parameter `category`: CMTagCategory for the created CMTag.
559    ///
560    /// Parameter `value`: A signed 64-bit integer to encode in the returned CMTag.
561    ///
562    /// Returns: A CMTag.
563    #[doc(alias = "CMTagMakeWithSInt64Value")]
564    #[inline]
565    pub unsafe fn with_s_int64_value(category: CMTagCategory, value: i64) -> CMTag {
566        extern "C-unwind" {
567            fn CMTagMakeWithSInt64Value(category: CMTagCategory, value: i64) -> CMTag;
568        }
569        unsafe { CMTagMakeWithSInt64Value(category, value) }
570    }
571
572    /// Create a CMTag holding a 64-bit float.
573    ///
574    /// This function creates a valid CMTag with the data type kCMTagDataType_Float64 and have a 64-bit floating point value.
575    ///
576    /// Parameter `category`: CMTagCategory for the created CMTag.
577    ///
578    /// Parameter `value`: A 64-bit float to encode in the returned CMTag.
579    ///
580    /// Returns: A CMTag.
581    #[doc(alias = "CMTagMakeWithFloat64Value")]
582    #[inline]
583    pub unsafe fn with_float64_value(category: CMTagCategory, value: f64) -> CMTag {
584        extern "C-unwind" {
585            fn CMTagMakeWithFloat64Value(category: CMTagCategory, value: f64) -> CMTag;
586        }
587        unsafe { CMTagMakeWithFloat64Value(category, value) }
588    }
589
590    /// Create a CMTag holding an OSType.
591    ///
592    /// This function creates a valid CMTag with the data type kCMTagDataType_OSType and have an OSType value.
593    ///
594    /// Parameter `category`: CMTagCategory for the created CMTag.
595    ///
596    /// Parameter `value`: An OSType to encode in the returned CMTag.
597    ///
598    /// Returns: A CMTag.
599    #[doc(alias = "CMTagMakeWithOSTypeValue")]
600    #[inline]
601    pub unsafe fn with_os_type_value(category: CMTagCategory, value: OSType) -> CMTag {
602        extern "C-unwind" {
603            fn CMTagMakeWithOSTypeValue(category: CMTagCategory, value: OSType) -> CMTag;
604        }
605        unsafe { CMTagMakeWithOSTypeValue(category, value) }
606    }
607
608    /// Create a CMTag holding a 64 bits of flags.
609    ///
610    /// This function creates a valid CMTag with the data type kCMTagDataType_Flags and has an unsigned 64-bit integer value holding the flags.
611    ///
612    /// Parameter `category`: CMTagCategory for the created CMTag.
613    ///
614    /// Parameter `flagsForTag`: An unsigned 64-bit integer to encode in the returned CMTag.
615    ///
616    /// Returns: A CMTag.
617    #[doc(alias = "CMTagMakeWithFlagsValue")]
618    #[inline]
619    pub unsafe fn with_flags_value(category: CMTagCategory, flags_for_tag: u64) -> CMTag {
620        extern "C-unwind" {
621            fn CMTagMakeWithFlagsValue(category: CMTagCategory, flags_for_tag: u64) -> CMTag;
622        }
623        unsafe { CMTagMakeWithFlagsValue(category, flags_for_tag) }
624    }
625
626    /// Tests if two CMTags are equal.
627    ///
628    /// Function evaluates if two tags are structurally equivalent. It performs a field by field comparison.
629    ///
630    /// Parameter `tag1`: First CMTag to test for equality.
631    ///
632    /// Parameter `tag2`: Second CMTag to test for equality.
633    ///
634    /// Returns: Returns true if the two tags are equal, false otherwise.
635    #[doc(alias = "CMTagEqualToTag")]
636    #[inline]
637    pub unsafe fn equal_to_tag(self, tag2: CMTag) -> bool {
638        extern "C-unwind" {
639            fn CMTagEqualToTag(tag1: CMTag, tag2: CMTag) -> Boolean;
640        }
641        let ret = unsafe { CMTagEqualToTag(self, tag2) };
642        ret != 0
643    }
644
645    /// Compares two CMTags in an ordered fashion returning a CFComparisonResult based upon the ordering of the tags.
646    ///
647    /// The entirety of a CMTag can be compared against a second CMTag in an ordered way.  The details of how the comparison is performed is an internal implementation detail. The comparison is performed as tag1 COMPARISON tag2 where COMPARISON is the ordering operation.  The ordering will be stable under a release of the framework but may change in the future. Therefore, an ordered CMTag array serialized in one version of the framework should not be assumed to be ordered the same in another version of the framework. This is best handled by retrieving the original array of CMTags and then reinserting with the new order.
648    ///
649    /// Parameter `tag1`: First CMTag to compare in ordered fashion.
650    ///
651    /// Parameter `tag2`: Second CMTag to compare in ordered fashion.
652    ///
653    /// Returns: The CFComparisonResult indicating the order of tag1 compared to tag2.
654    #[doc(alias = "CMTagCompare")]
655    #[inline]
656    pub unsafe fn compare(self, tag2: CMTag) -> CFComparisonResult {
657        extern "C-unwind" {
658            fn CMTagCompare(tag1: CMTag, tag2: CMTag) -> CFComparisonResult;
659        }
660        unsafe { CMTagCompare(self, tag2) }
661    }
662}
663
664impl CMTagCategory {
665    // TODO: pub fn CMTagCategoryValueEqualToValue(tag1: CMTag,tag2: CMTag,) -> Boolean;
666}
667
668impl CMTag {
669    /// Calculates a hash code for the CMTag.
670    ///
671    /// Parameter `tag`: CMTag to hash.
672    ///
673    /// Returns: The created CFHashCode.
674    #[doc(alias = "CMTagHash")]
675    #[inline]
676    pub unsafe fn hash(self) -> CFHashCode {
677        extern "C-unwind" {
678            fn CMTagHash(tag: CMTag) -> CFHashCode;
679        }
680        unsafe { CMTagHash(self) }
681    }
682
683    /// Creates a CFString with a description of a CMTag (just like CFCopyDescription).
684    ///
685    /// This can be used from within CFShow on an object that contains CMTag fields. It is also useful from other client debugging code.  The caller owns the returned CFString, and is responsible for releasing it.  Descriptions are not localized so are likely suitable only for debugging.
686    ///
687    /// Parameter `allocator`: CFAllocator to use in creating the description string.  Pass kCFAllocatorDefault to use the default allocator.
688    ///
689    /// Parameter `tag`: CMTag to describe.
690    ///
691    /// Returns: The created CFString description.
692    #[doc(alias = "CMTagCopyDescription")]
693    #[inline]
694    pub unsafe fn description(
695        allocator: Option<&CFAllocator>,
696        tag: CMTag,
697    ) -> Option<CFRetained<CFString>> {
698        extern "C-unwind" {
699            fn CMTagCopyDescription(
700                allocator: Option<&CFAllocator>,
701                tag: CMTag,
702            ) -> Option<NonNull<CFString>>;
703        }
704        let ret = unsafe { CMTagCopyDescription(allocator, tag) };
705        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
706    }
707
708    /// Returns a CFDictionary version of a CMTag.
709    ///
710    /// This is useful when putting CMTag in CF container types.  The caller owns the returned CFDictionary, and is responsible for releasing it.
711    ///
712    /// Parameter `tag`: The CMTag from which to create the dictionary.
713    ///
714    /// Parameter `allocator`: CFAllocator with which to create a dictionary. Pass kCFAllocatorDefault to use the default allocator.
715    ///
716    /// Returns: A CFDictionary version of the CMTag.
717    #[doc(alias = "CMTagCopyAsDictionary")]
718    #[inline]
719    pub unsafe fn as_dictionary(
720        self,
721        allocator: Option<&CFAllocator>,
722    ) -> Option<CFRetained<CFDictionary>> {
723        extern "C-unwind" {
724            fn CMTagCopyAsDictionary(
725                tag: CMTag,
726                allocator: Option<&CFAllocator>,
727            ) -> Option<NonNull<CFDictionary>>;
728        }
729        let ret = unsafe { CMTagCopyAsDictionary(self, allocator) };
730        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
731    }
732
733    /// Reconstitutes a CMTag struct from a CFDictionary previously created by CMTagCopyAsDictionary.
734    ///
735    /// This is useful when getting CMTag from CF container types.  If the CFDictionary does not have the requisite keyed values, kCMTagInvalid is returned.
736    ///
737    /// Parameter `dict`: A CFDictionary from which to create a CMTag.
738    ///
739    /// Returns: The created CMTag.
740    ///
741    /// # Safety
742    ///
743    /// `dict` generics must be of the correct type.
744    #[doc(alias = "CMTagMakeFromDictionary")]
745    #[inline]
746    pub unsafe fn from_dictionary(dict: &CFDictionary) -> CMTag {
747        extern "C-unwind" {
748            fn CMTagMakeFromDictionary(dict: &CFDictionary) -> CMTag;
749        }
750        unsafe { CMTagMakeFromDictionary(dict) }
751    }
752}
753
754extern "C" {
755    /// CFDictionary key for value field of a CMTag.
756    ///
757    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagvaluekey?language=objc)
758    pub static kCMTagValueKey: &'static CFString;
759}
760
761extern "C" {
762    /// CFDictionary key for category field of a CMTag.
763    ///
764    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagcategorykey?language=objc)
765    pub static kCMTagCategoryKey: &'static CFString;
766}
767
768extern "C" {
769    /// CFDictionary key for dataType field of a CMTag.
770    ///
771    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtagdatatypekey?language=objc)
772    pub static kCMTagDataTypeKey: &'static CFString;
773}
774
775impl CMTag {
776    // TODO: pub fn CMTagGetCategory(tag: CMTag,) -> CMTagCategory;
777
778    // TODO: pub fn CMTagGetValue(tag: CMTag,) -> CMTagValue;
779
780    // TODO: pub fn CMTagHasCategory(tag: CMTag,category: CMTagCategory,) -> Boolean;
781}
782
783impl CMTagCategory {
784    // TODO: pub fn CMTagCategoryEqualToTagCategory(tag1: CMTag,tag2: CMTag,) -> Boolean;
785}
786
787impl CMTag {
788    // TODO: pub fn CMTagIsValid(tag: CMTag,) -> Boolean;
789}
790
791impl CMTagCategory {
792    // TODO: pub fn CMTagCategoryValueEqualToValue(tag1: CMTag,tag2: CMTag,) -> Boolean;
793}
794
795extern "C-unwind" {
796    #[deprecated = "renamed to `CMTag::value_data_type`"]
797    pub fn CMTagGetValueDataType(tag: CMTag) -> CMTagDataType;
798}
799
800#[deprecated = "renamed to `CMTag::has_s_int64_value`"]
801#[inline]
802pub unsafe extern "C-unwind" fn CMTagHasSInt64Value(tag: CMTag) -> bool {
803    extern "C-unwind" {
804        fn CMTagHasSInt64Value(tag: CMTag) -> Boolean;
805    }
806    let ret = unsafe { CMTagHasSInt64Value(tag) };
807    ret != 0
808}
809
810extern "C-unwind" {
811    #[deprecated = "renamed to `CMTag::s_int64_value`"]
812    pub fn CMTagGetSInt64Value(tag: CMTag) -> i64;
813}
814
815#[deprecated = "renamed to `CMTag::has_float64_value`"]
816#[inline]
817pub unsafe extern "C-unwind" fn CMTagHasFloat64Value(tag: CMTag) -> bool {
818    extern "C-unwind" {
819        fn CMTagHasFloat64Value(tag: CMTag) -> Boolean;
820    }
821    let ret = unsafe { CMTagHasFloat64Value(tag) };
822    ret != 0
823}
824
825extern "C-unwind" {
826    #[deprecated = "renamed to `CMTag::float64_value`"]
827    pub fn CMTagGetFloat64Value(tag: CMTag) -> f64;
828}
829
830#[deprecated = "renamed to `CMTag::has_os_type_value`"]
831#[inline]
832pub unsafe extern "C-unwind" fn CMTagHasOSTypeValue(tag: CMTag) -> bool {
833    extern "C-unwind" {
834        fn CMTagHasOSTypeValue(tag: CMTag) -> Boolean;
835    }
836    let ret = unsafe { CMTagHasOSTypeValue(tag) };
837    ret != 0
838}
839
840extern "C-unwind" {
841    #[deprecated = "renamed to `CMTag::os_type_value`"]
842    pub fn CMTagGetOSTypeValue(tag: CMTag) -> OSType;
843}
844
845#[deprecated = "renamed to `CMTag::has_flags_value`"]
846#[inline]
847pub unsafe extern "C-unwind" fn CMTagHasFlagsValue(tag: CMTag) -> bool {
848    extern "C-unwind" {
849        fn CMTagHasFlagsValue(tag: CMTag) -> Boolean;
850    }
851    let ret = unsafe { CMTagHasFlagsValue(tag) };
852    ret != 0
853}
854
855extern "C-unwind" {
856    #[deprecated = "renamed to `CMTag::flags_value`"]
857    pub fn CMTagGetFlagsValue(tag: CMTag) -> u64;
858}
859
860extern "C-unwind" {
861    #[deprecated = "renamed to `CMTag::with_s_int64_value`"]
862    pub fn CMTagMakeWithSInt64Value(category: CMTagCategory, value: i64) -> CMTag;
863}
864
865extern "C-unwind" {
866    #[deprecated = "renamed to `CMTag::with_float64_value`"]
867    pub fn CMTagMakeWithFloat64Value(category: CMTagCategory, value: f64) -> CMTag;
868}
869
870extern "C-unwind" {
871    #[deprecated = "renamed to `CMTag::with_os_type_value`"]
872    pub fn CMTagMakeWithOSTypeValue(category: CMTagCategory, value: OSType) -> CMTag;
873}
874
875extern "C-unwind" {
876    #[deprecated = "renamed to `CMTag::with_flags_value`"]
877    pub fn CMTagMakeWithFlagsValue(category: CMTagCategory, flags_for_tag: u64) -> CMTag;
878}
879
880#[deprecated = "renamed to `CMTag::equal_to_tag`"]
881#[inline]
882pub unsafe extern "C-unwind" fn CMTagEqualToTag(tag1: CMTag, tag2: CMTag) -> bool {
883    extern "C-unwind" {
884        fn CMTagEqualToTag(tag1: CMTag, tag2: CMTag) -> Boolean;
885    }
886    let ret = unsafe { CMTagEqualToTag(tag1, tag2) };
887    ret != 0
888}
889
890extern "C-unwind" {
891    #[deprecated = "renamed to `CMTag::compare`"]
892    pub fn CMTagCompare(tag1: CMTag, tag2: CMTag) -> CFComparisonResult;
893}
894
895extern "C-unwind" {
896    #[deprecated = "renamed to `CMTag::hash`"]
897    pub fn CMTagHash(tag: CMTag) -> CFHashCode;
898}
899
900#[deprecated = "renamed to `CMTag::description`"]
901#[inline]
902pub unsafe extern "C-unwind" fn CMTagCopyDescription(
903    allocator: Option<&CFAllocator>,
904    tag: CMTag,
905) -> Option<CFRetained<CFString>> {
906    extern "C-unwind" {
907        fn CMTagCopyDescription(
908            allocator: Option<&CFAllocator>,
909            tag: CMTag,
910        ) -> Option<NonNull<CFString>>;
911    }
912    let ret = unsafe { CMTagCopyDescription(allocator, tag) };
913    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
914}
915
916#[deprecated = "renamed to `CMTag::as_dictionary`"]
917#[inline]
918pub unsafe extern "C-unwind" fn CMTagCopyAsDictionary(
919    tag: CMTag,
920    allocator: Option<&CFAllocator>,
921) -> Option<CFRetained<CFDictionary>> {
922    extern "C-unwind" {
923        fn CMTagCopyAsDictionary(
924            tag: CMTag,
925            allocator: Option<&CFAllocator>,
926        ) -> Option<NonNull<CFDictionary>>;
927    }
928    let ret = unsafe { CMTagCopyAsDictionary(tag, allocator) };
929    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
930}
931
932extern "C-unwind" {
933    #[deprecated = "renamed to `CMTag::from_dictionary`"]
934    pub fn CMTagMakeFromDictionary(dict: &CFDictionary) -> CMTag;
935}