qtdemux: Simple implementation of GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS
authorJan Schmidt <jan@centricular.com>
Wed, 4 Feb 2015 10:50:51 +0000 (21:50 +1100)
committerJan Schmidt <jan@centricular.com>
Wed, 4 Feb 2015 10:58:31 +0000 (21:58 +1100)
When the trickmode key-units flag is set on the segment, simply skip
any sample on a video stream that isn't a keyframe

gst/isomp4/qtdemux.c

index baffc76..5f1fffa 100644 (file)
@@ -4531,6 +4531,15 @@ gst_qtdemux_loop_state_movie (GstQTDemux * qtdemux)
               &offset, &sample_size, &dts, &pts, &duration, &keyframe)))
     goto eos_stream;
 
+  /* If we're doing a keyframe-only trickmode, only push keyframes on video streams */
+  if (G_UNLIKELY (qtdemux->
+          segment.flags & GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS)) {
+    if (stream->subtype == FOURCC_vide && !keyframe) {
+      GST_LOG_OBJECT (qtdemux, "Skipping non-keyframe on stream %d", index);
+      goto next;
+    }
+  }
+
   GST_DEBUG_OBJECT (qtdemux,
       "pushing from stream %d, empty %d offset %" G_GUINT64_FORMAT
       ", size %d, dts=%" GST_TIME_FORMAT ", pts=%" GST_TIME_FORMAT