tests: use g_timeout_add_seconds wherever possible.

https://bugzilla.gnome.org/show_bug.cgi?id=692613
This commit is contained in:
B.Prathibha 2013-01-27 09:45:59 +05:30 committed by Tim-Philipp Müller
parent a4bee3c83a
commit 8afb9e896c
6 changed files with 15 additions and 15 deletions

View file

@ -97,7 +97,7 @@ GST_START_TEST (test_basetime_calculation)
/* Run main pipeline first */
gst_element_set_state (p1, GST_STATE_PLAYING);
g_timeout_add (2 * 1000, break_mainloop, loop);
g_timeout_add_seconds (2, break_mainloop, loop);
g_main_loop_run (loop);
/* Now activate the audio pipeline */
@ -111,7 +111,7 @@ GST_START_TEST (test_basetime_calculation)
/* At this point a new clock is selected */
gst_element_set_state (p1, GST_STATE_PLAYING);
g_timeout_add (2 * 1000, break_mainloop, loop);
g_timeout_add_seconds (2, break_mainloop, loop);
g_main_loop_run (loop);
gst_object_unref (pad);

View file

@ -151,7 +151,7 @@ perform_step (gpointer pstep)
create_stream
("( v4l2src ! videoconvert ! timeoverlay ! queue ! xvimagesink name=v4llive )");
pause_play_stream (bin1, 0);
g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (1));
g_timeout_add_seconds (1, (GSourceFunc) perform_step, GINT_TO_POINTER (1));
break;
case 1:
/* live stream locks on to running_time, pipeline reconfigures latency
@ -159,14 +159,14 @@ perform_step (gpointer pstep)
g_print ("creating bin2\n");
bin2 = create_stream ("( alsasrc ! queue ! alsasink name=alsalive )");
pause_play_stream (bin2, 0);
g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (2));
g_timeout_add_seconds (1, (GSourceFunc) perform_step, GINT_TO_POINTER (2));
break;
case 2:
/* non-live stream, need base_time to align with current running live sources. */
g_print ("creating bin3\n");
bin3 = create_stream ("( audiotestsrc ! alsasink name=atnonlive )");
pause_play_stream (bin3, 0);
g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (3));
g_timeout_add_seconds (1, (GSourceFunc) perform_step, GINT_TO_POINTER (3));
break;
case 3:
g_print ("creating bin4\n");
@ -174,7 +174,7 @@ perform_step (gpointer pstep)
create_stream
("( videotestsrc ! timeoverlay ! videoconvert ! ximagesink name=vtnonlive )");
pause_play_stream (bin4, 0);
g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (4));
g_timeout_add_seconds (1, (GSourceFunc) perform_step, GINT_TO_POINTER (4));
break;
case 4:
/* live stream locks on to running_time */
@ -183,7 +183,7 @@ perform_step (gpointer pstep)
create_stream
("( videotestsrc is-live=1 ! timeoverlay ! videoconvert ! ximagesink name=vtlive )");
pause_play_stream (bin5, 0);
g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (5));
g_timeout_add_seconds (1, (GSourceFunc) perform_step, GINT_TO_POINTER (5));
break;
case 5:
/* pause the fist live stream for 2 seconds */
@ -196,7 +196,7 @@ perform_step (gpointer pstep)
g_print ("PAUSE bin5 for 2 seconds\n");
pause_play_stream (bin5, 2);
g_print ("Waiting 5 seconds\n");
g_timeout_add (5000, (GSourceFunc) perform_step, GINT_TO_POINTER (6));
g_timeout_add_seconds (5, (GSourceFunc) perform_step, GINT_TO_POINTER (6));
break;
case 6:
g_print ("quiting\n");

View file

@ -279,7 +279,7 @@ main (gint argc, gchar * argv[])
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* add a timeout to cycle between the formats */
g_timeout_add (1000, (GSourceFunc) do_switch, pipeline);
g_timeout_add_seconds (1, (GSourceFunc) do_switch, pipeline);
/* now run */
g_main_loop_run (loop);

View file

@ -1,6 +1,6 @@
#include <gst/gst.h>
#define SWITCH_TIMEOUT 1000
#define SWITCH_TIMEOUT 1
#define NUM_VIDEO_BUFFERS 500
static GMainLoop *loop;
@ -151,7 +151,7 @@ main (gint argc, gchar * argv[])
}
/* add switch callback */
g_timeout_add (SWITCH_TIMEOUT, switch_cb, osel);
g_timeout_add_seconds (SWITCH_TIMEOUT, switch_cb, osel);
/* change to playing */
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));

View file

@ -131,7 +131,7 @@ main (gint argc, gchar ** argv)
gst_object_unref (bus);
/* add timeout for queries */
g_timeout_add (1000, (GSourceFunc) run_queries, (gpointer) bin);
g_timeout_add_seconds (1, (GSourceFunc) run_queries, (gpointer) bin);
/* run the show */
if (gst_element_set_state (bin,

View file

@ -156,7 +156,7 @@ create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
g_timeout_add (50, (GSourceFunc) resize_window, pipeline);
g_timeout_add (50, (GSourceFunc) move_window, pipeline);
g_timeout_add (100, (GSourceFunc) cycle_window, ov);
g_timeout_add (2000, (GSourceFunc) toggle_events, ov);
g_timeout_add_seconds (2, (GSourceFunc) toggle_events, ov);
gst_message_unref (message);
return GST_BUS_DROP;
@ -233,8 +233,8 @@ main (int argc, char **argv)
/* We want to get out after */
//g_timeout_add (500000, (GSourceFunc) terminate_playback, pipeline);
g_timeout_add (10000, (GSourceFunc) pause_playback, pipeline);
g_timeout_add (20000, (GSourceFunc) start_playback, pipeline);
g_timeout_add_seconds (10, (GSourceFunc) pause_playback, pipeline);
g_timeout_add_seconds (20, (GSourceFunc) start_playback, pipeline);
g_main_loop_run (loop);