[FFmpeg-devel] [PATCH] Retrieve APE tags from Monkey Audio file

Aurelien Jacobs aurel
Sun Sep 16 15:45:47 CEST 2007


On Sun, 16 Sep 2007 15:02:34 +0200
Benjamin Zores <ben at geexbox.org> wrote:

> Diego Biurrun a ?crit :
> > On Sun, Sep 16, 2007 at 12:33:24PM +0200, Benjamin Zores wrote:
> >> Benjamin Zores a ?crit :
> >>> Attached patch to Monkey Audio demuxer allows APEtags retrieval.
> >>> Please review.
> >> Updated patch with a small get_buffer() fix.
> > 
> > FFmpeg uses 4 spaces for indentation.
> 
> You're right.
> Updatred patch attached.
> 
> [...]
> 
> +    if (!strcmp (buf, APE_TAG_FIELD_TITLE))
> +        ape_set_tag(pb, ctx->title, sizeof(ctx->title), size);
> +    else if (!strcmp (buf, APE_TAG_FIELD_ARTIST))
> +        ape_set_tag(pb, ctx->author, sizeof(ctx->author), size);
> +    else if (!strcmp (buf, APE_TAG_FIELD_COPYRIGHT))
> +        ape_set_tag(pb, ctx->copyright, sizeof(ctx->copyright), size);
> +    else if (!strcmp (buf, APE_TAG_FIELD_COMMENT))
> +        ape_set_tag(pb, ctx->comment, sizeof(ctx->comment), size);
> +    else if (!strcmp (buf, APE_TAG_FIELD_ALBUM))
> +        ape_set_tag(pb, ctx->album, sizeof(ctx->album), size);
> +    else if (!strcmp (buf, APE_TAG_FIELD_YEAR)) {
> +        ape_set_tag(pb, tmp, sizeof(tmp), size);
> +        ctx->year = atoi(tmp);
> +    }
> +    else if (!strcmp (buf, APE_TAG_FIELD_TRACK)) {
> +        ape_set_tag(pb, tmp, sizeof(tmp), size);
> +        ctx->track = atoi(tmp);
> +    }
> +    else if (!strcmp (buf, APE_TAG_FIELD_GENRE))
> +        ape_set_tag(pb, ctx->genre, sizeof(ctx->genre), size);

This big list of if(!strcmp()) looks a bit ugly IMO.
Attached updated patch replaces it by a table and a loop.
It reduces the object size:

   text	   data	    bss	    dec	    hex	filename
   7402	     64	      0	   7466	   1d2a	libavformat/ape.o.before
   7218	     64	      0	   7282	   1c72	libavformat/ape.o.after

Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-ffmpeg-apetag_2.diff
Type: text/x-diff
Size: 4605 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070916/f64e0162/attachment.diff>



More information about the ffmpeg-devel mailing list