[FFmpeg-devel] [PATCH] [2/2] add the id3v2 parsing for adts aac, take 3

Patrick Dehne patrick
Fri Jun 12 00:57:57 CEST 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> On Wed, Jun 10, 2009 at 03:58:17PM +0200, Patrick Dehne wrote:
>> 
>> This additionally takes the added ff_ prefix to the id3v2_parse function name into account.
>> 
>> Patrick
>> 
>
>>  raw.c |   34 +++++++++++++++++++++++++++++++++-
>>  1 file changed, 33 insertions(+), 1 deletion(-)
>> ade47364501b014617d953d4b7c680ab76cbf341  2_adtsaac_parse_id3v2.patch
>> Index: libavformat/raw.c
>> ===================================================================
>> --- libavformat/raw.c	(revision 19141)
>> +++ libavformat/raw.c	(working copy)
>> @@ -625,6 +625,38 @@
>>      else if(max_frames>=1) return 1;
>>      else                   return 0;
>>  }
>> +
>> +static int adts_aac_read_header(AVFormatContext *s,
>> +                                AVFormatParameters *ap)
>> +{
>> +    AVStream *st;
>> +    uint8_t buf[ID3v2_HEADER_SIZE];
>> +    int len, ret;
>> +
>> +    st = av_new_stream(s, 0);
>> +    if (!st)
>> +        return AVERROR(ENOMEM);
>> +
>> +    st->codec->codec_type = CODEC_TYPE_AUDIO;
>> +    st->codec->codec_id = s->iformat->value;
>> +    st->need_parsing = AVSTREAM_PARSE_FULL;
>> +
>> +    /* parse ID3v2 header */
>> +    ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
>> +    if (ret != ID3v2_HEADER_SIZE)
>> +        return -1;
>> +    if (ff_id3v2_match(buf)) {        
>> +        len = ((buf[6] & 0x7f) << 21) |
>> +            ((buf[7] & 0x7f) << 14) |
>> +            ((buf[8] & 0x7f) << 7) |
>> +            (buf[9] & 0x7f);
>> +        ff_id3v2_parse(s, len, buf[3], buf[5]);
>> +    } else {
>> +        url_fseek(s->pb, 0, SEEK_SET);
>> +    }       
>
> trailing whitespace
> code duplication relative to mp3.c
> and its missing id3v1 that mp3.c has
>
> [...]

fixed

Patrick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2_adtsaac_parse_id3v2.patch
Type: text/x-patch
Size: 8022 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090612/275ea65e/attachment.bin>



More information about the ffmpeg-devel mailing list