objc2_core_video/generated/
CVOpenGLBufferPool.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::marker::{PhantomData, PhantomPinned};
5use core::ptr::NonNull;
6use objc2_core_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvopenglbufferpool?language=objc)
11#[repr(C)]
12pub struct CVOpenGLBufferPool {
13    inner: [u8; 0],
14    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
15}
16
17cf_type!(
18    #[encoding_name = "__CVOpenGLBufferPool"]
19    unsafe impl CVOpenGLBufferPool {}
20);
21
22extern "C" {
23    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferpoolminimumbuffercountkey?language=objc)
24    pub static kCVOpenGLBufferPoolMinimumBufferCountKey: &'static CFString;
25}
26
27extern "C" {
28    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferpoolmaximumbufferagekey?language=objc)
29    pub static kCVOpenGLBufferPoolMaximumBufferAgeKey: &'static CFString;
30}
31
32unsafe impl ConcreteType for CVOpenGLBufferPool {
33    #[doc(alias = "CVOpenGLBufferPoolGetTypeID")]
34    #[inline]
35    fn type_id() -> CFTypeID {
36        extern "C-unwind" {
37            fn CVOpenGLBufferPoolGetTypeID() -> CFTypeID;
38        }
39        unsafe { CVOpenGLBufferPoolGetTypeID() }
40    }
41}
42
43extern "C-unwind" {
44    /// Creates a new OpenGL Buffer pool.
45    ///
46    /// Equivalent to CFRelease, but NULL safe
47    ///
48    /// Parameter `allocator`: The CFAllocatorRef to use for allocating this buffer pool.  May be NULL.
49    ///
50    /// Parameter `poolAttributes`: A CFDictionaryRef containing the attributes to be used for the pool itself.
51    ///
52    /// Parameter `openGLBufferAttributes`: A CFDictionaryRef containing the attributes to be used for creating new OpenGLBuffers within the pool.
53    ///
54    /// Parameter `poolOut`: The newly created pool will be placed here
55    ///
56    /// Returns: Returns kCVReturnSuccess on success
57    #[cfg(feature = "CVReturn")]
58    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
59    pub fn CVOpenGLBufferPoolCreate(
60        allocator: Option<&CFAllocator>,
61        pool_attributes: Option<&CFDictionary>,
62        open_gl_buffer_attributes: Option<&CFDictionary>,
63        pool_out: NonNull<*mut CVOpenGLBufferPool>,
64    ) -> CVReturn;
65}
66
67/// Returns the pool attributes dictionary for a CVOpenGLBufferPool
68///
69/// Parameter `pool`: The CVOpenGLBufferPoolRef to retrieve the attributes from
70///
71/// Returns: Returns the pool attributes dictionary, or NULL on failure.
72#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
73#[inline]
74pub unsafe extern "C-unwind" fn CVOpenGLBufferPoolGetAttributes(
75    pool: &CVOpenGLBufferPool,
76) -> Option<CFRetained<CFDictionary>> {
77    extern "C-unwind" {
78        fn CVOpenGLBufferPoolGetAttributes(
79            pool: &CVOpenGLBufferPool,
80        ) -> Option<NonNull<CFDictionary>>;
81    }
82    let ret = unsafe { CVOpenGLBufferPoolGetAttributes(pool) };
83    ret.map(|ret| unsafe { CFRetained::retain(ret) })
84}
85
86/// Returns the attributes of OpenGL buffers that will be created from this pool.
87///
88/// This function is provided for those cases where you may need to know some information about the buffers that
89/// will be created up front.
90///
91/// Parameter `pool`: The CVOpenGLBufferPoolRef to retrieve the attributes from
92///
93/// Returns: Returns the OpenGL buffer attributes dictionary, or NULL on failure.
94#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
95#[inline]
96pub unsafe extern "C-unwind" fn CVOpenGLBufferPoolGetOpenGLBufferAttributes(
97    pool: &CVOpenGLBufferPool,
98) -> Option<CFRetained<CFDictionary>> {
99    extern "C-unwind" {
100        fn CVOpenGLBufferPoolGetOpenGLBufferAttributes(
101            pool: &CVOpenGLBufferPool,
102        ) -> Option<NonNull<CFDictionary>>;
103    }
104    let ret = unsafe { CVOpenGLBufferPoolGetOpenGLBufferAttributes(pool) };
105    ret.map(|ret| unsafe { CFRetained::retain(ret) })
106}
107
108extern "C-unwind" {
109    /// Creates a new OpenGLBuffer object from the pool.
110    ///
111    /// The function creates a new CVOpenGLBuffer with the default attachments using the OpenGL buffer attributes specifed during pool creation.
112    ///
113    /// Parameter `allocator`: The CFAllocatorRef to use for creating the OpenGL buffer.  May be NULL.
114    ///
115    /// Parameter `openGLBufferPool`: The CVOpenGLBufferPool that should create the new CVOpenGLBuffer.
116    ///
117    /// Parameter `openGLBufferOut`: The newly created OpenGL buffer will be placed here
118    ///
119    /// Returns: Returns kCVReturnSuccess on success
120    #[cfg(all(
121        feature = "CVBuffer",
122        feature = "CVImageBuffer",
123        feature = "CVOpenGLBuffer",
124        feature = "CVReturn"
125    ))]
126    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
127    pub fn CVOpenGLBufferPoolCreateOpenGLBuffer(
128        allocator: Option<&CFAllocator>,
129        open_gl_buffer_pool: &CVOpenGLBufferPool,
130        open_gl_buffer_out: NonNull<*mut CVOpenGLBuffer>,
131    ) -> CVReturn;
132}