From patchwork Tue Nov 26 23:36:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2374 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DC49061C91 for ; Wed, 27 Nov 2019 00:39:45 +0100 (CET) X-Halon-ID: 06248b26-10a6-11ea-a0b9-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p54ac5865.dip0.t-ipconnect.de [84.172.88.101]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 06248b26-10a6-11ea-a0b9-005056917f90; Wed, 27 Nov 2019 00:39:44 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Wed, 27 Nov 2019 00:36:16 +0100 Message-Id: <20191126233620.1695316-27-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191126233620.1695316-1-niklas.soderlund@ragnatech.se> References: <20191126233620.1695316-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 26/30] libcamera: camera: Start streams before pipeline X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Nov 2019 23:39:46 -0000 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 --- 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; }