summaryrefslogtreecommitdiff
path: root/libavcodec/aacdec.c
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2012-01-06 17:22:45 -0800
committerAlex Converse <alex.converse@gmail.com>2012-01-09 11:04:05 -0800
commit4acd43a295aae0a88ae26cd54cd06b1df146e815 (patch)
treee8428e86ff0081ef10d654c9c94237a1fc588855 /libavcodec/aacdec.c
parent1ef8ff4534706de0b1da3442f380be58a650acf2 (diff)
aacdec: Turn off PS for multichannel files that use PCE based configs.
Fixes al_sbr_cm_48_5.1.mp4.
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r--libavcodec/aacdec.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 4d3f1ff0d0..b2fc740d4d 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -163,6 +163,19 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
}
}
+static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID])
+{
+ int i, type, sum = 0;
+ for (i = 0; i < MAX_ELEM_ID; i++) {
+ for (type = 0; type < 4; type++) {
+ sum += (1 + (type == TYPE_CPE)) *
+ (che_pos[type][i] != AAC_CHANNEL_OFF &&
+ che_pos[type][i] != AAC_CHANNEL_CC);
+ }
+ }
+ return sum;
+}
+
/**
* Check for the channel element in the current channel position configuration.
* If it exists, make sure the appropriate element is allocated and map the
@@ -418,6 +431,12 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
if ((ret = set_default_channel_config(avctx, new_che_pos, channel_config)))
return ret;
}
+
+ if (count_channels(new_che_pos) > 1) {
+ m4ac->ps = 0;
+ } else if (m4ac->sbr == 1 && m4ac->ps == -1)
+ m4ac->ps = 1;
+
if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR)))
return ret;
@@ -476,8 +495,6 @@ static int decode_audio_specific_config(AACContext *ac,
av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index);
return -1;
}
- if (m4ac->sbr == 1 && m4ac->ps == -1)
- m4ac->ps = 1;
skip_bits_long(&gb, i);