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