Function

CVPixelBufferCreateWithPlanarBytes(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)

Creates a single pixel buffer in planar format for a given size and pixel format containing data specified by a memory location.

Declaration

func CVPixelBufferCreateWithPlanarBytes(_ allocator: CFAllocator?, _ width: Int, _ height: Int, _ pixelFormatType: OSType, _ dataPtr: UnsafeMutableRawPointer?, _ dataSize: Int, _ numberOfPlanes: Int, _ planeBaseAddress: UnsafeMutablePointer<UnsafeMutableRawPointer?>, _ planeWidth: UnsafeMutablePointer<Int>, _ planeHeight: UnsafeMutablePointer<Int>, _ planeBytesPerRow: UnsafeMutablePointer<Int>, _ releaseCallback: CVPixelBufferReleasePlanarBytesCallback?, _ releaseRefCon: UnsafeMutableRawPointer?, _ pixelBufferAttributes: CFDictionary?, _ pixelBufferOut: UnsafeMutablePointer<CVPixelBuffer?>) -> CVReturn

Parameters

allocator

The allocator to use to create this buffer. Pass NULL to specify the default allocator.

width

The width of the pixel buffer, in pixels.

height

The height of the pixel buffer, in pixels.

pixelFormatType

The pixel format identified by its respective four-character code (type OSType).

dataPtr

A pointer to a plane descriptor block if applicable, or NULL if it is not.

dataSize

The size of the memory if the planes are contiguous, or NULL if it is not.

numberOfPlanes

The number of planes.

planeBaseAddress

The array of base addresses for the planes.

planeWidth

The array of plane widths.

planeHeight

The array of plane heights.

planeBytesPerRow

The array of plane bytes-per-row values.

releaseCallback

The callback function that gets called when the pixel buffer is destroyed. This callback allows the owner of the pixels to free the memory. See CVPixelBufferReleaseBytesCallback for more information.

releaseRefCon

A pointer to user data identifying the pixel buffer. This value is passed to your pixel buffer release callback.

pixelBufferAttributes

A dictionary with additional attributes for a a pixel buffer. This parameter is optional. See Pixel Buffer Attribute Keys for more details.

pixelBufferOut

On output, the newly created pixel buffer. Ownership follows the The Create Rule.

Return Value

A Core Video result code. See Core Video Constants for possible values.

Discussion

Some of the parameters specified in this call override equivalent pixel buffer attributes. For example, if you define the kCVPixelBufferWidth and kCVPixelBufferHeight keys in the pixel buffer attributes parameter (pixelBufferAttributes), these values are overridden by the width and height parameters.