objc2_av_foundation/generated/
AVAssetExportSession.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-media")]
7use objc2_core_media::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern "C" {
13    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetlowquality?language=objc)
14    pub static AVAssetExportPresetLowQuality: &'static NSString;
15}
16
17extern "C" {
18    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetmediumquality?language=objc)
19    pub static AVAssetExportPresetMediumQuality: &'static NSString;
20}
21
22extern "C" {
23    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethighestquality?language=objc)
24    pub static AVAssetExportPresetHighestQuality: &'static NSString;
25}
26
27extern "C" {
28    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevchighestquality?language=objc)
29    pub static AVAssetExportPresetHEVCHighestQuality: &'static NSString;
30}
31
32extern "C" {
33    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevchighestqualitywithalpha?language=objc)
34    pub static AVAssetExportPresetHEVCHighestQualityWithAlpha: &'static NSString;
35}
36
37extern "C" {
38    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpreset640x480?language=objc)
39    pub static AVAssetExportPreset640x480: &'static NSString;
40}
41
42extern "C" {
43    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpreset960x540?language=objc)
44    pub static AVAssetExportPreset960x540: &'static NSString;
45}
46
47extern "C" {
48    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpreset1280x720?language=objc)
49    pub static AVAssetExportPreset1280x720: &'static NSString;
50}
51
52extern "C" {
53    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpreset1920x1080?language=objc)
54    pub static AVAssetExportPreset1920x1080: &'static NSString;
55}
56
57extern "C" {
58    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpreset3840x2160?language=objc)
59    pub static AVAssetExportPreset3840x2160: &'static NSString;
60}
61
62extern "C" {
63    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevc1920x1080?language=objc)
64    pub static AVAssetExportPresetHEVC1920x1080: &'static NSString;
65}
66
67extern "C" {
68    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevc1920x1080withalpha?language=objc)
69    pub static AVAssetExportPresetHEVC1920x1080WithAlpha: &'static NSString;
70}
71
72extern "C" {
73    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevc3840x2160?language=objc)
74    pub static AVAssetExportPresetHEVC3840x2160: &'static NSString;
75}
76
77extern "C" {
78    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevc3840x2160withalpha?language=objc)
79    pub static AVAssetExportPresetHEVC3840x2160WithAlpha: &'static NSString;
80}
81
82extern "C" {
83    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevc4320x2160?language=objc)
84    pub static AVAssetExportPresetHEVC4320x2160: &'static NSString;
85}
86
87extern "C" {
88    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevc7680x4320?language=objc)
89    pub static AVAssetExportPresetHEVC7680x4320: &'static NSString;
90}
91
92extern "C" {
93    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetmvhevc960x960?language=objc)
94    pub static AVAssetExportPresetMVHEVC960x960: &'static NSString;
95}
96
97extern "C" {
98    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetmvhevc1440x1440?language=objc)
99    pub static AVAssetExportPresetMVHEVC1440x1440: &'static NSString;
100}
101
102extern "C" {
103    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetmvhevc4320x4320?language=objc)
104    pub static AVAssetExportPresetMVHEVC4320x4320: &'static NSString;
105}
106
107extern "C" {
108    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetmvhevc7680x7680?language=objc)
109    pub static AVAssetExportPresetMVHEVC7680x7680: &'static NSString;
110}
111
112extern "C" {
113    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4a?language=objc)
114    pub static AVAssetExportPresetAppleM4A: &'static NSString;
115}
116
117extern "C" {
118    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetpassthrough?language=objc)
119    pub static AVAssetExportPresetPassthrough: &'static NSString;
120}
121
122extern "C" {
123    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetappleprores422lpcm?language=objc)
124    pub static AVAssetExportPresetAppleProRes422LPCM: &'static NSString;
125}
126
127extern "C" {
128    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetappleprores4444lpcm?language=objc)
129    pub static AVAssetExportPresetAppleProRes4444LPCM: &'static NSString;
130}
131
132extern "C" {
133    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4vcellular?language=objc)
134    pub static AVAssetExportPresetAppleM4VCellular: &'static NSString;
135}
136
137extern "C" {
138    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4vipod?language=objc)
139    pub static AVAssetExportPresetAppleM4ViPod: &'static NSString;
140}
141
142extern "C" {
143    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4v480psd?language=objc)
144    pub static AVAssetExportPresetAppleM4V480pSD: &'static NSString;
145}
146
147extern "C" {
148    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4vappletv?language=objc)
149    pub static AVAssetExportPresetAppleM4VAppleTV: &'static NSString;
150}
151
152extern "C" {
153    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4vwifi?language=objc)
154    pub static AVAssetExportPresetAppleM4VWiFi: &'static NSString;
155}
156
157extern "C" {
158    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4v720phd?language=objc)
159    pub static AVAssetExportPresetAppleM4V720pHD: &'static NSString;
160}
161
162extern "C" {
163    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportpresetapplem4v1080phd?language=objc)
164    pub static AVAssetExportPresetAppleM4V1080pHD: &'static NSString;
165}
166
167/// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportsessionstatus?language=objc)
168// NS_ENUM
169#[repr(transparent)]
170#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
171pub struct AVAssetExportSessionStatus(pub NSInteger);
172impl AVAssetExportSessionStatus {
173    #[doc(alias = "AVAssetExportSessionStatusUnknown")]
174    pub const Unknown: Self = Self(0);
175    #[doc(alias = "AVAssetExportSessionStatusWaiting")]
176    pub const Waiting: Self = Self(1);
177    #[doc(alias = "AVAssetExportSessionStatusExporting")]
178    pub const Exporting: Self = Self(2);
179    #[doc(alias = "AVAssetExportSessionStatusCompleted")]
180    pub const Completed: Self = Self(3);
181    #[doc(alias = "AVAssetExportSessionStatusFailed")]
182    pub const Failed: Self = Self(4);
183    #[doc(alias = "AVAssetExportSessionStatusCancelled")]
184    pub const Cancelled: Self = Self(5);
185}
186
187unsafe impl Encode for AVAssetExportSessionStatus {
188    const ENCODING: Encoding = NSInteger::ENCODING;
189}
190
191unsafe impl RefEncode for AVAssetExportSessionStatus {
192    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
193}
194
195/// A bitfield type that specifies output handling policies for alternate tracks in a track group.
196///
197///
198///
199/// No specific processing directives are applied to alternate tracks.  The output is produced without regard to alternate track group assignments in the original asset.
200///
201///
202/// Preserve alternate tracks via pass-through.
203///
204/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassettrackgroupoutputhandling?language=objc)
205// NS_OPTIONS
206#[repr(transparent)]
207#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
208pub struct AVAssetTrackGroupOutputHandling(pub NSUInteger);
209bitflags::bitflags! {
210    impl AVAssetTrackGroupOutputHandling: NSUInteger {
211        #[doc(alias = "AVAssetTrackGroupOutputHandlingNone")]
212        const None = 0;
213        #[doc(alias = "AVAssetTrackGroupOutputHandlingPreserveAlternateTracks")]
214        const PreserveAlternateTracks = 1<<0;
215        #[doc(alias = "AVAssetTrackGroupOutputHandlingDefaultPolicy")]
216        const DefaultPolicy = AVAssetTrackGroupOutputHandling::None.0;
217    }
218}
219
220unsafe impl Encode for AVAssetTrackGroupOutputHandling {
221    const ENCODING: Encoding = NSUInteger::ENCODING;
222}
223
224unsafe impl RefEncode for AVAssetTrackGroupOutputHandling {
225    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
226}
227
228extern_class!(
229    /// An AVAssetExportSession creates a new timed media resource from the contents of an
230    /// existing AVAsset in the form described by a specified export preset.
231    ///
232    ///
233    /// Prior to initializing an instance of AVAssetExportSession, you can invoke
234    /// +allExportPresets to obtain the complete list of presets available. Use
235    /// +exportPresetsCompatibleWithAsset: to obtain a list of presets that are compatible
236    /// with a specific AVAsset.
237    ///
238    /// To configure an export, initialize an AVAssetExportSession with an AVAsset that contains
239    /// the source media, an AVAssetExportPreset, the output file type, (a UTI string from
240    /// those defined in AVMediaFormat.h) and the output URL.
241    ///
242    /// After configuration is complete, invoke exportAsynchronouslyWithCompletionHandler:
243    /// to start the export process. This method returns immediately; the export is performed
244    /// asynchronously. Invoke the -progress method to check on the progress. Note that in
245    /// some cases, depending on the capabilities of the device, when multiple exports are
246    /// attempted at the same time some may be queued until others have been completed. When
247    /// this happens, the status of a queued export will indicate that it's "waiting".
248    ///
249    /// Whether the export fails, completes, or is cancelled, the completion handler you
250    /// supply to -exportAsynchronouslyWithCompletionHandler: will be called. Upon
251    /// completion, the status property indicates whether the export has completed
252    /// successfully. If it has failed, the value of the error property supplies additional
253    /// information about the reason for the failure.
254    ///
255    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetexportsession?language=objc)
256    #[unsafe(super(NSObject))]
257    #[derive(Debug, PartialEq, Eq, Hash)]
258    pub struct AVAssetExportSession;
259);
260
261extern_conformance!(
262    unsafe impl NSObjectProtocol for AVAssetExportSession {}
263);
264
265impl AVAssetExportSession {
266    extern_methods!(
267        #[unsafe(method(init))]
268        #[unsafe(method_family = init)]
269        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
270
271        #[unsafe(method(new))]
272        #[unsafe(method_family = new)]
273        pub unsafe fn new() -> Retained<Self>;
274
275        #[cfg(feature = "AVAsset")]
276        /// Returns an instance of AVAssetExportSession for the specified source asset and preset.
277        ///
278        /// Parameter `asset`: An AVAsset object that is intended to be exported.
279        ///
280        /// Parameter `presetName`: An NSString specifying the name of the preset template for the export.
281        ///
282        /// Returns: An instance of AVAssetExportSession.
283        ///
284        /// If the specified asset belongs to a mutable subclass of AVAsset, AVMutableComposition or AVMutableMovie, the results of any export-related operation are undefined if you mutate the asset after the operation commences. These operations include but are not limited to: 1) testing the compatibility of export presets with the asset, 2) calculating the maximum duration or estimated length of the output file, and 3) the export operation itself.
285        #[unsafe(method(exportSessionWithAsset:presetName:))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn exportSessionWithAsset_presetName(
288            asset: &AVAsset,
289            preset_name: &NSString,
290        ) -> Option<Retained<Self>>;
291
292        #[cfg(feature = "AVAsset")]
293        /// Initialize an AVAssetExportSession with the specified preset and set the source to the contents of the asset.
294        ///
295        /// Parameter `asset`: An AVAsset object that is intended to be exported.
296        ///
297        /// Parameter `presetName`: An NSString specifying the name of the preset template for the export.
298        ///
299        /// Returns: Returns the initialized AVAssetExportSession.
300        ///
301        /// If the specified asset belongs to a mutable subclass of AVAsset, AVMutableComposition or AVMutableMovie, the results of any export-related operation are undefined if you mutate the asset after the operation commences. These operations include but are not limited to: 1) testing the compatibility of export presets with the asset, 2) calculating the maximum duration or estimated length of the output file, and 3) the export operation itself.
302        #[unsafe(method(initWithAsset:presetName:))]
303        #[unsafe(method_family = init)]
304        pub unsafe fn initWithAsset_presetName(
305            this: Allocated<Self>,
306            asset: &AVAsset,
307            preset_name: &NSString,
308        ) -> Option<Retained<Self>>;
309
310        #[unsafe(method(presetName))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn presetName(&self) -> Retained<NSString>;
313
314        #[cfg(feature = "AVAsset")]
315        #[unsafe(method(asset))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn asset(&self) -> Retained<AVAsset>;
318
319        #[cfg(feature = "AVMediaFormat")]
320        #[unsafe(method(outputFileType))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn outputFileType(&self) -> Option<Retained<AVFileType>>;
323
324        #[cfg(feature = "AVMediaFormat")]
325        /// Setter for [`outputFileType`][Self::outputFileType].
326        ///
327        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
328        #[unsafe(method(setOutputFileType:))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn setOutputFileType(&self, output_file_type: Option<&AVFileType>);
331
332        #[unsafe(method(outputURL))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn outputURL(&self) -> Option<Retained<NSURL>>;
335
336        /// Setter for [`outputURL`][Self::outputURL].
337        ///
338        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
339        #[unsafe(method(setOutputURL:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn setOutputURL(&self, output_url: Option<&NSURL>);
342
343        #[unsafe(method(shouldOptimizeForNetworkUse))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn shouldOptimizeForNetworkUse(&self) -> bool;
346
347        /// Setter for [`shouldOptimizeForNetworkUse`][Self::shouldOptimizeForNetworkUse].
348        #[unsafe(method(setShouldOptimizeForNetworkUse:))]
349        #[unsafe(method_family = none)]
350        pub unsafe fn setShouldOptimizeForNetworkUse(&self, should_optimize_for_network_use: bool);
351
352        /// Determines whether or not parallelization can be employed in the export.
353        ///
354        /// On select platforms, there may be opportunities to expedite the export by using additional resources in parallel.
355        /// If set to YES, export parallelization will be enabled, only if parallelization requirements are met.  There will
356        /// be no error signaled if export parallelization is not achievable, and instead the export will proceed as normal
357        /// (without parallelization).
358        /// If set to NO, export parallelization will not be used.
359        #[unsafe(method(allowsParallelizedExport))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn allowsParallelizedExport(&self) -> bool;
362
363        /// Setter for [`allowsParallelizedExport`][Self::allowsParallelizedExport].
364        #[unsafe(method(setAllowsParallelizedExport:))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn setAllowsParallelizedExport(&self, allows_parallelized_export: bool);
367
368        #[unsafe(method(status))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn status(&self) -> AVAssetExportSessionStatus;
371
372        #[unsafe(method(error))]
373        #[unsafe(method_family = none)]
374        pub unsafe fn error(&self) -> Option<Retained<NSError>>;
375
376        #[cfg(feature = "block2")]
377        /// Starts the asynchronous execution of an export session.
378        ///
379        /// Parameter `handler`: If internal preparation for export fails, the handler will be invoked synchronously.
380        /// The handler may also be called asynchronously after -exportAsynchronouslyWithCompletionHandler: returns,
381        /// in the following cases:
382        /// 1) if a failure occurs during the export, including failures of loading, re-encoding, or writing media data to the output,
383        /// 2) if -cancelExport is invoked,
384        /// 3) if export session succeeds, having completely written its output to the outputURL.
385        /// In each case, AVAssetExportSession.status will signal the terminal state of the asset reader, and if a failure occurs, the NSError
386        /// that describes the failure can be obtained from the error property.
387        ///
388        /// Initiates an asynchronous export operation and returns immediately.
389        ///
390        /// # Safety
391        ///
392        /// `handler` block must be sendable.
393        #[unsafe(method(exportAsynchronouslyWithCompletionHandler:))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn exportAsynchronouslyWithCompletionHandler(
396            &self,
397            handler: &block2::DynBlock<dyn Fn()>,
398        );
399
400        #[unsafe(method(progress))]
401        #[unsafe(method_family = none)]
402        pub unsafe fn progress(&self) -> c_float;
403
404        /// Cancels the execution of an export session.
405        ///
406        /// Cancel can be invoked when the export is running.
407        #[unsafe(method(cancelExport))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn cancelExport(&self);
410    );
411}
412
413/// AVAssetExportSessionPresets.
414impl AVAssetExportSession {
415    extern_methods!(
416        /// Returns all available export preset names.
417        ///
418        /// Returns an array of NSStrings with the names of all available presets. Note that not all presets are
419        /// compatible with all AVAssets.
420        ///
421        /// Returns: An NSArray containing an NSString for each of the available preset names.
422        #[unsafe(method(allExportPresets))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn allExportPresets() -> Retained<NSArray<NSString>>;
425
426        #[cfg(feature = "AVAsset")]
427        /// Returns only the identifiers compatible with the given AVAsset object.
428        ///
429        /// Not all export presets are compatible with all AVAssets. For example an video only asset is not compatible with an audio only preset.
430        /// This method returns only the identifiers for presets that will be compatible with the given asset.
431        /// A client should pass in an AVAsset that is ready to be exported.
432        /// In order to ensure that the setup and running of an export operation will succeed using a given preset no significant changes
433        /// (such as adding or deleting tracks) should be made to the asset between retrieving compatible identifiers and performing the export operation.
434        /// This method will access the tracks property of the AVAsset to build the returned NSArray.  To avoid blocking the calling thread,
435        /// the tracks property should be loaded using the AVAsynchronousKeyValueLoading protocol before calling this method.
436        ///
437        /// Parameter `asset`: An AVAsset object that is intended to be exported.
438        ///
439        /// Returns: An NSArray containing NSString values for the identifiers of compatible export types.
440        /// The array is a complete list of the valid identifiers that can be used as arguments to
441        /// initWithAsset:presetName: with the specified asset.
442        #[deprecated]
443        #[unsafe(method(exportPresetsCompatibleWithAsset:))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn exportPresetsCompatibleWithAsset(
446            asset: &AVAsset,
447        ) -> Retained<NSArray<NSString>>;
448
449        #[cfg(all(feature = "AVAsset", feature = "AVMediaFormat", feature = "block2"))]
450        /// Performs an inspection on the compatibility of an export preset, AVAsset and output file type.  Calls the completion handler with YES if
451        /// the arguments are compatible; NO otherwise.
452        ///
453        /// Not all export presets are compatible with all AVAssets and file types.  This method can be used to query compatibility.
454        /// In order to ensure that the setup and running of an export operation will succeed using a given preset no significant changes
455        /// (such as adding or deleting tracks) should be made to the asset between retrieving compatible identifiers and performing the export operation.
456        ///
457        /// Parameter `presetName`: An NSString specifying the name of the preset template for the export.
458        ///
459        /// Parameter `asset`: An AVAsset object that is intended to be exported.
460        ///
461        /// Parameter `outputFileType`: An AVFileType indicating a file type to check; or nil, to query whether there are any compatible types.
462        ///
463        /// Parameter `handler`: A block called with the compatibility result.
464        ///
465        /// # Safety
466        ///
467        /// `handler` block must be sendable.
468        #[unsafe(method(determineCompatibilityOfExportPreset:withAsset:outputFileType:completionHandler:))]
469        #[unsafe(method_family = none)]
470        pub unsafe fn determineCompatibilityOfExportPreset_withAsset_outputFileType_completionHandler(
471            preset_name: &NSString,
472            asset: &AVAsset,
473            output_file_type: Option<&AVFileType>,
474            handler: &block2::DynBlock<dyn Fn(Bool)>,
475        );
476    );
477}
478
479/// AVAssetExportSessionFileTypes.
480impl AVAssetExportSession {
481    extern_methods!(
482        #[cfg(feature = "AVMediaFormat")]
483        #[unsafe(method(supportedFileTypes))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn supportedFileTypes(&self) -> Retained<NSArray<AVFileType>>;
486
487        #[cfg(all(feature = "AVMediaFormat", feature = "block2"))]
488        /// Performs an inspection on the AVAsset and Preset the object was initialized with to determine a list of file types the ExportSession can write.
489        ///
490        /// Parameter `handler`: Called when the inspection completes with an array of file types the ExportSession can write.  Note that this may have a count of zero.
491        ///
492        /// This method is different than the supportedFileTypes property in that it performs an inspection of the AVAsset in order to determine its compatibility with each of the session's supported file types.
493        ///
494        /// # Safety
495        ///
496        /// `handler` block must be sendable.
497        #[unsafe(method(determineCompatibleFileTypesWithCompletionHandler:))]
498        #[unsafe(method_family = none)]
499        pub unsafe fn determineCompatibleFileTypesWithCompletionHandler(
500            &self,
501            handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<AVFileType>>)>,
502        );
503    );
504}
505
506/// AVAssetExportSessionDurationAndLength.
507impl AVAssetExportSession {
508    extern_methods!(
509        #[cfg(feature = "objc2-core-media")]
510        #[unsafe(method(timeRange))]
511        #[unsafe(method_family = none)]
512        pub unsafe fn timeRange(&self) -> CMTimeRange;
513
514        #[cfg(feature = "objc2-core-media")]
515        /// Setter for [`timeRange`][Self::timeRange].
516        #[unsafe(method(setTimeRange:))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn setTimeRange(&self, time_range: CMTimeRange);
519
520        #[cfg(feature = "objc2-core-media")]
521        #[deprecated = "Use estimateMaximumDurationWithCompletionHandler: instead"]
522        #[unsafe(method(maxDuration))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn maxDuration(&self) -> CMTime;
525
526        #[deprecated = "Use estimateOutputFileLengthWithCompletionHandler: instead"]
527        #[unsafe(method(estimatedOutputFileLength))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn estimatedOutputFileLength(&self) -> c_longlong;
530
531        #[unsafe(method(fileLengthLimit))]
532        #[unsafe(method_family = none)]
533        pub unsafe fn fileLengthLimit(&self) -> c_longlong;
534
535        /// Setter for [`fileLengthLimit`][Self::fileLengthLimit].
536        #[unsafe(method(setFileLengthLimit:))]
537        #[unsafe(method_family = none)]
538        pub unsafe fn setFileLengthLimit(&self, file_length_limit: c_longlong);
539
540        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
541        /// Starts the asynchronous execution of estimating the maximum duration of the export based on the asset, preset, and fileLengthLimit associated with the export session.
542        ///
543        /// If fileLengthLimit is not set on the export session, fileLengthLimit will be assumed to be the maximum file size specified by the preset (if any); else infinite.
544        ///
545        /// Parameter `handler`: A block called with the estimated maximum duration, or kCMTimeInvalid if an error occurs.  The error parameter will be non-nil if an error occurs.
546        ///
547        /// # Safety
548        ///
549        /// `handler` block must be sendable.
550        #[unsafe(method(estimateMaximumDurationWithCompletionHandler:))]
551        #[unsafe(method_family = none)]
552        pub unsafe fn estimateMaximumDurationWithCompletionHandler(
553            &self,
554            handler: &block2::DynBlock<dyn Fn(CMTime, *mut NSError)>,
555        );
556
557        #[cfg(feature = "block2")]
558        /// Starts the asynchronous execution of estimating the output file length of the export based on the asset, preset, and timeRange associated with the export session.
559        ///
560        /// If timeRange is not set on the export session, timeRange will be assumed to be the full time range of the asset.
561        ///
562        /// Parameter `handler`: A block called with the estimated output file length in bytes, if it can be determined; 0 otherwise.  The error parameter will be non-nil if an error occurs.
563        ///
564        /// # Safety
565        ///
566        /// `handler` block must be sendable.
567        #[unsafe(method(estimateOutputFileLengthWithCompletionHandler:))]
568        #[unsafe(method_family = none)]
569        pub unsafe fn estimateOutputFileLengthWithCompletionHandler(
570            &self,
571            handler: &block2::DynBlock<dyn Fn(i64, *mut NSError)>,
572        );
573    );
574}
575
576/// AVAssetExportSessionMetadata.
577impl AVAssetExportSession {
578    extern_methods!(
579        #[cfg(feature = "AVMetadataItem")]
580        #[unsafe(method(metadata))]
581        #[unsafe(method_family = none)]
582        pub unsafe fn metadata(&self) -> Option<Retained<NSArray<AVMetadataItem>>>;
583
584        #[cfg(feature = "AVMetadataItem")]
585        /// Setter for [`metadata`][Self::metadata].
586        ///
587        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
588        #[unsafe(method(setMetadata:))]
589        #[unsafe(method_family = none)]
590        pub unsafe fn setMetadata(&self, metadata: Option<&NSArray<AVMetadataItem>>);
591
592        #[cfg(feature = "AVMetadataItem")]
593        #[unsafe(method(metadataItemFilter))]
594        #[unsafe(method_family = none)]
595        pub unsafe fn metadataItemFilter(&self) -> Option<Retained<AVMetadataItemFilter>>;
596
597        #[cfg(feature = "AVMetadataItem")]
598        /// Setter for [`metadataItemFilter`][Self::metadataItemFilter].
599        #[unsafe(method(setMetadataItemFilter:))]
600        #[unsafe(method_family = none)]
601        pub unsafe fn setMetadataItemFilter(
602            &self,
603            metadata_item_filter: Option<&AVMetadataItemFilter>,
604        );
605    );
606}
607
608/// AVAssetExportSessionMediaProcessing.
609impl AVAssetExportSession {
610    extern_methods!(
611        #[cfg(feature = "AVAudioProcessingSettings")]
612        #[unsafe(method(audioTimePitchAlgorithm))]
613        #[unsafe(method_family = none)]
614        pub unsafe fn audioTimePitchAlgorithm(&self) -> Retained<AVAudioTimePitchAlgorithm>;
615
616        #[cfg(feature = "AVAudioProcessingSettings")]
617        /// Setter for [`audioTimePitchAlgorithm`][Self::audioTimePitchAlgorithm].
618        ///
619        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
620        #[unsafe(method(setAudioTimePitchAlgorithm:))]
621        #[unsafe(method_family = none)]
622        pub unsafe fn setAudioTimePitchAlgorithm(
623            &self,
624            audio_time_pitch_algorithm: &AVAudioTimePitchAlgorithm,
625        );
626
627        #[cfg(feature = "AVAudioMix")]
628        #[unsafe(method(audioMix))]
629        #[unsafe(method_family = none)]
630        pub unsafe fn audioMix(&self) -> Option<Retained<AVAudioMix>>;
631
632        #[cfg(feature = "AVAudioMix")]
633        /// Setter for [`audioMix`][Self::audioMix].
634        ///
635        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
636        #[unsafe(method(setAudioMix:))]
637        #[unsafe(method_family = none)]
638        pub unsafe fn setAudioMix(&self, audio_mix: Option<&AVAudioMix>);
639
640        #[cfg(feature = "AVVideoComposition")]
641        #[unsafe(method(videoComposition))]
642        #[unsafe(method_family = none)]
643        pub unsafe fn videoComposition(&self) -> Option<Retained<AVVideoComposition>>;
644
645        #[cfg(feature = "AVVideoComposition")]
646        /// Setter for [`videoComposition`][Self::videoComposition].
647        ///
648        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
649        #[unsafe(method(setVideoComposition:))]
650        #[unsafe(method_family = none)]
651        pub unsafe fn setVideoComposition(&self, video_composition: Option<&AVVideoComposition>);
652
653        #[cfg(feature = "AVVideoCompositing")]
654        #[unsafe(method(customVideoCompositor))]
655        #[unsafe(method_family = none)]
656        pub unsafe fn customVideoCompositor(
657            &self,
658        ) -> Option<Retained<ProtocolObject<dyn AVVideoCompositing>>>;
659
660        /// Defines export policy for handling alternate audio tracks
661        ///
662        ///
663        /// Specifies the handling of audio tracks that are members of the same alternate track group corresponding to an exported audio track in the source asset.
664        /// If no audio track group is present, the value of this property has no effect.
665        /// If necessary, use the trackGroups property of AVAsset to determine whether any audio track groups are present.
666        /// The AVAudioMix property is not allowed to be used when also specifying alternate track output handling.  An exception will be thrown if both are specified.
667        #[unsafe(method(audioTrackGroupHandling))]
668        #[unsafe(method_family = none)]
669        pub unsafe fn audioTrackGroupHandling(&self) -> AVAssetTrackGroupOutputHandling;
670
671        /// Setter for [`audioTrackGroupHandling`][Self::audioTrackGroupHandling].
672        #[unsafe(method(setAudioTrackGroupHandling:))]
673        #[unsafe(method_family = none)]
674        pub unsafe fn setAudioTrackGroupHandling(
675            &self,
676            audio_track_group_handling: AVAssetTrackGroupOutputHandling,
677        );
678    );
679}
680
681/// AVAssetExportSessionMultipass.
682impl AVAssetExportSession {
683    extern_methods!(
684        /// Determines whether the export session can perform multiple passes over the source media to achieve better results.
685        ///
686        ///
687        /// When the value for this property is YES, the export session can produce higher quality results at the expense of longer export times.  Setting this property to YES may also require the export session to write temporary data to disk during the export.  To control the location of temporary data, use the property directoryForTemporaryFiles.
688        ///
689        /// The default value is NO.  Not all export session configurations can benefit from performing multiple passes over the source media.  In these cases, setting this property to YES has no effect.
690        ///
691        /// This property cannot be set after the export has started.
692        #[unsafe(method(canPerformMultiplePassesOverSourceMediaData))]
693        #[unsafe(method_family = none)]
694        pub unsafe fn canPerformMultiplePassesOverSourceMediaData(&self) -> bool;
695
696        /// Setter for [`canPerformMultiplePassesOverSourceMediaData`][Self::canPerformMultiplePassesOverSourceMediaData].
697        #[unsafe(method(setCanPerformMultiplePassesOverSourceMediaData:))]
698        #[unsafe(method_family = none)]
699        pub unsafe fn setCanPerformMultiplePassesOverSourceMediaData(
700            &self,
701            can_perform_multiple_passes_over_source_media_data: bool,
702        );
703
704        /// Specifies a directory that is suitable for containing temporary files generated during the export process
705        ///
706        ///
707        /// AVAssetExportSession may need to write temporary files when configured in certain ways, such as when canPerformMultiplePassesOverSourceMediaData is set to YES.  This property can be used to control where in the filesystem those temporary files are created.  All temporary files will be deleted when the export is completed, is canceled, or fails.
708        ///
709        /// When the value of this property is nil, the export session will choose a suitable location when writing temporary files.  The default value is nil.
710        ///
711        /// This property cannot be set after the export has started.  The export will fail if the URL points to a location that is not a directory, does not exist, is not on the local file system, or if a file cannot be created in this directory (for example, due to insufficient permissions or sandboxing restrictions).
712        #[unsafe(method(directoryForTemporaryFiles))]
713        #[unsafe(method_family = none)]
714        pub unsafe fn directoryForTemporaryFiles(&self) -> Option<Retained<NSURL>>;
715
716        /// Setter for [`directoryForTemporaryFiles`][Self::directoryForTemporaryFiles].
717        ///
718        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
719        #[unsafe(method(setDirectoryForTemporaryFiles:))]
720        #[unsafe(method_family = none)]
721        pub unsafe fn setDirectoryForTemporaryFiles(
722            &self,
723            directory_for_temporary_files: Option<&NSURL>,
724        );
725    );
726}