diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-09-24 17:24:49 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-09-30 14:24:42 +0200 |
commit | 62372b7164999c46bedf8aef75d57746ccd10397 (patch) | |
tree | 529522e2d879b97acfd3624b5966df2df51d7bc8 /src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | |
parent | dbe8d271e7959245f64056d26d95e94fe3ff737d (diff) |
libcamera: pipeline: rkisp1: Breakout basic path handling to own class
The self and main paths are very similar and the introduction of support
for two simultaneous streams have made it clear their handling could be
abstracted in a separate class.
This is the first step to create such a class by breaking out the
initialization and storage of the video and subdevices. There is no
functional change in this patch.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/rkisp1/rkisp1_path.cpp')
-rw-r--r-- | src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp new file mode 100644 index 00000000..2eae4234 --- /dev/null +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Google Inc. + * + * rkisp1path.cpp - Rockchip ISP1 path helper + */ + +#include "rkisp1_path.h" + +#include "libcamera/internal/media_device.h" +#include "libcamera/internal/v4l2_subdevice.h" +#include "libcamera/internal/v4l2_videodevice.h" + +namespace libcamera { + +RkISP1Path::RkISP1Path(const char *name) + : resizer_(nullptr), video_(nullptr), name_(name) +{ +} + +RkISP1Path::~RkISP1Path() +{ + delete video_; + delete resizer_; +} + +bool RkISP1Path::init(MediaDevice *media) +{ + std::string resizer = std::string("rkisp1_resizer_") + name_ + "path"; + std::string video = std::string("rkisp1_") + name_ + "path"; + + resizer_ = V4L2Subdevice::fromEntityName(media, resizer); + if (resizer_->open() < 0) + return false; + + video_ = V4L2VideoDevice::fromEntityName(media, video); + if (video_->open() < 0) + return false; + + return true; +} + +RkISP1MainPath::RkISP1MainPath() + : RkISP1Path("main") +{ +} + +RkISP1SelfPath::RkISP1SelfPath() + : RkISP1Path("self") +{ +} + +} /* namespace libcamera */ |