[FFmpeg-devel] [PATCH] mov: parse @PRM and @PRQ metadata tags

Peter Ross pross at xvid.org
Sun Dec 9 04:36:19 CET 2012


These tags describe the product and quicktime library version respectively.
Originate from Adobe Premier, but some other products use them.
---
Sample: rsync://fate-suite.ffmpeg.org/fate-suite/cvid/catfight-cvid-pal8-partial.mov

 libavformat/mov.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 046e9b8..4cc1add 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -114,6 +114,18 @@ static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb,
     return 0;
 }
 
+static int mov_metadata_raw(MOVContext *c, AVIOContext *pb,
+                             unsigned len, const char *key)
+{
+    char * value = av_malloc(len + 1);
+    if (!value)
+        return AVERROR(ENOMEM);
+    avio_read(pb, value, len);
+    value[len] = 0;
+    av_dict_set(&c->fc->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
+    return 0;
+}
+
 static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb,
                              unsigned len, const char *key)
 {
@@ -334,6 +346,10 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         parse = mov_metadata_int8_no_padding; break;
     case MKTAG( 'p','g','a','p'): key = "gapless_playback";
         parse = mov_metadata_int8_no_padding; break;
+    case MKTAG( '@','P','R','M'):
+        return mov_metadata_raw(c, pb, atom.size, "prm");
+    case MKTAG( '@','P','R','Q'):
+       return mov_metadata_raw(c, pb, atom.size, "prq");
     }
 
     if (c->itunes_metadata && atom.size > 8) {
-- 
1.8.0

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121209/4bd914c2/attachment.asc>


More information about the ffmpeg-devel mailing list