objc2_av_foundation/generated/
AVComposition.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    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcomposition?language=objc)
16    #[unsafe(super(AVAsset, NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    #[cfg(feature = "AVAsset")]
19    pub struct AVComposition;
20);
21
22#[cfg(all(feature = "AVAsset", feature = "AVAsynchronousKeyValueLoading"))]
23unsafe impl AVAsynchronousKeyValueLoading for AVComposition {}
24
25#[cfg(feature = "AVAsset")]
26unsafe impl NSCopying for AVComposition {}
27
28#[cfg(feature = "AVAsset")]
29unsafe impl CopyingHelper for AVComposition {
30    type Result = Self;
31}
32
33#[cfg(feature = "AVAsset")]
34unsafe impl NSMutableCopying for AVComposition {}
35
36#[cfg(feature = "AVAsset")]
37unsafe impl MutableCopyingHelper for AVComposition {
38    type Result = AVMutableComposition;
39}
40
41#[cfg(feature = "AVAsset")]
42unsafe impl NSObjectProtocol for AVComposition {}
43
44#[cfg(feature = "AVAsset")]
45impl AVComposition {
46    extern_methods!(
47        #[cfg(all(feature = "AVAssetTrack", feature = "AVCompositionTrack"))]
48        /// Provides the array of AVCompositionTracks contained by the composition.
49        #[unsafe(method(tracks))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn tracks(&self) -> Retained<NSArray<AVCompositionTrack>>;
52
53        #[cfg(feature = "objc2-core-foundation")]
54        /// Indicates the authored size of the visual portion of the composition.
55        #[unsafe(method(naturalSize))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn naturalSize(&self) -> CGSize;
58
59        /// Specifies the initialization options for the creation of AVURLAssets by the receiver, e.g. AVURLAssetPreferPreciseDurationAndTimingKey. The default behavior for creation of AVURLAssets by an AVComposition is equivalent to the behavior of +[AVURLAsset URLAssetWithURL:options:] when specifying no initialization options.
60        ///
61        /// AVCompositions create AVURLAssets internally for URLs specified by AVCompositionTrackSegments of AVCompositionTracks, as needed, whenever AVCompositionTrackSegments were originally added to a track via -[AVMutableCompositionTrack setSegments:] rather than by inserting timeranges of already existing AVAssets or AVAssetTracks.
62        /// The value of URLAssetInitializationOptions can be specified at the time an AVMutableComposition is created via +compositionWithURLAssetInitializationOptions:.
63        #[unsafe(method(URLAssetInitializationOptions))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn URLAssetInitializationOptions(
66            &self,
67        ) -> Retained<NSDictionary<NSString, AnyObject>>;
68    );
69}
70
71/// Methods declared on superclass `AVAsset`.
72#[cfg(feature = "AVAsset")]
73impl AVComposition {
74    extern_methods!(
75        /// Returns an instance of AVAsset for inspection of a media resource.
76        ///
77        /// Parameter `URL`: An instance of NSURL that references a media resource.
78        ///
79        /// Returns: An instance of AVAsset.
80        ///
81        /// Returns a newly allocated instance of a subclass of AVAsset initialized with the specified URL.
82        #[unsafe(method(assetWithURL:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn assetWithURL(url: &NSURL) -> Retained<Self>;
85    );
86}
87
88/// Methods declared on superclass `NSObject`.
89#[cfg(feature = "AVAsset")]
90impl AVComposition {
91    extern_methods!(
92        #[unsafe(method(init))]
93        #[unsafe(method_family = init)]
94        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95
96        #[unsafe(method(new))]
97        #[unsafe(method_family = new)]
98        pub unsafe fn new() -> Retained<Self>;
99    );
100}
101
102/// AVCompositionTrackInspection.
103#[cfg(feature = "AVAsset")]
104impl AVComposition {
105    extern_methods!(
106        #[cfg(all(
107            feature = "AVAssetTrack",
108            feature = "AVCompositionTrack",
109            feature = "objc2-core-media"
110        ))]
111        /// Provides an instance of AVCompositionTrack that represents the track of the specified trackID.
112        ///
113        /// Parameter `trackID`: The trackID of the requested AVCompositionTrack.
114        ///
115        /// Returns: An instance of AVCompositionTrack; may be nil if no track of the specified trackID is available.
116        ///
117        /// Becomes callable without blocking when the key
118        /// "
119        /// tracks" has been loaded
120        #[unsafe(method(trackWithTrackID:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn trackWithTrackID(
123            &self,
124            track_id: CMPersistentTrackID,
125        ) -> Option<Retained<AVCompositionTrack>>;
126
127        #[cfg(all(
128            feature = "AVAssetTrack",
129            feature = "AVCompositionTrack",
130            feature = "block2",
131            feature = "objc2-core-media"
132        ))]
133        /// Loads an instance of AVCompositionTrack that represents the track of the specified trackID.
134        ///
135        /// Parameter `trackID`: The trackID of the requested AVCompositionTrack.
136        ///
137        /// Parameter `completionHandler`: A block that is called when the loading is finished, with either the loaded track (which may be nil if no track of the specified trackID is available) or an error.
138        #[unsafe(method(loadTrackWithTrackID:completionHandler:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn loadTrackWithTrackID_completionHandler(
141            &self,
142            track_id: CMPersistentTrackID,
143            completion_handler: &block2::Block<dyn Fn(*mut AVCompositionTrack, *mut NSError)>,
144        );
145
146        #[cfg(all(
147            feature = "AVAssetTrack",
148            feature = "AVCompositionTrack",
149            feature = "AVMediaFormat"
150        ))]
151        /// Provides an array of AVCompositionTracks of the asset that present media of the specified media type.
152        ///
153        /// Parameter `mediaType`: The media type according to which the receiver filters its AVCompositionTracks. (Media types are defined in AVMediaFormat.h)
154        ///
155        /// Returns: An NSArray of AVCompositionTracks; may be empty if no tracks of the specified media type are available.
156        ///
157        /// Becomes callable without blocking when the key
158        /// "
159        /// tracks" has been loaded
160        #[unsafe(method(tracksWithMediaType:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn tracksWithMediaType(
163            &self,
164            media_type: &AVMediaType,
165        ) -> Retained<NSArray<AVCompositionTrack>>;
166
167        #[cfg(all(
168            feature = "AVAssetTrack",
169            feature = "AVCompositionTrack",
170            feature = "AVMediaFormat",
171            feature = "block2"
172        ))]
173        /// Loads an array of AVCompositionTracks of the asset that present media of the specified media type.
174        ///
175        /// Parameter `mediaType`: The media type according to which AVAsset filters its AVCompositionTracks. (Media types are defined in AVMediaFormat.h.)
176        ///
177        /// Parameter `completionHandler`: A block that is called when the loading is finished, with either the loaded tracks (which may be empty if no tracks of the specified media type are available) or an error.
178        #[unsafe(method(loadTracksWithMediaType:completionHandler:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn loadTracksWithMediaType_completionHandler(
181            &self,
182            media_type: &AVMediaType,
183            completion_handler: &block2::Block<
184                dyn Fn(*mut NSArray<AVCompositionTrack>, *mut NSError),
185            >,
186        );
187
188        #[cfg(all(
189            feature = "AVAssetTrack",
190            feature = "AVCompositionTrack",
191            feature = "AVMediaFormat"
192        ))]
193        /// Provides an array of AVCompositionTracks of the asset that present media with the specified characteristic.
194        ///
195        /// Parameter `mediaCharacteristic`: The media characteristic according to which the receiver filters its AVCompositionTracks. (Media characteristics are defined in AVMediaFormat.h)
196        ///
197        /// Returns: An NSArray of AVCompositionTracks; may be empty if no tracks with the specified characteristic are available.
198        ///
199        /// Becomes callable without blocking when the key
200        /// "
201        /// tracks" has been loaded
202        #[unsafe(method(tracksWithMediaCharacteristic:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn tracksWithMediaCharacteristic(
205            &self,
206            media_characteristic: &AVMediaCharacteristic,
207        ) -> Retained<NSArray<AVCompositionTrack>>;
208
209        #[cfg(all(
210            feature = "AVAssetTrack",
211            feature = "AVCompositionTrack",
212            feature = "AVMediaFormat",
213            feature = "block2"
214        ))]
215        /// Loads an array of AVCompositionTracks of the asset that present media with the specified characteristic.
216        ///
217        /// Parameter `mediaCharacteristic`: The media characteristic according to which AVAsset filters its AVCompositionTracks. (Media characteristics are defined in AVMediaFormat.h.)
218        ///
219        /// Parameter `completionHandler`: A block that is called when the loading is finished, with either the loaded tracks (which may be empty if no tracks with the specified characteristic are available) or an error.
220        #[unsafe(method(loadTracksWithMediaCharacteristic:completionHandler:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn loadTracksWithMediaCharacteristic_completionHandler(
223            &self,
224            media_characteristic: &AVMediaCharacteristic,
225            completion_handler: &block2::Block<
226                dyn Fn(*mut NSArray<AVCompositionTrack>, *mut NSError),
227            >,
228        );
229    );
230}
231
232extern_class!(
233    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutablecomposition?language=objc)
234    #[unsafe(super(AVComposition, AVAsset, NSObject))]
235    #[derive(Debug, PartialEq, Eq, Hash)]
236    #[cfg(feature = "AVAsset")]
237    pub struct AVMutableComposition;
238);
239
240#[cfg(all(feature = "AVAsset", feature = "AVAsynchronousKeyValueLoading"))]
241unsafe impl AVAsynchronousKeyValueLoading for AVMutableComposition {}
242
243#[cfg(feature = "AVAsset")]
244unsafe impl NSCopying for AVMutableComposition {}
245
246#[cfg(feature = "AVAsset")]
247unsafe impl CopyingHelper for AVMutableComposition {
248    type Result = AVComposition;
249}
250
251#[cfg(feature = "AVAsset")]
252unsafe impl NSMutableCopying for AVMutableComposition {}
253
254#[cfg(feature = "AVAsset")]
255unsafe impl MutableCopyingHelper for AVMutableComposition {
256    type Result = Self;
257}
258
259#[cfg(feature = "AVAsset")]
260unsafe impl NSObjectProtocol for AVMutableComposition {}
261
262#[cfg(feature = "AVAsset")]
263impl AVMutableComposition {
264    extern_methods!(
265        #[cfg(all(feature = "AVAssetTrack", feature = "AVCompositionTrack"))]
266        /// Provides the array of AVMutableCompositionTracks contained by the composition.
267        #[unsafe(method(tracks))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn tracks(&self) -> Retained<NSArray<AVMutableCompositionTrack>>;
270
271        #[cfg(feature = "objc2-core-foundation")]
272        /// Indicates the authored size of the visual portion of the asset.
273        ///
274        /// If not set, the value is the size of the composition's first video track. Set to CGSizeZero to revert to default behavior.
275        #[unsafe(method(naturalSize))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn naturalSize(&self) -> CGSize;
278
279        #[cfg(feature = "objc2-core-foundation")]
280        /// Setter for [`naturalSize`][Self::naturalSize].
281        #[unsafe(method(setNaturalSize:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn setNaturalSize(&self, natural_size: CGSize);
284
285        /// Returns an empty AVMutableComposition.
286        #[unsafe(method(composition))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn composition() -> Retained<Self>;
289
290        /// Returns an empty AVMutableComposition.
291        ///
292        /// Parameter `URLAssetInitializationOptions`: Specifies the initialization options that the receiver should use when creating AVURLAssets internally, e.g. AVURLAssetPreferPreciseDurationAndTimingKey. The default behavior for creation of AVURLAssets by an AVMutableComposition is equivalent to the behavior of +[AVURLAsset URLAssetWithURL:options:] when specifying no initialization options.
293        ///
294        /// AVMutableCompositions create AVURLAssets internally for URLs specified by AVCompositionTrackSegments of AVMutableCompositionTracks, as needed, whenever AVCompositionTrackSegments are added to tracks via -[AVMutableCompositionTrack setSegments:] rather than by inserting timeranges of already existing AVAssets or AVAssetTracks.
295        #[unsafe(method(compositionWithURLAssetInitializationOptions:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn compositionWithURLAssetInitializationOptions(
298            url_asset_initialization_options: Option<&NSDictionary<NSString, AnyObject>>,
299        ) -> Retained<Self>;
300    );
301}
302
303/// Methods declared on superclass `AVAsset`.
304#[cfg(feature = "AVAsset")]
305impl AVMutableComposition {
306    extern_methods!(
307        /// Returns an instance of AVAsset for inspection of a media resource.
308        ///
309        /// Parameter `URL`: An instance of NSURL that references a media resource.
310        ///
311        /// Returns: An instance of AVAsset.
312        ///
313        /// Returns a newly allocated instance of a subclass of AVAsset initialized with the specified URL.
314        #[unsafe(method(assetWithURL:))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn assetWithURL(url: &NSURL) -> Retained<Self>;
317    );
318}
319
320/// Methods declared on superclass `NSObject`.
321#[cfg(feature = "AVAsset")]
322impl AVMutableComposition {
323    extern_methods!(
324        #[unsafe(method(init))]
325        #[unsafe(method_family = init)]
326        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
327
328        #[unsafe(method(new))]
329        #[unsafe(method_family = new)]
330        pub unsafe fn new() -> Retained<Self>;
331    );
332}
333
334/// AVMutableCompositionCompositionLevelEditing.
335#[cfg(feature = "AVAsset")]
336impl AVMutableComposition {
337    extern_methods!(
338        #[cfg(feature = "objc2-core-media")]
339        /// Inserts all the tracks of a timeRange of an asset into a composition.
340        ///
341        /// Parameter `timeRange`: Specifies the timeRange of the asset to be inserted.
342        ///
343        /// Parameter `asset`: Specifies the asset that contains the tracks that are to be inserted. Only instances of AVURLAsset and AVComposition are supported (AVComposition starting in macOS 10.10 and iOS 8.0). The asset should have its tracks loaded, and the tracks should have their formatDescriptions loaded before invoking this method to avoid blocking.
344        ///
345        /// Parameter `startTime`: Specifies the time at which the inserted tracks are to be presented by the composition.
346        ///
347        /// Parameter `outError`: Describes failures that may be reported to the user, e.g. the asset that was selected for insertion in the composition is restricted by copy-protection.
348        ///
349        /// Returns: A BOOL value indicating the success of the insertion.
350        ///
351        /// You provide a reference to an AVAsset and the timeRange within it that you want to insert. You specify the start time in the destination composition at which the timeRange should be inserted.
352        /// This method may add new tracks to ensure that all tracks of the asset are represented in the inserted timeRange.
353        /// Note that the media data for the inserted timeRange will be presented at its natural duration and rate. It can be scaled to a different duration and presented at a different rate via -scaleTimeRange:toDuration:.
354        /// Existing content at the specified startTime will be pushed out by the duration of timeRange.
355        /// Note that this operation only inserts one or more track segments into affected AVMutableCompositionTracks; it does not affect the values of other track properties, either to match the corresponding values of tracks in the source asset or for any other purpose.
356        #[deprecated]
357        #[unsafe(method(insertTimeRange:ofAsset:atTime:error:_))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn insertTimeRange_ofAsset_atTime_error(
360            &self,
361            time_range: CMTimeRange,
362            asset: &AVAsset,
363            start_time: CMTime,
364        ) -> Result<(), Retained<NSError>>;
365
366        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
367        /// Inserts all the tracks of a timeRange of an asset into a composition.
368        ///
369        /// Parameter `timeRange`: Specifies the timeRange of the asset to be inserted.
370        ///
371        /// Parameter `asset`: Specifies the asset that contains the tracks that are to be inserted. Only instances of AVURLAsset and AVComposition are supported (AVComposition starting in macOS 10.10 and iOS 8.0).
372        ///
373        /// Parameter `startTime`: Specifies the time at which the inserted tracks are to be presented by the composition.
374        ///
375        /// Parameter `completionHandler`: A block that is invoked when the insertion is complete.  If the error parameter is non-nil, it describes a failure that may be reported to the user, e.g. the asset that was selected for insertion in the composition is restricted by copy-protection.
376        ///
377        /// You provide a reference to an AVAsset and the timeRange within it that you want to insert. You specify the start time in the destination composition at which the timeRange should be inserted.
378        /// This method may add new tracks to ensure that all tracks of the asset are represented in the inserted timeRange.
379        /// Note that the media data for the inserted timeRange will be presented at its natural duration and rate. It can be scaled to a different duration and presented at a different rate via -scaleTimeRange:toDuration:.
380        /// Existing content at the specified startTime will be pushed out by the duration of timeRange.
381        /// Note that this operation only inserts one or more track segments into affected AVMutableCompositionTracks; it does not affect the values of other track properties, either to match the corresponding values of tracks in the source asset or for any other purpose.
382        #[unsafe(method(insertTimeRange:ofAsset:atTime:completionHandler:))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn insertTimeRange_ofAsset_atTime_completionHandler(
385            &self,
386            time_range: CMTimeRange,
387            asset: &AVAsset,
388            start_time: CMTime,
389            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
390        );
391
392        #[cfg(feature = "objc2-core-media")]
393        /// Adds or extends an empty timeRange within all tracks of the composition.
394        ///
395        /// Parameter `timeRange`: Specifies the empty timeRange to be inserted.
396        ///
397        /// If you insert an empty timeRange into the composition, any media that was presented during that interval prior to the insertion will be presented instead immediately afterward. You can use this method to reserve an interval in which you want a subsequently created track to present its media.
398        /// Note that you cannot add empty time ranges to the end of a composition.
399        #[unsafe(method(insertEmptyTimeRange:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn insertEmptyTimeRange(&self, time_range: CMTimeRange);
402
403        #[cfg(feature = "objc2-core-media")]
404        /// Removes a specified timeRange from all tracks of the composition.
405        ///
406        /// Parameter `timeRange`: Specifies the timeRange to be removed.
407        ///
408        /// Removal of a time range does not cause any existing tracks to be removed from the composition, even if removing timeRange results in an empty track. Instead, it removes or truncates track segments that intersect with the timeRange.
409        ///
410        /// After removing, existing content after timeRange will be pulled in.
411        #[unsafe(method(removeTimeRange:))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn removeTimeRange(&self, time_range: CMTimeRange);
414
415        #[cfg(feature = "objc2-core-media")]
416        /// Changes the duration of a timeRange of all tracks.
417        ///
418        /// Parameter `timeRange`: Specifies the timeRange of the composition to be scaled.
419        ///
420        /// Parameter `duration`: Specifies the new duration of the timeRange.
421        ///
422        /// Each trackSegment affected by the scaling operation will be presented at a rate equal to source.duration / target.duration of its resulting timeMapping.
423        #[unsafe(method(scaleTimeRange:toDuration:))]
424        #[unsafe(method_family = none)]
425        pub unsafe fn scaleTimeRange_toDuration(&self, time_range: CMTimeRange, duration: CMTime);
426    );
427}
428
429/// AVMutableCompositionTrackLevelEditing.
430#[cfg(feature = "AVAsset")]
431impl AVMutableComposition {
432    extern_methods!(
433        #[cfg(all(
434            feature = "AVAssetTrack",
435            feature = "AVCompositionTrack",
436            feature = "AVMediaFormat",
437            feature = "objc2-core-media"
438        ))]
439        /// Adds an empty track to a mutable composition.
440        ///
441        /// Parameter `mediaType`: The media type of the new track.
442        ///
443        /// Parameter `preferredTrackID`: Specifies the preferred track ID for the new track. If you do not need to specify a preferred track ID, pass kCMPersistentTrackID_Invalid. Otherwise the preferred track ID will be used for the new track, provided that it is not currently in use and has not previously been used.
444        ///
445        /// Returns: An instance of AVMutableCompositionTrack representing the new track. Its actual trackID is available via its
446        /// "
447        /// trackID" key.
448        ///
449        /// If the specified preferred track ID is not available, or kCMPersistentTrackID_Invalid was passed in, a unique track ID will be generated.
450        #[unsafe(method(addMutableTrackWithMediaType:preferredTrackID:))]
451        #[unsafe(method_family = none)]
452        pub unsafe fn addMutableTrackWithMediaType_preferredTrackID(
453            &self,
454            media_type: &AVMediaType,
455            preferred_track_id: CMPersistentTrackID,
456        ) -> Option<Retained<AVMutableCompositionTrack>>;
457
458        #[cfg(all(feature = "AVAssetTrack", feature = "AVCompositionTrack"))]
459        /// Removes a track of a mutable composition.
460        ///
461        /// Parameter `track`: A reference to the AVCompositionTrack to be removed.
462        ///
463        /// If you retain a reference to the removed track, note that its
464        /// "
465        /// composition" key will have the value nil, and the values of its other properties are undefined.
466        #[unsafe(method(removeTrack:))]
467        #[unsafe(method_family = none)]
468        pub unsafe fn removeTrack(&self, track: &AVCompositionTrack);
469
470        #[cfg(all(feature = "AVAssetTrack", feature = "AVCompositionTrack"))]
471        /// Provides a reference to a track of a mutable composition into which any timeRange of an AVAssetTrack can be inserted (via -[AVMutableCompositionTrack insertTimeRange:ofTrack:atTime:error:]).
472        ///
473        /// Parameter `track`: A reference to the AVAssetTrack from which a timeRange may be inserted.
474        ///
475        /// Returns: An AVMutableCompositionTrack that can accommodate the insertion, or, if no such track is available, nil.
476        ///
477        /// If a compatible track is desired but the result of this method is nil, a new track of the same mediaType as the AVAssetTrack can be created via -addMutableTrackWithMediaType:preferredTrackID:, and this new track will be compatible.
478        ///
479        /// For best performance, the number of tracks of a composition should be kept to a minimum, corresponding to the number for which media data must be presented in parallel. If media data of the same type is to be presented serially, even from multiple assets, a single track of that media type should be used. This method, -mutableTrackCompatibleWithTrack:, can help the client to identify an existing target track for an insertion.
480        ///
481        /// Similar to -[AVAsset compatibleTrackForCompositionTrack:].
482        #[unsafe(method(mutableTrackCompatibleWithTrack:))]
483        #[unsafe(method_family = none)]
484        pub unsafe fn mutableTrackCompatibleWithTrack(
485            &self,
486            track: &AVAssetTrack,
487        ) -> Option<Retained<AVMutableCompositionTrack>>;
488    );
489}
490
491/// AVMutableCompositionTrackInspection.
492#[cfg(feature = "AVAsset")]
493impl AVMutableComposition {
494    extern_methods!(
495        #[cfg(all(
496            feature = "AVAssetTrack",
497            feature = "AVCompositionTrack",
498            feature = "objc2-core-media"
499        ))]
500        /// Provides an instance of AVMutableCompositionTrack that represents the track of the specified trackID.
501        ///
502        /// Parameter `trackID`: The trackID of the requested AVMutableCompositionTrack.
503        ///
504        /// Returns: An instance of AVMutableCompositionTrack; may be nil if no track of the specified trackID is available.
505        ///
506        /// Becomes callable without blocking when the key
507        /// "
508        /// tracks" has been loaded
509        #[unsafe(method(trackWithTrackID:))]
510        #[unsafe(method_family = none)]
511        pub unsafe fn trackWithTrackID(
512            &self,
513            track_id: CMPersistentTrackID,
514        ) -> Option<Retained<AVMutableCompositionTrack>>;
515
516        #[cfg(all(
517            feature = "AVAssetTrack",
518            feature = "AVCompositionTrack",
519            feature = "block2",
520            feature = "objc2-core-media"
521        ))]
522        /// Loads an instance of AVMutableCompositionTrack that represents the track of the specified trackID.
523        ///
524        /// Parameter `trackID`: The trackID of the requested AVMutableCompositionTrack.
525        ///
526        /// Parameter `completionHandler`: A block that is called when the loading is finished, with either the loaded track (which may be nil if no track of the specified trackID is available) or an error.
527        #[unsafe(method(loadTrackWithTrackID:completionHandler:))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn loadTrackWithTrackID_completionHandler(
530            &self,
531            track_id: CMPersistentTrackID,
532            completion_handler: &block2::Block<
533                dyn Fn(*mut AVMutableCompositionTrack, *mut NSError),
534            >,
535        );
536
537        #[cfg(all(
538            feature = "AVAssetTrack",
539            feature = "AVCompositionTrack",
540            feature = "AVMediaFormat"
541        ))]
542        /// Provides an array of AVMutableCompositionTracks of the asset that present media of the specified media type.
543        ///
544        /// Parameter `mediaType`: The media type according to which the receiver filters its AVMutableCompositionTracks. (Media types are defined in AVMediaFormat.h)
545        ///
546        /// Returns: An NSArray of AVMutableCompositionTracks; may be empty if no tracks of the specified media type are available.
547        ///
548        /// Becomes callable without blocking when the key
549        /// "
550        /// tracks" has been loaded
551        #[unsafe(method(tracksWithMediaType:))]
552        #[unsafe(method_family = none)]
553        pub unsafe fn tracksWithMediaType(
554            &self,
555            media_type: &AVMediaType,
556        ) -> Retained<NSArray<AVMutableCompositionTrack>>;
557
558        #[cfg(all(
559            feature = "AVAssetTrack",
560            feature = "AVCompositionTrack",
561            feature = "AVMediaFormat",
562            feature = "block2"
563        ))]
564        /// Loads an array of AVMutableCompositionTracks of the asset that present media of the specified media type.
565        ///
566        /// Parameter `mediaType`: The media type according to which AVAsset filters its AVMutableCompositionTracks. (Media types are defined in AVMediaFormat.h.)
567        ///
568        /// Parameter `completionHandler`: A block that is called when the loading is finished, with either the loaded tracks (which may be empty if no tracks of the specified media type are available) or an error.
569        #[unsafe(method(loadTracksWithMediaType:completionHandler:))]
570        #[unsafe(method_family = none)]
571        pub unsafe fn loadTracksWithMediaType_completionHandler(
572            &self,
573            media_type: &AVMediaType,
574            completion_handler: &block2::Block<
575                dyn Fn(*mut NSArray<AVMutableCompositionTrack>, *mut NSError),
576            >,
577        );
578
579        #[cfg(all(
580            feature = "AVAssetTrack",
581            feature = "AVCompositionTrack",
582            feature = "AVMediaFormat"
583        ))]
584        /// Provides an array of AVMutableCompositionTracks of the asset that present media with the specified characteristic.
585        ///
586        /// Parameter `mediaCharacteristic`: The media characteristic according to which the receiver filters its AVMutableCompositionTracks. (Media characteristics are defined in AVMediaFormat.h)
587        ///
588        /// Returns: An NSArray of AVMutableCompositionTracks; may be empty if no tracks with the specified characteristic are available.
589        ///
590        /// Becomes callable without blocking when the key
591        /// "
592        /// tracks" has been loaded
593        #[unsafe(method(tracksWithMediaCharacteristic:))]
594        #[unsafe(method_family = none)]
595        pub unsafe fn tracksWithMediaCharacteristic(
596            &self,
597            media_characteristic: &AVMediaCharacteristic,
598        ) -> Retained<NSArray<AVMutableCompositionTrack>>;
599
600        #[cfg(all(
601            feature = "AVAssetTrack",
602            feature = "AVCompositionTrack",
603            feature = "AVMediaFormat",
604            feature = "block2"
605        ))]
606        /// Loads an array of AVMutableCompositionTracks of the asset that present media with the specified characteristic.
607        ///
608        /// Parameter `mediaCharacteristic`: The media characteristic according to which AVAsset filters its AVMutableCompositionTracks. (Media characteristics are defined in AVMediaFormat.h.)
609        ///
610        /// Parameter `completionHandler`: A block that is called when the loading is finished, with either the loaded tracks (which may be empty if no tracks with the specified characteristic are available) or an error.
611        #[unsafe(method(loadTracksWithMediaCharacteristic:completionHandler:))]
612        #[unsafe(method_family = none)]
613        pub unsafe fn loadTracksWithMediaCharacteristic_completionHandler(
614            &self,
615            media_characteristic: &AVMediaCharacteristic,
616            completion_handler: &block2::Block<
617                dyn Fn(*mut NSArray<AVMutableCompositionTrack>, *mut NSError),
618            >,
619        );
620    );
621}
622
623/// SynchronousAssetInterface.
624/// Redeclarations of async-only AVAsset interfaces to allow synchronous usage in the synchronous subclass.
625///
626/// See AVAsset's interface for more information about these interfaces.
627#[cfg(feature = "AVAsset")]
628impl AVComposition {
629    extern_methods!(
630        #[cfg(all(feature = "AVMetadataFormat", feature = "AVMetadataItem"))]
631        #[unsafe(method(metadataForFormat:))]
632        #[unsafe(method_family = none)]
633        pub unsafe fn metadataForFormat(
634            &self,
635            format: &AVMetadataFormat,
636        ) -> Retained<NSArray<AVMetadataItem>>;
637
638        #[cfg(all(feature = "AVMetadataFormat", feature = "AVTimedMetadataGroup"))]
639        #[unsafe(method(chapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:))]
640        #[unsafe(method_family = none)]
641        pub unsafe fn chapterMetadataGroupsWithTitleLocale_containingItemsWithCommonKeys(
642            &self,
643            locale: &NSLocale,
644            common_keys: Option<&NSArray<AVMetadataKey>>,
645        ) -> Retained<NSArray<AVTimedMetadataGroup>>;
646
647        #[cfg(feature = "AVTimedMetadataGroup")]
648        #[unsafe(method(chapterMetadataGroupsBestMatchingPreferredLanguages:))]
649        #[unsafe(method_family = none)]
650        pub unsafe fn chapterMetadataGroupsBestMatchingPreferredLanguages(
651            &self,
652            preferred_languages: &NSArray<NSString>,
653        ) -> Retained<NSArray<AVTimedMetadataGroup>>;
654
655        #[cfg(all(feature = "AVMediaFormat", feature = "AVMediaSelectionGroup"))]
656        #[unsafe(method(mediaSelectionGroupForMediaCharacteristic:))]
657        #[unsafe(method_family = none)]
658        pub unsafe fn mediaSelectionGroupForMediaCharacteristic(
659            &self,
660            media_characteristic: &AVMediaCharacteristic,
661        ) -> Option<Retained<AVMediaSelectionGroup>>;
662
663        #[cfg(feature = "objc2-core-media")]
664        #[unsafe(method(unusedTrackID))]
665        #[unsafe(method_family = none)]
666        pub unsafe fn unusedTrackID(&self) -> CMPersistentTrackID;
667    );
668}