summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-08-04 19:14:35 +0200
committerwm4 <wm4@nowhere>2016-08-04 19:14:35 +0200
commitc30aa2340132e50994cdf168aaba011ecb4f6b0c (patch)
treed5f054971c483acc6adf9e93f8014e95ebef80b5
parentefa9fe8edfb2260359aa468a11c0df521862fb0c (diff)
downloadmpv-c30aa2340132e50994cdf168aaba011ecb4f6b0c.tar.bz2
mpv-c30aa2340132e50994cdf168aaba011ecb4f6b0c.tar.xz
player: remove special-case for DL/DR speakers
Pointless anyway. With superficial checking I couldn't find any decoder which actually outputs this, and AO chmap negotiation would properly ignore them anyway in most cases.
-rw-r--r--audio/chmap.c38
-rw-r--r--audio/chmap.h3
-rw-r--r--player/audio.c2
3 files changed, 0 insertions, 43 deletions
diff --git a/audio/chmap.c b/audio/chmap.c
index 1d4970da6c..bbd3a17404 100644
--- a/audio/chmap.c
+++ b/audio/chmap.c
@@ -230,44 +230,6 @@ void mp_chmap_set_unknown(struct mp_chmap *dst, int num_channels)
}
}
-// Return channel index of the given speaker, or -1.
-static int mp_chmap_find_speaker(const struct mp_chmap *map, int speaker)
-{
- for (int n = 0; n < map->num; n++) {
- if (map->speaker[n] == speaker)
- return n;
- }
- return -1;
-}
-
-static void mp_chmap_remove_speaker(struct mp_chmap *map, int speaker)
-{
- int index = mp_chmap_find_speaker(map, speaker);
- if (index >= 0) {
- for (int n = index; n < map->num - 1; n++)
- map->speaker[n] = map->speaker[n + 1];
- map->num--;
- }
-}
-
-// Some decoders output additional, redundant channels, which are usually
-// useless and will mess up proper audio output channel handling.
-// map: channel map from which the channels should be removed
-// requested: if not NULL, and if it contains any of the "useless" channels,
-// don't remove them (this is for convenience)
-void mp_chmap_remove_useless_channels(struct mp_chmap *map,
- const struct mp_chmap *requested)
-{
- if (requested &&
- mp_chmap_find_speaker(requested, MP_SPEAKER_ID_DL) >= 0)
- return;
-
- if (map->num > 2) {
- mp_chmap_remove_speaker(map, MP_SPEAKER_ID_DL);
- mp_chmap_remove_speaker(map, MP_SPEAKER_ID_DR);
- }
-}
-
// Return the ffmpeg/libav channel layout as in <libavutil/channel_layout.h>.
// Speakers not representable by ffmpeg/libav are dropped.
// Warning: this ignores the order of the channels, and will return a channel
diff --git a/audio/chmap.h b/audio/chmap.h
index aa9b1c5a10..dff69336d6 100644
--- a/audio/chmap.h
+++ b/audio/chmap.h
@@ -109,9 +109,6 @@ void mp_chmap_fill_na(struct mp_chmap *map, int num);
void mp_chmap_from_channels(struct mp_chmap *dst, int num_channels);
void mp_chmap_set_unknown(struct mp_chmap *dst, int num_channels);
-void mp_chmap_remove_useless_channels(struct mp_chmap *map,
- const struct mp_chmap *requested);
-
uint64_t mp_chmap_to_lavc(const struct mp_chmap *src);
uint64_t mp_chmap_to_lavc_unchecked(const struct mp_chmap *src);
void mp_chmap_from_lavc(struct mp_chmap *dst, uint64_t src);
diff --git a/player/audio.c b/player/audio.c
index 6c53bdf721..bcaeb13e9f 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -372,8 +372,6 @@ static void reinit_audio_filters_and_output(struct MPContext *mpctx)
ao_c->spdif_passthrough;
bool ao_null_fallback = opts->ao_null_fallback && !spdif_fallback;
- mp_chmap_remove_useless_channels(&afs->output.channels,
- &opts->audio_output_channels);
mp_audio_set_channels(&afs->output, &afs->output.channels);
mpctx->ao = ao_init_best(mpctx->global, ao_null_fallback, mpctx->input,