tests/examples/seek/seek.c: When changing spinbutton we try to change the rate on the fly.

Original commit message from CVS:
2006-10-10  Julien MOUTTE  <julien@moutte.net>

* tests/examples/seek/seek.c: (do_seek),
(rate_spinbutton_changed_cb): When changing spinbutton we try
to change the rate on the fly.
This commit is contained in:
Julien Moutte 2006-10-10 18:56:01 +00:00
parent 98b1630fdc
commit 56276ba82d
2 changed files with 36 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2006-10-10 Julien MOUTTE <julien@moutte.net>
* tests/examples/seek/seek.c: (do_seek),
(rate_spinbutton_changed_cb): When changing spinbutton we try
to change the rate on the fly.
2006-10-10 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/riff/riff-ids.h:

View file

@ -1071,8 +1071,13 @@ do_seek (GtkWidget * widget)
if (loop_seek)
flags |= GST_SEEK_FLAG_SEGMENT;
s_event = gst_event_new_seek (rate,
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_NONE, 0);
if (rate >= 0) {
s_event = gst_event_new_seek (rate,
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_NONE, 0);
} else {
s_event = gst_event_new_seek (rate,
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, real);
}
GST_DEBUG ("seek to %" GST_TIME_FORMAT, GST_TIME_ARGS (real));
@ -1281,7 +1286,30 @@ play_scrub_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
static void
rate_spinbutton_changed_cb (GtkSpinButton * button, GstPipeline * pipeline)
{
gboolean res = FALSE;
GstEvent *s_event;
GstSeekFlags flags;
rate = gtk_spin_button_get_value (button);
flags = 0;
if (flush_seek)
flags |= GST_SEEK_FLAG_FLUSH;
if (loop_seek)
flags |= GST_SEEK_FLAG_SEGMENT;
s_event = gst_event_new_seek (rate,
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_NONE, 0, GST_SEEK_TYPE_NONE, 0);
res = send_event (s_event);
if (res) {
if (flush_seek) {
gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), 0);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, SEEK_TIMEOUT);
}
} else
g_print ("seek failed\n");
}
static void
segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)