[FFmpeg-devel] [PATCH 3/4] lavf: simplify setting the encoder ident tag.

Anton Khirnov anton
Fri Oct 15 21:21:00 CEST 2010


---
 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);
+        }
 
-        if (!(m = av_mallocz(sizeof(AVMetadata))))
-            return AVERROR(ENOMEM);
-        av_metadata_set2(&m, "encoder", LIBAVFORMAT_IDENT, 0);
-        metadata_conv(&m, s->oformat->metadata_conv, NULL);
-        if ((t = av_metadata_get(m, "", NULL, AV_METADATA_IGNORE_SUFFIX)))
-            av_metadata_set2(&s->metadata, t->key, t->value, 0);
-        av_metadata_free(&m);
+        av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
     }
 
     if(s->oformat->write_header){
-- 
1.7.1




More information about the ffmpeg-devel mailing list