[FFmpeg-devel] Subject: [PATCH] Process compressed id3v2 tags.

Clément Bœsch ubitux at gmail.com
Fri Dec 2 10:50:58 CET 2011


On Thu, Dec 01, 2011 at 09:50:48PM -0800, Adrian Drzewiecki wrote:
> ID3v2.4 allows for zlib compressed tags, but libavformat skips them.
> Implement code to inflate compressed tags.
> ---
>  libavformat/id3v2.c |   97 ++++++++++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 89 insertions(+), 8 deletions(-)
> 

Ah and forgot to mention: does it still build & work if you don't have the
zlib?

> diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
> index bb8819f..651b1db 100644
> --- a/libavformat/id3v2.c
> +++ b/libavformat/id3v2.c
> @@ -33,6 +33,8 @@
>  #include "libavutil/dict.h"
>  #include "avio_internal.h"
> 
> +#include <zlib.h>
> +
>  const AVMetadataConv ff_id3v2_34_metadata_conv[] = {
>      { "TALB", "album"},
>      { "TCOM", "composer"},
> @@ -419,6 +421,16 @@ static const ID3v2EMFunc
> *get_extra_meta_func(const char *tag, int isv34)
>      return &id3v2_extra_meta_funcs[i];
>  }
> 
> +static void *ff_id3v2_zalloc(void *opaque, unsigned int items,
> unsigned int size)
> +{
> +    return av_malloc(items * size);
> +}
> +

...and while I'm at it: maybe use av_calloc() which check for overflow.
You could also drop the ff_ here (and below) since it's a local function.

> +static void ff_id3v2_zfree(void *opaque, void *ptr)
> +{
> +    av_free(ptr);
> +}
> +

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111202/23bba681/attachment.asc>


More information about the ffmpeg-devel mailing list