Re: Specifying supported hw params (channels, format, etc.) by the plug plugin in alsa config?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jaroslav,

On 25. 08. 24 20:28, Jaroslav Kysela wrote:
> On 25. 08. 24 20:16, Pavel Hofman wrote:
>> Hi,
>>
>> Please is it possible to restrict the hw params space for the plug
>> plugin by some alsa configuration, so that it reports/accepts only a
>> specific number of channels/specific sample format? I was not able to
>> figure it out, I apologize if it's trivial :-)
> 
> Hi,
> 
>     here's a quick example:
> 
> ===
> pcm.hubcap {
>   type plug
>   slave {
>     pcm "hw:Loopback,1,0"
>     rate 48000
>     format S16_LE
>   }
> }
> ===
> 
> Documentation:
> https://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
> 



Thanks a lot for your quick response. IIUC this config specifies params
for the slave, but the plug's input hw params remain unrestricted:


aplay -v --dump-hw-params  -D hubcap /dev/zero
HW Params of device "hubcap":
--------------------
ACCESS:  MMAP_INTERLEAVED MMAP_NONINTERLEAVED MMAP_COMPLEX
RW_INTERLEAVED RW_NONINTERLEAVED
FORMAT:  S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE
S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE
MU_LAW A_LAW IMA_ADPCM S20_LE S20_BE U20_LE U20_BE S24_3LE S24_3BE
U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE
U18_3BE
SUBFORMAT:  STD
SAMPLE_BITS: [4 64]
FRAME_BITS: [4 640000]
CHANNELS: [1 10000]
RATE: [4000 4294967295)
PERIOD_TIME: (20 10922667)
PERIOD_SIZE: (0 4294967295)
PERIOD_BYTES: (0 4294967295)
PERIODS: (0 4294967295]
BUFFER_TIME: [1 4294967295]
BUFFER_SIZE: [1 4294967294]
BUFFER_BYTES: [1 4294967295]
TICK_TIME: ALL
--------------------
Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
...

I am looking for restricting the params offered by the plug plugin to
upstream.

Sometimes it's useful to fix the input channels or sample format, while
keeping the plug conversion capabilities. An example is the a52 plugin
which accepts only non-interleaved access. For clients which support
only interleaved access (e.g. java alsa interface), the plug will do the
conversion, but will also obscure the fact that a52 works with 6
channels and S16_LE, runs preferrably at 48kHz, etc. Yes, it will any of
the conversions necessary, but sometimes the client would prefer knowing
the optimal format instead.

I tried wrapping the plug with empty plugin which according to the docs
should be able to limit the plug input format
https://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html#pcm_plugins_empty
but those slave params format/channels were refused by snd config.

Thanks a lot for any help.

With regards,

Pavel.



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux