Fix seeking

This commit is contained in:
Sebastian Dröge 2012-10-01 16:56:49 +02:00
parent 5ad29d568e
commit 9a4b1977d4

View file

@ -129,6 +129,8 @@ static void execute_seek (gint64 desired_position, CustomData *data);
static gboolean static gboolean
delayed_seek_cb (CustomData *data) delayed_seek_cb (CustomData *data)
{ {
GST_DEBUG ("Doing delayed seek %" GST_TIME_FORMAT, GST_TIME_ARGS (data->desired_position));
data->last_seek_time = GST_CLOCK_TIME_NONE;
execute_seek (data->desired_position, data); execute_seek (data->desired_position, data);
return FALSE; return FALSE;
} }
@ -224,10 +226,8 @@ static void state_changed_cb (GstBus *bus, GstMessage *msg, CustomData *data) {
/* Only pay attention to messages coming from the pipeline, not its children */ /* Only pay attention to messages coming from the pipeline, not its children */
if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->pipeline)) { if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->pipeline)) {
data->state = new_state; data->state = new_state;
if (data->state >= GST_STATE_PAUSED && GST_CLOCK_TIME_IS_VALID (data->desired_position)) { if (data->state >= GST_STATE_PAUSED && GST_CLOCK_TIME_IS_VALID (data->desired_position))
execute_seek (data->desired_position, data); execute_seek (data->desired_position, data);
data->desired_position = GST_CLOCK_TIME_NONE;
}
GST_DEBUG ("State changed to %s, notifying application", gst_element_state_get_name(new_state)); GST_DEBUG ("State changed to %s, notifying application", gst_element_state_get_name(new_state));
(*env)->CallVoidMethod (env, data->app, set_current_state_method_id, new_state); (*env)->CallVoidMethod (env, data->app, set_current_state_method_id, new_state);
if ((*env)->ExceptionCheck (env)) { if ((*env)->ExceptionCheck (env)) {