CVPixelBufferCreateWithIOSurface

Function CVPixelBufferCreateWithIOSurface 

Source
pub unsafe extern "C-unwind" fn CVPixelBufferCreateWithIOSurface(
    allocator: Option<&CFAllocator>,
    surface: &IOSurfaceRef,
    pixel_buffer_attributes: Option<&CFDictionary>,
    pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
) -> CVReturn
Available on crate feature CVBuffer and crate feature CVImageBuffer and crate feature CVPixelBuffer and crate feature CVPixelBufferIOSurface and crate feature CVReturn and crate feature objc2-io-surface and non-watchOS only.
Expand description

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.