Commit 750b7c72 authored by Ognyan Tonchev's avatar Ognyan Tonchev Committed by Sebastian Dröge

matroskademux: Simple implementation of TRICKMODE_KEY_UNITS

When the trickmode key-units flag is set on the segment, simply skip
any sample on a video stream that isn't a keyframe

https://bugzilla.gnome.org/show_bug.cgi?id=762185
parent 77403d0a
...@@ -3536,16 +3536,27 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux, ...@@ -3536,16 +3536,27 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
} }
/* else duration is diff between timecode of this and next block */ /* else duration is diff between timecode of this and next block */
/* For SimpleBlock, look at the keyframe bit in flags. Otherwise,
a ReferenceBlock implies that this is not a keyframe. In either
case, it only makes sense for video streams. */
if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO) { if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
/* For SimpleBlock, look at the keyframe bit in flags. Otherwise,
a ReferenceBlock implies that this is not a keyframe. In either
case, it only makes sense for video streams. */
if ((is_simpleblock && !(flags & 0x80)) || referenceblock) { if ((is_simpleblock && !(flags & 0x80)) || referenceblock) {
delta_unit = TRUE; delta_unit = TRUE;
invisible_frame = ((flags & 0x08)) && invisible_frame = ((flags & 0x08)) &&
(!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8) || (!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8) ||
!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP9)); !strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP9));
} }
/* If we're doing a keyframe-only trickmode, only push keyframes on video
* streams */
if (delta_unit
&& demux->common.
segment.flags & GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS) {
GST_LOG_OBJECT (demux, "Skipping non-keyframe on stream %d",
stream->index);
ret = GST_FLOW_OK;
goto done;
}
} }
for (n = 0; n < laces; n++) { for (n = 0; n < laces; n++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment