summaryrefslogtreecommitdiffstats
path: root/audio/decode
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/decode
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/decode')
-rw-r--r--audio/decode/ad_lavc.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index afff84ef00..443cfdad54 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -96,25 +96,30 @@ static const struct pcm_map tag_map[] = {
// For demux_rawaudio.c; needed because ffmpeg doesn't have these sample
// formats natively.
-static const struct pcm_map af_map[] = {
+static const struct pcm_map af_map_le[] = {
{AF_FORMAT_U8, {"pcm_u8"}},
{AF_FORMAT_S8, {"pcm_u8"}},
- {AF_FORMAT_U16_LE, {"pcm_u16le"}},
- {AF_FORMAT_U16_BE, {"pcm_u16be"}},
- {AF_FORMAT_S16_LE, {"pcm_s16le"}},
- {AF_FORMAT_S16_BE, {"pcm_s16be"}},
- {AF_FORMAT_U24_LE, {"pcm_u24le"}},
- {AF_FORMAT_U24_BE, {"pcm_u24be"}},
- {AF_FORMAT_S24_LE, {"pcm_s24le"}},
- {AF_FORMAT_S24_BE, {"pcm_s24be"}},
- {AF_FORMAT_U32_LE, {"pcm_u32le"}},
- {AF_FORMAT_U32_BE, {"pcm_u32be"}},
- {AF_FORMAT_S32_LE, {"pcm_s32le"}},
- {AF_FORMAT_S32_BE, {"pcm_s32be"}},
- {AF_FORMAT_FLOAT_LE, {"pcm_f32le"}},
- {AF_FORMAT_FLOAT_BE, {"pcm_f32be"}},
- {AF_FORMAT_DOUBLE_LE, {"pcm_f64le"}},
- {AF_FORMAT_DOUBLE_BE, {"pcm_f64be"}},
+ {AF_FORMAT_U16, {"pcm_u16le"}},
+ {AF_FORMAT_S16, {"pcm_s16le"}},
+ {AF_FORMAT_U24, {"pcm_u24le"}},
+ {AF_FORMAT_S24, {"pcm_s24le"}},
+ {AF_FORMAT_U32, {"pcm_u32le"}},
+ {AF_FORMAT_S32, {"pcm_s32le"}},
+ {AF_FORMAT_FLOAT, {"pcm_f32le"}},
+ {AF_FORMAT_DOUBLE, {"pcm_f64le"}},
+ {-1},
+};
+static const struct pcm_map af_map_be[] = {
+ {AF_FORMAT_U8, {"pcm_u8"}},
+ {AF_FORMAT_S8, {"pcm_u8"}},
+ {AF_FORMAT_U16, {"pcm_u16be"}},
+ {AF_FORMAT_S16, {"pcm_s16be"}},
+ {AF_FORMAT_U24, {"pcm_u24be"}},
+ {AF_FORMAT_S24, {"pcm_s24be"}},
+ {AF_FORMAT_U32, {"pcm_u32be"}},
+ {AF_FORMAT_S32, {"pcm_s32be"}},
+ {AF_FORMAT_FLOAT, {"pcm_f32be"}},
+ {AF_FORMAT_DOUBLE, {"pcm_f64be"}},
{-1},
};
@@ -198,7 +203,8 @@ static int init(struct dec_audio *da, const char *decoder)
decoder = find_pcm_decoder(tag_map, sh->format,
sh_audio->wf->wBitsPerSample);
} else if (sh_audio->wf && strcmp(decoder, "mp-pcm") == 0) {
- decoder = find_pcm_decoder(af_map, sh->format, 0);
+ const struct pcm_map *map = sh_audio->big_endian ? af_map_be : af_map_le;
+ decoder = find_pcm_decoder(map, sh->format, 0);
ctx->force_channel_map = true;
}