Commit 354c07de authored by Julien Moutte's avatar Julien Moutte
Browse files

tests/examples/seek/seek.c: Fix various seeking bugs (Slider was not updating...

tests/examples/seek/seek.c: Fix various seeking bugs (Slider was not updating when doing a non flushing seek, Reverse...

Original commit message from CVS:
2007-02-27  Julien MOUTTE  <julien@moutte.net>

* tests/examples/seek/seek.c: (do_seek), (set_update_scale),
(msg_segment_done): Fix various seeking bugs (Slider was not
updating when doing a non flushing seek, Reverse playback
on segment seek was wrong).
parent 749d7204
2007-02-27 Julien MOUTTE <julien@moutte.net>
* tests/examples/seek/seek.c: (do_seek), (set_update_scale),
(msg_segment_done): Fix various seeking bugs (Slider was not
updating when doing a non flushing seek, Reverse playback
on segment seek was wrong).
2007-02-26 Wim Taymans <wim@fluendo.com> 2007-02-26 Wim Taymans <wim@fluendo.com>
   
* tests/examples/seek/seek.c: (stop_seek): * tests/examples/seek/seek.c: (stop_seek):
...@@ -1044,6 +1044,8 @@ update_scale (gpointer data) ...@@ -1044,6 +1044,8 @@ update_scale (gpointer data)
static void do_seek (GtkWidget * widget); static void do_seek (GtkWidget * widget);
static void set_update_scale (gboolean active);
static gboolean static gboolean
end_scrub (GtkWidget * widget) end_scrub (GtkWidget * widget)
{ {
...@@ -1113,21 +1115,24 @@ do_seek (GtkWidget * widget) ...@@ -1113,21 +1115,24 @@ do_seek (GtkWidget * widget)
if (rate >= 0) { if (rate >= 0) {
s_event = gst_event_new_seek (rate, s_event = gst_event_new_seek (rate,
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_SET, -1); GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_SET, -1);
GST_DEBUG ("seek with rate %lf to %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT,
rate, GST_TIME_ARGS (real), GST_TIME_ARGS (duration));
} else { } else {
s_event = gst_event_new_seek (rate, s_event = gst_event_new_seek (rate,
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0), GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
GST_SEEK_TYPE_SET, real); GST_SEEK_TYPE_SET, real);
GST_DEBUG ("seek with rate %lf to %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT,
rate, GST_TIME_ARGS (0), GST_TIME_ARGS (real));
} }
GST_DEBUG ("seek with rate %lf to %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT,
rate, GST_TIME_ARGS (real), GST_TIME_ARGS (duration));
res = send_event (s_event); res = send_event (s_event);
if (res) { if (res) {
if (flush_seek) { if (flush_seek) {
gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), 0); gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), 0);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, SEEK_TIMEOUT); gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, SEEK_TIMEOUT);
} else {
set_update_scale (TRUE);
} }
} else } else
g_print ("seek failed\n"); g_print ("seek failed\n");
...@@ -1159,6 +1164,9 @@ seek_cb (GtkWidget * widget) ...@@ -1159,6 +1164,9 @@ seek_cb (GtkWidget * widget)
static void static void
set_update_scale (gboolean active) set_update_scale (gboolean active)
{ {
GST_DEBUG ("update scale is %d", active);
if (active) { if (active) {
if (update_id == 0) { if (update_id == 0) {
update_id = update_id =
...@@ -1445,15 +1453,9 @@ msg_segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline) ...@@ -1445,15 +1453,9 @@ msg_segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
if (flush_seek) if (flush_seek)
flags |= GST_SEEK_FLAG_FLUSH; flags |= GST_SEEK_FLAG_FLUSH;
if (rate >= 0) { s_event = gst_event_new_seek (rate,
s_event = gst_event_new_seek (rate, GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0), GST_SEEK_TYPE_SET, duration);
GST_SEEK_TYPE_SET, duration);
} else {
s_event = gst_event_new_seek (rate,
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, duration,
GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0));
}
GST_DEBUG ("restart loop with rate %lf to 0 / %" GST_TIME_FORMAT, GST_DEBUG ("restart loop with rate %lf to 0 / %" GST_TIME_FORMAT,
rate, GST_TIME_ARGS (duration)); rate, GST_TIME_ARGS (duration));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment