Message ID | 20190219165620.2385-4-jacopo@jmondi.org |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, Thanks for your patch. On 2019-02-19 17:56:20 +0100, Jacopo Mondi wrote: > Add support for devices that provides video meta-data to v4l2_device.cpp > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > src/libcamera/include/v4l2_device.h | 4 ++++ > src/libcamera/v4l2_device.cpp | 12 ++++++++++-- > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h > index 1d31d1b403bc..52eb6785cc15 100644 > --- a/src/libcamera/include/v4l2_device.h > +++ b/src/libcamera/include/v4l2_device.h > @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability { > return device_caps() & (V4L2_CAP_VIDEO_CAPTURE | > V4L2_CAP_VIDEO_CAPTURE_MPLANE); > } > + bool isMeta() const > + { > + return device_caps() & V4L2_CAP_META_CAPTURE; > + } > bool isOutput() const > { > return device_caps() & (V4L2_CAP_VIDEO_OUTPUT | > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp > index 24e115554a99..7fe6476bf035 100644 > --- a/src/libcamera/v4l2_device.cpp > +++ b/src/libcamera/v4l2_device.cpp > @@ -79,6 +79,12 @@ LOG_DEFINE_CATEGORY(V4L2) > * \return True if the device can output video frames > */ > > +/** > + * \fn bool V4L2Capability::isMeta() > + * \brief Identify if the device is capable of providing video meta-data > + * \return True if the device can provide video meta-data > + */ > + > /** > * \fn bool V4L2Capability::hasStreaming() > * \brief Determine if the device can perform Streaming I/O > @@ -280,7 +286,7 @@ int V4L2Device::open() > << "Opened device " << caps_.bus_info() << ": " > << caps_.driver() << ": " << caps_.card(); > > - if (!caps_.isCapture() && !caps_.isOutput()) { > + if (!caps_.isCapture() && !caps_.isOutput() && !caps_.isMeta()) { > LOG(V4L2, Debug) << "Device is not a supported type"; > return -EINVAL; > } > @@ -294,10 +300,12 @@ int V4L2Device::open() > bufferType_ = caps_.isMultiplanar() > ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE > : V4L2_BUF_TYPE_VIDEO_CAPTURE; > - else > + else if (caps_.isOutput()) > bufferType_ = caps_.isMultiplanar() > ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE > : V4L2_BUF_TYPE_VIDEO_OUTPUT; > + else > + bufferType_ = V4L2_BUF_TYPE_META_CAPTURE; I would rearrange all changes in this patch to V4L2Device::open() into something like this if (!caps_.hasStreaming()) { ... } if (caps_.isCapture()) bufferType_ = ... else if (caps_.isOutput()) bufferType_ = ... else if (caps_.isMeta()) bufferType_ = ... else { LOG(V4L2, Debug) << "Device is not a supported type"; return -EINVAL; } It would eliminate the current practise of checking the same thing twice in the same function. There might be bonus points if you can figure out a nice way to turn it into a switch statement ;-) > > /* > * We wait for Read notifications on CAPTURE devices (POLLIN), and > -- > 2.20.1 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Jacopo, Thank you for the patch. On Tue, Feb 19, 2019 at 05:56:20PM +0100, Jacopo Mondi wrote: > Add support for devices that provides video meta-data to v4l2_device.cpp s/provides/provide/ s/to v4l2_device.cpp/to the V4L2Device class/ or just drop this part > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > src/libcamera/include/v4l2_device.h | 4 ++++ > src/libcamera/v4l2_device.cpp | 12 ++++++++++-- > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h > index 1d31d1b403bc..52eb6785cc15 100644 > --- a/src/libcamera/include/v4l2_device.h > +++ b/src/libcamera/include/v4l2_device.h > @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability { > return device_caps() & (V4L2_CAP_VIDEO_CAPTURE | > V4L2_CAP_VIDEO_CAPTURE_MPLANE); > } > + bool isMeta() const > + { > + return device_caps() & V4L2_CAP_META_CAPTURE; How about META_OUTPUT ? We will need that for the ImgU parameters. It would make sense to have 4 helpers, isVideo(), isMeta(), isCapture(), isOutput(). > + } > bool isOutput() const > { > return device_caps() & (V4L2_CAP_VIDEO_OUTPUT | > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp > index 24e115554a99..7fe6476bf035 100644 > --- a/src/libcamera/v4l2_device.cpp > +++ b/src/libcamera/v4l2_device.cpp > @@ -79,6 +79,12 @@ LOG_DEFINE_CATEGORY(V4L2) > * \return True if the device can output video frames > */ > > +/** > + * \fn bool V4L2Capability::isMeta() > + * \brief Identify if the device is capable of providing video meta-data > + * \return True if the device can provide video meta-data > + */ > + > /** > * \fn bool V4L2Capability::hasStreaming() > * \brief Determine if the device can perform Streaming I/O > @@ -280,7 +286,7 @@ int V4L2Device::open() > << "Opened device " << caps_.bus_info() << ": " > << caps_.driver() << ": " << caps_.card(); > > - if (!caps_.isCapture() && !caps_.isOutput()) { > + if (!caps_.isCapture() && !caps_.isOutput() && !caps_.isMeta()) { > LOG(V4L2, Debug) << "Device is not a supported type"; > return -EINVAL; > } > @@ -294,10 +300,12 @@ int V4L2Device::open() > bufferType_ = caps_.isMultiplanar() > ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE > : V4L2_BUF_TYPE_VIDEO_CAPTURE; > - else > + else if (caps_.isOutput()) > bufferType_ = caps_.isMultiplanar() > ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE > : V4L2_BUF_TYPE_VIDEO_OUTPUT; > + else > + bufferType_ = V4L2_BUF_TYPE_META_CAPTURE; > > /* > * We wait for Read notifications on CAPTURE devices (POLLIN), and
HI Laurent, On Fri, Feb 22, 2019 at 01:22:37AM +0200, Laurent Pinchart wrote: > Hi Jacopo, > > Thank you for the patch. > > On Tue, Feb 19, 2019 at 05:56:20PM +0100, Jacopo Mondi wrote: > > Add support for devices that provides video meta-data to v4l2_device.cpp > > s/provides/provide/ > s/to v4l2_device.cpp/to the V4L2Device class/ or just drop this part > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > --- > > src/libcamera/include/v4l2_device.h | 4 ++++ > > src/libcamera/v4l2_device.cpp | 12 ++++++++++-- > > 2 files changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h > > index 1d31d1b403bc..52eb6785cc15 100644 > > --- a/src/libcamera/include/v4l2_device.h > > +++ b/src/libcamera/include/v4l2_device.h > > @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability { > > return device_caps() & (V4L2_CAP_VIDEO_CAPTURE | > > V4L2_CAP_VIDEO_CAPTURE_MPLANE); > > } > > + bool isMeta() const > > + { > > + return device_caps() & V4L2_CAP_META_CAPTURE; > > How about META_OUTPUT ? We will need that for the ImgU parameters. It > would make sense to have 4 helpers, isVideo(), isMeta(), isCapture(), > isOutput(). > META_OUTPUT went in in v4.20, our headers come from v4.19 iirc > > + } > > bool isOutput() const > > { > > return device_caps() & (V4L2_CAP_VIDEO_OUTPUT | > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp > > index 24e115554a99..7fe6476bf035 100644 > > --- a/src/libcamera/v4l2_device.cpp > > +++ b/src/libcamera/v4l2_device.cpp > > @@ -79,6 +79,12 @@ LOG_DEFINE_CATEGORY(V4L2) > > * \return True if the device can output video frames > > */ > > > > +/** > > + * \fn bool V4L2Capability::isMeta() > > + * \brief Identify if the device is capable of providing video meta-data > > + * \return True if the device can provide video meta-data > > + */ > > + > > /** > > * \fn bool V4L2Capability::hasStreaming() > > * \brief Determine if the device can perform Streaming I/O > > @@ -280,7 +286,7 @@ int V4L2Device::open() > > << "Opened device " << caps_.bus_info() << ": " > > << caps_.driver() << ": " << caps_.card(); > > > > - if (!caps_.isCapture() && !caps_.isOutput()) { > > + if (!caps_.isCapture() && !caps_.isOutput() && !caps_.isMeta()) { > > LOG(V4L2, Debug) << "Device is not a supported type"; > > return -EINVAL; > > } > > @@ -294,10 +300,12 @@ int V4L2Device::open() > > bufferType_ = caps_.isMultiplanar() > > ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE > > : V4L2_BUF_TYPE_VIDEO_CAPTURE; > > - else > > + else if (caps_.isOutput()) > > bufferType_ = caps_.isMultiplanar() > > ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE > > : V4L2_BUF_TYPE_VIDEO_OUTPUT; > > + else > > + bufferType_ = V4L2_BUF_TYPE_META_CAPTURE; > > > > /* > > * We wait for Read notifications on CAPTURE devices (POLLIN), and > > -- > Regards, > > Laurent Pinchart
Hi Jacopo, On Mon, Feb 25, 2019 at 10:31:13AM +0100, Jacopo Mondi wrote: > On Fri, Feb 22, 2019 at 01:22:37AM +0200, Laurent Pinchart wrote: > > On Tue, Feb 19, 2019 at 05:56:20PM +0100, Jacopo Mondi wrote: > >> Add support for devices that provides video meta-data to v4l2_device.cpp > > > > s/provides/provide/ > > s/to v4l2_device.cpp/to the V4L2Device class/ or just drop this part > > > >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > >> --- > >> src/libcamera/include/v4l2_device.h | 4 ++++ > >> src/libcamera/v4l2_device.cpp | 12 ++++++++++-- > >> 2 files changed, 14 insertions(+), 2 deletions(-) > >> > >> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h > >> index 1d31d1b403bc..52eb6785cc15 100644 > >> --- a/src/libcamera/include/v4l2_device.h > >> +++ b/src/libcamera/include/v4l2_device.h > >> @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability { > >> return device_caps() & (V4L2_CAP_VIDEO_CAPTURE | > >> V4L2_CAP_VIDEO_CAPTURE_MPLANE); > >> } > >> + bool isMeta() const > >> + { > >> + return device_caps() & V4L2_CAP_META_CAPTURE; > > > > How about META_OUTPUT ? We will need that for the ImgU parameters. It > > would make sense to have 4 helpers, isVideo(), isMeta(), isCapture(), > > isOutput(). > > > > META_OUTPUT went in in v4.20, our headers come from v4.19 iirc Feel free to update them :-) Doesn't the IPU3 parameters queue use META_OUTPUT ? > >> + } > >> bool isOutput() const > >> { > >> return device_caps() & (V4L2_CAP_VIDEO_OUTPUT | > >> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp > >> index 24e115554a99..7fe6476bf035 100644 > >> --- a/src/libcamera/v4l2_device.cpp > >> +++ b/src/libcamera/v4l2_device.cpp > >> @@ -79,6 +79,12 @@ LOG_DEFINE_CATEGORY(V4L2) > >> * \return True if the device can output video frames > >> */ > >> > >> +/** > >> + * \fn bool V4L2Capability::isMeta() > >> + * \brief Identify if the device is capable of providing video meta-data > >> + * \return True if the device can provide video meta-data > >> + */ > >> + > >> /** > >> * \fn bool V4L2Capability::hasStreaming() > >> * \brief Determine if the device can perform Streaming I/O > >> @@ -280,7 +286,7 @@ int V4L2Device::open() > >> << "Opened device " << caps_.bus_info() << ": " > >> << caps_.driver() << ": " << caps_.card(); > >> > >> - if (!caps_.isCapture() && !caps_.isOutput()) { > >> + if (!caps_.isCapture() && !caps_.isOutput() && !caps_.isMeta()) { > >> LOG(V4L2, Debug) << "Device is not a supported type"; > >> return -EINVAL; > >> } > >> @@ -294,10 +300,12 @@ int V4L2Device::open() > >> bufferType_ = caps_.isMultiplanar() > >> ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE > >> : V4L2_BUF_TYPE_VIDEO_CAPTURE; > >> - else > >> + else if (caps_.isOutput()) > >> bufferType_ = caps_.isMultiplanar() > >> ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE > >> : V4L2_BUF_TYPE_VIDEO_OUTPUT; > >> + else > >> + bufferType_ = V4L2_BUF_TYPE_META_CAPTURE; > >> > >> /* > >> * We wait for Read notifications on CAPTURE devices (POLLIN), and
Hi Laurent, an update on the META_OUTPUT thing On Mon, Feb 25, 2019 at 09:49:39PM +0200, Laurent Pinchart wrote: > Hi Jacopo, > > On Mon, Feb 25, 2019 at 10:31:13AM +0100, Jacopo Mondi wrote: > > On Fri, Feb 22, 2019 at 01:22:37AM +0200, Laurent Pinchart wrote: > > > On Tue, Feb 19, 2019 at 05:56:20PM +0100, Jacopo Mondi wrote: > > >> Add support for devices that provides video meta-data to v4l2_device.cpp > > > > > > s/provides/provide/ > > > s/to v4l2_device.cpp/to the V4L2Device class/ or just drop this part > > > > > >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > >> --- > > >> src/libcamera/include/v4l2_device.h | 4 ++++ > > >> src/libcamera/v4l2_device.cpp | 12 ++++++++++-- > > >> 2 files changed, 14 insertions(+), 2 deletions(-) > > >> > > >> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h > > >> index 1d31d1b403bc..52eb6785cc15 100644 > > >> --- a/src/libcamera/include/v4l2_device.h > > >> +++ b/src/libcamera/include/v4l2_device.h > > >> @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability { > > >> return device_caps() & (V4L2_CAP_VIDEO_CAPTURE | > > >> V4L2_CAP_VIDEO_CAPTURE_MPLANE); > > >> } > > >> + bool isMeta() const > > >> + { > > >> + return device_caps() & V4L2_CAP_META_CAPTURE; > > > > > > How about META_OUTPUT ? We will need that for the ImgU parameters. It > > > would make sense to have 4 helpers, isVideo(), isMeta(), isCapture(), > > > isOutput(). > > > > > > > META_OUTPUT went in in v4.20, our headers come from v4.19 iirc > I was wrong. The the patch that introduces META_OUTPUT went in in v4.20-7 in the media tree, but hit Linus' tree in the 5.0 merge window. > Feel free to update them :-) Doesn't the IPU3 parameters queue use > META_OUTPUT ? I would wait another week or so and update headers to the 5.0 version, once v5.0 is released. It's not blocking IPU3 support anyway. Thanks j > > > >> + } > > >> bool isOutput() const > > >> { > > >> return device_caps() & (V4L2_CAP_VIDEO_OUTPUT | > > >> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp > > >> index 24e115554a99..7fe6476bf035 100644 > > >> --- a/src/libcamera/v4l2_device.cpp > > >> +++ b/src/libcamera/v4l2_device.cpp > > >> @@ -79,6 +79,12 @@ LOG_DEFINE_CATEGORY(V4L2) > > >> * \return True if the device can output video frames > > >> */ > > >> > > >> +/** > > >> + * \fn bool V4L2Capability::isMeta() > > >> + * \brief Identify if the device is capable of providing video meta-data > > >> + * \return True if the device can provide video meta-data > > >> + */ > > >> + > > >> /** > > >> * \fn bool V4L2Capability::hasStreaming() > > >> * \brief Determine if the device can perform Streaming I/O > > >> @@ -280,7 +286,7 @@ int V4L2Device::open() > > >> << "Opened device " << caps_.bus_info() << ": " > > >> << caps_.driver() << ": " << caps_.card(); > > >> > > >> - if (!caps_.isCapture() && !caps_.isOutput()) { > > >> + if (!caps_.isCapture() && !caps_.isOutput() && !caps_.isMeta()) { > > >> LOG(V4L2, Debug) << "Device is not a supported type"; > > >> return -EINVAL; > > >> } > > >> @@ -294,10 +300,12 @@ int V4L2Device::open() > > >> bufferType_ = caps_.isMultiplanar() > > >> ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE > > >> : V4L2_BUF_TYPE_VIDEO_CAPTURE; > > >> - else > > >> + else if (caps_.isOutput()) > > >> bufferType_ = caps_.isMultiplanar() > > >> ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE > > >> : V4L2_BUF_TYPE_VIDEO_OUTPUT; > > >> + else > > >> + bufferType_ = V4L2_BUF_TYPE_META_CAPTURE; > > >> > > >> /* > > >> * We wait for Read notifications on CAPTURE devices (POLLIN), and > > -- > Regards, > > Laurent Pinchart
Hi Jacopo, On Tue, Feb 26, 2019 at 11:04:41AM +0100, Jacopo Mondi wrote: > On Mon, Feb 25, 2019 at 09:49:39PM +0200, Laurent Pinchart wrote: > > On Mon, Feb 25, 2019 at 10:31:13AM +0100, Jacopo Mondi wrote: > >> On Fri, Feb 22, 2019 at 01:22:37AM +0200, Laurent Pinchart wrote: > >>> On Tue, Feb 19, 2019 at 05:56:20PM +0100, Jacopo Mondi wrote: > >>>> Add support for devices that provides video meta-data to v4l2_device.cpp > >>> > >>> s/provides/provide/ > >>> s/to v4l2_device.cpp/to the V4L2Device class/ or just drop this part > >>> > >>>> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > >>>> --- > >>>> src/libcamera/include/v4l2_device.h | 4 ++++ > >>>> src/libcamera/v4l2_device.cpp | 12 ++++++++++-- > >>>> 2 files changed, 14 insertions(+), 2 deletions(-) > >>>> > >>>> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h > >>>> index 1d31d1b403bc..52eb6785cc15 100644 > >>>> --- a/src/libcamera/include/v4l2_device.h > >>>> +++ b/src/libcamera/include/v4l2_device.h > >>>> @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability { > >>>> return device_caps() & (V4L2_CAP_VIDEO_CAPTURE | > >>>> V4L2_CAP_VIDEO_CAPTURE_MPLANE); > >>>> } > >>>> + bool isMeta() const > >>>> + { > >>>> + return device_caps() & V4L2_CAP_META_CAPTURE; > >>> > >>> How about META_OUTPUT ? We will need that for the ImgU parameters. It > >>> would make sense to have 4 helpers, isVideo(), isMeta(), isCapture(), > >>> isOutput(). > >> > >> META_OUTPUT went in in v4.20, our headers come from v4.19 iirc > > I was wrong. The the patch that introduces META_OUTPUT went in in > v4.20-7 in the media tree, but hit Linus' tree in the 5.0 merge > window. Indeed, my bad. > > Feel free to update them :-) Doesn't the IPU3 parameters queue use > > META_OUTPUT ? > > I would wait another week or so and update headers to the 5.0 version, > once v5.0 is released. That's fine with me, but you'll have to change the API introduced by this patch, and may fail to catch all required changes, so there's a small risk of introducting a bug. Up to you, but I don't think the V4L2 headers will change between v5.0-rc8 and v5.0, so updating them doesn't seem to be a problem to me. > It's not blocking IPU3 support anyway. > > >>>> + } > >>>> bool isOutput() const > >>>> { > >>>> return device_caps() & (V4L2_CAP_VIDEO_OUTPUT | > >>>> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp > >>>> index 24e115554a99..7fe6476bf035 100644 > >>>> --- a/src/libcamera/v4l2_device.cpp > >>>> +++ b/src/libcamera/v4l2_device.cpp > >>>> @@ -79,6 +79,12 @@ LOG_DEFINE_CATEGORY(V4L2) > >>>> * \return True if the device can output video frames > >>>> */ > >>>> > >>>> +/** > >>>> + * \fn bool V4L2Capability::isMeta() > >>>> + * \brief Identify if the device is capable of providing video meta-data > >>>> + * \return True if the device can provide video meta-data > >>>> + */ > >>>> + > >>>> /** > >>>> * \fn bool V4L2Capability::hasStreaming() > >>>> * \brief Determine if the device can perform Streaming I/O > >>>> @@ -280,7 +286,7 @@ int V4L2Device::open() > >>>> << "Opened device " << caps_.bus_info() << ": " > >>>> << caps_.driver() << ": " << caps_.card(); > >>>> > >>>> - if (!caps_.isCapture() && !caps_.isOutput()) { > >>>> + if (!caps_.isCapture() && !caps_.isOutput() && !caps_.isMeta()) { > >>>> LOG(V4L2, Debug) << "Device is not a supported type"; > >>>> return -EINVAL; > >>>> } > >>>> @@ -294,10 +300,12 @@ int V4L2Device::open() > >>>> bufferType_ = caps_.isMultiplanar() > >>>> ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE > >>>> : V4L2_BUF_TYPE_VIDEO_CAPTURE; > >>>> - else > >>>> + else if (caps_.isOutput()) > >>>> bufferType_ = caps_.isMultiplanar() > >>>> ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE > >>>> : V4L2_BUF_TYPE_VIDEO_OUTPUT; > >>>> + else > >>>> + bufferType_ = V4L2_BUF_TYPE_META_CAPTURE; > >>>> > >>>> /* > >>>> * We wait for Read notifications on CAPTURE devices (POLLIN), and
diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h index 1d31d1b403bc..52eb6785cc15 100644 --- a/src/libcamera/include/v4l2_device.h +++ b/src/libcamera/include/v4l2_device.h @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability { return device_caps() & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE); } + bool isMeta() const + { + return device_caps() & V4L2_CAP_META_CAPTURE; + } bool isOutput() const { return device_caps() & (V4L2_CAP_VIDEO_OUTPUT | diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 24e115554a99..7fe6476bf035 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -79,6 +79,12 @@ LOG_DEFINE_CATEGORY(V4L2) * \return True if the device can output video frames */ +/** + * \fn bool V4L2Capability::isMeta() + * \brief Identify if the device is capable of providing video meta-data + * \return True if the device can provide video meta-data + */ + /** * \fn bool V4L2Capability::hasStreaming() * \brief Determine if the device can perform Streaming I/O @@ -280,7 +286,7 @@ int V4L2Device::open() << "Opened device " << caps_.bus_info() << ": " << caps_.driver() << ": " << caps_.card(); - if (!caps_.isCapture() && !caps_.isOutput()) { + if (!caps_.isCapture() && !caps_.isOutput() && !caps_.isMeta()) { LOG(V4L2, Debug) << "Device is not a supported type"; return -EINVAL; } @@ -294,10 +300,12 @@ int V4L2Device::open() bufferType_ = caps_.isMultiplanar() ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : V4L2_BUF_TYPE_VIDEO_CAPTURE; - else + else if (caps_.isOutput()) bufferType_ = caps_.isMultiplanar() ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : V4L2_BUF_TYPE_VIDEO_OUTPUT; + else + bufferType_ = V4L2_BUF_TYPE_META_CAPTURE; /* * We wait for Read notifications on CAPTURE devices (POLLIN), and
Add support for devices that provides video meta-data to v4l2_device.cpp Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/libcamera/include/v4l2_device.h | 4 ++++ src/libcamera/v4l2_device.cpp | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-)