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