diff --git a/examples/events/Makefile.am b/examples/events/Makefile.am new file mode 100644 index 0000000000..82d65e2f46 --- /dev/null +++ b/examples/events/Makefile.am @@ -0,0 +1,4 @@ +noinst_PROGRAMS = seek + +LIBS = $(GLIB_LIBS) $(GST_LIBS) +CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS) diff --git a/examples/events/seek.c b/examples/events/seek.c new file mode 100644 index 0000000000..89a6e27189 --- /dev/null +++ b/examples/events/seek.c @@ -0,0 +1,68 @@ +#include + +int +main (int argc, char *argv[]) +{ + GstBin *bin; + GstElement *src, *sink; + GstPad *srcpad, *sinkpad; + +// _gst_plugin_spew = TRUE; + gst_init (&argc, &argv); + + bin = GST_BIN (gst_pipeline_new ("pipeline")); + g_return_val_if_fail (bin != NULL, -1); + + g_print ("--- creating src and sink elements\n"); + src = gst_elementfactory_make ("fakesrc", "src"); + g_return_val_if_fail (src != NULL, -1); + sink = gst_elementfactory_make ("fakesink", "sink"); + g_return_val_if_fail (sink != NULL, -1); + + g_print ("--- about to add the elements to the bin\n"); + gst_bin_add (bin, GST_ELEMENT (src)); + gst_bin_add (bin, GST_ELEMENT (sink)); + + g_print ("--- getting pads\n"); + srcpad = gst_element_get_pad (src, "src"); + g_return_val_if_fail (srcpad != NULL, -1); + sinkpad = gst_element_get_pad (sink, "sink"); + g_return_val_if_fail (srcpad != NULL, -1); + + g_print ("--- connecting\n"); + gst_pad_connect (srcpad, sinkpad); + + g_print ("--- setting up\n"); + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); + + g_print ("--- iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- seek to 100\n"); + gst_pad_send_event (srcpad, gst_event_new_seek (GST_SEEK_ANY, 100, FALSE)); + + g_print ("--- seek done, iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- seek to 200 with flush\n"); + gst_pad_send_event (srcpad, gst_event_new_seek (GST_SEEK_ANY, 200, TRUE)); + + g_print ("--- seek done, iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- flush\n"); + gst_pad_send_event (srcpad, gst_event_new_flush ()); + + g_print ("--- flush done, iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- cleaning up\n"); + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + + return 0; +} diff --git a/gstreamer-uninstalled.pc.in b/gstreamer-uninstalled.pc.in index d8a7ccf03a..b8483ee1c1 100644 --- a/gstreamer-uninstalled.pc.in +++ b/gstreamer-uninstalled.pc.in @@ -7,6 +7,6 @@ Name: GStreamer Uninstalled Description: Streaming-media framework, Not Installed Version: @VERSION@ Requires: @GST_PKG_DEPS@, libxml >= 1.8.1 -Libs: ${pcfiledir}/gst/libgst.la +Libs: ${pcfiledir}/gst/libgst.la -L${pcfiledir}/libs/gst/control/ Cflags: -I${pcfiledir} -I${pcfiledir}/libs -I${pc_top_builddir}/${pcfiledir}/@srcdir@ -I${pc_top_builddir}/${pcfiledir}/@srcdir@/libs @GST_PKG_CFLAGS@ diff --git a/test/Makefile.am b/test/Makefile.am index 70d71e380a..992f3b64c0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,32 +1,8 @@ -# FIXME FIXME +noinst_PROGRAMS = lat -INCLUDES = $(LIBGST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS) -I.. +SUBDIRS = bufspeed memchunk -if HAVE_GNOME -GNOME_PROGS = spectrum wave mp1parse videotest aviparse \ - videotest2 video2mp1 dvshow dv2mp1 \ - mpeg2parse2 mpeg2parse3 \ - mp2tomp1v2 main sinesliders testspeed dvdplay testpod -sinesliders_LDADD = ../libs/gst/control/libgstcontrol.la -else -GNOME_PROGS = -endif - -noinst_PROGRAMS = qtest $(GNOME_PROGS) record mp3 teardown buffer mp3parse \ - mp3play ac3parse ac3play dvdcat fake cobin \ - vidcapture avi2mpg mp2tomp1 mp1tomp1 pipetest \ - vidcapture2 mp2toavi mp3tovorbis xmmstest \ - mp3mad lat - -SUBDIRS = xml bindings events memchunk - -buffer_SOURCES = buffer.c mem.c -teardown_SOURCES = teardown.c mem.c -ac3play_SOURCES = ac3play.c mem.c - -noinst_HEADERS = mem.h - -LIBS = $(GNOME_LIBS) $(GST_LIBS) -CFLAGS = $(GNOME_CFLAGS) $(GST_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS) +lat_CFLAGS = $(GST_CFLAGS) +lat_LDFLAGS = $(GST_LIBS) EXTRA_DIST = README diff --git a/tests/autoplug.c b/tests/autoplug.c deleted file mode 100644 index 212922564b..0000000000 --- a/tests/autoplug.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -static void -new_object_added (GstAutoplug *autoplug, GstObject *object) -{ - g_print ("added new object \"%s\"\n", gst_object_get_name (object)); -} - -int -main (int argc, char *argv[]) -{ - GstElement *element; - GstElement *videosink, *osssink; - GstAutoplug *autoplugger; - GstCaps *testcaps; - - gst_init(&argc,&argv); - - osssink = gst_elementfactory_make ("osssink", "osssink"); - g_assert (osssink != NULL); - videosink = gst_elementfactory_make ("xvideosink", "videosink"); - g_assert (videosink != NULL); - - testcaps = gst_caps_new ("test_caps", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL)); - - autoplugger = gst_autoplugfactory_make ("static"); - - g_signal_connect (G_OBJECT (autoplugger), "new_object", - G_CALLBACK (new_object_added), NULL); - - element = gst_autoplug_to_caps (autoplugger, testcaps, - gst_pad_get_caps (gst_element_get_pad (osssink, "sink")), - gst_pad_get_caps (gst_element_get_pad (videosink, "sink")), - NULL); - g_assert (element != NULL); - - xmlDocDump (stdout, gst_xml_write (element)); - - exit (0); -} diff --git a/tests/autoplug2.c b/tests/autoplug2.c deleted file mode 100644 index 8d2aee91d8..0000000000 --- a/tests/autoplug2.c +++ /dev/null @@ -1,77 +0,0 @@ -#include - -static GstElement* -autoplug_caps (GstAutoplug *autoplug, gchar *mime1, gchar *mime2) -{ - GstCaps *caps1, *caps2; - - caps1 = gst_caps_new ("tescaps1", mime1, NULL); - caps2 = gst_caps_new ("tescaps2", mime2, NULL); - - return gst_autoplug_to_caps (autoplug, caps1, caps2, NULL); -} - -int -main (int argc, char *argv[]) -{ - GstElement *element; - GstAutoplug *autoplug; - - gst_init(&argc,&argv); - - autoplug = gst_autoplugfactory_make ("static"); - - element = autoplug_caps (autoplug, "audio/mp3", "audio/raw"); - xmlSaveFile ("autoplug2_1.gst", gst_xml_write (element)); - - element = autoplug_caps (autoplug, "video/mpeg", "audio/raw"); - xmlSaveFile ("autoplug2_2.gst", gst_xml_write (element)); - - element = gst_autoplug_to_caps (autoplug, - gst_caps_new( - "testcaps3", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL)), - gst_caps_new("testcaps4","audio/raw", NULL), - NULL); - xmlSaveFile ("autoplug2_3.gst", gst_xml_write (element)); - - element = gst_autoplug_to_caps (autoplug, - gst_caps_new( - "testcaps5", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (FALSE), - NULL)), - gst_caps_new("testcaps6", "video/raw", NULL), - NULL); - xmlSaveFile ("autoplug2_4.gst", gst_xml_write (element)); - - element = gst_autoplug_to_caps (autoplug, - gst_caps_new( - "testcaps7", - "video/avi", NULL), - gst_caps_new("testcaps8", "video/raw", NULL), - gst_caps_new("testcaps9", "audio/raw", NULL), - NULL); - xmlSaveFile ("autoplug2_5.gst", gst_xml_write (element)); - - element = gst_autoplug_to_caps (autoplug, - gst_caps_new( - "testcaps10", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL)), - gst_caps_new("testcaps10", "video/raw", NULL), - gst_caps_new("testcaps11", "audio/raw", NULL), - NULL); - xmlSaveFile ("autoplug2_6.gst", gst_xml_write (element)); - - exit (0); -} diff --git a/tests/autoplug3.c b/tests/autoplug3.c deleted file mode 100644 index 40c1cdcb0c..0000000000 --- a/tests/autoplug3.c +++ /dev/null @@ -1,50 +0,0 @@ -#include - -int -main (int argc, char *argv[]) -{ - GstAutoplug *autoplug; - GstElement *element; - GstElement *sink; - GstElement *pipeline; - GstElement *disksrc; - - gst_init(&argc,&argv); - - sink = gst_elementfactory_make ("osssink", "osssink"); - g_assert (sink != NULL); - - autoplug = gst_autoplugfactory_make ("staticrender"); - g_assert (autoplug != NULL); - - element = gst_autoplug_to_renderers (autoplug, - gst_caps_new ( - "mp3caps", - "audio/mp3", - NULL - ), - sink, - NULL); - g_assert (element != NULL); - - pipeline = gst_pipeline_new ("main_pipeline"); - g_assert (pipeline != NULL); - - disksrc = gst_elementfactory_make ("disksrc", "disk_reader"); - g_assert (disksrc != NULL); - - gst_bin_add (GST_BIN (pipeline), disksrc); - gst_bin_add (GST_BIN (pipeline), element); - - gst_element_connect (disksrc, "src", element, "sink"); - - g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - exit (0); -} diff --git a/tests/autoplug4.c b/tests/autoplug4.c deleted file mode 100644 index 34927edad2..0000000000 --- a/tests/autoplug4.c +++ /dev/null @@ -1,102 +0,0 @@ -#include - -int -main (int argc, char *argv[]) -{ - GstElement *element; - GstElement *sink1, *sink2; - GstAutoplug *autoplug; - GstAutoplug *autoplug2; - - gst_init(&argc,&argv); - - sink1 = gst_elementfactory_make ("videosink", "videosink"); - sink2 = gst_elementfactory_make ("osssink", "osssink"); - - autoplug = gst_autoplugfactory_make ("staticrender"); - autoplug2 = gst_autoplugfactory_make ("static"); - - element = gst_autoplug_to_renderers (autoplug, - gst_caps_new ("mp3caps", "audio/mp3", NULL), sink2, NULL); - xmlSaveFile ("autoplug3_1.gst", gst_xml_write (element)); - - element = gst_autoplug_to_renderers (autoplug, - gst_caps_new ("mpeg1caps", "video/mpeg", NULL), sink1, NULL); - if (element) { - xmlSaveFile ("autoplug3_2.gst", gst_xml_write (element)); - } - - element = gst_autoplug_to_caps (autoplug2, - gst_caps_new( - "testcaps3", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL)), - gst_caps_new("testcaps4","audio/raw", NULL), - NULL); - if (element) { - xmlSaveFile ("autoplug3_3.gst", gst_xml_write (element)); - } - - element = gst_autoplug_to_caps (autoplug2, - gst_caps_new( - "testcaps5", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (FALSE), - NULL)), - gst_caps_new("testcaps6", "video/raw", NULL), - NULL); - if (element) { - xmlSaveFile ("autoplug3_4.gst", gst_xml_write (element)); - } - - element = gst_autoplug_to_caps (autoplug2, - gst_caps_new( - "testcaps7", - "video/avi", NULL), - gst_caps_new("testcaps8", "video/raw", NULL), - gst_caps_new("testcaps9", "audio/raw", NULL), - NULL); - if (element) { - xmlSaveFile ("autoplug3_5.gst", gst_xml_write (element)); - } - - element = gst_autoplug_to_caps (autoplug2, - gst_caps_new( - "testcaps10", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL)), - gst_caps_new("testcaps10", "video/raw", NULL), - gst_caps_new("testcaps11", "audio/raw", NULL), - NULL); - if (element) { - xmlSaveFile ("autoplug3_6.gst", gst_xml_write (element)); - } - - sink1 = gst_elementfactory_make ("videosink", "videosink"); - sink2 = gst_elementfactory_make ("osssink", "osssink"); - - element = gst_autoplug_to_renderers (autoplug, - gst_caps_new( - "testcaps10", - "video/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL)), - sink1, - sink2, - NULL); - if (element) { - xmlSaveFile ("autoplug3_7.gst", gst_xml_write (element)); - } - - exit (0); -} diff --git a/tests/capsconnect.c b/tests/capsconnect.c deleted file mode 100644 index 714e053a72..0000000000 --- a/tests/capsconnect.c +++ /dev/null @@ -1,61 +0,0 @@ -#include - -int main(int argc,char *argv[]) -{ - xmlDocPtr doc; - xmlNodePtr parent; - GstElement *mad; - GstElement *mp3parse; - GstElement *queue; - GstPad *sinkpad; - GstPad *srcpad; - GstPad *qsinkpad; - - doc = xmlNewDoc ("1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); - - gst_init (&argc, &argv); - - mad = gst_elementfactory_make ("mad", "mad"); - g_assert (mad != NULL); - - sinkpad = gst_element_get_pad (mad, "sink"); - g_assert (sinkpad != NULL); - - queue = gst_elementfactory_make ("queue", "queue"); - g_assert (queue != NULL); - - srcpad = gst_element_get_pad (queue, "src"); - g_assert (srcpad != NULL); - qsinkpad = gst_element_get_pad (queue, "sink"); - g_assert (qsinkpad != NULL); - - parent = xmlNewChild (doc->xmlRootNode, NULL, "mad caps", NULL); - gst_caps_save_thyself (gst_pad_get_caps (sinkpad), parent); - - parent = xmlNewChild (doc->xmlRootNode, NULL, "queue caps", NULL); - gst_caps_save_thyself (gst_pad_get_caps (srcpad), parent); - - gst_pad_connect (srcpad, sinkpad); - - parent = xmlNewChild (doc->xmlRootNode, NULL, "queue caps after connect src", NULL); - gst_caps_save_thyself (gst_pad_get_caps (srcpad), parent); - - parent = xmlNewChild (doc->xmlRootNode, NULL, "queue caps after connect sink", NULL); - gst_caps_save_thyself (gst_pad_get_caps (qsinkpad), parent); - - mp3parse = gst_elementfactory_make ("mp3parse", "mp3parse"); - g_assert (mp3parse != NULL); - - gst_pad_connect (gst_element_get_pad (mp3parse, "src"), qsinkpad); - - parent = xmlNewChild (doc->xmlRootNode, NULL, "queue caps after connect sink", NULL); - gst_caps_save_thyself (gst_pad_get_caps (qsinkpad), parent); - - parent = xmlNewChild (doc->xmlRootNode, NULL, "mad caps after connect sink", NULL); - gst_caps_save_thyself (gst_pad_get_caps (sinkpad), parent); - - xmlDocDump(stdout, doc); - - return 0; -} diff --git a/tests/case4.c b/tests/case4.c deleted file mode 100644 index 29c4394f21..0000000000 --- a/tests/case4.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include - -int main(int argc,char *argv[]) { - GstBin *thread; - GstElement *src,*identity,*sink; - - GST_DEBUG_ENTER("(%d)",argc); - - gst_init(&argc,&argv); - - thread = GST_BIN(gst_bin_new("bin4")); - src = gst_elementfactory_make("fakesrc","src"); - identity = gst_elementfactory_make("identity","identity"); - g_return_val_if_fail(identity != NULL,2); - g_object_set(G_OBJECT(identity),"loop_based",TRUE,NULL); - sink = gst_elementfactory_make("fakesink","sink"); - g_return_val_if_fail(sink != NULL,3); - - fprintf(stderr,"src %p identity %p sink %p\n",src,identity,sink); - gst_bin_add(thread,src); - gst_bin_add(thread,identity); - gst_bin_add(thread,sink); - - gst_element_connect(src,"src",identity,"sink"); - gst_element_connect(identity,"src",sink,"sink"); - fprintf(stderr,"done creating case4 pipeline\n\n\n"); - - gst_element_set_state(GST_ELEMENT(thread),GST_STATE_PLAYING); - - gst_bin_iterate(thread); - gst_bin_iterate(thread); - - exit(0); -} diff --git a/tests/events.c b/tests/events.c deleted file mode 100644 index f427f1385a..0000000000 --- a/tests/events.c +++ /dev/null @@ -1,29 +0,0 @@ -#include - -void eos_handler(GstElement *element) { - printf("got EOS signal\n"); -} - -int main (int argc,char *argv[]) { - GstElement *pipeline, *disksrc, *identity, *fakesink; - - gst_init(&argc,&argv); - - pipeline = gst_pipeline_new("pipeline"); - disksrc = gst_elementfactory_make("disksrc","disksrc"); - identity = gst_elementfactory_make("identity","identity"); - fakesink = gst_elementfactory_make("fakesink","fakesink"); - - g_object_set(G_OBJECT(disksrc),"location","events.c",NULL); - g_signal_connect(G_OBJECT(fakesink),"eos",G_CALLBACK (eos_handler),NULL); - - gst_bin_add(GST_BIN(pipeline),disksrc); - gst_bin_add(GST_BIN(pipeline),fakesink); - - gst_element_connect(disksrc,"src",fakesink,"sink"); - - gst_element_set_state(pipeline,GST_STATE_PLAYING); - - gst_bin_iterate(GST_BIN(pipeline)); - gst_bin_iterate(GST_BIN(pipeline)); -} diff --git a/tests/faketest.c b/tests/faketest.c deleted file mode 100644 index 5ff43f40bc..0000000000 --- a/tests/faketest.c +++ /dev/null @@ -1,49 +0,0 @@ -#include - -int -main (int argc, gchar *argv[]) -{ - GstElement *pipeline; - GstElement *fakesrc, *fakesink, *identity; - GstElement *queue, *thread; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("main"); - g_assert (pipeline != NULL); - - queue = gst_elementfactory_make ("queue", "queue"); - g_assert (queue); - thread = gst_elementfactory_make ("thread", "thread"); - g_assert (thread); - fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc"); - g_assert (fakesrc); - fakesink = gst_elementfactory_make ("fakesink", "fakesink"); - g_assert (fakesink); - identity = gst_elementfactory_make ("identity", "identity"); - g_assert (identity); - - gst_bin_add (GST_BIN (pipeline), fakesrc); - gst_bin_add (GST_BIN (pipeline), identity); - gst_bin_add (GST_BIN (pipeline), queue); - - gst_bin_add (GST_BIN (thread), fakesink); - gst_bin_add (GST_BIN (pipeline), thread); - - gst_element_connect (fakesrc, "src", identity, "sink"); - gst_element_connect (identity, "src", queue, "sink"); - gst_element_connect (queue, "src", fakesink, "sink"); - - gst_element_set_state (pipeline, GST_STATE_READY); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - gst_bin_iterate (GST_BIN (pipeline)); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_element_set_state (pipeline, GST_STATE_READY); - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 0; -} diff --git a/tests/incsched.c b/tests/incsched.c deleted file mode 100644 index edb73f88a4..0000000000 --- a/tests/incsched.c +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include - -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; -} diff --git a/tests/init.c b/tests/init.c deleted file mode 100644 index 04984c9ff1..0000000000 --- a/tests/init.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc,char *argv[]) { - gst_init(&argc,&argv); - - exit (0); -} diff --git a/tests/load.c b/tests/load.c deleted file mode 100644 index 481c38dd36..0000000000 --- a/tests/load.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main(int argc,char *argv[]) { - GstElement *element; - - gst_init(&argc,&argv); - - element = gst_elementfactory_make(argv[1],"element"); - - return 0; -} diff --git a/tests/loadall.c b/tests/loadall.c deleted file mode 100644 index f51b5055c4..0000000000 --- a/tests/loadall.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(int argc,char *argv[]) { - gst_init(&argc,&argv); - gst_plugin_load_all(); - - return 0; -} diff --git a/tests/markup.c b/tests/markup.c deleted file mode 100644 index fd2e77aa29..0000000000 --- a/tests/markup.c +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include -#include - -gchar * -gst_markup_vsprintf (const gchar *format,...) -{ - va_list args; - gint i,j; - gboolean have_hash = FALSE; - gboolean longarg = FALSE; - GstObject *object; - gchar *newformat = g_new0(gchar,strlen(format)); - gchar *newstring; - GSList *tofree = NULL; - gint dummy; - - va_start(args, format); - for (i=0,j=0;i -#include - -GstElement *audiothread; -GstElement *audioqueue; -GstElement *audiodecode; -GstElement *audiosink; - -void new_pad(GstElement *parse,GstPad *pad,GstElement *pipeline) { - - if (!strncmp(gst_pad_get_name(pad), "audio_", 6)) { - fprintf(stderr,"have audio pad\n"); - - fprintf(stderr,"creating thread\n"); - audiothread = gst_elementfactory_make("thread","audiothread"); - gst_bin_add(GST_BIN(pipeline),audiothread); - - fprintf(stderr,"creating queue\n"); - audioqueue = gst_elementfactory_make("queue","audioqueue"); - gst_bin_add(GST_BIN(audiothread),audioqueue); - gst_pad_connect(pad,gst_element_get_pad(audioqueue,"sink")); - - fprintf(stderr,"creating decoder\n"); - audiodecode = gst_elementfactory_make("mad","audiodecode"); - gst_bin_add(GST_BIN(audiothread),audiodecode); - gst_element_connect(audioqueue,"src",audiodecode,"sink"); - - fprintf(stderr,"creating esdsink\n"); - audiosink = gst_elementfactory_make("osssink","audiosink"); - gst_bin_add(GST_BIN(audiothread),audiosink); - gst_element_connect(audiodecode,"src",audiosink,"sink"); - - fprintf(stderr,"setting state to PLAYING\n"); - gst_element_set_state(audiothread,GST_STATE_PLAYING); - - fprintf(stderr,"done dealing with new audio pad\n"); - } -} - -int main(int argc,char *argv[]) { - GstElement *pipeline, *sourcethread, *src, *parse; - //int i; - - gst_init(&argc,&argv); - - pipeline = gst_pipeline_new("pipeline"); - sourcethread = gst_elementfactory_make("thread","sourcethread"); - src = gst_elementfactory_make("disksrc","src"); - g_object_set(G_OBJECT(src),"location","/home/omega/media/AlienSong.mpg",NULL); - parse = gst_elementfactory_make("mpeg1parse","parse"); - - g_signal_connect(G_OBJECT(parse),"new_pad", - G_CALLBACK(new_pad),pipeline); - - gst_bin_add(GST_BIN(sourcethread),src); - gst_bin_add(GST_BIN(sourcethread),parse); - - gst_element_connect(src,"src",parse,"sink"); - - gst_bin_add(GST_BIN(pipeline),sourcethread); - - gst_scheduler_show(GST_ELEMENT_SCHED(pipeline)); - - gst_element_set_state(pipeline,GST_STATE_PLAYING); - sleep(1); - - while (1) { -// sleep(1); -fprintf(stderr,"setting to PAUSED\n"); - gst_element_set_state(pipeline,GST_STATE_PAUSED);fprintf(stderr,"paused... "); -// sleep(1); -fprintf(stderr,"setting to PLAYING\n"); - gst_element_set_state(pipeline,GST_STATE_PLAYING);fprintf(stderr,"playing.\n"); - } - -// for (i=0;i<10;i++) -// while (1) -// gst_bin_iterate(GST_BIN(pipeline)); -} diff --git a/tests/old/examples/events/Makefile.am b/tests/old/examples/events/Makefile.am new file mode 100644 index 0000000000..82d65e2f46 --- /dev/null +++ b/tests/old/examples/events/Makefile.am @@ -0,0 +1,4 @@ +noinst_PROGRAMS = seek + +LIBS = $(GLIB_LIBS) $(GST_LIBS) +CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS) diff --git a/tests/old/examples/events/seek.c b/tests/old/examples/events/seek.c new file mode 100644 index 0000000000..89a6e27189 --- /dev/null +++ b/tests/old/examples/events/seek.c @@ -0,0 +1,68 @@ +#include + +int +main (int argc, char *argv[]) +{ + GstBin *bin; + GstElement *src, *sink; + GstPad *srcpad, *sinkpad; + +// _gst_plugin_spew = TRUE; + gst_init (&argc, &argv); + + bin = GST_BIN (gst_pipeline_new ("pipeline")); + g_return_val_if_fail (bin != NULL, -1); + + g_print ("--- creating src and sink elements\n"); + src = gst_elementfactory_make ("fakesrc", "src"); + g_return_val_if_fail (src != NULL, -1); + sink = gst_elementfactory_make ("fakesink", "sink"); + g_return_val_if_fail (sink != NULL, -1); + + g_print ("--- about to add the elements to the bin\n"); + gst_bin_add (bin, GST_ELEMENT (src)); + gst_bin_add (bin, GST_ELEMENT (sink)); + + g_print ("--- getting pads\n"); + srcpad = gst_element_get_pad (src, "src"); + g_return_val_if_fail (srcpad != NULL, -1); + sinkpad = gst_element_get_pad (sink, "sink"); + g_return_val_if_fail (srcpad != NULL, -1); + + g_print ("--- connecting\n"); + gst_pad_connect (srcpad, sinkpad); + + g_print ("--- setting up\n"); + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); + + g_print ("--- iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- seek to 100\n"); + gst_pad_send_event (srcpad, gst_event_new_seek (GST_SEEK_ANY, 100, FALSE)); + + g_print ("--- seek done, iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- seek to 200 with flush\n"); + gst_pad_send_event (srcpad, gst_event_new_seek (GST_SEEK_ANY, 200, TRUE)); + + g_print ("--- seek done, iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- flush\n"); + gst_pad_send_event (srcpad, gst_event_new_flush ()); + + g_print ("--- flush done, iterating\n"); + gst_bin_iterate (bin); + gst_bin_iterate (bin); + + g_print ("--- cleaning up\n"); + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + + return 0; +} diff --git a/tests/old/testsuite/capsnego/Makefile.am b/tests/old/testsuite/capsnego/Makefile.am index f12ec083a1..edb2dd32c5 100644 --- a/tests/old/testsuite/capsnego/Makefile.am +++ b/tests/old/testsuite/capsnego/Makefile.am @@ -1,4 +1,4 @@ -testprogs = converter # enum capsnego converter2 +testprogs = converter compatibility # enum capsnego converter2 TESTS = $(testprogs) diff --git a/tests/caps.c b/tests/old/testsuite/capsnego/compatibility.c similarity index 93% rename from tests/caps.c rename to tests/old/testsuite/capsnego/compatibility.c index c8a10d63a6..c4ee4c713b 100644 --- a/tests/caps.c +++ b/tests/old/testsuite/capsnego/compatibility.c @@ -148,30 +148,41 @@ main (int argc, char *argv[]) testret = gst_caps_check_compatibility (mp1parsecaps, rawcaps); g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret); - + if (testret != 0) exit (-1); + testret = gst_caps_check_compatibility (mp1parsecaps, sinkcaps); g_print ("4 <-> 1 == %d (valid, subset)\n", testret); + if (testret != 1) exit (-1); testret = gst_caps_check_compatibility (sinkcaps, mp1parsecaps); g_print ("1 <-> 4 == %d (invalid, superset)\n", testret); + if (testret != 0) exit (-1); testret = gst_caps_check_compatibility (rawcaps, rawcaps2); g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret); + if (testret != 0) exit (-1); testret = gst_caps_check_compatibility (rawcaps, rawcaps3); g_print ("2 <-> 5 == %d (valid)\n", testret); + if (testret != 1) exit (-1); testret = gst_caps_check_compatibility (rawcaps3, rawcaps); g_print ("5 <-> 2 == %d (invalid)\n", testret); + if (testret != 0) exit (-1); testret = gst_caps_check_compatibility (rawcaps2, rawcaps3); g_print ("3 <-> 5 == %d (valid)\n", testret); + if (testret != 1) exit (-1); testret = gst_caps_check_compatibility (rawcaps2, rawcaps); g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret); + if (testret != 0) exit (-1); testret = gst_caps_check_compatibility (rawcaps, rawcaps); g_print ("2 <-> 2 == %d (valid, same caps)\n", testret); - + if (testret != 1) exit (-1); + + g_print ("caps test successful\n"); + return 0; } diff --git a/testsuite/capsnego/Makefile.am b/testsuite/capsnego/Makefile.am index f12ec083a1..edb2dd32c5 100644 --- a/testsuite/capsnego/Makefile.am +++ b/testsuite/capsnego/Makefile.am @@ -1,4 +1,4 @@ -testprogs = converter # enum capsnego converter2 +testprogs = converter compatibility # enum capsnego converter2 TESTS = $(testprogs) diff --git a/testsuite/capsnego/compatibility.c b/testsuite/capsnego/compatibility.c new file mode 100644 index 0000000000..c4ee4c713b --- /dev/null +++ b/testsuite/capsnego/compatibility.c @@ -0,0 +1,188 @@ +#include + +static GstCaps* +mpeg2dec_sink_caps (void) +{ + return + gst_caps_new ( + "mpeg2dec_sink", + "video/mpeg", + gst_props_new ( + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT(1), + GST_PROPS_INT(2) + ), + NULL + ) + ); +} + +static GstCaps* +mp1parse_src_caps (void) +{ + return + gst_caps_new ( + "mp1parse_src", + "video/mpeg", + gst_props_new ( + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT(1) + ), + NULL + ) + ); +} + +static GstCaps* +mpeg2dec_src_caps (void) +{ + return + gst_caps_new ( + "mpeg2dec_src", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')) + ), + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL + ) + ); +} + +static GstCaps* +raw_sink_caps (void) +{ + return + gst_caps_new ( + "raw_sink_caps", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')) + ), + "height", GST_PROPS_INT_RANGE (16, 256), + NULL + ) + ); +} + +static GstCaps* +raw2_sink_caps (void) +{ + return + gst_caps_new ( + "raw2_sink_caps", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')) + ), + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL + ) + ); +} + + +static GstCaps* +get_testcaps (void) +{ + return + gst_caps_new ( + "raw2_sink_caps", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V')) + ), + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL + ) + ); +} + +static GstCaps *sinkcaps = NULL, + *rawcaps = NULL, + *rawcaps2 = NULL, + *rawcaps3 = NULL, + *mp1parsecaps = NULL; + +int +main (int argc, char *argv[]) +{ + gboolean testret; + xmlDocPtr doc; + xmlNodePtr parent; + + doc = xmlNewDoc ("1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); + + gst_init (&argc, &argv); + + sinkcaps = mpeg2dec_sink_caps (); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (sinkcaps, parent); + + rawcaps = mpeg2dec_src_caps (); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL); + gst_caps_save_thyself (rawcaps, parent); + + rawcaps2 = raw_sink_caps (); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL); + gst_caps_save_thyself (rawcaps2, parent); + + mp1parsecaps = mp1parse_src_caps (); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL); + gst_caps_save_thyself (mp1parsecaps, parent); + + rawcaps3 = raw2_sink_caps (); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL); + gst_caps_save_thyself (rawcaps3, parent); + + xmlDocDump(stdout, doc); + + testret = gst_caps_check_compatibility (mp1parsecaps, rawcaps); + g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret); + if (testret != 0) exit (-1); + + testret = gst_caps_check_compatibility (mp1parsecaps, sinkcaps); + g_print ("4 <-> 1 == %d (valid, subset)\n", testret); + if (testret != 1) exit (-1); + + testret = gst_caps_check_compatibility (sinkcaps, mp1parsecaps); + g_print ("1 <-> 4 == %d (invalid, superset)\n", testret); + if (testret != 0) exit (-1); + + testret = gst_caps_check_compatibility (rawcaps, rawcaps2); + g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret); + if (testret != 0) exit (-1); + + testret = gst_caps_check_compatibility (rawcaps, rawcaps3); + g_print ("2 <-> 5 == %d (valid)\n", testret); + if (testret != 1) exit (-1); + + testret = gst_caps_check_compatibility (rawcaps3, rawcaps); + g_print ("5 <-> 2 == %d (invalid)\n", testret); + if (testret != 0) exit (-1); + + testret = gst_caps_check_compatibility (rawcaps2, rawcaps3); + g_print ("3 <-> 5 == %d (valid)\n", testret); + if (testret != 1) exit (-1); + + testret = gst_caps_check_compatibility (rawcaps2, rawcaps); + g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret); + if (testret != 0) exit (-1); + + testret = gst_caps_check_compatibility (rawcaps, rawcaps); + g_print ("2 <-> 2 == %d (valid, same caps)\n", testret); + if (testret != 1) exit (-1); + + g_print ("caps test successful\n"); + + return 0; +}