2 * test for fakesrc and fakesink element
4 * originally written for 0.3.2
11 element_create (char *name, char *element)
14 * print an error if it can't be created
15 * return NULL if it couldn't be created
16 * return element if it did work
19 GstElement *el = NULL;
21 el = (GstElement *) gst_element_factory_make (element, name);
23 fprintf (stderr, "Could not create element %s (%s) !\n", name, element);
30 main (int argc, char *argv[])
32 GstElement *pipeline = NULL;
33 GstElement *src, *sink;
37 gst_init (&argc, &argv);
40 g_print ("Creating pipeline\n");
41 pipeline = gst_pipeline_new ("pipeline");
43 g_print ("Connecting signals to pipeline\n");
44 g_signal_connect (pipeline, "deep_notify",
45 G_CALLBACK (property_change_callback), NULL);
46 g_print ("Creating elements\n");
47 if (!(src = element_create ("src", "fakesrc")))
49 g_object_set (G_OBJECT (src), "sizetype", 2, NULL);
50 if (!(sink = element_create ("sink", "fakesink")))
54 g_print ("Adding elements to bin\n");
55 gst_bin_add (GST_BIN (pipeline), src);
56 gst_bin_add (GST_BIN (pipeline), sink);
59 g_print ("Linking elements\n");
60 gst_element_set_state (pipeline, GST_STATE_PLAYING);
62 /* we expect this to give an error */
63 if (gst_bin_iterate (GST_BIN (pipeline)) != FALSE) {
65 ("Iterating a bin with unlinked elements should return FALSE !\n");
69 gst_pad_link (gst_element_get_pad (src, "src"),
70 gst_element_get_pad (sink, "sink"));
73 g_print ("Doing 1 iteration\n");
74 gst_element_set_state (pipeline, GST_STATE_PLAYING);
76 /* we expect this to work */
77 if (gst_bin_iterate (GST_BIN (pipeline)) != TRUE) {
78 g_error ("Iterating a bin with linked elements should return TRUE !\n");