summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-04-09 13:00:08 +0200
committerJacopo Mondi <jacopo@jmondi.org>2019-04-18 15:35:34 +0200
commit571d16b539df355a572a98bcbbdc2f9f1844a24d (patch)
treeda814e836f1a86fa6c2d3f83721fd3d75e83dbf4
parent7b7c8f06a0a836ebeb77aadbd3a8f38754934526 (diff)
libcamera: request: Add hasPendingBuffers() method
Add method to verify if a request has pending buffers yet to be completed. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--include/libcamera/request.h2
-rw-r--r--src/libcamera/request.cpp12
2 files changed, 12 insertions, 2 deletions
diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index 0dbd4251..0188bcab 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -37,6 +37,8 @@ public:
Status status() const { return status_; }
+ bool hasPendingBuffers() const { return !pending_.empty(); }
+
private:
friend class Camera;
friend class PipelineHandler;
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index e0e77e97..e5c25d2c 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -107,6 +107,14 @@ Buffer *Request::findBuffer(Stream *stream) const
*/
/**
+ * \fn Request::hasPendingBuffers()
+ * \brief Check if a request has buffers yet to be completed
+ *
+ * \return True if the request has buffers pending for completion, false
+ * otherwise
+ */
+
+/**
* \brief Prepare the resources for the completion handler
*/
int Request::prepare()
@@ -127,7 +135,7 @@ int Request::prepare()
*/
void Request::complete(Status status)
{
- ASSERT(pending_.empty());
+ ASSERT(!hasPendingBuffers());
status_ = status;
}
@@ -149,7 +157,7 @@ bool Request::completeBuffer(Buffer *buffer)
int ret = pending_.erase(buffer);
ASSERT(ret == 1);
- return pending_.empty();
+ return !hasPendingBuffers();
}
} /* namespace libcamera */