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>
This commit is contained in:
Niklas Söderlund
2019-02-05 17:36:04 +01:00
committed by Laurent Pinchart
parent 98edf29e01
commit bd38112b77
3 changed files with 159 additions and 5 deletions

View File

@@ -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 */