pub struct CVPixelBufferPool(/* private fields */);Expand description
Opaque handle to CVPixelBufferPool
Implementations§
Source§impl CVPixelBufferPool
impl CVPixelBufferPool
pub fn from_raw(ptr: *mut c_void) -> Option<Self>
Sourcepub unsafe fn from_ptr(ptr: *mut c_void) -> Self
pub unsafe fn from_ptr(ptr: *mut c_void) -> Self
§Safety
The caller must ensure the pointer is a valid CVPixelBufferPool pointer.
pub fn as_ptr(&self) -> *mut c_void
Sourcepub fn create(
width: usize,
height: usize,
pixel_format: u32,
max_buffers: usize,
) -> Result<Self, i32>
pub fn create( width: usize, height: usize, pixel_format: u32, max_buffers: usize, ) -> Result<Self, i32>
Create a new pixel buffer pool
§Arguments
width- Width of pixel buffers in the poolheight- Height of pixel buffers in the poolpixel_format- Pixel format typemax_buffers- Maximum number of buffers in the pool (0 for unlimited)
§Errors
Returns a Core Video error code if the pool creation fails.
Sourcepub fn create_pixel_buffer(&self) -> Result<CVPixelBuffer, i32>
pub fn create_pixel_buffer(&self) -> Result<CVPixelBuffer, i32>
Create a pixel buffer from the pool
§Errors
Returns a Core Video error code if the buffer creation fails.
Sourcepub fn flush(&self)
pub fn flush(&self)
Flush the pixel buffer pool
Releases all available pixel buffers in the pool
Sourcepub fn get_type_id() -> usize
pub fn get_type_id() -> usize
Get the Core Foundation type ID for CVPixelBufferPool
Sourcepub fn create_pixel_buffer_with_aux_attributes(
&self,
aux_attributes: Option<&HashMap<String, u32>>,
) -> Result<CVPixelBuffer, i32>
pub fn create_pixel_buffer_with_aux_attributes( &self, aux_attributes: Option<&HashMap<String, u32>>, ) -> Result<CVPixelBuffer, i32>
Create a pixel buffer from the pool with auxiliary attributes
This allows specifying additional attributes for the created buffer
§Errors
Returns a Core Video error code if the buffer creation fails.
Sourcepub fn try_create_pixel_buffer(&self) -> Option<CVPixelBuffer>
pub fn try_create_pixel_buffer(&self) -> Option<CVPixelBuffer>
Try to create a pixel buffer from the pool without blocking
Returns None if no buffers are available
Sourcepub fn flush_with_options(&self, _flags: u32)
pub fn flush_with_options(&self, _flags: u32)
Flush the pool with specific options
Releases buffers based on the provided flags
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if the pool is empty (no available buffers)
Note: This is an approximation based on whether we can create a buffer
Sourcepub fn get_attributes(&self) -> Option<*const c_void>
pub fn get_attributes(&self) -> Option<*const c_void>
Get the pool attributes
Returns the raw pointer to the CFDictionary containing pool attributes
Sourcepub fn get_pixel_buffer_attributes(&self) -> Option<*const c_void>
pub fn get_pixel_buffer_attributes(&self) -> Option<*const c_void>
Get the pixel buffer attributes
Returns the raw pointer to the CFDictionary containing pixel buffer attributes