diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2014-04-08 14:33:06 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2014-04-08 14:37:34 +0100 |
commit | 6e764e5b11a87c04d6289da586a0ae8a40ec189d (patch) | |
tree | cda296187f4133ce6328df8cb84bfa87906e6aac /gst/mxf | |
parent | db7934233f614a91a8bebc46de4ff0df23ff9ce4 (diff) | |
download | gstreamer-plugins-bad-6e764e5b11a87c04d6289da586a0ae8a40ec189d.tar.gz |
mxfdemux: implement simple KEY_UNIT seeking
If a KEY_UNIT seek was requested, adjust segment
start to position of the key frame.
Diffstat (limited to 'gst/mxf')
-rw-r--r-- | gst/mxf/mxfdemux.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 24127caa7..d8ef2ce05 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -3316,6 +3316,7 @@ no_new_offset: static gboolean gst_mxf_demux_seek_pull (GstMXFDemux * demux, GstEvent * event) { + GstClockTime keyunit_ts; GstFormat format; GstSeekFlags flags; GstSeekType start_type, stop_type; @@ -3340,6 +3341,8 @@ gst_mxf_demux_seek_pull (GstMXFDemux * demux, GstEvent * event) flush = ! !(flags & GST_SEEK_FLAG_FLUSH); keyframe = ! !(flags & GST_SEEK_FLAG_KEY_UNIT); + keyunit_ts = start; + if (flush) { GstEvent *e; @@ -3391,10 +3394,13 @@ gst_mxf_demux_seek_pull (GstMXFDemux * demux, GstEvent * event) /* Do the actual seeking */ for (i = 0; i < demux->src->len; i++) { + MXFMetadataTrackType track_type; GstMXFDemuxPad *p = g_ptr_array_index (demux->src, i); gint64 position; guint64 off; + track_type = p->material_track->parent.type; + /* Reset EOS flag on all pads */ p->eos = FALSE; p->last_flow = GST_FLOW_OK; @@ -3419,6 +3425,11 @@ gst_mxf_demux_seek_pull (GstMXFDemux * demux, GstEvent * event) p->current_essence_track->source_track->edit_rate.n); } p->current_essence_track_position = position; + + /* FIXME: what about DV + MPEG-TS container essence tracks? */ + if (track_type == MXF_METADATA_TRACK_PICTURE_ESSENCE) { + keyunit_ts = MIN (p->position, keyunit_ts); + } } p->discont = TRUE; } @@ -3452,8 +3463,11 @@ gst_mxf_demux_seek_pull (GstMXFDemux * demux, GstEvent * event) gst_event_set_seqnum (demux->close_seg_event, demux->seqnum); } - if (keyframe) { - /* FIXME: fix up segment start to position of key unit */ + if (keyframe && keyunit_ts != start) { + GST_INFO_OBJECT (demux, "key unit seek, adjusting segment start to " + "%" GST_TIME_FORMAT, GST_TIME_ARGS (keyunit_ts)); + gst_segment_do_seek (&seeksegment, rate, format, flags, + start_type, keyunit_ts, stop_type, stop, &update); } /* Ok seek succeeded, take the newly configured segment */ |