1 | #include <gst/gst.h> |
---|
2 | |
---|
3 | static GstElement * |
---|
4 | create_pipeline (void) |
---|
5 | { |
---|
6 | GstElement *fakesrc, *fakesink; |
---|
7 | GstElement *pipeline; |
---|
8 | GstElement *thread, *queue; |
---|
9 | |
---|
10 | pipeline = gst_pipeline_new ("main_pipeline"); |
---|
11 | |
---|
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"); |
---|
21 | |
---|
22 | gst_element_link (fakesrc, thread); |
---|
23 | |
---|
24 | gst_bin_add (GST_BIN (pipeline), fakesrc); |
---|
25 | gst_bin_add (GST_BIN (pipeline), thread); |
---|
26 | |
---|
27 | g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL); |
---|
28 | |
---|
29 | return pipeline; |
---|
30 | } |
---|
31 | |
---|
32 | gint |
---|
33 | main (gint argc, gchar * argv[]) |
---|
34 | { |
---|
35 | GstElement *pipeline; |
---|
36 | gint i = 10000; |
---|
37 | gint step = 100; |
---|
38 | |
---|
39 | free (malloc (8)); /* -lefence */ |
---|
40 | |
---|
41 | gst_init (&argc, &argv); |
---|
42 | |
---|
43 | |
---|
44 | g_mem_chunk_info (); |
---|
45 | while (i--) { |
---|
46 | if (i % step == 0) |
---|
47 | fprintf (stderr, "%10d\r", i); |
---|
48 | pipeline = create_pipeline (); |
---|
49 | |
---|
50 | gst_element_set_state (pipeline, GST_STATE_PLAYING); |
---|
51 | |
---|
52 | while (gst_bin_iterate (GST_BIN (pipeline))); |
---|
53 | |
---|
54 | gst_element_set_state (pipeline, GST_STATE_NULL); |
---|
55 | |
---|
56 | gst_element_set_state (pipeline, GST_STATE_PLAYING); |
---|
57 | |
---|
58 | while (gst_bin_iterate (GST_BIN (pipeline))); |
---|
59 | |
---|
60 | gst_element_set_state (pipeline, GST_STATE_NULL); |
---|
61 | |
---|
62 | gst_object_unref (GST_OBJECT (pipeline)); |
---|
63 | } |
---|
64 | fprintf (stderr, "\n"); |
---|
65 | g_mem_chunk_info (); |
---|
66 | |
---|
67 | return 0; |
---|
68 | } |
---|