libcamera
v0.0.0
Supporting cameras in Linux since 2019
|
Frame buffer data and its associated dynamic metadata. More...
Classes | |
struct | Plane |
A memory region to store a single plane of a frame. More... | |
Public Member Functions | |
FrameBuffer (const std::vector< Plane > &planes, unsigned int cookie=0) | |
Construct a FrameBuffer with an array of planes. More... | |
FrameBuffer (const FrameBuffer &)=delete | |
FrameBuffer (FrameBuffer &&)=delete | |
FrameBuffer & | operator= (const FrameBuffer &)=delete |
FrameBuffer & | operator= (FrameBuffer &&)=delete |
const std::vector< Plane > & | planes () const |
Retrieve the static plane descriptors. More... | |
Request * | request () const |
Retrieve the request this buffer belongs to. More... | |
void | setRequest (Request *request) |
Set the request this buffer belongs to. More... | |
const FrameMetadata & | metadata () const |
Retrieve the dynamic metadata. More... | |
unsigned int | cookie () const |
Retrieve the cookie. More... | |
void | setCookie (unsigned int cookie) |
Set the cookie. More... | |
int | copyFrom (const FrameBuffer *src) |
Copy the contents from another buffer. More... | |
Friends | |
class | Request |
class | V4L2VideoDevice |
Frame buffer data and its associated dynamic metadata.
The FrameBuffer class is the primary interface for applications, IPAs and pipeline handlers to interact with frame memory. It contains all the static and dynamic information to manage the whole life cycle of a frame capture, from buffer creation to consumption.
The static information describes the memory planes that make a frame. The planes are specified when creating the FrameBuffer and are expressed as a set of dmabuf file descriptors and length.
The dynamic information is grouped in a FrameMetadata instance. It is updated during the processing of a queued capture request, and is valid from the completion of the buffer as signaled by Camera::bufferComplete() until the FrameBuffer is either reused in a new request or deleted.
The creator of a FrameBuffer (application, IPA or pipeline handler) may associate to it an integer cookie for any private purpose. The cookie may be set when creating the FrameBuffer, and updated at any time with setCookie(). The cookie is transparent to the libcamera core and shall only be set by the creator of the FrameBuffer. This mechanism supplements the Request cookie.
libcamera::FrameBuffer::FrameBuffer | ( | const std::vector< Plane > & | planes, |
unsigned int | cookie = 0 |
||
) |
Construct a FrameBuffer with an array of planes.
[in] | planes | The frame memory planes |
[in] | cookie | Cookie |
|
inline |
Retrieve the cookie.
The cookie belongs to the creator of the FrameBuffer, which controls its lifetime and value.
int libcamera::FrameBuffer::copyFrom | ( | const FrameBuffer * | src | ) |
Copy the contents from another buffer.
[in] | src | Buffer to copy |
Copy the buffer contents and metadata from src to this buffer. The destination FrameBuffer shall have the same number of planes as the source buffer, and each destination plane shall be larger than or equal to the corresponding source plane.
The complete metadata of the source buffer is copied to the destination buffer. If an error occurs during the copy, the destination buffer's metadata status is set to FrameMetadata::FrameError, and other metadata fields are not modified.
The operation is performed using memcpy() so is very slow, users needs to consider this before copying buffers.
|
inline |
Retrieve the dynamic metadata.
|
inline |
Retrieve the static plane descriptors.
|
inline |
Retrieve the request this buffer belongs to.
The intended callers of this method are buffer completion handlers that need to associate a buffer to the request it belongs to.
A Buffer is associated to a request by Request::addBuffer() and the association is valid until the buffer completes. The returned request pointer is valid only during that interval.
|
inline |
Set the cookie.
[in] | cookie | Cookie to set |
The cookie belongs to the creator of the FrameBuffer. Its value may be modified at any time with this method. Applications and IPAs shall not modify the cookie value of buffers they haven't created themselves. The libcamera core never modifies the buffer cookie.
|
inline |