qtdemux: Take Theora headers directly out of the already parsed nodes
Instead of parsing them yet another time. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
This commit is contained in:
parent
137044195d
commit
118e66f59d
@ -8962,67 +8962,6 @@ qtdemux_parse_container (GstQTDemux * qtdemux, GNode * node, const guint8 * buf,
|
|||||||
return TRUE;
|
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
|
static gboolean
|
||||||
qtdemux_parse_node (GstQTDemux * qtdemux, GNode * node, const guint8 * buffer,
|
qtdemux_parse_node (GstQTDemux * qtdemux, GNode * node, const guint8 * buffer,
|
||||||
guint length)
|
guint length)
|
||||||
@ -15411,21 +15350,52 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak, guint32 * mvhd_matrix)
|
|||||||
}
|
}
|
||||||
case FOURCC_XiTh:
|
case FOURCC_XiTh:
|
||||||
{
|
{
|
||||||
GNode *xith, *xdxt;
|
GNode *xdxt;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "found XiTh");
|
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);
|
xdxt = qtdemux_tree_get_child_by_type (stsd_entry, FOURCC_XdxT);
|
||||||
if (!xdxt)
|
if (xdxt) {
|
||||||
break;
|
GNode *tcth, *tct, *tctc;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "found XdxT node");
|
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 */
|
/* collect the headers and store them in a stream list so that we can
|
||||||
qtdemux_parse_theora_extension (qtdemux, stream, xdxt);
|
* 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;
|
break;
|
||||||
}
|
}
|
||||||
case FOURCC_ovc1:
|
case FOURCC_ovc1:
|
||||||
|
@ -163,7 +163,7 @@ static const QtNodeType qt_node_types[] = {
|
|||||||
{FOURCC_ctts, "Composition time to sample", 0, qtdemux_dump_ctts},
|
{FOURCC_ctts, "Composition time to sample", 0, qtdemux_dump_ctts},
|
||||||
{FOURCC_cslg, "Composition Shift Least Greatest", 0, qtdemux_dump_cslg},
|
{FOURCC_cslg, "Composition Shift Least Greatest", 0, qtdemux_dump_cslg},
|
||||||
{FOURCC_XiTh, "XiTh", 0},
|
{FOURCC_XiTh, "XiTh", 0},
|
||||||
{FOURCC_XdxT, "XdxT", 0},
|
{FOURCC_XdxT, "XdxT", QT_FLAG_CONTAINER},
|
||||||
{FOURCC_loci, "loci", 0},
|
{FOURCC_loci, "loci", 0},
|
||||||
{FOURCC_clsf, "clsf", 0},
|
{FOURCC_clsf, "clsf", 0},
|
||||||
{FOURCC_mfra, "movie fragment random access",
|
{FOURCC_mfra, "movie fragment random access",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user