summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera.cpp10
-rw-r--r--src/libcamera/request.cpp18
2 files changed, 24 insertions, 4 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 810cb129..1f307654 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -754,10 +754,16 @@ int Camera::freeBuffers()
/**
* \brief Create a request object for the camera
+ * \param[in] cookie Opaque cookie for application use
*
* This method creates an empty request for the application to fill with
* buffers and paramaters, and queue for capture.
*
+ * The \a cookie is stored in the request and is accessible through the
+ * Request::cookie() method at any time. It is typically used by applications
+ * to map the request to an external resource in the request completion
+ * handler, and is completely opaque to libcamera.
+ *
* The ownership of the returned request is passed to the caller, which is
* responsible for either queueing the request or deleting it.
*
@@ -766,12 +772,12 @@ int Camera::freeBuffers()
*
* \return A pointer to the newly created request, or nullptr on error
*/
-Request *Camera::createRequest()
+Request *Camera::createRequest(uint64_t cookie)
{
if (disconnected_ || !stateBetween(CameraPrepared, CameraRunning))
return nullptr;
- return new Request(this);
+ return new Request(this, cookie);
}
/**
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index f0b59858..8cf41a43 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -46,9 +46,17 @@ LOG_DEFINE_CATEGORY(Request)
/**
* \brief Create a capture request for a camera
* \param[in] camera The camera that creates the request
+ * \param[in] cookie Opaque cookie for application use
+ *
+ * The \a cookie is stored in the request and is accessible through the
+ * cookie() method at any time. It is typically used by applications to map the
+ * request to an external resource in the request completion handler, and is
+ * completely opaque to libcamera.
+ *
*/
-Request::Request(Camera *camera)
- : camera_(camera), controls_(camera), status_(RequestPending)
+Request::Request(Camera *camera, uint64_t cookie)
+ : camera_(camera), controls_(camera), cookie_(cookie),
+ status_(RequestPending)
{
}
@@ -120,6 +128,12 @@ Buffer *Request::findBuffer(Stream *stream) const
}
/**
+ * \fn Request::cookie()
+ * \brief Retrieve the cookie set when the request was created
+ * \return The request cookie
+ */
+
+/**
* \fn Request::status()
* \brief Retrieve the request completion status
*