[libcamera-devel] [PATCH] libcamera: v4l2_videodevice: provide hasMediaController()

Naushir Patuck naush at raspberrypi.com
Wed Oct 27 14:33:07 CEST 2021


Hi Kieran,

Thank you for your patch.

On Wed, 27 Oct 2021 at 13:07, Kieran Bingham <
kieran.bingham at ideasonboard.com> wrote:

> The V4L2Capability has helpers to interogate the capabilities
> of a device.
>
> V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check
> if the device is supported by a MediaController device.
>
> Provide a helper, and update the usage.
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>


Just what I needed :-)
Reviewed-by: Naushir Patuck <naush at raspberrypi.com>



>
> ---
> This might also be used in the upcoming RPi MediaController series, but
> shouldn't block integration of that ...
> ---
>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++
>  src/libcamera/v4l2_videodevice.cpp            | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/libcamera/internal/v4l2_videodevice.h
> b/include/libcamera/internal/v4l2_videodevice.h
> index efe34d47e72b..a1c458e45088 100644
> --- a/include/libcamera/internal/v4l2_videodevice.h
> +++ b/include/libcamera/internal/v4l2_videodevice.h
> @@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability {
>         {
>                 return device_caps() & V4L2_CAP_STREAMING;
>         }
> +       bool hasMediaController() const
> +       {
> +               return device_caps() & V4L2_CAP_IO_MC;
> +       }
>  };
>
>  class V4L2BufferCache
> diff --git a/src/libcamera/v4l2_videodevice.cpp
> b/src/libcamera/v4l2_videodevice.cpp
> index 0cc622f91f2d..0fbf32bcfc00 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -1019,7 +1019,7 @@ std::vector<V4L2PixelFormat>
> V4L2VideoDevice::enumPixelformats(uint32_t code)
>         std::vector<V4L2PixelFormat> formats;
>         int ret;
>
> -       if (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) {
> +       if (code && !(caps_.hasMediaController())) {
>                 LOG(V4L2, Error)
>                         << "Media bus code filtering not supported by the
> device";
>                 return {};
> --
> 2.30.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20211027/4d6ac959/attachment.htm>


More information about the libcamera-devel mailing list