2001-01-20 03:02:29 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
gboolean playing = TRUE;
|
|
|
|
|
|
|
|
static void
|
2001-01-20 17:53:03 +00:00
|
|
|
eos_signal_element (GstElement *element)
|
2001-01-20 03:02:29 +00:00
|
|
|
{
|
|
|
|
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-01-20 17:53:03 +00:00
|
|
|
eos_signal (GstElement *element)
|
2001-01-20 03:02:29 +00:00
|
|
|
{
|
|
|
|
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
|
|
|
|
|
|
|
|
playing = FALSE;
|
|
|
|
}
|
|
|
|
|
2001-01-20 17:53:03 +00:00
|
|
|
int
|
|
|
|
main(int argc,char *argv[])
|
2001-01-20 03:02:29 +00:00
|
|
|
{
|
|
|
|
GstBin *pipeline;
|
|
|
|
GstElement *src,*identity,*sink;
|
|
|
|
GstElement *identity2,*sink2;
|
|
|
|
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
|
|
|
|
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
|
|
|
|
g_return_val_if_fail(pipeline != NULL, 1);
|
|
|
|
|
|
|
|
src = gst_elementfactory_make("fakesrc","src");
|
2001-06-25 01:20:11 +00:00
|
|
|
g_object_set (G_OBJECT (src), "num_buffers", 2, NULL);
|
|
|
|
g_object_set (G_OBJECT (src), "num_sources", 2, NULL);
|
2001-01-20 03:02:29 +00:00
|
|
|
g_return_val_if_fail(src != NULL, 2);
|
|
|
|
|
|
|
|
identity = gst_elementfactory_make("identity","identity");
|
|
|
|
g_return_val_if_fail(identity != NULL, 3);
|
|
|
|
|
|
|
|
sink = gst_elementfactory_make("fakesink","sink");
|
|
|
|
g_return_val_if_fail(sink != NULL, 4);
|
|
|
|
|
|
|
|
gst_bin_add(pipeline,GST_ELEMENT(src));
|
|
|
|
gst_bin_add(pipeline,GST_ELEMENT(identity));
|
|
|
|
gst_bin_add(pipeline,GST_ELEMENT(sink));
|
|
|
|
|
|
|
|
gst_element_connect(src,"src",identity,"sink");
|
|
|
|
gst_element_connect(identity,"src",sink,"sink");
|
|
|
|
|
|
|
|
identity2 = gst_elementfactory_make("identity","identity2");
|
|
|
|
g_return_val_if_fail(identity2 != NULL, 3);
|
|
|
|
|
|
|
|
sink2 = gst_elementfactory_make("fakesink","sink2");
|
|
|
|
g_return_val_if_fail(sink2 != NULL, 4);
|
|
|
|
|
|
|
|
gst_bin_add(pipeline,GST_ELEMENT(identity2));
|
|
|
|
gst_bin_add(pipeline,GST_ELEMENT(sink2));
|
|
|
|
|
|
|
|
gst_element_connect(src,"src1",identity2,"sink");
|
|
|
|
gst_element_connect(identity2,"src",sink2,"sink");
|
|
|
|
|
2001-08-13 19:00:13 +00:00
|
|
|
g_signal_connect (G_OBJECT (src), "eos", eos_signal_element, NULL);
|
|
|
|
g_signal_connect (G_OBJECT (pipeline), "eos", eos_signal, NULL);
|
2001-01-20 03:02:29 +00:00
|
|
|
|
|
|
|
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
|
|
|
|
|
|
|
while (playing)
|
|
|
|
gst_bin_iterate(pipeline);
|
|
|
|
|
|
|
|
exit (0);
|
|
|
|
}
|