Re: [PATCH v12 08/15] media: uapi: Define audio sample format fourcc type

From: Mauro Carvalho Chehab
Date: Sat Feb 17 2024 - 04:19:46 EST


Em Thu, 18 Jan 2024 20:32:01 +0800
Shengjiu Wang <shengjiu.wang@xxxxxxx> escreveu:

> The audio sample format definition is from alsa,
> the header file is include/uapi/sound/asound.h, but
> don't include this header file directly, because in
> user space, there is another copy in alsa-lib.
> There will be conflict in userspace for include
> videodev2.h & asound.h and asoundlib.h
>
> Here still use the fourcc format.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@xxxxxxx>
> ---
> .../userspace-api/media/v4l/pixfmt-audio.rst | 87 +++++++++++++++++++
> .../userspace-api/media/v4l/pixfmt.rst | 1 +
> drivers/media/v4l2-core/v4l2-ioctl.c | 13 +++
> include/uapi/linux/videodev2.h | 23 +++++
> 4 files changed, 124 insertions(+)
> create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-audio.rst
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-audio.rst b/Documentation/userspace-api/media/v4l/pixfmt-audio.rst
> new file mode 100644
> index 000000000000..04b4a7fbd8f4
> --- /dev/null
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-audio.rst
> @@ -0,0 +1,87 @@
> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> +
> +.. _pixfmt-audio:
> +
> +*************
> +Audio Formats
> +*************
> +
> +These formats are used for :ref:`audiomem2mem` interface only.
> +
> +.. tabularcolumns:: |p{5.8cm}|p{1.2cm}|p{10.3cm}|
> +
> +.. cssclass:: longtable
> +
> +.. flat-table:: Audio Format
> + :header-rows: 1
> + :stub-columns: 0
> + :widths: 3 1 4
> +
> + * - Identifier
> + - Code
> + - Details
> + * .. _V4L2-AUDIO-FMT-S8:
> +
> + - ``V4L2_AUDIO_FMT_S8``
> + - 'S8'
> + - Corresponds to SNDRV_PCM_FORMAT_S8 in ALSA
> + * .. _V4L2-AUDIO-FMT-S16-LE:

Hmm... why can't we just use SNDRV_*_FORMAT_*? Those are already part of
an uAPI header. No need to add any abstraction here and/or redefine
what is there already at include/uapi/sound/asound.h.

Thanks,
Mauro