[libcamera-devel] [PATCH 1/3] libcamera: request: Mark metadata() and controls() as const

Jacopo Mondi jacopo at jmondi.org
Thu Dec 10 10:43:08 CET 2020


Hi Kieran

On Thu, Dec 10, 2020 at 09:35:16AM +0000, Kieran Bingham wrote:
> Hi Jacopo,
>
> On 09/12/2020 17:35, Jacopo Mondi wrote:
> > Mark the metadata() and controls() operations as const function to make
> > it possible to retrieve them from const Request instances.
> >
>
> Is this accurate? How do applications set controls on the request if
> it's const? (before queueing it)

Probably from a 'const Request' you should only be able to get a
'const ControlList &' ?

>
> Or is that done somewhere else?
>
> Metadata certainly seems like it should be const though...

Happy to drop the const for controls(). I added it there expecting
some questions :)

>
> --
> Kieran
>
>
> > Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> > ---
> >  include/libcamera/request.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> > index 655b1324bae8..1a89622ab989 100644
> > --- a/include/libcamera/request.h
> > +++ b/include/libcamera/request.h
> > @@ -45,8 +45,8 @@ public:
> >
> >  	void reuse(ReuseFlag flags = Default);
> >
> > -	ControlList &controls() { return *controls_; }
> > -	ControlList &metadata() { return *metadata_; }
> > +	ControlList &controls() const { return *controls_; }
> > +	ControlList &metadata() const { return *metadata_; }
> >  	const BufferMap &buffers() const { return bufferMap_; }
> >  	int addBuffer(const Stream *stream, FrameBuffer *buffer);
> >  	FrameBuffer *findBuffer(const Stream *stream) const;
> >
>
> --
> Regards
> --
> Kieran


More information about the libcamera-devel mailing list