[FFmpeg-devel] [PATCH 1/3] metadata API: add a flag to not overwrite existing tags

Anton Khirnov wyskas
Wed Mar 31 19:10:05 CEST 2010


---
 doc/APIchanges         |    4 ++++
 libavformat/avformat.h |    3 ++-
 libavformat/metadata.c |    2 ++
 3 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 2f82917..efc262b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -12,6 +12,10 @@ libavutil:   2009-03-08
 
 API changes, most recent first:
 
+2010-03-31 - rxxxxx - lavf 52.60.0 - metadata API
+  Add a flag for av_metadata_set2() to disable overwriting of
+  existing tags.
+
 2010-03-31 - r22736 - lavu 50.14.0 - AVMediaType
   Move AVMediaType enum from libavcodec to libavutil.
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 65e32bb..5941046 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -22,7 +22,7 @@
 #define AVFORMAT_AVFORMAT_H
 
 #define LIBAVFORMAT_VERSION_MAJOR 52
-#define LIBAVFORMAT_VERSION_MINOR 59
+#define LIBAVFORMAT_VERSION_MINOR 60
 #define LIBAVFORMAT_VERSION_MICRO  0
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -119,6 +119,7 @@ struct AVFormatContext;
 #define AV_METADATA_IGNORE_SUFFIX   2
 #define AV_METADATA_DONT_STRDUP_KEY 4
 #define AV_METADATA_DONT_STRDUP_VAL 8
+#define AV_METADATA_DONT_OVERWRITE 16   ///< Don't overwrite existing tags.
 
 typedef struct {
     char *key;
diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index 9ff7c48..0f2b529 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -55,6 +55,8 @@ int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int fl
         m=*pm= av_mallocz(sizeof(*m));
 
     if(tag){
+        if (flags & AV_METADATA_DONT_OVERWRITE)
+            return 0;
         av_free(tag->value);
         av_free(tag->key);
         *tag= m->elems[--m->count];
-- 
1.7.0




More information about the ffmpeg-devel mailing list