[FFmpeg-devel] [PATCH] ADTS Muxer: Refuse to write out illegal ADTS files
Robert Swain
robert.swain
Fri Feb 13 00:51:16 CET 2009
2009/2/12 Alex Converse <alex.converse at gmail.com>:
> On Thu, Feb 12, 2009 at 6:58 AM, Robert Swain <robert.swain at gmail.com> wrote:
>> 2009/2/12 Alex Converse <alex.converse at gmail.com>:
>>> Right now we are part of the problem.
>>
>> :)
>>
>>> diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
>>> index 5c65d36..9566872 100644
>>> --- a/libavformat/adtsenc.c
>>> +++ b/libavformat/adtsenc.c
>>
>>> @@ -41,6 +41,19 @@ static int decode_extradata(ADTSContext *adts, uint8_t *buf, int size)
>>> adts->sample_rate_index = get_bits(&gb, 4);
>>> adts->channel_conf = get_bits(&gb, 4);
>>>
>>> + if (adts->objecttype > 3) {
>>> + av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype);
>>> + return -1;
>>> + }
>>
>> The error message is correct for "MPEG identifier" == 0 but not for ==
>> 1. If ID == 1, the object types pertain to MPEG-2 AAC profiles as per
>> "Table 1.A.11 ? MPEG-2 Audio profiles and MPEG-4 Audio object types".
>> Also note that object type == 3 is reserved for ID == 1.
>>
>
> We should be setting ID to 0 unless we can prove (or it's otherwise
> signaled to us) that no MPEG-4 only features (not just LTP, the rare
> 960 frame length, PNS) are being used in the stream.
And I see that we do always set ID to 0 so the error message is correct.
> The first two are easy to check for. The third requires parsing every
> frame. Thus for now we should be setting ID=0. If there is a command
> line way to pass options to a muxer, forcing ID=1 would be an
> interesting option.
Applied.
Regards,
Rob
More information about the ffmpeg-devel
mailing list