From 8afb9e896c5f09ff4ad8f3979706ec24b7c35683 Mon Sep 17 00:00:00 2001 From: "B.Prathibha" Date: Sun, 27 Jan 2013 09:45:59 +0530 Subject: [PATCH] tests: use g_timeout_add_seconds wherever possible. https://bugzilla.gnome.org/show_bug.cgi?id=692613 --- tests/check/pipelines/basetime.c | 4 ++-- tests/examples/dynamic/addstream.c | 12 ++++++------ tests/examples/dynamic/codec-select.c | 2 +- tests/icles/output-selector-test.c | 4 ++-- tests/icles/position-formats.c | 2 +- tests/icles/stress-videooverlay.c | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/check/pipelines/basetime.c b/tests/check/pipelines/basetime.c index 401b1b8..180935f 100644 --- a/tests/check/pipelines/basetime.c +++ b/tests/check/pipelines/basetime.c @@ -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); diff --git a/tests/examples/dynamic/addstream.c b/tests/examples/dynamic/addstream.c index 06580d1..b58b5cc 100644 --- a/tests/examples/dynamic/addstream.c +++ b/tests/examples/dynamic/addstream.c @@ -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"); diff --git a/tests/examples/dynamic/codec-select.c b/tests/examples/dynamic/codec-select.c index 6cd3664..48d5c83 100644 --- a/tests/examples/dynamic/codec-select.c +++ b/tests/examples/dynamic/codec-select.c @@ -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); diff --git a/tests/icles/output-selector-test.c b/tests/icles/output-selector-test.c index cc9cf7e..b9d3910 100644 --- a/tests/icles/output-selector-test.c +++ b/tests/icles/output-selector-test.c @@ -1,6 +1,6 @@ #include -#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)); diff --git a/tests/icles/position-formats.c b/tests/icles/position-formats.c index 3530f53..2263520 100644 --- a/tests/icles/position-formats.c +++ b/tests/icles/position-formats.c @@ -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, diff --git a/tests/icles/stress-videooverlay.c b/tests/icles/stress-videooverlay.c index 42d55f5..433aca2 100644 --- a/tests/icles/stress-videooverlay.c +++ b/tests/icles/stress-videooverlay.c @@ -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); -- 2.7.4