diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2020-06-30 21:32:41 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-07-10 16:11:13 +0900 |
commit | 10d05404eb5b3941ef34dbdd901c61d302b421e0 (patch) | |
tree | 2177f635f480bae293ed1eb5721054159af01d58 /src | |
parent | a77e60bf7b7a1b2b3ef8192ce8d695c971fcf1ef (diff) |
libcamera: pipeline: raspberrypi: Acquire media devices with acquireMediaDevice
Media devices should be acquired by pipeline handlers via
PipelineHandler::acquireMediaDevice so that the media devices can be
registered in the pipeline handler so that they can be automatically
added to the devnum map for the v4l2 compatibility layer to use. Make
the raspberrypi pipeline handler do this.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 1c0000bc..cbb6f1c1 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -374,7 +374,6 @@ class PipelineHandlerRPi : public PipelineHandler { public: PipelineHandlerRPi(CameraManager *manager); - ~PipelineHandlerRPi(); CameraConfiguration *generateConfiguration(Camera *camera, const StreamRoles &roles) override; int configure(Camera *camera, CameraConfiguration *config) override; @@ -401,8 +400,8 @@ private: int prepareBuffers(Camera *camera); void freeBuffers(Camera *camera); - std::shared_ptr<MediaDevice> unicam_; - std::shared_ptr<MediaDevice> isp_; + MediaDevice *unicam_; + MediaDevice *isp_; }; RPiCameraConfiguration::RPiCameraConfiguration(const RPiCameraData *data) @@ -502,15 +501,6 @@ PipelineHandlerRPi::PipelineHandlerRPi(CameraManager *manager) { } -PipelineHandlerRPi::~PipelineHandlerRPi() -{ - if (unicam_) - unicam_->release(); - - if (isp_) - isp_->release(); -} - CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &roles) { @@ -895,17 +885,14 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) isp.add("bcm2835-isp0-capture2"); /* Output 1 */ isp.add("bcm2835-isp0-capture3"); /* Stats */ - unicam_ = enumerator->search(unicam); + unicam_ = acquireMediaDevice(enumerator, unicam); if (!unicam_) return false; - isp_ = enumerator->search(isp); + isp_ = acquireMediaDevice(enumerator, isp); if (!isp_) return false; - unicam_->acquire(); - isp_->acquire(); - std::unique_ptr<RPiCameraData> data = std::make_unique<RPiCameraData>(this); /* Locate and open the unicam video streams. */ |