From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: pcm: comment about relation between msbits hw parameter and [S|U32] formats
Date: Sun, 30 May 2021 09:32:29 +0200 [thread overview]
Message-ID: <s5heedo3cdu.wl-tiwai@suse.de> (raw)
In-Reply-To: <20210529033353.21641-1-o-takashi@sakamocchi.jp>
On Sat, 29 May 2021 05:33:53 +0200,
Takashi Sakamoto wrote:
>
> Regarding to handling [U|S][32|24] PCM formats, many userspace
> application developers and driver developers have confusion, since they
> require them to understand justification or padding. It easily
> loses consistency and soundness to operate with many type of devices. In
> this commit, I attempt to solve the situation by adding comment about
> relation between [S|U]32 formats and 'msbits' hardware parameter.
>
> The formats are used for 'left-justified' sample format, and the available
> bit count in most significant bit is delivered to userspace in msbits
> hardware parameter (struct snd_pcm_hw_params.msbits), which is decided by
> msbits constraint added by pcm drivers (snd_pcm_hw_constraint_msbits()).
>
> In driver side, the msbits constraint includes two elements; the physical
> width of format and the available width of the format in most significant
> bit. The former is used to match SAMPLE_BITS of format. (For my
> convenience, I ignore wildcard in the usage of the constraint.)
>
> As a result of interaction between ALSA pcm core and ALSA pcm application,
> when the format in which SAMPLE_BITS equals to physical width of the
> msbits constaint, the msbits parameter is set by referring to the
> available width of the constraint. When the msbits parameter is not
> changed in the above process, ALSA pcm core set it alternatively with
> SAMPLE_BIT of chosen format.
>
> In userspace application side, the msbits is only available after calling
> ioctl(2) with SNDRV_PCM_IOCTL_HW_PARAMS request. Even if the hardware
> parameter structure includes somewhat value of SAMPLE_BITS interval
> parameter as width of format, all of the width is not always available
> since msbits can be less than the width.
>
> I note that [S|U24] formats are used for 'right-justified' 24 bit sample
> formats within 32 bit frame. The first byte in most significant bit
> should be invalidated. Although the msbits exposed to userspace should be
> zero as invalid value, actually it is 32 from physical width of format.
>
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Thanks, applied.
Takashi
next prev parent reply other threads:[~2021-05-30 7:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-29 3:33 [PATCH] ALSA: pcm: comment about relation between msbits hw parameter and [S|U32] formats Takashi Sakamoto
2021-05-30 7:32 ` Takashi Iwai [this message]
2021-12-12 11:30 ` Takashi Sakamoto
2021-12-13 7:20 ` Takashi Iwai
2021-12-13 8:02 ` Takashi Sakamoto
2021-12-13 8:18 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5heedo3cdu.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=o-takashi@sakamocchi.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.