diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-07-12 22:32:01 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-07-14 16:01:07 +0300 |
commit | 689e8916caf11942286a1f1264e55dcb709d3939 (patch) | |
tree | a82d5d6e858c2a0e3cd1b939198fa87ba5efa3f2 /src/qcam/main_window.cpp | |
parent | f1199a1011a22f00e863473ae241c781f4bd999d (diff) |
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>
Diffstat (limited to 'src/qcam/main_window.cpp')
-rw-r--r-- | src/qcam/main_window.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 92f88832..5c26ab8e 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -221,7 +221,6 @@ void MainWindow::requestComplete(Request *request, framesCaptured_++; - Stream *stream = buffers.begin()->first; Buffer *buffer = buffers.begin()->second; double fps = buffer->timestamp() - lastBufferTime_; @@ -235,8 +234,7 @@ void MainWindow::requestComplete(Request *request, << " fps: " << std::fixed << std::setprecision(2) << fps << std::endl; - BufferMemory *mem = &stream->buffers()[buffer->index()]; - display(buffer, mem); + display(buffer); request = camera_->createRequest(); if (!request) { @@ -261,8 +259,9 @@ void MainWindow::requestComplete(Request *request, camera_->queueRequest(request); } -int MainWindow::display(Buffer *buffer, BufferMemory *mem) +int MainWindow::display(Buffer *buffer) { + BufferMemory *mem = buffer->mem(); if (mem->planes().size() != 1) return -EINVAL; |