From: <mn...@ke...> - 2010-03-26 10:55:33
|
Module: gst-plugins-good Branch: master Commit: 6ccffcf5f12be83c3839a604aa3f2aac4ab29fc1 URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=6ccffcf5f12be83c3839a604aa3f2aac4ab29fc1 Author: Mark Nauwelaerts <mar...@co...> Date: Thu Mar 18 13:39:05 2010 +0100 matroskademux: prefer index of video track to perform seeking --- gst/matroska/matroska-demux.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 11ebd09..ed4c923 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -2133,6 +2133,28 @@ gst_matroska_demux_element_send_event (GstElement * element, GstEvent * event) return res; } +/* determine track to seek in */ +static GstMatroskaTrackContext * +gst_matroska_demux_get_seek_track (GstMatroskaDemux * demux, + GstMatroskaTrackContext * track) +{ + gint i; + + if (track && track->type == GST_MATROSKA_TRACK_TYPE_VIDEO) + return track; + + /* FIXME thread safety */ + for (i = 0; i < demux->src->len; i++) { + GstMatroskaTrackContext *stream; + + stream = g_ptr_array_index (demux->src, i); + if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO && stream->index_table) + track = stream; + } + + return track; +} + static gboolean gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, GstPad * pad, GstEvent * event) @@ -2152,6 +2174,8 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, if (pad) track = gst_pad_get_element_private (pad); + track = gst_matroska_demux_get_seek_track (demux, track); + gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, &stop_type, &stop); |