[FFmpeg-devel] [PATCH 06/11] avcodec/aac_parser: set key_frame and profile

James Almer jamrial at gmail.com
Wed Nov 20 03:31:36 EET 2024


On 11/19/2024 10:28 PM, Michael Niedermayer wrote:
> On Sun, Nov 17, 2024 at 11:04:18PM -0300, James Almer wrote:
>> This is in preparation for a following change.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   libavcodec/aac_ac3_parser.c | 16 +++++++++++++++-
>>   1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
>> index f45631d09f..2b4f92dd18 100644
>> --- a/libavcodec/aac_ac3_parser.c
>> +++ b/libavcodec/aac_ac3_parser.c
>> @@ -25,6 +25,7 @@
>>   #include "libavutil/channel_layout.h"
>>   #include "libavutil/common.h"
>>   #include "parser.h"
>> +#include "profiles.h"
>>   #include "aac_ac3_parser.h"
>>   #include "ac3_parser_internal.h"
>>   #include "adts_header.h"
>> @@ -40,6 +41,8 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
>>       int new_frame_start;
>>       int got_frame = 0;
>>   
>> +    s1->key_frame = -1;
>> +
>>       if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) {
>>           i = buf_size;
>>           got_frame = 1;
>> @@ -145,10 +148,21 @@ get_next:
>>           } else {
>>   #if CONFIG_AAC_PARSER
>>               AACADTSHeaderInfo hdr;
>> +            GetBitContext gb;
>> +            int profile;
>> +            init_get_bits8(&gb, buf, buf_size);
>>               if (buf_size < AV_AAC_ADTS_HEADER_SIZE ||
>> -                ff_adts_header_parse_buf(buf, &hdr) < 0)
>> +                ff_adts_header_parse(&gb, &hdr) < 0)
>>                   return i;
>>   
>> +            profile = hdr.object_type - 1;
>> +            for (int j = 0; avctx->profile != profile &&
>> +                            ff_aac_profiles[j].profile != AV_PROFILE_UNKNOWN; j++) {
>> +                if (profile != ff_aac_profiles[j].profile)
>> +                    continue;
>> +                avctx->profile = profile; // ensure it's a known profile
> 
> breaks build with --enable-small

Huh, the profiles not compiled with --enable-small? Weird, but ok.
Will fix.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241119/28d1b27b/attachment.sig>


More information about the ffmpeg-devel mailing list