[libcamera-devel] [PATCH 26/30] libcamera: camera: Start streams before pipeline

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Nov 27 00:36:16 CET 2019


The FrameBuffer interface require individual streams to be started
explicitly. This is needed so that the streams may perform any
preparations before the pipeline and this the camera is started.

The only supported stream at the moment is V4L2 streams and they need to
be started so they can prepare for the use of external buffers in the
case they are used.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 src/libcamera/camera.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index e810fb725d81350d..6b1b3fb64f8b2c0b 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -856,15 +856,23 @@ int Camera::queueRequest(Request *request)
  */
 int Camera::start()
 {
+	int ret;
+
 	if (disconnected_)
 		return -ENODEV;
 
 	if (!stateIs(CameraPrepared))
 		return -EACCES;
 
+	for (Stream *stream : activeStreams_) {
+		ret = stream->start();
+		if (ret < 0)
+			return ret;
+	}
+
 	LOG(Camera, Debug) << "Starting capture";
 
-	int ret = pipe_->start(this);
+	ret = pipe_->start(this);
 	if (ret)
 		return ret;
 
@@ -899,6 +907,9 @@ int Camera::stop()
 
 	pipe_->stop(this);
 
+	for (Stream *stream : activeStreams_)
+		stream->stop();
+
 	return 0;
 }
 
-- 
2.24.0



More information about the libcamera-devel mailing list