summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMilan Zamazal <mzamazal@redhat.com>2024-11-06 21:17:19 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-11-08 03:45:36 +0200
commitfe68cd0d7d504f9edb7fd98d9888f10fb21aeb13 (patch)
treeff2b023296bdb74c75efc3dfe0326e9477e4f5bd /src
parente1d45a17f76d5d125d44409b259114b087a4bfe3 (diff)
libcamera: pipeline_handler: Provide cancelRequest
Let's extract the two occurrences of canceling a request to a common helper. This is especially useful for the followup patch, which needs to cancel a request from outside. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline_handler.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index e5940469..4905863c 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -367,9 +367,7 @@ void PipelineHandler::stop(Camera *camera)
while (!waitingRequests_.empty()) {
Request *request = waitingRequests_.front();
waitingRequests_.pop();
-
- request->_d()->cancel();
- completeRequest(request);
+ cancelRequest(request);
}
/* Make sure no requests are pending. */
@@ -470,10 +468,8 @@ void PipelineHandler::doQueueRequest(Request *request)
}
int ret = queueRequestDevice(camera, request);
- if (ret) {
- request->_d()->cancel();
- completeRequest(request);
- }
+ if (ret)
+ cancelRequest(request);
}
/**
@@ -569,6 +565,19 @@ void PipelineHandler::completeRequest(Request *request)
}
/**
+ * \brief Cancel request and signal its completion
+ * \param[in] request The request to cancel
+ *
+ * This function cancels and completes the request. The same rules as for
+ * completeRequest() apply.
+ */
+void PipelineHandler::cancelRequest(Request *request)
+{
+ request->_d()->cancel();
+ completeRequest(request);
+}
+
+/**
* \brief Retrieve the absolute path to a platform configuration file
* \param[in] subdir The pipeline handler specific subdirectory name
* \param[in] name The configuration file name