objc2_av_foundation/generated/
AVAssetTrack.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15    /// An AVAssetTrack object provides provides the track-level inspection interface for all assets.
16    ///
17    /// AVAssetTrack adopts the AVAsynchronousKeyValueLoading protocol. Methods in the protocol should be used to access a track's properties without blocking the current thread. To cancel load requests for all keys of AVAssetTrack one must message the parent AVAsset object (for example, [track.asset cancelLoading]).
18    ///
19    /// For clients who want to examine a subset of the metadata or other parts of the track, asynchronous methods like -loadMetadataForFormat:completionHandler: can be used to load this information without blocking. When using these asynchronous methods, it is not necessary to load the associated property beforehand. Swift clients can also use the load(:) method to load properties in a type safe manner.
20    ///
21    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassettrack?language=objc)
22    #[unsafe(super(NSObject))]
23    #[derive(Debug, PartialEq, Eq, Hash)]
24    pub struct AVAssetTrack;
25);
26
27#[cfg(feature = "AVAsynchronousKeyValueLoading")]
28extern_conformance!(
29    unsafe impl AVAsynchronousKeyValueLoading for AVAssetTrack {}
30);
31
32extern_conformance!(
33    unsafe impl NSCopying for AVAssetTrack {}
34);
35
36unsafe impl CopyingHelper for AVAssetTrack {
37    type Result = Self;
38}
39
40extern_conformance!(
41    unsafe impl NSObjectProtocol for AVAssetTrack {}
42);
43
44impl AVAssetTrack {
45    extern_methods!(
46        #[unsafe(method(init))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
49
50        #[unsafe(method(new))]
51        #[unsafe(method_family = new)]
52        pub unsafe fn new() -> Retained<Self>;
53
54        #[cfg(feature = "AVAsset")]
55        /// Provides a reference to the AVAsset of which the AVAssetTrack is a part
56        #[unsafe(method(asset))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn asset(&self) -> Option<Retained<AVAsset>>;
59
60        #[cfg(feature = "objc2-core-media")]
61        /// Indicates the persistent unique identifier for this track of the asset
62        #[unsafe(method(trackID))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn trackID(&self) -> CMPersistentTrackID;
65    );
66}
67
68/// AVAssetTrackBasicPropertiesAndCharacteristics.
69impl AVAssetTrack {
70    extern_methods!(
71        #[cfg(feature = "AVMediaFormat")]
72        /// Indicates the media type for this track, e.g. AVMediaTypeVideo, AVMediaTypeAudio, etc., as defined in AVMediaFormat.h.
73        #[unsafe(method(mediaType))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;
76
77        /// Provides an array of CMFormatDescriptions each of which indicates the format of media samples referenced by the track; a track that presents uniform media, e.g. encoded according to the same encoding settings, will provide an array with a count of 1.
78        #[unsafe(method(formatDescriptions))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn formatDescriptions(&self) -> Retained<NSArray>;
81
82        /// Indicates whether the receiver is playable in the current environment; if YES, an AVPlayerItemTrack of an AVPlayerItem initialized with the receiver's asset can be enabled for playback.
83        #[unsafe(method(isPlayable))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn isPlayable(&self) -> bool;
86
87        /// Indicates whether the receiver is decodable in the current environment; if YES, the track can be decoded even though decoding may be too slow for real time playback.
88        #[unsafe(method(isDecodable))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn isDecodable(&self) -> bool;
91
92        /// Indicates whether the track is enabled according to state stored in its container or construct; note that its presentation state can be changed from this default via AVPlayerItemTrack
93        #[unsafe(method(isEnabled))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn isEnabled(&self) -> bool;
96
97        /// Indicates whether the track references sample data only within its storage container
98        #[unsafe(method(isSelfContained))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn isSelfContained(&self) -> bool;
101
102        /// Indicates the total number of bytes of sample data required by the track
103        #[unsafe(method(totalSampleDataLength))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn totalSampleDataLength(&self) -> c_longlong;
106
107        #[cfg(feature = "AVMediaFormat")]
108        /// Reports whether the track references media with the specified media characteristic.
109        ///
110        /// - Parameter mediaCharacteristic: The media characteristic of interest, e.g. AVMediaCharacteristicVisual, AVMediaCharacteristicAudible, AVMediaCharacteristicLegible, etc., as defined above.
111        ///
112        /// - Returns: YES if the track references media with the specified characteristic, otherwise NO.
113        #[unsafe(method(hasMediaCharacteristic:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn hasMediaCharacteristic(
116            &self,
117            media_characteristic: &AVMediaCharacteristic,
118        ) -> bool;
119    );
120}
121
122/// AVAssetTrackTemporalProperties.
123impl AVAssetTrack {
124    extern_methods!(
125        #[cfg(feature = "objc2-core-media")]
126        /// Indicates the timeRange of the track within the overall timeline of the asset; a track with CMTIME_COMPARE_INLINE(timeRange.start, >, kCMTimeZero) will initially present an empty interval.
127        #[unsafe(method(timeRange))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn timeRange(&self) -> CMTimeRange;
130
131        #[cfg(feature = "objc2-core-media")]
132        /// Indicates a timescale in which time values for the track can be operated upon without extraneous numerical conversion
133        #[unsafe(method(naturalTimeScale))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn naturalTimeScale(&self) -> CMTimeScale;
136
137        /// Indicates the estimated data rate of the media data referenced by the track, in units of bits per second
138        #[unsafe(method(estimatedDataRate))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn estimatedDataRate(&self) -> c_float;
141    );
142}
143
144/// AVAssetTrackLanguageProperties.
145impl AVAssetTrack {
146    extern_methods!(
147        /// Indicates the language associated with the track, as an ISO 639-2/T language code; may be nil if no language is indicated
148        #[unsafe(method(languageCode))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn languageCode(&self) -> Option<Retained<NSString>>;
151
152        /// Indicates the language tag associated with the track, as an IETF BCP 47 (RFC 4646) language identifier; may be nil if no language tag is indicated
153        #[unsafe(method(extendedLanguageTag))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn extendedLanguageTag(&self) -> Option<Retained<NSString>>;
156    );
157}
158
159/// AVAssetTrackPropertiesForVisualCharacteristic.
160impl AVAssetTrack {
161    extern_methods!(
162        #[cfg(feature = "objc2-core-foundation")]
163        /// Indicates the natural dimensions of the media data referenced by the track as a CGSize
164        #[unsafe(method(naturalSize))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn naturalSize(&self) -> CGSize;
167
168        #[cfg(feature = "objc2-core-foundation")]
169        /// Indicates the transform specified in the track's storage container as the preferred transformation of the visual media data for display purposes; its value is often but not always CGAffineTransformIdentity
170        #[unsafe(method(preferredTransform))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn preferredTransform(&self) -> CGAffineTransform;
173    );
174}
175
176/// AVAssetTrackPropertiesForAudibleCharacteristic.
177impl AVAssetTrack {
178    extern_methods!(
179        /// Indicates the volume specified in the track's storage container as the preferred volume of the audible media data
180        #[unsafe(method(preferredVolume))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn preferredVolume(&self) -> c_float;
183
184        /// Indicates whether this audio track has dependencies (e.g. kAudioFormatMPEGD_USAC)
185        #[unsafe(method(hasAudioSampleDependencies))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn hasAudioSampleDependencies(&self) -> bool;
188    );
189}
190
191/// AVAssetTrackPropertiesForFrameBasedCharacteristic.
192impl AVAssetTrack {
193    extern_methods!(
194        /// For tracks that carry a full frame per media sample, indicates the frame rate of the track in units of frames per second.
195        ///
196        /// For field-based video tracks that carry one field per media sample, the value of this property is the field rate, not the frame rate.
197        #[unsafe(method(nominalFrameRate))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn nominalFrameRate(&self) -> c_float;
200
201        #[cfg(feature = "objc2-core-media")]
202        /// Indicates the minimum duration of the track's frames; the value will be kCMTimeInvalid if the minimum frame duration is not known or cannot be calculated
203        #[unsafe(method(minFrameDuration))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn minFrameDuration(&self) -> CMTime;
206
207        /// Indicates whether samples in the track may have different values for their presentation and decode timestamps.
208        #[unsafe(method(requiresFrameReordering))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn requiresFrameReordering(&self) -> bool;
211    );
212}
213
214/// AVAssetTrackSegments.
215impl AVAssetTrack {
216    extern_methods!(
217        #[cfg(feature = "AVAssetTrackSegment")]
218        /// Provides an array of AVAssetTrackSegments with time mappings from the timeline of the track's media samples to the timeline of the track. Empty edits, i.e. timeRanges for which no media data is available to be presented, have a value of AVAssetTrackSegment.empty equal to YES.
219        #[unsafe(method(segments))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn segments(&self) -> Retained<NSArray<AVAssetTrackSegment>>;
222
223        #[cfg(all(feature = "AVAssetTrackSegment", feature = "objc2-core-media"))]
224        /// Supplies the AVAssetTrackSegment from the segments array with a target timeRange that either contains the specified track time or is the closest to it among the target timeRanges of the track's segments.
225        ///
226        /// If the trackTime does not map to a sample presentation time (e.g. it's outside the track's timeRange), the segment closest in time to the specified trackTime is returned.
227        ///
228        /// - Parameter trackTime: The trackTime for which an AVAssetTrackSegment is requested.
229        ///
230        /// - Returns: An AVAssetTrackSegment.
231        #[deprecated = "Use loadSegmentForTrackTime:completionHandler: instead"]
232        #[unsafe(method(segmentForTrackTime:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn segmentForTrackTime(
235            &self,
236            track_time: CMTime,
237        ) -> Option<Retained<AVAssetTrackSegment>>;
238
239        #[cfg(all(
240            feature = "AVAssetTrackSegment",
241            feature = "block2",
242            feature = "objc2-core-media"
243        ))]
244        /// Loads the AVAssetTrackSegment from the segments array with a target timeRange that either contains the specified track time or is the closest to it among the target timeRanges of the track's segments.
245        ///
246        /// If the trackTime does not map to a sample presentation time (e.g. it's outside the track's timeRange), the segment closest in time to the specified trackTime is returned.
247        ///
248        /// - Parameter trackTime: The trackTime for which an AVAssetTrackSegment is requested.
249        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending an AVAssetTrackSegment or an error.
250        ///
251        /// # Safety
252        ///
253        /// `completion_handler` block must be sendable.
254        #[unsafe(method(loadSegmentForTrackTime:completionHandler:))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn loadSegmentForTrackTime_completionHandler(
257            &self,
258            track_time: CMTime,
259            completion_handler: &block2::DynBlock<dyn Fn(*mut AVAssetTrackSegment, *mut NSError)>,
260        );
261
262        #[cfg(feature = "objc2-core-media")]
263        /// Maps the specified trackTime through the appropriate time mapping and returns the resulting sample presentation time.
264        ///
265        /// - Parameter trackTime: The trackTime for which a sample presentation time is requested.
266        ///
267        /// - Returns: A CMTime; will be invalid if the trackTime is out of range
268        #[deprecated = "Use loadSamplePresentationTimeForTrackTime:completionHandler: instead"]
269        #[unsafe(method(samplePresentationTimeForTrackTime:))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn samplePresentationTimeForTrackTime(&self, track_time: CMTime) -> CMTime;
272
273        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
274        /// Maps the specified trackTime through the appropriate time mapping and loads the resulting sample presentation time.
275        ///
276        /// - Parameter trackTime: The trackTime for which a sample presentation time is requested.
277        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending a CMTime (which will be invalid if the trackTime is out of range) or an error.
278        ///
279        /// # Safety
280        ///
281        /// `completion_handler` block must be sendable.
282        #[unsafe(method(loadSamplePresentationTimeForTrackTime:completionHandler:))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn loadSamplePresentationTimeForTrackTime_completionHandler(
285            &self,
286            track_time: CMTime,
287            completion_handler: &block2::DynBlock<dyn Fn(CMTime, *mut NSError)>,
288        );
289    );
290}
291
292/// AVAssetTrackMetadataReading.
293impl AVAssetTrack {
294    extern_methods!(
295        #[cfg(feature = "AVMetadataItem")]
296        /// Provides access to an array of AVMetadataItems for each common metadata key for which a value is available
297        #[unsafe(method(commonMetadata))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn commonMetadata(&self) -> Retained<NSArray<AVMetadataItem>>;
300
301        #[cfg(feature = "AVMetadataItem")]
302        /// Provides access to an array of AVMetadataItems for all metadata identifiers for which a value is available; items can be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:] and according to identifier via +[AVMetadataItem metadataItemsFromArray:filteredByIdentifier:].
303        #[unsafe(method(metadata))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn metadata(&self) -> Retained<NSArray<AVMetadataItem>>;
306
307        #[cfg(feature = "AVMetadataFormat")]
308        /// Provides an NSArray of NSStrings, each representing a format of metadata that's available for the track (e.g. QuickTime userdata, etc.) Metadata formats are defined in AVMetadataItem.h.
309        #[unsafe(method(availableMetadataFormats))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn availableMetadataFormats(&self) -> Retained<NSArray<AVMetadataFormat>>;
312
313        #[cfg(all(feature = "AVMetadataFormat", feature = "AVMetadataItem"))]
314        /// Provides an NSArray of AVMetadataItems, one for each metadata item in the container of the specified format.
315        ///
316        /// Becomes callable without blocking when the key
317        /// "
318        /// availableMetadataFormats" has been loaded
319        ///
320        /// - Parameter format: The metadata format for which items are requested.
321        ///
322        /// - Returns: An NSArray containing AVMetadataItems.
323        #[deprecated = "Use loadMetadataForFormat:completionHandler: instead"]
324        #[unsafe(method(metadataForFormat:))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn metadataForFormat(
327            &self,
328            format: &AVMetadataFormat,
329        ) -> Retained<NSArray<AVMetadataItem>>;
330
331        #[cfg(all(
332            feature = "AVMetadataFormat",
333            feature = "AVMetadataItem",
334            feature = "block2"
335        ))]
336        /// Loads an NSArray of AVMetadataItems, one for each metadata item in the container of the specified format.
337        ///
338        /// - Parameter format: The metadata format for which items are requested.
339        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending the array of metadata items (which may be empty if there is no metadata of the specified format) or an error.
340        ///
341        /// # Safety
342        ///
343        /// `completion_handler` block must be sendable.
344        #[unsafe(method(loadMetadataForFormat:completionHandler:))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn loadMetadataForFormat_completionHandler(
347            &self,
348            format: &AVMetadataFormat,
349            completion_handler: &block2::DynBlock<
350                dyn Fn(*mut NSArray<AVMetadataItem>, *mut NSError),
351            >,
352        );
353    );
354}
355
356/// The type of a track association.
357///
358/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtype?language=objc)
359// NS_TYPED_ENUM
360pub type AVTrackAssociationType = NSString;
361
362extern "C" {
363    /// Indicates an association between an audio track with another audio track that contains the same content but is typically encoded in a different format that's more widely supported, used to nominate a track that should be used in place of an unsupported track.
364    ///
365    /// Associations of type AVTrackAssociationTypeAudioFallback are supported only between audio tracks. This association is not symmetric; when used with -[AVAssetWriterInput addTrackAssociationWithTrackOfInput:type:], the receiver should be an instance of AVAssetWriterInput with a corresponding track that has content that's less widely supported, and the input parameter should be an instance of AVAssetWriterInput with a corresponding track that has content that's more widely supported.
366    ///
367    /// Example: Using AVTrackAssociationTypeAudioFallback, a stereo audio track with media subtype kAudioFormatMPEG4AAC could be nominated as the "fallback" for an audio track encoding the same source material but with media subtype kAudioFormatAC3 and a 5.1 channel layout. This would ensure that all clients are capable of playing back some form of the audio.
368    ///
369    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtypeaudiofallback?language=objc)
370    pub static AVTrackAssociationTypeAudioFallback: &'static AVTrackAssociationType;
371}
372
373extern "C" {
374    /// Indicates an association between a track with another track that contains chapter information. The track containing chapter information may be a text track, a video track, or a timed metadata track.
375    ///
376    /// This association is not symmetric; when used with -[AVAssetWriterInput addTrackAssociationWithTrackOfInput:type:], the receiver should be an instance of AVAssetWriterInput with a corresponding track that has renderable content while the input parameter should be an instance of AVAssetWriterInput with a corresponding track that contains chapter metadata.
377    ///
378    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtypechapterlist?language=objc)
379    pub static AVTrackAssociationTypeChapterList: &'static AVTrackAssociationType;
380}
381
382extern "C" {
383    /// Indicates an association between a subtitle track typically containing both forced and non-forced subtitles with another subtitle track that contains only forced subtitles, for use when the user indicates that only essential subtitles should be displayed. When such an association is established, the forced subtitles in both tracks are expected to present the same content in the same language but may have different timing.
384    ///
385    /// Associations of type AVTrackAssociationTypeForcedSubtitlesOnly are supported only between subtitle tracks. This association is not symmetric; when used with -[AVAssetWriterInput addTrackAssociationWithTrackOfInput:type:], the receiver should be an instance of AVAssetWriterInput with a corresponding subtitle track that contains non-forced subtitles, and the input parameter should be an instance of AVAssetWriterInput with a corresponding subtitle track that contains forced subtitles only.
386    ///
387    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtypeforcedsubtitlesonly?language=objc)
388    pub static AVTrackAssociationTypeForcedSubtitlesOnly: &'static AVTrackAssociationType;
389}
390
391extern "C" {
392    /// Indicates an association between a pair of tracks that specifies that, when the first of the pair is selected, the second of the pair should be considered an appropriate default for selection also. Example: a subtitle track in the same language as an audio track may be associated with that audio track using AVTrackAssociationTypeSelectionFollower, to indicate that selection of the subtitle track, in the absence of a directive for subtitle selection from the user, can "follow" the selection of the audio track.
393    ///
394    /// This association is not symmetric; when used with -[AVAssetWriterInput addTrackAssociationWithTrackOfInput:type:], the input parameter should be an instance of AVAssetWriterInput whose selection may depend on the selection of the receiver. In the example above, the receiver would be the instance of AVAssetWriterInput corresponding with the audio track and the input parameter would be the instance of AVAssetWriterInput corresponding with the subtitle track.
395    ///
396    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtypeselectionfollower?language=objc)
397    pub static AVTrackAssociationTypeSelectionFollower: &'static AVTrackAssociationType;
398}
399
400extern "C" {
401    /// Indicates an association between a track with another track that contains timecode information. The track containing timecode information should be a timecode track.
402    ///
403    /// This association is not symmetric; when used with -[AVAssetWriterInput addTrackAssociationWithTrackOfInput:type:], the receiver should be an instance of AVAssetWriterInput with a corresponding track that may be a video track or an audio track while the input parameter should be an instance of AVAssetWriterInput with a corresponding timecode track.
404    ///
405    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtypetimecode?language=objc)
406    pub static AVTrackAssociationTypeTimecode: &'static AVTrackAssociationType;
407}
408
409extern "C" {
410    /// Indicates an association between a metadata track and the track that's described or annotated via the contents of the metadata track.
411    ///
412    /// This track association is optional for AVAssetTracks with the mediaType AVMediaTypeMetadata. When a metadata track lacks this track association, its contents are assumed to describe or annotate the asset as a whole.
413    /// This association is not symmetric; when used with -[AVAssetWriterInput addTrackAssociationWithTrackOfInput:type:], the receiver should be an instance of AVAssetWriterInput with mediaType AVMediaTypeMetadata while the input parameter should be an instance of AVAssetWriterInput that's used to create the track to which the contents of the receiver's corresponding metadata track refer.
414    ///
415    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtypemetadatareferent?language=objc)
416    pub static AVTrackAssociationTypeMetadataReferent: &'static AVTrackAssociationType;
417}
418
419extern "C" {
420    /// Indicates an association between a metadata track and another track where the metadata provides additional information for rendering of that track.
421    ///
422    /// This track association is not symmetric; when used with -[AVAssetWriterInput addTrackAssociationWithTrackOfInput:type:], the receiver should be an instance of AVAssetWriterInput with mediaType, AVMediaTypeMetadata, while the input parameter should be an instance of AVAssetWriterInput for the target track that would be rendered (for example, a video track).
423    ///
424    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avtrackassociationtyperendermetadatasource?language=objc)
425    pub static AVTrackAssociationTypeRenderMetadataSource: &'static AVTrackAssociationType;
426}
427
428/// AVAssetTrackTrackAssociations.
429impl AVAssetTrack {
430    extern_methods!(
431        /// Provides an NSArray of NSStrings, each representing a type of track association that the receiver has with one or more of the other tracks of the asset (e.g. AVTrackAssociationTypeChapterList, AVTrackAssociationTypeTimecode, etc.). Track association types are defined immediately above.
432        #[unsafe(method(availableTrackAssociationTypes))]
433        #[unsafe(method_family = none)]
434        pub unsafe fn availableTrackAssociationTypes(
435            &self,
436        ) -> Retained<NSArray<AVTrackAssociationType>>;
437
438        /// Provides an NSArray of AVAssetTracks, one for each track associated with the receiver with the specified type of track association.
439        ///
440        /// Becomes callable without blocking when the key
441        /// "
442        /// availableTrackAssociationTypes" has been loaded.
443        ///
444        /// - Parameter trackAssociationType: The type of track association for which associated tracks are requested.
445        ///
446        /// - Returns: An NSArray containing AVAssetTracks; may be empty if there is no associated tracks of the specified type.
447        #[deprecated = "Use loadAssociatedTracksOfType:completionHandler: instead"]
448        #[unsafe(method(associatedTracksOfType:))]
449        #[unsafe(method_family = none)]
450        pub unsafe fn associatedTracksOfType(
451            &self,
452            track_association_type: &AVTrackAssociationType,
453        ) -> Retained<NSArray<AVAssetTrack>>;
454
455        #[cfg(feature = "block2")]
456        /// Provides an NSArray of AVAssetTracks, one for each track associated with the receiver with the specified type of track association.
457        ///
458        /// - Parameter trackAssociationType: The type of track association for which associated tracks are requested.
459        /// - Parameter completionHandler: A block that is invoked when loading is comlete, vending an array of tracks (which may be empty if there is no associated tracks of the specified type) or an error. `
460        ///
461        /// # Safety
462        ///
463        /// `completion_handler` block must be sendable.
464        #[unsafe(method(loadAssociatedTracksOfType:completionHandler:))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn loadAssociatedTracksOfType_completionHandler(
467            &self,
468            track_association_type: &AVTrackAssociationType,
469            completion_handler: &block2::DynBlock<dyn Fn(*mut NSArray<AVAssetTrack>, *mut NSError)>,
470        );
471    );
472}
473
474/// AVAssetTrackSampleCursorProvision.
475impl AVAssetTrack {
476    extern_methods!(
477        /// Indicates whether the receiver can provide instances of AVSampleCursor for traversing its media samples and discovering information about them.
478        #[unsafe(method(canProvideSampleCursors))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn canProvideSampleCursors(&self) -> bool;
481
482        #[cfg(all(feature = "AVSampleCursor", feature = "objc2-core-media"))]
483        /// Creates an instance of AVSampleCursor and positions it at or near the specified presentation timestamp.
484        ///
485        /// If the receiver's asset has a value of YES for providesPreciseDurationAndTiming, the sample cursor will be accurately positioned at the receiver's last media sample with presentation timestamp less than or equal to the desired timestamp, or, if there are no such samples, the first sample in presentation order.
486        /// If the receiver's asset has a value of NO for providesPreciseDurationAndTiming, and it is prohibitively expensive to locate the precise sample at the desired timestamp, the sample cursor may be approximately positioned.
487        /// This method will return nil if there are no samples in the track.
488        ///
489        /// - Parameter presentationTimeStamp: The desired initial presentation timestamp of the returned AVSampleCursor.
490        ///
491        /// - Returns: An instance of AVSampleCursor.
492        #[unsafe(method(makeSampleCursorWithPresentationTimeStamp:))]
493        #[unsafe(method_family = none)]
494        pub unsafe fn makeSampleCursorWithPresentationTimeStamp(
495            &self,
496            presentation_time_stamp: CMTime,
497        ) -> Option<Retained<AVSampleCursor>>;
498
499        #[cfg(feature = "AVSampleCursor")]
500        /// Creates an instance of AVSampleCursor and positions it at the receiver's first media sample in decode order.
501        ///
502        /// This method will return nil if there are no samples in the track.
503        ///
504        /// - Returns: An instance of AVSampleCursor.
505        #[unsafe(method(makeSampleCursorAtFirstSampleInDecodeOrder))]
506        #[unsafe(method_family = none)]
507        pub unsafe fn makeSampleCursorAtFirstSampleInDecodeOrder(
508            &self,
509        ) -> Option<Retained<AVSampleCursor>>;
510
511        #[cfg(feature = "AVSampleCursor")]
512        /// Creates an instance of AVSampleCursor and positions it at the receiver's last media sample in decode order.
513        ///
514        /// This method will return nil if there are no samples in the track.
515        ///
516        /// - Returns: An instance of AVSampleCursor.
517        #[unsafe(method(makeSampleCursorAtLastSampleInDecodeOrder))]
518        #[unsafe(method_family = none)]
519        pub unsafe fn makeSampleCursorAtLastSampleInDecodeOrder(
520            &self,
521        ) -> Option<Retained<AVSampleCursor>>;
522    );
523}
524
525extern "C" {
526    /// Posted when the timeRange of an AVFragmentedAssetTrack changes while the associated instance of AVFragmentedAsset is being minded by an AVFragmentedAssetMinder, but only for changes that occur after the status of the value of
527    /// "
528    /// timeRange" has reached AVKeyValueStatusLoaded.
529    ///
530    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassettracktimerangedidchangenotification?language=objc)
531    pub static AVAssetTrackTimeRangeDidChangeNotification: &'static NSString;
532}
533
534extern "C" {
535    /// Posted when the array of segments of an AVFragmentedAssetTrack changes while the associated instance of AVFragmentedAsset is being minded by an AVFragmentedAssetMinder, but only for changes that occur after the status of the value of
536    /// "
537    /// segments" has reached AVKeyValueStatusLoaded.
538    ///
539    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassettracksegmentsdidchangenotification?language=objc)
540    pub static AVAssetTrackSegmentsDidChangeNotification: &'static NSString;
541}
542
543extern "C" {
544    /// Posted when the collection of track associations of an AVAssetTrack changes, but only for changes that occur after the status of the value of
545    /// "
546    /// availableTrackAssociationTypes" has reached AVKeyValueStatusLoaded.
547    ///
548    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassettracktrackassociationsdidchangenotification?language=objc)
549    pub static AVAssetTrackTrackAssociationsDidChangeNotification: &'static NSString;
550}
551
552extern_class!(
553    /// A subclass of AVAssetTrack for handling tracks of fragmented assets. An AVFragmentedAssetTrack is capable of changing the values of certain of its properties, if its parent asset is associated with an instance of AVFragmentedAssetMinder when one or more fragments are appended to the underlying media resource.
554    ///
555    /// While its parent asset is associated with an AVFragmentedAssetMinder, AVFragmentedAssetTrack posts AVAssetTrackTimeRangeDidChangeNotification and AVAssetTrackSegmentsDidChangeNotification whenever new fragments are detected, as appropriate.
556    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
557    ///
558    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentedassettrack?language=objc)
559    #[unsafe(super(AVAssetTrack, NSObject))]
560    #[derive(Debug, PartialEq, Eq, Hash)]
561    pub struct AVFragmentedAssetTrack;
562);
563
564unsafe impl Send for AVFragmentedAssetTrack {}
565
566unsafe impl Sync for AVFragmentedAssetTrack {}
567
568#[cfg(feature = "AVAsynchronousKeyValueLoading")]
569extern_conformance!(
570    unsafe impl AVAsynchronousKeyValueLoading for AVFragmentedAssetTrack {}
571);
572
573extern_conformance!(
574    unsafe impl NSCopying for AVFragmentedAssetTrack {}
575);
576
577unsafe impl CopyingHelper for AVFragmentedAssetTrack {
578    type Result = Self;
579}
580
581extern_conformance!(
582    unsafe impl NSObjectProtocol for AVFragmentedAssetTrack {}
583);
584
585impl AVFragmentedAssetTrack {
586    extern_methods!();
587}
588
589/// Methods declared on superclass `AVAssetTrack`.
590impl AVFragmentedAssetTrack {
591    extern_methods!(
592        #[unsafe(method(init))]
593        #[unsafe(method_family = init)]
594        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
595
596        #[unsafe(method(new))]
597        #[unsafe(method_family = new)]
598        pub unsafe fn new() -> Retained<Self>;
599    );
600}