Re: [RFC PATCH v3 6/9] media: v4l2: Add audio capture and output support

From: Sakari Ailus
Date: Tue Sep 19 2023 - 07:53:42 EST


Hi Shengjiu,

On Tue, Sep 19, 2023 at 06:31:09PM +0800, Shengjiu Wang wrote:

...

> > > +*************************
> > > +V4L2_AUDIO_FMT_LPCM ('LPCM')
> > > +*************************

Something to fix here, too...?

> > > +
> > > +Linear Pulse-Code Modulation (LPCM)
> > > +
> > > +
> > > +Description
> > > +===========
> > > +
> > > +This describes audio format used by the audio memory to memory driver.
> > > +
> > > +It contains the following fields:
> > > +
> > > +.. flat-table::
> > > + :widths: 1 4
> > > + :header-rows: 1
> > > + :stub-columns: 0
> > > +
> > > + * - Field
> > > + - Description
> > > + * - u32 samplerate;
> > > + - which is the number of times per second that samples are taken.
> > > + * - u32 sampleformat;
> > > + - which determines the number of possible digital values that can be used to represent each sample
> >
> > 80 characters (or less) per line, please.
>
> Ok, will change it.
>
> >
> > Which values could this field have and what do they signify?
>
> The values are SNDRV_PCM_FORMAT_S8, SNDRV_PCM_FORMAT_U8...
> which are the PCM format, defined in ALSA.

I suppose this is documented in ALSA documentation. Could you refer to
that?

>
> >
> > > + * - u32 channels;
> > > + - channel number for each sample.
> >
> > I suppose the rest of the buffer would be samples? This should be
> > documented. I think there are also different ways the data could be
> > arrangeed and this needs to be documented, too.
>
> All data in the buffer are the samples, the 'samplerate', 'sampleformat'
> 'channels' I list here is try to describe the samples.
> I was confused how to write this document, so I list the characters.

The layout of this data in memory needs to be documented. I think a
reference to ALSA documentation would be the best.

--
Regards,

Sakari Ailus