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

Michael Niedermayer michaelni
Wed Jun 10 11:43:03 CEST 2009


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


[...]
> 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


> +
>  /**
> + * 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


[...]
> @@ -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


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090610/de5c1329/attachment.pgp>



More information about the ffmpeg-devel mailing list