From 66c1aae8f485606e85efaa5ed73463b6d824dcc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 25 Sep 2020 00:40:23 +0200 Subject: libcamera: pipeline: rkisp1: Move path link handling to RkISP1Path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the path link handling to RkISP1Path, there is no functional change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 ++--------- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 +++++- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 4 ++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 1eeff4ac..e9311b93 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -1015,20 +1015,13 @@ int PipelineHandlerRkISP1::initLinks(const Camera *camera, } for (const StreamConfiguration &cfg : config) { - MediaLink *link; if (cfg.stream() == &data->mainPathStream_) - link = media_->link("rkisp1_isp", 2, - "rkisp1_resizer_mainpath", 0); + ret = data->mainPath_->setEnabled(true); else if (cfg.stream() == &data->selfPathStream_) - link = media_->link("rkisp1_isp", 2, - "rkisp1_resizer_selfpath", 0); + ret = data->selfPath_->setEnabled(true); else return -EINVAL; - if (!link) - return -ENODEV; - - ret = link->setEnabled(true); if (ret < 0) return ret; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 355925eb..ee152c04 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -22,7 +22,7 @@ RkISP1Path::RkISP1Path(const char *name, const Span &formats, const Size &minResolution, const Size &maxResolution) : name_(name), running_(false), formats_(formats), minResolution_(minResolution), maxResolution_(maxResolution), - resizer_(nullptr), video_(nullptr) + resizer_(nullptr), video_(nullptr), link_(nullptr) { } @@ -45,6 +45,10 @@ bool RkISP1Path::init(MediaDevice *media) if (video_->open() < 0) return false; + link_ = media->link("rkisp1_isp", 2, resizer, 0); + if (!link_) + return false; + return true; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h index e2eb1be9..98863a2e 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h @@ -15,6 +15,7 @@ #include #include +#include "libcamera/internal/media_object.h" #include "libcamera/internal/v4l2_videodevice.h" namespace libcamera { @@ -33,6 +34,8 @@ public: bool init(MediaDevice *media); + int setEnabled(bool enable) { return link_->setEnabled(enable); } + StreamConfiguration generateConfiguration(const Size &resolution); CameraConfiguration::Status validate(StreamConfiguration *cfg); @@ -63,6 +66,7 @@ private: V4L2Subdevice *resizer_; V4L2VideoDevice *video_; + MediaLink *link_; }; class RkISP1MainPath : public RkISP1Path -- cgit v1.2.1