summaryrefslogtreecommitdiffstats
path: root/examples/switch
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch)
treef863b467dea9559a6ec9c48affbfae11f8104164 /examples/switch
parenta19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff)
downloadgst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'examples/switch')
-rw-r--r--examples/switch/switcher.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/examples/switch/switcher.c b/examples/switch/switcher.c
index d0bc4a67..6296f6ad 100644
--- a/examples/switch/switcher.c
+++ b/examples/switch/switcher.c
@@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -28,38 +28,36 @@ static GMainLoop *loop = NULL;
static void
-got_eos (GstElement *pipeline)
+got_eos (GstElement * pipeline)
{
g_main_loop_quit (loop);
}
static gboolean
-idle_iterate (GstElement *pipeline)
+idle_iterate (GstElement * pipeline)
{
gst_bin_iterate (GST_BIN (pipeline));
return (GST_STATE (GST_ELEMENT (pipeline)) == GST_STATE_PLAYING);
}
static gboolean
-switch_timer (GstElement *video_switch)
+switch_timer (GstElement * video_switch)
{
gint nb_sources, active_source;
-
+
g_object_get (G_OBJECT (video_switch), "nb_sources", &nb_sources, NULL);
- g_object_get (G_OBJECT (video_switch), "active_source",
- &active_source, NULL);
-
- active_source ++;
-
+ g_object_get (G_OBJECT (video_switch), "active_source", &active_source, NULL);
+
+ active_source++;
+
if (active_source > nb_sources - 1)
active_source = 0;
-
- g_object_set (G_OBJECT (video_switch), "active_source",
- active_source, NULL);
-
+
+ g_object_set (G_OBJECT (video_switch), "active_source", active_source, NULL);
+
g_message ("current number of sources : %d, active source %d",
- nb_sources, active_source);
-
+ nb_sources, active_source);
+
return (GST_STATE (GST_ELEMENT (video_switch)) == GST_STATE_PLAYING);
}
@@ -72,7 +70,7 @@ main (int argc, char *argv[])
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
-
+
pipeline = gst_pipeline_new ("pipeline");
src1 = gst_element_factory_make ("videotestsrc", "src1");
g_object_set (G_OBJECT (src1), "pattern", 0, NULL);
@@ -80,26 +78,25 @@ main (int argc, char *argv[])
g_object_set (G_OBJECT (src2), "pattern", 1, NULL);
video_switch = gst_element_factory_make ("switch", "video_switch");
video_sink = gst_element_factory_make ("ximagesink", "video_sink");
-
+
gst_bin_add_many (GST_BIN (pipeline), src1, src2, video_switch,
- video_sink, NULL);
-
+ video_sink, NULL);
+
gst_element_link (src1, video_switch);
gst_element_link (src2, video_switch);
gst_element_link (video_switch, video_sink);
-
- g_signal_connect (G_OBJECT (pipeline), "eos",
- G_CALLBACK (got_eos), NULL);
+
+ g_signal_connect (G_OBJECT (pipeline), "eos", G_CALLBACK (got_eos), NULL);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
+
g_idle_add ((GSourceFunc) idle_iterate, pipeline);
g_timeout_add (2000, (GSourceFunc) switch_timer, video_switch);
-
+
g_main_loop_run (loop);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
-
+
/* unref */
gst_object_unref (GST_OBJECT (pipeline));