summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/rkisp1/rkisp1.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-04-14 01:48:57 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-17 20:35:27 +0200
commitd6a88607479937a9941f1ea2c82a7e5c66b20647 (patch)
treeeff0e2193ef12e2b1e058943fb10d8a171c70e56 /src/libcamera/pipeline/rkisp1/rkisp1.cpp
parent2e22ee4310d47bc76c9db0da1b6b48f12f032743 (diff)
libcamera: pipeline_handler: Keep track of MediaDevice
Instead of requiring each pipeline handle implementation to keep track of calling release() on its media devices upon deletion, keep track of them in the base class. Add a helper that pipeline handlers shall use to acquire a media device instead of directly interacting with the DeviceEnumerator. This also means that pipeline handler implementations do no need to keep a shared_ptr<> reference to the media devices they store locally as the PipelineHandler base class will keep a shared_ptr<> reference to all media devices consumed for the entire lifetime of the pipeline handler implementation. Centrally keeping track of media devices will also be beneficial to implement exclusive access to pipelines across processes. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/rkisp1/rkisp1.cpp')
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index b94d742d..b395405c 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -81,7 +81,7 @@ private:
int createCamera(MediaEntity *sensor);
void bufferReady(Buffer *buffer);
- std::shared_ptr<MediaDevice> media_;
+ MediaDevice *media_;
V4L2Subdevice *dphy_;
V4L2Subdevice *isp_;
V4L2Device *video_;
@@ -100,9 +100,6 @@ PipelineHandlerRkISP1::~PipelineHandlerRkISP1()
delete video_;
delete isp_;
delete dphy_;
-
- if (media_)
- media_->release();
}
/* -----------------------------------------------------------------------------
@@ -355,24 +352,21 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)
dm.add("rkisp1-input-params");
dm.add("rockchip-sy-mipi-dphy");
- media_ = enumerator->search(dm);
+ media_ = acquireMediaDevice(enumerator, dm);
if (!media_)
return false;
- media_->acquire();
-
/* Create the V4L2 subdevices we will need. */
- dphy_ = V4L2Subdevice::fromEntityName(media_.get(),
- "rockchip-sy-mipi-dphy");
+ dphy_ = V4L2Subdevice::fromEntityName(media_, "rockchip-sy-mipi-dphy");
if (dphy_->open() < 0)
return false;
- isp_ = V4L2Subdevice::fromEntityName(media_.get(), "rkisp1-isp-subdev");
+ isp_ = V4L2Subdevice::fromEntityName(media_, "rkisp1-isp-subdev");
if (isp_->open() < 0)
return false;
/* Locate and open the capture video node. */
- video_ = V4L2Device::fromEntityName(media_.get(), "rkisp1_mainpath");
+ video_ = V4L2Device::fromEntityName(media_, "rkisp1_mainpath");
if (video_->open() < 0)
return false;