2003-02-10 20:08:59 +00:00
|
|
|
#include <stdlib.h>
|
2001-07-11 19:26:22 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
gboolean playing = TRUE;
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
handoff_signal (GstElement * element, GstBuffer * buf)
|
2001-07-11 19:26:22 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("handoff \"%s\" %" G_GINT64_FORMAT "\n",
|
|
|
|
gst_element_get_name (element), GST_BUFFER_TIMESTAMP (buf));
|
2001-07-11 19:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
eos_signal (GstElement * element)
|
2001-07-11 19:26:22 +00:00
|
|
|
{
|
|
|
|
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
|
|
|
|
|
|
|
|
playing = FALSE;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2001-07-11 19:26:22 +00:00
|
|
|
{
|
|
|
|
GstBin *pipeline;
|
|
|
|
GstElement *src, *tee, *identity1, *identity2, *aggregator, *sink;
|
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
|
|
|
pipeline = GST_BIN (gst_pipeline_new ("pipeline"));
|
|
|
|
g_return_val_if_fail (pipeline != NULL, 1);
|
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
2002-01-01 13:57:18 +00:00
|
|
|
g_object_set (G_OBJECT (src), "num_buffers", 40, NULL);
|
2001-07-11 19:26:22 +00:00
|
|
|
g_return_val_if_fail (src != NULL, 2);
|
2002-04-11 20:35:18 +00:00
|
|
|
tee = gst_element_factory_make ("tee", "tee");
|
2001-07-11 19:26:22 +00:00
|
|
|
g_return_val_if_fail (tee != NULL, 3);
|
2002-04-11 20:35:18 +00:00
|
|
|
identity1 = gst_element_factory_make ("identity", "identity0");
|
2001-07-11 19:26:22 +00:00
|
|
|
g_return_val_if_fail (identity1 != NULL, 3);
|
2002-04-11 20:35:18 +00:00
|
|
|
identity2 = gst_element_factory_make ("identity", "identity1");
|
2001-07-11 19:26:22 +00:00
|
|
|
g_object_set (G_OBJECT (identity2), "duplicate", 2, NULL);
|
2001-07-27 17:12:46 +00:00
|
|
|
g_object_set (G_OBJECT (identity2), "loop_based", TRUE, NULL);
|
2001-07-11 19:26:22 +00:00
|
|
|
g_return_val_if_fail (identity2 != NULL, 3);
|
2002-04-11 20:35:18 +00:00
|
|
|
aggregator = gst_element_factory_make ("aggregator", "aggregator");
|
2002-01-01 13:57:18 +00:00
|
|
|
g_object_set (G_OBJECT (aggregator), "sched", 4, NULL);
|
2001-07-11 19:26:22 +00:00
|
|
|
g_return_val_if_fail (aggregator != NULL, 3);
|
2002-04-11 20:35:18 +00:00
|
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
2001-07-11 19:26:22 +00:00
|
|
|
g_return_val_if_fail (sink != NULL, 4);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_bin_add_many (pipeline, src, tee, identity1, identity2, aggregator, sink,
|
|
|
|
NULL);
|
2001-07-11 19:26:22 +00:00
|
|
|
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_element_link_pads (src, "src", tee, "sink");
|
|
|
|
gst_pad_link (gst_element_get_request_pad (tee, "src%d"),
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_get_pad (identity1, "sink"));
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_pad_link (gst_element_get_request_pad (tee, "src%d"),
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_get_pad (identity2, "sink"));
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_pad_link (gst_element_get_pad (identity1, "src"),
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_get_request_pad (aggregator, "sink%d"));
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_pad_link (gst_element_get_pad (identity2, "src"),
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_get_request_pad (aggregator, "sink%d"));
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_element_link_pads (aggregator, "src", sink, "sink");
|
2001-07-11 19:26:22 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
g_signal_connect (G_OBJECT (src), "eos", G_CALLBACK (eos_signal), NULL);
|
2001-12-13 23:14:39 +00:00
|
|
|
g_signal_connect (G_OBJECT (sink), "handoff",
|
2004-03-13 15:27:01 +00:00
|
|
|
G_CALLBACK (handoff_signal), NULL);
|
2001-07-11 19:26:22 +00:00
|
|
|
|
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
|
|
|
docs/design/part-events.txt: Small update.
Original commit message from CVS:
* docs/design/part-events.txt:
Small update.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_do_sync), (gst_base_sink_activate_push),
(gst_base_sink_activate_pull):
Some more comments.
* gst/elements/gstfakesrc.c: (gst_fake_src_class_init),
(gst_fake_src_create):
Fix handoff marshall.
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_transform_ip):
We're a real inplace element.
* gst/gstbus.c: (gst_bus_post):
Added some comments.
* tests/lat.c: (fakesrc), (fakesink), (simple), (queue), (main):
* tests/muxing/case1.c: (main):
* tests/sched/dynamic-pipeline.c: (main):
* tests/sched/interrupt1.c: (main):
* tests/sched/interrupt2.c: (main):
* tests/sched/interrupt3.c: (main):
* tests/sched/runxml.c: (main):
* tests/sched/sched-stress.c: (main):
* tests/seeking/seeking1.c: (event_received), (main):
* tests/threadstate/threadstate2.c: (bus_handler), (timeout_func),
(main):
* tests/threadstate/threadstate3.c: (main):
* tests/threadstate/threadstate4.c: (main):
* tests/threadstate/threadstate5.c: (main):
Fix the tests.
2005-07-22 11:47:10 +00:00
|
|
|
g_usleep (2 * G_USEC_PER_SEC);
|
2001-07-11 19:26:22 +00:00
|
|
|
|
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
|
|
|
|
|
|
|
exit (0);
|
|
|
|
}
|