mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
08eaa11259
Original commit message from CVS: - added playondemand plugin by Leif Morgan Johnson <lmjohns3@eos.ncsu.edu> - some fixes to int2float - aplied a patch from wrobell <wrobell@ite.pl> that is a first attempt at making automake 1.5 happy (gst now requires automake1.5). It's still not perfect but it builds. - Made the schedulers plugable. The default scheduler now lives inside a plugin. - Added a new mpeg1/2 parser/demuxer. - Fixed some compiler warnings in the core libs. - substantial work to GstThread (hopefully less race conditions). simplified the code in GstThread a bit. A state change can now also happen in the thread context. - reworked the state semantics of a bin. it'll now automatically get the highest state of its children. - the autoplugger now nests the threads so that a state change failure of one thread doesn't make its upstream thread lock. - GstQueue refuses to go to PLAYING if the sinkpad is not connected. This way the queue will not wedge in the _get lock. - GstQueue unlocks its mutexes when going to PAUSED. - make sure that when all elements in a bin/thread go to PAUSED, the bin is set to PAUSED too. - make a parent bin wait for its children to PAUSE before ending the iteration with FALSE (EOS) - Some changes to GstPlay to deal with EOS. - aplied the latest patch from Zeenix to gstrtp. end result: GstPlay doesn't crash on EOS and the pipeline is now shut down properly.
137 lines
4.5 KiB
C
137 lines
4.5 KiB
C
#include <stdlib.h>
|
|
#include <gst/gst.h>
|
|
|
|
int main(int argc,char *argv[]) {
|
|
GstBin *thread, *bin;
|
|
GstElement *src, *identity, *sink, *identity2;
|
|
|
|
gst_init(&argc,&argv);
|
|
gst_info_set_categories(-1);
|
|
gst_debug_set_categories(-1);
|
|
|
|
g_print("\n\nConstructing stuff:\n");
|
|
thread = GST_BIN (gst_pipeline_new("thread"));
|
|
bin = GST_BIN (gst_bin_new("bin"));
|
|
src = gst_elementfactory_make("fakesrc","src");
|
|
identity = gst_elementfactory_make("identity","identity");
|
|
sink = gst_elementfactory_make("fakesink","sink");
|
|
identity2 = gst_elementfactory_make("identity","identity2");
|
|
|
|
g_print("\nAdding src to thread:\n");
|
|
gst_bin_add(thread,src);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nAdding identity to thread:\n");
|
|
gst_bin_add(thread,identity);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nRemoving identity from thread:\n");
|
|
gst_bin_remove(thread, identity);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nAdding identity to thread:\n");
|
|
gst_bin_add(thread,identity);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nConnecting src to identity:\n");
|
|
gst_element_connect(src,"src",identity,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nDisconnecting src from identity:\n");
|
|
gst_element_disconnect(src,"src",identity,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nConnecting src to identity:\n");
|
|
gst_element_connect(src,"src",identity,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nAdding sink to bin:\n");
|
|
gst_bin_add(bin,sink);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nAdding bin to thread:\n");
|
|
gst_bin_add(thread, GST_ELEMENT(bin));
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nConnecting identity to sink:\n");
|
|
gst_element_connect(identity,"src",sink,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nDisconnecting sink:\n");
|
|
gst_element_disconnect(identity,"src",sink,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nAdding identity2 to bin:\n");
|
|
gst_bin_add(bin, identity2);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nConnecting identity2 to sink\n");
|
|
gst_element_connect(identity2,"src",sink,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nConnecting identity to identity2\n");
|
|
gst_element_connect(identity,"src",identity2,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nNow setting state from NULL to READY:\n");
|
|
gst_element_set_state(GST_ELEMENT(thread),GST_STATE_READY);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nNow setting state from READY to PLAYING:\n");
|
|
gst_element_set_state(GST_ELEMENT(thread),GST_STATE_PLAYING);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nIterating:\n");
|
|
gst_bin_iterate(thread);
|
|
|
|
g_print("\n\nNow setting state from PLAYING to READY:\n");
|
|
gst_element_set_state(GST_ELEMENT(thread),GST_STATE_READY);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nNow setting state from READY to PLAYING:\n");
|
|
gst_element_set_state(GST_ELEMENT(thread),GST_STATE_PLAYING);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nIterating:\n");
|
|
gst_bin_iterate(thread);
|
|
|
|
g_print("\n\nNow setting state from PLAYING to READY:\n");
|
|
gst_element_set_state(GST_ELEMENT(thread),GST_STATE_READY);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nDisconnecting identity from identity2:\n");
|
|
gst_element_disconnect(identity,"src",identity2,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nDisconnecting identity2 from sink:\n");
|
|
gst_element_disconnect(identity2,"src",sink,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\nConnecting identity to sink:\n");
|
|
gst_element_connect(identity,"src",sink,"sink");
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nNow setting identity2 to NULL:\n");
|
|
gst_element_set_state(identity2,GST_STATE_NULL);
|
|
|
|
g_print("\nRemoving identity2 from bin:\n");
|
|
gst_bin_remove(bin, identity2);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nNow setting state from READY to PLAYING:\n");
|
|
gst_element_set_state(GST_ELEMENT(thread),GST_STATE_PLAYING);
|
|
gst_scheduler_show(GST_ELEMENT_SCHED(thread));
|
|
|
|
g_print("\n\nIterating:\n");
|
|
gst_bin_iterate(thread);
|
|
|
|
//return;
|
|
g_print("\n\nSetting EOS on fakesrc and iterating again:\n");
|
|
g_object_set(G_OBJECT(src),"eos",TRUE,NULL);
|
|
gst_bin_iterate(thread);
|
|
|
|
g_print("\n\nIterating:\n");
|
|
gst_bin_iterate(thread);
|
|
|
|
return 0;
|
|
}
|