diff options
author | Philippe Normand <philn@igalia.com> | 2016-02-25 11:33:13 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-02-25 12:46:27 +0200 |
commit | 9c47c0da59174fa0b725b14df12cac2581087a8a (patch) | |
tree | 9f2779e1452f7be0f3f966543bda06e1446a9b05 | |
parent | 67f3fc174827ff9255c5459f4857b8f214f7f447 (diff) | |
download | gstreamer-plugins-good-9c47c0da59174fa0b725b14df12cac2581087a8a.tar.gz |
qtdemux: cenc aux info parsing from mdat support in PULL mode
This is already supported for PUSH mode but was failing in PULL mode.
The aux info is sometimes stored in the mdat before the first sample,
so the loop task needs to pull data stored at that location and
perform the aux info cenc parsing.
https://bugzilla.gnome.org/show_bug.cgi?id=761700
https://bugzilla.gnome.org/show_bug.cgi?id=762516
-rw-r--r-- | gst/isomp4/qtdemux.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index a8bd06ccf..5334b6ced 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -3458,7 +3458,7 @@ qtdemux_parse_moof (GstQTDemux * qtdemux, const guint8 * buffer, guint length, qtdemux->cenc_aux_info_sizes = NULL; goto fail; } - if (base_offset > qtdemux->moof_offset) + if (base_offset > -1 && base_offset > qtdemux->moof_offset) offset += (guint64) (base_offset - qtdemux->moof_offset); if (info_type == FOURCC_cenc && info_type_parameter == 0U) { GstByteReader br; @@ -5220,6 +5220,30 @@ gst_qtdemux_loop_state_movie (GstQTDemux * qtdemux) MIN (sample_size - stream->offset_in_sample, stream->max_buffer_size); } + if (qtdemux->cenc_aux_info_offset > 0) { + GstMapInfo map; + GstByteReader br; + GstBuffer* aux_info = NULL; + + /* pull the data stored before the sample */ + ret = gst_qtdemux_pull_atom (qtdemux, qtdemux->offset, offset + stream->offset_in_sample - qtdemux->offset, &aux_info); + if (G_UNLIKELY (ret != GST_FLOW_OK)) + goto beach; + gst_buffer_map(aux_info, &map, GST_MAP_READ); + GST_DEBUG_OBJECT (qtdemux, "parsing cenc auxiliary info"); + gst_byte_reader_init (&br, map.data + 8, map.size); + if (!qtdemux_parse_cenc_aux_info (qtdemux, stream, &br, + qtdemux->cenc_aux_info_sizes, qtdemux->cenc_aux_sample_count)) { + GST_ERROR_OBJECT (qtdemux, "failed to parse cenc auxiliary info"); + gst_buffer_unmap(aux_info, &map); + gst_buffer_unref(aux_info); + ret = GST_FLOW_ERROR; + goto beach; + } + gst_buffer_unmap(aux_info, &map); + gst_buffer_unref(aux_info); + } + GST_LOG_OBJECT (qtdemux, "reading %d bytes @ %" G_GUINT64_FORMAT, size, offset); |