mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
tests: Use BOILERPLATE macro and update output-selector 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.
This commit is contained in:
parent
db777f1767
commit
4253fc77c6
1 changed files with 19 additions and 13 deletions
|
@ -1,9 +1,14 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
//[.. my_bus_callback goes here ..]
|
#define SWITCH_TIMEOUT 1000
|
||||||
|
#define NUM_VIDEO_BUFFERS 500
|
||||||
|
|
||||||
static GMainLoop *loop;
|
static GMainLoop *loop;
|
||||||
|
|
||||||
|
/* Output selector src pads */
|
||||||
|
static GstPad *osel_src1 = NULL;
|
||||||
|
static GstPad *osel_src2 = NULL;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -40,21 +45,22 @@ my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
||||||
static gboolean
|
static gboolean
|
||||||
switch_cb (gpointer user_data)
|
switch_cb (gpointer user_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstElement *sel = GST_ELEMENT (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"))
|
if (old_pad == osel_src1)
|
||||||
new_pad_name = "src1";
|
new_pad = osel_src2;
|
||||||
else
|
else
|
||||||
new_pad_name = "src0";
|
new_pad = osel_src1;
|
||||||
|
|
||||||
g_object_set (G_OBJECT (sel), "active-pad", new_pad_name, NULL);
|
g_object_set (G_OBJECT (sel), "active-pad", new_pad, NULL);
|
||||||
|
|
||||||
g_print ("switched from %s to %s\n", old_pad_name, new_pad_name);
|
g_print ("switched from %s:%s to %s:%s\n", GST_DEBUG_PAD_NAME (old_pad),
|
||||||
g_free (old_pad_name);
|
GST_DEBUG_PAD_NAME (new_pad));
|
||||||
|
|
||||||
|
gst_object_unref (old_pad);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -64,7 +70,7 @@ gint
|
||||||
main (gint argc, gchar * argv[])
|
main (gint argc, gchar * argv[])
|
||||||
{
|
{
|
||||||
GstElement *pipeline, *src, *toverlay, *osel, *sink1, *sink2, *convert;
|
GstElement *pipeline, *src, *toverlay, *osel, *sink1, *sink2, *convert;
|
||||||
GstPad *osel_src1, *osel_src2, *sinkpad;
|
GstPad *sinkpad;
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
|
|
||||||
/* init GStreamer */
|
/* init GStreamer */
|
||||||
|
@ -92,7 +98,7 @@ main (gint argc, gchar * argv[])
|
||||||
/* set properties */
|
/* set properties */
|
||||||
g_object_set (G_OBJECT (src), "is-live", TRUE, NULL);
|
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), "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 (sink1), "sync", FALSE, "async", FALSE, NULL);
|
||||||
g_object_set (G_OBJECT (sink2), "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);
|
g_object_set (G_OBJECT (osel), "resend-latest", TRUE, NULL);
|
||||||
|
@ -127,7 +133,7 @@ main (gint argc, gchar * argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add switch callback */
|
/* add switch callback */
|
||||||
g_timeout_add (1000, switch_cb, osel);
|
g_timeout_add (SWITCH_TIMEOUT, switch_cb, osel);
|
||||||
|
|
||||||
/* change to playing */
|
/* change to playing */
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||||
|
|
Loading…
Reference in a new issue