summaryrefslogtreecommitdiff
path: root/libavcodec/aacdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-03 19:23:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-03 19:23:34 +0200
commit120028968749cc65cc8eea491004d64bd5179487 (patch)
tree99928091d96252b50fd99a229dfa2143d967c08c /libavcodec/aacdec.c
parent6034b4bb88c1e5fc47fe2c2ff81835cb3dd4e872 (diff)
parent0289f81241e720452b5a77713488d54d3ec252d7 (diff)
downloadffmpeg-120028968749cc65cc8eea491004d64bd5179487.tar.gz
Merge commit '0289f81241e720452b5a77713488d54d3ec252d7'
* commit '0289f81241e720452b5a77713488d54d3ec252d7': aac: Correctly map multichannel ADTS AAC with non-zero channel_config + PCE Conflicts: libavcodec/aacdec.c Sample: 5.1ch_PCE_issue.aac Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r--libavcodec/aacdec.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 48cf637b79..c0a41e0917 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -457,12 +457,18 @@ static int output_configure(AACContext *ac,
AVCodecContext *avctx = ac->avctx;
int i, channels = 0, ret;
uint64_t layout = 0;
+ uint8_t id_map[TYPE_END][MAX_ELEM_ID] = {{ 0 }};
+ uint8_t type_counts[TYPE_END] = { 0 };
if (ac->oc[1].layout_map != layout_map) {
memcpy(ac->oc[1].layout_map, layout_map, tags * sizeof(layout_map[0]));
ac->oc[1].layout_map_tags = tags;
}
-
+ for (i = 0; i < tags; i++) {
+ int type = layout_map[i][0];
+ int id = layout_map[i][1];
+ id_map[type][id] = type_counts[type]++;
+ }
// Try to sniff a reasonable channel order, otherwise output the
// channels in the order the PCE declared them.
if (avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE)
@@ -470,12 +476,14 @@ static int output_configure(AACContext *ac,
for (i = 0; i < tags; i++) {
int type = layout_map[i][0];
int id = layout_map[i][1];
+ int iid = id_map[type][id];
int position = layout_map[i][2];
// Allocate or free elements depending on if they are in the
// current program configuration.
- ret = che_configure(ac, position, type, id, &channels);
+ ret = che_configure(ac, position, type, iid, &channels);
if (ret < 0)
return ret;
+ ac->tag_che_map[type][id] = ac->che[type][iid];
}
if (ac->oc[1].m4ac.ps == 1 && channels == 2) {
if (layout == AV_CH_FRONT_CENTER) {
@@ -485,7 +493,6 @@ static int output_configure(AACContext *ac,
}
}
- memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
if (layout) avctx->channel_layout = layout;
ac->oc[1].channel_layout = layout;
avctx->channels = ac->oc[1].channels = channels;