[FFmpeg-devel] [PATCH 2/5] metadata: add new conversion API

Michael Niedermayer michaelni
Sun Oct 3 22:00:34 CEST 2010


On Sun, Oct 03, 2010 at 09:14:23PM +0200, Anton Khirnov wrote:
> From: Anton Khirnov <wyskas at gmail.com>
> 
> Track current metadata format in AVMetadata and add av_metadata_clone()
> function for copying/replacing metadata.
> ---
>  libavformat/asfdec.c         |    2 +
>  libavformat/avformat.h       |   16 +++++++++++
>  libavformat/avidec.c         |    1 +
>  libavformat/id3v2.c          |    2 +
>  libavformat/matroskadec.c    |    2 +
>  libavformat/metadata.c       |   59 ++++++++++++++++++++++++++++++++++++++++++
>  libavformat/metadata.h       |    1 +
>  libavformat/nutdec.c         |    2 +
>  libavformat/oggparsevorbis.c |    3 ++
>  9 files changed, 88 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
> index 6741f8c..59b075c 100644
> --- a/libavformat/asfdec.c
> +++ b/libavformat/asfdec.c
> @@ -204,6 +204,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
>      get_byte(pb);
>      get_byte(pb);
>      memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
> +
> +    av_metadata_clone(&s->metadata, &s->metadata, ff_asf_metadata_conv, NULL, 0);
>      for(;;) {
>          uint64_t gpos= url_ftell(pb);
>          get_guid(pb, &g);
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 362a056..a9fb39f 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -198,6 +198,22 @@ void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv,
>                                                     const AVMetadataConv *s_conv);
>  
>  /**
> + * Copy metadata from src to dst, converting between their respective formats.
> + * dst may be equal to src -- for in-place conversion -- or empty (i.e. a
> + * pointer to NULL), in both cases it is initialized to dst_fmt format.
> + * Otherwise dst_fmt is ignored. src may be a pointer to NULL, in which case
> + * dst is initialized, but nothing is copied.
> + *
> + * @param pattern Used to copy only some keys. If non-NULL, it is passed
> + *                directly to av_metadata_get().
> + * @param flags   Passed directly to av_metadata_get/set. If pattern is NULL,
> + *                defaults to AV_METADATA_IGNORE_SUFFIX|AV_METADATA_DONT_OVERWRITE.
> + * @return >= 0 on success otherwise an error code <0
> + */
> +int av_metadata_clone(AVMetadata **src, AVMetadata **dst, const AVMetadataConv *dst_fmt,
> +                      const char *pattern, int flags);

when the convertion tables become private then there is no more need to
call this from outside so it doesnt need a av_ prefix

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

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101003/8525ba25/attachment.pgp>



More information about the ffmpeg-devel mailing list