[FFmpeg-devel] [PATCH 5/8] metadata: add av_metadata_remove() function.
Anton Khirnov
wyskas
Wed Jun 2 15:16:02 CEST 2010
---
doc/APIchanges | 3 +++
libavformat/avformat.h | 8 +++++++-
libavformat/metadata.c | 18 ++++++++++++++++++
3 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 3bb05c1..e7e8451 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -12,6 +12,9 @@ libavutil: 2009-03-08
API changes, most recent first:
+2010-xx-xx - rxxxxx - lavf 52.68.0 - metadata API
+ Add av_metadata_remove().
+
2010-06-01 - r31301 - lsws 0.11.0 - convertPalette API
Add sws_convertPalette8ToPacked32 and sws_convertPalette8ToPacked24
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 80dc5c3..0f58414 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 67
+#define LIBAVFORMAT_VERSION_MINOR 68
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -159,6 +159,12 @@ attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const
int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags);
/**
+ * Removes the given tag from m.
+ * @return >= 0 on success otherwise an error code < 0.
+ */
+int av_metadata_remove(AVMetadata **pm, AVMetadataTag **t);
+
+/**
* Converts all the metadata sets from ctx according to the source and
* destination conversion tables. If one of the tables is NULL, then
* tags are converted to/from ffmpeg generic tag names.
diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index cf4baf4..aedf91c 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -172,3 +172,21 @@ void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv,
for (i=0; i<ctx->nb_programs; i++)
metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv);
}
+
+int av_metadata_remove(AVMetadata **pm, AVMetadataTag **pt)
+{
+ AVMetadata *m = *pm;
+ AVMetadataTag *t = *pt;
+
+ if (t < m->elems || t >= m->elems + m->count)
+ return AVERROR(EINVAL);
+
+ av_free(t->key);
+ av_free(t->value);
+
+ memmove(t, t + 1, ((m->elems + m->count) - (t + 1))*sizeof(*t));
+ av_realloc(m->elems, (--m->count)*sizeof(*m->elems));
+
+ *pt = NULL;
+ return 0;
+}
--
1.7.1
More information about the ffmpeg-devel
mailing list