mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
qtdemux: Port ctts from Gnode * to GstByteReader
This commit is contained in:
parent
9e49197208
commit
a1e2047472
1 changed files with 9 additions and 11 deletions
|
@ -3722,7 +3722,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
||||||
GstByteReader stsz;
|
GstByteReader stsz;
|
||||||
GstByteReader stsc;
|
GstByteReader stsc;
|
||||||
GstByteReader stts;
|
GstByteReader stts;
|
||||||
GNode *ctts;
|
GstByteReader ctts;
|
||||||
guint32 sample_size = 0;
|
guint32 sample_size = 0;
|
||||||
guint32 n_samples = 0;
|
guint32 n_samples = 0;
|
||||||
guint32 n_samples_per_chunk = 0;
|
guint32 n_samples_per_chunk = 0;
|
||||||
|
@ -4101,24 +4101,22 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* composition time to sample */
|
/* composition time to sample */
|
||||||
if ((ctts = qtdemux_tree_get_child_by_type (stbl, FOURCC_ctts))) {
|
if (qtdemux_tree_get_child_by_type_full (stbl, FOURCC_ctts, &ctts)) {
|
||||||
const guint8 *ctts_data, *ctts_p;
|
|
||||||
guint32 n_entries;
|
guint32 n_entries;
|
||||||
guint32 count;
|
guint32 count;
|
||||||
gint32 soffset;
|
gint32 soffset;
|
||||||
|
|
||||||
ctts_data = (const guint8 *) ctts->data;
|
gst_byte_reader_skip (&ctts, 1 + 3);
|
||||||
n_entries = QT_UINT32 (ctts_data + 12);
|
n_entries = gst_byte_reader_get_uint32_be_unchecked (&ctts);
|
||||||
|
|
||||||
|
if (!qt_atom_parser_has_chunks (&ctts, n_entries, 4 + 4))
|
||||||
|
goto corrupt_file;
|
||||||
|
|
||||||
/* Fill in the pts_offsets */
|
/* Fill in the pts_offsets */
|
||||||
index = 0;
|
index = 0;
|
||||||
ctts_p = ctts_data + 16;
|
|
||||||
/* FIXME: make sure we don't read beyond the atom size/boundary */
|
|
||||||
for (i = 0; i < n_entries; i++) {
|
for (i = 0; i < n_entries; i++) {
|
||||||
count = QT_UINT32 (ctts_p);
|
count = gst_byte_reader_get_uint32_be_unchecked (&ctts);
|
||||||
ctts_p += 4;
|
soffset = gst_byte_reader_get_uint32_be_unchecked (&ctts);
|
||||||
soffset = QT_UINT32 (ctts_p);
|
|
||||||
ctts_p += 4;
|
|
||||||
for (j = 0; j < count; j++) {
|
for (j = 0; j < count; j++) {
|
||||||
/* we operate with very small soffset values here, it shouldn't overflow */
|
/* we operate with very small soffset values here, it shouldn't overflow */
|
||||||
samples[index].pts_offset = soffset * GST_SECOND / stream->timescale;
|
samples[index].pts_offset = soffset * GST_SECOND / stream->timescale;
|
||||||
|
|
Loading…
Reference in a new issue