[FFmpeg-devel] [PATCH] read metadata from wavpack files

Aurelien Jacobs aurel
Sun Oct 18 18:10:08 CEST 2009


On Sun, Oct 18, 2009 at 05:03:15PM +0200, Anton Khirnov wrote:
> $subj
> 
> Anton Khirnov

> From 2d105dbd6de74f109cec56c8e14fc3c4e37ecaff Mon Sep 17 00:00:00 2001
> From: Anton Khirnov <wyskas at gmail.com>
> Date: Fri, 16 Oct 2009 20:17:22 +0200
> Subject: [PATCH] wv: add support for reading metadata.
> 
> ---
>  libavformat/wv.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/wv.c b/libavformat/wv.c
> index d46f90d..1b5eb33 100644
> --- a/libavformat/wv.c
> +++ b/libavformat/wv.c
> @@ -21,6 +21,8 @@
>  
>  #include "libavutil/intreadwrite.h"
>  #include "avformat.h"
> +#include "apetag.h"
> +#include "id3v1.h"
>  
>  // specs say that maximum block size is 1Mb
>  #define WV_BLOCK_LIMIT 1047576
> @@ -146,6 +148,16 @@ static int wv_read_header(AVFormatContext *s,
>      av_set_pts_info(st, 64, 1, wc->rate);
>      s->start_time = 0;
>      s->duration = (int64_t)wc->samples * AV_TIME_BASE / st->codec->sample_rate;
> +
> +    if(!url_is_streamed(s->pb)) {
> +        int64_t cur;
> +        cur = url_ftell(s->pb);
> +        ff_ape_parse_tag(s);
> +        if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
> +            ff_id3v1_read(s);
> +        url_fseek(s->pb, cur, SEEK_SET);
> +    }

Maybe the url_ftell()/url_fseek() pair could be moved inside
ff_ape_parse_tag() (and inside ff_id3v1_read() ?) instead of duplicating
it everywhere...

Aurel



More information about the ffmpeg-devel mailing list