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