From patchwork Fri Feb 1 15:13:54 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: 471 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 906E960B10 for ; Fri, 1 Feb 2019 16:14:06 +0100 (CET) X-Halon-ID: fe2e104d-2633-11e9-b5ae-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [91.183.179.147]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id fe2e104d-2633-11e9-b5ae-0050569116f7; Fri, 01 Feb 2019 16:14:02 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 1 Feb 2019 16:13:54 +0100 Message-Id: <20190201151354.17980-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: pipeline: vimc: create camera for Sensor B 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, 01 Feb 2019 15:14:06 -0000 Create a camera for Sensor B of the vimc pipeline. At this stage only Sensor B is exposed while the are in total two sensors in the graph. Going forward Sensor A should also be exposed as another camera. Sensor B was chosen since the graph is configured correctly for it out of the box. As we lack control over sub devices formats it's not really possible to use Sensor A yet with the library. Once both cameras are registered with the library they should be extended to provide two streams each, one for the raw output and one for the output which uses the shared scaler. Signed-off-by: Niklas Söderlund Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/vimc.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 6ed069edec550a61..6ab6e203785499ec 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -12,6 +12,7 @@ #include "log.h" #include "media_device.h" #include "pipeline_handler.h" +#include "v4l2_device.h" namespace libcamera { @@ -33,16 +34,20 @@ public: private: std::shared_ptr media_; + V4L2Device *video_; Stream stream_; }; PipeHandlerVimc::PipeHandlerVimc(CameraManager *manager) - : PipelineHandler(manager), media_(nullptr) + : PipelineHandler(manager), media_(nullptr), video_(nullptr) { } PipeHandlerVimc::~PipeHandlerVimc() { + if (video_) + delete video_; + if (media_) media_->release(); } @@ -93,8 +98,16 @@ bool PipeHandlerVimc::match(DeviceEnumerator *enumerator) media_->acquire(); + video_ = new V4L2Device(*media_->getEntityByName("Raw Capture 1")); + + if (video_->open()) { + media_->release(); + return false; + } + std::vector streams{ &stream_ }; - std::shared_ptr camera = Camera::create(this, "Dummy VIMC Camera", streams); + std::shared_ptr camera = Camera::create(this, "VIMC Sensor B", + streams); registerCamera(std::move(camera)); return true;