Commit 454959a5 authored by Gian-Carlo Pascutto's avatar Gian-Carlo Pascutto Committed by Anton Khirnov

aacdec: Set the profile during decoding

Previously the profile would not be set if the bitstream needs
to be decoded to know the profile.
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent da6506c6
...@@ -2185,10 +2185,12 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, ...@@ -2185,10 +2185,12 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
} else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) { } else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) {
ac->oc[1].m4ac.sbr = 1; ac->oc[1].m4ac.sbr = 1;
ac->oc[1].m4ac.ps = 1; ac->oc[1].m4ac.ps = 1;
ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags, output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
ac->oc[1].status, 1); ac->oc[1].status, 1);
} else { } else {
ac->oc[1].m4ac.sbr = 1; ac->oc[1].m4ac.sbr = 1;
ac->avctx->profile = FF_PROFILE_AAC_HE;
} }
res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type); res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
break; break;
...@@ -2704,6 +2706,10 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data, ...@@ -2704,6 +2706,10 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
if ((err = frame_configure_elements(avctx)) < 0) if ((err = frame_configure_elements(avctx)) < 0)
return err; return err;
// The FF_PROFILE_AAC_* defines are all object_type - 1
// This may lead to an undefined profile being signaled
ac->avctx->profile = ac->oc[1].m4ac.object_type - 1;
ac->tags_mapped = 0; ac->tags_mapped = 0;
if (chan_config < 0 || chan_config >= 8) { if (chan_config < 0 || chan_config >= 8) {
...@@ -2772,6 +2778,10 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, ...@@ -2772,6 +2778,10 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
if ((err = frame_configure_elements(avctx)) < 0) if ((err = frame_configure_elements(avctx)) < 0)
goto fail; goto fail;
// The FF_PROFILE_AAC_* defines are all object_type - 1
// This may lead to an undefined profile being signaled
ac->avctx->profile = ac->oc[1].m4ac.object_type - 1;
ac->tags_mapped = 0; ac->tags_mapped = 0;
// parse // parse
while ((elem_type = get_bits(gb, 3)) != TYPE_END) { while ((elem_type = get_bits(gb, 3)) != TYPE_END) {
......
...@@ -919,6 +919,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, ...@@ -919,6 +919,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
} else { } else {
#if 1 #if 1
*num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps, *num_bits_left); *num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps, *num_bits_left);
ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
#else #else
avpriv_report_missing_feature(ac->avctx, "Parametric Stereo"); avpriv_report_missing_feature(ac->avctx, "Parametric Stereo");
skip_bits_long(gb, *num_bits_left); // bs_fill_bits skip_bits_long(gb, *num_bits_left); // bs_fill_bits
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment