diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 06f97dd0aa..c702eb4028 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -263,6 +263,7 @@ gst_avi_demux_reset (GstAviDemux * avi) avi->num_v_streams = 0; avi->num_a_streams = 0; avi->num_t_streams = 0; + avi->main_stream = -1; avi->state = GST_AVI_DEMUX_START; avi->offset = 0; @@ -1663,6 +1664,8 @@ gst_avi_demux_expose_streams (GstAviDemux * avi, gboolean force) GST_PAD_NAME (stream->pad), GST_PAD_CAPS (stream->pad)); gst_element_add_pad ((GstElement *) avi, stream->pad); stream->exposed = TRUE; + if (avi->main_stream == -1) + avi->main_stream = i; } else { GST_WARNING_OBJECT (avi, "Stream #%d doesn't have any entry, removing it", i); @@ -3441,7 +3444,7 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment) /* FIXME, this code assumes the main stream with keyframes is stream 0, * which is mostly correct... */ - stream = &avi->stream[0]; + stream = &avi->stream[avi->main_stream]; /* get the entry index for the requested position */ index = gst_avi_demux_index_for_time (avi, stream, seek_time); diff --git a/gst/avi/gstavidemux.h b/gst/avi/gstavidemux.h index 42ab6a5c55..83cee00de5 100644 --- a/gst/avi/gstavidemux.h +++ b/gst/avi/gstavidemux.h @@ -164,6 +164,8 @@ typedef struct _GstAviDemux { guint num_a_streams; guint num_t_streams; /* subtitle text streams */ + guint main_stream; /* used for seeking */ + /* for streaming mode */ gboolean streaming; gboolean have_eos;