use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
extern "C" {
pub static kCVPixelFormatName: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatConstant: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatCodecType: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatFourCC: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatContainsAlpha: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatContainsYCbCr: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatContainsRGB: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatContainsGrayscale: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatContainsSenselArray: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatComponentRange: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatComponentRange_VideoRange: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatComponentRange_FullRange: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatComponentRange_WideRange: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatPlanes: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatBlockWidth: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatBlockHeight: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatBitsPerBlock: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatBitsPerComponent: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatBlockHorizontalAlignment: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatBlockVerticalAlignment: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatBlackBlock: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatHorizontalSubsampling: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatVerticalSubsampling: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatOpenGLFormat: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatOpenGLType: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatOpenGLInternalFormat: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatCGBitmapInfo: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatQDCompatibility: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatCGBitmapContextCompatibility: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatCGImageCompatibility: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatOpenGLCompatibility: &'static CFString;
}
extern "C" {
pub static kCVPixelFormatOpenGLESCompatibility: &'static CFString;
}
#[cfg(all(
feature = "CVBuffer",
feature = "CVImageBuffer",
feature = "CVPixelBuffer"
))]
pub type CVFillExtendedPixelsCallBack =
Option<unsafe extern "C-unwind" fn(NonNull<CVPixelBuffer>, *mut c_void) -> Boolean>;
#[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" {
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" {
pub fn CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType(
description: &CFDictionary,
pixel_format: OSType,
);
}
#[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) }
}
#[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
}