|
...
|
...
|
@@ -189,10 +189,10 @@ static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID])
|
|
189
|
189
|
* @return Returns error status. 0 - OK, !0 - error
|
|
190
|
190
|
*/
|
|
191
|
191
|
static av_cold int che_configure(AACContext *ac,
|
|
192
|
|
- enum ChannelPosition che_pos[4][MAX_ELEM_ID],
|
|
|
192
|
+ enum ChannelPosition che_pos,
|
|
193
|
193
|
int type, int id, int *channels)
|
|
194
|
194
|
{
|
|
195
|
|
- if (che_pos[type][id]) {
|
|
|
195
|
+ if (che_pos) {
|
|
196
|
196
|
if (!ac->che[type][id]) {
|
|
197
|
197
|
if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
|
|
198
|
198
|
return AVERROR(ENOMEM);
|
|
...
|
...
|
@@ -222,22 +222,21 @@ static av_cold int che_configure(AACContext *ac,
|
|
222
|
222
|
* @return Returns error status. 0 - OK, !0 - error
|
|
223
|
223
|
*/
|
|
224
|
224
|
static av_cold int output_configure(AACContext *ac,
|
|
225
|
|
- enum ChannelPosition che_pos[4][MAX_ELEM_ID],
|
|
226
|
225
|
enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
|
|
227
|
226
|
int channel_config, enum OCStatus oc_type)
|
|
228
|
227
|
{
|
|
229
|
228
|
AVCodecContext *avctx = ac->avctx;
|
|
230
|
229
|
int i, type, channels = 0, ret;
|
|
231
|
230
|
|
|
232
|
|
- if (new_che_pos != che_pos)
|
|
233
|
|
- memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
|
|
|
231
|
+ if (new_che_pos)
|
|
|
232
|
+ memcpy(ac->che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
|
|
234
|
233
|
|
|
235
|
234
|
if (channel_config) {
|
|
236
|
235
|
for (i = 0; i < tags_per_config[channel_config]; i++) {
|
|
237
|
|
- if ((ret = che_configure(ac, che_pos,
|
|
238
|
|
- aac_channel_layout_map[channel_config - 1][i][0],
|
|
239
|
|
- aac_channel_layout_map[channel_config - 1][i][1],
|
|
240
|
|
- &channels)))
|
|
|
236
|
+ int id = aac_channel_layout_map[channel_config - 1][i][1];
|
|
|
237
|
+ type = aac_channel_layout_map[channel_config - 1][i][0];
|
|
|
238
|
+ if ((ret = che_configure(ac, ac->che_pos[type][id],
|
|
|
239
|
+ type, id, &channels)))
|
|
241
|
240
|
return ret;
|
|
242
|
241
|
}
|
|
243
|
242
|
|
|
...
|
...
|
@@ -256,7 +255,8 @@ static av_cold int output_configure(AACContext *ac,
|
|
256
|
256
|
|
|
257
|
257
|
for (i = 0; i < MAX_ELEM_ID; i++) {
|
|
258
|
258
|
for (type = 0; type < 4; type++) {
|
|
259
|
|
- if ((ret = che_configure(ac, che_pos, type, i, &channels)))
|
|
|
259
|
+ if ((ret = che_configure(ac, ac->che_pos[type][i],
|
|
|
260
|
+ type, i, &channels)))
|
|
260
|
261
|
return ret;
|
|
261
|
262
|
}
|
|
262
|
263
|
}
|
|
...
|
...
|
@@ -437,7 +437,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
|
|
437
|
437
|
} else if (m4ac->sbr == 1 && m4ac->ps == -1)
|
|
438
|
438
|
m4ac->ps = 1;
|
|
439
|
439
|
|
|
440
|
|
- if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR)))
|
|
|
440
|
+ if (ac && (ret = output_configure(ac, new_che_pos, channel_config, OC_GLOBAL_HDR)))
|
|
441
|
441
|
return ret;
|
|
442
|
442
|
|
|
443
|
443
|
if (extension_flag) {
|
|
...
|
...
|
@@ -610,7 +610,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
|
610
|
610
|
if (ac->m4ac.chan_config) {
|
|
611
|
611
|
int ret = set_default_channel_config(avctx, new_che_pos, ac->m4ac.chan_config);
|
|
612
|
612
|
if (!ret)
|
|
613
|
|
- output_configure(ac, ac->che_pos, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR);
|
|
|
613
|
+ output_configure(ac, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR);
|
|
614
|
614
|
else if (avctx->err_recognition & AV_EF_EXPLODE)
|
|
615
|
615
|
return AVERROR_INVALIDDATA;
|
|
616
|
616
|
}
|
|
...
|
...
|
@@ -1714,7 +1714,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
|
|
1714
|
1714
|
} else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) {
|
|
1715
|
1715
|
ac->m4ac.sbr = 1;
|
|
1716
|
1716
|
ac->m4ac.ps = 1;
|
|
1717
|
|
- output_configure(ac, ac->che_pos, ac->che_pos, ac->m4ac.chan_config, ac->output_configured);
|
|
|
1717
|
+ output_configure(ac, NULL, ac->m4ac.chan_config, ac->output_configured);
|
|
1718
|
1718
|
} else {
|
|
1719
|
1719
|
ac->m4ac.sbr = 1;
|
|
1720
|
1720
|
}
|
|
...
|
...
|
@@ -2097,7 +2097,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
|
|
2097
|
2097
|
ac->m4ac.chan_config = hdr_info.chan_config;
|
|
2098
|
2098
|
if (set_default_channel_config(ac->avctx, new_che_pos, hdr_info.chan_config))
|
|
2099
|
2099
|
return -7;
|
|
2100
|
|
- if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config,
|
|
|
2100
|
+ if (output_configure(ac, new_che_pos, hdr_info.chan_config,
|
|
2101
|
2101
|
FFMAX(ac->output_configured, OC_TRIAL_FRAME)))
|
|
2102
|
2102
|
return -7;
|
|
2103
|
2103
|
} else if (ac->output_configured != OC_LOCKED) {
|
|
...
|
...
|
@@ -2192,7 +2192,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
|
2192
|
2192
|
av_log(avctx, AV_LOG_ERROR,
|
|
2193
|
2193
|
"Not evaluating a further program_config_element as this construct is dubious at best.\n");
|
|
2194
|
2194
|
else
|
|
2195
|
|
- err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE);
|
|
|
2195
|
+ err = output_configure(ac, new_che_pos, 0, OC_TRIAL_PCE);
|
|
2196
|
2196
|
break;
|
|
2197
|
2197
|
}
|
|
2198
|
2198
|
|