diff options
author | wm4 <wm4@nowhere> | 2015-06-16 20:57:43 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-06-16 21:11:59 +0200 |
commit | 831d7c3c400b554484561bf912c1f9657f8192cd (patch) | |
tree | 7c3abe2dadd826f58ac316f9c35b56d9e869d760 /audio/out/ao_sndio.c | |
parent | 488ebdb0d57b4e822e8dac4fac18dfe460b61ac6 (diff) | |
download | mpv-831d7c3c400b554484561bf912c1f9657f8192cd.tar.bz2 mpv-831d7c3c400b554484561bf912c1f9657f8192cd.tar.xz |
audio: remove S8, U16, U24, U32 formats
They are useless. Not only are they actually rarely in use; but
libavcodec doesn't even output them, as libavcodec has no such sample
formats for decoded audio.
Even if it should happen that we actually still need them (e.g. if doing
direct hardware output), there are better solutions. Swapping the sign
is a fast and lossless operation and can be done inplace, so AO actually
needing it could do this directly.
If you wonder why we keep U8 instead of S8: because libavcodec does it.
Diffstat (limited to 'audio/out/ao_sndio.c')
-rw-r--r-- | audio/out/ao_sndio.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c index abce0efd36..f192ef98b5 100644 --- a/audio/out/ao_sndio.c +++ b/audio/out/ao_sndio.c @@ -116,12 +116,8 @@ static int init(struct ao *ao) }; static const struct af_to_par af_to_par[] = { {AF_FORMAT_U8, 8, 0}, - {AF_FORMAT_S8, 8, 1}, - {AF_FORMAT_U16, 16, 0}, {AF_FORMAT_S16, 16, 1}, - {AF_FORMAT_U24, 24, 0}, {AF_FORMAT_S24, 24, 1}, - {AF_FORMAT_U32, 32, 0}, {AF_FORMAT_S32, 32, 1}, }; const struct af_to_par *ap; @@ -178,14 +174,14 @@ static int init(struct ao *ao) MP_ERR(ao, "swapped endian output not supported\n"); goto error; } - if (p->par.bits == 8 && p->par.bps == 1) { - ao->format = p->par.sig ? AF_FORMAT_S8 : AF_FORMAT_U8; - } else if (p->par.bits == 16 && p->par.bps == 2) { - ao->format = p->par.sig ? AF_FORMAT_S16 : AF_FORMAT_U16; - } else if ((p->par.bits == 24 || p->par.msb) && p->par.bps == 3) { - ao->format = p->par.sig ? AF_FORMAT_S24 : AF_FORMAT_U24; - } else if ((p->par.bits == 32 || p->par.msb) && p->par.bps == 4) { - ao->format = p->par.sig ? AF_FORMAT_S32 : AF_FORMAT_U32; + if (p->par.bits == 8 && p->par.bps == 1 && !p->par.sig) { + ao->format = AF_FORMAT_U8; + } else if (p->par.bits == 16 && p->par.bps == 2 && p->par.sig) { + ao->format = AF_FORMAT_S16; + } else if ((p->par.bits == 24 || p->par.msb) && p->par.bps == 3 && p->par.sig) { + ao->format = AF_FORMAT_S24; + } else if ((p->par.bits == 32 || p->par.msb) && p->par.bps == 4 && p->par.sig) { + ao->format = AF_FORMAT_S32; } else { MP_ERR(ao, "couldn't set format\n"); goto error; |