libcamera: pipeline_handler: Store the camera manager pointer

Instead of passing the camera manager pointer to the match() function,
and later to more PipelineHandler functions, store it in the
PipelineHandler::manager_ member variable at construction time and
access it from there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-01-23 21:53:17 +02:00
parent eb1ecc92ce
commit e597598abf
6 changed files with 66 additions and 36 deletions

View file

@ -17,17 +17,17 @@ namespace libcamera {
class PipeHandlerVimc : public PipelineHandler
{
public:
PipeHandlerVimc();
PipeHandlerVimc(CameraManager *manager);
~PipeHandlerVimc();
bool match(CameraManager *manager, DeviceEnumerator *enumerator);
bool match(DeviceEnumerator *enumerator);
private:
MediaDevice *dev_;
};
PipeHandlerVimc::PipeHandlerVimc()
: dev_(nullptr)
PipeHandlerVimc::PipeHandlerVimc(CameraManager *manager)
: PipelineHandler(manager), dev_(nullptr)
{
}
@ -37,7 +37,7 @@ PipeHandlerVimc::~PipeHandlerVimc()
dev_->release();
}
bool PipeHandlerVimc::match(CameraManager *manager, DeviceEnumerator *enumerator)
bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
{
DeviceMatch dm("vimc");
@ -65,7 +65,7 @@ bool PipeHandlerVimc::match(CameraManager *manager, DeviceEnumerator *enumerator
* object is modeled.
*/
std::shared_ptr<Camera> camera = Camera::create("Dummy VIMC Camera");
manager->addCamera(std::move(camera));
manager_->addCamera(std::move(camera));
return true;
}