diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index 09bfb92cfd..0e894402dc 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -8962,67 +8962,6 @@ qtdemux_parse_container (GstQTDemux * qtdemux, GNode * node, const guint8 * buf, return TRUE; } -static gboolean -qtdemux_parse_theora_extension (GstQTDemux * qtdemux, QtDemuxStream * stream, - GNode * xdxt) -{ - int len = QT_UINT32 (xdxt->data); - guint8 *buf = xdxt->data; - guint8 *end = buf + len; - GstBuffer *buffer; - - /* skip size and type */ - buf += 8; - end -= 8; - - while (buf < end) { - guint32 size; - guint32 type; - - size = QT_UINT32 (buf); - type = QT_FOURCC (buf + 4); - - GST_LOG_OBJECT (qtdemux, "%p %p", buf, end); - - if (end - buf < size || size < 8) - break; - - buf += 8; - size -= 8; - - GST_WARNING_OBJECT (qtdemux, "have cookie %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (type)); - - switch (type) { - case FOURCC_tCtH: - buffer = gst_buffer_new_and_alloc (size); - gst_buffer_fill (buffer, 0, buf, size); - stream->buffers = g_slist_append (stream->buffers, buffer); - GST_LOG_OBJECT (qtdemux, "parsing theora header"); - break; - case FOURCC_tCt_: - buffer = gst_buffer_new_and_alloc (size); - gst_buffer_fill (buffer, 0, buf, size); - stream->buffers = g_slist_append (stream->buffers, buffer); - GST_LOG_OBJECT (qtdemux, "parsing theora comment"); - break; - case FOURCC_tCtC: - buffer = gst_buffer_new_and_alloc (size); - gst_buffer_fill (buffer, 0, buf, size); - stream->buffers = g_slist_append (stream->buffers, buffer); - GST_LOG_OBJECT (qtdemux, "parsing theora codebook"); - break; - default: - GST_WARNING_OBJECT (qtdemux, - "unknown theora cookie %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (type)); - break; - } - buf += size; - } - return TRUE; -} - static gboolean qtdemux_parse_node (GstQTDemux * qtdemux, GNode * node, const guint8 * buffer, guint length) @@ -15411,21 +15350,52 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak, guint32 * mvhd_matrix) } case FOURCC_XiTh: { - GNode *xith, *xdxt; + GNode *xdxt; GST_DEBUG_OBJECT (qtdemux, "found XiTh"); - xith = qtdemux_tree_get_child_by_index (stsd, stsd_index); - if (!xith) - break; - xdxt = qtdemux_tree_get_child_by_type (xith, FOURCC_XdxT); - if (!xdxt) - break; + xdxt = qtdemux_tree_get_child_by_type (stsd_entry, FOURCC_XdxT); + if (xdxt) { + GNode *tcth, *tct, *tctc; - GST_DEBUG_OBJECT (qtdemux, "found XdxT node"); - /* collect the headers and store them in a stream list so that we can - * send them out first */ - qtdemux_parse_theora_extension (qtdemux, stream, xdxt); + GST_DEBUG_OBJECT (qtdemux, "found XdxT node"); + + /* collect the headers and store them in a stream list so that we can + * send them out first */ + + tcth = qtdemux_tree_get_child_by_type (xdxt, FOURCC_tCtH); + if (tcth) { + guint32 size = QT_UINT32 (tcth->data); + GstBuffer *buffer; + + buffer = gst_buffer_new_and_alloc (size); + gst_buffer_fill (buffer, 0, tcth->data, size); + stream->buffers = g_slist_append (stream->buffers, buffer); + GST_LOG_OBJECT (qtdemux, "parsing theora header"); + } + + tct = qtdemux_tree_get_child_by_type (xdxt, FOURCC_tCt_); + if (tct) { + guint32 size = QT_UINT32 (tct->data); + GstBuffer *buffer; + + buffer = gst_buffer_new_and_alloc (size); + gst_buffer_fill (buffer, 0, tct->data, size); + stream->buffers = g_slist_append (stream->buffers, buffer); + GST_LOG_OBJECT (qtdemux, "parsing theora comment"); + } + + tctc = qtdemux_tree_get_child_by_type (xdxt, FOURCC_tCtC); + if (tctc) { + guint32 size = QT_UINT32 (tctc->data); + GstBuffer *buffer; + + buffer = gst_buffer_new_and_alloc (size); + gst_buffer_fill (buffer, 0, tctc->data, size); + stream->buffers = g_slist_append (stream->buffers, buffer); + GST_LOG_OBJECT (qtdemux, "parsing theora codebook"); + } + } break; } case FOURCC_ovc1: diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c index a3daab0b7b..286028c09e 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c @@ -163,7 +163,7 @@ static const QtNodeType qt_node_types[] = { {FOURCC_ctts, "Composition time to sample", 0, qtdemux_dump_ctts}, {FOURCC_cslg, "Composition Shift Least Greatest", 0, qtdemux_dump_cslg}, {FOURCC_XiTh, "XiTh", 0}, - {FOURCC_XdxT, "XdxT", 0}, + {FOURCC_XdxT, "XdxT", QT_FLAG_CONTAINER}, {FOURCC_loci, "loci", 0}, {FOURCC_clsf, "clsf", 0}, {FOURCC_mfra, "movie fragment random access",