use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
use objc2_open_gl::*;
use crate::*;
#[doc(alias = "CVOpenGLTextureCacheRef")]
#[repr(C)]
pub struct CVOpenGLTextureCache {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl CVOpenGLTextureCache {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__CVOpenGLTextureCache"> for CVOpenGLTextureCache {}
);
extern "C" {
#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
pub static kCVOpenGLTextureCacheChromaSamplingModeKey: &'static CFString;
}
extern "C" {
#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
pub static kCVOpenGLTextureCacheChromaSamplingModeAutomatic: &'static CFString;
}
extern "C" {
#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
pub static kCVOpenGLTextureCacheChromaSamplingModeHighestQuality: &'static CFString;
}
extern "C" {
#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
pub static kCVOpenGLTextureCacheChromaSamplingModeBestPerformance: &'static CFString;
}
unsafe impl ConcreteType for CVOpenGLTextureCache {
#[doc(alias = "CVOpenGLTextureCacheGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn CVOpenGLTextureCacheGetTypeID() -> CFTypeID;
}
unsafe { CVOpenGLTextureCacheGetTypeID() }
}
}
impl CVOpenGLTextureCache {
#[doc(alias = "CVOpenGLTextureCacheCreate")]
#[cfg(all(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)"]
#[inline]
pub unsafe fn create(
allocator: Option<&CFAllocator>,
cache_attributes: Option<&CFDictionary>,
cgl_context: CGLContextObj,
cgl_pixel_format: CGLPixelFormatObj,
texture_attributes: Option<&CFDictionary>,
cache_out: NonNull<*mut CVOpenGLTextureCache>,
) -> CVReturn {
extern "C-unwind" {
fn CVOpenGLTextureCacheCreate(
allocator: Option<&CFAllocator>,
cache_attributes: Option<&CFDictionary>,
cgl_context: CGLContextObj,
cgl_pixel_format: CGLPixelFormatObj,
texture_attributes: Option<&CFDictionary>,
cache_out: NonNull<*mut CVOpenGLTextureCache>,
) -> CVReturn;
}
unsafe {
CVOpenGLTextureCacheCreate(
allocator,
cache_attributes,
cgl_context,
cgl_pixel_format,
texture_attributes,
cache_out,
)
}
}
#[doc(alias = "CVOpenGLTextureCacheCreateTextureFromImage")]
#[cfg(all(
feature = "CVBuffer",
feature = "CVImageBuffer",
feature = "CVOpenGLTexture",
feature = "CVReturn"
))]
#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
#[inline]
pub unsafe fn create_texture_from_image(
allocator: Option<&CFAllocator>,
texture_cache: &CVOpenGLTextureCache,
source_image: &CVImageBuffer,
attributes: Option<&CFDictionary>,
texture_out: NonNull<*mut CVOpenGLTexture>,
) -> CVReturn {
extern "C-unwind" {
fn CVOpenGLTextureCacheCreateTextureFromImage(
allocator: Option<&CFAllocator>,
texture_cache: &CVOpenGLTextureCache,
source_image: &CVImageBuffer,
attributes: Option<&CFDictionary>,
texture_out: NonNull<*mut CVOpenGLTexture>,
) -> CVReturn;
}
unsafe {
CVOpenGLTextureCacheCreateTextureFromImage(
allocator,
texture_cache,
source_image,
attributes,
texture_out,
)
}
}
#[doc(alias = "CVOpenGLTextureCacheFlush")]
#[cfg(feature = "CVBase")]
#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
#[inline]
pub fn flush(&self, options: CVOptionFlags) {
extern "C-unwind" {
fn CVOpenGLTextureCacheFlush(
texture_cache: &CVOpenGLTextureCache,
options: CVOptionFlags,
);
}
unsafe { CVOpenGLTextureCacheFlush(self, options) }
}
}
extern "C-unwind" {
#[cfg(all(feature = "CVReturn", feature = "objc2-open-gl"))]
#[cfg(target_os = "macos")]
#[deprecated = "renamed to `CVOpenGLTextureCache::create`"]
pub fn CVOpenGLTextureCacheCreate(
allocator: Option<&CFAllocator>,
cache_attributes: Option<&CFDictionary>,
cgl_context: CGLContextObj,
cgl_pixel_format: CGLPixelFormatObj,
texture_attributes: Option<&CFDictionary>,
cache_out: NonNull<*mut CVOpenGLTextureCache>,
) -> CVReturn;
}
extern "C-unwind" {
#[cfg(all(
feature = "CVBuffer",
feature = "CVImageBuffer",
feature = "CVOpenGLTexture",
feature = "CVReturn"
))]
#[deprecated = "renamed to `CVOpenGLTextureCache::create_texture_from_image`"]
pub fn CVOpenGLTextureCacheCreateTextureFromImage(
allocator: Option<&CFAllocator>,
texture_cache: &CVOpenGLTextureCache,
source_image: &CVImageBuffer,
attributes: Option<&CFDictionary>,
texture_out: NonNull<*mut CVOpenGLTexture>,
) -> CVReturn;
}
#[cfg(feature = "CVBase")]
#[deprecated = "renamed to `CVOpenGLTextureCache::flush`"]
#[inline]
pub extern "C-unwind" fn CVOpenGLTextureCacheFlush(
texture_cache: &CVOpenGLTextureCache,
options: CVOptionFlags,
) {
extern "C-unwind" {
fn CVOpenGLTextureCacheFlush(texture_cache: &CVOpenGLTextureCache, options: CVOptionFlags);
}
unsafe { CVOpenGLTextureCacheFlush(texture_cache, options) }
}