summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/vimc.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-01-03 13:10:37 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-01-21 11:13:49 +0200
commitf3695e9b09ce4a88d6e0480d9e5058673af34a49 (patch)
tree804d52f7b54c2add621f317fd13529d1d27bb17b /src/libcamera/pipeline/vimc.cpp
parent32bf7ef239c1310fba638f35046b0f7eb13b32bf (diff)
libcamera: camera_manager: Register cameras with the camera manager
Cameras are listed through a double indirection, first iterating over all available pipeline handlers, and then listing the cameras they each support. To simplify the API make the pipeline handlers register the cameras with the camera manager directly, which lets the camera manager easily expose the list of all available cameras. The PipelineHandler API gets simplified as the handlers don't need to expose the list of cameras they have created. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/pipeline/vimc.cpp')
-rw-r--r--src/libcamera/pipeline/vimc.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index 720d9c20..8742e0ba 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -6,6 +6,7 @@
*/
#include <libcamera/camera.h>
+#include <libcamera/camera_manager.h>
#include "device_enumerator.h"
#include "media_device.h"
@@ -19,44 +20,24 @@ public:
PipeHandlerVimc();
~PipeHandlerVimc();
- bool match(DeviceEnumerator *enumerator);
-
- unsigned int count();
- Camera *camera(unsigned int id) final;
+ bool match(CameraManager *manager, DeviceEnumerator *enumerator);
private:
MediaDevice *dev_;
- Camera *camera_;
};
PipeHandlerVimc::PipeHandlerVimc()
- : dev_(nullptr), camera_(nullptr)
+ : dev_(nullptr)
{
}
PipeHandlerVimc::~PipeHandlerVimc()
{
- if (camera_)
- camera_->put();
-
if (dev_)
dev_->release();
}
-unsigned int PipeHandlerVimc::count()
-{
- return 1;
-}
-
-Camera *PipeHandlerVimc::camera(unsigned int id)
-{
- if (id != 0)
- return nullptr;
-
- return camera_;
-}
-
-bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
+bool PipeHandlerVimc::match(CameraManager *manager, DeviceEnumerator *enumerator)
{
DeviceMatch dm("vimc");
@@ -83,7 +64,8 @@ bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
* will be chosen depends on how the Camera
* object is modeled.
*/
- camera_ = new Camera("Dummy VIMC Camera");
+ Camera *camera = new Camera("Dummy VIMC Camera");
+ manager->addCamera(camera);
return true;
}