kutting out the kruft

Original commit message from CVS:
kutting out the kruft
This commit is contained in:
Andy Wingo 2002-01-05 01:19:24 +00:00
parent f3dc36d37d
commit e1bc025265
27 changed files with 0 additions and 1637 deletions

15
tests/eos/.gitignore vendored
View file

@ -1,15 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
*.xml
case1
case2
case3
case4
case5
case6
case7

View file

@ -1,4 +0,0 @@
noinst_PROGRAMS = case1 case2 case3 case4 case5 case6 case7
LDADD = $(GST_LIBS)
AM_CFLAGS = $(GST_CFLAGS)

View file

@ -1,57 +0,0 @@
#include <gst/gst.h>
gboolean playing = TRUE;
static void
eos_signal_element (GstElement *element)
{
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
}
static void
eos_signal (GstElement *element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
playing = FALSE;
}
int
main(int argc,char *argv[])
{
GstBin *pipeline;
GstElement *src,*identity,*sink;
gst_init(&argc,&argv);
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL, 1);
src = gst_elementfactory_make("fakesrc","src");
g_object_set (G_OBJECT (src), "num_buffers", 1, NULL);
g_return_val_if_fail(src != NULL, 2);
identity = gst_elementfactory_make("identity","identity");
g_return_val_if_fail(identity != NULL, 3);
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(sink != NULL, 4);
gst_bin_add(pipeline,GST_ELEMENT(src));
gst_bin_add(pipeline,GST_ELEMENT(identity));
gst_bin_add(pipeline,GST_ELEMENT(sink));
gst_element_connect(src,"src",identity,"sink");
gst_element_connect(identity,"src",sink,"sink");
g_signal_connect (G_OBJECT (src), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (pipeline), "eos",
G_CALLBACK (eos_signal), NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
while (playing)
gst_bin_iterate(pipeline);
exit (0);
}

View file

@ -1,76 +0,0 @@
#include <gst/gst.h>
gboolean playing = TRUE;
static void
eos_signal_element (GstElement *element)
{
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
}
static void
eos_signal (GstElement *element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
playing = FALSE;
}
int
main(int argc,char *argv[])
{
GstBin *pipeline;
GstElement *src,*identity,*sink;
GstElement *src2,*identity2,*sink2;
gst_init(&argc,&argv);
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL, 1);
src = gst_elementfactory_make("fakesrc","src");
g_object_set (G_OBJECT (src), "num_buffers", 1, NULL);
g_return_val_if_fail(src != NULL, 2);
identity = gst_elementfactory_make("identity","identity");
g_return_val_if_fail(identity != NULL, 3);
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(sink != NULL, 4);
gst_bin_add(pipeline,GST_ELEMENT(src));
gst_bin_add(pipeline,GST_ELEMENT(identity));
gst_bin_add(pipeline,GST_ELEMENT(sink));
gst_element_connect(src,"src",identity,"sink");
gst_element_connect(identity,"src",sink,"sink");
src2 = gst_elementfactory_make("fakesrc","src2");
g_object_set (G_OBJECT (src2), "num_buffers", 3, NULL);
g_return_val_if_fail(src2 != NULL, 2);
identity2 = gst_elementfactory_make("identity","identity2");
g_return_val_if_fail(identity2 != NULL, 3);
sink2 = gst_elementfactory_make("fakesink","sink2");
g_return_val_if_fail(sink2 != NULL, 4);
gst_bin_add(pipeline,GST_ELEMENT(src2));
gst_bin_add(pipeline,GST_ELEMENT(identity2));
gst_bin_add(pipeline,GST_ELEMENT(sink2));
gst_element_connect(src2,"src",identity2,"sink");
gst_element_connect(identity2,"src",sink2,"sink");
g_signal_connect (G_OBJECT (src), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (pipeline), "eos",
G_CALLBACK (eos_signal), NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
while (playing)
gst_bin_iterate(pipeline);
exit (0);
}

View file

@ -1,72 +0,0 @@
#include <gst/gst.h>
gboolean playing = TRUE;
static void
eos_signal_element (GstElement *element)
{
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
}
static void
eos_signal (GstElement *element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
playing = FALSE;
}
int
main(int argc,char *argv[])
{
GstBin *pipeline;
GstElement *src,*identity,*sink;
GstElement *identity2,*sink2;
gst_init(&argc,&argv);
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL, 1);
src = gst_elementfactory_make("fakesrc","src");
g_object_set (G_OBJECT (src), "num_buffers", 2, NULL);
g_object_set (G_OBJECT (src), "num_sources", 2, NULL);
g_return_val_if_fail(src != NULL, 2);
identity = gst_elementfactory_make("identity","identity");
g_return_val_if_fail(identity != NULL, 3);
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(sink != NULL, 4);
gst_bin_add(pipeline,GST_ELEMENT(src));
gst_bin_add(pipeline,GST_ELEMENT(identity));
gst_bin_add(pipeline,GST_ELEMENT(sink));
gst_element_connect(src,"src",identity,"sink");
gst_element_connect(identity,"src",sink,"sink");
identity2 = gst_elementfactory_make("identity","identity2");
g_return_val_if_fail(identity2 != NULL, 3);
sink2 = gst_elementfactory_make("fakesink","sink2");
g_return_val_if_fail(sink2 != NULL, 4);
gst_bin_add(pipeline,GST_ELEMENT(identity2));
gst_bin_add(pipeline,GST_ELEMENT(sink2));
gst_element_connect(src,"src1",identity2,"sink");
gst_element_connect(identity2,"src",sink2,"sink");
g_signal_connect (G_OBJECT (src), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (pipeline), "eos",
G_CALLBACK (eos_signal), NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
while (playing)
gst_bin_iterate(pipeline);
exit (0);
}

View file

@ -1,81 +0,0 @@
#include <gst/gst.h>
gboolean playing = TRUE;
static void
eos_signal_element (GstElement *element)
{
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
}
static void
eos_signal (GstElement *element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
playing = FALSE;
}
int
main(int argc,char *argv[])
{
GstBin *pipeline, *bin;
GstElement *src,*identity,*sink;
GstElement *src2,*identity2,*sink2;
gst_init(&argc,&argv);
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL, 1);
src = gst_elementfactory_make("fakesrc","src");
g_object_set (G_OBJECT (src), "num_buffers", 1, NULL);
g_return_val_if_fail(src != NULL, 2);
identity = gst_elementfactory_make("identity","identity");
g_return_val_if_fail(identity != NULL, 3);
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(sink != NULL, 4);
bin = GST_BIN(gst_bin_new("bin"));
g_return_val_if_fail(bin != NULL, 1);
gst_bin_add(bin,GST_ELEMENT(src));
gst_bin_add(bin,GST_ELEMENT(identity));
gst_bin_add(bin,GST_ELEMENT(sink));
gst_bin_add(pipeline,GST_ELEMENT(bin));
gst_element_connect(src,"src",identity,"sink");
gst_element_connect(identity,"src",sink,"sink");
src2 = gst_elementfactory_make("fakesrc","src2");
g_object_set (G_OBJECT (src2), "num_buffers", 3, NULL);
g_return_val_if_fail(src2 != NULL, 2);
identity2 = gst_elementfactory_make("identity","identity2");
g_return_val_if_fail(identity2 != NULL, 3);
sink2 = gst_elementfactory_make("fakesink","sink2");
g_return_val_if_fail(sink2 != NULL, 4);
gst_bin_add(pipeline,GST_ELEMENT(src2));
gst_bin_add(pipeline,GST_ELEMENT(identity2));
gst_bin_add(pipeline,GST_ELEMENT(sink2));
gst_element_connect(src2,"src",identity2,"sink");
gst_element_connect(identity2,"src",sink2,"sink");
g_signal_connect (G_OBJECT (src), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (pipeline), "eos",
G_CALLBACK (eos_signal), NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
while (playing)
gst_bin_iterate(pipeline);
exit (0);
}

View file

@ -1,87 +0,0 @@
#include <gst/gst.h>
gboolean playing = TRUE;
static void
eos_signal_element (GstElement *element)
{
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
}
static void
eos_signal (GstElement *element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
playing = FALSE;
}
int
main(int argc,char *argv[])
{
GstBin *pipeline, *thread;
GstElement *src,*identity,*sink;
GstElement *src2,*identity2,*sink2;
gst_init(&argc,&argv);
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL, 1);
src = gst_elementfactory_make("fakesrc","src");
g_object_set (G_OBJECT (src), "num_buffers", 4, NULL);
g_return_val_if_fail(src != NULL, 2);
identity = gst_elementfactory_make("identity","identity");
g_object_set (G_OBJECT (identity), "sleep_time", 1000000, NULL);
g_return_val_if_fail(identity != NULL, 3);
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(sink != NULL, 4);
thread = GST_BIN(gst_thread_new("thread"));
g_return_val_if_fail(thread != NULL, 1);
gst_bin_add(thread,GST_ELEMENT(src));
gst_bin_add(thread,GST_ELEMENT(identity));
gst_bin_add(thread,GST_ELEMENT(sink));
gst_bin_add(pipeline,GST_ELEMENT(thread));
gst_element_connect(src,"src",identity,"sink");
gst_element_connect(identity,"src",sink,"sink");
src2 = gst_elementfactory_make("fakesrc","src2");
g_object_set (G_OBJECT (src2), "num_buffers", 1, NULL);
g_return_val_if_fail(src2 != NULL, 2);
identity2 = gst_elementfactory_make("identity","identity2");
g_return_val_if_fail(identity2 != NULL, 3);
sink2 = gst_elementfactory_make("fakesink","sink2");
g_return_val_if_fail(sink2 != NULL, 4);
gst_bin_add(pipeline,GST_ELEMENT(src2));
gst_bin_add(pipeline,GST_ELEMENT(identity2));
gst_bin_add(pipeline,GST_ELEMENT(sink2));
gst_element_connect(src2,"src",identity2,"sink");
gst_element_connect(identity2,"src",sink2,"sink");
g_signal_connect (G_OBJECT (src), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (src2), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (pipeline), "eos",
G_CALLBACK (eos_signal), NULL);
g_signal_connect (G_OBJECT (thread), "eos",
G_CALLBACK (eos_signal_element), NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
while (gst_bin_iterate(pipeline));
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_NULL);
exit (0);
}

View file

@ -1,83 +0,0 @@
#include <gst/gst.h>
gboolean playing = TRUE;
static void
eos_signal_element (GstElement *element)
{
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
}
static void
eos_signal (GstElement *element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
playing = FALSE;
}
int
main(int argc,char *argv[])
{
GstBin *pipeline, *thread;
GstElement *queue,*identity,*sink;
GstElement *src2, *identity2;
gst_init(&argc,&argv);
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL, 1);
src2 = gst_elementfactory_make("fakesrc","src2");
g_object_set (G_OBJECT (src2), "num_buffers", 4, NULL);
g_return_val_if_fail(src2 != NULL, 2);
identity2 = gst_elementfactory_make("identity","identity2");
g_return_val_if_fail(identity2 != NULL, 3);
queue = gst_elementfactory_make("queue","queue");
g_object_set (G_OBJECT (queue), "max_level", 1, NULL);
g_return_val_if_fail(queue != NULL, 4);
gst_element_connect(src2,"src",identity2,"sink");
gst_element_connect(identity2,"src",queue,"sink");
gst_bin_add(pipeline,GST_ELEMENT(src2));
gst_bin_add(pipeline,GST_ELEMENT(identity2));
gst_bin_add(pipeline,GST_ELEMENT(queue));
identity = gst_elementfactory_make("identity","identity");
//g_object_set (G_OBJECT (identity), "sleep_time", 1000000, NULL);
g_return_val_if_fail(identity != NULL, 3);
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(sink != NULL, 3);
thread = GST_BIN(gst_thread_new("thread"));
g_return_val_if_fail(thread != NULL, 1);
gst_bin_add(thread,GST_ELEMENT(identity));
gst_bin_add(thread,GST_ELEMENT(sink));
gst_bin_add(pipeline,GST_ELEMENT(thread));
gst_element_connect(queue,"src",identity,"sink");
gst_element_connect(identity,"src",sink,"sink");
g_signal_connect (G_OBJECT (src2), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (queue), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (pipeline), "eos",
G_CALLBACK (eos_signal), NULL);
g_signal_connect (G_OBJECT (thread), "eos",
G_CALLBACK (eos_signal_element), NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
while (gst_bin_iterate(pipeline));
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_NULL);
exit (0);
}

View file

@ -1,71 +0,0 @@
#include <gst/gst.h>
static void
eos_signal_element (GstElement *element)
{
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
}
static void
eos_signal (GstElement *element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
gst_element_set_state (GST_ELEMENT (element), GST_STATE_NULL);
g_print ("quiting main loop\n");
//gdk_threads_enter ();
//g_main_quit();
//gdk_threads_leave ();
g_print ("quited main loop\n");
}
int
main(int argc,char *argv[])
{
GstBin *bin, *thread;
GstElement *src,*identity,*sink;
gst_init (&argc, &argv);
thread = GST_BIN (gst_thread_new ("thread"));
g_return_val_if_fail (thread != NULL, 1);
bin = GST_BIN (gst_bin_new ("bin"));
g_return_val_if_fail(bin != NULL, 1);
src = gst_elementfactory_make ("fakesrc", "src");
g_object_set (G_OBJECT (src), "num_buffers", 1, NULL);
g_return_val_if_fail (src != NULL, 2);
identity = gst_elementfactory_make ("identity", "identity");
g_return_val_if_fail (identity != NULL, 3);
sink = gst_elementfactory_make ("fakesink", "sink");
g_return_val_if_fail (sink != NULL, 4);
gst_bin_add(bin, GST_ELEMENT (src));
gst_bin_add(bin, GST_ELEMENT (identity));
gst_bin_add(bin, GST_ELEMENT (sink));
gst_bin_add(thread, GST_ELEMENT (bin));
gst_element_connect(src, "src", identity, "sink");
gst_element_connect(identity, "src", sink, "sink");
g_signal_connect (G_OBJECT (src), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (bin), "eos",
G_CALLBACK (eos_signal_element), NULL);
g_signal_connect (G_OBJECT (thread), "eos",
G_CALLBACK (eos_signal), NULL);
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
//gdk_threads_enter ();
//g_main();
//gdk_threads_leave ();
g_print ("quiting\n");
exit (0);
}

View file

@ -1,86 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstPipeline *pipeline;
GstElement *src,*lame,*sink;
int bitrate = 128000;
int fdin = -1;
int fdout = -1;
int i;
gst_init(&argc,&argv);
for (i=1;i<argc;i++) {
fprintf(stderr,"arg is %s\n",argv[i]);
if (argv[i][0] == '-') {
fprintf(stderr," starts with -\n");
switch (argv[i][1]) {
case 'b': bitrate = atoi(argv[++i]);break;
case 0: {
if (fdin == -1) fdin = STDIN_FILENO;
else if (fdout == -1) fdout = STDOUT_FILENO;
else fprintf(stderr,"unknown argument\n");exit(1);
break;
}
default: fprintf(stderr,"unknown argument\n");exit(1);
}
} else {
fprintf(stderr," probably a filename\n");
if (fdin == -1) {
fdin = open(argv[i],O_RDONLY);
if (fdin <= 0) {
fprintf(stderr,"can't open file '%s' for read\n",argv[i]);
exit(1);
}
fprintf(stderr," openned file %s for read, fd %d\n",argv[i],fdin);
} else if (fdout == -1) {
unlink(argv[i]);
fdout = open(argv[i],O_CREAT|O_RDWR|O_TRUNC);
if (fdout <= 0) {
fprintf(stderr,"can't open file '%s' for write\n",argv[i]);
exit(1);
}
fprintf(stderr," openned file %s for write, fd %d\n",argv[i],fdout);
} else {
fprintf(stderr,"unknown argument\n");exit(1);
}
}
}
pipeline = GST_PIPELINE (gst_pipeline_new("mp3encode"));
src = gst_elementfactory_make("fdsrc","src");
g_return_val_if_fail(src != NULL,1);
g_object_set(G_OBJECT(src),"location",fdin,NULL);
lame = gst_elementfactory_make("lame","encoder");
g_return_val_if_fail(lame != NULL,2);
g_object_set(G_OBJECT(lame),"bitrate",bitrate,NULL);
sink = gst_elementfactory_make("fdsink","sink");
g_return_val_if_fail(sink != NULL,3);
g_object_set(G_OBJECT(src),"fd",fdout,NULL);
gst_bin_add(GST_BIN(pipeline),src);
gst_bin_add(GST_BIN(pipeline),lame);
gst_bin_add(GST_BIN(pipeline),sink);
gst_element_connect(src,"src",lame,"sink");
gst_element_connect(lame,"src",sink,"sink");
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
if (GST_STATE(src) != GST_STATE_PLAYING) fprintf(stderr,"error: state not set\n");
for (i=0;i<100;i++) {
fprintf(stderr,"\n");
gst_bin_iterate(GST_BIN(pipeline));
}
return 0;
}

View file

@ -1,9 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
*.xml
nego1

View file

@ -1,4 +0,0 @@
noinst_PROGRAMS = nego1
LDADD = $(GST_LIBS)
AM_CFLAGS = $(GST_CFLAGS)

View file

@ -1,59 +0,0 @@
#include <gst/gst.h>
/* this is an example of the src pad dictating the caps
* the sink pad only accepts audio/raw */
static GstPadNegotiateReturn
negotiate (GstPad *pad, GstCaps **caps, gpointer *count)
{
g_print ("negotiation entered\n");
if (!strcmp (gst_caps_get_mime (*caps), "audio/raw"))
return GST_PAD_NEGOTIATE_AGREE;
return GST_PAD_NEGOTIATE_FAIL;
}
int
main(int argc,char *argv[])
{
GstPad *srcpad, *sinkpad;
GstCaps *new;
gst_init(&argc,&argv);
srcpad = gst_pad_new ("src", GST_PAD_SRC);
sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_pad_connect (srcpad, sinkpad);
gst_pad_set_negotiate_function (sinkpad, negotiate);
/* fill in our desired caps */
new = gst_caps_new (
"src_caps", /* name */
"audio/raw", /* mime */
gst_props_new (
"format", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (48000),
"channels", GST_PROPS_INT (2),
NULL
)
);
gst_pad_set_caps (srcpad, new);
new = gst_caps_new (
"src_caps", /* name */
"video/raw", /* mime */
gst_props_new (
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V')),
NULL
)
);
gst_pad_set_caps (srcpad, new);
exit (0);
}

View file

@ -1,24 +0,0 @@
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstPipeline *pipeline;
GstElement *src,*sink;
gst_init(&argc,&argv);
pipeline = gst_pipeline_new("fakepipeline");
src = gst_elementfactory_make("fakesrc","fakesrc");
g_return_val_if_fail(1,src != NULL);
sink = gst_elementfactory_make("fakesink","fakesink");
g_return_val_if_fail(1,sink != NULL);
gst_bin_add(GST_BIN(pipeline),src);
gst_bin_add(GST_BIN(pipeline),sink);
gst_element_connect(src,"src",sink,"sink");
gtk_object_set(GTK_OBJECT(gst_element_get_pad(src,"src")),"active",FALSE,NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
gst_bin_iterate(GST_BIN(pipeline));
}

View file

@ -1,125 +0,0 @@
#include <gst/gst.h>
static GstCaps*
mpeg2dec_sink_caps (void)
{
static GstCaps *caps;
if (!caps) {
caps = gst_caps_new (
"mpeg2deccaps",
"video/mpeg",
gst_props_new (
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT(1),
GST_PROPS_INT(2)
),
NULL));
}
return caps;
}
GST_CAPS_FACTORY (mpeg2dec_src_caps,
GST_CAPS_NEW (
"mpeg2dec_src_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC ( GST_MAKE_FOURCC ('Y','V','1','2')),
GST_PROPS_FOURCC (0x56595559)
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW(
"mpeg2dec_src_caps",
"video/raw",
"foo", GST_PROPS_BOOLEAN (TRUE)
)
)
static GstPadTemplate*
pad_caps (void)
{
static GstPadTemplate *template = NULL;
if (!template) {
template = gst_padtemplate_new (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_new (
"videocaps",
"video/raw",
gst_props_new (
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (0x32315659),
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V'))
),
"height", GST_PROPS_INT_RANGE (16, 4096),
NULL)),
gst_caps_new (
"videocaps2",
"video/raw",
gst_props_new (
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (0x32315659)
),
"height", GST_PROPS_INT_RANGE (16, 256),
NULL)),
NULL);
}
return template;
}
GST_PADTEMPLATE_FACTORY (testtempl,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"mycaps",
"audio/raw",
"format", GST_PROPS_INT (55),
"foo", GST_PROPS_STRING ("bar")
),
GST_CAPS_NEW (
"mycaps2",
"audio/float",
"format", GST_PROPS_INT (7),
"baz", GST_PROPS_STRING ("toe")
)
)
static GstCaps *sinkcaps = NULL,
*rawcaps = NULL;
static GstPadTemplate *temp;
int main(int argc,char *argv[])
{
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 = GST_CAPS_GET (mpeg2dec_src_caps);
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
gst_caps_save_thyself (rawcaps, parent);
temp = pad_caps ();
parent = xmlNewChild (doc->xmlRootNode, NULL, "Padtemplate", NULL);
gst_padtemplate_save_thyself (temp, parent);
parent = xmlNewChild (doc->xmlRootNode, NULL, "Padtemplate2", NULL);
gst_padtemplate_save_thyself (GST_PADTEMPLATE_GET (testtempl), parent);
xmlDocDump(stdout, doc);
return 0;
}

View file

@ -1,52 +0,0 @@
#include <gst/gst.h>
void paranoia_eos(GstPad *pad) {
gst_element_set_state(GST_ELEMENT(gst_pad_get_parent(pad)),GST_STATE_READY);
fprintf(stderr,"PARANOIA: have eos signal\n");
}
int main(int argc,char *argv[]) {
GstPipeline *pipeline;
GstElement *paranoia,*queue,*audio_thread,*osssink;
//int track = (argc == 2) ? atoi(argv[1]) : 1;
GST_DEBUG_ENTER("(%d)",argc);
gst_init(&argc,&argv);
pipeline = GST_PIPELINE(gst_pipeline_new("paranoia"));
g_return_val_if_fail(pipeline != NULL,1);
audio_thread = gst_thread_new("audio_thread");
g_return_val_if_fail(audio_thread != NULL,2);
paranoia = gst_elementfactory_make("cdparanoia","paranoia");
g_return_val_if_fail(paranoia != NULL,3);
g_object_set(G_OBJECT(paranoia),"paranoia_mode",0,NULL);
// g_object_set(G_OBJECT(paranoia),"start_sector",0,"end_sector",75,NULL);
queue = gst_elementfactory_make("queue","queue");
g_object_set(G_OBJECT(queue),"max_level",750,NULL);
g_return_val_if_fail(queue != NULL,4);
osssink = gst_elementfactory_make("fakesink","osssink");
g_return_val_if_fail(osssink != NULL,4);
gst_bin_add(GST_BIN(pipeline),paranoia);
gst_bin_add(GST_BIN(pipeline),queue);
gst_bin_add(GST_BIN(audio_thread),osssink);
gst_bin_add(GST_BIN(pipeline),audio_thread);
gst_element_add_ghost_pad(GST_ELEMENT(audio_thread),gst_element_get_pad(osssink,"sink"),"sink");
gst_element_connect(paranoia,"src",queue,"sink");
gst_element_connect(queue,"src",audio_thread,"sink");
g_signal_connect(G_OBJECT(gst_element_get_pad(paranoia,"src")),"eos",
G_CALLBACK(paranoia_eos),NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
if (GST_STATE(paranoia) != GST_STATE_PLAYING) fprintf(stderr,"error: state not set\n");
while (1) {
gst_bin_iterate(GST_BIN(pipeline));
}
}

View file

@ -1,78 +0,0 @@
#include <gst/gst.h>
static GstProps* mpeg2dec_sink_props_register (void) {
return gst_props_new (
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT(1),
GST_PROPS_INT(2)
),
NULL);
}
static GstProps* mpeg2dec_src_props_register (void) {
return 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 GstProps *sinkprops = NULL,
*rawprops = NULL,
*testprops = NULL;
int main(int argc,char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
gint i;
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Properties", NULL);
g_thread_init (NULL);
_gst_props_initialize ();
sinkprops = mpeg2dec_sink_props_register ();
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props1", NULL);
gst_props_save_thyself (sinkprops, parent);
rawprops = mpeg2dec_src_props_register ();
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props2", NULL);
gst_props_save_thyself (rawprops, parent);
i=argc;
testprops = gst_props_new ("layer", GST_PROPS_INT (i),
"bitrate", GST_PROPS_INT_RANGE (i*300, i*10000),
NULL);
if (i==3) {
testprops = gst_props_merge (testprops,
gst_props_new ("framed", GST_PROPS_BOOLEAN (TRUE),
"mpegtest", GST_PROPS_BOOLEAN (FALSE),
"hello", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_MAKE_FOURCC (0,0,0x55,0x55)),
GST_PROPS_FOURCC (GST_MAKE_FOURCC (0,0,0x66,0x66))
),
NULL));
}
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props3", NULL);
gst_props_save_thyself (testprops, parent);
sinkprops = gst_props_set (sinkprops, "mpegtype", GST_PROPS_INT (1));
sinkprops = gst_props_set (sinkprops, "foobar", GST_PROPS_FOURCC (GST_MAKE_FOURCC (0x56, 0x56,0x56,0x56)));
g_print ("%08lx\n", gst_props_get_fourcc_int (sinkprops, "foobar"));
g_print ("%d\n", gst_props_get_int (sinkprops, "mpegtype"));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props4", NULL);
gst_props_save_thyself (sinkprops, parent);
xmlDocDump(stdout, doc);
return 0;
}

View file

@ -1,64 +0,0 @@
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstBin *pipeline,*thr1,*thr2;
GstElement *src,*queue,*sink;
int i;
gst_init(&argc,&argv);
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
g_return_val_if_fail(1,pipeline != NULL);
thr1 = GST_BIN(gst_thread_new("thr1"));
// thr1 = gst_bin_new("thr1");
g_return_val_if_fail(2,thr1 != NULL);
// thr2 = GST_BIN(gst_thread_new("thr2"));
thr2 = GST_BIN(gst_bin_new("thr2"));
g_return_val_if_fail(3,thr2 != NULL);
fprintf(stderr,"QUEUE: fakesrc\n");
src = gst_elementfactory_make("fakesrc","src");
g_return_val_if_fail(4,src != NULL);
fprintf(stderr,"QUEUE: queue\n");
queue = gst_elementfactory_make("queue","queue");
g_return_val_if_fail(4,queue != NULL);
g_object_set(G_OBJECT(queue),"max_level",1,NULL);
fprintf(stderr,"QUEUE: fakesink\n");
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(5,sink != NULL);
fprintf(stderr,"QUEUE: have elements\n");
gst_bin_add(thr1,src);
fprintf(stderr,"QUEUE: added src to thr1\n");
gst_element_add_ghost_pad(GST_ELEMENT(thr1),gst_element_get_pad(src,"src"),"src");
// gst_bin_use_cothreads(thr1,TRUE);
gst_bin_add(thr2,sink);
fprintf(stderr,"QUEUE: added sink to thr2\n");
gst_element_add_ghost_pad(GST_ELEMENT(thr2),gst_element_get_pad(sink,"sink"),"sink");
// gst_bin_use_cothreads(thr2,TRUE);
fprintf(stderr,"QUEUE: filled in threads\n");
gst_bin_add(pipeline,GST_ELEMENT(thr1));
gst_bin_add(pipeline,GST_ELEMENT(queue));
gst_bin_add(pipeline,GST_ELEMENT(thr2));
fprintf(stderr,"QUEUE: connecting elements\n");
gst_element_connect(GST_ELEMENT(thr1),"src",queue,"sink");
gst_element_connect(queue,"src",GST_ELEMENT(thr2),"sink");
// gst_pad_connect(gst_element_get_pad(src,"src"),gst_element_get_pad(queue,"sink"));
// gst_pad_connect(gst_element_get_pad(queue,"src"),gst_element_get_pad(sink,"sink"));
fprintf(stderr,"QUEUE: constructed outer pipeline\n");
fprintf(stderr,"\n\nQUEUE: setting state:\n");
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
if (GST_STATE(src) != GST_STATE_PLAYING) fprintf(stderr,"error: state not set\n");
sleep(1);
fprintf(stderr,"\n\n");
for (i=0;i<1000;i++)
gst_bin_iterate(thr2);
// fprintf(stderr,"\n\n");
// fflush(stdout);
// fflush(stderr);
// gst_bin_iterate(thr2);
//
exit (0);
}

View file

@ -1,37 +0,0 @@
#include <stdio.h>
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstBin *pipeline, *thread;
GstElement *src, *queue1, *sink;
gst_init(&argc,&argv);
gst_info_set_categories(-1);
gst_debug_set_categories(-1);
pipeline = GST_BIN (gst_pipeline_new("pipeline"));
thread = GST_BIN (gst_thread_new("thread"));
src = gst_elementfactory_make("fakesrc","src");
queue1 = gst_elementfactory_make("queue","queue");
sink = gst_elementfactory_make("fakesink","sink");
gst_bin_add(pipeline,src);
gst_bin_add(pipeline,queue1);
gst_bin_add(pipeline,GST_ELEMENT(thread));
gst_bin_add(thread,sink);
gst_element_add_ghost_pad(GST_ELEMENT(thread),gst_element_get_pad(sink,"sink"),"sink");
gst_element_connect (src,"src",queue1,"sink");
gst_element_connect (queue1, "src", GST_ELEMENT (thread), "sink");
fprintf(stderr,"\n\n\n");
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
fprintf(stderr,"\n\n\n");
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
return 0;
}

View file

@ -1,90 +0,0 @@
/*
* reconnect.c - test disconnect and reconnect
* thomas@apestaart.org
*
* Latest change : 31/05/2001
*
* Version : 0.1
*/
#include <stdlib.h>
#include <gst/gst.h>
#include <unistd.h>
#define DEBUG
/* function prototypes */
GstElement *main_bin;
GstElement *fakesrc;
GstElement *fakesink;
int main (int argc, char *argv[])
{
int i;
gst_init (&argc, &argv);
/* set up input channel and main bin */
g_print ("creating main bin\n");
/* create an audio src */
fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
fakesink = gst_elementfactory_make ("fakesink", "fakesink");
/*
gtk_object_set (GTK_OBJECT (fakesink), "silent", TRUE, NULL);
*/
/* create main bin */
main_bin = gst_pipeline_new ("bin");
gst_bin_add (GST_BIN (main_bin), fakesrc);
gst_bin_add (GST_BIN (main_bin), fakesink);
gst_pad_connect (gst_element_get_pad (fakesrc, "src"),
gst_element_get_pad (fakesink, "sink"));
/* start playing */
g_print ("setting to play\n");
gst_element_set_state (main_bin, GST_STATE_PLAYING);
for (i = 0; i < 5; ++i)
{
g_print ("going to iterate\n");
gst_bin_iterate (GST_BIN (main_bin));
g_print ("back from iterate\n");
}
/* disconnect and reconnect fakesink */
gst_element_set_state (main_bin, GST_STATE_PAUSED);
g_print ("disconnecting...\n");
gst_pad_disconnect (gst_element_get_pad (fakesrc, "src"),
gst_element_get_pad (fakesink, "sink"));
g_print ("reconnecting...\n");
gst_pad_connect (gst_element_get_pad (fakesrc, "src"),
gst_element_get_pad (fakesink, "sink"));
gst_element_set_state (main_bin, GST_STATE_PLAYING);
for (i = 0; i < 5; ++i)
{
g_print ("going to iterate\n");
gst_bin_iterate (GST_BIN (main_bin));
g_print ("back from iterate\n");
}
g_print ("we're done iterating.\n");
/* stop the bin */
gst_element_set_state(main_bin, GST_STATE_NULL);
/*
gst_object_destroy (GST_OBJECT (fakesink));
gst_object_destroy (GST_OBJECT (main_bin));
*/
exit(0);
}

View file

@ -1,152 +0,0 @@
#include <gst/gst.h>
static void
dump_plugins (void)
{
GList *plugins;
plugins = gst_plugin_get_list ();
while (plugins) {
GstPlugin *plugin = (GstPlugin *)plugins->data;
g_print ("plugin: %s, loaded %d\n", plugin->name, gst_plugin_is_loaded (plugin));
plugins = g_list_next (plugins);
}
}
static void
dump_factories (void)
{
GList *factories;
factories = gst_elementfactory_get_list ();
while (factories) {
GstElementFactory *factory = (GstElementFactory *)factories->data;
g_print ("factory: %s %d\n", gst_object_get_name (GST_OBJECT (factory)), factory->type);
factories = g_list_next (factories);
}
}
static void
dump_factory (gchar *name)
{
GstElementFactory *factory;
factory = gst_elementfactory_find (name);
if (factory) {
GList *padtemplates = factory->padtemplates;
xmlDocPtr doc;
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "templates", NULL);
while (padtemplates) {
xmlNodePtr parent;
GstPadTemplate *template = (GstPadTemplate *) padtemplates->data;
parent = xmlNewChild (doc->xmlRootNode, NULL, "template", NULL);
gst_padtemplate_save_thyself (template, parent);
padtemplates = g_list_next (padtemplates);
}
xmlDocDump(stdout, doc);
}
}
static void
dump_types (void)
{
GList *types;
types = gst_type_get_list ();
while (types) {
GstType *factory = (GstType *)types->data;
g_print ("type: %s %d\n", factory->mime, factory->id);
types = g_list_next (types);
}
}
static void
load_something (gchar *name)
{
GstElementFactory *factory;
GstElement *element;
//factory = gst_elementfactory_find ("foo");
//g_print ("factory \"foo\" %s\n", (factory?"found":"not found"));
factory = gst_elementfactory_find (name);
g_print ("factory \"%s\" %s\n", name, (factory?"found":"not found"));
element = gst_elementfactory_create (factory, "test");
g_print ("element \"%s\" %s\n", name, (element?"found":"not found"));
}
static void
print_some_providers (gchar *mime)
{
guint16 type;
//GList *srcs, *sinks;
type = gst_type_find_by_mime (mime);
/*
srcs = gst_type_get_srcs (type);
while (srcs) {
GstElementFactory *factory;
factory = (GstElementFactory *) srcs->data;
g_print ("factory src: \"%s\"\n", factory->name);
srcs = g_list_next (srcs);
}
sinks = gst_type_get_sinks (type);
while (sinks) {
GstElementFactory *factory;
factory = (GstElementFactory *) sinks->data;
g_print ("factory sink: \"%s\"\n", factory->name);
sinks = g_list_next (sinks);
}
*/
}
int main(int argc,char *argv[])
{
gst_init(&argc,&argv);
//dump_plugins ();
//dump_factories ();
//dump_types ();
//print_some_providers ("audio/mp3");
load_something ("fdsink");
print_some_providers ("audio/mp3");
load_something ("mpg123");
dump_plugins ();
dump_factories ();
dump_types ();
dump_factory ("lame");
dump_factory ("mpeg_play");
return 0;
}

View file

@ -1,59 +0,0 @@
#include <gst/gst.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc,char *argv[]) {
GstElement *pipeline;
GstElement *paranoia,*lame,*sink;
int i;
int outfile;
GST_DEBUG_ENTER("(%d)",argc);
gst_init(&argc,&argv);
if (argc != 2) argv[1] = "output.mp3";
unlink(argv[1]);
outfile = open(argv[1],O_CREAT | O_RDWR | O_TRUNC);
if (!outfile) {
fprintf(stderr,"couldn't open file\n");
exit(1);
}
fprintf(stderr,"outfile is fd %d\n",outfile);
pipeline = gst_pipeline_new("ripper");
g_return_val_if_fail(pipeline != NULL,1);
paranoia = gst_elementfactory_make("cdparanoia","paranoia");
g_return_val_if_fail(paranoia != NULL,2);
g_object_set(G_OBJECT(paranoia),"paranoia_mode",0,NULL);
// g_object_set(G_OBJECT(paranoia),"start_sector",0,"end_sector",75,NULL);
lame = gst_elementfactory_make("lame","lame");
g_return_val_if_fail(lame != NULL,3);
g_object_set(G_OBJECT(lame),"bitrate",128,NULL);
sink = gst_elementfactory_make("fdsink","fdsink");
g_return_val_if_fail(sink != NULL,4);
g_object_set(G_OBJECT(sink),"fd",outfile,NULL);
fprintf(stderr,"paranoia is %p, lame is %p, sink is %p\n",paranoia,lame,sink);
gst_bin_add(GST_BIN(pipeline),paranoia);
gst_bin_add(GST_BIN(pipeline),lame);
gst_bin_add(GST_BIN(pipeline),sink);
gst_element_connect(paranoia,"src",lame,"sink");
gst_element_connect(lame,"src",sink,"sink");
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
if (GST_STATE(paranoia) != GST_STATE_PLAYING) fprintf(stderr,"error: state not set\n");
for (i=0;i<((argc >= 3)?atoi(argv[2]):4500);i++) {
fprintf(stderr,"\n");
gst_bin_iterate(GST_BIN(pipeline));
}
return 0;
}

View file

@ -1,44 +0,0 @@
#include <gst/gst.h>
#include <assert.h>
int main(int argc,char *argv[]) {
GstElement *pipeline;
GstElement *src,*identity,*sink;
int i;
GST_DEBUG_ENTER("(%d)",argc);
gst_init(&argc,&argv);
pipeline = gst_pipeline_new("fakepipeline");
src = gst_elementfactory_make("fakesrc","src");
/* g_return_val_if_fail(src != NULL,1);
if (argc == 2)
gtk_object_set(GTK_OBJECT(src),"location",argv[1],NULL);
else
gtk_object_set(GTK_OBJECT(src),"location","simplefake.c",NULL);*/
identity = gst_elementfactory_make("identity","identity");
g_return_val_if_fail(identity != NULL,2);
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(GST_BIN(pipeline),src);
gst_bin_add(GST_BIN(pipeline),identity);
gst_bin_add(GST_BIN(pipeline),sink);
gst_element_connect(src,"src",identity,"sink");
gst_element_connect(identity,"src",sink,"sink");
// gst_bin_use_cothreads(GST_BIN(pipeline),TRUE);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
if (GST_STATE(src) != GST_STATE_PLAYING) fprintf(stderr,"error: state not set\n");
for (i=0;i<2;i++) {
fprintf(stderr,"\n");
gst_bin_iterate(GST_BIN(pipeline));
}
exit (0);
}

View file

@ -1,68 +0,0 @@
#include <gst/gst.h>
gboolean state_change(GstElement *element,GstElementState state) {
g_print(">STATES: element '%s' state set to %d(%s)\n",
gst_element_get_name(element),state,gst_element_statename(state));
g_print(">STATES: element state is actually %d\n",GST_STATE(element));
return TRUE;
}
int main(int argc,char *argv[]) {
GstElement *bin,*subbin;
GstElement *src,*sink,*filter;
gst_init(&argc,&argv);
src = gst_elementfactory_make("fakesrc","src");
g_return_val_if_fail(1,src != NULL);
subbin = gst_bin_new("subbin");
g_return_val_if_fail(1,subbin != NULL);
filter = gst_elementfactory_make("identity","filter");
g_return_val_if_fail(1,filter != NULL);
sink = gst_elementfactory_make("fakesink","sink");
g_return_val_if_fail(1,sink != NULL);
bin = gst_bin_new("bin");
g_return_val_if_fail(1,bin != NULL);
g_signal_connect (G_OBJECT(src),"state_change",
G_CALLBACK(state_change),NULL);
g_signal_connect (G_OBJECT(subbin),"state_change",
G_CALLBACK(state_change),NULL);
g_signal_connect (G_OBJECT(filter),"state_change",
G_CALLBACK(state_change),NULL);
g_signal_connect (G_OBJECT(sink),"state_change",
G_CALLBACK(state_change),NULL);
g_signal_connect (G_OBJECT(bin),"state_change",
G_CALLBACK(state_change),NULL);
g_print("STATES: element '%s' starts at state %d(%s)\n",gst_element_get_name(src),
GST_STATE(src),gst_element_statename(GST_STATE(src)));
g_print("STATES: element '%s' starts at state %d(%s)\n",gst_element_get_name(subbin),
GST_STATE(subbin),gst_element_statename(GST_STATE(subbin)));
g_print("STATES: element '%s' starts at state %d(%s)\n",gst_element_get_name(filter),
GST_STATE(filter),gst_element_statename(GST_STATE(filter)));
g_print("STATES: element '%s' starts at state %d(%s)\n",gst_element_get_name(sink),
GST_STATE(sink),gst_element_statename(GST_STATE(sink)));
g_print("STATES: element '%s' starts at state %d(%s)\n",gst_element_get_name(bin),
GST_STATE(bin),gst_element_statename(GST_STATE(bin)));
gst_bin_add(GST_BIN(subbin),filter);
gst_element_add_ghost_pad(GST_ELEMENT(bin),gst_element_get_pad(filter,"sink"),"sink");
gst_element_add_ghost_pad(GST_ELEMENT(bin),gst_element_get_pad(filter,"src"),"src");
gst_bin_add(GST_BIN(bin),src);
gst_bin_add(GST_BIN(bin),subbin);
gst_bin_add(GST_BIN(bin),sink);
gst_pad_connect(gst_element_get_pad(src,"src"),
gst_element_get_pad(subbin,"sink"));
gst_pad_connect(gst_element_get_pad(subbin,"src"),
gst_element_get_pad(sink,"sink"));
gst_element_set_state (bin, GST_STATE_PLAYING);
gst_bin_iterate (GST_BIN (bin));
exit (0);
}

View file

@ -1,37 +0,0 @@
#include <gst/gst.h>
int
main(int argc, char *argv[])
{
GstElement *element, *mp3parse;
GstPadTemplate *templ;
GstPad *pad;
xmlDocPtr doc;
xmlNodePtr parent;
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
gst_init(&argc,&argv);
element = gst_elementfactory_make("tee","element");
mp3parse = gst_elementfactory_make("mp3parse","mp3parse");
pad = gst_element_request_pad_by_name (element, "src%d");
g_print ("new pad %s\n", gst_pad_get_name (pad));
templ = gst_element_get_padtemplate_by_name (mp3parse, "sink");
pad = gst_element_request_compatible_pad (element, templ);
g_print ("new pad %s\n", gst_pad_get_name (pad));
if (pad != NULL) {
parent = xmlNewChild (doc->xmlRootNode, NULL, "Padtemplate", NULL);
gst_padtemplate_save_thyself (pad->padtemplate, parent);
xmlDocDump(stdout, doc);
}
return 0;
}

View file

@ -1,37 +0,0 @@
#include <stdio.h>
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstBin *pipeline, *thread;
GstElement *src, *sink;
gst_info_set_categories(-1);
gst_debug_set_categories(-1);
gst_init(&argc,&argv);
pipeline = GST_BIN (gst_pipeline_new("pipeline"));
thread = GST_BIN (gst_thread_new("thread"));
src = gst_elementfactory_make("fakesrc","src");
g_object_set(G_OBJECT(src),"silent",TRUE,NULL);
sink = gst_elementfactory_make("fakesink","sink");
g_object_set(G_OBJECT(sink),"silent",TRUE,NULL);
fprintf(stderr,"ADDING src\n");
gst_bin_add(thread,src);
fprintf(stderr,"ADDING sink\n");
gst_bin_add(thread,sink);
fprintf(stderr,"CONNECTING src to sink\n");
gst_element_connect (src, "src", sink, "sink");
fprintf(stderr,"ADDING thread\n");
gst_bin_add(pipeline,GST_ELEMENT(thread));
while (1) {
fprintf(stderr,"\nSWITCHING to PLAYING:\n");
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
sleep(1);
fprintf(stderr,"\nSWITCHING to PAUSED:\n");
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PAUSED);
// sleep(1);
}
}

View file

@ -1,66 +0,0 @@
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstTimeCache *tc;
gint64 timestamp;
guint64 location;
gint group;
GstTimeCacheCertainty certain;
gst_init(&argc,&argv);
tc = gst_timecache_new();
g_return_if_fail(tc != NULL);
fprintf(stderr,"current group in timecache is %d\n",gst_timecache_get_group(tc));
// add an entry
gst_timecache_add_entry(tc,0LL,0LL);
// test for new entry
if (gst_timecache_find_location(tc,0LL,&timestamp))
fprintf(stderr,"found timestamp %Ld for location 0\n",timestamp);
else
fprintf(stderr,"ERROR: couldn't find timestamp for newly added entry at 0\n");
// test for entry not there
if (gst_timecache_find_location(tc,1024LL,&timestamp))
fprintf(stderr,"ERROR: found timestamp %Ld for location 1024\n",timestamp);
else
fprintf(stderr,"no timestamp found at 1024\n");
// add another entry
gst_timecache_add_entry(tc,1024LL,1000000LL);
// test for new entry
if (gst_timecache_find_location(tc,1024LL,&timestamp))
fprintf(stderr,"found timestamp %Ld for location 1024\n",timestamp);
else
fprintf(stderr,"ERROR: couldn't find timestamp for newly added entry at 1024\n");
// test for new entry
if (gst_timecache_find_timestamp(tc,1000000LL,&location))
fprintf(stderr,"found location %Ld for location 1000000\n",location);
else
fprintf(stderr,"ERROR: couldn't find location for newly added entry at 1000000\n");
// create a new group
group = gst_timecache_new_group(tc);
// add a couple entries
gst_timecache_add_entry(tc, 2048LL,2000000LL);
gst_timecache_add_entry(tc, 3072LL,3000000LL);
// first test for an existing entry
if (gst_timecache_find_timestamp(tc,1000000LL,&location))
fprintf(stderr,"found location %Ld for location 1000000\n",location);
else
fprintf(stderr,"ERROR: couldn't find location for old entry at 1000000\n");
// then test for an new entry in the current group
if (gst_timecache_find_timestamp(tc,3000000LL,&location))
fprintf(stderr,"found location %Ld for location 3000000\n",location);
else
fprintf(stderr,"ERROR: couldn't find location for old entry at 3000000\n");
}