---
 libavformat/mov.c | 39 +++++++++++++++++++++++++++++++--------
 1 file changed, 31 insertions(+), 8 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4a2d265..c78a7d9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -506,6 +506,8 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     AVStream *st;
     uint32_t type;
     uint32_t av_unused ctype;
+    uint32_t val;
+    char buf[1024];
 
     if (c->fc->nb_streams < 1) // meta before first trak
         return 0;
@@ -532,8 +534,16 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
         st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
 
     avio_rb32(pb); /* component  manufacture */
-    avio_rb32(pb); /* component flags */
-    avio_rb32(pb); /* component flags mask */
+    val = avio_rb32(pb); /* component flags */
+    if (val) {
+        snprintf(buf, sizeof(buf), "%d", val);
+        av_dict_set(&st->metadata, "mov-component-flags", buf, 0);
+    }
+    val = avio_rb32(pb); /* component flags mask */
+    if (val) {
+        snprintf(buf, sizeof(buf), "%d", val);
+        av_dict_set(&st->metadata, "mov-component-mask", buf, 0);
+    }
 
     return 0;
 }
@@ -2389,7 +2399,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     AVStream *st;
     MOVStreamContext *sc;
     int version;
-    int flags;
+    int val;
+    char buf[256];
 
     if (c->fc->nb_streams < 1)
         return 0;
@@ -2397,8 +2408,10 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     sc = st->priv_data;
 
     version = avio_r8(pb);
-    flags = avio_rb24(pb);
-    st->disposition |= (flags & MOV_TKHD_FLAG_ENABLED) ? 
AV_DISPOSITION_DEFAULT : 0;
+    val = avio_rb24(pb);
+    snprintf(buf, sizeof(buf), "%d", val);
+    av_dict_set(&st->metadata, "mov-flags", buf, 0);
+    st->disposition |= (val & MOV_TKHD_FLAG_ENABLED) ? AV_DISPOSITION_DEFAULT 
: 0;
 
     if (version == 1) {
         avio_rb64(pb);
@@ -2415,9 +2428,19 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     avio_rb32(pb); /* reserved */
     avio_rb32(pb); /* reserved */
 
-    avio_rb16(pb); /* layer */
-    avio_rb16(pb); /* alternate group */
-    avio_rb16(pb); /* volume */
+    val = avio_rb16(pb); /* layer */
+    if (val) {
+        snprintf(buf, sizeof(buf), "%d", val);
+        av_dict_set(&st->metadata, "mov-layer", buf, 0);
+    }
+    val = avio_rb16(pb); /* alternate group */
+    snprintf(buf, sizeof(buf), "%d", val);
+    av_dict_set(&st->metadata, "mov-alternate-group", buf, 0);
+    val = avio_rb16(pb); /* volume */
+    if (val) {
+        snprintf(buf, sizeof(buf), "%d", val);
+        av_dict_set(&st->metadata, "mov-volume", buf, 0);
+    }
     avio_rb16(pb); /* reserved */
 
     //read in the display matrix (outlined in ISO 14496-12, Section 6.2.2)
-- 
1.9.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to