Mercurial > mplayer.hg
changeset 36897:38234a308fd3
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.
author | reimar |
---|---|
date | Tue, 11 Mar 2014 19:50:38 +0000 |
parents | 737e2a3b9a5d |
children | 049db0aeea85 |
files | libao2/ao_sndio.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_sndio.c Tue Mar 11 12:51:31 2014 +0000 +++ b/libao2/ao_sndio.c Tue Mar 11 19:50:38 2014 +0000 @@ -103,6 +103,10 @@ } 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 @@ 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; }