summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-01-14 19:30:55 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2011-01-14 19:30:55 +0000
commit7f88a5bf9b2705a301b68743172c1f4ed51ac06f (patch)
tree596744b8dcf504e9cdfcc73243b78cccf113eab2 /libavformat
parentca32f7f2083f9ededd1d9964ed065e0ad07a01e0 (diff)
Introduce av_metadata_copy() to copy metadata from one struct to another.
Originally committed as revision 26330 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h12
-rw-r--r--libavformat/metadata.c8
2 files changed, 19 insertions, 1 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 56a1946fe7..919933ff68 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 92
+#define LIBAVFORMAT_VERSION_MINOR 93
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -227,6 +227,16 @@ attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AV
#endif
/**
+ * Copy metadata from one AVMetadata struct into another.
+ * @param dst pointer to a pointer to a AVMetadata struct. If *dst is NULL,
+ * this function will allocate a struct for you and put it in *dst
+ * @param src pointer to source AVMetadata struct
+ * @param flags flags to use when setting metadata in *dst
+ * @note metadata is read using the AV_METADATA_IGNORE_SUFFIX flag
+ */
+void av_metadata_copy(AVMetadata **dst, AVMetadata *src, int flags);
+
+/**
* Free all the memory allocated for an AVMetadata struct.
*/
void av_metadata_free(AVMetadata **m);
diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index 0c9eb36fc9..7d9a8645df 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -158,3 +158,11 @@ void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv,
for (i=0; i<ctx->nb_programs; i++)
ff_metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv);
}
+
+void av_metadata_copy(AVMetadata **dst, AVMetadata *src, int flags)
+{
+ AVMetadataTag *t = NULL;
+
+ while ((t = av_metadata_get(src, "", t, AV_METADATA_IGNORE_SUFFIX)))
+ av_metadata_set2(dst, t->key, t->value, flags);
+}