Struct CVPixelBufferPool
pub struct CVPixelBufferPool { /* private fields */ }Expand description
Opaque handle to a native CVPixelBufferPoolRef.
Implementations§
§impl CVPixelBufferPool
impl CVPixelBufferPool
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<CVPixelBufferPool>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<CVPixelBufferPool>
Adopts a +1 retained native pool with no wrapper allocation threshold.
§Safety
A non-null ptr must be a live CVPixelBufferPoolRef carrying one
retain transferred to this wrapper. The caller must not release or
separately adopt that transferred retain.
pub unsafe fn from_raw_with_max_buffers(
ptr: *mut c_void,
max_buffers: usize,
) -> Result<Option<CVPixelBufferPool>, i32>
pub unsafe fn from_raw_with_max_buffers( ptr: *mut c_void, max_buffers: usize, ) -> Result<Option<CVPixelBufferPool>, i32>
Adopts a +1 retained native pool and applies max_buffers to wrapper allocations.
A zero threshold means unlimited. Native callers using Self::as_ptr
can bypass this wrapper policy.
§Safety
A non-null ptr must be a live CVPixelBufferPoolRef carrying one
retain transferred to this wrapper. On an error, ownership remains with
the caller.
§Errors
Returns paramErr if max_buffers cannot be represented by Core Video.
pub unsafe fn from_raw_borrowed(ptr: *mut c_void) -> Option<CVPixelBufferPool>
pub unsafe fn from_raw_borrowed(ptr: *mut c_void) -> Option<CVPixelBufferPool>
Retains a +0 borrowed native pool with no wrapper allocation threshold.
§Safety
A non-null ptr must be a live CVPixelBufferPoolRef for the duration
of the retain call.
pub unsafe fn from_raw_borrowed_with_max_buffers(
ptr: *mut c_void,
max_buffers: usize,
) -> Result<Option<CVPixelBufferPool>, i32>
pub unsafe fn from_raw_borrowed_with_max_buffers( ptr: *mut c_void, max_buffers: usize, ) -> Result<Option<CVPixelBufferPool>, i32>
pub unsafe fn from_ptr(ptr: *mut c_void) -> CVPixelBufferPool
pub unsafe fn from_ptr(ptr: *mut c_void) -> CVPixelBufferPool
Wraps a raw CVPixelBufferPoolRef by taking ownership without retaining it.
§Safety
ptr must be a non-null, live CVPixelBufferPoolRef carrying one retain
transferred to this wrapper.
pub const fn as_ptr(&self) -> *mut c_void
pub const fn as_ptr(&self) -> *mut c_void
Borrows the raw +0 native pool pointer while self remains alive.
Allocations performed directly through this pointer bypass the wrapper’s
configured Self::max_buffers threshold.
pub fn max_buffers(&self) -> usize
pub fn max_buffers(&self) -> usize
Wrapper-enforced allocation threshold, or zero when unlimited.
pub fn create(
width: usize,
height: usize,
pixel_format: u32,
max_buffers: usize,
) -> Result<CVPixelBufferPool, i32>
pub fn create( width: usize, height: usize, pixel_format: u32, max_buffers: usize, ) -> Result<CVPixelBufferPool, 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.
pub fn create_pixel_buffer(&self) -> Result<CVPixelBuffer, i32>
pub fn create_pixel_buffer(&self) -> Result<CVPixelBuffer, i32>
Create a pixel buffer while enforcing the configured allocation threshold.
§Errors
Returns a Core Video error code if the buffer creation fails.
pub fn flush(&self)
pub fn flush(&self)
Flush buffers that have aged out of the pool.
pub fn flush_with_flags(&self, flags: CVPixelBufferPoolFlushFlags)
pub fn flush_with_flags(&self, flags: CVPixelBufferPoolFlushFlags)
Flush unused buffers according to native Core Video flags.
pub fn flush_excess_buffers(&self)
pub fn flush_excess_buffers(&self)
Flush every unused buffer regardless of age.
pub 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 per-call auxiliary attributes.
String keys become CFString keys and values become CFNumber values.
A per-call allocation threshold can tighten but not loosen the
threshold configured when the wrapper was created.
§Errors
Returns paramErr for an attribute key containing a NUL byte or an
unrepresentable threshold, otherwise returns the Core Video allocation
status.
pub fn try_create_pixel_buffer(&self) -> Result<Option<CVPixelBuffer>, i32>
pub fn try_create_pixel_buffer(&self) -> Result<Option<CVPixelBuffer>, i32>
Try to create a pixel buffer without exceeding the allocation threshold.
Only kCVReturnWouldExceedAllocationThreshold maps to Ok(None);
every other Core Video error is preserved.
§Errors
Returns any Core Video allocation error other than threshold exhaustion.
pub fn attributes(&self) -> Option<CFDictionary>
pub fn attributes(&self) -> Option<CFDictionary>
Copy the pool attributes into an independently owned dictionary.
pub fn pixel_buffer_attributes(&self) -> Option<CFDictionary>
pub fn pixel_buffer_attributes(&self) -> Option<CFDictionary>
Copy the pixel-buffer attributes into an independently owned dictionary.
Trait Implementations§
§impl Clone for CVPixelBufferPool
impl Clone for CVPixelBufferPool
§fn clone(&self) -> CVPixelBufferPool
fn clone(&self) -> CVPixelBufferPool
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CVPixelBufferPool
impl Debug for CVPixelBufferPool
§impl Display for CVPixelBufferPool
impl Display for CVPixelBufferPool
§impl Drop for CVPixelBufferPool
impl Drop for CVPixelBufferPool
impl Eq for CVPixelBufferPool
§impl Hash for CVPixelBufferPool
impl Hash for CVPixelBufferPool
§impl PartialEq for CVPixelBufferPool
impl PartialEq for CVPixelBufferPool
§fn eq(&self, other: &CVPixelBufferPool) -> bool
fn eq(&self, other: &CVPixelBufferPool) -> bool
self and other values to be equal, and is used by ==.