From c30aa2340132e50994cdf168aaba011ecb4f6b0c Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Aug 2016 19:14:35 +0200 Subject: 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. --- audio/chmap.c | 38 -------------------------------------- audio/chmap.h | 3 --- 2 files changed, 41 deletions(-) (limited to 'audio') 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 . // 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); -- cgit v1.2.3