[FFmpeg-devel] [PATCH] [1/2] move id3v2 parsing code from mp3.c to the id3v2.h and id3v2.c, take 3

Patrick Dehne patrick
Wed Jun 10 22:01:48 CEST 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> On Wed, Jun 10, 2009 at 03:54:02PM +0200, Patrick Dehne wrote:
>> Michael Niedermayer <michaelni at gmx.at> writes:
>> 
>> > On Tue, Jun 09, 2009 at 11:57:24PM +0200, Patrick Dehne wrote:
>> >>  id3v2.c |  146 ++++++++++++++++++++++++++++++++
>> >>  id3v2.h |  143 ++++++++++++++++++++++++++++++++
>> >>  mp3.c   |  284 ----------------------------------------------------------------
>> >>  3 files changed, 289 insertions(+), 284 deletions(-)
>> >> 5da35d281da6c56aa9dc5ec6b91f1e6b484841cf  1_adtsaac_parse_id3v2.patch
>> >> Index: libavformat/id3v2.c
>> >> ===================================================================
>> >> --- libavformat/id3v2.c	(revision 19140)
>> >> +++ libavformat/id3v2.c	(working copy)
>> >> @@ -20,6 +20,7 @@
>> >>   */
>> >>  
>> >>  #include "id3v2.h"
>> >> +#include "libavutil/avstring.h"
>> >>  
>> >>  int ff_id3v2_match(const uint8_t *buf)
>> >>  {
>> >> @@ -45,3 +46,148 @@
>> >>          len += ID3v2_HEADER_SIZE;
>> >>      return len;
>> >>  }
>> >> +
>> >> +static unsigned int id3v2_get_size(ByteIOContext *s, int len)
>> >
>> > the id3v2 prefix is redundant for static functions in a file named
>> > id3v2
>> 
>> fixed
>> 
>> > [...]
>> >> Index: libavformat/id3v2.h
>> >> ===================================================================
>> >> --- libavformat/id3v2.h	(revision 19140)
>> >> +++ libavformat/id3v2.h	(working copy)
>> >> @@ -23,10 +23,147 @@
>> >>  #define AVFORMAT_ID3V2_H
>> >>  
>> >>  #include <stdint.h>
>> >> +#include "avformat.h"
>> >>  
>> >>  #define ID3v2_HEADER_SIZE 10
>> >>  
>> >> +#define ID3v1_TAG_SIZE 128
>> >> +
>> >> +#define ID3v1_GENRE_MAX 125
>> >
>> > ID3v1 does not belong in a file named id3v2
>> 
>> fixed
>> 
>> >>  /**
>> >> + * ID3v1 genres
>> >> + */
>> >> +static const char * const id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
>> >
>> > tables dont belong in headers that are possibly included from
>> > multipe places
>> 
>> fixed
>> 
>> > [...]
>> >> @@ -39,4 +176,10 @@
>> >>   */
>> >>  int ff_id3v2_tag_len(const uint8_t *buf);
>> >>  
>> >> +/**
>> >> + * ID3v2 parser
>> >> + * Handles ID3v2.2, 2.3 and 2.4.
>> >> + */
>> >> +void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags);
>> >
>> > needs ff prefix
>> 
>> fixed
>> 
>> Patrick
>> 
>
>>  Makefile |    2 
>>  id3v1.c  |  151 +++++++++++++++++++++++++++++++++
>>  id3v1.h  |   34 +++++++
>>  id3v2.c  |  147 ++++++++++++++++++++++++++++++++
>>  id3v2.h  |    7 +
>>  mp3.c    |  287 ---------------------------------------------------------------
>>  6 files changed, 342 insertions(+), 286 deletions(-)
>> 7574889932ceca1b7803c39bc5fc80f7a15fc9c8  1_adtsaac_parse_id3v2.patch
>> Index: libavformat/id3v1.c
>> ===================================================================
>> --- libavformat/id3v1.c	(revision 0)
>> +++ libavformat/id3v1.c	(revision 0)
>> @@ -0,0 +1,151 @@
>> +/*
>> + * ID3v1 header parser
>> + * Copyright (c) 2003 Fabrice Bellard
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>> + */
>> +
>> +#include "id3v1.h"
>> +
>> +const char *id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
>
> all non static symbols need a ff_ prefix

fixed

> [...]
>> +};
>> \ No newline at end of file
>
> there should be a newline at the end i think

fixed

Patrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1_adtsaac_parse_id3v2.patch
Type: text/x-patch
Size: 19212 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090610/679cbec5/attachment.bin>



More information about the ffmpeg-devel mailing list