1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! 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-io-surface")]
#[cfg(not(target_os = "watchos"))]
use objc2_io_surface::*;
use crate::*;
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfaceopengltexturecompatibilitykey?language=objc)
pub static kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey: &'static CFString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfaceopenglfbocompatibilitykey?language=objc)
pub static kCVPixelBufferIOSurfaceOpenGLFBOCompatibilityKey: &'static CFString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfacecoreanimationcompatibilitykey?language=objc)
pub static kCVPixelBufferIOSurfaceCoreAnimationCompatibilityKey: &'static CFString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfaceopenglestexturecompatibilitykey?language=objc)
pub static kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey: &'static CFString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfaceopenglesfbocompatibilitykey?language=objc)
pub static kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey: &'static CFString;
}
/// Returns the IOSurface backing the pixel buffer, or NULL if it is not backed by an IOSurface.
///
/// Parameter `pixelBuffer`: Target PixelBuffer.
#[cfg(all(
feature = "CVBuffer",
feature = "CVImageBuffer",
feature = "CVPixelBuffer",
feature = "objc2-io-surface"
))]
#[cfg(not(target_os = "watchos"))]
#[inline]
pub extern "C-unwind" fn CVPixelBufferGetIOSurface(
pixel_buffer: Option<&CVPixelBuffer>,
) -> Option<CFRetained<IOSurfaceRef>> {
extern "C-unwind" {
fn CVPixelBufferGetIOSurface(
pixel_buffer: Option<&CVPixelBuffer>,
) -> Option<NonNull<IOSurfaceRef>>;
}
let ret = unsafe { CVPixelBufferGetIOSurface(pixel_buffer) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
extern "C-unwind" {
/// Call to create a single CVPixelBuffer for a passed-in IOSurface.
///
/// The CVPixelBuffer will retain the IOSurface.
/// IMPORTANT NOTE: If you are using IOSurface to share CVPixelBuffers between processes
/// and those CVPixelBuffers are allocated via a CVPixelBufferPool, it is important
/// that the CVPixelBufferPool does not reuse CVPixelBuffers whose IOSurfaces are still
/// in use in other processes.
/// CoreVideo and IOSurface will take care of this for if you use IOSurfaceCreateMachPort
/// and IOSurfaceLookupFromMachPort, but NOT if you pass IOSurfaceIDs.
///
/// Parameter `surface`: The IOSurface to wrap.
///
/// Parameter `pixelBufferAttributes`: A dictionary with additional attributes for a a pixel buffer. This parameter is optional. See PixelBufferAttributes for more details.
///
/// Parameter `pixelBufferOut`: The new pixel buffer will be returned here
///
/// Returns: returns kCVReturnSuccess on success.
///
/// # Safety
///
/// - `pixel_buffer_attributes` generics must be of the correct type.
/// - `pixel_buffer_out` must be a valid pointer.
#[cfg(all(
feature = "CVBuffer",
feature = "CVImageBuffer",
feature = "CVPixelBuffer",
feature = "CVReturn",
feature = "objc2-io-surface"
))]
#[cfg(not(target_os = "watchos"))]
pub fn CVPixelBufferCreateWithIOSurface(
allocator: Option<&CFAllocator>,
surface: &IOSurfaceRef,
pixel_buffer_attributes: Option<&CFDictionary>,
pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
) -> CVReturn;
}