CVPixelBufferCreateWithPlanarBytes

Function CVPixelBufferCreateWithPlanarBytes 

Source
pub unsafe extern "C-unwind" fn CVPixelBufferCreateWithPlanarBytes(
    allocator: Option<&CFAllocator>,
    width: usize,
    height: usize,
    pixel_format_type: u32,
    data_ptr: *mut c_void,
    data_size: usize,
    number_of_planes: usize,
    plane_base_address: NonNull<*mut c_void>,
    plane_width: NonNull<usize>,
    plane_height: NonNull<usize>,
    plane_bytes_per_row: NonNull<usize>,
    release_callback: CVPixelBufferReleasePlanarBytesCallback,
    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 CVPixelBuffer and CVReturn only.
Expand description

Call to create a single PixelBuffer in planar format 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 dataPtr: Pass a pointer to a plane descriptor block, or NULL.

Parameter dataSize: pass size if planes are contiguous, NULL if not.

Parameter numberOfPlanes: Number of planes.

Parameter planeBaseAddress: Array of base addresses for the planes.

Parameter planeWidth: Array of plane widths.

Parameter planeHeight: Array of plane heights.

Parameter planeBytesPerRow: Array of plane bytesPerRow values.

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.

ยงSafety

  • data_ptr must be a valid pointer or null.
  • plane_base_address must be a valid pointer.
  • plane_width must be a valid pointer.
  • plane_height must be a valid pointer.
  • plane_bytes_per_row must be a valid pointer.
  • release_callback must be implemented correctly.
  • release_ref_con must be a valid pointer or null.
  • pixel_buffer_attributes generics must be of the correct type.
  • pixel_buffer_out must be a valid pointer.