gstreamer/tests/sched/dynamic-pipeline.c
Wim Taymans 086de421dc Totally rewritten registry handling.
Original commit message from CVS:
Totally rewritten registry handling.
- move the registry save/load code into a gstregistry subclass, this
will make it possible to use other registries (flat file, web based,
RDBMS type, etc..)
- a simple GMarkup xml registry is implemented
- use standard statically linked plugins for core elements.
- GstPlugin has a very well defined set of functions now
A little bytestream hack..
Added more info to -inspect.
Some more debugging info for clocking.
Small cleanups

I use ./gst-register --gst-plugin-path=/opt/src/sourceforge/gst-plugins/gst-libs:/opt/src/sourceforge/gst-plugins/
to register core and gst-plugins now.
2002-05-08 20:40:48 +00:00

62 lines
2 KiB
C

#include <gst/gst.h>
/* This test will fail because it tries to allocate two cothread_context's in
* one thread. This will cause a segfault. This is a problem with gstreamer's
* cothreading that will be fixed in the future.
*/
int main (int argc, char *argv[])
{
GstElement *fakesrc, *fakesink1, *fakesink2, *pipe1, *pipe2;
gst_init(&argc, &argv);
if (argc!=1) {
g_print("usage: %s\n", argv[0]);
exit(-1);
}
fakesrc = gst_element_factory_make("fakesrc", "fakesrc");
fakesink1 = gst_element_factory_make("fakesink", "fakesink1");
fakesink2 = gst_element_factory_make("fakesink", "fakesink2");
pipe1 = gst_pipeline_new("pipe1");
/* make the first pipeline */
gst_bin_add (GST_BIN(pipe1), fakesrc);
gst_bin_add (GST_BIN(pipe1), fakesink1);
gst_element_connect_pads (fakesrc, "src", fakesink1, "sink");
/* initialize cothreads */
gst_element_set_state(pipe1, GST_STATE_PLAYING);
gst_bin_iterate (GST_BIN (pipe1));
gst_element_set_state(pipe1, GST_STATE_READY);
/* destroy the fakesink, but keep fakesrc (its state is GST_STATE_READY) */
gst_element_disconnect_pads (fakesrc, "src", fakesink1, "sink");
gst_object_ref(GST_OBJECT(fakesrc));
gst_bin_remove(GST_BIN(pipe1), fakesrc);
gst_bin_remove(GST_BIN(pipe1), fakesink1);
gst_object_unref (GST_OBJECT (pipe1));
pipe2 = gst_pipeline_new("pipe2");
/* make a new pipeline */
gst_bin_add (GST_BIN(pipe2), fakesink2);
/* don't change the new pipeline's state, it should change on the bin_add */
gst_bin_add (GST_BIN(pipe2), fakesrc);
gst_element_connect_pads (fakesrc, "src", fakesink2, "sink");
/* show the pipeline state */
gst_xml_write_file (GST_ELEMENT (pipe2), stdout);
/* try to iterate the pipeline */
gst_element_set_state(pipe2, GST_STATE_PLAYING);
gst_bin_iterate(GST_BIN(pipe2));
gst_element_set_state(pipe2, GST_STATE_NULL);
return 0;
}