changes to allow apps outside of gstreamer/ to use dparams continuing test removal

Original commit message from CVS:
* changes to allow apps outside of gstreamer/ to use dparams
* continuing test removal
This commit is contained in:
Andy Wingo 2002-01-05 00:56:40 +00:00
parent 7930956d92
commit f3dc36d37d
24 changed files with 352 additions and 792 deletions

View file

@ -0,0 +1,4 @@
noinst_PROGRAMS = seek
LIBS = $(GLIB_LIBS) $(GST_LIBS)
CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS)

68
examples/events/seek.c Normal file
View file

@ -0,0 +1,68 @@
#include <gst/gst.h>
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;
}

View file

@ -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@

View file

@ -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

View file

@ -1,45 +0,0 @@
#include <gst/gst.h>
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);
}

View file

@ -1,77 +0,0 @@
#include <gst/gst.h>
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);
}

View file

@ -1,50 +0,0 @@
#include <gst/gst.h>
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);
}

View file

@ -1,102 +0,0 @@
#include <gst/gst.h>
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);
}

View file

@ -1,61 +0,0 @@
#include <gst/gst.h>
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;
}

View file

@ -1,35 +0,0 @@
#include <gst/gst.h>
#include <assert.h>
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);
}

View file

@ -1,29 +0,0 @@
#include <gst/gst.h>
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));
}

View file

@ -1,49 +0,0 @@
#include <gst/gst.h>
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;
}

View file

@ -1,137 +0,0 @@
#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;
}

View file

@ -1,7 +0,0 @@
#include <gst/gst.h>
int main(int argc,char *argv[]) {
gst_init(&argc,&argv);
exit (0);
}

View file

@ -1,11 +0,0 @@
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstElement *element;
gst_init(&argc,&argv);
element = gst_elementfactory_make(argv[1],"element");
return 0;
}

View file

@ -1,8 +0,0 @@
#include <gst/gst.h>
int main(int argc,char *argv[]) {
gst_init(&argc,&argv);
gst_plugin_load_all();
return 0;
}

View file

@ -1,69 +0,0 @@
#include <stdarg.h>
#include <gst/gst.h>
#include <assert.h>
#include <string.h>
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<strlen(format);i++,j++) {
newformat[j] = format[i];
if (have_hash) {
switch (format[i]) {
case 'l': longarg = TRUE;break;
case 'O': {
if (longarg) j--;
newformat[j] = 's';
object = va_arg(args,GstObject *);
if (longarg) {
fprintf(stderr,"have %%lO\n");
newstring = gst_object_get_path_string(object);
tofree = g_slist_prepend (tofree, newstring);
longarg = FALSE;
} else {
fprintf(stderr,"have %%O\n");
newstring = "something";
}
break;
}
case '%': break;
default: dummy = va_arg(args,gint);
}
}
if (format[i] == '%')
have_hash = TRUE;
}
newformat[j] = '\0';
fprintf(stderr,"new format is '%s'\n",newformat);
return g_strdup_vprintf(newformat,args);
}
int main(int argc,char *argv[]) {
GstElement *pipeline;
GstElement *src;
GST_DEBUG_ENTER("(%d)",argc);
gst_init(&argc,&argv);
pipeline = gst_pipeline_new("fakepipeline");
src = gst_elementfactory_make("fakesrc","src");
gst_bin_add(GST_BIN(pipeline),src);
fprintf(stderr,gst_markup_vsprintf("testing %d, %lO\n",2,"src"));
return 0;
}

View file

@ -1,79 +0,0 @@
#include <string.h>
#include <gst/gst.h>
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));
}

View file

@ -0,0 +1,4 @@
noinst_PROGRAMS = seek
LIBS = $(GLIB_LIBS) $(GST_LIBS)
CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS)

View file

@ -0,0 +1,68 @@
#include <gst/gst.h>
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;
}

View file

@ -1,4 +1,4 @@
testprogs = converter # enum capsnego converter2
testprogs = converter compatibility # enum capsnego converter2
TESTS = $(testprogs)

View file

@ -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;
}

View file

@ -1,4 +1,4 @@
testprogs = converter # enum capsnego converter2
testprogs = converter compatibility # enum capsnego converter2
TESTS = $(testprogs)

View file

@ -0,0 +1,188 @@
#include <gst/gst.h>
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;
}