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;
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8use objc2_core_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvopenglbufferpool?language=objc)
13#[doc(alias = "CVOpenGLBufferPoolRef")]
14#[repr(C)]
15pub struct CVOpenGLBufferPool {
16    inner: [u8; 0],
17    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20cf_type!(
21    unsafe impl CVOpenGLBufferPool {}
22);
23#[cfg(feature = "objc2")]
24cf_objc2_type!(
25    unsafe impl RefEncode<"__CVOpenGLBufferPool"> for CVOpenGLBufferPool {}
26);
27
28extern "C" {
29    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferpoolminimumbuffercountkey?language=objc)
30    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
31    pub static kCVOpenGLBufferPoolMinimumBufferCountKey: &'static CFString;
32}
33
34extern "C" {
35    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferpoolmaximumbufferagekey?language=objc)
36    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
37    pub static kCVOpenGLBufferPoolMaximumBufferAgeKey: &'static CFString;
38}
39
40unsafe impl ConcreteType for CVOpenGLBufferPool {
41    #[doc(alias = "CVOpenGLBufferPoolGetTypeID")]
42    #[inline]
43    fn type_id() -> CFTypeID {
44        extern "C-unwind" {
45            fn CVOpenGLBufferPoolGetTypeID() -> CFTypeID;
46        }
47        unsafe { CVOpenGLBufferPoolGetTypeID() }
48    }
49}
50
51impl CVOpenGLBufferPool {
52    /// Creates a new OpenGL Buffer pool.
53    ///
54    /// Equivalent to CFRelease, but NULL safe
55    ///
56    /// Parameter `allocator`: The CFAllocatorRef to use for allocating this buffer pool.  May be NULL.
57    ///
58    /// Parameter `poolAttributes`: A CFDictionaryRef containing the attributes to be used for the pool itself.
59    ///
60    /// Parameter `openGLBufferAttributes`: A CFDictionaryRef containing the attributes to be used for creating new OpenGLBuffers within the pool.
61    ///
62    /// Parameter `poolOut`: The newly created pool will be placed here
63    ///
64    /// Returns: Returns kCVReturnSuccess on success
65    ///
66    /// # Safety
67    ///
68    /// - `pool_attributes` generics must be of the correct type.
69    /// - `open_gl_buffer_attributes` generics must be of the correct type.
70    /// - `pool_out` must be a valid pointer.
71    #[doc(alias = "CVOpenGLBufferPoolCreate")]
72    #[cfg(feature = "CVReturn")]
73    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
74    #[inline]
75    pub unsafe fn create(
76        allocator: Option<&CFAllocator>,
77        pool_attributes: Option<&CFDictionary>,
78        open_gl_buffer_attributes: Option<&CFDictionary>,
79        pool_out: NonNull<*mut CVOpenGLBufferPool>,
80    ) -> CVReturn {
81        extern "C-unwind" {
82            fn CVOpenGLBufferPoolCreate(
83                allocator: Option<&CFAllocator>,
84                pool_attributes: Option<&CFDictionary>,
85                open_gl_buffer_attributes: Option<&CFDictionary>,
86                pool_out: NonNull<*mut CVOpenGLBufferPool>,
87            ) -> CVReturn;
88        }
89        unsafe {
90            CVOpenGLBufferPoolCreate(
91                allocator,
92                pool_attributes,
93                open_gl_buffer_attributes,
94                pool_out,
95            )
96        }
97    }
98
99    /// Returns the pool attributes dictionary for a CVOpenGLBufferPool
100    ///
101    /// Parameter `pool`: The CVOpenGLBufferPoolRef to retrieve the attributes from
102    ///
103    /// Returns: Returns the pool attributes dictionary, or NULL on failure.
104    #[doc(alias = "CVOpenGLBufferPoolGetAttributes")]
105    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
106    #[inline]
107    pub fn attributes(&self) -> Option<CFRetained<CFDictionary>> {
108        extern "C-unwind" {
109            fn CVOpenGLBufferPoolGetAttributes(
110                pool: &CVOpenGLBufferPool,
111            ) -> Option<NonNull<CFDictionary>>;
112        }
113        let ret = unsafe { CVOpenGLBufferPoolGetAttributes(self) };
114        ret.map(|ret| unsafe { CFRetained::retain(ret) })
115    }
116
117    /// Returns the attributes of OpenGL buffers that will be created from this pool.
118    ///
119    /// This function is provided for those cases where you may need to know some information about the buffers that
120    /// will be created up front.
121    ///
122    /// Parameter `pool`: The CVOpenGLBufferPoolRef to retrieve the attributes from
123    ///
124    /// Returns: Returns the OpenGL buffer attributes dictionary, or NULL on failure.
125    #[doc(alias = "CVOpenGLBufferPoolGetOpenGLBufferAttributes")]
126    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
127    #[inline]
128    pub fn open_gl_buffer_attributes(&self) -> Option<CFRetained<CFDictionary>> {
129        extern "C-unwind" {
130            fn CVOpenGLBufferPoolGetOpenGLBufferAttributes(
131                pool: &CVOpenGLBufferPool,
132            ) -> Option<NonNull<CFDictionary>>;
133        }
134        let ret = unsafe { CVOpenGLBufferPoolGetOpenGLBufferAttributes(self) };
135        ret.map(|ret| unsafe { CFRetained::retain(ret) })
136    }
137
138    /// Creates a new OpenGLBuffer object from the pool.
139    ///
140    /// The function creates a new CVOpenGLBuffer with the default attachments using the OpenGL buffer attributes specifed during pool creation.
141    ///
142    /// Parameter `allocator`: The CFAllocatorRef to use for creating the OpenGL buffer.  May be NULL.
143    ///
144    /// Parameter `openGLBufferPool`: The CVOpenGLBufferPool that should create the new CVOpenGLBuffer.
145    ///
146    /// Parameter `openGLBufferOut`: The newly created OpenGL buffer will be placed here
147    ///
148    /// Returns: Returns kCVReturnSuccess on success
149    ///
150    /// # Safety
151    ///
152    /// `open_gl_buffer_out` must be a valid pointer.
153    #[doc(alias = "CVOpenGLBufferPoolCreateOpenGLBuffer")]
154    #[cfg(all(
155        feature = "CVBuffer",
156        feature = "CVImageBuffer",
157        feature = "CVOpenGLBuffer",
158        feature = "CVReturn"
159    ))]
160    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
161    #[inline]
162    pub unsafe fn create_open_gl_buffer(
163        allocator: Option<&CFAllocator>,
164        open_gl_buffer_pool: &CVOpenGLBufferPool,
165        open_gl_buffer_out: NonNull<*mut CVOpenGLBuffer>,
166    ) -> CVReturn {
167        extern "C-unwind" {
168            fn CVOpenGLBufferPoolCreateOpenGLBuffer(
169                allocator: Option<&CFAllocator>,
170                open_gl_buffer_pool: &CVOpenGLBufferPool,
171                open_gl_buffer_out: NonNull<*mut CVOpenGLBuffer>,
172            ) -> CVReturn;
173        }
174        unsafe {
175            CVOpenGLBufferPoolCreateOpenGLBuffer(allocator, open_gl_buffer_pool, open_gl_buffer_out)
176        }
177    }
178}
179
180extern "C-unwind" {
181    #[cfg(feature = "CVReturn")]
182    #[deprecated = "renamed to `CVOpenGLBufferPool::create`"]
183    pub fn CVOpenGLBufferPoolCreate(
184        allocator: Option<&CFAllocator>,
185        pool_attributes: Option<&CFDictionary>,
186        open_gl_buffer_attributes: Option<&CFDictionary>,
187        pool_out: NonNull<*mut CVOpenGLBufferPool>,
188    ) -> CVReturn;
189}
190
191#[deprecated = "renamed to `CVOpenGLBufferPool::attributes`"]
192#[inline]
193pub extern "C-unwind" fn CVOpenGLBufferPoolGetAttributes(
194    pool: &CVOpenGLBufferPool,
195) -> Option<CFRetained<CFDictionary>> {
196    extern "C-unwind" {
197        fn CVOpenGLBufferPoolGetAttributes(
198            pool: &CVOpenGLBufferPool,
199        ) -> Option<NonNull<CFDictionary>>;
200    }
201    let ret = unsafe { CVOpenGLBufferPoolGetAttributes(pool) };
202    ret.map(|ret| unsafe { CFRetained::retain(ret) })
203}
204
205#[deprecated = "renamed to `CVOpenGLBufferPool::open_gl_buffer_attributes`"]
206#[inline]
207pub extern "C-unwind" fn CVOpenGLBufferPoolGetOpenGLBufferAttributes(
208    pool: &CVOpenGLBufferPool,
209) -> Option<CFRetained<CFDictionary>> {
210    extern "C-unwind" {
211        fn CVOpenGLBufferPoolGetOpenGLBufferAttributes(
212            pool: &CVOpenGLBufferPool,
213        ) -> Option<NonNull<CFDictionary>>;
214    }
215    let ret = unsafe { CVOpenGLBufferPoolGetOpenGLBufferAttributes(pool) };
216    ret.map(|ret| unsafe { CFRetained::retain(ret) })
217}
218
219extern "C-unwind" {
220    #[cfg(all(
221        feature = "CVBuffer",
222        feature = "CVImageBuffer",
223        feature = "CVOpenGLBuffer",
224        feature = "CVReturn"
225    ))]
226    #[deprecated = "renamed to `CVOpenGLBufferPool::create_open_gl_buffer`"]
227    pub fn CVOpenGLBufferPoolCreateOpenGLBuffer(
228        allocator: Option<&CFAllocator>,
229        open_gl_buffer_pool: &CVOpenGLBufferPool,
230        open_gl_buffer_out: NonNull<*mut CVOpenGLBuffer>,
231    ) -> CVReturn;
232}