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