1 #include <gst/gst.h>
3 static GstElement *
4 create_pipeline (void)
5 {
6 GstElement *fakesrc, *fakesink;
7 GstElement *pipeline;
8 GstElement *thread, *queue;
10 pipeline = gst_pipeline_new ("main_pipeline");
12 fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
13 thread = gst_thread_new ("thread");
14 fakesink = gst_element_factory_make ("fakesink", "fakesink");
15 queue = gst_element_factory_make ("queue", "queue");
16 gst_bin_add (GST_BIN (thread), fakesink);
17 gst_bin_add (GST_BIN (thread), queue);
18 gst_element_link (queue, fakesink);
19 gst_element_add_ghost_pad (thread, gst_element_get_pad (queue, "sink"),
20 "sink");
22 gst_element_link (fakesrc, thread);
24 gst_bin_add (GST_BIN (pipeline), fakesrc);
25 gst_bin_add (GST_BIN (pipeline), thread);
27 g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
29 return pipeline;
30 }
32 gint
33 main (gint argc, gchar * argv[])
34 {
35 GstElement *pipeline;
36 gint i = 10000;
37 gint step = 100;
39 free (malloc (8)); /* -lefence */
41 gst_init (&argc, &argv);
44 g_mem_chunk_info ();
45 while (i--) {
46 if (i % step == 0)
47 fprintf (stderr, "%10d\r", i);
48 pipeline = create_pipeline ();
50 gst_element_set_state (pipeline, GST_STATE_PLAYING);
52 while (gst_bin_iterate (GST_BIN (pipeline)));
54 gst_element_set_state (pipeline, GST_STATE_NULL);
56 gst_element_set_state (pipeline, GST_STATE_PLAYING);
58 while (gst_bin_iterate (GST_BIN (pipeline)));
60 gst_element_set_state (pipeline, GST_STATE_NULL);
62 gst_object_unref (GST_OBJECT (pipeline));
63 }
64 fprintf (stderr, "\n");
65 g_mem_chunk_info ();
67 return 0;
68 }