summaryrefslogtreecommitdiffstats
path: root/examples/switch
diff options
context:
space:
mode:
authorZaheer Abbas Merali <zaheerabbas@merali.org>2007-06-22 15:30:00 +0000
committerZaheer Abbas Merali <zaheerabbas@merali.org>2007-06-22 15:30:00 +0000
commitd6627ae8e08ddf3a645d0c961970edcfc4a2a3cd (patch)
treebc432985eb40b92ede7f05dfc5f9c0c5a8e2fa14 /examples/switch
parent8eb58da4b47dff93075738afccd452ecbdf9342f (diff)
downloadgst-plugins-bad-d6627ae8e08ddf3a645d0c961970edcfc4a2a3cd.tar.gz
gst-plugins-bad-d6627ae8e08ddf3a645d0c961970edcfc4a2a3cd.tar.bz2
gst-plugins-bad-d6627ae8e08ddf3a645d0c961970edcfc4a2a3cd.zip
examples/switch/switcher.c (my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c (gst_...
Original commit message from CVS: * examples/switch/switcher.c (my_bus_callback, switch_timer, last_message_received, main): * gst/switch/gstswitch.c (gst_switch_release_pad, gst_switch_request_new_pad, gst_switch_chain, gst_switch_event, gst_switch_set_property, gst_switch_get_property, gst_switch_get_linked_pad, gst_switch_getcaps, gst_switch_bufferalloc, gst_switch_dispose, gst_switch_init): * gst/switch/gstswitch.h (switch_mutex, GST_SWITCH_LOCK, GST_SWITCH_UNLOCK): Add an extra lock to protect against certain variables instead of using the object lock. Fix case where caps are different in the sink pads causes deadlock. Update example to use different caps on each sink pad.
Diffstat (limited to 'examples/switch')
-rw-r--r--examples/switch/switcher.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/examples/switch/switcher.c b/examples/switch/switcher.c
index 29f1d1a4..2faa26c7 100644
--- a/examples/switch/switcher.c
+++ b/examples/switch/switcher.c
@@ -68,6 +68,7 @@ switch_timer (GstElement * video_switch)
gint nb_sources;
gchar *active_pad;
+ g_message ("switching");
g_object_get (G_OBJECT (video_switch), "num-sources", &nb_sources, NULL);
g_object_get (G_OBJECT (video_switch), "active-pad", &active_pad, NULL);
@@ -97,7 +98,7 @@ int
main (int argc, char *argv[])
{
GstElement *pipeline, *src1, *src2, *video_switch, *video_sink, *segment;
- GstElement *sink1_sync, *sink2_sync;
+ GstElement *sink1_sync, *sink2_sync, *capsfilter, *scaler;
GstBus *bus;
/* Initing GStreamer library */
@@ -110,11 +111,15 @@ main (int argc, char *argv[])
g_object_set (G_OBJECT (src1), "pattern", 0, NULL);
src2 = gst_element_factory_make ("videotestsrc", "src2");
g_object_set (G_OBJECT (src2), "pattern", 1, NULL);
+ capsfilter = gst_element_factory_make ("capsfilter", "caps0");
+ g_object_set (G_OBJECT (capsfilter), "caps",
+ gst_caps_from_string ("video/x-raw-rgb,width=640,height=480"), NULL);
video_switch = gst_element_factory_make ("switch", "video_switch");
segment = gst_element_factory_make ("identity", "identity-segment");
g_signal_connect (G_OBJECT (segment), "notify::last-message",
G_CALLBACK (last_message_received), segment);
g_object_set (G_OBJECT (segment), "single-segment", TRUE, NULL);
+ scaler = gst_element_factory_make ("videoscale", "videoscale0");
video_sink = gst_element_factory_make ("ximagesink", "video_sink");
//g_object_set (G_OBJECT (video_sink), "sync", FALSE, NULL);
sink1_sync = gst_element_factory_make ("identity", "sink0_sync");
@@ -122,13 +127,15 @@ main (int argc, char *argv[])
sink2_sync = gst_element_factory_make ("identity", "sink1_sync");
g_object_set (G_OBJECT (sink2_sync), "sync", TRUE, NULL);
gst_bin_add_many (GST_BIN (pipeline), src1, src2, segment, video_switch,
- video_sink, sink1_sync, sink2_sync, NULL);
+ video_sink, sink1_sync, sink2_sync, scaler, capsfilter, NULL);
gst_element_link (src1, sink1_sync);
gst_element_link (sink1_sync, video_switch);
- gst_element_link (src2, sink2_sync);
+ gst_element_link (src2, capsfilter);
+ gst_element_link (capsfilter, sink2_sync);
gst_element_link (sink2_sync, video_switch);
gst_element_link (video_switch, segment);
- gst_element_link (segment, video_sink);
+ gst_element_link (segment, scaler);
+ gst_element_link (scaler, video_sink);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, my_bus_callback, NULL);