mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
tests/examples/seek/scrubby.c: Set higher priority for bus events so they don't get reordered with gtk gui events.
Original commit message from CVS: * tests/examples/seek/scrubby.c: (main): Set higher priority for bus events so they don't get reordered with gtk gui events. * tests/examples/seek/seek.c: (do_seek), (start_seek), (stop_seek), (flush_toggle_cb), (main): Added checkbox do disable flushing seeks. Disable scrubbing when doing non flushing seeks.
This commit is contained in:
parent
3b930ebf09
commit
c758847445
3 changed files with 44 additions and 10 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2005-12-12 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* tests/examples/seek/scrubby.c: (main):
|
||||||
|
Set higher priority for bus events so they don't get reordered with
|
||||||
|
gtk gui events.
|
||||||
|
|
||||||
|
* tests/examples/seek/seek.c: (do_seek), (start_seek), (stop_seek),
|
||||||
|
(flush_toggle_cb), (main):
|
||||||
|
Added checkbox do disable flushing seeks.
|
||||||
|
Disable scrubbing when doing non flushing seeks.
|
||||||
|
|
||||||
2005-12-12 Tim-Philipp Müller <tim at centricular dot net>
|
2005-12-12 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst/subparse/gstsubparse.c: (gst_sub_parse_init),
|
* gst/subparse/gstsubparse.c: (gst_sub_parse_init),
|
||||||
|
|
|
@ -544,7 +544,7 @@ main (int argc, char **argv)
|
||||||
g_assert (bus);
|
g_assert (bus);
|
||||||
|
|
||||||
bus_watch = gst_bus_add_watch_full (bus,
|
bus_watch = gst_bus_add_watch_full (bus,
|
||||||
G_PRIORITY_LOW, bus_message, pipeline, NULL);
|
G_PRIORITY_HIGH, bus_message, pipeline, NULL);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ static GList *seekable_elements = NULL;
|
||||||
static gboolean accurate_seek = FALSE;
|
static gboolean accurate_seek = FALSE;
|
||||||
static gboolean keyframe_seek = FALSE;
|
static gboolean keyframe_seek = FALSE;
|
||||||
static gboolean loop_seek = FALSE;
|
static gboolean loop_seek = FALSE;
|
||||||
|
static gboolean flush_seek = TRUE;
|
||||||
|
|
||||||
static GstElement *pipeline;
|
static GstElement *pipeline;
|
||||||
static gint64 position;
|
static gint64 position;
|
||||||
|
@ -1053,7 +1054,9 @@ do_seek (GtkWidget * widget)
|
||||||
|
|
||||||
real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
|
real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
|
||||||
|
|
||||||
flags = GST_SEEK_FLAG_FLUSH;
|
flags = 0;
|
||||||
|
if (flush_seek)
|
||||||
|
flags |= GST_SEEK_FLAG_FLUSH;
|
||||||
if (accurate_seek)
|
if (accurate_seek)
|
||||||
flags |= GST_SEEK_FLAG_ACCURATE;
|
flags |= GST_SEEK_FLAG_ACCURATE;
|
||||||
if (keyframe_seek)
|
if (keyframe_seek)
|
||||||
|
@ -1069,9 +1072,11 @@ do_seek (GtkWidget * widget)
|
||||||
res = send_event (s_event);
|
res = send_event (s_event);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), 0);
|
if (flush_seek) {
|
||||||
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
|
gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), 0);
|
||||||
50 * GST_MSECOND);
|
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
|
||||||
|
50 * GST_MSECOND);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
g_print ("seek failed\n");
|
g_print ("seek failed\n");
|
||||||
}
|
}
|
||||||
|
@ -1117,12 +1122,12 @@ set_update_scale (gboolean active)
|
||||||
static gboolean
|
static gboolean
|
||||||
start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
|
start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
|
||||||
{
|
{
|
||||||
if (state == GST_STATE_PLAYING)
|
if (state == GST_STATE_PLAYING && flush_seek)
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
||||||
|
|
||||||
set_update_scale (FALSE);
|
set_update_scale (FALSE);
|
||||||
|
|
||||||
if (changed_id == 0) {
|
if (changed_id == 0 && flush_seek) {
|
||||||
changed_id = gtk_signal_connect (GTK_OBJECT (hscale),
|
changed_id = gtk_signal_connect (GTK_OBJECT (hscale),
|
||||||
"value_changed", G_CALLBACK (seek_cb), pipeline);
|
"value_changed", G_CALLBACK (seek_cb), pipeline);
|
||||||
}
|
}
|
||||||
|
@ -1133,8 +1138,15 @@ start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
|
||||||
static gboolean
|
static gboolean
|
||||||
stop_seek (GtkWidget * widget, gpointer user_data)
|
stop_seek (GtkWidget * widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_signal_handler_disconnect (GTK_OBJECT (hscale), changed_id);
|
if (changed_id) {
|
||||||
changed_id = 0;
|
g_signal_handler_disconnect (GTK_OBJECT (hscale), changed_id);
|
||||||
|
changed_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flush_seek) {
|
||||||
|
do_seek (widget);
|
||||||
|
}
|
||||||
|
|
||||||
if (seek_timeout_id != 0) {
|
if (seek_timeout_id != 0) {
|
||||||
g_source_remove (seek_timeout_id);
|
g_source_remove (seek_timeout_id);
|
||||||
seek_timeout_id = 0;
|
seek_timeout_id = 0;
|
||||||
|
@ -1235,6 +1247,12 @@ loop_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
|
||||||
loop_seek = gtk_toggle_button_get_active (button);
|
loop_seek = gtk_toggle_button_get_active (button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
flush_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
|
||||||
|
{
|
||||||
|
flush_seek = gtk_toggle_button_get_active (button);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
|
segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
|
||||||
{
|
{
|
||||||
|
@ -1324,7 +1342,7 @@ int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
GtkWidget *window, *hbox, *vbox, *play_button, *pause_button, *stop_button;
|
GtkWidget *window, *hbox, *vbox, *play_button, *pause_button, *stop_button;
|
||||||
GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox;
|
GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox, *flush_checkbox;
|
||||||
GOptionEntry options[] = {
|
GOptionEntry options[] = {
|
||||||
{"stats", 's', 0, G_OPTION_ARG_NONE, &stats,
|
{"stats", 's', 0, G_OPTION_ARG_NONE, &stats,
|
||||||
"Show pad stats", NULL},
|
"Show pad stats", NULL},
|
||||||
|
@ -1377,6 +1395,8 @@ main (int argc, char **argv)
|
||||||
accurate_checkbox = gtk_check_button_new_with_label ("Accurate Seek");
|
accurate_checkbox = gtk_check_button_new_with_label ("Accurate Seek");
|
||||||
key_checkbox = gtk_check_button_new_with_label ("Key_unit Seek");
|
key_checkbox = gtk_check_button_new_with_label ("Key_unit Seek");
|
||||||
loop_checkbox = gtk_check_button_new_with_label ("Loop");
|
loop_checkbox = gtk_check_button_new_with_label ("Loop");
|
||||||
|
flush_checkbox = gtk_check_button_new_with_label ("Flush");
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flush_checkbox), TRUE);
|
||||||
|
|
||||||
adjustment =
|
adjustment =
|
||||||
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
||||||
|
@ -1401,6 +1421,7 @@ main (int argc, char **argv)
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), accurate_checkbox, FALSE, FALSE, 2);
|
gtk_box_pack_start (GTK_BOX (hbox), accurate_checkbox, FALSE, FALSE, 2);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), key_checkbox, FALSE, FALSE, 2);
|
gtk_box_pack_start (GTK_BOX (hbox), key_checkbox, FALSE, FALSE, 2);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), loop_checkbox, FALSE, FALSE, 2);
|
gtk_box_pack_start (GTK_BOX (hbox), loop_checkbox, FALSE, FALSE, 2);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), flush_checkbox, FALSE, FALSE, 2);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
|
gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
|
||||||
|
|
||||||
/* connect things ... */
|
/* connect things ... */
|
||||||
|
@ -1416,6 +1437,8 @@ main (int argc, char **argv)
|
||||||
G_CALLBACK (key_toggle_cb), pipeline);
|
G_CALLBACK (key_toggle_cb), pipeline);
|
||||||
g_signal_connect (G_OBJECT (loop_checkbox), "toggled",
|
g_signal_connect (G_OBJECT (loop_checkbox), "toggled",
|
||||||
G_CALLBACK (loop_toggle_cb), pipeline);
|
G_CALLBACK (loop_toggle_cb), pipeline);
|
||||||
|
g_signal_connect (G_OBJECT (flush_checkbox), "toggled",
|
||||||
|
G_CALLBACK (flush_toggle_cb), pipeline);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue