[MPlayer-dev-eng] How to retrieve the actual number of audio channels?
wm4
nfxjfg at googlemail.com
Mon Mar 24 21:15:52 CET 2014
On Mon, 24 Mar 2014 17:20:41 +0100
Ingo Brückl <ib at wupperonline.de> wrote:
> It seems that sh_audio->channels only reports the number of channels of a
> downmix(?):
>
> ./mplayer /media/cdrom/AC3/prologe.AC3 -v
> [...]
> ==> Found audio stream: 0
> ======= WAVE Format =======
> Format Tag: 8192 (0x2000)
> Channels: 6
> Samplerate: 48000
> avg byte/sec: 56000
> Block align: 1
> bits/sample: 0
> cbSize: 0
> [...]
> hwac3: switched to AC3, 448000 bps, 48000 Hz
>
> AUDIO: 48000 Hz, 2 ch, ac3be, 448.0 kbit/29.17% (ratio: 56000->192000)
>
> How can I retrieve the information about the actual 6 channels, not just the
> 2 channels (which I still don't understand with AC3 pass-through S/PDIF,
> by the way).
>
> I would then block balance control for number of channels != 2.
>
> (This question may be related to my recent postings "Sound issue with ac3 on
> PC speakers" on the user list.)
Maybe this was already explained in that thread, but this is how spdif
works. It pretends that the audio stream is PCM, and uses a "fake"
audio format for that, like 2 channels at 48000Hz. What really happens
is that the audio stream contains compressed audio packets, framed into
the spdif protocol (or whatever it's called), and padded to achieve the
same bitrate as the "fake" audio PCM would.
So, these streams contain compressed packets. The only way to know to
what these decompress are either:
1) decompress them with a software decoder to see what they return
2) parse the digital packets to determine the channel configuration
3) rely on what libavformat returns in the stream header, since
libavformat already does 1)+2) automatically
Looks like you want 3), but of course that doesn't work with the
builtin demuxers used e.g. for DVD.
More information about the MPlayer-dev-eng
mailing list