objc2-video-toolbox 0.3.2

Bindings to the VideoToolbox framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
#[cfg(feature = "objc2-core-video")]
use objc2_core_video::*;

use crate::*;

#[cfg(feature = "objc2")]
extern_class!(
    /// Helper class to wrap pixel buffers as video frames.
    ///
    /// You can use the frames as source frames, reference frames, or output frames of a processor. Frame instances retain
    /// the backing pixel buffer.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtframeprocessorframe?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct VTFrameProcessorFrame;
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for VTFrameProcessorFrame {}
);

#[cfg(feature = "objc2")]
impl VTFrameProcessorFrame {
    extern_methods!(
        #[cfg(all(feature = "objc2-core-media", feature = "objc2-core-video"))]
        /// Creates a new instance of frame with a pixel buffer and presentation timestamp.
        ///
        /// The `CVPixelBuffer` is retained in this object.
        /// Returns `nil` if the ``CVPixelBuffer`` you provided is NULL or the ``CVPixelBuffer`` is not backed by ``IOSurface``.
        ///
        /// - Parameters:
        /// - buffer: The ``CVPixelBuffer`` that this frame wraps; it must not be `nil` and must be ``IOSurface`` backed.
        /// - presentationTimeStamp: The presentation timestamp of the buffer.
        #[unsafe(method(initWithBuffer:presentationTimeStamp:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithBuffer_presentationTimeStamp(
            this: Allocated<Self>,
            buffer: &CVPixelBuffer,
            presentation_time_stamp: CMTime,
        ) -> Option<Retained<Self>>;

        #[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-video")]
        /// Pixel buffer that you provided when you initialized the object.
        #[unsafe(method(buffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn buffer(&self) -> Retained<CVPixelBuffer>;

        #[cfg(feature = "objc2-core-media")]
        /// Presentation timestamp that you provided when you initialized the object.
        #[unsafe(method(presentationTimeStamp))]
        #[unsafe(method_family = none)]
        pub unsafe fn presentationTimeStamp(&self) -> CMTime;
    );
}

#[cfg(feature = "objc2")]
extern_class!(
    /// Helper class to wrap optical flow.
    ///
    /// Instances retain the backing pixel buffers that you provide.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtframeprocessoropticalflow?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct VTFrameProcessorOpticalFlow;
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for VTFrameProcessorOpticalFlow {}
);

#[cfg(feature = "objc2")]
impl VTFrameProcessorOpticalFlow {
    extern_methods!(
        #[cfg(feature = "objc2-core-video")]
        /// Creates a new instance of forward and backward optical flow with pixel buffers.
        ///
        /// Create a new instance with forward and backward optical flow ``CVPixelBuffer``s. Instances retain the pixel buffers
        /// you provide to this method. Returns `nil` if either `CVPixelBuffer` is NULL or the `CVPixelBuffer`s are not `IOSurface` backed.
        ///
        /// - Parameters:
        /// - forwardFlow: `CVPixelBuffer` that contains forward optical flow; it must not be `nil` and must be `IOSurface` backed.
        /// - backwardFlow: `CVPixelBuffer` that contains backward optical flow; it must not be `nil` and must be `IOSurface` backed.
        #[unsafe(method(initWithForwardFlow:backwardFlow:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithForwardFlow_backwardFlow(
            this: Allocated<Self>,
            forward_flow: &CVPixelBuffer,
            backward_flow: &CVPixelBuffer,
        ) -> Option<Retained<Self>>;

        #[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-video")]
        /// Returns the forward optical flow `CVPixelBuffer` that you provided when you initialized the object.
        #[unsafe(method(forwardFlow))]
        #[unsafe(method_family = none)]
        pub unsafe fn forwardFlow(&self) -> Retained<CVPixelBuffer>;

        #[cfg(feature = "objc2-core-video")]
        /// Returns the backward optical flow `CVPixelBuffer` that you provided when you initialized the object.
        #[unsafe(method(backwardFlow))]
        #[unsafe(method_family = none)]
        pub unsafe fn backwardFlow(&self) -> Retained<CVPixelBuffer>;
    );
}