From patchwork Tue Feb 5 00:06:56 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: 504 X-Patchwork-Delegate: niklas.soderlund@ragnatech.se Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 58C0160DB8 for ; Tue, 5 Feb 2019 01:07:52 +0100 (CET) X-Halon-ID: 12e273c5-28da-11e9-b530-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [81.164.19.127]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 12e273c5-28da-11e9-b530-005056917a89; Tue, 05 Feb 2019 01:07:49 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Feb 2019 01:06:56 +0100 Message-Id: <20190205000702.15370-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190205000702.15370-1-niklas.soderlund@ragnatech.se> References: <20190205000702.15370-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 1/7] libcamera: pipelines: implement start and stop of a camera X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2019 00:07:52 -0000 The camera need methods to start and stop capturing once it have been configured. Extend the pipeline API to provide this and implement stubs in all pipeline handlers. Signed-off-by: Niklas Söderlund --- src/libcamera/include/pipeline_handler.h | 3 +++ src/libcamera/pipeline/ipu3/ipu3.cpp | 14 ++++++++++++ src/libcamera/pipeline/uvcvideo.cpp | 14 ++++++++++++ src/libcamera/pipeline/vimc.cpp | 14 ++++++++++++ src/libcamera/pipeline_handler.cpp | 27 ++++++++++++++++++++++++ 5 files changed, 72 insertions(+) diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index b4321f0fa0f765be..4bfe45aaf78e34ab 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -45,6 +45,9 @@ public: virtual int configureStreams(Camera *camera, std::map &config) = 0; + virtual int start(const Camera *camera) = 0; + virtual void stop(const Camera *camera) = 0; + virtual bool match(DeviceEnumerator *enumerator) = 0; protected: diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 7823bbb55d9bde16..3bf196051f2ebdbc 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -34,6 +34,9 @@ public: int configureStreams(Camera *camera, std::map &config) override; + int start(const Camera *camera) override; + void stop(const Camera *camera) override; + bool match(DeviceEnumerator *enumerator); private: @@ -104,6 +107,17 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera, return 0; } +int PipelineHandlerIPU3::start(const Camera *camera) +{ + LOG(IPU3, Error) << "TODO: start camera"; + return 0; +} + +void PipelineHandlerIPU3::stop(const Camera *camera) +{ + LOG(IPU3, Error) << "TODO: stop camera"; +} + bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator) { DeviceMatch cio2_dm("ipu3-cio2"); diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index ad4d45d0698519b6..e6a15c58a63cf76b 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -30,6 +30,9 @@ public: int configureStreams(Camera *camera, std::map &config) override; + int start(const Camera *camera) override; + void stop(const Camera *camera) override; + bool match(DeviceEnumerator *enumerator); private: @@ -82,6 +85,17 @@ int PipelineHandlerUVC::configureStreams(Camera *camera, return 0; } +int PipelineHandlerUVC::start(const Camera *camera) +{ + LOG(UVC, Error) << "TODO: start camera"; + return 0; +} + +void PipelineHandlerUVC::stop(const Camera *camera) +{ + LOG(UVC, Error) << "TODO: stop camera"; +} + bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) { DeviceMatch dm("uvcvideo"); diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 900477e257232b70..11eca0cd4d9a6e0c 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -30,6 +30,9 @@ public: int configureStreams(Camera *camera, std::map &config) override; + int start(const Camera *camera) override; + void stop(const Camera *camera) override; + bool match(DeviceEnumerator *enumerator); private: @@ -77,6 +80,17 @@ int PipeHandlerVimc::configureStreams(Camera *camera, return 0; } +int PipeHandlerVimc::start(const Camera *camera) +{ + LOG(VIMC, Error) << "TODO: start camera"; + return 0; +} + +void PipeHandlerVimc::stop(const Camera *camera) +{ + LOG(VIMC, Error) << "TODO: stop camera"; +} + bool PipeHandlerVimc::match(DeviceEnumerator *enumerator) { DeviceMatch dm("vimc"); diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 3a560e10c442717f..fa5f780cea34fc8f 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -109,6 +109,33 @@ PipelineHandler::~PipelineHandler() * \return 0 on success or a negative error code on error. */ +/** + * \fn PipelineHandler::start() + * \brief Start capturing from a group of streams + * \param[in] camera The camera to start + * + * Start the group of streams that have been configured for capture by + * \a configureStreams(). The intended caller of this interface is + * the Camera class which will in turn will receive the call from the + * application to indicate that it's done configuring the streams + * and are ready to capture. + * + * \return 0 on success or a negative error code on error. + */ + +/** + * \fn PipelineHandler::stop() + * \brief Stop capturing from all running streams + * \param[in] camera The camera to stop + * + * Stop processing requests, finish processing all already queued requests + * and once all buffers on all streams have been dequeued stop capturing + * from all running streams. Finish processing of queued requests do not + * necessarily involve processing them by the capture hardware but notifying + * the application that a queued request was not processed due to the fact + * that the camera was stopped before they could be processed. + */ + /** * \fn PipelineHandler::match(DeviceEnumerator *enumerator) * \brief Match media devices and create camera instances