objc2-core-video 0.3.2

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

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatname?language=objc)
    pub static kCVPixelFormatName: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatconstant?language=objc)
    pub static kCVPixelFormatConstant: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcodectype?language=objc)
    pub static kCVPixelFormatCodecType: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatfourcc?language=objc)
    pub static kCVPixelFormatFourCC: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsalpha?language=objc)
    pub static kCVPixelFormatContainsAlpha: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsycbcr?language=objc)
    pub static kCVPixelFormatContainsYCbCr: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsrgb?language=objc)
    pub static kCVPixelFormatContainsRGB: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsgrayscale?language=objc)
    pub static kCVPixelFormatContainsGrayscale: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainssenselarray?language=objc)
    pub static kCVPixelFormatContainsSenselArray: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange?language=objc)
    pub static kCVPixelFormatComponentRange: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange_videorange?language=objc)
    pub static kCVPixelFormatComponentRange_VideoRange: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange_fullrange?language=objc)
    pub static kCVPixelFormatComponentRange_FullRange: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange_widerange?language=objc)
    pub static kCVPixelFormatComponentRange_WideRange: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatplanes?language=objc)
    pub static kCVPixelFormatPlanes: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockwidth?language=objc)
    pub static kCVPixelFormatBlockWidth: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockheight?language=objc)
    pub static kCVPixelFormatBlockHeight: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatbitsperblock?language=objc)
    pub static kCVPixelFormatBitsPerBlock: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatbitspercomponent?language=objc)
    pub static kCVPixelFormatBitsPerComponent: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockhorizontalalignment?language=objc)
    pub static kCVPixelFormatBlockHorizontalAlignment: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockverticalalignment?language=objc)
    pub static kCVPixelFormatBlockVerticalAlignment: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblackblock?language=objc)
    pub static kCVPixelFormatBlackBlock: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformathorizontalsubsampling?language=objc)
    pub static kCVPixelFormatHorizontalSubsampling: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatverticalsubsampling?language=objc)
    pub static kCVPixelFormatVerticalSubsampling: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglformat?language=objc)
    pub static kCVPixelFormatOpenGLFormat: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopengltype?language=objc)
    pub static kCVPixelFormatOpenGLType: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglinternalformat?language=objc)
    pub static kCVPixelFormatOpenGLInternalFormat: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcgbitmapinfo?language=objc)
    pub static kCVPixelFormatCGBitmapInfo: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatqdcompatibility?language=objc)
    pub static kCVPixelFormatQDCompatibility: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcgbitmapcontextcompatibility?language=objc)
    pub static kCVPixelFormatCGBitmapContextCompatibility: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcgimagecompatibility?language=objc)
    pub static kCVPixelFormatCGImageCompatibility: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglcompatibility?language=objc)
    pub static kCVPixelFormatOpenGLCompatibility: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglescompatibility?language=objc)
    pub static kCVPixelFormatOpenGLESCompatibility: &'static CFString;
}

/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvfillextendedpixelscallback?language=objc)
#[cfg(all(
    feature = "CVBuffer",
    feature = "CVImageBuffer",
    feature = "CVPixelBuffer"
))]
pub type CVFillExtendedPixelsCallBack =
    Option<unsafe extern "C-unwind" fn(NonNull<CVPixelBuffer>, *mut c_void) -> Boolean>;

/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvfillextendedpixelscallbackdata?language=objc)
#[cfg(all(
    feature = "CVBuffer",
    feature = "CVImageBuffer",
    feature = "CVPixelBuffer"
))]
#[repr(C)]
#[allow(unpredictable_function_pointer_comparisons)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CVFillExtendedPixelsCallBackData {
    pub version: CFIndex,
    pub fillCallBack: CVFillExtendedPixelsCallBack,
    pub refCon: *mut c_void,
}

#[cfg(all(
    feature = "CVBuffer",
    feature = "CVImageBuffer",
    feature = "CVPixelBuffer",
    feature = "objc2"
))]
unsafe impl Encode for CVFillExtendedPixelsCallBackData {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <CFIndex>::ENCODING,
            <CVFillExtendedPixelsCallBack>::ENCODING,
            <*mut c_void>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "CVBuffer",
    feature = "CVImageBuffer",
    feature = "CVPixelBuffer",
    feature = "objc2"
))]
unsafe impl RefEncode for CVFillExtendedPixelsCallBackData {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatfillextendedpixelscallback?language=objc)
    pub static kCVPixelFormatFillExtendedPixelsCallback: &'static CFString;
}

#[inline]
pub extern "C-unwind" fn CVPixelFormatDescriptionCreateWithPixelFormatType(
    allocator: Option<&CFAllocator>,
    pixel_format: OSType,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn CVPixelFormatDescriptionCreateWithPixelFormatType(
            allocator: Option<&CFAllocator>,
            pixel_format: OSType,
        ) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { CVPixelFormatDescriptionCreateWithPixelFormatType(allocator, pixel_format) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[inline]
pub extern "C-unwind" fn CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(
    allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(
            allocator: Option<&CFAllocator>,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(allocator) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `description` generics must be of the correct type.
    pub fn CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType(
        description: &CFDictionary,
        pixel_format: OSType,
    );
}

/// Creates a string with a formatted representation of a pixel format
///
/// Parameter `pixelFormat`: The pixel format to convert
///
/// Returns: A string with a user displayable conversion of a pixel format.
#[inline]
pub extern "C-unwind" fn CVPixelFormatTypeCopyFourCharCodeString(
    pixel_format: OSType,
) -> CFRetained<CFString> {
    extern "C-unwind" {
        fn CVPixelFormatTypeCopyFourCharCodeString(
            pixel_format: OSType,
        ) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CVPixelFormatTypeCopyFourCharCodeString(pixel_format) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// Checks if a compressed pixel format is supported on the current platform.
///
/// Parameter `pixelFormatType`: compressed pixel format.
///
/// Returns: True if pixel format is supported on the current platform.
#[inline]
pub extern "C-unwind" fn CVIsCompressedPixelFormatAvailable(pixel_format_type: OSType) -> bool {
    extern "C-unwind" {
        fn CVIsCompressedPixelFormatAvailable(pixel_format_type: OSType) -> Boolean;
    }
    let ret = unsafe { CVIsCompressedPixelFormatAvailable(pixel_format_type) };
    ret != 0
}