objc2_av_foundation/generated/
AVCaptureTimecodeGenerator.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-media")]
11use objc2_core_media::*;
12use objc2_foundation::*;
13
14use crate::*;
15
16/// Defines possible sources for generating timecode in using a timecode generator.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetimecodesourcetype?language=objc)
19// NS_ENUM
20#[repr(transparent)]
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
22pub struct AVCaptureTimecodeSourceType(pub NSInteger);
23impl AVCaptureTimecodeSourceType {
24    /// No internal or external source is adopted. Timecodes are zero-based, sequentially generated frame counts.
25    #[doc(alias = "AVCaptureTimecodeSourceTypeFrameCount")]
26    pub const FrameCount: Self = Self(0);
27    /// Synchronizes timecode to the system clock for real-time applications. Useful for live events or scenarios requiring alignment with the actual time of day.
28    #[doc(alias = "AVCaptureTimecodeSourceTypeRealTimeClock")]
29    pub const RealTimeClock: Self = Self(1);
30    /// Synchronizes timecode to an external timecode data stream. Ideal for professional audio and video synchronization with external quarter-frame MIDI or HID timecode hardware.
31    #[doc(alias = "AVCaptureTimecodeSourceTypeExternal")]
32    pub const External: Self = Self(2);
33}
34
35unsafe impl Encode for AVCaptureTimecodeSourceType {
36    const ENCODING: Encoding = NSInteger::ENCODING;
37}
38
39unsafe impl RefEncode for AVCaptureTimecodeSourceType {
40    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43/// Constants defining the synchronization status of a timecode generator .
44///
45/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetimecodegeneratorsynchronizationstatus?language=objc)
46// NS_ENUM
47#[repr(transparent)]
48#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
49pub struct AVCaptureTimecodeGeneratorSynchronizationStatus(pub NSInteger);
50impl AVCaptureTimecodeGeneratorSynchronizationStatus {
51    /// The initial state before a source is selected or during error conditions.
52    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusUnknown")]
53    pub const Unknown: Self = Self(0);
54    /// A timecode source has been selected, but synchronization has not yet started.
55    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusSourceSelected")]
56    pub const SourceSelected: Self = Self(1);
57    /// The timecode generator is actively synchronizing to the selected source.
58    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusSynchronizing")]
59    pub const Synchronizing: Self = Self(2);
60    /// The timecode generator is successfully synchronized to the selected source, maintaining active timing alignment.
61    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusSynchronized")]
62    pub const Synchronized: Self = Self(3);
63    /// The synchronization has timed out.
64    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusTimedOut")]
65    pub const TimedOut: Self = Self(4);
66    /// The timecode generator has failed to establish a connection with a given source.
67    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusSourceUnavailable")]
68    pub const SourceUnavailable: Self = Self(5);
69    /// The timecode generator is receiving data from the source in an unrecognized format.
70    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusSourceUnsupported")]
71    pub const SourceUnsupported: Self = Self(6);
72    /// The timecode generator does not require active synchronization for a given source.
73    #[doc(alias = "AVCaptureTimecodeGeneratorSynchronizationStatusNotRequired")]
74    pub const NotRequired: Self = Self(7);
75}
76
77unsafe impl Encode for AVCaptureTimecodeGeneratorSynchronizationStatus {
78    const ENCODING: Encoding = NSInteger::ENCODING;
79}
80
81unsafe impl RefEncode for AVCaptureTimecodeGeneratorSynchronizationStatus {
82    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
83}
84
85extern_class!(
86    /// Describes a timecode source that a timecode generator can synchronize to.
87    ///
88    /// `AVCaptureTimecodeSource` provides information about a specific timecode source available for synchronization in `AVCaptureTimecodeGenerator`. It includes metadata such as the source’s name, type, and unique identifier.
89    ///
90    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetimecodesource?language=objc)
91    #[unsafe(super(NSObject))]
92    #[derive(Debug, PartialEq, Eq, Hash)]
93    pub struct AVCaptureTimecodeSource;
94);
95
96extern_conformance!(
97    unsafe impl NSCopying for AVCaptureTimecodeSource {}
98);
99
100unsafe impl CopyingHelper for AVCaptureTimecodeSource {
101    type Result = Self;
102}
103
104extern_conformance!(
105    unsafe impl NSObjectProtocol for AVCaptureTimecodeSource {}
106);
107
108impl AVCaptureTimecodeSource {
109    extern_methods!(
110        /// The name of the timecode source.
111        ///
112        /// This property provides a descriptive name of the timecode source, useful for display in user interfaces or logging.
113        #[unsafe(method(displayName))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn displayName(&self) -> Retained<NSString>;
116
117        /// The type of timecode source.
118        ///
119        /// Indicates the type of timecode source, represented as a value from the ``AVCaptureTimecodeSynchronizationSourceType`` enum. This helps you identify the source for specific synchronization use cases, such as frame counter, real-time clock, MIDI, or HID.
120        #[unsafe(method(type))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn r#type(&self) -> AVCaptureTimecodeSourceType;
123
124        /// A unique identifier for the timecode source.
125        ///
126        /// The UUID uniquely identifies this timecode source. It is particularly useful when multiple sources of the same type are available, allowing your application to distinguish between them.
127        ///
128        /// - Note: This value does not persist across application sessions.
129        #[unsafe(method(uuid))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn uuid(&self) -> Retained<NSUUID>;
132    );
133}
134
135/// Methods declared on superclass `NSObject`.
136impl AVCaptureTimecodeSource {
137    extern_methods!(
138        #[unsafe(method(init))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
141
142        #[unsafe(method(new))]
143        #[unsafe(method_family = new)]
144        pub unsafe fn new() -> Retained<Self>;
145    );
146}
147
148/// This structure represents a timecode, adhering to SMPTE standards, which define precise time information and associated timestamps for video or audio synchronization.
149///
150/// This structure corresponds to the SMPTE 12M-1 Linear Timecode (LTC) format, widely used for professional video and audio synchronization.
151///
152/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetimecode?language=objc)
153#[cfg(feature = "objc2-core-media")]
154#[repr(C)]
155#[derive(Clone, Copy, Debug, PartialEq)]
156pub struct AVCaptureTimecode {
157    /// Time component representing the current timecode in hours.
158    pub hours: u8,
159    /// Time component representing the current timecode in minutes.
160    pub minutes: u8,
161    /// Time component representing the current timecode in seconds.
162    pub seconds: u8,
163    /// Frame component of the timecode, indicating the frame count within the second.
164    pub frames: u8,
165    /// A 32-bit field carrying SMPTE user bits, which are not strictly standardized. User bits are often used for additional metadata such as scene-take information, reel numbers, or dates, but their exact usage is application-dependent.
166    pub userBits: u32,
167    /// Frame duration of the timecode. If unknown, the value is `kCMTimeInvalid`.
168    pub frameDuration: CMTime,
169    /// Source type of the timecode, indicating the emitter, carriage, or transport mechanism.
170    pub sourceType: AVCaptureTimecodeSourceType,
171}
172
173#[cfg(feature = "objc2-core-media")]
174unsafe impl Encode for AVCaptureTimecode {
175    const ENCODING: Encoding = Encoding::Struct(
176        "?",
177        &[
178            <u8>::ENCODING,
179            <u8>::ENCODING,
180            <u8>::ENCODING,
181            <u8>::ENCODING,
182            <u32>::ENCODING,
183            <CMTime>::ENCODING,
184            <AVCaptureTimecodeSourceType>::ENCODING,
185        ],
186    );
187}
188
189#[cfg(feature = "objc2-core-media")]
190unsafe impl RefEncode for AVCaptureTimecode {
191    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
192}
193
194#[cfg(feature = "objc2-core-media")]
195impl AVCaptureTimecode {
196    /// Creates a sample buffer containing Timecode Media Description metadata for integration with a video track.
197    ///
198    /// - Parameter timecode: The ``AVCaptureTimecode`` instance providing the timecode details to encode.
199    /// - Parameter presentationTimeStamp: The presentation time stamp that determines the exact moment in the media timeline where the metadata should be applied. It is embedded in the sample timing info (``CMSampleTimingInfo``) and ensures that the packaged metadata synchronizes accurately with the corresponding video frame.
200    /// - Returns: A ``CMSampleBufferRef`` with the encoded Timecode Media Description metadata for video synchronization, or `nil` if sample buffer creation fails.
201    #[doc(alias = "AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp")]
202    #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-media"))]
203    #[inline]
204    pub unsafe fn metadata_sample_buffer_associated_with_presentation_time_stamp(
205        self,
206        presentation_time_stamp: CMTime,
207    ) -> Option<CFRetained<CMSampleBuffer>> {
208        extern "C-unwind" {
209            fn AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp(
210                timecode: AVCaptureTimecode,
211                presentation_time_stamp: CMTime,
212            ) -> Option<NonNull<CMSampleBuffer>>;
213        }
214        let ret = unsafe {
215            AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp(
216                self,
217                presentation_time_stamp,
218            )
219        };
220        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
221    }
222
223    /// Creates a sample buffer containing Timecode Media Description metadata for a specified duration.
224    ///
225    /// - Parameter timecode: The ``AVCaptureTimecode`` instance providing the timecode details for the metadata sample.
226    /// - Parameter duration: The duration that the metadata sample buffer should represent.
227    /// - Returns: A ``CMSampleBufferRef`` with encoded Timecode Media Description metadata for the given duration, or `nil` if sample buffer creation fails.
228    ///
229    /// Use this function for scenarios where timecode metadata needs to span a custom interval (not just a single frame), such as non-frame-accurate workflows or for describing a segment of media with a consistent timecode.
230    #[doc(alias = "AVCaptureTimecodeCreateMetadataSampleBufferForDuration")]
231    #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-media"))]
232    #[inline]
233    pub unsafe fn metadata_sample_buffer_for_duration(
234        self,
235        duration: CMTime,
236    ) -> Option<CFRetained<CMSampleBuffer>> {
237        extern "C-unwind" {
238            fn AVCaptureTimecodeCreateMetadataSampleBufferForDuration(
239                timecode: AVCaptureTimecode,
240                duration: CMTime,
241            ) -> Option<NonNull<CMSampleBuffer>>;
242        }
243        let ret = unsafe { AVCaptureTimecodeCreateMetadataSampleBufferForDuration(self, duration) };
244        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
245    }
246
247    /// Generates a new timecode by adding a specified number of frames to the given timecode, handling overflow for seconds, minutes, and hours.
248    ///
249    /// - Parameter timecode: The original ``AVCaptureTimecode`` to be incremented.
250    /// - Parameter framesToAdd: The number of frames to add to the timecode.
251    /// - Returns: A new ``AVCaptureTimecode`` struct with the updated time values after adding the specified frames.
252    #[doc(alias = "AVCaptureTimecodeAdvancedByFrames")]
253    #[cfg(feature = "objc2-core-media")]
254    #[inline]
255    pub unsafe fn advanced_by_frames(self, frames_to_add: i64) -> AVCaptureTimecode {
256        extern "C-unwind" {
257            fn AVCaptureTimecodeAdvancedByFrames(
258                timecode: AVCaptureTimecode,
259                frames_to_add: i64,
260            ) -> AVCaptureTimecode;
261        }
262        unsafe { AVCaptureTimecodeAdvancedByFrames(self, frames_to_add) }
263    }
264}
265
266extern_protocol!(
267    /// A protocol for receiving real-time timecode updates and error notifications from a timecode generator.
268    ///
269    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetimecodegeneratordelegate?language=objc)
270    pub unsafe trait AVCaptureTimecodeGeneratorDelegate: NSObjectProtocol {
271        #[cfg(feature = "objc2-core-media")]
272        /// Notifies the delegate when new, unaligned timecodes are parsed from the specified source.
273        ///
274        /// - Parameter generator: The timecode generator providing the update.
275        /// - Parameter timecode: The updated timecode data.
276        /// - Parameter source: The source from which the timecode was received.
277        #[unsafe(method(timecodeGenerator:didReceiveUpdate:fromSource:))]
278        #[unsafe(method_family = none)]
279        unsafe fn timecodeGenerator_didReceiveUpdate_fromSource(
280            &self,
281            generator: &AVCaptureTimecodeGenerator,
282            timecode: AVCaptureTimecode,
283            source: &AVCaptureTimecodeSource,
284        );
285
286        /// Notifies the delegate when the synchronization status of a timecode source changes.
287        ///
288        /// - Parameter generator: The ``AVCaptureTimecodeGenerator`` instance providing the status update.
289        /// - Parameter synchronizationStatus: The updated synchronization state.
290        /// - Parameter source: The internal or external source to which the generator synchronizes.
291        #[unsafe(method(timecodeGenerator:transitionedToSynchronizationStatus:forSource:))]
292        #[unsafe(method_family = none)]
293        unsafe fn timecodeGenerator_transitionedToSynchronizationStatus_forSource(
294            &self,
295            generator: &AVCaptureTimecodeGenerator,
296            synchronization_status: AVCaptureTimecodeGeneratorSynchronizationStatus,
297            source: &AVCaptureTimecodeSource,
298        );
299
300        /// Notifies the delegate when the list of available timecode synchronization sources is updated.
301        ///
302        /// - Parameter generator: The ``AVCaptureTimecodeGenerator`` instance providing the source list update.
303        /// - Parameter availableSources: An array of ``AVCaptureTimecodeSource`` objects representing the available timecode synchronization sources.
304        #[unsafe(method(timecodeGenerator:didUpdateAvailableSources:))]
305        #[unsafe(method_family = none)]
306        unsafe fn timecodeGenerator_didUpdateAvailableSources(
307            &self,
308            generator: &AVCaptureTimecodeGenerator,
309            available_sources: &NSArray<AVCaptureTimecodeSource>,
310        );
311    }
312);
313
314extern_class!(
315    /// Generates and synchronizes timecode data from various sources for precise video and audio synchronization.
316    ///
317    /// The ``AVCaptureTimecodeGenerator`` class supports multiple timecode sources, including frame counting, system clock synchronization, and MIDI timecode input (MTC). Suitable for playback, recording, or other time-sensitive operations where precise timecode metadata is required.
318    ///
319    /// Use the ``startSynchronizationWithTimecodeSource:`` method to set up the desired timecode source.
320    ///
321    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetimecodegenerator?language=objc)
322    #[unsafe(super(NSObject))]
323    #[derive(Debug, PartialEq, Eq, Hash)]
324    pub struct AVCaptureTimecodeGenerator;
325);
326
327extern_conformance!(
328    unsafe impl NSObjectProtocol for AVCaptureTimecodeGenerator {}
329);
330
331impl AVCaptureTimecodeGenerator {
332    extern_methods!(
333        /// An array of available timecode synchronization sources that can be used by the timecode generator.
334        ///
335        /// This property provides a list of ``AVCaptureTimecodeSource`` objects representing the available timecode sources with which the generator can synchronize. The sources may include built-in options such as the frame counter and real-time clock, as well as dynamically detected sources such as connected MIDI or HID devices.
336        ///
337        /// This array is key-value observable, allowing you to monitor changes in real-time. For example, when a new MIDI device is connected, the array is updated to include the corresponding timecode source.
338        ///
339        /// - Returns: A read-only array of ``AVCaptureTimecodeSource`` objects representing the available timecode synchronization sources.
340        #[unsafe(method(availableSources))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn availableSources(&self) -> Retained<NSArray<AVCaptureTimecodeSource>>;
343
344        /// The active timecode source used by ``AVCaptureTimecodeGenerator`` to maintain clock synchronization for accurate timecode generation.
345        ///
346        /// Indicates the active timecode source, as defined in the ``AVCaptureTimecodeSynchronizationSourceType`` enum. If an ``AVCaptureTimecodeGenerator`` becomes disconnected from its source, it continues generating timecodes using historical data from its ring buffer. This approach allows the generator to maintain synchronization during brief disruptions, as is common in cinema workflows where timecode signals may experience discontinuities.
347        #[unsafe(method(currentSource))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn currentSource(&self) -> Retained<AVCaptureTimecodeSource>;
350
351        /// The delegate that receives timecode updates from the timecode generator.
352        ///
353        /// You can use your ``delegate`` to receive real-time timecode updates. Implement the ``timecodeGenerator:didReceiveUpdate:`` method in your delegate to handle updates.
354        #[unsafe(method(delegate))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn delegate(
357            &self,
358        ) -> Option<Retained<ProtocolObject<dyn AVCaptureTimecodeGeneratorDelegate>>>;
359
360        #[cfg(feature = "dispatch2")]
361        /// The dispatch queue on which delegate callbacks are invoked.
362        ///
363        /// Provides the queue set in ``setDelegate:queue:``. If no delegate is assigned, this property is `nil`.
364        #[unsafe(method(delegateCallbackQueue))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn delegateCallbackQueue(&self) -> Option<Retained<DispatchQueue>>;
367
368        #[cfg(feature = "dispatch2")]
369        /// Assigns a delegate to receive real-time timecode updates and specifies a queue for callbacks.
370        ///
371        /// - Parameter delegate: An object conforming to the ``AVCaptureTimecodeGeneratorDelegate`` protocol.
372        /// - Parameter callbackQueue: The dispatch queue on which the delegate methods are invoked. The `callbackQueue` parameter may not be `nil`, except when setting the ``AVCaptureTimecodeGeneratorDelegate`` to `nil`, otherwise ``setDelegate:queue:`` throws an `NSInvalidArgumentException`.
373        ///
374        /// Use this method to configure a delegate that handles timecode updates. The specified `queue` ensures thread-safe invocation of delegate methods.
375        ///
376        /// # Safety
377        ///
378        /// `callback_queue` possibly has additional threading requirements.
379        #[unsafe(method(setDelegate:queue:))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn setDelegate_queue(
382            &self,
383            delegate: Option<&ProtocolObject<dyn AVCaptureTimecodeGeneratorDelegate>>,
384            callback_queue: Option<&DispatchQueue>,
385        );
386
387        /// The maximum time interval allowed for source synchronization attempts before timing out.
388        ///
389        /// This property specifies the duration, in seconds, that the ``AVCaptureTimecodeGenerator`` will attempt to synchronize with a timecode source before timing out if synchronization cannot be achieved. If this threshold is exceeded, the synchronization status updates to reflect a timeout, and your ``AVCaptureTimecodeGeneratorDelegate/timecodeGenerator:transitionedToSynchronizationStatus:forSource:`` delegate method fires, informing you of the event. The default value is 15 seconds.
390        #[unsafe(method(synchronizationTimeout))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn synchronizationTimeout(&self) -> NSTimeInterval;
393
394        /// Setter for [`synchronizationTimeout`][Self::synchronizationTimeout].
395        #[unsafe(method(setSynchronizationTimeout:))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn setSynchronizationTimeout(&self, synchronization_timeout: NSTimeInterval);
398
399        /// The time offset, in seconds, applied to the generated timecode.
400        ///
401        /// This offset allows fine-tuning of time alignment for synchronization with external sources or to accommodate any intentional delay. The default value is 0 seconds.
402        #[unsafe(method(timecodeAlignmentOffset))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn timecodeAlignmentOffset(&self) -> NSTimeInterval;
405
406        /// Setter for [`timecodeAlignmentOffset`][Self::timecodeAlignmentOffset].
407        #[unsafe(method(setTimecodeAlignmentOffset:))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn setTimecodeAlignmentOffset(&self, timecode_alignment_offset: NSTimeInterval);
410
411        #[cfg(feature = "objc2-core-media")]
412        /// The frame duration that the generator will use to generate timecodes.
413        #[unsafe(method(timecodeFrameDuration))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn timecodeFrameDuration(&self) -> CMTime;
416
417        #[cfg(feature = "objc2-core-media")]
418        /// Setter for [`timecodeFrameDuration`][Self::timecodeFrameDuration].
419        #[unsafe(method(setTimecodeFrameDuration:))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn setTimecodeFrameDuration(&self, timecode_frame_duration: CMTime);
422
423        /// Synchronizes the generator with the specified timecode source.
424        ///
425        /// - Parameter source: The timecode source for synchronization.
426        #[unsafe(method(startSynchronizationWithTimecodeSource:))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn startSynchronizationWithTimecodeSource(
429            &self,
430            source: &AVCaptureTimecodeSource,
431        );
432
433        #[cfg(feature = "objc2-core-media")]
434        /// Generates an initial timecode intended to be the first in a sequence.
435        ///
436        /// - Returns: A populated ``AVCaptureTimecode`` structure.
437        #[unsafe(method(generateInitialTimecode))]
438        #[unsafe(method_family = none)]
439        pub unsafe fn generateInitialTimecode(&self) -> AVCaptureTimecode;
440
441        /// A frame counter timecode source that operates independently of any internal or external synchronization.
442        ///
443        /// This class property represents a standalone timecode source that advances based purely on frame count, independent of any real-time or external synchronization. It is ideal for scenarios where a simple, self-contained timing reference is sufficient, without requiring alignment to system clocks or external devices.
444        #[unsafe(method(frameCountSource))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn frameCountSource() -> Retained<AVCaptureTimecodeSource>;
447
448        /// A predefined timecode source synchronized to the real-time system clock.
449        ///
450        /// This class property provides a default timecode source based on the real-time system clock, requiring no external device. It is ideal for live events or scenarios where alignment with the current time of day is necessary.
451        #[unsafe(method(realTimeClockSource))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn realTimeClockSource() -> Retained<AVCaptureTimecodeSource>;
454    );
455}
456
457/// Methods declared on superclass `NSObject`.
458impl AVCaptureTimecodeGenerator {
459    extern_methods!(
460        #[unsafe(method(init))]
461        #[unsafe(method_family = init)]
462        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
463
464        #[unsafe(method(new))]
465        #[unsafe(method_family = new)]
466        pub unsafe fn new() -> Retained<Self>;
467    );
468}
469
470#[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-media"))]
471#[deprecated = "renamed to `AVCaptureTimecode::metadata_sample_buffer_associated_with_presentation_time_stamp`"]
472#[inline]
473pub unsafe extern "C-unwind" fn AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp(
474    timecode: AVCaptureTimecode,
475    presentation_time_stamp: CMTime,
476) -> Option<CFRetained<CMSampleBuffer>> {
477    extern "C-unwind" {
478        fn AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp(
479            timecode: AVCaptureTimecode,
480            presentation_time_stamp: CMTime,
481        ) -> Option<NonNull<CMSampleBuffer>>;
482    }
483    let ret = unsafe {
484        AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp(
485            timecode,
486            presentation_time_stamp,
487        )
488    };
489    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
490}
491
492#[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-media"))]
493#[deprecated = "renamed to `AVCaptureTimecode::metadata_sample_buffer_for_duration`"]
494#[inline]
495pub unsafe extern "C-unwind" fn AVCaptureTimecodeCreateMetadataSampleBufferForDuration(
496    timecode: AVCaptureTimecode,
497    duration: CMTime,
498) -> Option<CFRetained<CMSampleBuffer>> {
499    extern "C-unwind" {
500        fn AVCaptureTimecodeCreateMetadataSampleBufferForDuration(
501            timecode: AVCaptureTimecode,
502            duration: CMTime,
503        ) -> Option<NonNull<CMSampleBuffer>>;
504    }
505    let ret = unsafe { AVCaptureTimecodeCreateMetadataSampleBufferForDuration(timecode, duration) };
506    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
507}
508
509extern "C-unwind" {
510    #[cfg(feature = "objc2-core-media")]
511    #[deprecated = "renamed to `AVCaptureTimecode::advanced_by_frames`"]
512    pub fn AVCaptureTimecodeAdvancedByFrames(
513        timecode: AVCaptureTimecode,
514        frames_to_add: i64,
515    ) -> AVCaptureTimecode;
516}