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::ffi::*;
use core::ptr::NonNull;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
#[cfg(feature = "objc2-core-video")]
use objc2_core_video::*;

use crate::*;

extern "C-unwind" {
    /// Creates a CGImage using the provided CVPixelBuffer
    ///
    /// Parameter `pixelBuffer`: The pixelBuffer to be used as the image data source for the CGImage.
    ///
    /// Parameter `options`: no options currently.  pass NULL.
    ///
    /// Parameter `imageOut`: pointer to an address to receive the newly created CGImage.
    ///
    /// This routine creates a CGImage representation of the image data contained in
    /// the provided CVPixelBuffer.
    /// The source CVPixelBuffer may be retained for the lifetime of the CGImage.  Changes
    /// to the CVPixelBuffer after making this call (other than releasing it) will have
    /// undefined results.
    /// Not all CVPixelBuffer pixel formats will support conversion into a CGImage compatible
    /// pixel format.
    ///
    /// # Safety
    ///
    /// - `options` generics must be of the correct type.
    /// - `image_out` must be a valid pointer.
    #[cfg(all(feature = "objc2-core-graphics", feature = "objc2-core-video"))]
    pub fn VTCreateCGImageFromCVPixelBuffer(
        pixel_buffer: &CVPixelBuffer,
        options: Option<&CFDictionary>,
        image_out: NonNull<*mut CGImage>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Requests that a video decoder, if available, be registered for the specified CMVideoCodecType
    ///
    /// Parameter `codecType`: The CMVideoCodecType corresponding the format being requested
    ///
    /// This call will find and register a video decoder for the provided CMVideoCodecType if
    /// such a decoder is available on the system but not registered by default.
    #[cfg(feature = "objc2-core-media")]
    pub fn VTRegisterSupplementalVideoDecoderIfAvailable(codec_type: CMVideoCodecType);
}

extern "C-unwind" {
    /// Returns information about the Media Extension video decoder required to decode the specified format.
    ///
    /// If a Media Extension video decoder will be used to decode the specified format, this function will return information about the Media Extension that will be used.
    ///
    /// Parameter `formatDesc`: The format description for the video format for which information is being requested.
    ///
    /// Parameter `mediaExtensionPropertiesOut`: If a Media Extension video decoder will be used to decode the specified format, this pointer will return a dictionary with a set of properties describing the extension video decoder. The dictionary keys are VTExtensionPropertiesKey values.
    ///
    /// Returns: If the function succeeds and a Media Extension video decoder will be used to decode this format, the return value will be noErr. If the function succeeds but a Media Extension video decoder will not be used to decode this format, the return value will be kVTCouldNotFindExtensionErr. If a Media Extension video decoder for the format was found but is disabled, the function will return kVTExtensionDisabledErr. Otherwise, the return value will be an error code describing the failure.
    ///
    /// # Safety
    ///
    /// `media_extension_properties_out` must be a valid pointer.
    #[cfg(feature = "objc2-core-media")]
    pub fn VTCopyVideoDecoderExtensionProperties(
        format_desc: &CMFormatDescription,
        media_extension_properties_out: NonNull<*const CFDictionary>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Returns information about the Media Extension RAW processor supporting the specified format.
    ///
    /// If a Media Extension RAW processor will be used to process the specified format, this function will return information about the Media Extension that will be used.
    ///
    /// Parameter `formatDesc`: The format description for the video format for which information is being requested.
    ///
    /// Parameter `mediaExtensionPropertiesOut`: If a Media Extension RAW processor  will be used to process the specified format, this pointer will return a dictionary with a set of properties describing the extension RAW processor. The dictionary keys VTExtensionPropertiesKey values.
    ///
    /// Returns: If the function succeeds and a Media Extension RAW processor will be used to process this format, the return value will be noErr. If the function succeeds but a Media Extension RAW processor will not be used to process this format, the return value will be kVTCouldNotFindExtensionErr. If a Media Extension RAW processor for the format was found but is disabled, the function will return kVTExtensionDisabledErr. Otherwise, the return value will be an error code describing the failure.
    ///
    /// # Safety
    ///
    /// `media_extension_properties_out` must be a valid pointer.
    #[cfg(feature = "objc2-core-media")]
    pub fn VTCopyRAWProcessorExtensionProperties(
        format_desc: &CMFormatDescription,
        media_extension_properties_out: NonNull<*const CFDictionary>,
    ) -> OSStatus;
}

/// A key in a Media Extension extension properties dictionary.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtextensionpropertieskey?language=objc)
// NS_TYPED_ENUM
pub type VTExtensionPropertiesKey = CFString;

extern "C" {
    /// A CFDictionary key for the video decoder extension identifier.
    ///
    /// This key points to a CFStringRef value with the extension identifier, corresponding to the ClassImplementationID value from the EXAppExtensionAttributes dictionary in the Info.plist file.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtextensionproperties_extensionidentifierkey?language=objc)
    pub static kVTExtensionProperties_ExtensionIdentifierKey: &'static VTExtensionPropertiesKey;
}

extern "C" {
    /// A CFDictionary key for the localized extension name.
    ///
    /// This key points to a CFStringRef value with the localized extension name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtextensionproperties_extensionnamekey?language=objc)
    pub static kVTExtensionProperties_ExtensionNameKey: &'static VTExtensionPropertiesKey;
}

extern "C" {
    /// A CFDictionary key for the extension host application localized name.
    ///
    /// This key points to a CFStringRef value with the localized name of the application hosting the extension.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtextensionproperties_containingbundlenamekey?language=objc)
    pub static kVTExtensionProperties_ContainingBundleNameKey: &'static VTExtensionPropertiesKey;
}

extern "C" {
    /// A CFDictionary key for the URL of the extension.
    ///
    /// This key points to a CFURLRef value with the URL for the extension.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtextensionproperties_extensionurlkey?language=objc)
    pub static kVTExtensionProperties_ExtensionURLKey: &'static VTExtensionPropertiesKey;
}

extern "C" {
    /// A CFDictionary key for the URL of the extension host application.
    ///
    /// This key points to a CFURLRef value with the URL of the extension host application.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtextensionproperties_containingbundleurlkey?language=objc)
    pub static kVTExtensionProperties_ContainingBundleURLKey: &'static VTExtensionPropertiesKey;
}

extern "C" {
    /// A CFDictionary key for the user readable name string of the codec.
    ///
    /// This key points to a CFStringRef with the name of the codec from the supplied format description. This name will be the one listed in the extension CodecInfo array with the key CodecName.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtextensionproperties_codecnamekey?language=objc)
    pub static kVTExtensionProperties_CodecNameKey: &'static VTExtensionPropertiesKey;
}