[MPlayer-users] s32_le (flac) falls back to s16_le instead of s24_3le

Mervin Beng mervinb at mail.com
Tue Aug 3 11:48:53 CEST 2010


This is my first post here. Please excuse me if this is the wrong list.

I use mplayer with alsa output, and I find that when using a USB dac
capable
of 24/96, the output is converted to s16_le, even though the card
supports
s24_3le.

Playing recit24bit.flac.
Audio only file format detected.
==================================================
========================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 88200 Hz, 2 ch, s32le, 2401.6 kbit/42.54% (ratio: 300196->705600)
Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio)
==================================================
========================
[AO_ALSA] Format s32le is not supported by hardware, trying default.
AO: [alsa] 96000Hz 2ch s16le (2 bytes per sample)     ***** BAD NEWS
*****
Video: no video
Starting playback...

I was directed to libao2/ao_alsa.c as the part in mplayer which does
this defaulting,
and I have since created a small patch that appears to work with a range
of audio
chips and USB audio devices.

I am not familiar with mplayer code or alsa, which is why I thought it's
better
to post this here, then let some mplayer gurus take over from here if
the patch
is useful.

$ diff ao_alsa_orig.c ao_alsa.c
515c515,516
< 	 sets default format to S16_LE if the given formats aren't supported
*/
---
> 	 sets default format to S24_3LE or S16_LE
> 	 if the given formats aren't supported */
521c522,526
<          alsa_format = SND_PCM_FORMAT_S16_LE;
---
>          if ((err = snd_pcm_hw_params_test_format(alsa_handler,
alsa_hwparams,
>                                              SND_PCM_FORMAT_S24_3LE))
< 0)
>            alsa_format = SND_PCM_FORMAT_S16_LE;
>          else
>            alsa_format = SND_PCM_FORMAT_S24_3LE;
523a529,530
>          else if (alsa_format == SND_PCM_FORMAT_S24_3LE)
>            ao_data.format = AF_FORMAT_S24_LE;
525c532
<          ao_data.format = AF_FORMAT_S16_LE;
---
>            ao_data.format = AF_FORMAT_S16_LE;

Cheers,
Mervin


More information about the MPlayer-users mailing list