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::ptr::NonNull;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
use objc2_open_gl::*;

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferwidth?language=objc)
    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
    pub static kCVOpenGLBufferWidth: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferheight?language=objc)
    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
    pub static kCVOpenGLBufferHeight: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbuffertarget?language=objc)
    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
    pub static kCVOpenGLBufferTarget: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferinternalformat?language=objc)
    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
    pub static kCVOpenGLBufferInternalFormat: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbuffermaximummipmaplevel?language=objc)
    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
    pub static kCVOpenGLBufferMaximumMipmapLevel: &'static CFString;
}

/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvopenglbuffer?language=objc)
#[doc(alias = "CVOpenGLBufferRef")]
#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
pub type CVOpenGLBuffer = CVImageBuffer;

#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
#[inline]
pub extern "C-unwind" fn CVOpenGLBufferGetTypeID() -> CFTypeID {
    extern "C-unwind" {
        fn CVOpenGLBufferGetTypeID() -> CFTypeID;
    }
    unsafe { CVOpenGLBufferGetTypeID() }
}

extern "C-unwind" {
    /// Create a new CVOpenGLBuffer that may be used for OpenGL rendering purposes
    ///
    /// Parameter `width`: The width of the buffer in pixels
    ///
    /// Parameter `height`: The height of the buffer in pixels
    ///
    /// Parameter `attributes`: A CFDictionaryRef containing other desired attributes of the buffer (texture target, internal format, max mipmap level, etc.).
    /// May be NULL.  Defaults are GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, and 0 for kCVOpenGLBufferTarget, kCVOpenGLBufferInternalFormat and kCVOpenGLBufferMaximumMipmapLevel,
    /// respectively.
    ///
    /// Parameter `bufferOut`: The newly created buffer will be placed here.
    ///
    /// Returns: kCVReturnSuccess if the attachment succeeded
    ///
    /// # Safety
    ///
    /// - `attributes` generics must be of the correct type.
    /// - `buffer_out` must be a valid pointer.
    #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
    pub fn CVOpenGLBufferCreate(
        allocator: Option<&CFAllocator>,
        width: usize,
        height: usize,
        attributes: Option<&CFDictionary>,
        buffer_out: NonNull<*mut CVOpenGLBuffer>,
    ) -> CVReturn;
}

/// Parameter `openGLBuffer`: Target OpenGL Buffer.
///
/// Returns: CVOpenGLBuffer attributes dictionary, NULL if not set.
#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
#[inline]
pub extern "C-unwind" fn CVOpenGLBufferGetAttributes(
    open_gl_buffer: &CVOpenGLBuffer,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn CVOpenGLBufferGetAttributes(
            open_gl_buffer: &CVOpenGLBuffer,
        ) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { CVOpenGLBufferGetAttributes(open_gl_buffer) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

extern "C-unwind" {
    /// Parameter `openGLBuffer`: The buffer you wish to attach a GL context to
    ///
    /// Parameter `cglContext`: The CGLContextObj you wish to attach
    ///
    /// Parameter `face`: The target GL face enum (0 for non cube maps)
    ///
    /// Parameter `level`: The mipmap level index you wish to attach to
    ///
    /// Parameter `screen`: The virtual screen number you want to use
    ///
    /// Returns: kCVReturnSuccess if the attachment succeeded
    ///
    /// # Safety
    ///
    /// `cgl_context` must be a valid pointer.
    #[cfg(all(
        feature = "CVBuffer",
        feature = "CVImageBuffer",
        feature = "CVReturn",
        feature = "objc2-open-gl"
    ))]
    #[cfg(target_os = "macos")]
    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
    pub fn CVOpenGLBufferAttach(
        open_gl_buffer: &CVOpenGLBuffer,
        cgl_context: CGLContextObj,
        face: GLenum,
        level: GLint,
        screen: GLint,
    ) -> CVReturn;
}