[FFmpeg-cvslog] mov: Parse tmcd extradata

Luca Barbato git at videolan.org
Mon Aug 26 14:31:16 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Sun Aug 25 13:02:07 2013 +0200| [5b41eb91e0083755de8c35e8cd005896ec3ab31f] | committer: Luca Barbato

mov: Parse tmcd extradata

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b41eb91e0083755de8c35e8cd005896ec3ab31f
---

 libavformat/mov.c |   26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0e823f5..6614f89 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1306,6 +1306,23 @@ static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,
     st->codec->height = sc->height;
 }
 
+static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb,
+                                AVStream *st, MOVStreamContext *sc,
+                                int size)
+{
+    if (st->codec->codec_tag == MKTAG('t','m','c','d')) {
+        st->codec->extradata_size = size;
+        st->codec->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+        if (!st->codec->extradata)
+            return AVERROR(ENOMEM);
+        avio_read(pb, st->codec->extradata, size);
+    } else {
+        /* other codec type, just skip (rtp, mp4s ...) */
+        avio_skip(pb, size);
+    }
+    return 0;
+}
+
 static int mov_finalize_stsd_codec(MOVContext *c, AVIOContext *pb,
                                    AVStream *st, MOVStreamContext *sc)
 {
@@ -1409,7 +1426,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
          pseudo_stream_id++) {
         //Parsing Sample description table
         enum AVCodecID id;
-        int dref_id = 1;
+        int ret, dref_id = 1;
         MOVAtom a = { AV_RL32("stsd") };
         int64_t start_pos = avio_tell(pb);
         uint32_t size = avio_rb32(pb); /* size */
@@ -1448,13 +1465,14 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
             mov_parse_stsd_subtitle(c, pb, st, sc,
                                     size - (avio_tell(pb) - start_pos));
         } else {
-            /* other codec type, just skip (rtp, mp4s, tmcd ...) */
-            avio_skip(pb, size - (avio_tell(pb) - start_pos));
+            ret = mov_parse_stsd_data(c, pb, st, sc,
+                                      size - (avio_tell(pb) - start_pos));
+            if (ret < 0)
+                return ret;
         }
         /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */
         a.size = size - (avio_tell(pb) - start_pos);
         if (a.size > 8) {
-            int ret;
             if ((ret = mov_read_default(c, pb, a)) < 0)
                 return ret;
         } else if (a.size > 0)



More information about the ffmpeg-cvslog mailing list