objc2_av_foundation/generated/
AVAsset.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#[cfg(feature = "objc2-uniform-type-identifiers")]
12use objc2_uniform_type_identifiers::*;
13
14use crate::*;
15
16extern_class!(
17    /// An AVAsset is an abstract class that defines AVFoundation's model for timed audiovisual media.
18    ///
19    /// Each asset contains a collection of tracks that are intended to be presented or processed together, each of a uniform media type, including but not limited to audio, video, text, closed captions, and subtitles.
20    ///
21    /// AVAssets are often instantiated via its concrete subclass AVURLAsset with NSURLs that refer to audiovisual media resources, such as streams (including HTTP live streams), QuickTime movie files, MP3 files, and files of other types.
22    ///
23    /// They can also be instantiated using other concrete subclasses that extend the basic model for audiovisual media in useful ways, as AVComposition does for temporal editing.
24    ///
25    /// Properties of assets as a whole are defined by AVAsset. Additionally, references to instances of AVAssetTracks representing tracks of the collection can be obtained, so that each of these can be examined independently.
26    ///
27    /// Because of the nature of timed audiovisual media, upon successful initialization of an AVAsset some or all of the values for its keys may not be immediately available. The value of any key can be requested at any time, and AVAsset will always return its value synchronously, although it may have to block the calling thread in order to do so.
28    ///
29    /// In order to avoid blocking, clients can register their interest in particular keys and to become notified when their values become available. For further details, see AVAsynchronousKeyValueLoading.h. For clients who want to examine a subset of the tracks, metadata, and other parts of the asset, asynchronous methods like -loadTracksWithMediaType:completionHandler: can be used to load this information without blocking. When using these asynchronous methods, it is not necessary to load the associated property beforehand. Swift clients can also use the load(:) method to load properties in a type safe manner.
30    ///
31    /// On platforms other than macOS, it is particularly important to avoid blocking. To preserve responsiveness, a synchronous request that blocks for too long (eg, a property request on an asset on a slow HTTP server) may lead to media services being reset.
32    ///
33    /// To play an instance of AVAsset, initialize an instance of AVPlayerItem with it, use the AVPlayerItem to set up its presentation state (such as whether only a limited timeRange of the asset should be played, etc.), and provide the AVPlayerItem to an AVPlayer according to whether the items is to be played by itself or together with a collection of other items. Full details available in AVPlayerItem.h and AVPlayer.h.
34    ///
35    /// AVAssets can also be inserted into AVMutableCompositions in order to assemble audiovisual constructs from one or more source assets.
36    ///
37    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avasset?language=objc)
38    #[unsafe(super(NSObject))]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    pub struct AVAsset;
41);
42
43#[cfg(feature = "AVAsynchronousKeyValueLoading")]
44extern_conformance!(
45    unsafe impl AVAsynchronousKeyValueLoading for AVAsset {}
46);
47
48extern_conformance!(
49    unsafe impl NSCopying for AVAsset {}
50);
51
52unsafe impl CopyingHelper for AVAsset {
53    type Result = Self;
54}
55
56extern_conformance!(
57    unsafe impl NSObjectProtocol for AVAsset {}
58);
59
60impl AVAsset {
61    extern_methods!(
62        /// Returns an instance of AVAsset for inspection of a media resource.
63        ///
64        /// Returns a newly allocated instance of a subclass of AVAsset initialized with the specified URL.
65        ///
66        /// - Parameter URL: An instance of NSURL that references a media resource.
67        ///
68        /// - Returns: An instance of AVAsset.
69        #[unsafe(method(assetWithURL:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn assetWithURL(url: &NSURL) -> Retained<Self>;
72
73        #[cfg(feature = "objc2-core-media")]
74        /// Indicates the duration of the asset.
75        ///
76        /// If
77        /// "
78        /// providesPreciseDurationAndTiming" is NO, a best-available estimate of the duration is returned. The degree of precision preferred for timing-related properties can be set at initialization time for assets initialized with URLs
79        ///
80        /// - Seealso: AVURLAssetPreferPreciseDurationAndTimingKey for AVURLAsset below.
81        #[unsafe(method(duration))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn duration(&self) -> CMTime;
84
85        /// Indicates the natural rate at which the asset is to be played; often but not always 1.0
86        #[unsafe(method(preferredRate))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn preferredRate(&self) -> c_float;
89
90        /// Indicates the preferred volume at which the audible media of an asset is to be played; often but not always 1.0
91        #[unsafe(method(preferredVolume))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn preferredVolume(&self) -> c_float;
94
95        #[cfg(feature = "objc2-core-foundation")]
96        /// Indicates the preferred transform to apply to the visual content of the asset for presentation or processing; the value is often but not always the identity transform
97        #[unsafe(method(preferredTransform))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn preferredTransform(&self) -> CGAffineTransform;
100
101        #[cfg(feature = "objc2-core-foundation")]
102        /// The following property is deprecated. Instead, use the naturalSize and preferredTransform, as appropriate, of the receiver's video tracks. See -tracksWithMediaType: below.
103        #[deprecated = "Use the naturalSize and preferredTransform, as appropriate, of the receiver's video tracks. See -tracksWithMediaType:"]
104        #[unsafe(method(naturalSize))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn naturalSize(&self) -> CGSize;
107
108        #[cfg(feature = "objc2-core-media")]
109        /// Indicates how close to the latest content in a live stream playback can be sustained.
110        ///
111        /// For non-live assets this value is kCMTimeInvalid.
112        #[unsafe(method(minimumTimeOffsetFromLive))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn minimumTimeOffsetFromLive(&self) -> CMTime;
115    );
116}
117
118/// Methods declared on superclass `NSObject`.
119impl AVAsset {
120    extern_methods!(
121        #[unsafe(method(init))]
122        #[unsafe(method_family = init)]
123        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
124
125        #[unsafe(method(new))]
126        #[unsafe(method_family = new)]
127        pub unsafe fn new() -> Retained<Self>;
128    );
129}
130
131/// AVAssetAsynchronousLoading.
132impl AVAsset {
133    extern_methods!(
134        /// Indicates that the asset provides precise timing. See
135        /// "
136        /// duration" above and AVURLAssetPreferPreciseDurationAndTimingKey below.
137        #[unsafe(method(providesPreciseDurationAndTiming))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn providesPreciseDurationAndTiming(&self) -> bool;
140
141        /// Cancels the loading of all values for all observers.
142        ///
143        /// Deallocation or finalization of an instance of AVAsset will implicitly cancel loading if any loading requests are still outstanding.
144        #[unsafe(method(cancelLoading))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn cancelLoading(&self);
147    );
148}
149
150/// These constants can be passed in to AVURLAssetReferenceRestrictionsKey to control the resolution of references to external media data.
151///
152/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetreferencerestrictions?language=objc)
153// NS_OPTIONS
154#[repr(transparent)]
155#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
156pub struct AVAssetReferenceRestrictions(pub NSUInteger);
157bitflags::bitflags! {
158    impl AVAssetReferenceRestrictions: NSUInteger {
159/// Indicates that all types of references should be followed.
160        #[doc(alias = "AVAssetReferenceRestrictionForbidNone")]
161        const ForbidNone = 0;
162/// Indicates that references from a remote asset (e.g. referenced via http URL) to local media data (e.g. stored in a local file) should not be followed.
163        #[doc(alias = "AVAssetReferenceRestrictionForbidRemoteReferenceToLocal")]
164        const ForbidRemoteReferenceToLocal = 1<<0;
165/// Indicates that references from a local asset to remote media data should not be followed.
166        #[doc(alias = "AVAssetReferenceRestrictionForbidLocalReferenceToRemote")]
167        const ForbidLocalReferenceToRemote = 1<<1;
168/// Indicates that references from a remote asset to remote media data stored at a different site should not be followed.
169        #[doc(alias = "AVAssetReferenceRestrictionForbidCrossSiteReference")]
170        const ForbidCrossSiteReference = 1<<2;
171/// Indicates that references from a local asset to local media data stored outside the asset's container file should not be followed.
172        #[doc(alias = "AVAssetReferenceRestrictionForbidLocalReferenceToLocal")]
173        const ForbidLocalReferenceToLocal = 1<<3;
174/// Indicates that only references to media data stored within the asset's container file should be allowed.
175        #[doc(alias = "AVAssetReferenceRestrictionForbidAll")]
176        const ForbidAll = 0xFFFF;
177/// Indicates that only references to media data stored within the asset's container file should be allowed.
178        #[doc(alias = "AVAssetReferenceRestrictionDefaultPolicy")]
179        const DefaultPolicy = AVAssetReferenceRestrictions::ForbidLocalReferenceToRemote.0;
180    }
181}
182
183unsafe impl Encode for AVAssetReferenceRestrictions {
184    const ENCODING: Encoding = NSUInteger::ENCODING;
185}
186
187unsafe impl RefEncode for AVAssetReferenceRestrictions {
188    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
189}
190
191/// AVAssetReferenceRestrictions.
192impl AVAsset {
193    extern_methods!(
194        /// Indicates the reference restrictions being used by the receiver.
195        ///
196        /// For AVURLAsset, this property reflects the value passed in for AVURLAssetReferenceRestrictionsKey, if any. See AVURLAssetReferenceRestrictionsKey below for a full discussion of reference restrictions. The default value for this property is AVAssetReferenceRestrictionForbidLocalReferenceToRemote.
197        #[unsafe(method(referenceRestrictions))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn referenceRestrictions(&self) -> AVAssetReferenceRestrictions;
200    );
201}
202
203/// AVAssetTrackInspection.
204impl AVAsset {
205    extern_methods!(
206        #[cfg(feature = "AVAssetTrack")]
207        /// Provides the array of AVAssetTracks contained by the asset
208        #[unsafe(method(tracks))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn tracks(&self) -> Retained<NSArray<AVAssetTrack>>;
211
212        #[cfg(all(feature = "AVAssetTrack", feature = "objc2-core-media"))]
213        /// Provides an instance of AVAssetTrack that represents the track of the specified trackID.
214        ///
215        /// Becomes callable without blocking when the key
216        /// "
217        /// tracks" has been loaded
218        ///
219        /// - Parameter trackID: The trackID of the requested AVAssetTrack.
220        ///
221        /// - Returns: An instance of AVAssetTrack; may be nil if no track of the specified trackID is available.
222        #[deprecated = "Use loadTrackWithTrackID:completionHandler: instead"]
223        #[unsafe(method(trackWithTrackID:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn trackWithTrackID(
226            &self,
227            track_id: CMPersistentTrackID,
228        ) -> Option<Retained<AVAssetTrack>>;
229
230        #[cfg(all(
231            feature = "AVAssetTrack",
232            feature = "block2",
233            feature = "objc2-core-media"
234        ))]
235        /// Loads an instance of AVAssetTrack that represents the track of the specified trackID.
236        ///
237        /// - Parameter trackID: The trackID of the requested AVAssetTrack.
238        /// - 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.
239        ///
240        /// # Safety
241        ///
242        /// `completion_handler` block must be sendable.
243        #[unsafe(method(loadTrackWithTrackID:completionHandler:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn loadTrackWithTrackID_completionHandler(
246            &self,
247            track_id: CMPersistentTrackID,
248            completion_handler: &block2::DynBlock<dyn Fn(*mut AVAssetTrack, *mut NSError)>,
249        );
250
251        #[cfg(all(feature = "AVAssetTrack", feature = "AVMediaFormat"))]
252        /// Provides an array of AVAssetTracks of the asset that present media of the specified media type.
253        ///
254        /// Becomes callable without blocking when the key
255        /// "
256        /// tracks" has been loaded
257        ///
258        /// - Parameter mediaType: The media type according to which AVAsset filters its AVAssetTracks. (Media types are defined in AVMediaFormat.h.)
259        ///
260        /// - Returns: An NSArray of AVAssetTracks; may be empty if no tracks of the specified media type are available.
261        #[deprecated = "Use loadTracksWithMediaType:completionHandler: instead"]
262        #[unsafe(method(tracksWithMediaType:))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn tracksWithMediaType(
265            &self,
266            media_type: &AVMediaType,
267        ) -> Retained<NSArray<AVAssetTrack>>;
268
269        #[cfg(all(
270            feature = "AVAssetTrack",
271            feature = "AVMediaFormat",
272            feature = "block2"
273        ))]
274        /// Loads an array of AVAssetTracks of the asset that present media of the specified media type.
275        ///
276        /// - Parameter mediaType: The media type according to which AVAsset filters its AVAssetTracks. (Media types are defined in AVMediaFormat.h.)
277        /// - 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.
278        ///
279        /// # Safety
280        ///
281        /// `completion_handler` block must be sendable.
282        #[unsafe(method(loadTracksWithMediaType:completionHandler:))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn loadTracksWithMediaType_completionHandler(
285            &self,
286            media_type: &AVMediaType,
287            completion_handler: &block2::DynBlock<dyn Fn(*mut NSArray<AVAssetTrack>, *mut NSError)>,
288        );
289
290        #[cfg(all(feature = "AVAssetTrack", feature = "AVMediaFormat"))]
291        /// Provides an array of AVAssetTracks of the asset that present media with the specified characteristic.
292        ///
293        /// Becomes callable without blocking when the key
294        /// "
295        /// tracks" has been loaded
296        ///
297        /// - Parameter mediaCharacteristic: The media characteristic according to which AVAsset filters its AVAssetTracks. (Media characteristics are defined in AVMediaFormat.h.)
298        ///
299        /// - Returns: An NSArray of AVAssetTracks; may be empty if no tracks with the specified characteristic are available.
300        #[deprecated = "Use loadTracksWithMediaCharacteristic:completionHandler: instead"]
301        #[unsafe(method(tracksWithMediaCharacteristic:))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn tracksWithMediaCharacteristic(
304            &self,
305            media_characteristic: &AVMediaCharacteristic,
306        ) -> Retained<NSArray<AVAssetTrack>>;
307
308        #[cfg(all(
309            feature = "AVAssetTrack",
310            feature = "AVMediaFormat",
311            feature = "block2"
312        ))]
313        /// Loads an array of AVAssetTracks of the asset that present media with the specified characteristic.
314        ///
315        /// - Parameter mediaCharacteristic: The media characteristic according to which AVAsset filters its AVAssetTracks. (Media characteristics are defined in AVMediaFormat.h.)
316        /// - 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.
317        ///
318        /// # Safety
319        ///
320        /// `completion_handler` block must be sendable.
321        #[unsafe(method(loadTracksWithMediaCharacteristic:completionHandler:))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn loadTracksWithMediaCharacteristic_completionHandler(
324            &self,
325            media_characteristic: &AVMediaCharacteristic,
326            completion_handler: &block2::DynBlock<dyn Fn(*mut NSArray<AVAssetTrack>, *mut NSError)>,
327        );
328
329        #[cfg(feature = "AVAssetTrackGroup")]
330        /// All track groups in the receiver.
331        ///
332        /// The value of this property is an NSArray of AVAssetTrackGroups, each representing a different grouping of tracks in the receiver.
333        #[unsafe(method(trackGroups))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn trackGroups(&self) -> Retained<NSArray<AVAssetTrackGroup>>;
336    );
337}
338
339/// AVAssetMetadataReading.
340impl AVAsset {
341    extern_methods!(
342        #[cfg(feature = "AVMetadataItem")]
343        /// Indicates the creation date of the asset as an AVMetadataItem. May be nil. If a creation date has been stored by the asset in a form that can be converted to an NSDate, the dateValue property of the AVMetadataItem will provide an instance of NSDate. Otherwise the creation date is available only as a string value, via -[AVMetadataItem stringValue].
344        #[unsafe(method(creationDate))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn creationDate(&self) -> Option<Retained<AVMetadataItem>>;
347
348        /// Provides access to the lyrics of the asset suitable for the current locale.
349        #[unsafe(method(lyrics))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn lyrics(&self) -> Option<Retained<NSString>>;
352
353        #[cfg(feature = "AVMetadataItem")]
354        /// Provides access to an array of AVMetadataItems for each common metadata key for which a value is available; items can be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:] and according to identifier via +[AVMetadataItem metadataItemsFromArray:filteredByIdentifier:].
355        #[unsafe(method(commonMetadata))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn commonMetadata(&self) -> Retained<NSArray<AVMetadataItem>>;
358
359        #[cfg(feature = "AVMetadataItem")]
360        /// Provides access to an array of AVMetadataItems for all metadata identifiers for which a value is available; items can be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:] and according to identifier via +[AVMetadataItem metadataItemsFromArray:filteredByIdentifier:].
361        #[unsafe(method(metadata))]
362        #[unsafe(method_family = none)]
363        pub unsafe fn metadata(&self) -> Retained<NSArray<AVMetadataItem>>;
364
365        #[cfg(feature = "AVMetadataFormat")]
366        /// Provides an NSArray of NSStrings, each representing a metadata format that's available to the asset (e.g. ID3, iTunes metadata, etc.). Metadata formats are defined in AVMetadataFormat.h.
367        #[unsafe(method(availableMetadataFormats))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn availableMetadataFormats(&self) -> Retained<NSArray<AVMetadataFormat>>;
370
371        #[cfg(all(feature = "AVMetadataFormat", feature = "AVMetadataItem"))]
372        /// Provides an NSArray of AVMetadataItems, one for each metadata item in the container of the specified format; can subsequently be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:], according to locale via +[AVMetadataItem metadataItemsFromArray:withLocale:], or according to key via +[AVMetadataItem metadataItemsFromArray:withKey:keySpace:].
373        ///
374        /// Becomes callable without blocking when the key
375        /// "
376        /// availableMetadataFormats" has been loaded
377        ///
378        /// - Parameter format: The metadata format for which items are requested.
379        ///
380        /// - Returns: An NSArray containing AVMetadataItems; may be empty if there is no metadata of the specified format.
381        #[deprecated = "Use loadMetadataForFormat:completionHandler: instead"]
382        #[unsafe(method(metadataForFormat:))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn metadataForFormat(
385            &self,
386            format: &AVMetadataFormat,
387        ) -> Retained<NSArray<AVMetadataItem>>;
388
389        #[cfg(all(
390            feature = "AVMetadataFormat",
391            feature = "AVMetadataItem",
392            feature = "block2"
393        ))]
394        /// Loads an NSArray of AVMetadataItems, one for each metadata item in the container of the specified format; can subsequently be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:], according to locale via +[AVMetadataItem metadataItemsFromArray:withLocale:], or according to key via +[AVMetadataItem metadataItemsFromArray:withKey:keySpace:].
395        ///
396        /// - Parameter format: The metadata format for which items are requested.
397        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending the array of metadata items (which may be empty if there is no metadata of the specified format) or an error.
398        ///
399        /// # Safety
400        ///
401        /// `completion_handler` block must be sendable.
402        #[unsafe(method(loadMetadataForFormat:completionHandler:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn loadMetadataForFormat_completionHandler(
405            &self,
406            format: &AVMetadataFormat,
407            completion_handler: &block2::DynBlock<
408                dyn Fn(*mut NSArray<AVMetadataItem>, *mut NSError),
409            >,
410        );
411    );
412}
413
414/// AVAssetChapterInspection.
415impl AVAsset {
416    extern_methods!(
417        /// array of NSLocale
418        #[unsafe(method(availableChapterLocales))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn availableChapterLocales(&self) -> Retained<NSArray<NSLocale>>;
421
422        #[cfg(all(feature = "AVMetadataFormat", feature = "AVTimedMetadataGroup"))]
423        /// Provides an array of chapters.
424        ///
425        /// This method returns an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.
426        ///
427        /// An AVMetadataItem with the specified common key will be added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and the metadata group overlaps. The locale of items not carrying chapter titles need not match the specified locale parameter.
428        ///
429        /// Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:].
430        ///
431        /// - Parameter locale: Locale of the metadata items carrying chapter titles to be returned (supports the IETF BCP 47 specification).
432        /// - Parameter commonKeys: Array of common keys of AVMetadataItem to be included; can be nil. AVMetadataCommonKeyArtwork is the only supported key for now.
433        ///
434        /// - Returns: An NSArray of AVTimedMetadataGroup.
435        #[deprecated = "Use loadChapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:completionHandler: instead"]
436        #[unsafe(method(chapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn chapterMetadataGroupsWithTitleLocale_containingItemsWithCommonKeys(
439            &self,
440            locale: &NSLocale,
441            common_keys: Option<&NSArray<AVMetadataKey>>,
442        ) -> Retained<NSArray<AVTimedMetadataGroup>>;
443
444        #[cfg(all(
445            feature = "AVMetadataFormat",
446            feature = "AVTimedMetadataGroup",
447            feature = "block2"
448        ))]
449        /// Loads an array of chapters.
450        ///
451        /// This method vends an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.
452        ///
453        /// An AVMetadataItem with the specified common key will be added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and the metadata group overlaps. The locale of items not carrying chapter titles need not match the specified locale parameter.
454        ///
455        /// Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:].
456        ///
457        /// - Parameter locale: Locale of the metadata items carrying chapter titles to be returned (supports the IETF BCP 47 specification).
458        /// - Parameter commonKeys: Array of common keys of AVMetadataItem to be included; if no common keys are required, send an empty list. AVMetadataCommonKeyArtwork is the only supported key for now.
459        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending the array of timed metadata groups or an error.
460        ///
461        /// # Safety
462        ///
463        /// `completion_handler` block must be sendable.
464        #[unsafe(method(loadChapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:completionHandler:))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn loadChapterMetadataGroupsWithTitleLocale_containingItemsWithCommonKeys_completionHandler(
467            &self,
468            locale: &NSLocale,
469            common_keys: &NSArray<AVMetadataKey>,
470            completion_handler: &block2::DynBlock<
471                dyn Fn(*mut NSArray<AVTimedMetadataGroup>, *mut NSError),
472            >,
473        );
474
475        #[cfg(feature = "AVTimedMetadataGroup")]
476        /// Tests, in order of preference, for a match between language identifiers in the specified array of preferred languages and the available chapter locales, and returns the array of chapters corresponding to the first match that's found.
477        ///
478        /// Safe to call without blocking when the AVAsset key availableChapterLocales has status AVKeyValueStatusLoaded.
479        ///
480        /// Returns an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.
481        ///
482        /// All of the available chapter metadata is included in the metadata groups, including items with the common key AVMetadataCommonKeyArtwork, if such items are present. Items not carrying chapter titles will be added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and that of the metadata group overlaps. The locale of such items need not match the locale of the chapter titles.
483        ///
484        /// Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:].
485        ///
486        /// - Parameter preferredLanguages: An array of language identifiers in order of preference, each of which is an IETF BCP 47 (RFC 4646) language identifier. If your goal is to provide the best match for the end user's preferred languages without consideration of your app's available localizations, pass [NSLocale preferredLanguages] as the value of preferredLanguages. However, if you want to filter the available choices in order to obtain the best match among the localizations that are available for your app, pass [NSBundle preferredLocalizationsFromArray:[[NSBundle mainBundle] localizations] forPreferences:[NSLocale preferredLanguages]] instead. The latter choice is normally more appropriate for strings intended for display as part of the app's UI.
487        ///
488        /// - Returns: An NSArray of AVTimedMetadataGroup.
489        #[deprecated = "Use loadChapterMetadataGroupsBestMatchingPreferredLanguages:completionHandler: instead"]
490        #[unsafe(method(chapterMetadataGroupsBestMatchingPreferredLanguages:))]
491        #[unsafe(method_family = none)]
492        pub unsafe fn chapterMetadataGroupsBestMatchingPreferredLanguages(
493            &self,
494            preferred_languages: &NSArray<NSString>,
495        ) -> Retained<NSArray<AVTimedMetadataGroup>>;
496
497        #[cfg(all(feature = "AVTimedMetadataGroup", feature = "block2"))]
498        /// Tests, in order of preference, for a match between language identifiers in the specified array of preferred languages and the available chapter locales, and loads the array of chapters corresponding to the first match that's found.
499        ///
500        /// Returns an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.
501        ///
502        /// All of the available chapter metadata is included in the metadata groups, including items with the common key AVMetadataCommonKeyArtwork, if such items are present. Items not carrying chapter titles will be added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and that of the metadata group overlaps. The locale of such items need not match the locale of the chapter titles.
503        ///
504        /// Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:].
505        ///
506        /// - Parameter preferredLanguages: An array of language identifiers in order of preference, each of which is an IETF BCP 47 (RFC 4646) language identifier. If your goal is to provide the best match for the end user's preferred languages without consideration of your app's available localizations, pass [NSLocale preferredLanguages] as the value of preferredLanguages. However, if you want to filter the available choices in order to obtain the best match among the localizations that are available for your app, pass [NSBundle preferredLocalizationsFromArray:[[NSBundle mainBundle] localizations] forPreferences:[NSLocale preferredLanguages]] instead. The latter choice is normally more appropriate for strings intended for display as part of the app's UI.
507        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending the array of timed metadata groups or an error.
508        ///
509        /// # Safety
510        ///
511        /// `completion_handler` block must be sendable.
512        #[unsafe(method(loadChapterMetadataGroupsBestMatchingPreferredLanguages:completionHandler:))]
513        #[unsafe(method_family = none)]
514        pub unsafe fn loadChapterMetadataGroupsBestMatchingPreferredLanguages_completionHandler(
515            &self,
516            preferred_languages: &NSArray<NSString>,
517            completion_handler: &block2::DynBlock<
518                dyn Fn(*mut NSArray<AVTimedMetadataGroup>, *mut NSError),
519            >,
520        );
521    );
522}
523
524/// AVAssetMediaSelection.
525impl AVAsset {
526    extern_methods!(
527        #[cfg(feature = "AVMediaFormat")]
528        /// Provides an NSArray of NSStrings, each NSString indicating a media characteristic for which a media selection option is available.
529        #[unsafe(method(availableMediaCharacteristicsWithMediaSelectionOptions))]
530        #[unsafe(method_family = none)]
531        pub unsafe fn availableMediaCharacteristicsWithMediaSelectionOptions(
532            &self,
533        ) -> Retained<NSArray<AVMediaCharacteristic>>;
534
535        #[cfg(all(feature = "AVMediaFormat", feature = "AVMediaSelectionGroup"))]
536        /// Provides an instance of AVMediaSelectionGroup that contains one or more options with the specified media characteristic.
537        ///
538        /// Becomes callable without blocking when the key
539        /// "
540        /// availableMediaCharacteristicsWithMediaSelectionOptions" has been loaded.
541        ///
542        /// If the asset has no AVMediaSelectionGroup containing options with the specified media characteristic, the return value will be nil.
543        ///
544        /// Filtering of the options in the returned AVMediaSelectionGroup according to playability, locale, and additional media characteristics can be accomplished using the category AVMediaSelectionOptionFiltering defined on AVMediaSelectionGroup.
545        ///
546        /// - Parameter mediaCharacteristic: A media characteristic for which you wish to obtain the available media selection options. AVMediaCharacteristicAudible, AVMediaCharacteristicLegible, and AVMediaCharacteristicVisual are currently supported.
547        /// Pass AVMediaCharacteristicAudible to obtain the group of available options for audio media in various languages and for various purposes, such as descriptive audio.
548        /// Pass AVMediaCharacteristicLegible to obtain the group of available options for subtitles in various languages and for various purposes.
549        /// Pass AVMediaCharacteristicVisual to obtain the group of available options for video media.
550        ///
551        /// - Returns: An instance of AVMediaSelectionGroup. May be nil.
552        #[deprecated = "Use loadMediaSelectionGroupForMediaCharacteristic:completionHandler: instead"]
553        #[unsafe(method(mediaSelectionGroupForMediaCharacteristic:))]
554        #[unsafe(method_family = none)]
555        pub unsafe fn mediaSelectionGroupForMediaCharacteristic(
556            &self,
557            media_characteristic: &AVMediaCharacteristic,
558        ) -> Option<Retained<AVMediaSelectionGroup>>;
559
560        #[cfg(all(
561            feature = "AVMediaFormat",
562            feature = "AVMediaSelectionGroup",
563            feature = "block2"
564        ))]
565        /// Loads an instance of AVMediaSelectionGroup that contains one or more options with the specified media characteristic.
566        ///
567        /// If the asset has no AVMediaSelectionGroup containing options with the specified media characteristic, the return value will be nil.
568        ///
569        /// Filtering of the options in the returned AVMediaSelectionGroup according to playability, locale, and additional media characteristics can be accomplished using the category AVMediaSelectionOptionFiltering defined on AVMediaSelectionGroup.
570        ///
571        /// - Parameter mediaCharacteristic: A media characteristic for which you wish to obtain the available media selection options. AVMediaCharacteristicAudible, AVMediaCharacteristicLegible, and AVMediaCharacteristicVisual are currently supported.
572        /// Pass AVMediaCharacteristicAudible to obtain the group of available options for audio media in various languages and for various purposes, such as descriptive audio.
573        /// Pass AVMediaCharacteristicLegible to obtain the group of available options for subtitles in various languages and for various purposes
574        /// Pass AVMediaCharacteristicVisual to obtain the group of available options for video media.
575        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending an instance of AVMediaSelectionGroup (which may be nil) or an error.
576        ///
577        /// # Safety
578        ///
579        /// `completion_handler` block must be sendable.
580        #[unsafe(method(loadMediaSelectionGroupForMediaCharacteristic:completionHandler:))]
581        #[unsafe(method_family = none)]
582        pub unsafe fn loadMediaSelectionGroupForMediaCharacteristic_completionHandler(
583            &self,
584            media_characteristic: &AVMediaCharacteristic,
585            completion_handler: &block2::DynBlock<dyn Fn(*mut AVMediaSelectionGroup, *mut NSError)>,
586        );
587
588        #[cfg(feature = "AVMediaSelection")]
589        /// Provides an instance of AVMediaSelection with default selections for each of the receiver's media selection groups.
590        #[unsafe(method(preferredMediaSelection))]
591        #[unsafe(method_family = none)]
592        pub unsafe fn preferredMediaSelection(&self) -> Retained<AVMediaSelection>;
593
594        #[cfg(feature = "AVMediaSelection")]
595        /// Provides an array of all permutations of AVMediaSelection for this asset.
596        #[unsafe(method(allMediaSelections))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn allMediaSelections(&self) -> Retained<NSArray<AVMediaSelection>>;
599    );
600}
601
602/// AVAssetProtectedContent.
603impl AVAsset {
604    extern_methods!(
605        /// Indicates whether or not the asset has protected content.
606        ///
607        /// Assets containing protected content may not be playable without successful authorization, even if the value of the "playable" property is YES. See the properties in the AVAssetUsability category for details on how such an asset may be used. On macOS, clients can use the interfaces in AVPlayerItemProtectedContentAdditions.h to request authorization to play the asset.
608        #[unsafe(method(hasProtectedContent))]
609        #[unsafe(method_family = none)]
610        pub unsafe fn hasProtectedContent(&self) -> bool;
611    );
612}
613
614/// AVAssetFragments.
615impl AVAsset {
616    extern_methods!(
617        /// Indicates whether the asset is capable of being extended by fragments.
618        ///
619        /// For QuickTime movie files and MPEG-4 files, the value of canContainFragments is YES if an 'mvex' box is present in the 'moov' box. For those types, the 'mvex' box signals the possible presence of later 'moof' boxes.
620        #[unsafe(method(canContainFragments))]
621        #[unsafe(method_family = none)]
622        pub unsafe fn canContainFragments(&self) -> bool;
623
624        /// Indicates whether the asset is extended by at least one fragment.
625        ///
626        /// For QuickTime movie files and MPEG-4 files, the value of this property is YES if canContainFragments is YES and at least one 'moof' box is present after the 'moov' box.
627        #[unsafe(method(containsFragments))]
628        #[unsafe(method_family = none)]
629        pub unsafe fn containsFragments(&self) -> bool;
630
631        #[cfg(feature = "objc2-core-media")]
632        /// Indicates the total duration of fragments that either exist now or may be appended in the future in order to extend the duration of the asset.
633        ///
634        /// For QuickTime movie files and MPEG-4 files, the value of this property is obtained from the 'mehd' box of the 'mvex' box, if present. If no total fragment duration hint is available, the value of this property is kCMTimeInvalid.
635        #[unsafe(method(overallDurationHint))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn overallDurationHint(&self) -> CMTime;
638    );
639}
640
641/// AVAssetUsability.
642impl AVAsset {
643    extern_methods!(
644        /// Indicates whether an AVPlayer can play the contents of the asset in a manner that meets user expectations.
645        ///
646        /// A client can attempt playback when playable is NO, this however may lead to a substandard playback experience.
647        #[unsafe(method(isPlayable))]
648        #[unsafe(method_family = none)]
649        pub unsafe fn isPlayable(&self) -> bool;
650
651        /// Indicates whether an AVAssetExportSession can be used with the receiver for export
652        #[unsafe(method(isExportable))]
653        #[unsafe(method_family = none)]
654        pub unsafe fn isExportable(&self) -> bool;
655
656        /// Indicates whether an AVAssetReader can be used with the receiver for extracting media data
657        #[unsafe(method(isReadable))]
658        #[unsafe(method_family = none)]
659        pub unsafe fn isReadable(&self) -> bool;
660
661        /// Indicates whether the receiver can be used to build an AVMutableComposition
662        #[unsafe(method(isComposable))]
663        #[unsafe(method_family = none)]
664        pub unsafe fn isComposable(&self) -> bool;
665
666        /// Indicates whether the receiver can be written to the saved photos album
667        #[unsafe(method(isCompatibleWithSavedPhotosAlbum))]
668        #[unsafe(method_family = none)]
669        pub unsafe fn isCompatibleWithSavedPhotosAlbum(&self) -> bool;
670
671        /// Indicates whether the asset is compatible with AirPlay Video.
672        ///
673        /// YES if an AVPlayerItem initialized with the receiver can be played by an external device via AirPlay Video.
674        #[unsafe(method(isCompatibleWithAirPlayVideo))]
675        #[unsafe(method_family = none)]
676        pub unsafe fn isCompatibleWithAirPlayVideo(&self) -> bool;
677    );
678}
679
680extern "C" {
681    /// Indicates whether the asset should be prepared to indicate a precise duration and provide precise random access by time.
682    ///
683    /// The value for this key is a boolean NSNumber.
684    ///
685    /// If nil is passed as the value of the options parameter to -[AVURLAsset initWithURL:options:], or if a dictionary that lacks a value for the key AVURLAssetPreferPreciseDurationAndTimingKey is passed instead, a default value of NO is assumed. If the asset is intended to be played only, because AVPlayer will support approximate random access by time when full precision isn't available, the default value of NO will suffice.
686    /// Pass YES if longer loading times are acceptable in cases in which precise timing is required. If the asset is intended to be inserted into an AVMutableComposition, precise random access is typically desirable and the value of YES is recommended.
687    /// Note that such precision may require additional parsing of the resource in advance of operations that make use of any portion of it, depending on the specifics of its container format. Many container formats provide sufficient summary information for precise timing and do not require additional parsing to prepare for it; QuickTime movie files and MPEG-4 files are examples of such formats. Other formats do not provide sufficient summary information, and precise random access for them is possible only after a preliminary examination of a file's contents.
688    /// If you pass YES for an asset that you intend to play via an instance of AVPlayerItem and you are prepared for playback to commence before the value of -[AVPlayerItem duration] becomes available, you can omit the key
689    /// "
690    /// duration" from the array of AVAsset keys you pass to -[AVPlayerItem initWithAsset:automaticallyLoadedAssetKeys:] in order to prevent AVPlayerItem from automatically loading the value of duration while the item becomes ready to play.
691    /// If precise duration and timing is not possible for the timed media resource referenced by the asset's URL, AVAsset.providesPreciseDurationAndTiming will be NO even if precise timing is requested via the use of this key.
692    ///
693    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetpreferprecisedurationandtimingkey?language=objc)
694    pub static AVURLAssetPreferPreciseDurationAndTimingKey: &'static NSString;
695}
696
697extern "C" {
698    /// Indicates the MIME type that should be used to identify the format of the media resource.
699    ///
700    /// When a value for this key is provided, only the specified MIME type is considered in determining how to handle or parse the media resource. Any other information that may be available, such as the URL path extension or a server-provided MIME type, is ignored.
701    ///
702    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetoverridemimetypekey?language=objc)
703    pub static AVURLAssetOverrideMIMETypeKey: &'static NSString;
704}
705
706extern "C" {
707    /// Indicates the restrictions used by the asset when resolving references to external media data. The value of this key is an NSNumber wrapping an AVAssetReferenceRestrictions enum value or the logical combination of multiple such values.
708    ///
709    /// Some assets can contain references to media data stored outside the asset's container file, for example in another file. This key can be used to specify a policy to use when these references are encountered. If an asset contains one or more references of a type that is forbidden by the reference restrictions, loading of asset properties will fail. In addition, such an asset cannot be used with other AVFoundation modules, such as AVPlayerItem or AVAssetExportSession.
710    ///
711    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetreferencerestrictionskey?language=objc)
712    pub static AVURLAssetReferenceRestrictionsKey: &'static NSString;
713}
714
715extern "C" {
716    /// HTTP cookies that the AVURLAsset may send with HTTP requests
717    ///
718    /// Standard cross-site policy still applies: cookies will only be sent to domains to which they apply.
719    ///
720    /// By default, an AVURLAsset will only have access to cookies in the client's default cookie storage
721    /// that apply to the AVURLAsset's URL. You can supplement the cookies available to the asset
722    /// via use of this initialization option
723    ///
724    /// HTTP cookies do not apply to non-HTTP(S) URLS.
725    /// In HLS, many HTTP requests (e.g., media, crypt key, variant index) might be issued to different paths or hosts.
726    /// In both of these cases, HTTP requests will be missing any cookies that do not apply to the AVURLAsset's URL.
727    /// This init option allows the AVURLAsset to use additional HTTP cookies for those HTTP(S) requests.
728    ///
729    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassethttpcookieskey?language=objc)
730    pub static AVURLAssetHTTPCookiesKey: &'static NSString;
731}
732
733extern "C" {
734    /// Indicates whether network requests on behalf of this asset are allowed to use the cellular interface.
735    ///
736    /// Default is YES.
737    ///
738    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetallowscellularaccesskey?language=objc)
739    pub static AVURLAssetAllowsCellularAccessKey: &'static NSString;
740}
741
742extern "C" {
743    /// Indicates whether network requests on behalf of this asset are allowed to use the expensive interface (e.g. cellular, tethered, constrained).
744    ///
745    /// Default is YES.
746    ///
747    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetallowsexpensivenetworkaccesskey?language=objc)
748    pub static AVURLAssetAllowsExpensiveNetworkAccessKey: &'static NSString;
749}
750
751extern "C" {
752    /// Indicates whether network requests on behalf of this asset are allowed to use the constrained interface (e.g. interfaces marked as being in data saver mode).
753    ///
754    /// Default is YES.
755    ///
756    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetallowsconstrainednetworkaccesskey?language=objc)
757    pub static AVURLAssetAllowsConstrainedNetworkAccessKey: &'static NSString;
758}
759
760extern "C" {
761    /// Indicates whether alias data references in the asset should be parsed and resolved.
762    ///
763    /// Default is NO. Although the majority of QuickTime movie files contain all of the media data they require, some contain references to media stored in other files. While AVFoundation and CoreMedia typically employ a URL reference for this purpose, older implementations such as QuickTime 7 have commonly employed a Macintosh alias instead, as documented in the QuickTime File Format specification. If your application must work with legacy QuickTime movie files containing alias-based references to media data stored in other files, the use of this AVURLAsset initialization option is appropriate.
764    ///
765    /// If you provide a value for AVURLAssetReferenceRestrictionsKey, restrictions will be observed for resolved alias references just as they are for URL references.
766    ///
767    /// For more details about alias resolution, consult documentation of the bookmark-related interfaces of NSURL.
768    ///
769    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetshouldsupportaliasdatareferenceskey?language=objc)
770    pub static AVURLAssetShouldSupportAliasDataReferencesKey: &'static NSString;
771}
772
773extern "C" {
774    /// Specifies the attribution of the URLs requested by this asset.
775    ///
776    /// Value is an NSNumber whose value is an NSURLRequestAttribution (see NSURLRequest.h).
777    /// Default value is NSURLRequestAttributionDeveloper.
778    /// All NSURLRequests issed on behalf of this AVURLAsset will be attributed with this value and follow the App Privacy Policy accordingly.
779    ///
780    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlasseturlrequestattributionkey?language=objc)
781    pub static AVURLAssetURLRequestAttributionKey: &'static NSString;
782}
783
784extern "C" {
785    /// Specifies the value of the User-Agent header to add to HTTP requests made by this asset.
786    ///
787    /// Value is an NSString
788    /// Default value is the systems's default User-Agent.
789    ///
790    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassethttpuseragentkey?language=objc)
791    pub static AVURLAssetHTTPUserAgentKey: &'static NSString;
792}
793
794extern "C" {
795    /// Specifies a UUID to append as the value of the query parameter "_HLS_primary_id" to selected HTTP requests issued on behalf of the asset. Supported for HLS assets only.
796    ///
797    /// Value is an NSUUID. Its UUID string value will be used as the query parameter.
798    /// If you create AVURLAssets for the templateItems of AVPlayerInterstitialEvents and you want the instances of AVURLAsset that you create to be used during interstitial playback rather than equivalent AVURLAssets with the same URL, you must provide a value for this key that's equal to the httpSessionIdentifier of the primary AVPlayerItem's asset. See AVPlayerInterstitialEventController.h. This is especially useful if you require the use of a custom AVAssetResourceLoader delegate for interstitial assets.
799    ///
800    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetprimarysessionidentifierkey?language=objc)
801    pub static AVURLAssetPrimarySessionIdentifierKey: &'static NSString;
802}
803
804extern "C" {
805    /// Indicates whether additional projected media signaling in the asset should be parsed and resolved as format description extensions.
806    ///
807    /// Default is NO.
808    ///
809    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlassetshouldparseexternalsphericaltagskey?language=objc)
810    pub static AVURLAssetShouldParseExternalSphericalTagsKey: &'static NSString;
811}
812
813extern_class!(
814    /// AVURLAsset provides access to the AVAsset model for timed audiovisual media referenced by URL.
815    ///
816    /// Note that although instances of AVURLAsset are immutable, values for its keys may not be immediately available without blocking. See the discussion of the class AVAsset above regarding the availability of values for keys and the use of AVAsynchronousKeyValueLoading.
817    ///
818    /// Once an AVURLAsset's value for a key is available, it will not change. AVPlayerItem provides access to information that can change dynamically during playback; see AVPlayerItem.duration and AVPlayerItem.tracks.
819    ///
820    /// AVURLAssets can be initialized with NSURLs that refer to audiovisual media resources, such as streams (including HTTP live streams), QuickTime movie files, MP3 files, and files of other types.
821    ///
822    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
823    ///
824    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avurlasset?language=objc)
825    #[unsafe(super(AVAsset, NSObject))]
826    #[derive(Debug, PartialEq, Eq, Hash)]
827    pub struct AVURLAsset;
828);
829
830unsafe impl Send for AVURLAsset {}
831
832unsafe impl Sync for AVURLAsset {}
833
834#[cfg(feature = "AVAsynchronousKeyValueLoading")]
835extern_conformance!(
836    unsafe impl AVAsynchronousKeyValueLoading for AVURLAsset {}
837);
838
839extern_conformance!(
840    unsafe impl NSCopying for AVURLAsset {}
841);
842
843unsafe impl CopyingHelper for AVURLAsset {
844    type Result = Self;
845}
846
847extern_conformance!(
848    unsafe impl NSObjectProtocol for AVURLAsset {}
849);
850
851impl AVURLAsset {
852    extern_methods!(
853        #[unsafe(method(init))]
854        #[unsafe(method_family = init)]
855        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
856
857        #[unsafe(method(new))]
858        #[unsafe(method_family = new)]
859        pub unsafe fn new() -> Retained<Self>;
860
861        #[cfg(feature = "AVMediaFormat")]
862        /// Provides the file types the AVURLAsset class understands.
863        ///
864        /// - Returns: An NSArray of UTIs identifying the file types the AVURLAsset class understands.
865        #[deprecated = "Use audiovisualContentTypes instead"]
866        #[unsafe(method(audiovisualTypes))]
867        #[unsafe(method_family = none)]
868        pub unsafe fn audiovisualTypes() -> Retained<NSArray<AVFileType>>;
869
870        /// Provides the MIME types the AVURLAsset class understands.
871        ///
872        /// - Returns: An NSArray of NSStrings containing MIME types the AVURLAsset class understands.
873        #[unsafe(method(audiovisualMIMETypes))]
874        #[unsafe(method_family = none)]
875        pub unsafe fn audiovisualMIMETypes() -> Retained<NSArray<NSString>>;
876
877        #[cfg(feature = "objc2-uniform-type-identifiers")]
878        /// Provides the content types the AVURLAsset class understands.
879        ///
880        /// - Returns: An NSArray of UTTypes identifying the content types the AVURLAsset class understands.
881        #[unsafe(method(audiovisualContentTypes))]
882        #[unsafe(method_family = none)]
883        pub unsafe fn audiovisualContentTypes() -> Retained<NSArray<UTType>>;
884
885        /// Returns YES if asset is playable with the codec(s) and container type specified in extendedMIMEType. Returns NO otherwise.
886        ///
887        /// On releases prior to macOS 14, iOS 17, tvOS 17, and watchOS 10, regardless of the specified MIME type this method interprets all codecs parameters according to the ISO family syntax defined by RFC 6381 and evaluates playability according to whether the indicated codecs are supported when carried in container formats that conform to the ISO BMFF specification, such as the MPEG-4 file format.
888        /// On releases starting with macOS 14, iOS 17, tvOS 17, and watchOS 10, this method interprets codecs parameters according to the syntax and namespace determined by the specified MIME type and evaluates playability according to whether the indicated codecs are supported when carried in the container format indicated by that MIME type. Codecs parameters for each of the following MIME types are supported: video/mp4 (per RFC 6381, ISO/IEC 14496-15 Annex E, et al), video/quicktime (RFC 6381 et al), video/mp2t (ISO/IEC 13818-1), audio/vnd.wave (RFC 2361), audio/aiff (using the CoreAudio AudioFormatID namespace), audio/x-caf (also using the CoreAudio AudioFormatID namespace), and audio/mpeg (e.g. codecs="mp3"). MIME types supported as alternatives for the same container formats, e.g audio/mp4, are equivalently treated. If the indicated MIME type defines no supported syntax and namespace for codecs parameters, when any codecs parameter is present this method returns NO.
889        ///
890        /// - Parameter extendedMIMEType:
891        ///
892        /// - Returns: YES or NO.
893        #[unsafe(method(isPlayableExtendedMIMEType:))]
894        #[unsafe(method_family = none)]
895        pub unsafe fn isPlayableExtendedMIMEType(extended_mime_type: &NSString) -> bool;
896
897        /// Returns an instance of AVURLAsset for inspection of a media resource.
898        ///
899        /// - Parameter URL: An instance of NSURL that references a media resource.
900        /// - Parameter options: An instance of NSDictionary that contains keys for specifying options for the initialization of the AVURLAsset. See AVURLAssetPreferPreciseDurationAndTimingKey and AVURLAssetReferenceRestrictionsKey above.
901        ///
902        /// - Returns: An instance of AVURLAsset.
903        ///
904        /// # Safety
905        ///
906        /// `options` generic should be of the correct type.
907        #[unsafe(method(URLAssetWithURL:options:))]
908        #[unsafe(method_family = none)]
909        pub unsafe fn URLAssetWithURL_options(
910            url: &NSURL,
911            options: Option<&NSDictionary<NSString, AnyObject>>,
912        ) -> Retained<Self>;
913
914        /// Initializes an instance of AVURLAsset for inspection of a media resource.
915        ///
916        /// - Parameter URL: An instance of NSURL that references a media resource.
917        /// - Parameter options: An instance of NSDictionary that contains keys for specifying options for the initialization of the AVURLAsset. See AVURLAssetPreferPreciseDurationAndTimingKey and AVURLAssetReferenceRestrictionsKey above.
918        ///
919        /// - Returns: An instance of AVURLAsset.
920        ///
921        /// # Safety
922        ///
923        /// `options` generic should be of the correct type.
924        #[unsafe(method(initWithURL:options:))]
925        #[unsafe(method_family = init)]
926        pub unsafe fn initWithURL_options(
927            this: Allocated<Self>,
928            url: &NSURL,
929            options: Option<&NSDictionary<NSString, AnyObject>>,
930        ) -> Retained<Self>;
931
932        /// Indicates the URL with which the instance of AVURLAsset was initialized.
933        ///
934        /// This property is not atomic.
935        ///
936        /// # Safety
937        ///
938        /// This might not be thread-safe.
939        #[unsafe(method(URL))]
940        #[unsafe(method_family = none)]
941        pub unsafe fn URL(&self) -> Retained<NSURL>;
942
943        /// Provides the identifier that's automatically included in any HTTP request issued on behalf of this asset in the HTTP header field "X-Playback-Session-Id".
944        ///
945        /// The value is an NSUUID from which the UUID string can be obtained.
946        /// Note that copies of an AVURLAsset vend an equivalent httpSessionIdentifier.
947        ///
948        /// This property is not atomic.
949        ///
950        /// # Safety
951        ///
952        /// This might not be thread-safe.
953        #[unsafe(method(httpSessionIdentifier))]
954        #[unsafe(method_family = none)]
955        pub unsafe fn httpSessionIdentifier(&self) -> Retained<NSUUID>;
956    );
957}
958
959/// Methods declared on superclass `AVAsset`.
960impl AVURLAsset {
961    extern_methods!(
962        /// Returns an instance of AVAsset for inspection of a media resource.
963        ///
964        /// Returns a newly allocated instance of a subclass of AVAsset initialized with the specified URL.
965        ///
966        /// - Parameter URL: An instance of NSURL that references a media resource.
967        ///
968        /// - Returns: An instance of AVAsset.
969        #[unsafe(method(assetWithURL:))]
970        #[unsafe(method_family = none)]
971        pub unsafe fn assetWithURL(url: &NSURL) -> Retained<Self>;
972    );
973}
974
975/// AVURLAssetURLHandling.
976impl AVURLAsset {
977    extern_methods!(
978        #[cfg(feature = "AVAssetResourceLoader")]
979        /// Provides access to an instance of AVAssetResourceLoader, which offers limited control over the handling of URLs that may be loaded in the course of performing operations on the asset, such as playback.
980        ///
981        /// The loading of file URLs cannot be mediated via use of AVAssetResourceLoader.
982        ///
983        /// Note that copies of an AVAsset will vend the same instance of AVAssetResourceLoader.
984        ///
985        /// This property is not atomic.
986        ///
987        /// # Safety
988        ///
989        /// This might not be thread-safe.
990        #[unsafe(method(resourceLoader))]
991        #[unsafe(method_family = none)]
992        pub unsafe fn resourceLoader(&self) -> Retained<AVAssetResourceLoader>;
993    );
994}
995
996/// AVURLAssetCache.
997impl AVURLAsset {
998    extern_methods!(
999        #[cfg(feature = "AVAssetCache")]
1000        /// Provides access to an instance of AVAssetCache to use for inspection of locally cached media data. Will be nil if an asset has not been configured to store or access media data from disk.
1001        ///
1002        /// This property is not atomic.
1003        ///
1004        /// # Safety
1005        ///
1006        /// This might not be thread-safe.
1007        #[unsafe(method(assetCache))]
1008        #[unsafe(method_family = none)]
1009        pub unsafe fn assetCache(&self) -> Option<Retained<AVAssetCache>>;
1010    );
1011}
1012
1013/// AVAssetCompositionUtility.
1014impl AVURLAsset {
1015    extern_methods!(
1016        #[cfg(all(feature = "AVAssetTrack", feature = "AVCompositionTrack"))]
1017        /// Provides a reference to an AVAssetTrack of the target from which any timeRange can be inserted into a mutable composition track (via -[AVMutableCompositionTrack insertTimeRange:ofTrack:atTime:error:]).
1018        ///
1019        /// Finds a track of the target with content that can be accommodated by the specified composition track.
1020        /// The logical complement of -[AVMutableComposition mutableTrackCompatibleWithTrack:].
1021        ///
1022        /// - Parameter compositionTrack: The composition track for which a compatible AVAssetTrack is requested.
1023        ///
1024        /// - Returns: an instance of AVAssetTrack
1025        #[deprecated = "Use findCompatibleTrackForCompositionTrack:completionHandler: instead"]
1026        #[unsafe(method(compatibleTrackForCompositionTrack:))]
1027        #[unsafe(method_family = none)]
1028        pub unsafe fn compatibleTrackForCompositionTrack(
1029            &self,
1030            composition_track: &AVCompositionTrack,
1031        ) -> Option<Retained<AVAssetTrack>>;
1032
1033        #[cfg(all(
1034            feature = "AVAssetTrack",
1035            feature = "AVCompositionTrack",
1036            feature = "block2"
1037        ))]
1038        /// Loads a reference to an AVAssetTrack of the target from which any timeRange can be inserted into a mutable composition track (via -[AVMutableCompositionTrack insertTimeRange:ofTrack:atTime:error:]).
1039        ///
1040        /// Finds a track of the target with content that can be accommodated by the specified composition track.
1041        /// The logical complement of -[AVMutableComposition mutableTrackCompatibleWithTrack:].
1042        ///
1043        /// - Parameter compositionTrack: The composition track for which a compatible AVAssetTrack is requested.
1044        /// - Parameter completionHandler: A block that is invoked when loading is complete, vending an instance of AVAssetTrack or an error.
1045        ///
1046        /// # Safety
1047        ///
1048        /// `completion_handler` block must be sendable.
1049        #[unsafe(method(findCompatibleTrackForCompositionTrack:completionHandler:))]
1050        #[unsafe(method_family = none)]
1051        pub unsafe fn findCompatibleTrackForCompositionTrack_completionHandler(
1052            &self,
1053            composition_track: &AVCompositionTrack,
1054            completion_handler: &block2::DynBlock<dyn Fn(*mut AVAssetTrack, *mut NSError)>,
1055        );
1056    );
1057}
1058
1059/// AVAssetVariantInspection.
1060impl AVURLAsset {
1061    extern_methods!(
1062        #[cfg(feature = "AVAssetVariant")]
1063        /// Provides an array of AVAssetVariants contained in the asset
1064        ///
1065        /// Some variants may not be playable according to the current device configuration.
1066        ///
1067        /// This property is not atomic.
1068        ///
1069        /// # Safety
1070        ///
1071        /// This might not be thread-safe.
1072        #[unsafe(method(variants))]
1073        #[unsafe(method_family = none)]
1074        pub unsafe fn variants(&self) -> Retained<NSArray<AVAssetVariant>>;
1075    );
1076}
1077
1078/// AVURLAssetNSItemProvider.
1079///
1080/// AVURLAssets can be shared through any interface that supports passing NSItemProviders. Note that only AVURLAssets with file URLs can be added to NSItemProviders. Attempting to share assets with non file URLs will result in an error.
1081///
1082/// AVURLAssets can be retrieved from NSItemProviders by directly requesting an AVURLAsset through -[NSItemProvider loadObjectOfClass:completionHandler:]. Requesting data representations of AVURLAssets is not supported. File representations of AVURLAssets will be sent without copying the underlying media and the receiver will be extended readonly sandbox access to the sender's original URL until the AVURLAsset is deallocated. Use of NSFileCoordinator and NSFilePresenter is recommended for both the sender and receive to coordinate possible changes in the file's state once sharing has been completed.
1083impl AVURLAsset {
1084    extern_methods!();
1085}
1086
1087extern_conformance!(
1088    unsafe impl NSItemProviderReading for AVURLAsset {}
1089);
1090
1091extern_conformance!(
1092    unsafe impl NSItemProviderWriting for AVURLAsset {}
1093);
1094
1095extern_class!(
1096    /// A class incorporating properties for a MediaExtension
1097    ///
1098    /// AVMediaExtensionProperties objects are returned from property queries on AVAsset, AVPlayerItemTrack, AVSampleBufferDisplayLayer, or AVSampleBufferVideoRenderer.
1099    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1100    ///
1101    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmediaextensionproperties?language=objc)
1102    #[unsafe(super(NSObject))]
1103    #[derive(Debug, PartialEq, Eq, Hash)]
1104    pub struct AVMediaExtensionProperties;
1105);
1106
1107unsafe impl Send for AVMediaExtensionProperties {}
1108
1109unsafe impl Sync for AVMediaExtensionProperties {}
1110
1111extern_conformance!(
1112    unsafe impl NSCopying for AVMediaExtensionProperties {}
1113);
1114
1115unsafe impl CopyingHelper for AVMediaExtensionProperties {
1116    type Result = Self;
1117}
1118
1119extern_conformance!(
1120    unsafe impl NSObjectProtocol for AVMediaExtensionProperties {}
1121);
1122
1123impl AVMediaExtensionProperties {
1124    extern_methods!(
1125        #[unsafe(method(init))]
1126        #[unsafe(method_family = init)]
1127        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1128
1129        #[unsafe(method(new))]
1130        #[unsafe(method_family = new)]
1131        pub unsafe fn new() -> Retained<Self>;
1132
1133        /// The identifier of the Media Extension.
1134        ///
1135        /// The extension identifier string, corresponding to the ClassImplementationID value from the EXAppExtensionAttributes dictionary in the Info.plist file.
1136        ///
1137        /// This property is not atomic.
1138        ///
1139        /// # Safety
1140        ///
1141        /// This might not be thread-safe.
1142        #[unsafe(method(extensionIdentifier))]
1143        #[unsafe(method_family = none)]
1144        pub unsafe fn extensionIdentifier(&self) -> Retained<NSString>;
1145
1146        /// The name of the MediaExtension.
1147        ///
1148        /// The localized name of the MediaExtension format reader or video decoder, corresponding to the CFBundleDisplayName.
1149        ///
1150        /// This property is not atomic.
1151        ///
1152        /// # Safety
1153        ///
1154        /// This might not be thread-safe.
1155        #[unsafe(method(extensionName))]
1156        #[unsafe(method_family = none)]
1157        pub unsafe fn extensionName(&self) -> Retained<NSString>;
1158
1159        /// The name of the containing application bundle.
1160        ///
1161        /// The localized name of the application that hosts the MediaExtension.
1162        ///
1163        /// This property is not atomic.
1164        ///
1165        /// # Safety
1166        ///
1167        /// This might not be thread-safe.
1168        #[unsafe(method(containingBundleName))]
1169        #[unsafe(method_family = none)]
1170        pub unsafe fn containingBundleName(&self) -> Retained<NSString>;
1171
1172        /// The file URL of the MediaExtension bundle.
1173        ///
1174        /// This property is not atomic.
1175        ///
1176        /// # Safety
1177        ///
1178        /// This might not be thread-safe.
1179        #[unsafe(method(extensionURL))]
1180        #[unsafe(method_family = none)]
1181        pub unsafe fn extensionURL(&self) -> Retained<NSURL>;
1182
1183        /// The file URL of the host application for the MediaExtension.
1184        ///
1185        /// This property is not atomic.
1186        ///
1187        /// # Safety
1188        ///
1189        /// This might not be thread-safe.
1190        #[unsafe(method(containingBundleURL))]
1191        #[unsafe(method_family = none)]
1192        pub unsafe fn containingBundleURL(&self) -> Retained<NSURL>;
1193    );
1194}
1195
1196/// AVMediaExtension.
1197impl AVURLAsset {
1198    extern_methods!(
1199        /// The properties of the MediaExtension format reader for the asset.
1200        ///
1201        /// If the asset is being decoded using a MediaExtension format reader, this property will return a AVMediaExtensionProperties object describing the extension. If the asset is not being decoded with a MediaExtension format reader, this property will return nil.
1202        ///
1203        /// This property is not atomic.
1204        ///
1205        /// # Safety
1206        ///
1207        /// This might not be thread-safe.
1208        #[unsafe(method(mediaExtensionProperties))]
1209        #[unsafe(method_family = none)]
1210        pub unsafe fn mediaExtensionProperties(
1211            &self,
1212        ) -> Option<Retained<AVMediaExtensionProperties>>;
1213
1214        /// The sidecar URL used by the MediaExtension.
1215        ///
1216        /// The sidecar URL is returned only if the MediaExtension format reader supports sidecar files, and implements this property [MEFileInfo setSidecarFilename:]. Will return nil otherwise.
1217        ///
1218        /// This property is not atomic.
1219        ///
1220        /// # Safety
1221        ///
1222        /// This might not be thread-safe.
1223        #[unsafe(method(sidecarURL))]
1224        #[unsafe(method_family = none)]
1225        pub unsafe fn sidecarURL(&self) -> Option<Retained<NSURL>>;
1226    );
1227}
1228
1229extern "C" {
1230    /// Posted when the duration of an AVFragmentedAsset changes while it's being minded by an AVFragmentedAssetMinder, but only for changes that occur after the status of the value of
1231    /// "
1232    /// duration" has reached AVKeyValueStatusLoaded.
1233    ///
1234    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetdurationdidchangenotification?language=objc)
1235    pub static AVAssetDurationDidChangeNotification: &'static NSString;
1236}
1237
1238extern "C" {
1239    /// Posted after the value of
1240    /// "
1241    /// containsFragments" has already been loaded and the AVFragmentedAsset is added to an AVFragmentedAssetMinder, either when 1) fragments are detected in the asset on disk after it had previously contained none or when 2) no fragments are detected in the asset on disk after it had previously contained one or more.
1242    ///
1243    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetcontainsfragmentsdidchangenotification?language=objc)
1244    pub static AVAssetContainsFragmentsDidChangeNotification: &'static NSString;
1245}
1246
1247extern "C" {
1248    /// Posted when the asset on disk is defragmented while an AVFragmentedAsset is being minded by an AVFragmentedAssetMinder, but only if the defragmentation occurs after the status of the value of
1249    /// "
1250    /// canContainFragments" has reached AVKeyValueStatusLoaded.
1251    ///
1252    /// After this notification is posted, the value of the asset properties canContainFragments and containsFragments will both be NO.
1253    ///
1254    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetwasdefragmentednotification?language=objc)
1255    pub static AVAssetWasDefragmentedNotification: &'static NSString;
1256}
1257
1258extern "C" {
1259    /// Posted when the collection of arrays of timed metadata groups representing chapters of an AVAsset change and when any of the contents of the timed metadata groups change, but only for changes that occur after the status of the value of
1260    /// "
1261    /// availableChapterLocales" has reached AVKeyValueStatusLoaded.
1262    ///
1263    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetchaptermetadatagroupsdidchangenotification?language=objc)
1264    pub static AVAssetChapterMetadataGroupsDidChangeNotification: &'static NSString;
1265}
1266
1267extern "C" {
1268    /// Posted when the collection of media selection groups provided by an AVAsset changes and when any of the contents of its media selection groups change, but only for changes that occur after the status of the value of
1269    /// "
1270    /// availableMediaCharacteristicsWithMediaSelectionOptions" has reached AVKeyValueStatusLoaded.
1271    ///
1272    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetmediaselectiongroupsdidchangenotification?language=objc)
1273    pub static AVAssetMediaSelectionGroupsDidChangeNotification: &'static NSString;
1274}
1275
1276extern_protocol!(
1277    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentminding?language=objc)
1278    pub unsafe trait AVFragmentMinding {
1279        /// Indicates whether an AVAsset that supports fragment minding is currently associated with a fragment minder, e.g. an instance of AVFragmentedAssetMinder.
1280        ///
1281        /// AVAssets that support fragment minding post change notifications only while associated with a fragment minder.
1282        #[unsafe(method(isAssociatedWithFragmentMinder))]
1283        #[unsafe(method_family = none)]
1284        unsafe fn isAssociatedWithFragmentMinder(&self) -> bool;
1285    }
1286);
1287
1288extern_class!(
1289    /// A subclass of AVURLAsset that represents media resources that can be extended in total duration without modifying previously existing data structures.
1290    ///
1291    /// Such media resources include QuickTime movie files and MPEG-4 files that indicate, via an 'mvex' box in their 'moov' box, that they accommodate additional fragments. Media resources of other types may also be supported. To check whether a given instance of AVFragmentedAsset can be used to monitor the addition of fragments, check the value of the AVURLAsset property canContainFragments.
1292    ///
1293    /// An AVFragmentedAsset is capable of changing the values of certain of its properties and those of its tracks, while an operation that appends fragments to the underlying media resource in in progress, if the AVFragmentedAsset is associated with an instance of AVFragmentedAssetMinder.
1294    ///
1295    /// While associated with an AVFragmentedAssetMinder, AVFragmentedAsset posts AVAssetDurationDidChangeNotification whenever new fragments are detected, as appropriate. It may also post AVAssetContainsFragmentsDidChangeNotification and AVAssetWasDefragmentedNotification, as discussed in documentation of those notifications.
1296    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1297    ///
1298    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentedasset?language=objc)
1299    #[unsafe(super(AVURLAsset, AVAsset, NSObject))]
1300    #[derive(Debug, PartialEq, Eq, Hash)]
1301    pub struct AVFragmentedAsset;
1302);
1303
1304unsafe impl Send for AVFragmentedAsset {}
1305
1306unsafe impl Sync for AVFragmentedAsset {}
1307
1308#[cfg(feature = "AVAsynchronousKeyValueLoading")]
1309extern_conformance!(
1310    unsafe impl AVAsynchronousKeyValueLoading for AVFragmentedAsset {}
1311);
1312
1313extern_conformance!(
1314    unsafe impl AVFragmentMinding for AVFragmentedAsset {}
1315);
1316
1317extern_conformance!(
1318    unsafe impl NSCopying for AVFragmentedAsset {}
1319);
1320
1321unsafe impl CopyingHelper for AVFragmentedAsset {
1322    type Result = Self;
1323}
1324
1325extern_conformance!(
1326    unsafe impl NSObjectProtocol for AVFragmentedAsset {}
1327);
1328
1329impl AVFragmentedAsset {
1330    extern_methods!(
1331        /// Returns an instance of AVFragmentedAsset for inspection of a fragmented media resource.
1332        ///
1333        /// - Parameter URL: An instance of NSURL that references a media resource.
1334        /// - Parameter options: An instance of NSDictionary that contains keys for specifying options for the initialization of the AVFragmentedAsset. See AVURLAssetPreferPreciseDurationAndTimingKey and AVURLAssetReferenceRestrictionsKey above.
1335        ///
1336        /// - Returns: An instance of AVFragmentedAsset.
1337        ///
1338        /// # Safety
1339        ///
1340        /// `options` generic should be of the correct type.
1341        #[unsafe(method(fragmentedAssetWithURL:options:))]
1342        #[unsafe(method_family = none)]
1343        pub unsafe fn fragmentedAssetWithURL_options(
1344            url: &NSURL,
1345            options: Option<&NSDictionary<NSString, AnyObject>>,
1346        ) -> Retained<Self>;
1347
1348        #[cfg(feature = "AVAssetTrack")]
1349        /// The tracks in an asset.
1350        ///
1351        /// The value of this property is an array of tracks the asset contains; the tracks are of type AVFragmentedAssetTrack.
1352        ///
1353        /// This property is not atomic.
1354        ///
1355        /// # Safety
1356        ///
1357        /// This might not be thread-safe.
1358        #[unsafe(method(tracks))]
1359        #[unsafe(method_family = none)]
1360        pub unsafe fn tracks(&self) -> Retained<NSArray<AVFragmentedAssetTrack>>;
1361    );
1362}
1363
1364/// Methods declared on superclass `AVURLAsset`.
1365impl AVFragmentedAsset {
1366    extern_methods!(
1367        #[unsafe(method(init))]
1368        #[unsafe(method_family = init)]
1369        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1370
1371        #[unsafe(method(new))]
1372        #[unsafe(method_family = new)]
1373        pub unsafe fn new() -> Retained<Self>;
1374
1375        /// Returns an instance of AVURLAsset for inspection of a media resource.
1376        ///
1377        /// - Parameter URL: An instance of NSURL that references a media resource.
1378        /// - Parameter options: An instance of NSDictionary that contains keys for specifying options for the initialization of the AVURLAsset. See AVURLAssetPreferPreciseDurationAndTimingKey and AVURLAssetReferenceRestrictionsKey above.
1379        ///
1380        /// - Returns: An instance of AVURLAsset.
1381        ///
1382        /// # Safety
1383        ///
1384        /// `options` generic should be of the correct type.
1385        #[unsafe(method(URLAssetWithURL:options:))]
1386        #[unsafe(method_family = none)]
1387        pub unsafe fn URLAssetWithURL_options(
1388            url: &NSURL,
1389            options: Option<&NSDictionary<NSString, AnyObject>>,
1390        ) -> Retained<Self>;
1391
1392        /// Initializes an instance of AVURLAsset for inspection of a media resource.
1393        ///
1394        /// - Parameter URL: An instance of NSURL that references a media resource.
1395        /// - Parameter options: An instance of NSDictionary that contains keys for specifying options for the initialization of the AVURLAsset. See AVURLAssetPreferPreciseDurationAndTimingKey and AVURLAssetReferenceRestrictionsKey above.
1396        ///
1397        /// - Returns: An instance of AVURLAsset.
1398        ///
1399        /// # Safety
1400        ///
1401        /// `options` generic should be of the correct type.
1402        #[unsafe(method(initWithURL:options:))]
1403        #[unsafe(method_family = init)]
1404        pub unsafe fn initWithURL_options(
1405            this: Allocated<Self>,
1406            url: &NSURL,
1407            options: Option<&NSDictionary<NSString, AnyObject>>,
1408        ) -> Retained<Self>;
1409    );
1410}
1411
1412/// Methods declared on superclass `AVAsset`.
1413impl AVFragmentedAsset {
1414    extern_methods!(
1415        /// Returns an instance of AVAsset for inspection of a media resource.
1416        ///
1417        /// Returns a newly allocated instance of a subclass of AVAsset initialized with the specified URL.
1418        ///
1419        /// - Parameter URL: An instance of NSURL that references a media resource.
1420        ///
1421        /// - Returns: An instance of AVAsset.
1422        #[unsafe(method(assetWithURL:))]
1423        #[unsafe(method_family = none)]
1424        pub unsafe fn assetWithURL(url: &NSURL) -> Retained<Self>;
1425    );
1426}
1427
1428/// AVFragmentedAssetTrackInspection.
1429impl AVFragmentedAsset {
1430    extern_methods!(
1431        #[cfg(all(feature = "AVAssetTrack", feature = "objc2-core-media"))]
1432        /// Provides an instance of AVFragmentedAssetTrack that represents the track of the specified trackID.
1433        ///
1434        /// Becomes callable without blocking when the key
1435        /// "
1436        /// tracks" has been loaded
1437        ///
1438        /// - Parameter trackID: The trackID of the requested AVFragmentedAssetTrack.
1439        ///
1440        /// - Returns: An instance of AVFragmentedAssetTrack; may be nil if no track of the specified trackID is available.
1441        #[deprecated = "Use loadTrackWithTrackID:completionHandler: instead"]
1442        #[unsafe(method(trackWithTrackID:))]
1443        #[unsafe(method_family = none)]
1444        pub unsafe fn trackWithTrackID(
1445            &self,
1446            track_id: CMPersistentTrackID,
1447        ) -> Option<Retained<AVFragmentedAssetTrack>>;
1448
1449        #[cfg(all(
1450            feature = "AVAssetTrack",
1451            feature = "block2",
1452            feature = "objc2-core-media"
1453        ))]
1454        /// Loads an instance of AVFragmentedAssetTrack that represents the track of the specified trackID.
1455        ///
1456        /// - Parameter trackID: The trackID of the requested AVFragmentedAssetTrack.
1457        /// - 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.
1458        ///
1459        /// # Safety
1460        ///
1461        /// `completion_handler` block must be sendable.
1462        #[unsafe(method(loadTrackWithTrackID:completionHandler:))]
1463        #[unsafe(method_family = none)]
1464        pub unsafe fn loadTrackWithTrackID_completionHandler(
1465            &self,
1466            track_id: CMPersistentTrackID,
1467            completion_handler: &block2::DynBlock<
1468                dyn Fn(*mut AVFragmentedAssetTrack, *mut NSError),
1469            >,
1470        );
1471
1472        #[cfg(all(feature = "AVAssetTrack", feature = "AVMediaFormat"))]
1473        /// Provides an array of AVFragmentedAssetTracks of the asset that present media of the specified media type.
1474        ///
1475        /// Becomes callable without blocking when the key
1476        /// "
1477        /// tracks" has been loaded
1478        ///
1479        /// - Parameter mediaType: The media type according to which the receiver filters its AVFragmentedAssetTracks. (Media types are defined in AVMediaFormat.h)
1480        ///
1481        /// - Returns: An NSArray of AVFragmentedAssetTracks; may be empty if no tracks of the specified media type are available.
1482        #[deprecated = "Use loadTracksWithMediaType:completionHandler: instead"]
1483        #[unsafe(method(tracksWithMediaType:))]
1484        #[unsafe(method_family = none)]
1485        pub unsafe fn tracksWithMediaType(
1486            &self,
1487            media_type: &AVMediaType,
1488        ) -> Retained<NSArray<AVFragmentedAssetTrack>>;
1489
1490        #[cfg(all(
1491            feature = "AVAssetTrack",
1492            feature = "AVMediaFormat",
1493            feature = "block2"
1494        ))]
1495        /// Loads an array of AVFragmentedAssetTracks of the asset that present media of the specified media type.
1496        ///
1497        /// - Parameter mediaType: The media type according to which AVAsset filters its AVFragmentedAssetTracks. (Media types are defined in AVMediaFormat.h.)
1498        /// - 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.
1499        ///
1500        /// # Safety
1501        ///
1502        /// `completion_handler` block must be sendable.
1503        #[unsafe(method(loadTracksWithMediaType:completionHandler:))]
1504        #[unsafe(method_family = none)]
1505        pub unsafe fn loadTracksWithMediaType_completionHandler(
1506            &self,
1507            media_type: &AVMediaType,
1508            completion_handler: &block2::DynBlock<
1509                dyn Fn(*mut NSArray<AVFragmentedAssetTrack>, *mut NSError),
1510            >,
1511        );
1512
1513        #[cfg(all(feature = "AVAssetTrack", feature = "AVMediaFormat"))]
1514        /// Provides an array of AVFragmentedAssetTracks of the asset that present media with the specified characteristic.
1515        ///
1516        /// Becomes callable without blocking when the key
1517        /// "
1518        /// tracks" has been loaded
1519        ///
1520        /// - Parameter mediaCharacteristic: The media characteristic according to which the receiver filters its AVFragmentedAssetTracks. (Media characteristics are defined in AVMediaFormat.h)
1521        ///
1522        /// - Returns: An NSArray of AVFragmentedAssetTracks; may be empty if no tracks with the specified characteristic are available.
1523        #[deprecated = "Use loadTracksWithMediaCharacteristic:completionHandler: instead"]
1524        #[unsafe(method(tracksWithMediaCharacteristic:))]
1525        #[unsafe(method_family = none)]
1526        pub unsafe fn tracksWithMediaCharacteristic(
1527            &self,
1528            media_characteristic: &AVMediaCharacteristic,
1529        ) -> Retained<NSArray<AVFragmentedAssetTrack>>;
1530
1531        #[cfg(all(
1532            feature = "AVAssetTrack",
1533            feature = "AVMediaFormat",
1534            feature = "block2"
1535        ))]
1536        /// Loads an array of AVFragmentedAssetTracks of the asset that present media with the specified characteristic.
1537        ///
1538        /// - Parameter mediaCharacteristic: The media characteristic according to which AVAsset filters its AVFragmentedAssetTracks. (Media characteristics are defined in AVMediaFormat.h.)
1539        /// - 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.
1540        ///
1541        /// # Safety
1542        ///
1543        /// `completion_handler` block must be sendable.
1544        #[unsafe(method(loadTracksWithMediaCharacteristic:completionHandler:))]
1545        #[unsafe(method_family = none)]
1546        pub unsafe fn loadTracksWithMediaCharacteristic_completionHandler(
1547            &self,
1548            media_characteristic: &AVMediaCharacteristic,
1549            completion_handler: &block2::DynBlock<
1550                dyn Fn(*mut NSArray<AVFragmentedAssetTrack>, *mut NSError),
1551            >,
1552        );
1553    );
1554}
1555
1556extern_class!(
1557    /// A class that periodically checks whether additional fragments have been appended to fragmented assets.
1558    ///
1559    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentedassetminder?language=objc)
1560    #[unsafe(super(NSObject))]
1561    #[derive(Debug, PartialEq, Eq, Hash)]
1562    pub struct AVFragmentedAssetMinder;
1563);
1564
1565extern_conformance!(
1566    unsafe impl NSObjectProtocol for AVFragmentedAssetMinder {}
1567);
1568
1569impl AVFragmentedAssetMinder {
1570    extern_methods!(
1571        /// Creates an AVFragmentedAssetMinder, adds the specified asset to it, and sets the mindingInterval to the specified value.
1572        ///
1573        /// - Parameter asset: An instance of AVFragmentedAsset to add to the AVFragmentedAssetMinder
1574        /// - Parameter mindingInterval: The initial minding interval of the AVFragmentedAssetMinder.
1575        ///
1576        /// - Returns: A new instance of AVFragmentedAssetMinder.
1577        ///
1578        /// # Safety
1579        ///
1580        /// `asset` must implement AVFragmentMinding.
1581        #[unsafe(method(fragmentedAssetMinderWithAsset:mindingInterval:))]
1582        #[unsafe(method_family = none)]
1583        pub unsafe fn fragmentedAssetMinderWithAsset_mindingInterval(
1584            asset: &AVAsset,
1585            minding_interval: NSTimeInterval,
1586        ) -> Retained<Self>;
1587
1588        /// Creates an AVFragmentedAssetMinder, adds the specified asset to it, and sets the mindingInterval to the specified value.
1589        ///
1590        /// - Parameter asset: An instance of AVFragmentedAsset to add to the AVFragmentedAssetMinder
1591        /// - Parameter mindingInterval: The initial minding interval of the AVFragmentedAssetMinder.
1592        ///
1593        /// - Returns: A new instance of AVFragmentedAssetMinder.
1594        ///
1595        /// # Safety
1596        ///
1597        /// `asset` must implement AVFragmentMinding.
1598        #[unsafe(method(initWithAsset:mindingInterval:))]
1599        #[unsafe(method_family = init)]
1600        pub unsafe fn initWithAsset_mindingInterval(
1601            this: Allocated<Self>,
1602            asset: &AVAsset,
1603            minding_interval: NSTimeInterval,
1604        ) -> Retained<Self>;
1605
1606        /// An NSTimeInterval indicating how often a check for additional fragments should be performed. The default interval is 10.0.
1607        ///
1608        /// This property throws an excepion if a value is set less than one millisecond (0.001) in duration.
1609        #[unsafe(method(mindingInterval))]
1610        #[unsafe(method_family = none)]
1611        pub unsafe fn mindingInterval(&self) -> NSTimeInterval;
1612
1613        /// Setter for [`mindingInterval`][Self::mindingInterval].
1614        #[unsafe(method(setMindingInterval:))]
1615        #[unsafe(method_family = none)]
1616        pub unsafe fn setMindingInterval(&self, minding_interval: NSTimeInterval);
1617
1618        /// An NSArray of the AVFragmentedAsset objects being minded.
1619        #[unsafe(method(assets))]
1620        #[unsafe(method_family = none)]
1621        pub unsafe fn assets(&self) -> Retained<NSArray<AVAsset>>;
1622
1623        /// Adds a fragmented asset to the array of assets being minded.
1624        ///
1625        /// This method throws an exception if the asset is not a supported type (AVFragmentedAsset, AVFragmentedMovie), or if the asset is already being minded by another fragment minder.
1626        ///
1627        /// - Parameter asset: The fragmented asset to add to the minder.
1628        ///
1629        /// # Safety
1630        ///
1631        /// `asset` must implement AVFragmentMinding.
1632        #[unsafe(method(addFragmentedAsset:))]
1633        #[unsafe(method_family = none)]
1634        pub unsafe fn addFragmentedAsset(&self, asset: &AVAsset);
1635
1636        /// Removes a fragmented asset from the array of assets being minded.
1637        ///
1638        /// This method throws an exception if the asset is not a supported type (AVFragmentedAsset, AVFragmentedMovie).
1639        ///
1640        /// - Parameter asset: The fragmented asset to remove from the minder.
1641        ///
1642        /// # Safety
1643        ///
1644        /// `asset` must implement AVFragmentMinding.
1645        #[unsafe(method(removeFragmentedAsset:))]
1646        #[unsafe(method_family = none)]
1647        pub unsafe fn removeFragmentedAsset(&self, asset: &AVAsset);
1648    );
1649}
1650
1651/// Methods declared on superclass `NSObject`.
1652impl AVFragmentedAssetMinder {
1653    extern_methods!(
1654        #[unsafe(method(init))]
1655        #[unsafe(method_family = init)]
1656        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1657
1658        #[unsafe(method(new))]
1659        #[unsafe(method_family = new)]
1660        pub unsafe fn new() -> Retained<Self>;
1661    );
1662}
1663
1664/// AVURLAssetContentKeyEligibility.
1665impl AVURLAsset {
1666    extern_methods!(
1667        /// Allows AVURLAsset to be added as a content key recipient to an AVContentKeySession.
1668        ///
1669        /// This property is not atomic.
1670        ///
1671        /// # Safety
1672        ///
1673        /// This might not be thread-safe.
1674        #[unsafe(method(mayRequireContentKeysForMediaDataProcessing))]
1675        #[unsafe(method_family = none)]
1676        pub unsafe fn mayRequireContentKeysForMediaDataProcessing(&self) -> bool;
1677    );
1678}
1679
1680#[cfg(feature = "AVContentKeySession")]
1681extern_conformance!(
1682    unsafe impl AVContentKeyRecipient for AVURLAsset {}
1683);