[FFmpeg-devel] [PATCH] avformat/mov: export xml metadata
Paul B Mahol
onemda at gmail.com
Wed Feb 1 13:50:51 EET 2017
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavformat/mov.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9ae4f8c..75e1c9c60 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3764,6 +3764,25 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+static int mov_read_xml(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ uint8_t *xml;
+
+ if (atom.size < 5)
+ return 0;
+
+ avio_skip(pb, 4);
+ xml = av_calloc(atom.size - 4 + 1, sizeof(uint8_t));
+ if (!xml)
+ return AVERROR(ENOMEM);
+
+ avio_read(pb, xml, atom.size - 4);
+ av_dict_set(&c->fc->metadata, "xml", xml, 0);
+ av_free(xml);
+
+ return 0;
+}
+
static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
int64_t end = avio_tell(pb) + atom.size;
@@ -5280,6 +5299,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
parse = mov_read_keys;
}
+ if (!parse &&
+ atom.type == MKTAG('m','e','t','a') &&
+ a.type == MKTAG('x','m','l',' ')) {
+ parse = mov_read_xml;
+ }
+
if (!parse) { /* skip leaf atoms data */
avio_skip(pb, a.size);
} else {
--
2.9.3
More information about the ffmpeg-devel
mailing list