3 static GstElement *src1, *src2, *sink, *pipeline, *bin;
7 notify (GstProbe * probe, GstData ** data, gpointer user_data)
11 if (GST_BUFFER_TIMESTAMP (*data) == 10) {
12 gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
14 gst_element_unlink_pads (GST_ELEMENT (src1), "src", sink, "sink");
15 gst_bin_add (GST_BIN (bin), src2);
16 gst_bin_remove (GST_BIN (bin), src1);
17 gst_element_link_pads (GST_ELEMENT (src2), "src", sink, "sink");
18 gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
20 gst_data_unref (*data);
25 GST_BUFFER_TIMESTAMP (*data) = GST_BUFFER_TIMESTAMP (*data) + 10;
26 if (GST_BUFFER_TIMESTAMP (*data) == 20) {
27 gst_data_unref (*data);
28 *data = GST_DATA (gst_event_new (GST_EVENT_EOS));
29 gst_element_set_state (src2, GST_STATE_PAUSED);
41 main (int argc, gchar * argv[])
43 gst_init (&argc, &argv);
45 pipeline = gst_pipeline_new ("main_pipeline");
46 bin = gst_bin_new ("control");
48 src1 = gst_element_factory_make ("fakesrc", "src1");
49 src2 = gst_element_factory_make ("fakesrc", "src2");
51 gst_bin_add (GST_BIN (bin), src1);
53 sink = gst_element_factory_make ("fakesink", "sink");
54 gst_bin_add (GST_BIN (pipeline), sink);
55 gst_bin_add (GST_BIN (pipeline), bin);
57 gst_element_link_pads (GST_ELEMENT (src1), "src", sink, "sink");
59 g_signal_connect (pipeline, "deep_notify",
60 G_CALLBACK (gst_element_default_deep_notify), NULL);
61 g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error),
64 gst_pad_add_probe (gst_element_get_pad (src1, "src"),
65 gst_probe_new (FALSE, notify, NULL));
67 gst_pad_add_probe (gst_element_get_pad (src2, "src"),
68 gst_probe_new (FALSE, notify, NULL));
70 gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
72 while (gst_bin_iterate (GST_BIN (pipeline)));
74 gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
76 gst_object_unref (GST_OBJECT (pipeline));