diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-06-28 01:37:03 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-06-28 14:25:46 +0200 |
commit | d130c55073231a29ba9590dd3f13094abc7c5cad (patch) | |
tree | a03bc99acccf32d8b34c670d04ab98a636ac43b8 /src/libcamera/pipeline/ipu3/imgu.cpp | |
parent | 1e0cd804f07d126af2e248a54dbb4042d861487b (diff) |
libcamera: ipu3: imgu: Use unique_ptr for video and subdevices
Instead of manually deleting the video and subdevices in the destructor
use std::unique_ptr.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/ipu3/imgu.cpp')
-rw-r--r-- | src/libcamera/pipeline/ipu3/imgu.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp index c4bb6100..d7f4173d 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -44,28 +44,29 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) * by the match() function: no need to check for newly created * video devices and subdevice validity here. */ - imgu_ = V4L2Subdevice::fromEntityName(media, name_); + imgu_.reset(V4L2Subdevice::fromEntityName(media, name_)); ret = imgu_->open(); if (ret) return ret; - input_ = V4L2VideoDevice::fromEntityName(media, name_ + " input"); + input_.reset(V4L2VideoDevice::fromEntityName(media, name_ + " input")); ret = input_->open(); if (ret) return ret; - output_ = V4L2VideoDevice::fromEntityName(media, name_ + " output"); + output_.reset(V4L2VideoDevice::fromEntityName(media, + name_ + " output")); ret = output_->open(); if (ret) return ret; - viewfinder_ = V4L2VideoDevice::fromEntityName(media, - name_ + " viewfinder"); + viewfinder_.reset(V4L2VideoDevice::fromEntityName(media, + name_ + " viewfinder")); ret = viewfinder_->open(); if (ret) return ret; - stat_ = V4L2VideoDevice::fromEntityName(media, name_ + " 3a stat"); + stat_.reset(V4L2VideoDevice::fromEntityName(media, name_ + " 3a stat")); ret = stat_->open(); if (ret) return ret; @@ -150,7 +151,7 @@ int ImgUDevice::configureVideoDevice(V4L2VideoDevice *dev, unsigned int pad, return ret; /* No need to apply format to the stat node. */ - if (dev == stat_) + if (dev == stat_.get()) return 0; *outputFormat = {}; @@ -162,7 +163,7 @@ int ImgUDevice::configureVideoDevice(V4L2VideoDevice *dev, unsigned int pad, if (ret) return ret; - const char *name = dev == output_ ? "output" : "viewfinder"; + const char *name = dev == output_.get() ? "output" : "viewfinder"; LOG(IPU3, Debug) << "ImgU " << name << " format = " << outputFormat->toString(); |