[PATCH 2/2] libcamera: Add Unsigned 16-bits Control Type

Kieran Bingham kieran.bingham at ideasonboard.com
Tue Oct 22 12:20:48 CEST 2024


Quoting Cheng-Hao Yang (2024-10-22 10:51:09)
> Hi Kieran,
> 
> On Tue, Oct 22, 2024 at 12:27 AM Kieran Bingham
> <kieran.bingham at ideasonboard.com> wrote:
> >
> > Quoting Harvey Yang (2024-10-11 18:55:12)
> > > From: Yudhistira Erlandinata <yerlandinata at google.com>
> > >
> > > Some camera metadata is of length 16-bits,
> > > for example JPEG metadata headers.
> > >
> > > Signed-off-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
> > > Co-developed-by: Harvey Yang <chenghaoyang at chromium.org>
> > > Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>
> > > ---
> > >  include/libcamera/controls.h  | 6 ++++++
> > >  src/libcamera/controls.cpp    | 8 ++++++++
> > >  src/libcamera/v4l2_device.cpp | 9 +++++++++
> > >  3 files changed, 23 insertions(+)
> > >
> > > diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> > > index 25f68040d..1987ca5f5 100644
> > > --- a/include/libcamera/controls.h
> > > +++ b/include/libcamera/controls.h
> > > @@ -29,6 +29,7 @@ enum ControlType {
> > >         ControlTypeNone,
> > >         ControlTypeBool,
> > >         ControlTypeByte,
> > > +       ControlTypeUnsigned16,
> > >         ControlTypeUnsigned32,
> > >         ControlTypeInteger32,
> > >         ControlTypeInteger64,
> > > @@ -63,6 +64,11 @@ struct control_type<uint8_t> {
> > >         static constexpr std::size_t size = 0;
> > >  };
> > >
> > > +template<>
> > > +struct control_type<uint16_t> {
> > > +       static constexpr ControlType value = ControlTypeUnsigned16;
> >
> > Does this also need to set the size? What is size - why is it always
> > zero?
> 
> Yes, you're right.
> 
> I think it's the default value for the potential array size:
> https://git.libcamera.org/libcamera/libcamera.git/commit/?id=ab67fdd210e30ad3806f10cb5f6d4e325059f8de
> 

Aha, thanks - that's where it's from...

--
Kieran


More information about the libcamera-devel mailing list