summaryrefslogtreecommitdiffstats
path: root/tests/icles
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sourceforge.net>2008-06-19 13:18:24 +0000
committerStefan Kost <ensonic@users.sourceforge.net>2008-06-19 13:18:24 +0000
commitd190f3cf8406edf4686a2f7c9f633cca6b32f54f (patch)
tree280eb19c972eac08406e1e913c910652301ccaa5 /tests/icles
parent1de45598a79c268b70785523b52980562613272c (diff)
downloadgst-plugins-bad-d190f3cf8406edf4686a2f7c9f633cca6b32f54f.tar.gz
gst-plugins-bad-d190f3cf8406edf4686a2f7c9f633cca6b32f54f.tar.bz2
gst-plugins-bad-d190f3cf8406edf4686a2f7c9f633cca6b32f54f.zip
Use BOILERPLATE macro and update test to the latest api changes.
Original commit message from CVS: * gst/selector/gstoutputselector.c: * tests/icles/output-selector-test.c: Use BOILERPLATE macro and update test to the latest api changes.
Diffstat (limited to 'tests/icles')
-rwxr-xr-xtests/icles/output-selector-test.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/icles/output-selector-test.c b/tests/icles/output-selector-test.c
index b158b68e..1d54b34a 100755
--- a/tests/icles/output-selector-test.c
+++ b/tests/icles/output-selector-test.c
@@ -1,9 +1,14 @@
#include <gst/gst.h>
-//[.. my_bus_callback goes here ..]
+#define SWITCH_TIMEOUT 1000
+#define NUM_VIDEO_BUFFERS 500
static GMainLoop *loop;
+/* Output selector src pads */
+static GstPad *osel_src1 = NULL;
+static GstPad *osel_src2 = NULL;
+
static gboolean
my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
{
@@ -40,21 +45,22 @@ my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
static gboolean
switch_cb (gpointer user_data)
{
-
GstElement *sel = GST_ELEMENT (user_data);
- gchar *old_pad_name, *new_pad_name;
+ GstPad *old_pad, *new_pad = NULL;
- g_object_get (G_OBJECT (sel), "active-pad", &old_pad_name, NULL);
+ g_object_get (G_OBJECT (sel), "active-pad", &old_pad, NULL);
- if (g_str_equal (old_pad_name, "src0"))
- new_pad_name = "src1";
+ if (old_pad == osel_src1)
+ new_pad = osel_src2;
else
- new_pad_name = "src0";
+ new_pad = osel_src1;
+
+ g_object_set (G_OBJECT (sel), "active-pad", new_pad, NULL);
- g_object_set (G_OBJECT (sel), "active-pad", new_pad_name, NULL);
+ g_print ("switched from %s:%s to %s:%s\n", GST_DEBUG_PAD_NAME (old_pad),
+ GST_DEBUG_PAD_NAME (new_pad));
- g_print ("switched from %s to %s\n", old_pad_name, new_pad_name);
- g_free (old_pad_name);
+ gst_object_unref (old_pad);
return TRUE;
@@ -64,7 +70,7 @@ gint
main (gint argc, gchar * argv[])
{
GstElement *pipeline, *src, *toverlay, *osel, *sink1, *sink2, *convert;
- GstPad *osel_src1, *osel_src2, *sinkpad;
+ GstPad *sinkpad;
GstBus *bus;
/* init GStreamer */
@@ -92,7 +98,7 @@ main (gint argc, gchar * argv[])
/* set properties */
g_object_set (G_OBJECT (src), "is-live", TRUE, NULL);
g_object_set (G_OBJECT (src), "do-timestamp", TRUE, NULL);
- g_object_set (G_OBJECT (src), "num-buffers", 500, NULL);
+ g_object_set (G_OBJECT (src), "num-buffers", NUM_VIDEO_BUFFERS, NULL);
g_object_set (G_OBJECT (sink1), "sync", FALSE, "async", FALSE, NULL);
g_object_set (G_OBJECT (sink2), "sync", FALSE, "async", FALSE, NULL);
g_object_set (G_OBJECT (osel), "resend-latest", TRUE, NULL);
@@ -127,7 +133,7 @@ main (gint argc, gchar * argv[])
}
/* add switch callback */
- g_timeout_add (1000, switch_cb, osel);
+ g_timeout_add (SWITCH_TIMEOUT, switch_cb, osel);
/* change to playing */
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));