diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-02-28 17:45:58 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-03-01 15:45:09 +0200 |
commit | 1accc258cc8efb077f8437be702646583ee61ca6 (patch) | |
tree | b7a4311d4e9c448f010bbb9ee4f087571675c9f5 /src | |
parent | fca7602c3c88e804d1fbb5ae1372e2e6e841a4ee (diff) |
libcamera: request: Add request completion status
Add a new field to the Request class to report its completion status,
and a new complete() method to update the status.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/request.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index d76db24d..cb170930 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -24,6 +24,17 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Request) /** + * \enum Request::Status + * Request completion status + * \var Request::RequestPending + * The request hasn't completed yet + * \var Request::RequestComplete + * The request has completed + * \var Request::RequestCancelled + * The request has been cancelled due to capture stop + */ + +/** * \class Request * \brief A frame capture request * @@ -36,7 +47,7 @@ LOG_DEFINE_CATEGORY(Request) * \param[in] camera The camera that creates the request */ Request::Request(Camera *camera) - : camera_(camera) + : camera_(camera), status_(RequestPending) { } @@ -83,6 +94,19 @@ Buffer *Request::findBuffer(Stream *stream) const } /** + * \fn Request::status() + * \brief Retrieve the request completion status + * + * The request status indicates whether the request has completed successfully + * or with an error. When requests are created and before they complete the + * request status is set to RequestPending, and is updated at completion time + * to RequestComplete. If a request is cancelled at capture stop before it has + * completed, its status is set to RequestCancelled. + * + * \return The request completion status + */ + +/** * \brief Prepare the resources for the completion handler */ int Request::prepare() @@ -97,6 +121,18 @@ int Request::prepare() } /** + * \brief Complete a queued request + * \param[in] status The request completion status + * + * Mark the request as complete by updating its status to \a status. + */ +void Request::complete(Status status) +{ + ASSERT(pending_.empty()); + status_ = status; +} + +/** * \brief Slot for the buffer completed signal * * The bufferCompleted method serves as slot where to connect the @@ -117,6 +153,8 @@ void Request::bufferCompleted(Buffer *buffer) if (!pending_.empty()) return; + complete(RequestComplete); + std::map<Stream *, Buffer *> buffers(std::move(bufferMap_)); camera_->requestCompleted.emit(this, buffers); delete this; |