summaryrefslogtreecommitdiffstats
path: root/audio/out
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
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')
-rw-r--r--audio/out/ao_alsa.c32
-rw-r--r--audio/out/ao_coreaudio_utils.c3
-rw-r--r--audio/out/ao_dsound.c6
-rw-r--r--audio/out/ao_oss.c58
-rw-r--r--audio/out/ao_pcm.c21
-rw-r--r--audio/out/ao_pulse.c9
-rw-r--r--audio/out/ao_rsound.c42
-rw-r--r--audio/out/ao_sdl.c76
-rw-r--r--audio/out/ao_sndio.c42
-rwxr-xr-xaudio/out/ao_wasapi_utils.c5
10 files changed, 134 insertions, 160 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index 60b8338f9d..c344f6f20e 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -38,6 +38,7 @@
#include "options/options.h"
#include "options/m_option.h"
#include "common/msg.h"
+#include "osdep/endian.h"
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
@@ -208,22 +209,17 @@ alsa_error:
static const int mp_to_alsa_format[][2] = {
{AF_FORMAT_S8, SND_PCM_FORMAT_S8},
{AF_FORMAT_U8, SND_PCM_FORMAT_U8},
- {AF_FORMAT_U16_LE, SND_PCM_FORMAT_U16_LE},
- {AF_FORMAT_U16_BE, SND_PCM_FORMAT_U16_BE},
- {AF_FORMAT_S16_LE, SND_PCM_FORMAT_S16_LE},
- {AF_FORMAT_S16_BE, SND_PCM_FORMAT_S16_BE},
- {AF_FORMAT_U32_LE, SND_PCM_FORMAT_U32_LE},
- {AF_FORMAT_U32_BE, SND_PCM_FORMAT_U32_BE},
- {AF_FORMAT_S32_LE, SND_PCM_FORMAT_S32_LE},
- {AF_FORMAT_S32_BE, SND_PCM_FORMAT_S32_BE},
- {AF_FORMAT_U24_LE, SND_PCM_FORMAT_U24_3LE},
- {AF_FORMAT_U24_BE, SND_PCM_FORMAT_U24_3BE},
- {AF_FORMAT_S24_LE, SND_PCM_FORMAT_S24_3LE},
- {AF_FORMAT_S24_BE, SND_PCM_FORMAT_S24_3BE},
- {AF_FORMAT_FLOAT_LE, SND_PCM_FORMAT_FLOAT_LE},
- {AF_FORMAT_FLOAT_BE, SND_PCM_FORMAT_FLOAT_BE},
- {AF_FORMAT_AC3, SND_PCM_FORMAT_S16_LE},
- {AF_FORMAT_IEC61937, SND_PCM_FORMAT_S16_LE},
+ {AF_FORMAT_U16, SND_PCM_FORMAT_U16},
+ {AF_FORMAT_S16, SND_PCM_FORMAT_S16},
+ {AF_FORMAT_U32, SND_PCM_FORMAT_U32},
+ {AF_FORMAT_S32, SND_PCM_FORMAT_S32},
+ {AF_FORMAT_U24,
+ MP_SELECT_LE_BE(SND_PCM_FORMAT_U24_3LE, SND_PCM_FORMAT_U24_3BE)},
+ {AF_FORMAT_S24,
+ MP_SELECT_LE_BE(SND_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_S24_3BE)},
+ {AF_FORMAT_FLOAT, SND_PCM_FORMAT_FLOAT},
+ {AF_FORMAT_AC3, SND_PCM_FORMAT_S16},
+ {AF_FORMAT_IEC61937, SND_PCM_FORMAT_S16},
{AF_FORMAT_MPEG2, SND_PCM_FORMAT_MPEG},
{AF_FORMAT_UNKNOWN, SND_PCM_FORMAT_UNKNOWN},
};
@@ -417,13 +413,13 @@ static int init(struct ao *ao)
if (err < 0) {
MP_INFO(ao, "Format %s is not supported by hardware, trying default.\n",
af_fmt_to_str(ao->format));
- p->alsa_fmt = SND_PCM_FORMAT_S16_LE;
+ p->alsa_fmt = SND_PCM_FORMAT_S16;
if (AF_FORMAT_IS_AC3(ao->format))
ao->format = AF_FORMAT_AC3;
else if (AF_FORMAT_IS_IEC61937(ao->format))
ao->format = AF_FORMAT_IEC61937;
else
- ao->format = AF_FORMAT_S16_LE;
+ ao->format = AF_FORMAT_S16;
}
err = snd_pcm_hw_params_set_format(p->alsa, alsa_hwparams, p->alsa_fmt);
diff --git a/audio/out/ao_coreaudio_utils.c b/audio/out/ao_coreaudio_utils.c
index da06656e9d..b39323ce72 100644
--- a/audio/out/ao_coreaudio_utils.c
+++ b/audio/out/ao_coreaudio_utils.c
@@ -25,6 +25,7 @@
#include "audio/out/ao_coreaudio_utils.h"
#include "audio/out/ao_coreaudio_properties.h"
#include "osdep/timer.h"
+#include "osdep/endian.h"
#include "audio/format.h"
void ca_print_device_list(struct ao *ao)
@@ -142,7 +143,7 @@ void ca_fill_asbd(struct ao *ao, AudioStreamBasicDescription *asbd)
if ((ao->format & AF_FORMAT_SIGN_MASK) == AF_FORMAT_SI)
asbd->mFormatFlags |= kAudioFormatFlagIsSignedInteger;
- if ((ao->format & AF_FORMAT_END_MASK) == AF_FORMAT_BE)
+ if (BYTE_ORDER == BIG_ENDIAN)
asbd->mFormatFlags |= kAudioFormatFlagIsBigEndian;
asbd->mFramesPerPacket = 1;
diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c
index da1742e077..78b39b17b9 100644
--- a/audio/out/ao_dsound.c
+++ b/audio/out/ao_dsound.c
@@ -392,14 +392,14 @@ static int init(struct ao *ao)
}
switch (format) {
case AF_FORMAT_AC3:
- case AF_FORMAT_S24_LE:
- case AF_FORMAT_S16_LE:
+ case AF_FORMAT_S24:
+ case AF_FORMAT_S16:
case AF_FORMAT_U8:
break;
default:
MP_VERBOSE(ao, "format %s not supported defaulting to Signed 16-bit Little-Endian\n",
af_fmt_to_str(format));
- format = AF_FORMAT_S16_LE;
+ format = AF_FORMAT_S16;
}
//set our audio parameters
ao->samplerate = rate;
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c
index b78f244a7b..de71017432 100644
--- a/audio/out/ao_oss.c
+++ b/audio/out/ao_oss.c
@@ -40,6 +40,7 @@
#include "options/options.h"
#include "common/msg.h"
#include "osdep/timer.h"
+#include "osdep/endian.h"
#if HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
@@ -89,39 +90,46 @@ static const struct mp_chmap oss_layouts[MP_NUM_CHANNELS + 1] = {
MP_CHMAP8(FL, FR, BL, BR, FC, LFE, SL, SR), // 7.1
};
-static const int format_table[][2] = {
- {AFMT_U8, AF_FORMAT_U8},
- {AFMT_S8, AF_FORMAT_S8},
- {AFMT_U16_LE, AF_FORMAT_U16_LE},
- {AFMT_U16_BE, AF_FORMAT_U16_BE},
- {AFMT_S16_LE, AF_FORMAT_S16_LE},
- {AFMT_S16_BE, AF_FORMAT_S16_BE},
-#ifdef AFMT_S24_PACKED
- {AFMT_S24_PACKED, AF_FORMAT_S24_LE},
+#if !defined(AFMT_S16_NE) && defined(AFMT_S16_LE) && defined(AFMT_S16_BE)
+#define AFMT_S16_NE MP_SELECT_LE_BE(AFMT_S16_LE, AFMT_S16_BE)
#endif
-#ifdef AFMT_U24_LE
- {AFMT_U24_LE, AF_FORMAT_U24_LE},
+
+#if !defined(AFMT_U16_NE) && defined(AFMT_U16_LE) && defined(AFMT_U16_BE)
+#define AFMT_U16_NE MP_SELECT_LE_BE(AFMT_U16_LE, AFMT_U16_BE)
#endif
-#ifdef AFMT_U24_BE
- {AFMT_U24_BE, AF_FORMAT_U24_BE},
+
+#if !defined(AFMT_U24_NE) && defined(AFMT_U24_LE) && defined(AFMT_U24_BE)
+#define AFMT_U24_NE MP_SELECT_LE_BE(AFMT_U24_LE, AFMT_U24_BE)
#endif
-#ifdef AFMT_S24_LE
- {AFMT_S24_LE, AF_FORMAT_S24_LE},
+
+#if !defined(AFMT_S24_NE) && defined(AFMT_S24_LE) && defined(AFMT_S24_BE)
+#define AFMT_S24_NE MP_SELECT_LE_BE(AFMT_S24_LE, AFMT_S24_BE)
#endif
-#ifdef AFMT_S24_BE
- {AFMT_S24_BE, AF_FORMAT_S24_BE},
+
+#if !defined(AFMT_U32_NE) && defined(AFMT_U32_LE) && defined(AFMT_U32_BE)
+#define AFMT_U32MP_SELECT_LE_BE(AFMT_U32_LE, AFMT_U32_BE)
#endif
-#ifdef AFMT_U32_LE
- {AFMT_U32_LE, AF_FORMAT_U32_LE},
+
+#if !defined(AFMT_S32_NE) && defined(AFMT_S32_LE) && defined(AFMT_S32_BE)
+#define AFMT_S32MP_SELECT_LE_BE(AFMT_S32_LE, AFMT_S32_BE)
+#endif
+
+static const int format_table[][2] = {
+ {AFMT_U8, AF_FORMAT_U8},
+ {AFMT_S8, AF_FORMAT_S8},
+ {AFMT_U16_NE, AF_FORMAT_U16},
+ {AFMT_S16_NE, AF_FORMAT_S16},
+#ifdef AFMT_U24_NE
+ {AFMT_U24_NE, AF_FORMAT_U24},
#endif
-#ifdef AFMT_U32_BE
- {AFMT_U32_BE, AF_FORMAT_U32_BE},
+#ifdef AFMT_S24_NE
+ {AFMT_S24_NE, AF_FORMAT_S24},
#endif
-#ifdef AFMT_S32_LE
- {AFMT_S32_LE, AF_FORMAT_S32_LE},
+#ifdef AFMT_U32_NE
+ {AFMT_U32_NE, AF_FORMAT_U32},
#endif
-#ifdef AFMT_S32_BE
- {AFMT_S32_BE, AF_FORMAT_S32_BE},
+#ifdef AFMT_S32_NE
+ {AFMT_S32_NE, AF_FORMAT_S32},
#endif
#ifdef AFMT_FLOAT
{AFMT_FLOAT, AF_FORMAT_FLOAT},
diff --git a/audio/out/ao_pcm.c b/audio/out/ao_pcm.c
index 3c1f46409a..eb089c6c42 100644
--- a/audio/out/ao_pcm.c
+++ b/audio/out/ao_pcm.c
@@ -35,6 +35,7 @@
#include "ao.h"
#include "internal.h"
#include "common/msg.h"
+#include "osdep/endian.h"
#ifdef __MINGW32__
// for GetFileType to detect pipes
@@ -72,8 +73,7 @@ static void fput32le(uint32_t val, FILE *fp)
static void write_wave_header(struct ao *ao, FILE *fp, uint64_t data_length)
{
bool use_waveex = true;
- uint16_t fmt = ao->format == AF_FORMAT_FLOAT_LE ?
- WAV_ID_FLOAT_PCM : WAV_ID_PCM;
+ uint16_t fmt = ao->format == AF_FORMAT_FLOAT ? WAV_ID_FLOAT_PCM : WAV_ID_PCM;
uint32_t fmt_chunk_size = use_waveex ? 40 : 16;
int bits = af_fmt2bits(ao->format);
@@ -124,16 +124,23 @@ static int init(struct ao *ao)
if (priv->waveheader) {
// WAV files must have one of the following formats
+ // And they don't work in big endian; fixing it would be simple, but
+ // nobody cares.
+ if (BYTE_ORDER == BIG_ENDIAN) {
+ MP_FATAL(ao, "Not supported on big endian.\n");
+ return -1;
+ }
+
switch (ao->format) {
case AF_FORMAT_U8:
- case AF_FORMAT_S16_LE:
- case AF_FORMAT_S24_LE:
- case AF_FORMAT_S32_LE:
- case AF_FORMAT_FLOAT_LE:
+ case AF_FORMAT_S16:
+ case AF_FORMAT_S24:
+ case AF_FORMAT_S32:
+ case AF_FORMAT_FLOAT:
case AF_FORMAT_AC3:
break;
default:
- ao->format = AF_FORMAT_S16_LE;
+ ao->format = AF_FORMAT_S16;
break;
}
}
diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c
index 790ecb23dc..fa8a6a46be 100644
--- a/audio/out/ao_pulse.c
+++ b/audio/out/ao_pulse.c
@@ -169,12 +169,9 @@ static const struct format_map {
int mp_format;
pa_sample_format_t pa_format;
} format_maps[] = {
- {AF_FORMAT_S16_LE, PA_SAMPLE_S16LE},
- {AF_FORMAT_S16_BE, PA_SAMPLE_S16BE},
- {AF_FORMAT_S32_LE, PA_SAMPLE_S32LE},
- {AF_FORMAT_S32_BE, PA_SAMPLE_S32BE},
- {AF_FORMAT_FLOAT_LE, PA_SAMPLE_FLOAT32LE},
- {AF_FORMAT_FLOAT_BE, PA_SAMPLE_FLOAT32BE},
+ {AF_FORMAT_S16, PA_SAMPLE_S16NE},
+ {AF_FORMAT_S32, PA_SAMPLE_S32NE},
+ {AF_FORMAT_FLOAT, PA_SAMPLE_FLOAT32NE},
{AF_FORMAT_U8, PA_SAMPLE_U8},
{AF_FORMAT_UNKNOWN, 0}
};
diff --git a/audio/out/ao_rsound.c b/audio/out/ao_rsound.c
index e41a89ae37..fe187144a6 100644
--- a/audio/out/ao_rsound.c
+++ b/audio/out/ao_rsound.c
@@ -52,40 +52,26 @@ static int set_format(struct ao *ao)
case AF_FORMAT_S8:
rsd_format = RSD_S8;
break;
- case AF_FORMAT_S16_LE:
- rsd_format = RSD_S16_LE;
+ case AF_FORMAT_S16:
+ rsd_format = RSD_S16_NE;
break;
- case AF_FORMAT_S16_BE:
- rsd_format = RSD_S16_BE;
+ case AF_FORMAT_U16:
+ rsd_format = RSD_U16_NE;
break;
- case AF_FORMAT_U16_LE:
- rsd_format = RSD_U16_LE;
+ case AF_FORMAT_S24:
+ case AF_FORMAT_U24:
+ rsd_format = RSD_S32_NE;
+ ao->format = AF_FORMAT_S32;
break;
- case AF_FORMAT_U16_BE:
- rsd_format = RSD_U16_BE;
+ case AF_FORMAT_S32:
+ rsd_format = RSD_S32_NE;
break;
- case AF_FORMAT_S24_LE:
- case AF_FORMAT_S24_BE:
- case AF_FORMAT_U24_LE:
- case AF_FORMAT_U24_BE:
- rsd_format = RSD_S32_LE;
- ao->format = AF_FORMAT_S32_LE;
- break;
- case AF_FORMAT_S32_LE:
- rsd_format = RSD_S32_LE;
- break;
- case AF_FORMAT_S32_BE:
- rsd_format = RSD_S32_BE;
- break;
- case AF_FORMAT_U32_LE:
- rsd_format = RSD_U32_LE;
- break;
- case AF_FORMAT_U32_BE:
- rsd_format = RSD_U32_BE;
+ case AF_FORMAT_U32:
+ rsd_format = RSD_U32_NE;
break;
default:
- rsd_format = RSD_S16_LE;
- ao->format = AF_FORMAT_S16_LE;
+ rsd_format = RSD_S16_NE;
+ ao->format = AF_FORMAT_S16;
}
return rsd_format;
diff --git a/audio/out/ao_sdl.c b/audio/out/ao_sdl.c
index 9af5db4021..d2362a723e 100644
--- a/audio/out/ao_sdl.c
+++ b/audio/out/ao_sdl.c
@@ -38,6 +38,20 @@ struct priv
float buflen;
};
+static int fmtmap[][2] = {
+ {AF_FORMAT_U8, AUDIO_U8},
+ {AF_FORMAT_S8, AUDIO_S8},
+ {AF_FORMAT_U16, AUDIO_U16SYS},
+ {AF_FORMAT_S16, AUDIO_S16SYS},
+#ifdef AUDIO_S32SYS
+ {AF_FORMAT_S32, AUDIO_S32SYS},
+#endif
+#ifdef AUDIO_F32SYS
+ {AF_FORMAT_FLOAT, AUDIO_F32SYS},
+#endif
+ {0}
+};
+
static void audio_callback(void *userdata, Uint8 *stream, int len)
{
struct ao *ao = userdata;
@@ -104,26 +118,12 @@ static int init(struct ao *ao)
SDL_AudioSpec desired, obtained;
- switch (ao->format) {
- case AF_FORMAT_U8: desired.format = AUDIO_U8; break;
- case AF_FORMAT_S8: desired.format = AUDIO_S8; break;
- case AF_FORMAT_U16_LE: desired.format = AUDIO_U16LSB; break;
- case AF_FORMAT_U16_BE: desired.format = AUDIO_U16MSB; break;
- default:
- case AF_FORMAT_S16_LE: desired.format = AUDIO_S16LSB; break;
- case AF_FORMAT_S16_BE: desired.format = AUDIO_S16MSB; break;
-#ifdef AUDIO_S32LSB
- case AF_FORMAT_S32_LE: desired.format = AUDIO_S32LSB; break;
-#endif
-#ifdef AUDIO_S32MSB
- case AF_FORMAT_S32_BE: desired.format = AUDIO_S32MSB; break;
-#endif
-#ifdef AUDIO_F32LSB
- case AF_FORMAT_FLOAT_LE: desired.format = AUDIO_F32LSB; break;
-#endif
-#ifdef AUDIO_F32MSB
- case AF_FORMAT_FLOAT_BE: desired.format = AUDIO_F32MSB; break;
-#endif
+ desired.format = AUDIO_S16SYS;
+ for (int n = 0; fmtmap[n][0]; n++) {
+ if (ao->format == fmtmap[n][0]) {
+ desired.format = fmtmap[n][1];
+ break;
+ }
}
desired.freq = ao->samplerate;
desired.channels = ao->channels.num;
@@ -156,30 +156,18 @@ static int init(struct ao *ao)
// large, this will help.
ao->device_buffer = 3 * obtained.samples;
- switch (obtained.format) {
- case AUDIO_U8: ao->format = AF_FORMAT_U8; break;
- case AUDIO_S8: ao->format = AF_FORMAT_S8; break;
- case AUDIO_S16LSB: ao->format = AF_FORMAT_S16_LE; break;
- case AUDIO_S16MSB: ao->format = AF_FORMAT_S16_BE; break;
- case AUDIO_U16LSB: ao->format = AF_FORMAT_U16_LE; break;
- case AUDIO_U16MSB: ao->format = AF_FORMAT_U16_BE; break;
-#ifdef AUDIO_S32LSB
- case AUDIO_S32LSB: ao->format = AF_FORMAT_S32_LE; break;
-#endif
-#ifdef AUDIO_S32MSB
- case AUDIO_S32MSB: ao->format = AF_FORMAT_S32_BE; break;
-#endif
-#ifdef AUDIO_F32LSB
- case AUDIO_F32LSB: ao->format = AF_FORMAT_FLOAT_LE; break;
-#endif
-#ifdef AUDIO_F32MSB
- case AUDIO_F32MSB: ao->format = AF_FORMAT_FLOAT_BE; break;
-#endif
- default:
- if (!ao->probing)
- MP_ERR(ao, "could not find matching format\n");
- uninit(ao);
- return -1;
+ ao->format = 0;
+ for (int n = 0; fmtmap[n][0]; n++) {
+ if (obtained.format == fmtmap[n][1]) {
+ ao->format = fmtmap[n][0];
+ break;
+ }
+ }
+ if (!ao->format) {
+ if (!ao->probing)
+ MP_ERR(ao, "could not find matching format\n");
+ uninit(ao);
+ return -1;
}
if (!ao_chmap_sel_get_def(ao, &sel, &ao->channels, obtained.channels)) {
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;
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index afa2ad6b40..c12f3baf61 100755
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -292,14 +292,13 @@ static int try_passthrough(struct wasapi_state *state,
union WAVEFMT u;
u.extensible = &wformat;
- MP_VERBOSE(ao, "trying passthrough for %s...\n",
- af_fmt_to_str((ao->format&~AF_FORMAT_END_MASK) | AF_FORMAT_LE));
+ MP_VERBOSE(ao, "trying passthrough for %s...\n", af_fmt_to_str(ao->format));
HRESULT hr = IAudioClient_IsFormatSupported(state->pAudioClient,
state->share_mode,
u.ex, NULL);
if (!FAILED(hr)) {
- ao->format = (ao->format&~AF_FORMAT_END_MASK) | AF_FORMAT_LE;
+ ao->format = ao->format;
state->format = wformat;
return 1;
}