Get max audio channels available from alsasink

Nicolas Dufresne nicolas at ndufresne.ca
Tue Jan 29 16:55:04 UTC 2019


Le lundi 28 janvier 2019 à 12:15 -0600, moritz.vieli a écrit :
> Hi there
> 
> I am letting the user decide, how many audio channels he wants to to play on
> an alsasink. However, if he configures more channels than available on the
> specified audio interface, my complete app gets wiped from the memory
> (because of some illegal memory access form Gstreamer/ALSA i suppose).

Sounds like a driver bug, normally you'd get an "not-negotaited" error
on the bus and adding audioconvert element before alsasink would handle
the required up/down-mixing for you.

> 
> Now, is there a possibility to find out the maximum available channels on an
> audio interface? It would be nice with Gstreamer of course, but a command
> line solution would also be sufficient. I tried querying the negotiated
> caps, allowed caps and so on, but it's always returning the configured
> channels, not the possible available channels. I couldn't figure out a
> solution.


It can all be done grammatically of course, the number of channels will
depend on the selected output. But as an example, my laptop have two
physical speaker, if I use amixer, I can read this:

  amixer -c 0
  . . . 
  Simple mixer control 'Speaker',0
    Capabilities: pvolume pswitch
    Playback channels: Front Left - Front Right
    Limits: Playback 0 - 87
    Mono:
      Front Left: Playback 87 [100%] [0.00dB] [on]
      Front Right: Playback 87 [100%] [0.00dB] [on]
  Simple mixer control 'PCM',0
    Capabilities: pvolume
    Playback channels: Front Left - Front Right
    Limits: Playback 0 - 255
    Mono:
      Front Left: Playback 255 [100%] [0.00dB]
      Front Right: Playback 255 [100%] [0.00dB]
    Simple mixer control 'Mic',0

You can see that "Playback channels:" give me both how many channels I
got and what these channels are mapped to.

Nicolas


> 
> Thanks a lot and best,
> Moritz
> 
> 
> 
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190129/e01ae507/attachment.sig>


More information about the gstreamer-devel mailing list