objc2_core_video/generated/
CVBase.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// Flags to be used for the display and render call back functions.
10///
11/// ***Values to be defined***
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvoptionflags?language=objc)
14pub type CVOptionFlags = u64;
15
16/// A structure for holding a SMPTE time.
17/// Field: subframes
18/// The number of subframes in the full message.
19/// Field: subframeDivisor
20/// The number of subframes per frame (typically 80).
21/// Field: counter
22/// The total number of messages received.
23/// Field: type
24/// The kind of SMPTE time using the SMPTE time type constants.
25/// Field: flags
26/// A set of flags that indicate the SMPTE state.
27/// Field: hours
28/// The number of hours in the full message.
29/// Field: minutes
30/// The number of minutes in the full message.
31/// Field: seconds
32/// The number of seconds in the full message.
33/// Field: frames
34/// The number of frames in the full message.
35///
36/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvsmptetime?language=objc)
37#[repr(C)]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub struct CVSMPTETime {
40    pub subframes: i16,
41    pub subframeDivisor: i16,
42    pub counter: u32,
43    pub r#type: u32,
44    pub flags: u32,
45    pub hours: i16,
46    pub minutes: i16,
47    pub seconds: i16,
48    pub frames: i16,
49}
50
51#[cfg(feature = "objc2")]
52unsafe impl Encode for CVSMPTETime {
53    const ENCODING: Encoding = Encoding::Struct(
54        "CVSMPTETime",
55        &[
56            <i16>::ENCODING,
57            <i16>::ENCODING,
58            <u32>::ENCODING,
59            <u32>::ENCODING,
60            <u32>::ENCODING,
61            <i16>::ENCODING,
62            <i16>::ENCODING,
63            <i16>::ENCODING,
64            <i16>::ENCODING,
65        ],
66    );
67}
68
69#[cfg(feature = "objc2")]
70unsafe impl RefEncode for CVSMPTETime {
71    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
72}
73
74unsafe impl Send for CVSMPTETime {}
75
76unsafe impl Sync for CVSMPTETime {}
77
78/// Constants that describe the type of SMPTE time.
79///
80/// 24 Frame
81///
82/// 25 Frame
83///
84/// 30 Drop Frame
85///
86/// 30 Frame
87///
88/// 29.97 Frame
89///
90/// 29.97 Drop Frame
91///
92/// 60 Frame
93///
94/// 59.94 Frame
95///
96/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvsmptetimetype?language=objc)
97// NS_ENUM
98#[repr(transparent)]
99#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
100pub struct CVSMPTETimeType(pub u32);
101impl CVSMPTETimeType {
102    #[doc(alias = "kCVSMPTETimeType24")]
103    pub const Type24: Self = Self(0);
104    #[doc(alias = "kCVSMPTETimeType25")]
105    pub const Type25: Self = Self(1);
106    #[doc(alias = "kCVSMPTETimeType30Drop")]
107    pub const Type30Drop: Self = Self(2);
108    #[doc(alias = "kCVSMPTETimeType30")]
109    pub const Type30: Self = Self(3);
110    #[doc(alias = "kCVSMPTETimeType2997")]
111    pub const Type2997: Self = Self(4);
112    #[doc(alias = "kCVSMPTETimeType2997Drop")]
113    pub const Type2997Drop: Self = Self(5);
114    #[doc(alias = "kCVSMPTETimeType60")]
115    pub const Type60: Self = Self(6);
116    #[doc(alias = "kCVSMPTETimeType5994")]
117    pub const Type5994: Self = Self(7);
118}
119
120#[cfg(feature = "objc2")]
121unsafe impl Encode for CVSMPTETimeType {
122    const ENCODING: Encoding = u32::ENCODING;
123}
124
125#[cfg(feature = "objc2")]
126unsafe impl RefEncode for CVSMPTETimeType {
127    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
128}
129
130unsafe impl Send for CVSMPTETimeType {}
131
132unsafe impl Sync for CVSMPTETimeType {}
133
134/// Flags that describe the SMPTE time state.
135///
136/// The full time is valid.
137///
138/// Time is running.
139///
140/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvsmptetimeflags?language=objc)
141// NS_OPTIONS
142#[repr(transparent)]
143#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
144pub struct CVSMPTETimeFlags(pub u32);
145bitflags::bitflags! {
146    impl CVSMPTETimeFlags: u32 {
147        #[doc(alias = "kCVSMPTETimeValid")]
148        const Valid = 1<<0;
149        #[doc(alias = "kCVSMPTETimeRunning")]
150        const Running = 1<<1;
151    }
152}
153
154#[cfg(feature = "objc2")]
155unsafe impl Encode for CVSMPTETimeFlags {
156    const ENCODING: Encoding = u32::ENCODING;
157}
158
159#[cfg(feature = "objc2")]
160unsafe impl RefEncode for CVSMPTETimeFlags {
161    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
162}
163
164unsafe impl Send for CVSMPTETimeFlags {}
165
166unsafe impl Sync for CVSMPTETimeFlags {}
167
168/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvtimeflags?language=objc)
169// NS_OPTIONS
170#[repr(transparent)]
171#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
172pub struct CVTimeFlags(pub i32);
173bitflags::bitflags! {
174    impl CVTimeFlags: i32 {
175        #[doc(alias = "kCVTimeIsIndefinite")]
176        const IsIndefinite = 1<<0;
177    }
178}
179
180#[cfg(feature = "objc2")]
181unsafe impl Encode for CVTimeFlags {
182    const ENCODING: Encoding = i32::ENCODING;
183}
184
185#[cfg(feature = "objc2")]
186unsafe impl RefEncode for CVTimeFlags {
187    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
188}
189
190unsafe impl Send for CVTimeFlags {}
191
192unsafe impl Sync for CVTimeFlags {}
193
194/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvtime?language=objc)
195#[repr(C)]
196#[derive(Clone, Copy, Debug, PartialEq)]
197pub struct CVTime {
198    pub timeValue: i64,
199    pub timeScale: i32,
200    pub flags: i32,
201}
202
203#[cfg(feature = "objc2")]
204unsafe impl Encode for CVTime {
205    const ENCODING: Encoding =
206        Encoding::Struct("?", &[<i64>::ENCODING, <i32>::ENCODING, <i32>::ENCODING]);
207}
208
209#[cfg(feature = "objc2")]
210unsafe impl RefEncode for CVTime {
211    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
212}
213
214extern "C" {
215    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvzerotime?language=objc)
216    pub static kCVZeroTime: CVTime;
217}
218
219extern "C" {
220    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvindefinitetime?language=objc)
221    pub static kCVIndefiniteTime: CVTime;
222}
223
224/// CoreVideo uses a CVTimeStamp structure to store video display time stamps.
225///
226/// This structure is purposely very similar to AudioTimeStamp defined in the CoreAudio framework.
227/// Most of the CVTimeStamp struct should be fairly self-explanatory. However, it is probably worth pointing out that unlike the audio time stamps, floats are not used to represent the video equivalent of sample times. This was done partly to avoid precision issues, and partly because QuickTime still uses integers for time values and time scales. In the actual implementation it has turned out to be very convenient to use integers, and we can represent framerates like NTSC (30000/1001 fps) exactly. The mHostTime structure field uses the same Mach absolute time base that is used in CoreAudio, so that clients of the CoreVideo API can synchronize between the two subsystems.
228/// Field: version The current CVTimeStamp is version 0.
229/// Field: videoTimeScale The scale (in units per second) of the videoTime and videoPeriod values
230/// Field: videoTime This represents the start of a frame (or field for interlaced)
231/// Field: hostTime Host root timebase time
232/// Field: rateScalar This is the current rate of the device as measured by the timestamps, divided by the nominal rate
233/// Field: videoRefreshPeriod This is the nominal update period of the current output device
234/// Field: smpteTime SMPTE time representation of the time stamp.
235/// Field: flags Possible values are:
236/// kCVTimeStampVideoTimeValid
237/// kCVTimeStampHostTimeValid
238/// kCVTimeStampSMPTETimeValid
239/// kCVTimeStampVideoPeriodValid
240/// kCVTimeStampRateScalarValid
241/// There are flags for each field to make it easier to detect interlaced vs progressive output
242/// kCVTimeStampTopField
243/// kCVTimeStampBottomField
244/// Some commonly used combinations of timestamp flags
245/// kCVTimeStampVideoHostTimeValid
246/// kCVTimeStampIsInterlaced
247/// Field: reserved Reserved. Do not use.
248///
249/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvtimestamp?language=objc)
250#[repr(C)]
251#[derive(Clone, Copy, Debug, PartialEq)]
252pub struct CVTimeStamp {
253    pub version: u32,
254    pub videoTimeScale: i32,
255    pub videoTime: i64,
256    pub hostTime: u64,
257    pub rateScalar: c_double,
258    pub videoRefreshPeriod: i64,
259    pub smpteTime: CVSMPTETime,
260    pub flags: u64,
261    pub reserved: u64,
262}
263
264#[cfg(feature = "objc2")]
265unsafe impl Encode for CVTimeStamp {
266    const ENCODING: Encoding = Encoding::Struct(
267        "?",
268        &[
269            <u32>::ENCODING,
270            <i32>::ENCODING,
271            <i64>::ENCODING,
272            <u64>::ENCODING,
273            <c_double>::ENCODING,
274            <i64>::ENCODING,
275            <CVSMPTETime>::ENCODING,
276            <u64>::ENCODING,
277            <u64>::ENCODING,
278        ],
279    );
280}
281
282#[cfg(feature = "objc2")]
283unsafe impl RefEncode for CVTimeStamp {
284    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
285}
286
287/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvtimestampflags?language=objc)
288// NS_OPTIONS
289#[repr(transparent)]
290#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
291pub struct CVTimeStampFlags(pub u64);
292bitflags::bitflags! {
293    impl CVTimeStampFlags: u64 {
294        #[doc(alias = "kCVTimeStampVideoTimeValid")]
295        const VideoTimeValid = 1<<0;
296        #[doc(alias = "kCVTimeStampHostTimeValid")]
297        const HostTimeValid = 1<<1;
298        #[doc(alias = "kCVTimeStampSMPTETimeValid")]
299        const SMPTETimeValid = 1<<2;
300        #[doc(alias = "kCVTimeStampVideoRefreshPeriodValid")]
301        const VideoRefreshPeriodValid = 1<<3;
302        #[doc(alias = "kCVTimeStampRateScalarValid")]
303        const RateScalarValid = 1<<4;
304        #[doc(alias = "kCVTimeStampTopField")]
305        const TopField = 1<<16;
306        #[doc(alias = "kCVTimeStampBottomField")]
307        const BottomField = 1<<17;
308        #[doc(alias = "kCVTimeStampVideoHostTimeValid")]
309        const VideoHostTimeValid = CVTimeStampFlags::VideoTimeValid.0|CVTimeStampFlags::HostTimeValid.0;
310        #[doc(alias = "kCVTimeStampIsInterlaced")]
311        const IsInterlaced = CVTimeStampFlags::TopField.0|CVTimeStampFlags::BottomField.0;
312    }
313}
314
315#[cfg(feature = "objc2")]
316unsafe impl Encode for CVTimeStampFlags {
317    const ENCODING: Encoding = u64::ENCODING;
318}
319
320#[cfg(feature = "objc2")]
321unsafe impl RefEncode for CVTimeStampFlags {
322    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
323}
324
325unsafe impl Send for CVTimeStampFlags {}
326
327unsafe impl Sync for CVTimeStampFlags {}