Function CVPixelBufferCreateWithBytes

Source
pub unsafe extern "C-unwind" fn CVPixelBufferCreateWithBytes(
    allocator: Option<&CFAllocator>,
    width: usize,
    height: usize,
    pixel_format_type: u32,
    base_address: NonNull<c_void>,
    bytes_per_row: usize,
    release_callback: CVPixelBufferReleaseBytesCallback,
    release_ref_con: *mut c_void,
    pixel_buffer_attributes: Option<&CFDictionary>,
    pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
) -> CVReturn
Available on crate features CVBuffer and CVImageBuffer and CVReturn and CVPixelBuffer only.
Expand description

Call to create a single PixelBuffer for a given size and pixelFormatType based on a passed in piece of memory.

Creates a single PixelBuffer for a given size and pixelFormatType. Not all parameters of the pixelBufferAttributes will be used here. It requires a release callback function that will be called, when the PixelBuffer gets destroyed so that the owner of the pixels can free the memory.

Parameter width: Width of the PixelBuffer in pixels

Parameter height: Height of the PixelBuffer in pixels

Parameter pixelFormatType: Pixel format indentified by its respective OSType.

Parameter baseAddress: Address of the memory storing the pixels.

Parameter bytesPerRow: Row bytes of the pixel storage memory.

Parameter releaseCallback: CVPixelBufferReleaseBytePointerCallback function that gets called when the PixelBuffer gets destroyed.

Parameter releaseRefCon: User data identifying the PixelBuffer for the release callback.

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.