summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2018-02-09 11:20:38 +0100
committerEdward Hervey <bilboed@bilboed.com>2018-02-09 11:22:38 +0100
commite16be12e373e10906a5d2846631023142883c96e (patch)
treecab7aa852270e6c4df9a59d6add15b3cf1ee17be
parente7177059e91ec5c2b9f1b67e0ed2ed09493ffb83 (diff)
qtdemux: More 'meta' atom parsing fixes
Turns out everybody is doing it their own way, so peek into the meta atom itself to figure out which spec it is following
-rw-r--r--gst/isomp4/qtdemux.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index 9774ece8f..b0deab516 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -7521,13 +7521,27 @@ qtdemux_parse_node (GstQTDemux * qtdemux, GNode * node, const guint8 * buffer,
case FOURCC_meta:
{
GST_DEBUG_OBJECT (qtdemux, "parsing meta atom");
+
/* You are reading this correctly. QTFF specifies that the
* metadata atom is a short atom, whereas ISO BMFF specifies
- * it's a full atom. joy joy joy */
- if (qtdemux->major_brand == FOURCC_qt__)
+ * it's a full atom. But since so many people are doing things
+ * differently, we actually peek into the atom to see which
+ * variant it is */
+ if (length < 16) {
+ GST_LOG_OBJECT (qtdemux, "skipping small %" GST_FOURCC_FORMAT " box",
+ GST_FOURCC_ARGS (fourcc));
+ break;
+ }
+ if (QT_FOURCC (buffer + 12) == FOURCC_hdlr) {
+ /* Variant 1: What QTFF specifies. 'meta' is a short header which
+ * starts with a 'hldr' atom */
qtdemux_parse_container (qtdemux, node, buffer + 8, end);
- else
+ } else if (QT_UINT32 (buffer + 8) == 0x00000000) {
+ /* Variant 2: What ISO BMFF specifies. 'meta' is a _full_ atom
+ * with version/flags both set to zero */
qtdemux_parse_container (qtdemux, node, buffer + 12, end);
+ } else
+ GST_WARNING_OBJECT (qtdemux, "Unknown 'meta' atom format");
break;
}
case FOURCC_mp4s: