summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_sndio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-23 21:04:37 +0200
committerwm4 <wm4@nowhere>2014-09-23 23:09:25 +0200
commitb745c2d0050468580aec0a4e12aec854fefd1796 (patch)
tree0df9a9f56b339cabc68376840b4d283b848acdf8 /audio/out/ao_sndio.c
parent5b5a3d0c469fa5e282b60eb9ac2b7e4414640d80 (diff)
downloadmpv-b745c2d0050468580aec0a4e12aec854fefd1796.tar.bz2
mpv-b745c2d0050468580aec0a4e12aec854fefd1796.tar.xz
audio: drop swapped-endian audio formats
Until now, the audio chain could handle both little endian and big endian formats. This actually doesn't make much sense, since the audio API and the HW will most likely prefer native formats. Or at the very least, it should be trivial for audio drivers to do the byte swapping themselves. From now on, the audio chain contains native-endian formats only. All AOs and some filters are adjusted. af_convertsignendian.c is now wrongly named, but the filter name is adjusted. In some cases, the audio infrastructure was reused on the demuxer side, but that is relatively easy to rectify. This is a quite intrusive and radical change. It's possible that it will break some things (especially if they're obscure or not Linux), so watch out for regressions. It's probably still better to do it the bulldozer way, since slow transition and researching foreign platforms would take a lot of time and effort.
Diffstat (limited to 'audio/out/ao_sndio.c')
-rw-r--r--audio/out/ao_sndio.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c
index c75027dffc..c1c4ef17ab 100644
--- a/audio/out/ao_sndio.c
+++ b/audio/out/ao_sndio.c
@@ -109,22 +109,16 @@ static int init(struct ao *ao)
struct priv *p = ao->priv;
struct af_to_par {
- int format, bits, sig, le;
+ int format, bits, sig;
} static const af_to_par[] = {
- {AF_FORMAT_U8, 8, 0, 0},
- {AF_FORMAT_S8, 8, 1, 0},
- {AF_FORMAT_U16_LE, 16, 0, 1},
- {AF_FORMAT_U16_BE, 16, 0, 0},
- {AF_FORMAT_S16_LE, 16, 1, 1},
- {AF_FORMAT_S16_BE, 16, 1, 0},
- {AF_FORMAT_U24_LE, 16, 0, 1},
- {AF_FORMAT_U24_BE, 24, 0, 0},
- {AF_FORMAT_S24_LE, 24, 1, 1},
- {AF_FORMAT_S24_BE, 24, 1, 0},
- {AF_FORMAT_U32_LE, 32, 0, 1},
- {AF_FORMAT_U32_BE, 32, 0, 0},
- {AF_FORMAT_S32_LE, 32, 1, 1},
- {AF_FORMAT_S32_BE, 32, 1, 0}
+ {AF_FORMAT_U8, 8, 0},
+ {AF_FORMAT_S8, 8, 1},
+ {AF_FORMAT_U16, 16, 0},
+ {AF_FORMAT_S16, 16, 1},
+ {AF_FORMAT_U24, 16, 0},
+ {AF_FORMAT_S24, 24, 1},
+ {AF_FORMAT_U32, 32, 0},
+ {AF_FORMAT_S32, 32, 1},
}, *ap;
int i;
@@ -149,7 +143,7 @@ static int init(struct ao *ao)
p->par.bits = ap->bits;
p->par.sig = ap->sig;
if (ap->bits > 8)
- p->par.le = ap->le;
+ p->par.le = SIO_LE_NATIVE;
if (ap->bits != SIO_BPS(ap->bits))
p->par.bps = ap->bits / 8;
break;
@@ -175,20 +169,18 @@ static int init(struct ao *ao)
MP_ERR(ao, "couldn't get params\n");
goto error;
}
+ if (p->par.bps > 1 && p->par.le != SIO_LE_NATIVE) {
+ 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 ?
- (p->par.le ? AF_FORMAT_S16_LE : AF_FORMAT_S16_BE) :
- (p->par.le ? AF_FORMAT_U16_LE : AF_FORMAT_U16_BE);
+ 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 ?
- (p->par.le ? AF_FORMAT_S24_LE : AF_FORMAT_S24_BE) :
- (p->par.le ? AF_FORMAT_U24_LE : AF_FORMAT_U24_BE);
+ 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 ?
- (p->par.le ? AF_FORMAT_S32_LE : AF_FORMAT_S32_BE) :
- (p->par.le ? AF_FORMAT_U32_LE : AF_FORMAT_U32_BE);
+ ao->format = p->par.sig ? AF_FORMAT_S32 : AF_FORMAT_U32;
} else {
MP_ERR(ao, "couldn't set format\n");
goto error;