5 static guint outcount, incount;
8 buffer_handoff_sink (GstElement * src, GstBuffer * buf, GstElement * bin)
10 g_print ("\n\n *** buffer arrived in sink ***\n\n");
11 gst_element_set_state (bin, GST_STATE_NULL);
17 buffer_handoff_src (GstElement * src, GstBuffer * buf, GstElement * bin)
19 g_print ("\n\n *** buffer started in src ***\n\n");
23 /* eos will be called when the src element has an end of stream */
25 eos (GstElement * element, gpointer data)
27 g_print ("have eos, quitting\n");
31 main (int argc, char *argv[])
34 GList *toplevelelements;
37 gst_init (&argc, &argv);
40 g_print ("usage: %s <xml file>\n", argv[0]);
44 g_print ("\n *** using testfile %s\n", argv[1]);
47 gst_xml_parse_file (xml, argv[1], NULL);
49 toplevelelements = gst_xml_get_topelements (xml);
51 while (toplevelelements) {
52 GstElement *bin = (GstElement *) toplevelelements->data;
53 GstElement *src, *sink;
55 g_print ("\n ***** testcase %d\n", i++);
57 src = gst_bin_get_by_name (GST_BIN (bin), "fakesrc");
59 g_signal_connect (G_OBJECT (src), "handoff",
60 G_CALLBACK (buffer_handoff_src), bin);
62 g_print ("could not find src element\n");
66 sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink");
68 g_signal_connect (G_OBJECT (sink), "handoff",
69 G_CALLBACK (buffer_handoff_sink), bin);
71 g_print ("could not find sink element\n");
78 /* gst_element_set_state(bin, GST_STATE_READY); */
79 gst_element_set_state (bin, GST_STATE_PLAYING);
81 if (GST_IS_THREAD (bin)) {
82 g_usleep (G_USEC_PER_SEC);
84 gst_bin_iterate (GST_BIN (bin));
87 if (outcount != 1 && incount != 1) {
88 g_print ("test failed\n");
92 toplevelelements = g_list_next (toplevelelements);