qtdemux: allow pulling atoms with unknown size
authorMarc-André Lureau <mlureau@flumotion.com>
Thu, 11 Mar 2010 13:10:12 +0000 (14:10 +0100)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Fri, 3 Dec 2010 14:50:30 +0000 (15:50 +0100)
Signed-off-by: Andoni Morales Alastruey <amorales@flumotion.com>
https://bugzilla.gnome.org/show_bug.cgi?id=596321

gst/qtdemux/qtdemux.c

index 0e5a0fc..a4a3a8b 100644 (file)
@@ -510,6 +510,20 @@ gst_qtdemux_pull_atom (GstQTDemux * qtdemux, guint64 offset, guint64 size,
 {
   GstFlowReturn flow;
 
+  if (size == 0) {
+    GstFlowReturn ret;
+    GstBuffer *tmp = NULL;
+
+    ret = gst_qtdemux_pull_atom (qtdemux, offset, sizeof (guint32), &tmp);
+    if (ret != GST_FLOW_OK)
+      return ret;
+
+    size = QT_UINT32 (GST_BUFFER_DATA (tmp));
+    GST_DEBUG ("size 0x%08" G_GINT64_MODIFIER "x", size);
+
+    gst_buffer_unref (tmp);
+  }
+
   /* Sanity check: catch bogus sizes (fuzzed/broken files) */
   if (G_UNLIKELY (size > QTDEMUX_MAX_ATOM_SIZE)) {
     GST_ELEMENT_ERROR (qtdemux, STREAM, DEMUX,