[libcamera-devel] [RFC 06/11] libcamera: pipeline_handler: Keep track of MediaDevice

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Apr 29 20:30:18 CEST 2019


Hi Laurent,

Thanks for your feedback.

On 2019-04-17 13:49:15 +0300, Laurent Pinchart wrote:
> > diff --git a/src/libcamera/include/pipeline_handler.h 
> > b/src/libcamera/include/pipeline_handler.h
> > index b6cbd3bae51b08dc..d995a7e56d90f706 100644
> > --- a/src/libcamera/include/pipeline_handler.h
> > +++ b/src/libcamera/include/pipeline_handler.h
> > @@ -21,6 +21,7 @@ class Camera;
> >  class CameraConfiguration;
> >  class CameraManager;
> >  class DeviceEnumerator;
> > +class DeviceMatch;
> >  class MediaDevice;
> >  class PipelineHandler;
> >  class Request;
> > @@ -52,6 +53,8 @@ public:
> >  	virtual ~PipelineHandler();
> >  
> >  	virtual bool match(DeviceEnumerator *enumerator) = 0;
> > +	std::shared_ptr<MediaDevice> tryAcquire(DeviceEnumerator *enumerator,
> > +						const DeviceMatch &dm);
> 
> Given that this function stores a reference internally in
> PipelineHandler, which is guaranteed to remain valid until the pipeline
> handler is destroyed, can't we return a MediaDevice * instead of a
> shared pointer ?

We could do that, this would make pipeline handler implementations a tad 
more simple as they no longer need to store a shared_ptr<> for the media 
devices it needs to use during it's lifetime. 

Thanks for pointing this out!

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list