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::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;

use crate::*;

/// Indicates the type of segment.
///
///
/// Indicates that the segment is a initialization segment.
///
/// Indicates that the segment is a separable segment.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetsegmenttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAssetSegmentType(pub NSInteger);
impl AVAssetSegmentType {
    #[doc(alias = "AVAssetSegmentTypeInitialization")]
    pub const Initialization: Self = Self(1);
    #[doc(alias = "AVAssetSegmentTypeSeparable")]
    pub const Separable: Self = Self(2);
}

unsafe impl Encode for AVAssetSegmentType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVAssetSegmentType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// This class provides information on a segment data.
    ///
    /// Clients may get an instance of AVAssetSegmentReport through the -assetWriter:didOutputSegmentData:segmentType:segmentReport: delegate method, which is defined in AVAssetWriter.h. 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/avassetsegmentreport?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVAssetSegmentReport;
);

unsafe impl Send for AVAssetSegmentReport {}

unsafe impl Sync for AVAssetSegmentReport {}

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

impl AVAssetSegmentReport {
    extern_methods!(
        #[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>;

        /// A segment type of the segment data.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(segmentType))]
        #[unsafe(method_family = none)]
        pub unsafe fn segmentType(&self) -> AVAssetSegmentType;

        /// Provides an array of AVAssetSegmentTrackReport in the segment data.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(trackReports))]
        #[unsafe(method_family = none)]
        pub unsafe fn trackReports(&self) -> Retained<NSArray<AVAssetSegmentTrackReport>>;
    );
}

extern_class!(
    /// This class is vended by AVAssetSegmentReport. It will provide information on a track in a segment data.
    ///
    /// 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/avassetsegmenttrackreport?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVAssetSegmentTrackReport;
);

unsafe impl Send for AVAssetSegmentTrackReport {}

unsafe impl Sync for AVAssetSegmentTrackReport {}

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

impl AVAssetSegmentTrackReport {
    extern_methods!(
        #[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>;

        #[cfg(feature = "objc2-core-media")]
        /// Indicates the persistent unique identifier for this track.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(trackID))]
        #[unsafe(method_family = none)]
        pub unsafe fn trackID(&self) -> CMPersistentTrackID;

        #[cfg(feature = "AVMediaFormat")]
        /// Indicates the media type for this track. Media types are declared in AVMediaFormat.h.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(mediaType))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;

        #[cfg(feature = "objc2-core-media")]
        /// Indicates the earliest presentation timestamp (PTS) for this track. The value is kCMTimeInvalid if there is no information available.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(earliestPresentationTimeStamp))]
        #[unsafe(method_family = none)]
        pub unsafe fn earliestPresentationTimeStamp(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// Indicates the duration for this track. The value is kCMTimeInvalid if there is no information available.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub unsafe fn duration(&self) -> CMTime;

        /// Provides information on the first video sample in this track. The value is nil if this track is not video track or no information available.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(firstVideoSampleInformation))]
        #[unsafe(method_family = none)]
        pub unsafe fn firstVideoSampleInformation(
            &self,
        ) -> Option<Retained<AVAssetSegmentReportSampleInformation>>;
    );
}

extern_class!(
    /// This class is vended by AVAssetSegmentTrackReport. It will provide information on a sample in a track.
    ///
    /// 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/avassetsegmentreportsampleinformation?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVAssetSegmentReportSampleInformation;
);

unsafe impl Send for AVAssetSegmentReportSampleInformation {}

unsafe impl Sync for AVAssetSegmentReportSampleInformation {}

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

impl AVAssetSegmentReportSampleInformation {
    extern_methods!(
        #[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>;

        #[cfg(feature = "objc2-core-media")]
        /// The presentation timestamp (PTS) of the sample.
        ///
        /// This timestamp may be different from the earliestPresentationTimeStamp if the video is encoded using frame reordering.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(presentationTimeStamp))]
        #[unsafe(method_family = none)]
        pub unsafe fn presentationTimeStamp(&self) -> CMTime;

        /// The offset of the sample in the segment.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(offset))]
        #[unsafe(method_family = none)]
        pub unsafe fn offset(&self) -> NSInteger;

        /// The length of the sample.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(length))]
        #[unsafe(method_family = none)]
        pub unsafe fn length(&self) -> NSInteger;

        /// Indicates whether the sample is a sync sample.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isSyncSample))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSyncSample(&self) -> bool;
    );
}