[MPlayer-cvslog] r36993 - trunk/libao2/ao_sndio.c

reimar subversion at mplayerhq.hu
Tue Mar 11 20:50:38 CET 2014


Author: reimar
Date: Tue Mar 11 20:50:38 2014
New Revision: 36993

Log:
Fix sndio playback of 24 bit/sample audio.

Setting bps correctly is necessary since otherwise
sndio defaults to 4 bps (instead of 3) for 24 bit audio.
Setting msb will also allow playback if sndio also ignores
our preferences and requests 4 bps input with 24 significant
bits.

Patch by Alexandre Ratchov [alex caoua org] with
additional comments by me.

Modified:
   trunk/libao2/ao_sndio.c

Modified: trunk/libao2/ao_sndio.c
==============================================================================
--- trunk/libao2/ao_sndio.c	Tue Mar 11 13:51:31 2014	(r36992)
+++ trunk/libao2/ao_sndio.c	Tue Mar 11 20:50:38 2014	(r36993)
@@ -103,6 +103,10 @@ static int init(int rate, int channels, 
     }
     sio_initpar(&par);
     par.bits = af_fmt2bits(format);
+    par.bps = (par.bits + 7) >> 3;
+    // normally bits == 8*bps so this makes no difference
+    // but we can support more formats for msb == 1, see "if" below
+    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 +122,8 @@ static int init(int rate, int channels, 
         mp_msg(MSGT_AO, MSGL_ERR, "ao2: couldn't get params\n");
         goto err_out;
     }
-    if (par.bps != SIO_BPS(par.bits)) {
+    // we do not care if LSBs are discarded
+    if (par.bits < 8 * par.bps && !par.msb) {
         mp_msg(MSGT_AO, MSGL_ERR, "ao2: unsupported format\n");
         goto err_out;
     }


More information about the MPlayer-cvslog mailing list