On 09/13/18 13:29, Oleksandr Andrushchenko wrote:
> Hi, all!
>
> Is there a way in V4L2 to get number of planes from fourcc code
>
> or specifically I need number of planes for a given pixel format
>
> expressed as V4L2_PIX_FMT_* value.
Sadly not. It's part of the documentation for the formats, but there
is no naming scheme through which you can deduce this or even helper
functions for it.
I think the main reason why this never happened is that drivers tend to
have custom code for this anyway.
I have proposed in the past that some of this information is exposed
via VIDIOC_ENUM_FMT, but it never got traction.
> I know that DRM has such a helper [1], but I am not quite sure
>
> if I can call it with V4L2_PIX_FMT_* as argument to get what I need.
>
> I am a bit confused here because there are different definitions
>
> for DRM [2] and V4L2 [3].
I know. Each subsystem has traditionally been assigning fourccs independently.
In all fairness, this seems to be the case for fourccs throughout the whole
industry.
Regards,
Hans
>
> Thank you,
>
> Oleksandr
>
> [1]
> https://elixir.bootlin.com/linux/v4.19-rc3/source/drivers/gpu/drm/drm_fourcc.c#L199
>
> [2]
> https://elixir.bootlin.com/linux/v4.19-rc3/source/include/uapi/drm/drm_fourcc.h
>
> [3]
> https://elixir.bootlin.com/linux/v4.19-rc3/source/include/uapi/linux/videodev2.h
>