summaryrefslogtreecommitdiff
path: root/src/libcamera/request.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-02-05 17:36:04 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-02-06 07:41:51 +0200
commitbd38112b7795b79c7056cfe6e9d713e80ee74586 (patch)
treeb657b03308ba685bf6982993a30bf97f9965b1d9 /src/libcamera/request.cpp
parent98edf29e012cce6a3c0a428e3d78490780c1a824 (diff)
libcamera: camera: Extend the interface to support capture
In order to support capture, the camera needs methods to allocate and free buffers, to start and stop the capture and to queue requests. Define those interfaces in the Camera class and implement them to call the corresponding pipeline handler methods. Once a camera is started the pipeline handler of the camera will begin processing requests queued to the camera by the application until it gets stopped. Once a request is created it can be queued to the camera and the application will be notified asynchronously once the request is completed and be able to process all the buffers involved in the request. At this point the request objects don't support controls. This will be extended in the future. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/request.cpp')
-rw-r--r--src/libcamera/request.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 922682a3..d76db24d 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -104,7 +104,8 @@ int Request::prepare()
* data.
*
* The request completes when all the buffers it contains are ready to be
- * presented to the application.
+ * presented to the application. It then emits the Camera::requestCompleted
+ * signal and is automatically deleted.
*/
void Request::bufferCompleted(Buffer *buffer)
{
@@ -113,10 +114,12 @@ void Request::bufferCompleted(Buffer *buffer)
int ret = pending_.erase(buffer);
ASSERT(ret == 1);
- if (pending_.empty()) {
- std::map<Stream *, Buffer *> buffers(std::move(bufferMap_));
- camera_->requestCompleted.emit(this, buffers);
- }
+ if (!pending_.empty())
+ return;
+
+ std::map<Stream *, Buffer *> buffers(std::move(bufferMap_));
+ camera_->requestCompleted.emit(this, buffers);
+ delete this;
}
} /* namespace libcamera */