diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-01-29 16:56:16 +0100 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-02-04 16:52:50 +0100 |
commit | 08c31d2a868656fb967618957fdf9e122422606e (patch) | |
tree | a5ea0d746941086efe94f2d8de5c32a26a74bb43 | |
parent | 8400bdd19adfe4f904c971f6ef6ef9499896fa4d (diff) |
libcamera: pipeline: vimc: create camera for Sensor B
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 <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r-- | src/libcamera/pipeline/vimc.cpp | 16 |
1 files 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<MediaDevice> 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<Stream *> streams{ &stream_ }; - std::shared_ptr<Camera> camera = Camera::create(this, "Dummy VIMC Camera", streams); + std::shared_ptr<Camera> camera = Camera::create(this, "VIMC Sensor B", + streams); registerCamera(std::move(camera)); return true; |