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