2001-12-19 19:25:06 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
static GstElement *
|
|
|
|
create_pipeline (void)
|
|
|
|
{
|
|
|
|
GstElement *fakesrc, *fakesink;
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *thread, *queue;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("main_pipeline");
|
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
2001-12-19 19:25:06 +00:00
|
|
|
thread = gst_thread_new ("thread");
|
2002-04-11 20:35:18 +00:00
|
|
|
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
|
|
queue = gst_element_factory_make ("queue", "queue");
|
2001-12-19 19:25:06 +00:00
|
|
|
gst_bin_add (GST_BIN (thread), fakesink);
|
|
|
|
gst_bin_add (GST_BIN (thread), queue);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_link (queue, fakesink);
|
|
|
|
gst_element_add_ghost_pad (thread, gst_element_get_pad (queue, "sink"),
|
|
|
|
"sink");
|
2001-12-19 19:25:06 +00:00
|
|
|
|
2003-01-10 04:54:20 +00:00
|
|
|
gst_element_link (fakesrc, thread);
|
2001-12-19 19:25:06 +00:00
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), thread);
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2004-03-13 15:27:01 +00:00
|
|
|
main (gint argc, gchar * argv[])
|
2001-12-19 19:25:06 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
2002-05-09 16:43:10 +00:00
|
|
|
gint i = 10000;
|
|
|
|
gint step = 100;
|
2001-12-19 19:25:06 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
free (malloc (8)); /* -lefence */
|
2001-12-19 19:25:06 +00:00
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
|
|
|
|
|
|
|
g_mem_chunk_info ();
|
|
|
|
while (i--) {
|
2002-05-09 16:43:10 +00:00
|
|
|
if (i % step == 0)
|
|
|
|
fprintf (stderr, "%10d\r", i);
|
2001-12-19 19:25:06 +00:00
|
|
|
pipeline = create_pipeline ();
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-12-19 19:25:06 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
|
|
|
|
|
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
|
|
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
|
|
|
|
|
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
|
|
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
|
|
|
|
gst_object_unref (GST_OBJECT (pipeline));
|
|
|
|
}
|
2002-01-01 13:56:35 +00:00
|
|
|
fprintf (stderr, "\n");
|
2001-12-19 19:25:06 +00:00
|
|
|
g_mem_chunk_info ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|