On 26. 08. 24 8:17, Pavel Hofman wrote:
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:
It's true.
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.
It would be better to use 'copy' plugin instead 'plug' in this case to do just interleaved/non-interleaved stream conversion.
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_... > but those slave params format/channels were refused by snd config.
Yes, there's missing code implementing this feature in the empty plugin.
Jaroslav