Function

CVPixelBufferLockBaseAddress

Locks the base address of the pixel buffer.

Declaration

CVReturn CVPixelBufferLockBaseAddress(CVPixelBufferRef pixelBuffer, CVPixelBufferLockFlags lockFlags);

Parameters

pixelBuffer

The pixel buffer whose base address you want to lock.

lockFlags

Either kCVPixelBufferLock_ReadOnly or 0; see CVPixelBufferLockFlags for discussion.

Return Value

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

See Also

Modifying Pixel Buffers

CVPixelBufferFillExtendedPixels

Fills the extended pixels of the pixel buffer.

CVPixelBufferUnlockBaseAddress

Unlocks the base address of the pixel buffer.