objc2-av-foundation 0.3.2

Bindings to the AVFoundation framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// AVAssetCache is a class vended by an AVAsset used for the inspection of locally available media data.
    ///
    /// AVAssetCaches are vended by AVURLAsset's assetCache property.
    ///
    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetcache?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVAssetCache;
);

unsafe impl Send for AVAssetCache {}

unsafe impl Sync for AVAssetCache {}

extern_conformance!(
    unsafe impl NSObjectProtocol for AVAssetCache {}
);

impl AVAssetCache {
    extern_methods!(
        /// Returns YES if a complete rendition of an AVAsset is available to be played without a network connection.
        ///
        /// An answer of YES does not indicate that any given media selection is available for offline playback. To determine if a specific media selection is available offline, see mediaSelectionOptionsInMediaSelectionGroup:.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isPlayableOffline))]
        #[unsafe(method_family = none)]
        pub unsafe fn isPlayableOffline(&self) -> bool;

        #[cfg(feature = "AVMediaSelectionGroup")]
        /// Returns an array of AVMediaSelectionOptions in an AVMediaSelectionGroup that are available for offline operations, e.g. playback.
        #[unsafe(method(mediaSelectionOptionsInMediaSelectionGroup:))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaSelectionOptionsInMediaSelectionGroup(
            &self,
            media_selection_group: &AVMediaSelectionGroup,
        ) -> Retained<NSArray<AVMediaSelectionOption>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// AVAssetCacheCustomMediaSelectionScheme.
impl AVAssetCache {
    extern_methods!(
        #[cfg(feature = "AVMediaSelectionGroup")]
        /// For each AVMediaPresentationSelector defined by the AVCustomMediaSelectionScheme of an AVMediaSelectionGroup, returns the AVMediaPresentationSettings that can be satisfied for offline operations, e.g. playback.
        #[unsafe(method(mediaPresentationSettingsForMediaSelectionGroup:))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaPresentationSettingsForMediaSelectionGroup(
            &self,
            media_selection_group: &AVMediaSelectionGroup,
        ) -> Retained<NSDictionary<AVMediaPresentationSelector, NSArray<AVMediaPresentationSetting>>>;

        #[cfg(feature = "AVMediaSelectionGroup")]
        /// Returns an array of extended language tags for languages that can be selected for offline operations via use of the AVMediaSelectionGroup's AVCustomMediaSelectionScheme.
        #[unsafe(method(mediaPresentationLanguagesForMediaSelectionGroup:))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaPresentationLanguagesForMediaSelectionGroup(
            &self,
            media_selection_group: &AVMediaSelectionGroup,
        ) -> Retained<NSArray<NSString>>;
    );
}