gst/gstpipeline.c: Wheen a seek was successful on a pipeline, set the stream_time to the seek offset in order to have...

Original commit message from CVS:
* gst/gstpipeline.c: (gst_pipeline_send_event):
Wheen a seek was successful on a pipeline, set the stream_time to the
seek offset in order to have a synchronized stream_time.
This commit is contained in:
Edward Hervey 2005-06-28 10:45:48 +00:00
parent 57d529de3a
commit 2e75d2ae7e
2 changed files with 23 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2005-06-28 Edward Hervey <edward@fluendo.com>
* gst/gstpipeline.c: (gst_pipeline_send_event):
Wheen a seek was successful on a pipeline, set the stream_time to the
seek offset in order to have a synchronized stream_time.
2005-06-28 Wim Taymans <wim@fluendo.com>
* gst/gstghostpad.c: (gst_proxy_pad_do_bufferalloc),

View file

@ -286,6 +286,7 @@ gst_pipeline_send_event (GstElement * element, GstEvent * event)
GstElementState state;
GstEventType event_type = GST_EVENT_TYPE (event);
GTimeVal timeout;
gint64 offset = -1;
/* need to call _get_state() since a bin state is only updated
* with this call. */
@ -294,13 +295,25 @@ gst_pipeline_send_event (GstElement * element, GstEvent * event)
gst_element_get_state (element, &state, NULL, &timeout);
was_playing = state == GST_STATE_PLAYING;
if (was_playing && event_type == GST_EVENT_SEEK)
if (event_type == GST_EVENT_SEEK) {
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_TIME) {
GST_WARNING ("Pipelines only accept seek events with TIME format");
g_warning ("Pipelines only accept seek events with TIME format");
return FALSE;
}
offset = GST_EVENT_SEEK_OFFSET (event);
if (was_playing)
gst_element_set_state (element, GST_STATE_PAUSED);
}
res = GST_ELEMENT_CLASS (parent_class)->send_event (element, event);
if (was_playing && event_type == GST_EVENT_SEEK)
if (res && event_type == GST_EVENT_SEEK) {
/* need to set the stream time to the seek time */
GST_PIPELINE (element)->stream_time = offset;
if (was_playing)
gst_element_set_state (element, GST_STATE_PLAYING);
}
return res;
}