iOS Developer Library

Developer

System Framework Reference CVPixelBufferPool Reference

Options
Deployment Target:

On This Page
Language:

CVPixelBufferPool Reference

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

  • Creates a pixel buffer pool.

    Declaration

    Swift

    func CVPixelBufferPoolCreate(_ allocator: CFAllocator!, _ poolAttributes: CFDictionary!, _ pixelBufferAttributes: CFDictionary!, _ poolOut: UnsafeMutablePointer<Unmanaged<CVPixelBufferPool>?>) -> CVReturn

    Objective-C

    CVReturn CVPixelBufferPoolCreate ( CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef pixelBufferAttributes, CVPixelBufferPoolRef *poolOut );

    Parameters

    allocator

    The allocator to use for allocating this buffer pool. Pass NULL to specify the default allocator.

    poolAttributes

    A Core Foundation dictionary containing the attributes for this pixel buffer pool. (See “Pixel Buffer Pool Attribute Keys”.)

    pixelBufferAttributes

    A Core Foundation dictionary containing the attributes to be used for creating new pixel buffers within the pool. (See Pixel Buffer Attribute Keys.)

    poolOut

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

    Return Value

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

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in iOS 4.0 and later.

  • Creates a pixel buffer from a pixel buffer pool.

    Declaration

    Swift

    func CVPixelBufferPoolCreatePixelBuffer(_ allocator: CFAllocator!, _ pixelBufferPool: CVPixelBufferPool!, _ pixelBufferOut: UnsafeMutablePointer<Unmanaged<CVPixelBuffer>?>) -> CVReturn

    Objective-C

    CVReturn CVPixelBufferPoolCreatePixelBuffer ( CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CVPixelBufferRef *pixelBufferOut );

    Parameters

    allocator

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

    pixelBufferPool

    The pixel buffer pool for creating the new pixel buffer.

    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 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).

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in iOS 4.0 and later.

  • Creates a new pixel buffer with some auxiliary attributes from the pool.

    Declaration

    Swift

    func CVPixelBufferPoolCreatePixelBufferWithAuxAttributes(_ allocator: CFAllocator!, _ pixelBufferPool: CVPixelBufferPool!, _ auxAttributes: CFDictionary!, _ pixelBufferOut: UnsafeMutablePointer<Unmanaged<CVPixelBuffer>?>) -> CVReturn

    Objective-C

    CVReturn CVPixelBufferPoolCreatePixelBufferWithAuxAttributes ( CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CFDictionaryRef auxAttributes, CVPixelBufferRef *pixelBufferOut );

    Parameters

    allocator

    The CFAllocatorRef to use for creating the new pixel buffer. This parameter may be NULL.

    pixelBufferPool

    The CVPixelBufferPool that should create the new CVPixelBufferRef object.

    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 CVPixelBufferRef where 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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in iOS 4.0 and later.

  • Returns the pool attributes dictionary for a pixel buffer pool.

    Declaration

    Swift

    func CVPixelBufferPoolGetAttributes(_ pool: CVPixelBufferPool!) -> Unmanaged<CFDictionary>!

    Objective-C

    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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in iOS 4.0 and later.

  • Returns the attributes of pixel buffers that will be created from this pool.

    Declaration

    Swift

    func CVPixelBufferPoolGetPixelBufferAttributes(_ pool: CVPixelBufferPool!) -> Unmanaged<CFDictionary>!

    Objective-C

    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 .

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in iOS 4.0 and later.

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

    Declaration

    Swift

    func CVPixelBufferPoolGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CVPixelBufferPoolGetTypeID ( void );

    Return Value

    The Core Foundation type identifier for this type.

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in iOS 4.0 and later.

  • Releases a pixel buffer pool.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Availability

    Available in iOS 4.0 and later.

  • Retains a pixel buffer pool.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Availability

    Available in iOS 4.0 and later.

Data Types

  • A reference to a pixel buffer pool object.

    Declaration

    Swift

    typealias CVPixelBufferPoolRef = CVPixelBufferPool

    Objective-C

    typedef struct _CVPixelBufferPool *CVPixelBufferPoolRef;

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in iOS 4.0 and later.

Constants

  • The attributes associated with a pixel buffer pool.

    Declaration

    Swift

    let kCVPixelBufferPoolMinimumBufferCountKey: CFString! let kCVPixelBufferPoolMaximumBufferAgeKey: CFString!

    Objective-C

    const CFStringRef kCVPixelBufferPoolMinimumBufferCountKey; const CFStringRef kCVPixelBufferPoolMaximumBufferAgeKey;

    Constants

    • kCVPixelBufferPoolMinimumBufferCountKey

      kCVPixelBufferPoolMinimumBufferCountKey

      The minimum number of buffers allowed in the pixel buffer pool (type CFNumber).

      Available in iOS 4.0 and later.

    • kCVPixelBufferPoolMaximumBufferAgeKey

      kCVPixelBufferPoolMaximumBufferAgeKey

      The maximum allowable age for a buffer in the pixel buffer pool (type CFAbsoluteTime).

      Available in iOS 4.0 and later.

    Discussion

    You specify these keys in a Core Foundation dictionary when calling functions such as CVPixelBufferPoolCreate.

  • The auxiliary attributes used when allocating new pixel buffers using the CVPixelBufferPoolCreatePixelBufferWithAuxAttributes function.

    Declaration

    Swift

    let kCVPixelBufferPoolAllocationThresholdKey: CFString!

    Objective-C

    const CFStringRef kCVPixelBufferPoolAllocationThresholdKey;

    Constants

    • kCVPixelBufferPoolAllocationThresholdKey

      kCVPixelBufferPoolAllocationThresholdKey

      When 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 CVPixelBufferPoolCreatePixelBufferWithAuxAttributes to fail, it will return kCVReturnWouldExceedAllocationThreshold. (type CFNumberRef)

      Available in iOS 4.0 and later.

  • The notifications posted by pixel buffer pools.

    Declaration

    Swift

    let kCVPixelBufferPoolFreeBufferNotification: CFString!

    Objective-C

    const CFStringRef kCVPixelBufferPoolFreeBufferNotification;

    Constants

    • kCVPixelBufferPoolFreeBufferNotification

      kCVPixelBufferPoolFreeBufferNotification

      This notification is posted if a buffer becomes available after the CVPixelBufferPoolCreatePixelBufferWithAuxAttributes function has failed due to the value of the kCVPixelBufferPoolAllocationThresholdKey key. This notification will not be posted by the pool if a value for the kCVPixelBufferPoolAllocationThresholdKey key has never been passed to the CVPixelBufferPoolCreatePixelBufferWithAuxAttributes function.

      Available in iOS 4.0 and later.