CVPixelBufferPool Reference
| Derived from | |
| Framework | System/Library/Frameworks/QuartzCore.framework |
| Companion guide | |
| Declared in | CVImageBuffer.h CVPixelBuffer.h CVPixelBufferPool.h |
Overview
A pixel buffer pool is a utility object for managing a set of pixel buffer objects for repeated use. Pixel buffer pools allocate a number of buffers in main memory that can be reused as needed, avoiding repeated allocations and deallocations, which hurt performance.
Functions
CVPixelBufferPoolCreate
Creates a pixel buffer pool.
CVReturn CVPixelBufferPoolCreate ( CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef pixelBufferAttributes, CVPixelBufferPoolRef *poolOut );
Parameters
- allocator
The allocator to use for allocating this buffer pool. Pass
NULLto specify the default allocator.- poolAttributes
A Core Foundation dictionary containing the attributes for this pixel buffer pool.
- pixelBufferAttributes
A Core Foundation dictionary containing the attributes to be used for creating new pixel buffers within the pool.
- poolOut
On output,
poolOutpoints to the newly created pixel buffer pool.
Return Value
A Core Video result code. See Core Video Constants Reference for possible values.
Availability
- Available in OS X v10.4 and later.
Declared In
CVPixelBufferPool.hCVPixelBufferPoolCreatePixelBuffer
Creates a pixel buffer from a pixel buffer pool.
CVReturn CVPixelBufferPoolCreatePixelBuffer ( CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CVPixelBufferRef *pixelBufferOut );
Parameters
- allocator
The allocator to use for creating the pixel buffer. Pass
NULLto specify the default allocator.- pixelBufferPool
The pixel buffer pool for creating the new pixel buffer.
- pixelBufferOut
On output,
pixelBufferOutpoints to the newly created pixel buffer.
Return Value
A Core Video result code. See Core Video Constants Reference for possible values.
Discussion
This function creates a new pixel buffer using the pixel buffer attributes specified during pool creation. This buffer has default attachments as specified in the pixelBufferAttributes parameter of CVPixelBufferPoolCreate (using either the kCVBufferPropagatedAttachmentsKey or kCVBufferNonPropagatedAttachmentsKey attributes).
Availability
- Available in OS X v10.4 and later.
Declared In
CVPixelBufferPool.hCVPixelBufferPoolCreatePixelBufferWithAuxAttributes
Creates a new pixel buffer with some auxiliary attributes from the pool.
CVReturn CVPixelBufferPoolCreatePixelBufferWithAuxAttributes ( CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CFDictionaryRef auxAttributes, CVPixelBufferRef *pixelBufferOut );
Parameters
- allocator
The
CFAllocatorRefto use for creating the new pixel buffer. This parameter may beNULL.- pixelBufferPool
The
CVPixelBufferPoolthat should create the newCVPixelBufferRefobject.- auxAttributes
A dictionary of auxiliary attributes describing this specific allocation request. This parameter may be
NULL. For a list of possible keys, see “Pixel Buffer Pool Auxiliary Attribute Keys.”- pixelBufferOut
A reference to a
CVPixelBufferRefwhere the newly created pixel buffer will be placed.
Return Value
A Core Video result code. See Core Video Constants Reference for possible values.
Discussion
This function creates a new CVPixelBufferRef object using the pixel buffer attributes specified during pool creation and the attributes specified in the auxAttributes parameter.
Availability
- Available in OS X v10.7 and later.
Declared In
CVPixelBufferPool.hCVPixelBufferPoolGetAttributes
Returns the pool attributes dictionary for a pixel buffer pool.
CFDictionaryRef CVPixelBufferPoolGetAttributes ( CVPixelBufferPoolRef pool );
Parameters
- pool
The pixel buffer pool whose attributes are to be retrieved.
Return Value
A Core Foundation dictionary containing the pool attributes, or NULL on failure.
Availability
- Available in OS X v10.4 and later.
Declared In
CVPixelBufferPool.hCVPixelBufferPoolGetPixelBufferAttributes
Returns the attributes of pixel buffers that will be created from this pool.
CFDictionaryRef CVPixelBufferPoolGetPixelBufferAttributes ( CVPixelBufferPoolRef pool );
Parameters
- pool
The pixel buffer pool whose attributes are to be retrieved.
Return Value
A Core Foundation dictionary containing the pixel buffer attributes, or NULL on failure.
Discussion
Use this function to obtain information about the buffers that will be created for you .
Availability
- Available in OS X v10.4 and later.
Declared In
CVPixelBufferPool.hCVPixelBufferPoolGetTypeID
Returns the Core Foundation ID of the pixel buffer pool type.
CFTypeID CVPixelBufferPoolGetTypeID ( void );
Return Value
The Core Foundation ID for this type.
Availability
- Available in OS X v10.4 and later.
Declared In
CVPixelBufferPool.hCVPixelBufferPoolRelease
Releases a pixel buffer pool.
void CVPixelBufferPoolRelease ( CVPixelBufferPoolRef pixelBufferPool );
Parameters
- pixelBufferPool
The pixel buffer pool that you want to release.
Discussion
This function is equivalent to CFRelease, but is NULL safe.
Availability
- Available in OS X v10.4 and later.
Declared In
CVPixelBufferPool.hCVPixelBufferPoolRetain
Retains a pixel buffer pool.
CVPixelBufferPoolRef CVPixelBufferPoolRetain ( CVPixelBufferPoolRef pixelBufferPool );
Parameters
- buffer
The pixel buffer pool that you want to retain.
Return Value
For convenience, the same pixel buffer pool that you wanted to retain.
Discussion
This function is equivalent to CFRetain, but is NULL safe.
Availability
- Available in OS X v10.4 and later.
Declared In
CVPixelBufferPool.hData Types
CVPixelBufferPoolRef
A reference to a pixel buffer pool object.
typedef struct _CVPixelBufferPool *CVPixelBufferPoolRef;
Availability
- Available in OS X v10.3 and later.
Declared In
CVPixelBufferPool.hCVPlanarComponentInfo
A structure for describing planar components.
struct CVPlanarComponentInfo {
int32_t offset;
uint32_t rowBytes;
};
typedef struct CVPlanarComponentInfo CVPlanarComponentInfo;
Fields
offsetThe offset from the main base address to the base address of this plane. (big-endian)
rowBytesThe number of bytes per row of this plane. (big-endian)
Discussion
Planar pixel buffers have this descriptor at their base address. Clients should generally use CVPixelBufferGetBaseAddressOfPlane and CVPixelBufferGetBytesPerRowOfPlane instead of accessing CVPlanarComponentInfo directly.
Availability
- Available in OS X v10.5 and later.
Declared In
CVPixelBuffer.hCVPlanarPixelBufferInfo
A structure for describing planar buffers.
struct CVPlanarPixelBufferInfo {
CVPlanarComponentInfo componentInfo[1];
};
typedef struct CVPlanarPixelBufferInfo CVPlanarPixelBufferInfo;
Fields
componentInfoAn array containing a
CVPlanarComponentInfostruct for each plane of the buffer.
Availability
- Available in OS X v10.5 and later.
Declared In
CVPixelBuffer.hCVPlanarPixelBufferInfo_YCbCrPlanar
A structure for describing YCbCr planar buffers.
struct CVPlanarPixelBufferInfo_YCbCrPlanar {
CVPlanarComponentInfo componentInfoY;
CVPlanarComponentInfo componentInfoCb;
CVPlanarComponentInfo componentInfoCr;
};
typedef struct CVPlanarPixelBufferInfo_YCbCrPlanar CVPlanarPixelBufferInfo_YCbCrPlanar;
Fields
componentInfoYA
CVPlanarComponentInfocontaining information on the Y component of the buffer.componentInfoCbA
CVPlanarComponentInfocontaining information on the Cb component of the buffer.componentInfoCrA
CVPlanarComponentInfocontaining information on the Cr component of the buffer.
Availability
- Available in OS X v10.5 and later.
Declared In
CVPixelBuffer.hConstants
Pixel Buffer Pool Attribute Keys
The attributes associated with a pixel buffer pool.
const CFStringRef kCVPixelBufferPoolMinimumBufferCountKey; const CFStringRef kCVPixelBufferPoolMaximumBufferAgeKey; const CFStringRef kCVImageBufferChromaLocationTopFieldKey; const CFStringRef kCVImageBufferChromaLocationBottomFieldKey; const CFStringRef kCVImageBufferChromaLocation_Left; const CFStringRef kCVImageBufferChromaLocation_Center; const CFStringRef kCVImageBufferChromaLocation_TopLeft; const CFStringRef kCVImageBufferChromaLocation_Top; const CFStringRef kCVImageBufferChromaLocation_BottomLeft; const CFStringRef kCVImageBufferChromaLocation_Bottom; const CFStringRef kCVImageBufferChromaLocation_DV420;
Constants
kCVPixelBufferPoolMinimumBufferCountKeyThe minimum number of buffers allowed in the pixel buffer pool (type
CFNumber).Available in OS X v10.4 and later.
Declared in
CVPixelBufferPool.h.kCVPixelBufferPoolMaximumBufferAgeKeyThe maximum allowable age for a buffer in the pixel buffer pool (type
CFAbsoluteTime).Available in OS X v10.4 and later.
Declared in
CVPixelBufferPool.h.kCVImageBufferChromaLocationTopFieldKeyThe location of the chroma sample in the top field. This key has one of the following values:
kCVImageBufferChromaLocation_LeftkCVImageBufferChromaLocation_CenterkCVImageBufferChromaLocation_TopLeftkCVImageBufferChromaLocation_TopkCVImageBufferChromaLocation_BottomLeftkCVImageBufferChromaLocation_BottomkCVImageBufferChromaLocation_DV420
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocationBottomFieldKeyThe location of the chroma sample in the bottom field. This key has one of the following values:
kCVImageBufferChromaLocation_LeftkCVImageBufferChromaLocation_CenterkCVImageBufferChromaLocation_TopLeftkCVImageBufferChromaLocation_TopkCVImageBufferChromaLocation_BottomLeftkCVImageBufferChromaLocation_BottomkCVImageBufferChromaLocation_DV420
For progressive images, only
kCVImageBufferChromaLocationTopFieldKeyis used.Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocation_LeftThe chroma sample is horizontally co-sited with the left column of luma samples, but centered vertically.
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocation_CenterThe chroma sample is fully centered.
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocation_TopLeftThe chroma sample is co-sited with the top-left luma sample.
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocation_TopThe chroma sample is horizontally centered, but is co-sited with the top row of luma samples.
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocation_BottomLeftThe chroma sample is co-sited with the bottom-left luma sample.
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocation_BottomThe chroma sample is horizontally centered, but is co-sited with the bottom row of luma samples.
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.kCVImageBufferChromaLocation_DV420The Cr and Cb samples are alternately co-sited with the left luma samples of the same field.
Available in OS X v10.5 and later.
Declared in
CVImageBuffer.h.
Discussion
You specify these keys in a Core Foundation dictionary when calling functions such as CVPixelBufferPoolCreate.
Pixel Buffer Pool Auxiliary Attribute Keys
The auxiliary attributes used when allocating new pixel buffers using the CVPixelBufferPoolCreatePixelBufferWithAuxAttributes function.
const CFStringRef kCVPixelBufferPoolAllocationThresholdKey;
Constants
kCVPixelBufferPoolAllocationThresholdKeyWhen set, the value associated with this key indicates that a new pixel buffer should not be allocated if the pool already has this many or more pixel buffers allocated. This doesn’t prevent buffers that have already been allocated from being recycled. If this key causes
CVPixelBufferPoolCreatePixelBufferWithAuxAttributesto fail, it will returnkCVReturnWouldExceedAllocationThreshold. (typeCFNumberRef)Available in OS X v10.7 and later.
Declared in
CVPixelBufferPool.h.
Notifications
The notifications posted by pixel buffer pools.
const CFStringRef kCVPixelBufferPoolFreeBufferNotification;
Constants
kCVPixelBufferPoolFreeBufferNotificationThis notification is posted if a buffer becomes available after the
CVPixelBufferPoolCreatePixelBufferWithAuxAttributesfunction has failed due to the value of thekCVPixelBufferPoolAllocationThresholdKeykey. This notification will not be posted by the pool if a value for thekCVPixelBufferPoolAllocationThresholdKeykey has never been passed to theCVPixelBufferPoolCreatePixelBufferWithAuxAttributesfunction.Available in OS X v10.7 and later.
Declared in
CVPixelBufferPool.h.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-12-13)