CVPixelBuffer Reference

Derived from
Framework
System/Library/Frameworks/CoreVideo.framework
Companion guide
Core Video Programming Guide
Declared in
CVPixelBuffer.h

Overview

A Core Video pixel buffer is an image buffer that holds pixels in main memory. Applications generating frames, compressing or decompressing video, or using Core Image can all make use of Core Video pixel buffers.

Functions

CVPixelBufferCreate

Creates a single pixel buffer for a given size and pixel format.

CVReturn CVPixelBufferCreate (
   CFAllocatorRef allocator,
   size_t width,
   size_t height,
   OSType pixelFormatType,
   CFDictionaryRef pixelBufferAttributes,
   CVPixelBufferRef *pixelBufferOut
);
Parameters
allocator

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

width

Width of the pixel buffer, in pixels.

height

Height of the pixel buffer, in pixels.

pixelFormatType

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

pixelBufferAttributes

A dictionary with additional attributes for 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” in Memory Management Programming Guide for Core Foundation.

Return Value

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

Discussion

This function allocates the necessary memory based on the pixel dimensions, format, and extended pixels described in the pixel buffer’s attributes.

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.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferCreateResolvedAttributesDictionary

Resolves an array of CFDictionary objects describing various pixel buffer attributes into a single dictionary.

CVReturn CVPixelBufferCreateResolvedAttributesDictionary (
   CFAllocatorRef allocator,
   CFArrayRef attributes,
   CFDictionaryRef *resolvedDictionaryOut
);
Parameters
allocator

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

attributes

An array of Core Foundation dictionaries containing pixel buffer attribute key-value pairs.

resolvedDictionaryOut

On output, the consolidated dictionary. Ownership follows the “The Create Rule” in Memory Management Programming Guide for Core Foundation.

Return Value

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

Discussion

This call is useful when you need to resolve requirements between several potential clients of a buffer.

If two or more dictionaries contain the same key but different values, this function adjusts values where possible so that the output dictionary contains a mutually compatible set of values. For example, if the attributes parameter contains dictionaries whose bytes-per-row attributes differ, the rowBytes value in the output dictionary is the least common multiple of the input values.

Some mismatched attributes cannot be resolved. Calling this function results in an error if the widths, heights, pixel format allocators, or callbacks in the input dictionaries do not match.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferCreateWithBytes

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

CVReturn CVPixelBufferCreateWithBytes (
   CFAllocatorRef allocator,
   size_t width,
   size_t height,
   OSType pixelFormatType,
   void *baseAddress,
   size_t bytesPerRow,
   CVPixelBufferReleaseBytesCallback releaseCallback,
   void *releaseRefCon,
   CFDictionaryRef pixelBufferAttributes,
   CVPixelBufferRef *pixelBufferOut
);
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).

baseAddress

A pointer to the base address of the memory storing the pixels.

bytesPerRow

The row bytes of the pixel storage memory.

releaseCallback

The callback function to be 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

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

pixelBufferAttributes

A Core Foundation 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” in Memory Management Programming Guide for Core Foundation.

Return Value

A Core Video result code. See Core Video Constants Reference 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.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferCreateWithPlanarBytes

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

CVReturn CVPixelBufferCreateWithPlanarBytes (
   CFAllocatorRef allocator,
   size_t width,
   size_t height,
   OSType pixelFormatType,
   void *dataPtr,
   size_t dataSize,
   size_t numberOfPlanes,
   void *planeBaseAddress[],
   size_t planeWidth[],
   size_t planeHeight[],
   size_t planeBytesPerRow[],
   CVPixelBufferReleasePlanarBytesCallback releaseCallback,
   void *releaseRefCon,
   CFDictionaryRef pixelBufferAttributes,
   CVPixelBufferRef *pixelBufferOut
);
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” in Memory Management Programming Guide for Core Foundation.

Return Value

A Core Video result code. See Core Video Constants Reference 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.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferFillExtendedPixels

Fills the extended pixels of the pixel buffer.

CVReturn CVPixelBufferFillExtendedPixels (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose extended pixels you want to fill.

Return Value

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

Discussion

This function replicates edge pixels to fill the entire extended region of the image.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetBaseAddress

Returns the base address of the pixel buffer.

void * CVPixelBufferGetBaseAddress (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose base address you want to obtain.

Return Value

The base address of the pixel buffer.

Discussion

The pointer returned by this function depends on the type of buffer and the conditions under which it was created.

  • For chunky buffers, returns a pointer to the pixel at (0,0) in the buffer.

  • For planar buffers, returns a pointer to a CVPlanarComponentInfo structure, or NULL if no such structure is present.

Because this function returns NULL for some planar buffers, you should call CVPixelBufferGetBaseAddressOfPlane and CVPixelBufferGetBytesPerRowOfPlane to get information about a planar buffer.

Retrieving the base address for a pixel buffer requires that the buffer base address be locked using the CVPixelBufferLockBaseAddress function.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CVPixelBuffer.h

CVPixelBufferGetBaseAddressOfPlane

Returns the base address of the plane at the specified plane index.

void * CVPixelBufferGetBaseAddressOfPlane (
   CVPixelBufferRef pixelBuffer,
   size_t planeIndex
);
Parameters
pixelBuffer

The pixel buffer containing the plane whose base address you want to obtain.

planeIndex

The index of the plane.

Return Value

The base address of the plane, or NULL for nonplanar pixel buffers.

Discussion

Retrieving the base address for a pixel buffer requires that the buffer base address be locked locked using the CVPixelBufferLockBaseAddress function.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetBytesPerRow

Returns the number of bytes per row of the pixel buffer.

size_t CVPixelBufferGetBytesPerRow (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose bytes-per-row value you want to obtain.

Return Value

The number of bytes per row of the image data. For planar buffers, this function returns a rowBytes value such that bytesPerRow * height covers the entire image, including all planes.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CVPixelBuffer.h

CVPixelBufferGetBytesPerRowOfPlane

Returns the number of bytes per row for a plane at the specified index in the pixel buffer.

size_t CVPixelBufferGetBytesPerRowOfPlane (
   CVPixelBufferRef pixelBuffer,
   size_t planeIndex
);
Parameters
pixelBuffer

The pixel buffer containing the plane.

planeIndex

The index of the plane whose bytes-per-row value you want to obtain.

Return Value

The number of row bytes of the plane, or NULL for nonplanar pixel buffers.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetDataSize

Returns the data size for contiguous planes of the pixel buffer.

size_t CVPixelBufferGetDataSize (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose data size you want to obtain.

Return Value

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

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetExtendedPixels

Returns the amount of extended pixel padding in the pixel buffer.

void CVPixelBufferGetExtendedPixels (
   CVPixelBufferRef pixelBuffer,
   size_t *extraColumnsOnLeft,
   size_t *extraColumnsOnRight,
   size_t *extraRowsOnTop,
   size_t *extraRowsOnBottom
);
Parameters
pixelBuffer

The pixel buffer whose extended pixel size you want to obtain.

extraColumnsOnLeft

On output, the pixel row padding to the left. Pass NULL if you do not want this information.

extraColumnsOnRight

On output, the pixel row padding to the right. Pass NULL if you do not want this information.

extraRowsOnTop

On output, the pixel row padding to the top. Pass NULL if you do not want this information.

extraRowsOnBottom

On output, the pixel row padding to the bottom. Pass NULL if you do not want this information.

Discussion

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetHeight

Returns the height of the pixel buffer.

size_t CVPixelBufferGetHeight (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose height you want to obtain.

Return Value

The buffer height, in pixels.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetHeightOfPlane

Returns the height of the plane at planeIndex in the pixel buffer.

size_t CVPixelBufferGetHeightOfPlane (
   CVPixelBufferRef pixelBuffer,
   size_t planeIndex
);
Parameters
pixelBuffer

The pixel buffer whose plane height you want to obtain.

planeIndex

The index of the plane.

Return Value

The height of the buffer, in pixels, or 0 for nonplanar pixel buffers.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetPixelFormatType

Returns the pixel format type of the pixel buffer.

OSType CVPixelBufferGetPixelFormatType (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose format type you want to obtain.

Return Value

A four-character code OSType identifier for the pixel format.

Discussion

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CVPixelBuffer.h

CVPixelBufferGetPlaneCount

Returns number of planes of the pixel buffer.

size_t CVPixelBufferGetPlaneCount (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose plane count you want to obtain.

Return Value

The number of planes. Returns 0 for nonplanar pixel buffers.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetTypeID

Returns the Core Foundation type identifier of the pixel buffer type.

CFTypeID CVPixelBufferGetTypeID (
   void
);
Return Value

The Core Foundation type identifier for this type.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetWidth

Returns the width of the pixel buffer.

size_t CVPixelBufferGetWidth (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer whose width you want to obtain.

Return Value

The width of the buffer, in pixels.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferGetWidthOfPlane

Returns the width of the plane at a given index in the pixel buffer.

size_t CVPixelBufferGetWidthOfPlane (
   CVPixelBufferRef pixelBuffer,
   size_t planeIndex
);
Parameters
pixelBuffer

The pixel buffer whose plane width you want to obtain.

planeIndex

The plane index that contains the plane’s width value.

Return Value

The width of the plane, in pixels, or 0 for nonplanar pixel buffers.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferIsPlanar

Determines whether the pixel buffer is planar.

Boolean CVPixelBufferIsPlanar (
   CVPixelBufferRef pixelBuffer
);
Parameters
pixelBuffer

The pixel buffer to check.

Return Value

true if the pixel buffer is planar; otherwise, false.

Discussion

Planar buffers can be created using the CVPixelBufferCreateWithPlanarBytes function.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferLockBaseAddress

Locks the base address of the pixel buffer.

CVReturn CVPixelBufferLockBaseAddress (
   CVPixelBufferRef pixelBuffer,
   CVOptionFlags lockFlags
);
Parameters
pixelBuffer

The pixel buffer whose base address you want to lock.

lockFlags

Either kCVPixelBufferLock_ReadOnly or 0; see Pixel Buffer Locking Flags for discussion.

Return Value

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

Discussion

You must call the CVPixelBufferLockBaseAddress function before accessing pixel data with the CPU, and call the CVPixelBufferUnlockBaseAddress function afterward. If you include the kCVPixelBufferLock_ReadOnly value in the lockFlags parameter when locking the buffer, you must also include it when unlocking the buffer.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CVPixelBuffer.h

CVPixelBufferRelease

Releases a pixel buffer.

void CVPixelBufferRelease (
   CVPixelBufferRef buffer
);
Parameters
buffer

The pixel buffer that you want to release.

Discussion

This function is equivalent to CFRelease, but is NULL safe.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CVPixelBuffer.h

CVPixelBufferRetain

Retains a pixel buffer.

CVPixelBufferRef CVPixelBufferRetain (
   CVPixelBufferRef buffer
);
Parameters
buffer

The pixel buffer that you want to retain.

Return Value

For convenience, the same pixel buffer you want to retain.

Discussion

This function is equivalent to CFRetain, but is NULL safe.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CVPixelBuffer.h

CVPixelBufferUnlockBaseAddress

Unlocks the base address of the pixel buffer.

CVReturn CVPixelBufferUnlockBaseAddress (
   CVPixelBufferRef pixelBuffer,
   CVOptionFlags unlockFlags
);
Parameters
pixelBuffer

The pixel buffer whose base address you want to unlock.

unlockFlags

Either kCVPixelBufferLock_ReadOnly or 0; see Pixel Buffer Locking Flags for discussion.

Return Value

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

Discussion

You must call the CVPixelBufferLockBaseAddress function before accessing pixel data with the CPU, and call the CVPixelBufferUnlockBaseAddress function afterward. If you include the kCVPixelBufferLock_ReadOnly value in the lockFlags parameter when locking the buffer, you must also include it when unlocking the buffer.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CVPixelBuffer.h

Callbacks

CVPixelBufferReleaseBytesCallback

Defines a pointer to a pixel buffer release callback function, which is called when a pixel buffer created by CVPixelBufferCreateWithBytes is released.

typedef void (*CVPixelBufferReleaseBytesCallback)(
   void *releaseRefCon,
   const void *baseAddress
   );

You would declare a pixel buffer release callback named MyPixelBufferReleaseCallback like this:

void MyPixelBufferReleaseCallback(
   void *releaseRefCon,
   const void *baseAddress
   );

Parameters
releaseRefCon

A pointer to application-defined data. This pointer is the same as that passed in the releaseRefCon parameter of CVPixelBufferCreateWithBytes.

baseAddress

A pointer to the base address of the memory holding the pixels. This pointer is the same as that passed in the baseAddress parameter of CVPixelBufferCreateWithBytes.

Discussion

You use this callback to release the pixels and perform any other cleanup when a pixel buffer is released.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPixelBufferReleasePlanarBytesCallback

Defines a pointer to a pixel buffer release callback function, which is called when a pixel buffer created by CVPixelBufferCreateWithPlanarBytes is released.

typedef void (*CVPixelBufferReleasePlanarBytesCallback)(
   void *releaseRefCon,
   const void *dataPtr,
   size_t dataSize,
   size_t numberOfPlanes,
   const void *planeAddresses[]
   );

You would declare a callback named MyPixelBufferReleasePlanarBytes like this:

void MyPixelBufferReleasePlanarBytes)(
   void *releaseRefCon,
   const void *dataPtr,
   size_t dataSize,
   size_t numberOfPlanes,
   const void *planeAddresses[]
   );

Parameters
releaseRefCon

A pointer to application-defined data. This pointer is the same as that passed in the releaseRefCon parameter of CVPixelBufferCreateWithPlanarBytes.

dataPtr

A pointer to a plane descriptor block. This is the same pointer you passed to CVPixelBufferCreateWithPlanarBytes in the dataPtr parameter.

dataSize

The size value you passed to CVPixelBufferCreateWithPlanarBytes in the dataSize parameter.

numberOfPlanes

The number of planes value you passed to CVPixelBufferCreateWithPlanarBytes in the numberOfPlanes parameter.

planeAddresses

A pointer to the base plane address you passed to CVPixelBufferCreateWithPlanarBytes in the basePlaneAddress parameter.

Discussion

You use this callback to release the pixels and perform any other cleanup when a pixel buffer is released.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

Data Types

CVPixelBufferRef

A reference to a Core Video pixel buffer object.

typedef CVImageBufferRef CVPixelBufferRef;
Discussion

The pixel buffer stores an image in main memory.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPlanarComponentInfo

A structure for describing planar components.

struct CVPlanarComponentInfo {
   int32_t             offset;
   uint32_t            rowBytes;
};
typedef struct CVPlanarComponentInfo CVPlanarComponentInfo;
Fields
offset

The offset from the main base address to the base address of this plane. (big-endian)

rowBytes

The number of bytes per row of this plane. (big-endian)

Discussion

Depending on how they were created, planar pixel buffers may or may not have this descriptor at their base address. For this reason, you should use CVPixelBufferGetBaseAddressOfPlane and CVPixelBufferGetBytesPerRowOfPlane to get information about a planar pixel buffer.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPlanarPixelBufferInfo

A structure for describing planar buffers.

struct CVPlanarPixelBufferInfo {
   CVPlanarComponentInfo  componentInfo[1];
};
typedef struct CVPlanarPixelBufferInfo CVPlanarPixelBufferInfo;
Fields
componentInfo

An array containing a CVPlanarComponentInfo structure for each plane of the buffer.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPlanarPixelBufferInfo_YCbCrPlanar

A structure for describing YCbCr planar buffers.

struct CVPlanarPixelBufferInfo_YCbCrPlanar {
   CVPlanarComponentInfo  componentInfoY;
   CVPlanarComponentInfo  componentInfoCb;
   CVPlanarComponentInfo  componentInfoCr;
};
typedef struct CVPlanarPixelBufferInfo_YCbCrPlanar CVPlanarPixelBufferInfo_YCbCrPlanar;
Fields
componentInfoY

A CVPlanarComponentInfo structure containing information on the Y component of the buffer.

componentInfoCb

A CVPlanarComponentInfo structure containing information on the Cb component of the buffer.

componentInfoCr

A CVPlanarComponentInfo structure containing information on the Cr component of the buffer.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

CVPlanarPixelBufferInfo_YCbCrBiPlanar

A structure for describing YCbCr biplanar buffers.

struct CVPlanarPixelBufferInfo_YCbCrBiPlanar {
   CVPlanarComponentInfo  componentInfoY;
   CVPlanarComponentInfo  componentInfoCbCr;
};
typedef struct CVPlanarPixelBufferInfo_YCbCrBiPlanar CVPlanarPixelBufferInfo_YCbCrBiPlanar;
Fields
componentInfoY

A CVPlanarComponentInfo structure containing information on the Y component of the buffer.

componentInfoCbCr

A CVPlanarComponentInfo structure containing information on the Cb/Cr component of the buffer.

Availability
  • Available in iOS 4.0 and later.
Declared In
CVPixelBuffer.h

Constants

Pixel Buffer Attribute Keys

The attributes associated with a pixel buffer.

const CFStringRef kCVPixelBufferPixelFormatTypeKey;
const CFStringRef kCVPixelBufferMemoryAllocatorKey;
const CFStringRef kCVPixelBufferWidthKey;
const CFStringRef kCVPixelBufferHeightKey;
const CFStringRef kCVPixelBufferExtendedPixelsLeftKey;
const CFStringRef kCVPixelBufferExtendedPixelsTopKey;
const CFStringRef kCVPixelBufferExtendedPixelsRightKey;
const CFStringRef kCVPixelBufferExtendedPixelsBottomKey;
const CFStringRef kCVPixelBufferBytesPerRowAlignmentKey;
const CFStringRef kCVPixelBufferCGBitmapContextCompatibilityKey;
const CFStringRef kCVPixelBufferCGImageCompatibilityKey;
const CFStringRef kCVPixelBufferOpenGLCompatibilityKey;
const CFStringRef kCVPixelBufferPlaneAlignmentKey;
const CFStringRef kCVPixelBufferIOSurfacePropertiesKey;
const CFStringRef kCVPixelBufferOpenGLESCompatibilityKey;
Constants
kCVPixelBufferPixelFormatTypeKey

One or more pixel format types used for this buffer. The value for this key may be a single CFNumber value or an array (CFArray) containing multiple CFNumber values.

For a list of common pixel formats, see Pixel Format Types.

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferMemoryAllocatorKey

The allocator used with this buffer (type CFAllocatorRef).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferWidthKey

The width of the pixel buffer (type CFNumber).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferHeightKey

The height of the pixel buffer (type CFNumber).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferExtendedPixelsLeftKey

The number of pixels padding the left of the image (type CFNumber).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferExtendedPixelsTopKey

The number of pixels padding the top of the image (type CFNumber).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferExtendedPixelsRightKey

The number of pixels padding the right of the image (type CFNumber).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferExtendedPixelsBottomKey

The number of pixels padding the bottom of the image (type CFNumber).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferBytesPerRowAlignmentKey

A number that specifies the alignment of number of bytes per row in the pixel buffer(type CFNumber).

The pixel buffer’s number of bytes per row must be a multiple of this number.

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferCGBitmapContextCompatibilityKey

A Boolean value that indicates whether the pixel buffer is compatible with Core Graphics bitmap contexts (type CFBoolean).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferCGImageCompatibilityKey

A Boolean value that indicates whether the pixel buffer is compatible with CGImage types (type CFBoolean).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferOpenGLCompatibilityKey

A Boolean value that indicates whether the pixel buffer is compatible with OpenGL contexts (type CFBoolean).

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferPlaneAlignmentKey

A number that specifies the alignment of the planes in the pixel buffer (type CFNumber).

Planes start on a byte number which is a multiple of this value.

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferIOSurfacePropertiesKey

A dictionary containing optional properties for use by the IOSurface framework (type CFDictionary).

Provide a value for this key if you want Core Video to use the IOSurface framework to allocate the pixel buffer. (See “IOSurface Framework Reference”.) Provide an empty dictionary to use default IOSurface options.

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.

kCVPixelBufferOpenGLESCompatibilityKey

A Boolean value that indicates whether the pixel buffer is compatible with OpenGL ES contexts (type CFBoolean).

Available in iOS 6.0 and later.

Declared in CVPixelBuffer.h.

Discussion

A pixel buffer attributes dictionary is a Core Foundation dictionary containing zero or more of these keys and appropriate values. Core Video functions such as CVPixelBufferCreate and CVPixelBufferPoolCreate accept pixel buffer attributes dictionaries to describe how to allocate pixel buffers for compatibility with client requirements. Where multiple CoreVideo clients seek to exchange pixel buffers, CVPixelBufferCreateResolvedAttributesDictionary can be used to find a common pixel buffer attributes dictionary that is compatible with all the clients' pixel buffer attributes dictionaries.

Pixel Buffer Locking Flags

The flags to pass to CVPixelBufferLockBaseAddress and CVPixelBufferUnlockBaseAddress.

enum CVPixelBufferLockFlags {
   kCVPixelBufferLock_ReadOnly = 0x00000001,
};
Constants
kCVPixelBufferLock_ReadOnly

A read-only buffer.

Set this flag if you don’t plan to modify buffer data while holding the lock. Setting this flag improves performance by preventing Core Video from invalidating existing caches of the buffer’s contents.

Important: If you pass this flag to the CVPixelBufferLockBaseAddress function, you must also pass it to the CVPixelBufferUnlockBaseAddress function.

Available in iOS 4.0 and later.

Declared in CVPixelBuffer.h.