[FFmpeg-devel] [PATCH 3/4] lavf: simplify setting the encoder ident tag.
Tomas Härdin
tomas.hardin
Mon Oct 18 09:20:23 CEST 2010
On Sat, 2010-10-16 at 18:19 +0200, Anton Khirnov wrote:
> On Sat, Oct 16, 2010 at 03:08:39PM +0200, Aurelien Jacobs wrote:
> > On Sat, Oct 16, 2010 at 06:41:47AM +0200, Anton Khirnov wrote:
> > > On Fri, Oct 15, 2010 at 10:24:15PM +0200, Aurelien Jacobs wrote:
> > > > On Fri, Oct 15, 2010 at 09:21:00PM +0200, Anton Khirnov wrote:
> > > > > ---
> > > > > libavformat/utils.c | 13 +++++--------
> > > > > 1 files changed, 5 insertions(+), 8 deletions(-)
> > > > >
> > > > > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > > > > index 289b91c..6fe3793 100644
> > > > > --- a/libavformat/utils.c
> > > > > +++ b/libavformat/utils.c
> > > > > @@ -2755,16 +2755,13 @@ int av_write_header(AVFormatContext *s)
> > > > >
> > > > > /* set muxer identification string */
> > > > > if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
> > > > > - AVMetadata *m;
> > > > > AVMetadataTag *t;
> > > > > + while ((t = av_metadata_get(s->metadata, "encoder", NULL, 0))) {
> > > > > + char *key = av_strdup(t->key);
> > > > > + av_metadata_set2(&s->metadata, key, NULL, AV_METADATA_DONT_STRDUP_KEY);
> > > > > + }
> > > >
> > > > Is this really useful ?
> > > yes, when we're remuxing from e.g. matroska or ogg there might be an
> > > all-uppercase ENCODER tag, which we don't want in the output.
> >
> > Hum... It would probably be cleaner to just export generic tags from the
> > matroska and ogg demuxers. You could provide a conversion table
> > converting ENCODER to encoder (and same for other generic tag), or maybe
> > all tags could be converted to lowercase in those demuxers....
> > But in all cases, it looks wrong to try to workaround demuxers which
> > export encoder name in a tag which is not named "encoder".
> Metadata conversion (and most other metadata-related code) is currently
> case-insensitive. I'd like for it to stay that way.
>
> Maybe we should instead make av_metadata_set2 case insensitive by
> default? Patch for that attached.
> From 9e88c3bee722c813e0313895e1c962d5c2c9bb7d Mon Sep 17 00:00:00 2001
> From: Anton Khirnov <anton at khirnov.net>
> Date: Sat, 16 Oct 2010 18:12:46 +0200
> Subject: [PATCH] metadata: make av_metadata_set2 case insensitive by
> default.
>
> ---
> libavformat/metadata.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/metadata.c b/libavformat/metadata.c
> index 1164fbb..b330d7c 100644
> --- a/libavformat/metadata.c
> +++ b/libavformat/metadata.c
> @@ -49,7 +49,7 @@ av_metadata_get(AVMetadata *m, const char *key,
> const AVMetadataTag *prev, int f
> int av_metadata_set2(AVMetadata **pm, const char *key, const char
> *value, int flags)
> {
> AVMetadata *m= *pm;
> - AVMetadataTag *tag= av_metadata_get(m, key, NULL,
> AV_METADATA_MATCH_CASE);
> + AVMetadataTag *tag= av_metadata_get(m, key, NULL, flags &
> AV_METADATA_MATCH_CASE);
flags & ~AV_METADATA_MATCH_CASE ?
> if(!m)
> m=*pm= av_mallocz(sizeof(*m));
> --
> 1.7.1
/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101018/4fa843a9/attachment.pgp>
More information about the ffmpeg-devel
mailing list