From 08c31d2a868656fb967618957fdf9e122422606e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 29 Jan 2019 16:56:16 +0100 Subject: libcamera: pipeline: vimc: create camera for Sensor B MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 6ed069ed..900477e2 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,19 @@ 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() { + delete video_; + if (media_) media_->release(); } @@ -93,8 +97,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; -- cgit v1.2.1