path: root/demux/demux_tv.c
diff options
authorwm4 <wm4@nowhere>2014-09-23 21:04:37 +0200
committerwm4 <wm4@nowhere>2014-09-23 23:09:25 +0200
commitb745c2d0050468580aec0a4e12aec854fefd1796 (patch)
tree0df9a9f56b339cabc68376840b4d283b848acdf8 /demux/demux_tv.c
parent5b5a3d0c469fa5e282b60eb9ac2b7e4414640d80 (diff)
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 'demux/demux_tv.c')
1 files changed, 6 insertions, 7 deletions
diff --git a/demux/demux_tv.c b/demux/demux_tv.c
index fe7584a387..a4421a86cf 100644
--- a/demux/demux_tv.c
+++ b/demux/demux_tv.c
@@ -11,6 +11,7 @@
#include "audio/format.h"
#include "video/img_fourcc.h"
+#include "osdep/endian.h"
#include "stream/stream.h"
#include "stream/tv.h"
@@ -106,14 +107,10 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
case AF_FORMAT_U8:
case AF_FORMAT_S8:
- case AF_FORMAT_U16_LE:
- case AF_FORMAT_U16_BE:
- case AF_FORMAT_S16_LE:
- case AF_FORMAT_S16_BE:
- case AF_FORMAT_S32_LE:
- case AF_FORMAT_S32_BE:
+ case AF_FORMAT_U16:
+ case AF_FORMAT_S16:
+ case AF_FORMAT_S32:
MP_ERR(tvh, "Audio type '%s' unsupported!\n",
@@ -147,6 +144,8 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
sh_audio->wf->nSamplesPerSec = sh_audio->samplerate;
sh_audio->wf->nBlockAlign = block_align;
sh_audio->wf->nAvgBytesPerSec = bytes_per_second;
+ // wav header usually implies little endian
+ sh_audio->big_endian = BYTE_ORDER == BIG_ENDIAN;
MP_VERBOSE(tvh, " TV audio: %d channels, %d bits, %d Hz\n",
sh_audio->wf->nChannels, sh_audio->wf->wBitsPerSample,