Hi Mauro
On Sat, Feb 17, 2024 at 5:19 PM Mauro Carvalho Chehab mchehab@kernel.org wrote:
Em Thu, 18 Jan 2024 20:32:01 +0800 Shengjiu Wang shengjiu.wang@nxp.com 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@nxp.com
.../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.
Actually I try to avoid including the include/uapi/sound/asound.h. Because in user space, there is another copy in alsa-lib (asoundlib.h). There will be conflict in userspace when including videodev2.h and asoundlib.h.
And in the V4l framework, the fourcc type is commonly used in other cases (video, radio, touch, meta....), to avoid changing common code a lot, so I think using fourcc definition for audio may be simpler.
Best regards Shengjiu Wang