libcamera: buffer: Add an accessor to the BufferMemory

Buffer instances reference memory, which is modelled internally by a
BufferMemory instance. Store a pointer to the BufferMemory in the Buffer
class, and populate it when the buffer is queued to the camera through a
request. This is useful for applications to access the buffer memory in
the buffer or request completion handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2019-07-12 22:32:01 +03:00
parent f1199a1011
commit 689e8916ca
8 changed files with 26 additions and 11 deletions

View File

@@ -19,8 +19,7 @@ BufferWriter::BufferWriter(const std::string &pattern)
{
}
int BufferWriter::write(libcamera::Buffer *buffer, libcamera::BufferMemory *mem,
const std::string &streamName)
int BufferWriter::write(libcamera::Buffer *buffer, const std::string &streamName)
{
std::string filename;
size_t pos;
@@ -41,6 +40,7 @@ int BufferWriter::write(libcamera::Buffer *buffer, libcamera::BufferMemory *mem,
if (fd == -1)
return -errno;
libcamera::BufferMemory *mem = buffer->mem();
for (libcamera::Plane &plane : mem->planes()) {
void *data = plane.mem();
unsigned int length = plane.length();