objc2_core_video/generated/
CVOpenGLTextureCache.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-open-gl")]
11#[cfg(target_os = "macos")]
12use objc2_open_gl::*;
13
14use crate::*;
15
16/// CoreVideo OpenGL Texture Cache
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvopengltexturecache?language=objc)
19#[doc(alias = "CVOpenGLTextureCacheRef")]
20#[repr(C)]
21pub struct CVOpenGLTextureCache {
22    inner: [u8; 0],
23    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
24}
25
26cf_type!(
27    unsafe impl CVOpenGLTextureCache {}
28);
29#[cfg(feature = "objc2")]
30cf_objc2_type!(
31    unsafe impl RefEncode<"__CVOpenGLTextureCache"> for CVOpenGLTextureCache {}
32);
33
34extern "C" {
35    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopengltexturecachechromasamplingmodekey?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 kCVOpenGLTextureCacheChromaSamplingModeKey: &'static CFString;
38}
39
40extern "C" {
41    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopengltexturecachechromasamplingmodeautomatic?language=objc)
42    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
43    pub static kCVOpenGLTextureCacheChromaSamplingModeAutomatic: &'static CFString;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopengltexturecachechromasamplingmodehighestquality?language=objc)
48    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
49    pub static kCVOpenGLTextureCacheChromaSamplingModeHighestQuality: &'static CFString;
50}
51
52extern "C" {
53    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopengltexturecachechromasamplingmodebestperformance?language=objc)
54    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
55    pub static kCVOpenGLTextureCacheChromaSamplingModeBestPerformance: &'static CFString;
56}
57
58unsafe impl ConcreteType for CVOpenGLTextureCache {
59    #[doc(alias = "CVOpenGLTextureCacheGetTypeID")]
60    #[inline]
61    fn type_id() -> CFTypeID {
62        extern "C-unwind" {
63            fn CVOpenGLTextureCacheGetTypeID() -> CFTypeID;
64        }
65        unsafe { CVOpenGLTextureCacheGetTypeID() }
66    }
67}
68
69impl CVOpenGLTextureCache {
70    /// Creates a new Texture Cache.
71    ///
72    /// Parameter `allocator`: The CFAllocatorRef to use for allocating the cache.  May be NULL.
73    ///
74    /// Parameter `cacheAttributes`: A CFDictionaryRef containing the attributes of the cache itself.   May be NULL.
75    ///
76    /// Parameter `cglContext`: The OpenGL context into which the texture objects will be created
77    ///
78    /// Parameter `cglPixelFormat`: The OpenGL pixel format object used to create the passed in OpenGL context
79    ///
80    /// Parameter `textureAttributes`: A CFDictionaryRef containing the attributes to be used for creating the CVOpenGLTexture objects.  May be NULL.
81    ///
82    /// Parameter `cacheOut`: The newly created texture cache will be placed here
83    ///
84    /// Returns: Returns kCVReturnSuccess on success
85    ///
86    /// # Safety
87    ///
88    /// - `cache_attributes` generics must be of the correct type.
89    /// - `cgl_context` must be a valid pointer.
90    /// - `cgl_pixel_format` must be a valid pointer.
91    /// - `texture_attributes` generics must be of the correct type.
92    /// - `cache_out` must be a valid pointer.
93    #[doc(alias = "CVOpenGLTextureCacheCreate")]
94    #[cfg(all(feature = "CVReturn", feature = "objc2-open-gl"))]
95    #[cfg(target_os = "macos")]
96    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
97    #[inline]
98    pub unsafe fn create(
99        allocator: Option<&CFAllocator>,
100        cache_attributes: Option<&CFDictionary>,
101        cgl_context: CGLContextObj,
102        cgl_pixel_format: CGLPixelFormatObj,
103        texture_attributes: Option<&CFDictionary>,
104        cache_out: NonNull<*mut CVOpenGLTextureCache>,
105    ) -> CVReturn {
106        extern "C-unwind" {
107            fn CVOpenGLTextureCacheCreate(
108                allocator: Option<&CFAllocator>,
109                cache_attributes: Option<&CFDictionary>,
110                cgl_context: CGLContextObj,
111                cgl_pixel_format: CGLPixelFormatObj,
112                texture_attributes: Option<&CFDictionary>,
113                cache_out: NonNull<*mut CVOpenGLTextureCache>,
114            ) -> CVReturn;
115        }
116        unsafe {
117            CVOpenGLTextureCacheCreate(
118                allocator,
119                cache_attributes,
120                cgl_context,
121                cgl_pixel_format,
122                texture_attributes,
123                cache_out,
124            )
125        }
126    }
127
128    /// Creates a CVOpenGLTexture object from an existing CVImageBuffer
129    ///
130    /// Parameter `allocator`: The CFAllocatorRef to use for allocating the CVOpenGLTexture object.  May be NULL.
131    ///
132    /// Parameter `textureCache`: The texture cache object that will manage the texture
133    ///
134    /// Parameter `sourceImage`: The CVImageBuffer that you want to create a CVOpenGLTexture from.
135    ///
136    /// Parameter `attributes`: For Future use only! - The desired buffer attributes for the CVOpenGLTexture.
137    ///
138    /// Parameter `textureOut`: The newly created texture object will be placed here.
139    ///
140    /// Returns: Returns kCVReturnSuccess on success
141    ///
142    /// # Safety
143    ///
144    /// - `attributes` generics must be of the correct type.
145    /// - `texture_out` must be a valid pointer.
146    #[doc(alias = "CVOpenGLTextureCacheCreateTextureFromImage")]
147    #[cfg(all(
148        feature = "CVBuffer",
149        feature = "CVImageBuffer",
150        feature = "CVOpenGLTexture",
151        feature = "CVReturn"
152    ))]
153    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
154    #[inline]
155    pub unsafe fn create_texture_from_image(
156        allocator: Option<&CFAllocator>,
157        texture_cache: &CVOpenGLTextureCache,
158        source_image: &CVImageBuffer,
159        attributes: Option<&CFDictionary>,
160        texture_out: NonNull<*mut CVOpenGLTexture>,
161    ) -> CVReturn {
162        extern "C-unwind" {
163            fn CVOpenGLTextureCacheCreateTextureFromImage(
164                allocator: Option<&CFAllocator>,
165                texture_cache: &CVOpenGLTextureCache,
166                source_image: &CVImageBuffer,
167                attributes: Option<&CFDictionary>,
168                texture_out: NonNull<*mut CVOpenGLTexture>,
169            ) -> CVReturn;
170        }
171        unsafe {
172            CVOpenGLTextureCacheCreateTextureFromImage(
173                allocator,
174                texture_cache,
175                source_image,
176                attributes,
177                texture_out,
178            )
179        }
180    }
181
182    /// Performs internal housekeeping/recycling operations
183    ///
184    /// This call must be made periodically to give the texture cache a chance to make OpenGL calls
185    /// on the OpenGL context used to create it in order to do housekeeping operations.
186    ///
187    /// Parameter `textureCache`: The texture cache object to flush
188    ///
189    /// Parameter `options`: Currently unused, set to 0.
190    ///
191    /// Returns: Returns kCVReturnSuccess on success
192    #[doc(alias = "CVOpenGLTextureCacheFlush")]
193    #[cfg(feature = "CVBase")]
194    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
195    #[inline]
196    pub fn flush(&self, options: CVOptionFlags) {
197        extern "C-unwind" {
198            fn CVOpenGLTextureCacheFlush(
199                texture_cache: &CVOpenGLTextureCache,
200                options: CVOptionFlags,
201            );
202        }
203        unsafe { CVOpenGLTextureCacheFlush(self, options) }
204    }
205}
206
207extern "C-unwind" {
208    #[cfg(all(feature = "CVReturn", feature = "objc2-open-gl"))]
209    #[cfg(target_os = "macos")]
210    #[deprecated = "renamed to `CVOpenGLTextureCache::create`"]
211    pub fn CVOpenGLTextureCacheCreate(
212        allocator: Option<&CFAllocator>,
213        cache_attributes: Option<&CFDictionary>,
214        cgl_context: CGLContextObj,
215        cgl_pixel_format: CGLPixelFormatObj,
216        texture_attributes: Option<&CFDictionary>,
217        cache_out: NonNull<*mut CVOpenGLTextureCache>,
218    ) -> CVReturn;
219}
220
221extern "C-unwind" {
222    #[cfg(all(
223        feature = "CVBuffer",
224        feature = "CVImageBuffer",
225        feature = "CVOpenGLTexture",
226        feature = "CVReturn"
227    ))]
228    #[deprecated = "renamed to `CVOpenGLTextureCache::create_texture_from_image`"]
229    pub fn CVOpenGLTextureCacheCreateTextureFromImage(
230        allocator: Option<&CFAllocator>,
231        texture_cache: &CVOpenGLTextureCache,
232        source_image: &CVImageBuffer,
233        attributes: Option<&CFDictionary>,
234        texture_out: NonNull<*mut CVOpenGLTexture>,
235    ) -> CVReturn;
236}
237
238#[cfg(feature = "CVBase")]
239#[deprecated = "renamed to `CVOpenGLTextureCache::flush`"]
240#[inline]
241pub extern "C-unwind" fn CVOpenGLTextureCacheFlush(
242    texture_cache: &CVOpenGLTextureCache,
243    options: CVOptionFlags,
244) {
245    extern "C-unwind" {
246        fn CVOpenGLTextureCacheFlush(texture_cache: &CVOpenGLTextureCache, options: CVOptionFlags);
247    }
248    unsafe { CVOpenGLTextureCacheFlush(texture_cache, options) }
249}