From bd38112b7795b79c7056cfe6e9d713e80ee74586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 5 Feb 2019 17:36:04 +0100 Subject: libcamera: camera: Extend the interface to support capture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Jacopo Mondi Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart --- src/libcamera/request.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/libcamera/request.cpp') 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 buffers(std::move(bufferMap_)); - camera_->requestCompleted.emit(this, buffers); - } + if (!pending_.empty()) + return; + + std::map buffers(std::move(bufferMap_)); + camera_->requestCompleted.emit(this, buffers); + delete this; } } /* namespace libcamera */ -- cgit v1.2.1