[MPlayer-dev-eng] [PATCH] Fix playback of 24-bit audio when sndio ao is used

Brad Smith brad at comstyle.com
Thu Feb 27 06:19:53 CET 2014


Here is a diff from Alexandre Ratchov to fix 24-bit audio with the sndio
backend. Without the diff playing 24-bit audio results in white noise.

$ mplayer test_s24be.aiff
MPlayer SVN-r36952 (C) 2000-2014 MPlayer Team

Playing test_s24be.aiff.
libavformat version 54.63.104 (external)
libavformat file format detected.
[aiff @ 0x1215ca4ed860]max_analyze_duration 5000000 reached at 5010612 microseconds
[lavf] stream 0: audio (pcm_s24be), -aid 0
Load subtitles in ./
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, s24be, 2116.8 kbit/100.00% (ratio: 264600->264600)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [sndio] 44100Hz 2ch s24be (3 bytes per sample)
Video: no video
Starting playback...

Exiting... (End of file)
$ mplayer test_s24le.wav
MPlayer SVN-r36952 (C) 2000-2014 MPlayer Team

Playing test_s24le.wav.
libavformat version 54.63.104 (external)
Audio only file format detected.
Load subtitles in ./
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, s24le, 2116.8 kbit/100.00% (ratio: 264600->264600)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [sndio] 44100Hz 2ch s24le (3 bytes per sample)
Video: no video
Starting playback...

Exiting... (End of file)


--- libao2/ao_sndio.c.orig	Mon Jan  6 23:02:58 2014
+++ libao2/ao_sndio.c	Tue Feb 18 14:31:47 2014
@@ -103,6 +103,8 @@ static int init(int rate, int channels, int format, in
     }
     sio_initpar(&par);
     par.bits = af_fmt2bits(format);
+    par.bps = (par.bits + 7) >> 3;
+    par.msb = 1;
     par.sig = (format & AF_FORMAT_SIGN_MASK) == AF_FORMAT_SI;
     if (par.bits > 8)
         par.le = (format & AF_FORMAT_END_MASK) == AF_FORMAT_LE;
@@ -118,7 +120,7 @@ static int init(int rate, int channels, int format, in
         mp_msg(MSGT_AO, MSGL_ERR, "ao2: couldn't get params\n");
         goto err_out;
     }
-    if (par.bps != SIO_BPS(par.bits)) {
+    if (par.bits < 8 * par.bps && !par.msb) {
         mp_msg(MSGT_AO, MSGL_ERR, "ao2: unsupported format\n");
         goto err_out;
     }

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MPlayer-dev-eng mailing list