From patchwork Fri Jan 25 15:33:36 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: 382 X-Patchwork-Delegate: niklas.soderlund@ragnatech.se Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 03D4F60C83 for ; Fri, 25 Jan 2019 16:33:52 +0100 (CET) X-Halon-ID: 9d929c62-20b6-11e9-874f-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 9d929c62-20b6-11e9-874f-005056917f90; Fri, 25 Jan 2019 16:33:51 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 25 Jan 2019 16:33:36 +0100 Message-Id: <20190125153340.2744-4-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190125153340.2744-1-niklas.soderlund@ragnatech.se> References: <20190125153340.2744-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/7] libcamera: pipelines: add method to retrieve streams 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: Fri, 25 Jan 2019 15:33:53 -0000 A Camera object needs to be able to inquire its responsible PipelineHandler for which streams it supports. Add and implement such an interface to the PipelineHandler base class and all pipeline handler implementations. Signed-off-by: Niklas Söderlund --- src/libcamera/include/pipeline_handler.h | 3 +++ src/libcamera/pipeline/ipu3/ipu3.cpp | 12 ++++++++++++ src/libcamera/pipeline/uvcvideo.cpp | 12 ++++++++++++ src/libcamera/pipeline/vimc.cpp | 12 ++++++++++++ src/libcamera/pipeline_handler.cpp | 12 ++++++++++++ 5 files changed, 51 insertions(+) diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index 0db84217089e692a..f92cc5b5fa5e777b 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -17,6 +17,7 @@ namespace libcamera { class CameraManager; class DeviceEnumerator; class MediaDevice; +class Stream; class Camera; class CameraData @@ -38,6 +39,8 @@ public: PipelineHandler(CameraManager *manager); virtual ~PipelineHandler(); + virtual std::vector streams(const Camera *camera) const = 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 d74655d037728feb..5c35c7a53b9347a3 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "device_enumerator.h" #include "log.h" @@ -27,6 +28,8 @@ public: PipelineHandlerIPU3(CameraManager *manager); ~PipelineHandlerIPU3(); + std::vector streams(const Camera *camera) const; + bool match(DeviceEnumerator *enumerator); private: @@ -60,6 +63,15 @@ PipelineHandlerIPU3::~PipelineHandlerIPU3() imgu_->release(); } +std::vector PipelineHandlerIPU3::streams(const Camera *camera) const +{ + std::vector streams; + + streams.push_back(Stream(0)); + + return streams; +} + 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 c51e8bc1f2c2bf25..e1f023245b8e63dd 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -6,6 +6,7 @@ */ #include +#include #include "device_enumerator.h" #include "media_device.h" @@ -20,6 +21,8 @@ public: PipelineHandlerUVC(CameraManager *manager); ~PipelineHandlerUVC(); + std::vector streams(const Camera *camera) const; + bool match(DeviceEnumerator *enumerator); private: @@ -41,6 +44,15 @@ PipelineHandlerUVC::~PipelineHandlerUVC() media_->release(); } +std::vector PipelineHandlerUVC::streams(const Camera *camera) const +{ + std::vector streams; + + streams.push_back(Stream(0)); + + return streams; +} + bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) { DeviceMatch dm("uvcvideo"); diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index f58a97d51619515d..a96ec9f431361a32 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -6,6 +6,7 @@ */ #include +#include #include "device_enumerator.h" #include "media_device.h" @@ -19,6 +20,8 @@ public: PipeHandlerVimc(CameraManager *manager); ~PipeHandlerVimc(); + std::vector streams(const Camera *camera) const; + bool match(DeviceEnumerator *enumerator); private: @@ -36,6 +39,15 @@ PipeHandlerVimc::~PipeHandlerVimc() media_->release(); } +std::vector PipeHandlerVimc::streams(const Camera *camera) const +{ + std::vector streams; + + streams.push_back(Stream(0)); + + return streams; +} + bool PipeHandlerVimc::match(DeviceEnumerator *enumerator) { DeviceMatch dm("vimc"); diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 4d5344988cfe8aa2..a825e7bf882d23c2 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -84,6 +84,18 @@ PipelineHandler::~PipelineHandler() cameraData_.clear(); }; +/** + * \fn PipelineHandler::streams(const Camera *camera) + * \brief Retrive a array of all streams the camera provides + * \param[in] camera The camera to retrieve streams from + * + * This function is the interface to extract information about streams from a + * PipelineHandler. + * + * \return A array of streams from the camera or a empty list if \a camera + * is not part of the PipelineHandler. + */ + /** * \fn PipelineHandler::match(DeviceEnumerator *enumerator) * \brief Match media devices and create camera instances