4 * this tests if we can make a GThread and construct and interate a pipeline
6 * used to fail because of cothread ctx key not being reset on context
10 #define MAX_IDENTITIES 29
11 #define RUNS_PER_IDENTITY 5
13 gboolean running = FALSE;
14 gboolean done = FALSE;
17 construct_pipeline (GstElement * pipeline, gint identities)
19 GstElement *src, *sink;
20 GstElement *identity = NULL;
25 src = gst_element_factory_make ("fakesrc", NULL);
26 sink = gst_element_factory_make ("fakesink", NULL);
29 gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
32 for (i = 0; i < identities; ++i) {
33 identity = gst_element_factory_make ("identity", NULL);
35 gst_bin_add (GST_BIN (pipeline), identity);
36 if (!(gst_element_link (from, identity)))
37 g_print ("Warning: can't link identity with previous element\n");
40 gst_element_link (identity, sink);
42 g_object_set (G_OBJECT (src), "num_buffers", 10, "sizetype", 3, NULL);
48 int runs = MAX_IDENTITIES * RUNS_PER_IDENTITY;
52 for (i = 30; i < runs; ++i) {
53 pipeline = gst_pipeline_new ("main_pipeline");
56 g_print ("Run %d, using %d identities\n", i, i / RUNS_PER_IDENTITY + 1);
57 construct_pipeline (pipeline, i / RUNS_PER_IDENTITY + 1);
58 if (!gst_element_set_state (pipeline, GST_STATE_PLAYING))
59 g_print ("WARNING: can't set pipeline to play\n");
60 while (gst_bin_iterate (GST_BIN (pipeline)))
63 g_print ("Unreffing pipeline\n");
64 g_object_unref (G_OBJECT (pipeline));
70 main (gint argc, gchar * argv[])
75 gst_init (&argc, &argv);
77 g_thread_create ((GThreadFunc) thread, NULL, FALSE, NULL);
78 g_print ("main: created GThread\n");
80 g_usleep (G_USEC_PER_SEC);
81 g_print ("main: done\n");