Remove old 0.8 tests and examples from git tree

Doesn't really look like anything's worth keeping.
This commit is contained in:
Tim-Philipp Müller 2010-07-04 17:34:30 +01:00
parent 9db5a93ed8
commit d089b09075
146 changed files with 0 additions and 10352 deletions

View file

@ -1,24 +0,0 @@
# these example currently don't build (see TODO)
dirs =
#appreader
#cutter
#events
#helloworld2
#launch
#manual
#mixer
#pingpong
#plugins
#pwg
#queue2
#queue3
#queue4
#retag
#thread
SUBDIRS = $(dirs)
DIST_SUBDIRS = $(dirs)

View file

@ -1,66 +0,0 @@
state of the examples:
appreader
controller
okay
cutter
events
helloworld
helloworld2
manual
metadata
mixer
pingpong
plugins
pwg
queue
queue2
queue3
queue4
retag
typefind
xml
----
appreader
gst_bin_iterate
cutter
gst_bin_iterate
events
gst_bin_iterate
gst_event_new_seek
gst_event_new_flush
helloworld
GstAutoplug
manual
dynamic
gst_registry_pool_feature_filter
mixer
gst_bin_iterate
gst_scheduler_show
gst_element_add_ghost_pad
pingpong
gst_bin_iterate
gst_element_add_ghost_pad
gst_element_default_deep_notify
plugins
lots of errors
pwg
lots of errors
retag
gst_tag_setter_
gst_bin_iterate
thread
obsolete, uses gst_thread_new

View file

@ -1 +0,0 @@
appreader

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = appreader
appreader_LDADD = $(GST_OBJ_LIBS)
appreader_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,76 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
static void
fill_queue (GstElement * queue, gint level, GstBin * pipeline)
{
/* this needs to iterate till something is pushed
* in the queue */
gst_bin_iterate (pipeline);
}
gint
main (gint argc, gchar * argv[])
{
GstElement *queue, *src, *pipeline;
GstBuffer *buffer;
gboolean done = FALSE;
GstPad *pad;
gst_init (&argc, &argv);
queue = gst_element_factory_make ("queue", "queue");
g_object_set (G_OBJECT (queue), "signal_marks", TRUE, NULL);
src = gst_element_factory_make ("filesrc", "src");
g_object_set (G_OBJECT (src), "location", "appreader.c", NULL);
pipeline = gst_pipeline_new ("pipeline");
gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL);
gst_element_link_many (src, queue, NULL);
pad = gst_element_get_pad (queue, "src");
g_signal_connect (G_OBJECT (queue), "low_watermark", G_CALLBACK (fill_queue),
pipeline);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
do {
/* get buffer into the app */
buffer = GST_RPAD_GETFUNC (pad) (pad);
/* just exit on any event */
if (GST_IS_EVENT (buffer)) {
done = TRUE;
} else {
gst_util_dump_mem (GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
}
gst_data_unref (GST_DATA (buffer));
} while (!done);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}

View file

@ -1,4 +0,0 @@
cutter
*.bb
*.bbg
*.da

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = cutter
noinst_HEADERS = cutter.h
cutter_LDADD = $(GST_OBJ_LIBS)
cutter_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,203 +0,0 @@
/*
* cutter.c - cut audio into pieces based on silence - thomas@apestaart.org
*
* construct a simple pipeline osssrc ! cutter ! filesink
* pause when necessary, change output
*
* Latest change : 03/06/2001
*
* Version : 0.3
*/
#include <stdlib.h>
#include <gst/gst.h>
#include <unistd.h>
#include <time.h>
#define DEBUG
gboolean playing = TRUE;
gboolean cut_start_signalled = FALSE;
gboolean cut_stop_signalled = FALSE;
int id = 0; /* increment this for each new cut */
GstElement *main_bin;
GstElement *audiosrc;
GstElement *queue;
GstElement *thread;
GstElement *cutter;
GstElement *filesink;
GstElement *encoder;
char buffer[255];
/* signal callbacks */
void
cut_start (GstElement * element)
{
g_print ("\nDEBUG: main: cut start\n");
/* we should pause the pipeline, unlink cutter and filesink
* create a new filesink to a real file, relink, and set to play
*/
g_print ("DEBUG: cut_start: main_bin pausing\n");
gst_element_set_state (main_bin, GST_STATE_PAUSED);
g_print ("DEBUG: cut_start: main_bin paused\n");
{
time_t seconds;
struct tm *ct;
time (&seconds);
ct = localtime (&seconds);
/* sprintf (buffer, "/news/incoming/audio/cutter.%06d.wav", id); */
sprintf (buffer,
"/news/incoming/audio/cutter.%04d%02d%02d.%02d%02d%02d.wav",
ct->tm_year + 1900, ct->tm_mon, ct->tm_mday, ct->tm_hour, ct->tm_min,
ct->tm_sec);
}
g_print ("DEBUG: cut_start: setting new location to %s\n", buffer);
g_object_set (G_OBJECT (filesink), "location", buffer, NULL);
g_object_set (G_OBJECT (filesink), "type", 4, NULL);
gst_element_set_state (main_bin, GST_STATE_PLAYING);
++id;
g_print ("start_cut_signal done\n");
return;
}
void
cut_start_signal (GstElement * element)
{
g_print ("\nDEBUG: main: cut start signal\n");
cut_start_signalled = TRUE;
}
void
cut_stop (GstElement * element)
{
g_print ("\nDEBUG: main: cut stop\n");
/* we should pause the pipeline, unlink filesink, create a fake filesink,
* link to pipeline, and set to play
*/
g_print ("DEBUG: cut_stop: main_bin paused\n");
gst_element_set_state (main_bin, GST_STATE_PAUSED);
g_print ("DEBUG: cut_stop: setting new location\n");
g_object_set (G_OBJECT (filesink), "location", "/dev/null", NULL);
gst_element_set_state (main_bin, GST_STATE_PLAYING);
g_print ("stop_cut_signal done\n");
return;
}
void
cut_stop_signal (GstElement * element)
{
g_print ("\nDEBUG: main: cut stop signal\n");
cut_stop_signalled = TRUE;
}
int
main (int argc, char *argv[])
{
/*int i, j; */
/*gboolean done; */
/*char buffer[20]; */
/*output_channel_t *channel_out; */
GstElement *audiosrc;
gst_init (&argc, &argv);
/*
if (argc == 1)
{
g_print("usage: %s <filename1> <filename2> <...>\n", argv[0]);
exit(-1);
}*/
/* set up input channel and main bin */
g_print ("creating main bin\n");
/* create cutter */
cutter = gst_element_factory_make ("cutter", "cutter");
g_object_set (G_OBJECT (cutter),
"threshold_dB", -40.0, "runlength", 0.5, "prelength", 1.0, NULL);
/* create an audio src */
if (!(audiosrc = gst_element_factory_make ("osssrc", "audio_src")))
g_error ("Could not create 'osssrc' element !\n");
/* set params */
g_object_set (G_OBJECT (audiosrc), "frequency", 44100,
"channels", 1, "format", 16, NULL);
if (!(encoder = gst_element_factory_make ("passthrough", "encoder")))
g_error ("Could not create 'passthrough' element !\n");
if (!(filesink = gst_element_factory_make ("afsink", "disk_sink")))
g_error ("Could not create 'afsink' element !\n");
g_object_set (G_OBJECT (filesink), "location", "/dev/null", NULL);
thread = gst_thread_new ("thread");
g_assert (thread != NULL);
/* create main bin */
main_bin = gst_pipeline_new ("bin");
g_assert (main_bin != NULL);
queue = gst_element_factory_make ("queue", "queue");
g_assert (queue);
/* add elements to bin */
gst_bin_add (GST_BIN (main_bin), audiosrc);
gst_bin_add (GST_BIN (thread), queue);
gst_bin_add_many (GST_BIN (thread), cutter, encoder, filesink, NULL);
gst_element_link_many (audiosrc, queue, cutter, encoder, filesink, NULL);
gst_bin_add (GST_BIN (main_bin), thread);
/* set signal handlers */
g_print ("setting signal handlers\n");
g_signal_connect (G_OBJECT (cutter), "cut_start",
(GCallback) cut_start_signal, NULL);
g_signal_connect (G_OBJECT (cutter), "cut_stop",
(GCallback) cut_stop_signal, NULL);
/* start playing */
g_print ("setting to play\n");
gst_element_set_state (main_bin, GST_STATE_PLAYING);
/*
g_print ("setting thread to play\n");
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
*/
while (playing) {
/* g_print ("> "); */
gst_bin_iterate (GST_BIN (main_bin));
/* g_print (" <"); */
if (cut_start_signalled) {
g_print ("\nDEBUG: main: cut_start_signalled true !\n");
cut_start (cutter);
cut_start_signalled = FALSE;
}
if (cut_stop_signalled) {
g_print ("\nDEBUG: main: cut_stop_signalled true !\n");
cut_stop (cutter);
cut_stop_signalled = FALSE;
}
}
g_print ("we're done iterating.\n");
/* stop the bin */
gst_element_set_state (main_bin, GST_STATE_NULL);
gst_object_unref (filesink);
gst_object_unref (main_bin);
exit (0);
}

View file

@ -1,14 +0,0 @@
/*
* cutter.h header file
* thomas@apestaart.org
*/
typedef struct
{
GstElement *pipe;
GstElement *filesink;
GstElement *audiosink;
char *location;
int channel_id;
} output_channel_t;

View file

@ -1,4 +0,0 @@
noinst_PROGRAMS = seek
LDADD = $(GST_OBJ_LIBS)
AM_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,68 +0,0 @@
#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_element_factory_make ("fakesrc", "src");
g_return_val_if_fail (src != NULL, -1);
sink = gst_element_factory_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 ("--- linking\n");
gst_pad_link (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 +0,0 @@
helloworld2

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = helloworld2
helloworld2_LDADD = $(GST_OBJ_LIBS)
helloworld2_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,133 +0,0 @@
#include <gst/gst.h>
static void
gst_play_have_type (GstElement * typefind, GstCaps * caps,
GstElement * pipeline)
{
GstElement *osssink;
GstElement *new_element;
GstAutoplug *autoplug;
GstElement *autobin;
GstElement *filesrc;
GstElement *cache;
GST_DEBUG ("GstPipeline: play have type");
gst_element_set_state (pipeline, GST_STATE_PAUSED);
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin");
cache = gst_bin_get_by_name (GST_BIN (autobin), "cache");
/* unlink_pads the typefind from the pipeline and remove it */
gst_element_unlink_pads (cache, "src", typefind, "sink");
gst_bin_remove (GST_BIN (autobin), typefind);
/* and an audio sink */
osssink = gst_element_factory_make ("osssink", "play_audio");
g_assert (osssink != NULL);
autoplug = gst_autoplug_factory_make ("staticrender");
g_assert (autoplug != NULL);
new_element = gst_autoplug_to_renderers (autoplug, caps, osssink, NULL);
if (!new_element) {
g_print ("could not autoplug, no suitable codecs found...\n");
exit (-1);
}
gst_element_set_name (new_element, "new_element");
gst_bin_add (GST_BIN (autobin), new_element);
g_object_set (G_OBJECT (cache), "reset", TRUE, NULL);
gst_element_link_pads (cache, "src", new_element, "sink");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
static void
gst_play_cache_empty (GstElement * element, GstElement * pipeline)
{
GstElement *autobin;
GstElement *filesrc;
GstElement *cache;
GstElement *new_element;
fprintf (stderr, "have cache empty\n");
gst_element_set_state (pipeline, GST_STATE_PAUSED);
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin");
cache = gst_bin_get_by_name (GST_BIN (autobin), "cache");
new_element = gst_bin_get_by_name (GST_BIN (autobin), "new_element");
gst_element_unlink_pads (filesrc, "src", cache, "sink");
gst_element_unlink_pads (cache, "src", new_element, "sink");
gst_bin_remove (GST_BIN (autobin), cache);
gst_element_link_pads (filesrc, "src", new_element, "sink");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
fprintf (stderr, "done with cache_empty\n");
}
int
main (int argc, char *argv[])
{
GstElement *filesrc;
GstElement *pipeline;
GstElement *autobin;
GstElement *typefind;
GstElement *cache;
gst_init (&argc, &argv);
if (argc != 2) {
g_print ("usage: %s <filename>\n", argv[0]);
exit (-1);
}
/* create a new pipeline to hold the elements */
pipeline = gst_pipeline_new ("pipeline");
g_assert (pipeline != NULL);
/* create a disk reader */
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_assert (filesrc != NULL);
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
gst_bin_add (GST_BIN (pipeline), filesrc);
autobin = gst_bin_new ("autobin");
cache = gst_element_factory_make ("autoplugcache", "cache");
g_signal_connect (G_OBJECT (cache), "cache_empty",
G_CALLBACK (gst_play_cache_empty), pipeline);
typefind = gst_element_factory_make ("typefind", "typefind");
g_signal_connect (G_OBJECT (typefind), "have_type",
G_CALLBACK (gst_play_have_type), pipeline);
gst_bin_add (GST_BIN (autobin), cache);
gst_bin_add (GST_BIN (autobin), typefind);
gst_element_link_pads (cache, "src", typefind, "sink");
gst_element_add_ghost_pad (autobin, gst_element_get_pad (cache, "sink"),
"sink");
gst_bin_add (GST_BIN (pipeline), autobin);
gst_element_link_pads (filesrc, "src", autobin, "sink");
/* start playing */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
while (gst_bin_iterate (GST_BIN (pipeline)));
/* stop the pipeline */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_object_unref (pipeline);
exit (0);
}

View file

@ -1,39 +0,0 @@
Makefile
Makefile.in
*.c
*.o
*.lo
*.la
.deps
.libs
dynamic
elementget
elementmake
gnome
fakesrc
helloworld
helloworld2
init
popt
queue
threads
bin
decodebin
elementcreate
elementfactory
elementlink
ghostpad
pad
playbin
query
typefind
xml-mp3
xml
xmlTest.gst
README
*.bb
*.bbg
*.da

View file

@ -1,104 +0,0 @@
if HAVE_LIBGNOMEUI
GNOME=gnome
else
GNOME=
endif
if GST_DISABLE_LOADSAVE
GST_LOADSAVE_SRC =
else
GST_LOADSAVE_SRC = xml-mp3
endif
INCLUDES = $(GST_OBJ_CFLAGS)
goption_CFLAGS = -DGETTEXT_PACKAGE="\"gstreamer-0.9\""
#dynamic_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
#dynamic_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS)
gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
gnome_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS)
EXTRA_DIST = extract.pl
EXAMPLES = \
bus \
dynamic \
$(GNOME) \
elementcreate \
elementmake \
elementfactory \
elementget \
elementlink \
bin \
pad \
ghostpad \
helloworld \
init \
goption \
query \
typefind \
probe \
fakesrc \
playbin \
decodebin \
$(GST_LOADSAVE_SRC)
elementmake.c elementcreate.c elementget.c elementlink.c elementfactory.c: $(top_srcdir)/docs/manual/basics-elements.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-elements.xml
bin.c : $(top_srcdir)/docs/manual/basics-bins.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-bins.xml
bus.c: $(top_srcdir)/docs/manual/basics-bus.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-bus.xml
pad.c ghostpad.c: $(top_srcdir)/docs/manual/basics-pads.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-pads.xml
gnome.c: $(top_srcdir)/docs/manual/appendix-integration.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/appendix-integration.xml
helloworld.c: $(top_srcdir)/docs/manual/basics-helloworld.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-helloworld.xml
init.c goption.c: $(top_srcdir)/docs/manual/basics-init.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-init.xml
query.c: $(top_srcdir)/docs/manual/advanced-position.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/advanced-position.xml
typefind.c dynamic.c: $(top_srcdir)/docs/manual/advanced-autoplugging.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/advanced-autoplugging.xml
probe.c fakesrc.c: $(top_srcdir)/docs/manual/advanced-dataaccess.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/advanced-dataaccess.xml
playbin.c decodebin.c: $(top_srcdir)/docs/manual/highlevel-components.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/highlevel-components.xml
xml-mp3.c: $(top_srcdir)/docs/manual/highlevel-xml.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/highlevel-xml.xml
# we use some of the examples as testsuite apps, to verify that
# they actually run
include $(top_srcdir)/tests/old/testsuite/Rules
tests_pass = elementmake elementget init goption
tests_fail =
tests_ignore =
noinst_PROGRAMS = $(EXAMPLES)
LDADD = $(GST_OBJ_LIBS)

View file

@ -1,78 +0,0 @@
#!/usr/bin/perl
# extract code fragments from xml program listings
# first argument: source code file to find
# second argument: xml files to extract code from
# main
# decodes xml by translating &amp; &lt; &gt; back to what they should be
# and also ignore
# <![CDATA[ and ]]> and <!-- and -->
sub
xml_decode ($)
{
my $input = shift;
$input =~ s/\&amp;/&/g;
$input =~ s/&lt;/</g;
$input =~ s/&gt;/>/g;
if ($input =~ /<!\[CDATA\[/) { $input = ""; }
if ($input =~ /]]>/) { $input = ""; }
if ($input =~ /<!--/) { $input = ""; }
if ($input =~ /-->/) { $input = ""; }
#print "Returning line $input";
return $input;
}
# main
my $output = shift @ARGV;
$found = 0;
%blocks = ();
foreach $file (@ARGV)
{
open FILE, $file or die "Cannot open file $file";
while ($line = <FILE>)
{
if ($line =~ /<!-- example-begin $output (.*?)-->/)
{
$found = 1;
$block_id = $1;
$block = "\n/*** block $block_id from $file ***/\n";
print "Extracting $output block $block_id from $file\n";
while ($line = <FILE>)
{
if ($line =~ /<!-- example-end $output (.*?)-->/)
{
last;
}
$block .= xml_decode ($line);
}
$blocks{$block_id} = $block;
}
}
}
if (!$found)
{
print "Could not find $output example !\n";
exit(1);
}
# now output all the blocks in the right order
open OUTPUT, ">$output";
@block_ids = keys %blocks;
foreach $block_id (sort @block_ids)
{
print "Writing $output block $block_id\n";
print OUTPUT $blocks{$block_id};
}
close OUTPUT;

View file

@ -1,5 +0,0 @@
helloworld
mixer
*.bb
*.bbg
*.da

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = mixer
noinst_HEADERS = mixer.h
mixer_LDADD = $(GST_OBJ_LIBS)
mixer_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,398 +0,0 @@
/*
* mixer.c - stereo audio mixer - thomas@apestaart.org
* example based on helloworld
* demonstrates the adder plugin and the volume envelope plugin
* work in progress but do try it out
*
* Latest change : 28/08/2001
* trying to adapt to incsched
* delayed start for channels > 1
* now works by quickhacking the
* adder plugin to set
* GST_ELEMENT_COTHREAD_STOPPING
* Version : 0.5.1
*/
#include <stdlib.h>
#include <gst/gst.h>
#include "mixer.h"
#include <unistd.h>
/*#define WITH_BUG */
/*#define WITH_BUG2 */
/*#define DEBUG */
/*#define AUTOPLUG * define if you want autoplugging of input channels * */
/* function prototypes */
input_channel_t *create_input_channel (int id, char *location);
void destroy_input_channel (input_channel_t * pipe);
void env_register_cp (GstElement * volenv, double cp_time, double cp_level);
gboolean playing;
/* eos will be called when the src element has an end of stream */
void
eos (GstElement * element)
{
g_print ("have eos, quitting ?\n");
/* playing = FALSE; */
}
G_GNUC_UNUSED static GstCaps *
gst_play_type_find (GstBin * bin, GstElement * element)
{
GstElement *typefind;
GstElement *pipeline;
GstCaps *caps = NULL;
GST_DEBUG ("GstPipeline: typefind for element \"%s\"",
GST_ELEMENT_NAME (element));
pipeline = gst_pipeline_new ("autoplug_pipeline");
typefind = gst_element_factory_make ("typefind", "typefind");
g_return_val_if_fail (typefind != NULL, FALSE);
gst_pad_link (gst_element_get_pad (element, "src"),
gst_element_get_pad (typefind, "sink"));
gst_bin_add (bin, typefind);
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (bin));
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* push a buffer... the have_type signal handler will set the found flag */
gst_bin_iterate (GST_BIN (pipeline));
gst_element_set_state (pipeline, GST_STATE_NULL);
caps = gst_pad_get_caps (gst_element_get_pad (element, "src"));
gst_pad_unlink (gst_element_get_pad (element, "src"),
gst_element_get_pad (typefind, "sink"));
gst_bin_remove (bin, typefind);
gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin));
gst_object_unref (typefind);
gst_object_unref (pipeline);
return caps;
}
int
main (int argc, char *argv[])
{
int i, j;
int num_channels;
char buffer[20];
GList *input_channels; /* structure holding all the input channels */
input_channel_t *channel_in;
GstElement *main_bin;
GstElement *adder;
GstElement *audiosink;
GstPad *pad; /* to request pads for the adder */
gst_init (&argc, &argv);
if (argc == 1) {
g_print ("usage: %s <filename1> <filename2> <...>\n", argv[0]);
exit (-1);
}
num_channels = argc - 1;
/* set up output channel and main bin */
/* create adder */
adder = gst_element_factory_make ("adder", "adderel");
/* create an audio sink */
audiosink = gst_element_factory_make ("esdsink", "play_audio");
/* create main bin */
main_bin = gst_pipeline_new ("bin");
/* link adder and output to bin */
GST_INFO ("main: adding adder to bin");
gst_bin_add (GST_BIN (main_bin), adder);
GST_INFO ("main: adding audiosink to bin");
gst_bin_add (GST_BIN (main_bin), audiosink);
/* link adder and audiosink */
gst_pad_link (gst_element_get_pad (adder, "src"),
gst_element_get_pad (audiosink, "sink"));
/* start looping */
input_channels = NULL;
for (i = 1; i < argc; ++i) {
printf ("Opening channel %d from file %s...\n", i, argv[i]);
channel_in = create_input_channel (i, argv[i]);
input_channels = g_list_append (input_channels, channel_in);
if (i > 1)
gst_element_set_state (main_bin, GST_STATE_PAUSED);
gst_bin_add (GST_BIN (main_bin), channel_in->pipe);
/* request pads and link to adder */
GST_INFO ("requesting pad\n");
pad = gst_element_get_request_pad (adder, "sink%d");
printf ("\tGot new adder sink pad %s\n", gst_pad_get_name (pad));
sprintf (buffer, "channel%d", i);
gst_pad_link (gst_element_get_pad (channel_in->pipe, buffer), pad);
/* register a volume envelope */
printf ("\tregistering volume envelope...\n");
/*
* this is the volenv :
* each song gets a slot of 5 seconds, with a 5 second fadeout
* at the end of that, all audio streams play simultaneously
* at a level ensuring no distortion
* example for three songs :
* song1 : starts at full level, plays 5 seconds, faded out at 10 seconds,
* sleep until 25, fade to end level at 30
* song2 : starts silent, fades in at 5 seconds, full blast at 10 seconds,
* full level until 15, faded out at 20, sleep until 25, fade to end at 30
* song3 : starts muted, fades in from 15, full at 20, until 25, fade to end level
*/
if (i == 1) {
/* first song gets special treatment for end style */
env_register_cp (channel_in->volenv, 0.0, 1.0);
} else {
env_register_cp (channel_in->volenv, 0.0, 0.0000001); /* start muted */
env_register_cp (channel_in->volenv, i * 10.0 - 15.0, 0.0000001); /* start fade in */
env_register_cp (channel_in->volenv, i * 10.0 - 10.0, 1.0);
}
env_register_cp (channel_in->volenv, i * 10.0 - 5.0, 1.0); /* end of full level */
if (i != num_channels) {
env_register_cp (channel_in->volenv, i * 10.0, 0.0000001); /* fade to black */
env_register_cp (channel_in->volenv, num_channels * 10.0 - 5.0, 0.0000001); /* start fade in */
}
env_register_cp (channel_in->volenv, num_channels * 10.0, 1.0 / num_channels); /* to end level */
#ifndef GST_DISABLE_LOADSAVE
gst_xml_write_file (GST_ELEMENT (main_bin), fopen ("mixer.xml", "w"));
#endif
/* start playing */
gst_element_set_state (main_bin, GST_STATE_PLAYING);
/* write out the schedule */
gst_scheduler_show (GST_ELEMENT_SCHEDULER (main_bin));
playing = TRUE;
j = 0;
/*printf ("main: start iterating from 0"); */
while (playing && j < 100) {
/* printf ("main: iterating %d\n", j); */
gst_bin_iterate (GST_BIN (main_bin));
/*fprintf(stderr,"after iterate()\n"); */
++j;
}
}
printf ("main: all the channels are open\n");
while (playing) {
gst_bin_iterate (GST_BIN (main_bin));
/*fprintf(stderr,"after iterate()\n"); */
}
/* stop the bin */
gst_element_set_state (main_bin, GST_STATE_NULL);
while (input_channels) {
destroy_input_channel (input_channels->data);
input_channels = g_list_next (input_channels);
}
g_list_free (input_channels);
gst_object_unref (audiosink);
gst_object_unref (main_bin);
exit (0);
}
input_channel_t *
create_input_channel (int id, char *location)
{
/* create an input channel, reading from location
* return a pointer to the channel
* return NULL if failed
*/
input_channel_t *channel;
char buffer[20]; /* hold the names */
/* GstAutoplug *autoplug;
GstCaps *srccaps; */
GstElement *new_element;
GstElement *decoder;
GST_DEBUG ("c_i_p : creating channel with id %d for file %s", id, location);
/* allocate channel */
channel = (input_channel_t *) malloc (sizeof (input_channel_t));
if (channel == NULL) {
printf ("create_input_channel : could not allocate memory for channel !\n");
return NULL;
}
/* create channel */
GST_DEBUG ("c_i_p : creating pipeline");
sprintf (buffer, "pipeline%d", id);
channel->pipe = gst_bin_new (buffer);
g_assert (channel->pipe != NULL);
/* create elements */
GST_DEBUG ("c_i_p : creating filesrc");
sprintf (buffer, "filesrc%d", id);
channel->filesrc = gst_element_factory_make ("filesrc", buffer);
g_assert (channel->filesrc != NULL);
GST_DEBUG ("c_i_p : setting location");
g_object_set (G_OBJECT (channel->filesrc), "location", location, NULL);
/* add filesrc to the bin before autoplug */
gst_bin_add (GST_BIN (channel->pipe), channel->filesrc);
/* link signal to eos of filesrc */
g_signal_connect (G_OBJECT (channel->filesrc), "eos", G_CALLBACK (eos), NULL);
#ifdef DEBUG
printf ("DEBUG : c_i_p : creating volume envelope\n");
#endif
sprintf (buffer, "volenv%d", id);
channel->volenv = gst_element_factory_make ("volenv", buffer);
g_assert (channel->volenv != NULL);
/* autoplug the pipe */
#ifdef DEBUG
printf ("DEBUG : c_i_p : getting srccaps\n");
#endif
#ifdef WITH_BUG
srccaps = gst_play_type_find (GST_BIN (channel->pipe), channel->filesrc);
#endif
#ifdef WITH_BUG2
{
GstElement *pipeline;
pipeline = gst_pipeline_new ("autoplug_pipeline");
gst_bin_add (GST_BIN (pipeline), channel->pipe);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_bin_remove (GST_BIN (pipeline), channel->pipe);
}
#endif
#ifdef AUTOPLUG
if (!srccaps) {
g_print ("could not autoplug, unknown media type...\n");
exit (-1);
}
#ifdef DEBUG
printf ("DEBUG : c_i_p : creating autoplug\n");
#endif
autoplug = gst_autoplug_factory_make ("static");
g_assert (autoplug != NULL);
#ifdef DEBUG
printf ("DEBUG : c_i_p : autoplugging\n");
#endif
new_element = gst_autoplug_to_caps (autoplug, srccaps,
gst_caps_new ("audio/raw", NULL), NULL);
if (!new_element) {
g_print ("could not autoplug, no suitable codecs found...\n");
exit (-1);
}
#else
new_element = gst_bin_new ("autoplug_bin");
/* static plug, use mad plugin and assume mp3 input */
printf ("using static plugging for input channel\n");
decoder = gst_element_factory_make ("mad", "mpg123");
if (!decoder) {
fprintf (stderr, "Could not get a decoder element !\n");
exit (1);
}
gst_bin_add (GST_BIN (new_element), decoder);
gst_element_add_ghost_pad (new_element,
gst_element_get_pad (decoder, "sink"), "sink");
gst_element_add_ghost_pad (new_element,
gst_element_get_pad (decoder, "src"), "src_00");
#endif
#ifndef GST_DISABLE_LOADSAVE
gst_xml_write_file (GST_ELEMENT (new_element), fopen ("mixer.gst", "w"));
#endif
gst_bin_add (GST_BIN (channel->pipe), channel->volenv);
gst_bin_add (GST_BIN (channel->pipe), new_element);
gst_element_link_pads (channel->filesrc, "src", new_element, "sink");
gst_element_link_pads (new_element, "src_00", channel->volenv, "sink");
/* add a ghost pad */
sprintf (buffer, "channel%d", id);
gst_element_add_ghost_pad (channel->pipe,
gst_element_get_pad (channel->volenv, "src"), buffer);
#ifdef DEBUG
printf ("DEBUG : c_i_p : end function\n");
#endif
return channel;
}
void
destroy_input_channel (input_channel_t * channel)
{
/*
* destroy an input channel
*/
#ifdef DEBUG
printf ("DEBUG : d_i_p : start\n");
#endif
/* destroy elements */
gst_object_unref (channel->pipe);
free (channel);
}
void
env_register_cp (GstElement * volenv, double cp_time, double cp_level)
{
char buffer[30];
sprintf (buffer, "%f:%f", cp_time, cp_level);
g_object_set (G_OBJECT (volenv), "controlpoint", buffer, NULL);
}

View file

@ -1,12 +0,0 @@
/*
* mixer.h header file
* thomas@apestaart.org
*/
typedef struct
{
GstElement *pipe, *filesrc, *volenv;
char *location;
int channel_id;
} input_channel_t;

View file

@ -1,12 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
pingpong
*.bb
*.bbg
*.da

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = pingpong
pingpong_LDADD = $(GST_OBJ_LIBS)
pingpong_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,99 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
static GstElement *
make_bin (gint count)
{
GstElement *bin;
GstElement *src;
char *name;
name = g_strdup_printf ("bin%d", count);
bin = gst_bin_new (name);
g_free (name);
name = g_strdup_printf ("fakesrc%d", count);
src = gst_element_factory_make ("fakesrc", name);
g_free (name);
gst_bin_add (GST_BIN (bin), src);
gst_element_add_ghost_pad (bin, gst_element_get_pad (src, "src"), "src");
return bin;
}
gint
main (gint argc, gchar * argv[])
{
GstElement *pipeline;
GstElement *aggregator, *sink;
GstElement *bin1, *bin2;
GstPad *pad1, *pad2;
gint i;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("main");
g_signal_connect (pipeline, "deep_notify",
G_CALLBACK (gst_element_default_deep_notify), NULL);
aggregator = gst_element_factory_make ("aggregator", "mixer");
sink = gst_element_factory_make ("fakesink", "sink");
gst_bin_add (GST_BIN (pipeline), aggregator);
gst_bin_add (GST_BIN (pipeline), sink);
gst_element_link_pads (aggregator, "src", sink, "sink");
bin1 = make_bin (1);
pad1 = gst_element_get_request_pad (aggregator, "sink%d");
gst_pad_link (gst_element_get_pad (bin1, "src"), pad1);
gst_bin_add (GST_BIN (pipeline), bin1);
bin2 = make_bin (2);
pad2 = gst_element_get_request_pad (aggregator, "sink%d");
gst_pad_link (gst_element_get_pad (bin2, "src"), pad2);
gst_bin_add (GST_BIN (pipeline), bin2);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
i = 2;
while (i--)
gst_bin_iterate (GST_BIN (pipeline));
g_print ("pause bin1\n");
gst_element_set_state (bin1, GST_STATE_PAUSED);
i = 4;
while (i--)
gst_bin_iterate (GST_BIN (pipeline));
g_print ("playing bin1\n");
gst_element_set_state (bin1, GST_STATE_PLAYING);
i = 4;
while (i--)
gst_bin_iterate (GST_BIN (pipeline));
gst_element_set_state (pipeline, GST_STATE_NULL);
return 0;
}

View file

@ -1,10 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
*.bb
*.bbg
*.da

View file

@ -1,12 +0,0 @@
plugin_LTLIBRARIES = libgstexample.la
libgstexample_la_SOURCES = example.c
libgstexample_la_CFLAGS = $(GST_OBJ_CFLAGS)
libgstexample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = example.h
## ... but we don't want them installed so we override the install target
install:
@true

View file

@ -1,426 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* First, include the header file for the plugin, to bring in the
* object definition and other useful things.
*/
#include <string.h>
#include "example.h"
/* The ElementDetails structure gives a human-readable description of the
* plugin, as well as author and version data. Use the GST_ELEMENT_DETAILS
* macro when defining it.
*/
static GstElementDetails example_details =
GST_ELEMENT_DETAILS ("An example plugin",
"Example/FirstExample",
"Shows the basic structure of a plugin",
"your name <your.name@your.isp>");
/* These are the signals that this element can fire. They are zero-
* based because the numbers themselves are private to the object.
* LAST_SIGNAL is used for initialization of the signal array.
*/
enum
{
ASDF,
/* FILL ME */
LAST_SIGNAL
};
/* Arguments are identified the same way, but cannot be zero, so you
* must leave the ARG_0 entry in as a placeholder.
*/
enum
{
ARG_0,
ARG_ACTIVE
/* FILL ME */
};
/* The PadFactory structures describe what pads the element has or
* can have. They can be quite complex, but for this example plugin
* they are rather simple.
*/
GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* The name of the pad */
GST_PAD_SINK, /* Direction of the pad */
GST_PAD_ALWAYS, /* The pad exists for every instance */
GST_STATIC_CAPS ("unknown/unknown, " /* The MIME media type */
"foo:int=1, " /* an integer property */
"bar:boolean=true, " /* a boolean property */
"baz:int={ 1, 3 }" /* a list of values */
)
);
/* This factory is much simpler, and defines the source pad. */
GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("unknown/unknown")
);
/* A number of function prototypes are given so we can refer to them later. */
static void gst_example_class_init (GstExampleClass * klass);
static void gst_example_init (GstExample * example);
static void gst_example_chain (GstPad * pad, GstData * _data);
static void gst_example_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_example_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstStateChangeReturn gst_example_change_state (GstElement * element,
GstStateChange transition);
/* The parent class pointer needs to be kept around for some object
* operations.
*/
static GstElementClass *parent_class = NULL;
/* This array holds the ids of the signals registered for this object.
* The array indexes are based on the enum up above.
*/
static guint gst_example_signals[LAST_SIGNAL] = { 0 };
/* This function is used to register and subsequently return the type
* identifier for this object class. On first invocation, it will
* register the type, providing the name of the class, struct sizes,
* and pointers to the various functions that define the class.
*/
GType
gst_example_get_type (void)
{
static GType example_type = 0;
if (!example_type) {
static const GTypeInfo example_info = {
sizeof (GstExampleClass),
NULL,
NULL,
(GClassInitFunc) gst_example_class_init,
NULL,
NULL,
sizeof (GstExample),
0,
(GInstanceInitFunc) gst_example_init,
};
example_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstExample", &example_info,
0);
}
return example_type;
}
/* In order to create an instance of an object, the class must be
* initialized by this function. GObject will take care of running
* it, based on the pointer to the function provided above.
*/
static void
gst_example_class_init (GstExampleClass * klass)
{
/* Class pointers are needed to supply pointers to the private
* implementations of parent class methods.
*/
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
/* Since the example class contains the parent classes, you can simply
* cast the pointer to get access to the parent classes.
*/
gobject_class = G_OBJECT_CLASS (klass);
gstelement_class = GST_ELEMENT_CLASS (klass);
/* The parent class is needed for class method overrides. */
parent_class = g_type_class_peek_parent (klass);
/* Here we add an argument to the object. This argument is an integer,
* and can be both read and written.
*/
g_object_class_install_property (gobject_class, ARG_ACTIVE, g_param_spec_int ("active", "active", "active", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
/* Here we add a signal to the object. This is a very useless signal
* called asdf. The signal will also pass a pointer to the listeners
* which happens to be the example element itself */
gst_example_signals[ASDF] =
g_signal_new ("asdf", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstExampleClass, asdf), NULL, NULL,
g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, GST_TYPE_EXAMPLE);
/* The last thing is to provide the functions that implement get and set
* of arguments.
*/
gobject_class->set_property = gst_example_set_property;
gobject_class->get_property = gst_example_get_property;
/* we also override the default state change handler with our own
* implementation */
gstelement_class->change_state = gst_example_change_state;
/* We can now provide the details for this element, that we defined earlier. */
gst_element_class_set_details (gstelement_class, &example_details);
/* The pad templates can be easily generated from the factories above,
* and then added to the list of padtemplates for the class.
*/
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&src_template));
}
/* This function is responsible for initializing a specific instance of
* the plugin.
*/
static void
gst_example_init (GstExample * example)
{
/* First we create the sink pad, which is the input to the element.
* We will use the template constructed by the factory.
*/
example->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
"sink");
/* Setting the chain function allows us to supply the function that will
* actually be performing the work. Without this, the element would do
* nothing, with undefined results (assertion failures and such).
*/
gst_pad_set_chain_function (example->sinkpad, gst_example_chain);
/* We then must add this pad to the element's list of pads. The base
* element class manages the list of pads, and provides accessors to it.
*/
gst_element_add_pad (GST_ELEMENT (example), example->sinkpad);
/* The src pad, the output of the element, is created and registered
* in the same way, with the exception of the chain function. Source
* pads don't have chain functions, because they can't accept buffers,
* they only produce them.
*/
example->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
"src");
gst_element_add_pad (GST_ELEMENT (example), example->srcpad);
/* Initialization of element's private variables. */
example->active = FALSE;
}
/* The chain function is the heart of the element. It's where all the
* work is done. It is passed a pointer to the pad in question, as well
* as the buffer provided by the peer element.
*/
static void
gst_example_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstExample *example;
GstBuffer *outbuf;
/* Some of these checks are of dubious value, since if there were not
* already true, the chain function would never be called.
*/
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
/* We need to get a pointer to the element this pad belongs to. */
example = GST_EXAMPLE (gst_pad_get_parent (pad));
/* A few more sanity checks to make sure that the element that owns
* this pad is the right kind of element, in case something got confused.
*/
g_return_if_fail (example != NULL);
g_return_if_fail (GST_IS_EXAMPLE (example));
/* If we are supposed to be doing something, here's where it happens. */
if (example->active) {
/* In this example we're going to copy the buffer to another one,
* so we need to allocate a new buffer first. */
outbuf = gst_buffer_new ();
/* We need to copy the size and offset of the buffer at a minimum. */
GST_BUFFER_SIZE (outbuf) = GST_BUFFER_SIZE (buf);
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf);
/* Then allocate the memory for the new buffer */
GST_BUFFER_DATA (outbuf) = (guchar *) g_malloc (GST_BUFFER_SIZE (outbuf));
/* Then copy the data in the incoming buffer into the new buffer. */
memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (outbuf));
/* we don't need the incomming buffer anymore so we unref it. When we are
* the last plugin with a handle to the buffer, its memory will be freed */
gst_buffer_unref (buf);
/* When we're done with the buffer, we push it on to the next element
* in the pipeline, through the element's source pad, which is stored
* in the element's structure.
*/
gst_pad_push (example->srcpad, GST_DATA (outbuf));
/* For fun we'll emit our useless signal here */
g_signal_emit (G_OBJECT (example), gst_example_signals[ASDF], 0, example);
/* If we're not doing something, just send the original incoming buffer. */
} else {
gst_pad_push (example->srcpad, GST_DATA (buf));
}
}
/* Properties are part of the GLib+ object system, and these functions
* enable the element to respond to various properties.
*/
static void
gst_example_set_property (GObject * object, guint prop_id, const GValue * value,
GParamSpec * pspec)
{
GstExample *example;
g_return_if_fail (GST_IS_EXAMPLE (object));
/* Get a pointer of the right type. */
example = GST_EXAMPLE (object);
/* Check the argument id to see which argument we're setting. */
switch (prop_id) {
case ARG_ACTIVE:
/* Here we simply copy the value of the argument to our private
* storage. More complex operations can be done, but beware that
* they may occur at any time, possibly even while your chain function
* is running, if you are using threads.
*/
example->active = g_value_get_int (value);
g_print ("example: set active to %d\n", example->active);
break;
default:
break;
}
}
/* The set function is simply the inverse of the get fuction. */
static void
gst_example_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstExample *example;
g_return_if_fail (GST_IS_EXAMPLE (object));
example = GST_EXAMPLE (object);
switch (prop_id) {
case ARG_ACTIVE:
g_value_set_int (value, example->active);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/* This is the state change function that will be called when
* the element goes through the different state changes.
* The plugin can prepare itself and its internal data structures
* in the various state transitions.
*/
static GstStateChangeReturn
gst_example_change_state (GstElement * element, GstStateChange transition)
{
GstExample *example;
/* cast to our plugin */
example = GST_EXAMPLE (element);
/* we perform our actions based on the state transition
* of the element */
switch (transition) {
/* The NULL to READY transition is used to
* create threads (if any), and/or open devices */
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
/* In the PAUSED to PLAYING state, the element should
* prepare itself for operation or continue after a PAUSE */
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
/* In the PLAYING to PAUSED state, the element should
* PAUSE itself and make sure it can resume operation */
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
/* In the PAUSED to READY state, the element should reset
* its internal state and close any devices. */
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
/* The element should free all resources, terminate threads
* and put itself into its initial state again */
case GST_STATE_CHANGE_READY_TO_NULL:
break;
}
/* Then we call the parent state change handler */
return parent_class->change_state (element, transition);
}
/* This is the entry into the plugin itself. When the plugin loads,
* this function is called to register everything that the plugin provides.
*/
static gboolean
plugin_init (GstPlugin * plugin)
{
/* We need to register each element we provide with the plugin. This consists
* of the name of the element, a rank that gives the importance of the element
* when compared to similar plugins and the GType identifier.
*/
if (!gst_element_register (plugin, "example", GST_RANK_MARGINAL,
GST_TYPE_EXAMPLE))
return FALSE;
/* Now we can return successfully. */
return TRUE;
/* At this point, the GStreamer core registers the plugin, its
* elementfactories, padtemplates, etc., for use in your application.
*/
}
/* This structure describes the plugin to the system for dynamically loading
* plugins, so that the version number and name can be checked in a uniform
* way.
*
* The symbol pointing to this structure is the only symbol looked up when
* loading the plugin.
*/
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, /* The major version of the core that this was built with */
GST_VERSION_MINOR, /* The minor version of the core that this was built with */
"example", /* The name of the plugin. This must be unique: plugins with
* the same name will be assumed to be identical, and only
* one will be loaded. */
"an example plugin", /* a short description of the plugin in English */
plugin_init, /* Pointer to the initialisation function for the plugin. */
"0.1", /* The version number of the plugin */
"LGPL", /* effective license the plugin can be shipped with. Must be
* valid for all libraries it links to, too. */
"my nifty plugin package",
/* package this plugin belongs to. */
"http://www.mydomain.com"
/* originating URL for this plugin. This is the place to look
* for updates, information and so on. */
);

View file

@ -1,87 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_EXAMPLE_H__
#define __GST_EXAMPLE_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* This is the definition of the element's object structure. */
typedef struct _GstExample GstExample;
/* The structure itself is derived from GstElement, as can be seen by the
* fact that there's a complete instance of the GstElement structure at
* the beginning of the object. This allows the element to be cast to
* an Element or even an Object.
*/
struct _GstExample {
GstElement element;
/* We need to keep track of our pads, so we do so here. */
GstPad *sinkpad,*srcpad;
/* We'll use this to decide whether to do anything to the data we get. */
gboolean active;
};
/* The other half of the object is its class. The class also derives from
* the same parent, though it must be the class structure this time.
* Function pointers for polymophic methods and signals are placed in this
* structure. */
typedef struct _GstExampleClass GstExampleClass;
struct _GstExampleClass {
GstElementClass parent_class;
/* signals */
void (*asdf) (GstElement *element, GstExample *example);
};
/* Five standard preprocessing macros are used in the GLib object system.
* The first uses the object's _get_type function to return the GType
* of the object.
*/
#define GST_TYPE_EXAMPLE \
(gst_example_get_type())
/* The second is a checking cast to the correct type. If the object passed
* is not the right type, a warning will be generated on stderr.
*/
#define GST_EXAMPLE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_EXAMPLE,GstExample))
/* The third is a checking cast of the class instead of the object. */
#define GST_EXAMPLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_EXAMPLE,GstExampleClass))
/* The last two simply check to see if the passed pointer is an object or
* class of the correct type. */
#define GST_IS_EXAMPLE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_EXAMPLE))
#define GST_IS_EXAMPLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_EXAMPLE))
/* This is the only prototype needed, because it is used in the above
* GST_TYPE_EXAMPLE macro.
*/
GType gst_example_get_type(void);
G_END_DECLS
#endif /* __GST_EXAMPLE_H__ */

View file

@ -1,18 +0,0 @@
boilerplate.c
caps.func
chain2.c
chain.c
chain.func
convertcaps.c
filter.h
forwardcaps.c
getcaps.c
init.func
pads.c
properties.c
range.c
register.func
state.c
state.func
task.c
test.c

View file

@ -1,88 +0,0 @@
INCLUDES = $(GST_OBJ_CFLAGS) \
-DVERSION="\"0.0.1\""
libboilerplate_la_SOURCES = boilerplate.c
libpads_la_SOURCES = pads.c
libchain_la_SOURCES = chain.c
libchain2_la_SOURCES = chain2.c
libstate_la_SOURCES = state.c
libproperties_la_SOURCES = properties.c
libforwardcaps_la_SOURCES = forwardcaps.c
libconvertcaps_la_SOURCES = convertcaps.c
libgetcaps_la_SOURCES = getcaps.c
libtask_la_SOURCES = task.c
librange_la_SOURCES = range.c
DISTCLEANFILES = \
boilerplate.c pads.c chain.c chain2.c state.c properties.c \
forwardcaps.c convertcaps.c getcaps.c task.c range.c \
init.func caps.func chain.func state.func register.func filter.h
EXTRA_DIST = extract.pl
EXAMPLES = \
libboilerplate.la \
libpads.la \
libchain.la \
libchain2.la \
libstate.la \
libproperties.la \
libforwardcaps.la \
libconvertcaps.la \
libgetcaps.la \
libtask.la \
librange.la
EXAMPLE_APPS = \
test
filter.h register.func: $(top_srcdir)/docs/pwg/building-boiler.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-boiler.xml
boilerplate.c: $(top_srcdir)/docs/pwg/building-boiler.xml filter.h register.func
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-boiler.xml
caps.func init.func: $(top_srcdir)/docs/pwg/building-pads.xml filter.h
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-pads.xml
pads.c: $(top_srcdir)/docs/pwg/building-pads.xml register.func caps.func init.func
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-pads.xml
chain.func: $(top_srcdir)/docs/pwg/building-chainfn.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-chainfn.xml
chain.c chain2.c: $(top_srcdir)/docs/pwg/building-chainfn.xml register.func caps.func init.func chain.func
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-chainfn.xml
state.func: $(top_srcdir)/docs/pwg/building-state.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-state.xml
state.c: $(top_srcdir)/docs/pwg/building-state.xml register.func caps.func init.func chain.func state.func
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-state.xml
properties.c: $(top_srcdir)/docs/pwg/building-props.xml filter.h register.func
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-props.xml
test.c: $(top_srcdir)/docs/pwg/building-testapp.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/building-testapp.xml
forwardcaps.c convertcaps.c getcaps.c: $(top_srcdir)/docs/pwg/advanced-negotiation.xml init.func register.func chain.func state.func
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/advanced-negotiation.xml
task.c range.c: $(top_srcdir)/docs/pwg/advanced-scheduling.xml register.func
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/pwg/advanced-scheduling.xml
noinst_PROGRAMS = $(EXAMPLE_APPS)
noinst_LTLIBRARIES = $(EXAMPLES)
LDADD = $(GST_OBJ_LIBS)

View file

@ -1,78 +0,0 @@
#!/usr/bin/perl
# extract code fragments from xml program listings
# first argument: source code file to find
# second argument: xml files to extract code from
# main
# decodes xml by translating &amp; &lt; &gt; back to what they should be
# and also ignore
# <![CDATA[ and ]]> and <!-- and -->
sub
xml_decode ($)
{
my $input = shift;
$input =~ s/\&amp;/&/g;
$input =~ s/&lt;/</g;
$input =~ s/&gt;/>/g;
if ($input =~ /<!\[CDATA\[/) { $input = ""; }
if ($input =~ /]]>/) { $input = ""; }
if ($input =~ /<!--/) { $input = ""; }
if ($input =~ /-->/) { $input = ""; }
#print "Returning line $input";
return $input;
}
# main
my $output = shift @ARGV;
$found = 0;
%blocks = ();
foreach $file (@ARGV)
{
open FILE, $file or die "Cannot open file $file";
while ($line = <FILE>)
{
if ($line =~ /<!-- example-begin $output (.*?)-->/)
{
$found = 1;
$block_id = $1;
$block = "\n/*** block $block_id from $file ***/\n";
print "Extracting $output block $block_id from $file\n";
while ($line = <FILE>)
{
if ($line =~ /<!-- example-end $output (.*?)-->/)
{
last;
}
$block .= xml_decode ($line);
}
$blocks{$block_id} = $block;
}
}
}
if (!$found)
{
print "Could not find $output example !\n";
exit(1);
}
# now output all the blocks in the right order
open OUTPUT, ">$output";
@block_ids = keys %blocks;
foreach $block_id (sort @block_ids)
{
print "Writing $output block $block_id\n";
print OUTPUT $blocks{$block_id};
}
close OUTPUT;

View file

@ -1,4 +0,0 @@
queue2
*.bb
*.bbg
*.da

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = queue2
queue2_LDADD = $(GST_OBJ_LIBS)
queue2_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,76 +0,0 @@
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing;
/* eos will be called when the src element has an end of stream */
void
eos (GstElement * element, gpointer data)
{
g_print ("have eos, quitting\n");
playing = FALSE;
}
int
main (int argc, char *argv[])
{
GstElement *filesrc, *audiosink, *queue;
GstElement *pipeline;
gst_init (&argc, &argv);
if (argc != 2) {
g_print ("usage: %s <filename>\n", argv[0]);
exit (-1);
}
/* create a new bin to hold the elements */
pipeline = gst_pipeline_new ("pipeline");
g_assert (pipeline != NULL);
/* create a disk reader */
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_assert (filesrc != NULL);
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread);
queue = gst_element_factory_make ("queue", "queue");
/* and an audio sink */
audiosink = gst_element_factory_make ("alsasink", "play_audio");
g_assert (audiosink != NULL);
/* add objects to the main pipeline */
/*
gst_pipeline_add_src(GST_PIPELINE(pipeline), filesrc);
gst_pipeline_add_sink(GST_PIPELINE(pipeline), queue);
gst_bin_add(GST_BIN (pipeline), audiosink);
gst_pad_link(gst_element_get_pad(queue,"src"),
gst_element_get_pad(audiosink,"sink"));
if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
g_print("cannot autoplug pipeline\n");
exit(-1);
}
*/
gst_bin_add (GST_BIN (pipeline), thread);
/* make it ready */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
/* start playing */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
playing = TRUE;
while (playing) {
gst_bin_iterate (GST_BIN (pipeline));
}
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
exit (0);
}

View file

@ -1,4 +0,0 @@
queue3
*.bb
*.bbg
*.da

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = queue3
queue3_LDADD = $(GST_OBJ_LIBS)
queue3_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,76 +0,0 @@
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing;
/* eos will be called when the src element has an end of stream */
void
eos (GstElement * element, gpointer data)
{
g_print ("have eos, quitting\n");
playing = FALSE;
}
int
main (int argc, char *argv[])
{
GstElement *filesrc, *osssink, *queue, *parse, *decode;
GstElement *bin;
GstElement *thread;
gst_init (&argc, &argv);
if (argc != 2) {
g_print ("usage: %s <filename>\n", argv[0]);
exit (-1);
}
/* create a new thread to hold the elements */
thread = gst_thread_new ("thread");
g_assert (thread != NULL);
/* create a new bin to hold the elements */
bin = gst_bin_new ("bin");
g_assert (bin != NULL);
/* create a disk reader */
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_assert (filesrc != NULL);
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread);
queue = gst_element_factory_make ("queue", "queue");
/* and an audio sink */
osssink = gst_element_factory_make ("osssink", "play_audio");
g_assert (osssink != NULL);
parse = gst_element_factory_make ("mp3parse", "parse");
decode = gst_element_factory_make ("mpg123", "decode");
/* add objects to the main bin */
gst_bin_add (GST_BIN (bin), filesrc);
gst_bin_add (GST_BIN (bin), queue);
gst_bin_add (GST_BIN (thread), parse);
gst_bin_add (GST_BIN (thread), decode);
gst_bin_add (GST_BIN (thread), osssink);
gst_element_link_many (filesrc, queue, parse, decode, osssink, NULL);
/* make it ready */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
/* start playing */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
playing = TRUE;
while (playing) {
gst_bin_iterate (GST_BIN (bin));
}
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
exit (0);
}

View file

@ -1,4 +0,0 @@
queue4
*.bb
*.bbg
*.da

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = queue4
queue4_LDADD = $(GST_OBJ_LIBS)
queue4_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,84 +0,0 @@
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing;
/* eos will be called when the src element has an end of stream */
void
eos (GstElement * element, gpointer data)
{
g_print ("have eos, quitting\n");
playing = FALSE;
}
int
main (int argc, char *argv[])
{
GstElement *filesrc, *osssink, *queue, *queue2, *parse, *decode;
GstElement *bin;
GstElement *thread, *thread2;
gst_init (&argc, &argv);
if (argc != 2) {
g_print ("usage: %s <filename>\n", argv[0]);
exit (-1);
}
/* create a new thread to hold the elements */
thread = gst_thread_new ("thread");
g_assert (thread != NULL);
thread2 = gst_thread_new ("thread2");
g_assert (thread2 != NULL);
/* create a new bin to hold the elements */
bin = gst_bin_new ("bin");
g_assert (bin != NULL);
/* create a disk reader */
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_assert (filesrc != NULL);
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread);
queue = gst_element_factory_make ("queue", "queue");
queue2 = gst_element_factory_make ("queue", "queue2");
/* and an audio sink */
osssink = gst_element_factory_make ("osssink", "play_audio");
g_assert (osssink != NULL);
parse = gst_element_factory_make ("mp3parse", "parse");
decode = gst_element_factory_make ("mpg123", "decode");
/* add objects to the main bin */
gst_bin_add (GST_BIN (bin), filesrc);
gst_bin_add (GST_BIN (bin), queue);
gst_bin_add (GST_BIN (thread), parse);
gst_bin_add (GST_BIN (thread), decode);
gst_bin_add (GST_BIN (thread), queue2);
gst_bin_add (GST_BIN (thread2), osssink);
gst_element_link_many (filesrc, queue, parse, decode, queue2, osssink, NULL);
gst_bin_add (GST_BIN (bin), thread);
gst_bin_add (GST_BIN (bin), thread2);
/* make it ready */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
/* start playing */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
playing = TRUE;
while (playing) {
gst_bin_iterate (GST_BIN (bin));
}
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
exit (0);
}

View file

@ -1,5 +0,0 @@
retag
transcode
*.bb
*.bbg
*.da

View file

@ -1,7 +0,0 @@
noinst_PROGRAMS = retag transcode
retag_LDADD = $(GST_OBJ_LIBS)
retag_CFLAGS = $(GST_OBJ_CFLAGS)
transcode_LDADD = $(GST_OBJ_LIBS)
transcode_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,103 +0,0 @@
/*
* This example shows how to use interfaces and the tag subsystem.
* It takes an mp3 file as input, and makes an ogg file out of it. While doing
* this, it parses the filename and sets artist and title in the ogg file.
* It assumes the filename to be "<artist> - <title>.mp3"
*
* Run the program as "retag <mp3 file>"
*
* To run this program, you need to have the gst-plugins package (specifically
* the vorbis and mad plugins) installed.
*/
/* main header */
#include <gst/gst.h>
/* and a header we need for the string manipulation */
#include <string.h>
int
main (int argc, char *argv[])
{
GstElement *bin, *filesrc, *tag_changer, *filesink;
gchar *artist, *title, *ext, *filename;
/* initialize GStreamer */
gst_init (&argc, &argv);
/* check that the argument is there */
if (argc != 2) {
g_print ("usage: %s <mp3 file>\n", argv[0]);
return 1;
}
/* parse the mp3 name */
artist = strrchr (argv[1], '/');
if (artist == NULL)
artist = argv[1];
artist = g_strdup (artist);
ext = strrchr (artist, '.');
if (ext)
*ext = '\0';
title = strstr (artist, " - ");
if (title == NULL) {
g_print ("The format of the mp3 file is invalid.\n");
return 1;
}
*title = '\0';
title += 3;
/* create a new bin to hold the elements */
bin = gst_pipeline_new ("pipeline");
g_assert (bin);
/* create a file reader */
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_assert (filesrc);
/* now it's time to get the tag_changer */
tag_changer = gst_element_factory_make ("id3tag", "tag_changer");
if (!tag_changer) {
g_print ("could not find plugin \"mad\"");
return 1;
}
/* and a file writer */
filesink = gst_element_factory_make ("filesink", "filesink");
g_assert (filesink);
/* set the filenames */
filename = g_strdup_printf ("%s.temp", argv[1]); /* easy solution */
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
g_object_set (G_OBJECT (filesink), "location", filename, NULL);
/* make sure the tag setter uses our stuff
(though that should already be default) */
gst_tag_setter_set_merge_mode (GST_TAG_SETTER (tag_changer),
GST_TAG_MERGE_KEEP);
/* set the tagging information */
gst_tag_setter_add (GST_TAG_SETTER (tag_changer), GST_TAG_MERGE_REPLACE,
GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL);
/* add objects to the main pipeline */
gst_bin_add_many (GST_BIN (bin), filesrc, tag_changer, filesink, NULL);
/* link the elements */
if (!gst_element_link_many (filesrc, tag_changer, filesink, NULL))
g_assert_not_reached ();
/* start playing */
gst_element_set_state (bin, GST_STATE_PLAYING);
while (gst_bin_iterate (GST_BIN (bin)));
/* stop the bin */
gst_element_set_state (bin, GST_STATE_NULL);
/* rename the file to the correct name and remove the old one */
remove (argv[1]);
rename (filename, argv[1]);
g_free (filename);
return 0;
}

View file

@ -1,105 +0,0 @@
/*
* This example shows how to use interfaces and the tag subsystem.
* It takes an mp3 file as input, and makes an ogg file out of it. While doing
* this, it parses the filename and sets artist and title in the ogg file.
* It assumes the filename to be "<artist> - <title>.mp3"
*
* Run the program as "transcode <mp3 file>"
*
* To run this program, you need to have the gst-plugins package (specifically
* the vorbis and mad plugins) installed.
*/
/* main header */
#include <gst/gst.h>
/* and a header we need for the string manipulation */
#include <string.h>
int
main (int argc, char *argv[])
{
GstElement *bin, *filesrc, *decoder, *encoder, *filesink;
gchar *artist, *title, *ext, *filename;
/* initialize GStreamer */
gst_init (&argc, &argv);
/* check that the argument is there */
if (argc != 2) {
g_print ("usage: %s <mp3 file>\n", argv[0]);
return 1;
}
/* parse the mp3 name */
artist = strrchr (argv[1], '/');
if (artist == NULL)
artist = argv[1];
artist = g_strdup (artist);
ext = strrchr (artist, '.');
if (ext)
*ext = '\0';
title = strstr (artist, " - ");
if (title == NULL) {
g_print ("The format of the mp3 file is invalid.\n");
g_print ("It needs to be in the form of artist - title.mp3.\n");
return 1;
}
*title = '\0';
title += 3;
/* create a new bin to hold the elements */
bin = gst_pipeline_new ("pipeline");
g_assert (bin);
/* create a file reader */
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_assert (filesrc);
/* now it's time to get the decoder */
decoder = gst_element_factory_make ("mad", "decode");
if (!decoder) {
g_print ("could not find plugin \"mad\"");
return 1;
}
/* create the encoder */
encoder = gst_element_factory_make ("vorbisenc", "encoder");
if (!encoder) {
g_print ("cound not find plugin \"vorbisenc\"");
return 1;
}
/* and a file writer */
filesink = gst_element_factory_make ("filesink", "filesink");
g_assert (filesink);
/* set the filenames */
filename = g_strdup_printf ("%s.ogg", argv[1]); /* easy solution */
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
g_object_set (G_OBJECT (filesink), "location", filename, NULL);
g_free (filename);
/* make sure the tag setter uses our stuff
(though that should already be default) */
gst_tag_setter_set_merge_mode (GST_TAG_SETTER (encoder), GST_TAG_MERGE_KEEP);
/* set the tagging information */
gst_tag_setter_add (GST_TAG_SETTER (encoder), GST_TAG_MERGE_REPLACE,
GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL);
/* add objects to the main pipeline */
gst_bin_add_many (GST_BIN (bin), filesrc, decoder, encoder, filesink, NULL);
/* link the elements */
gst_element_link_many (filesrc, decoder, encoder, filesink, NULL);
/* start playing */
gst_element_set_state (bin, GST_STATE_PLAYING);
while (gst_bin_iterate (GST_BIN (bin)));
/* stop the bin */
gst_element_set_state (bin, GST_STATE_NULL);
return 0;
}

View file

@ -1,4 +0,0 @@
thread
*.bb
*.bbg
*.da

View file

@ -1,5 +0,0 @@
noinst_PROGRAMS = thread
thread_LDADD = $(GST_OBJ_LIBS)
thread_CFLAGS = $(GST_OBJ_CFLAGS)

View file

@ -1,79 +0,0 @@
#include <stdlib.h>
#include <gst/gst.h>
static GMainLoop *loop;
/* eos will be called when the src element has an end of stream */
void
eos (GstElement * element, gpointer data)
{
GstThread *thread = GST_THREAD (data);
g_print ("have eos, quitting\n");
/* stop the bin */
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_NULL);
g_main_loop_quit (loop);
g_main_loop_unref (loop);
}
int
main (int argc, char *argv[])
{
GstElement *filesrc, *osssink;
GstElement *pipeline;
GstElement *thread;
gst_init (&argc, &argv);
if (argc != 2) {
g_print ("usage: %s <filename>\n", argv[0]);
exit (-1);
}
/* create a new thread to hold the elements */
thread = gst_thread_new ("thread");
g_assert (thread != NULL);
/* create a new bin to hold the elements */
pipeline = gst_pipeline_new ("pipeline");
g_assert (pipeline != NULL);
/* create a disk reader */
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_assert (filesrc != NULL);
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread);
/* and an audio sink */
osssink = gst_element_factory_make ("osssink", "play_audio");
g_assert (osssink != NULL);
/* add objects to the main pipeline */
/*
gst_pipeline_add_src(GST_PIPELINE(pipeline), filesrc);
gst_pipeline_add_sink(GST_PIPELINE(pipeline), osssink);
if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
g_print("unable to handle stream\n");
exit(-1);
}
*/
/*gst_bin_remove(GST_BIN(pipeline), filesrc); */
/*gst_bin_add(GST_BIN(thread), filesrc); */
gst_bin_add (GST_BIN (thread), GST_ELEMENT (pipeline));
/* make it ready */
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_READY);
/* start playing */
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
loop = g_main_loop_new (NULL, FALSE);
gst_object_unref (thread);
exit (0);
}

View file

@ -1,14 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
test-registry.xml
elementstest-registry.xml
threadstest-registry.xml
*.bb
*.bbg
*.da
test_gst_init

View file

@ -1,38 +0,0 @@
include Rules
if GST_DISABLE_PARSE
GST_PARSE_DIRS =
else
GST_PARSE_DIRS = parse
endif
if GST_DISABLE_GST_DEBUG
GST_DEBUG_DIRS =
else
GST_DEBUG_DIRS = debug
endif
SUBDIRS = \
caps \
$(GST_DEBUG_DIRS) \
dlopen \
elements indexers \
$(GST_PARSE_DIRS) \
plugin refcounting states threads
DIST_SUBDIRS = \
caps \
debug \
dlopen \
elements indexers \
parse \
plugin refcounting states threads
tests_pass =
tests_fail =
tests_ignore =
# we makes them, we gots to clean them
CLEANFILES += test-registry.xml

View file

@ -1,33 +0,0 @@
TESTS_ENVIRONMENT=\
G_DEBUG=fatal_warnings \
GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/testsuite \
GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
check_PROGRAMS = $(tests_pass) $(tests_fail) $(tests_ignore)
# make all tests depend on the versioned gst-register
$(tests_pass) $(tests_fail): $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@
# rebuild gst-register-@GST_MAJORMINOR@ if needed
# the EXEEXT is because am 1.6 complained about overrides
$(top_builddir)/tools/gst-register-@GST_MAJORMINOR@$(EXEEXT):
cd $(top_builddir)/tools && make
TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(tests_pass) $(tests_fail)
XFAIL_TESTS = $(tests_fail)
AM_CFLAGS = $(GST_OBJ_CFLAGS)
LIBS = $(GST_OBJ_LIBS)
# override to _not_ install the test plugins
install-pluginLTLIBRARIES:
# This rule is here so make distcheck works on machines where core
# dumps have PIDs appended
CLEANFILES = core.*

View file

@ -1,36 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
*.bb
*.bbg
*.da
.deps
.libs
app_fixate
audioscale
caps
compatibility
deserialize
enumcaps
eratosthenes
filtercaps
fixed
fraction-convert
fraction-multiply-and-zero
intersect2
intersection
normalisation
random
renegotiate
union
simplify
sets
string-conversions
structure
subtract
value_compare
value_intersect
value_serialize

View file

@ -1,33 +0,0 @@
include ../Rules
tests_pass = \
app_fixate \
enumcaps \
intersection \
compatibility \
deserialize \
normalisation \
union \
string-conversions \
fixed \
fraction-convert \
fraction-multiply-and-zero \
intersect2 \
caps \
audioscale \
filtercaps \
eratosthenes \
renegotiate \
subtract \
sets \
simplify \
random \
structure
EXTRA_DIST = caps_strings
noinst_HEADERS = \
caps.h
tests_fail =
tests_ignore =

View file

@ -1,51 +0,0 @@
#include <gst/gst.h>
static GstCaps *
handler (GObject * object, GstCaps * caps, gpointer user_data)
{
g_print ("in handler %p, %p, %p\n", object, caps, user_data);
g_assert (GST_IS_PAD (object));
g_print ("caps: %s\n", gst_caps_to_string (caps));
if (gst_caps_is_any (caps)) {
return gst_caps_new_simple ("application/x-foo",
"field", GST_TYPE_INT_RANGE, 1, 10, NULL);
}
return NULL;
}
int
main (int argc, char *argv[])
{
GstElement *a;
GstElement *b;
GstElement *pipeline;
GstPad *pad;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new (NULL);
a = gst_element_factory_make ("fakesrc", NULL);
g_assert (a);
b = gst_element_factory_make ("fakesink", NULL);
g_assert (b);
gst_bin_add_many (GST_BIN (pipeline), a, b, NULL);
gst_element_link (a, b);
pad = gst_element_get_pad (a, "src");
g_signal_connect (G_OBJECT (pad), "fixate", G_CALLBACK (handler),
(void *) 0xdeadbeef);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
return 0;
}

View file

@ -1,174 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Element-Checklist-Version: 5 */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <math.h>
#include <gst/gst.h>
static void
gst_audioscale_expand_value (GValue * dest, const GValue * src)
{
int rate_min, rate_max;
if (G_VALUE_TYPE (src) == G_TYPE_INT ||
G_VALUE_TYPE (src) == GST_TYPE_INT_RANGE) {
if (G_VALUE_TYPE (src) == G_TYPE_INT) {
rate_min = g_value_get_int (src);
rate_max = rate_min;
} else {
rate_min = gst_value_get_int_range_min (src);
rate_max = gst_value_get_int_range_max (src);
}
rate_min /= 2;
if (rate_min < 1)
rate_min = 1;
if (rate_max < G_MAXINT / 2) {
rate_max *= 2;
} else {
rate_max = G_MAXINT;
}
g_value_init (dest, GST_TYPE_INT_RANGE);
gst_value_set_int_range (dest, rate_min, rate_max);
return;
}
if (G_VALUE_TYPE (src) == GST_TYPE_LIST) {
int i;
g_value_init (dest, GST_TYPE_LIST);
for (i = 0; i < gst_value_list_get_size (src); i++) {
const GValue *s = gst_value_list_get_value (src, i);
GValue d = { 0 };
int j;
gst_audioscale_expand_value (&d, s);
for (j = 0; j < gst_value_list_get_size (dest); j++) {
const GValue *s2 = gst_value_list_get_value (dest, j);
GValue d2 = { 0 };
gst_value_union (&d2, &d, s2);
if (G_VALUE_TYPE (&d2) == GST_TYPE_INT_RANGE) {
g_value_unset ((GValue *) s2);
gst_value_init_and_copy ((GValue *) s2, &d2);
break;
}
g_value_unset (&d2);
}
if (j == gst_value_list_get_size (dest)) {
gst_value_list_append_value (dest, &d);
}
g_value_unset (&d);
}
if (gst_value_list_get_size (dest) == 1) {
const GValue *s = gst_value_list_get_value (dest, 0);
GValue d = { 0 };
gst_value_init_and_copy (&d, s);
g_value_unset (dest);
gst_value_init_and_copy (dest, &d);
g_value_unset (&d);
}
return;
}
GST_ERROR ("unexpected value type");
}
static GstCaps *
gst_audioscale_getcaps (const GstCaps * othercaps)
{
GstCaps *caps;
int i;
caps = gst_caps_copy (othercaps);
/* we do this hack, because the audioscale lib doesn't handle
* rate conversions larger than a factor of 2 */
for (i = 0; i < gst_caps_get_size (caps); i++) {
GstStructure *structure = gst_caps_get_structure (caps, i);
const GValue *value;
GValue dest = { 0 };
value = gst_structure_get_value (structure, "rate");
if (value == NULL) {
GST_ERROR ("caps structure doesn't have required rate field");
return NULL;
}
gst_audioscale_expand_value (&dest, value);
gst_structure_set_value (structure, "rate", &dest);
}
return caps;
}
void
test_caps (const char *s)
{
GstCaps *caps;
GstCaps *caps2;
char *s2;
caps = gst_caps_from_string (s);
caps2 = gst_audioscale_getcaps (caps);
s2 = gst_caps_to_string (caps2);
g_print ("original: %s\nfiltered: %s\n\n", s, s2);
g_free (s2);
gst_caps_unref (caps);
gst_caps_unref (caps2);
}
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
test_caps ("audio/x-raw-int, rate=(int)1");
test_caps ("audio/x-raw-int, rate=(int)10");
test_caps ("audio/x-raw-int, rate=(int)100");
test_caps ("audio/x-raw-int, rate=(int)10000");
test_caps ("audio/x-raw-int, rate=(int)2000000000");
test_caps ("audio/x-raw-int, rate=(int)[1,100]");
test_caps ("audio/x-raw-int, rate=(int)[1000,40000]");
test_caps ("audio/x-raw-int, rate=(int){1,100}");
test_caps ("audio/x-raw-int, rate=(int){100,200,300}");
test_caps ("audio/x-raw-int, rate=(int){[100,200],1000}");
return 0;
}

View file

@ -1,159 +0,0 @@
#include <gst/gst.h>
void
test1 (void)
{
GstCaps *caps;
GstCaps *caps2;
g_print ("type is %d\n", (int) gst_caps_get_type ());
caps = gst_caps_new_empty ();
g_assert (caps != NULL);
gst_caps_unref (caps);
caps = gst_caps_new_any ();
g_assert (caps != NULL);
gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
g_assert (caps != NULL);
g_assert (gst_caps_is_empty (caps) == FALSE);
g_assert (gst_caps_is_any (caps) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
g_assert (gst_caps_is_fixed (caps) == TRUE);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/raw",
"_double", G_TYPE_DOUBLE, 100.0, NULL);
g_assert (caps != NULL);
g_assert (gst_caps_is_empty (caps) == FALSE);
g_assert (gst_caps_is_any (caps) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
g_assert (gst_caps_is_fixed (caps) == TRUE);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/raw",
"_fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('a', 'b', 'c', 'd'), NULL);
g_assert (caps != NULL);
g_assert (gst_caps_is_empty (caps) == FALSE);
g_assert (gst_caps_is_any (caps) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
g_assert (gst_caps_is_fixed (caps) == TRUE);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/raw",
"_boolean", G_TYPE_BOOLEAN, TRUE, NULL);
g_assert (caps != NULL);
g_assert (gst_caps_is_empty (caps) == FALSE);
g_assert (gst_caps_is_any (caps) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
g_assert (gst_caps_is_fixed (caps) == TRUE);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
caps =
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
100, NULL), gst_structure_new ("audio/raw2", "_int", G_TYPE_INT, 100,
NULL), NULL);
g_assert (caps != NULL);
g_assert (gst_caps_is_empty (caps) == FALSE);
g_assert (gst_caps_is_any (caps) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
g_assert (gst_caps_is_fixed (caps) == FALSE);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
g_assert (caps != NULL);
caps2 = gst_caps_copy (caps);
g_assert (caps2 != NULL);
g_assert (gst_caps_is_empty (caps2) == FALSE);
g_assert (gst_caps_is_any (caps2) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps2) == TRUE);
g_assert (gst_caps_is_fixed (caps2) == TRUE);
g_print ("%s\n", gst_caps_to_string (caps));
g_print ("%s\n", gst_caps_to_string (caps2));
gst_caps_unref (caps);
gst_caps_unref (caps2);
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
gst_caps_append (caps,
gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 200, NULL));
g_assert (caps != NULL);
g_assert (gst_caps_is_empty (caps) == FALSE);
g_assert (gst_caps_is_any (caps) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
g_assert (gst_caps_is_fixed (caps) == FALSE);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
g_assert (caps != NULL);
gst_caps_append_structure (caps,
gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 200, NULL));
g_assert (gst_caps_is_empty (caps) == FALSE);
g_assert (gst_caps_is_any (caps) == FALSE);
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
g_assert (gst_caps_is_fixed (caps) == FALSE);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
}
void
test2 (void)
{
GstCaps *caps1;
GstCaps *caps2;
GstCaps *caps;
caps1 =
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
100, NULL), gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 200,
NULL), NULL);
caps2 =
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
100, NULL), gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 300,
NULL), NULL);
caps = gst_caps_intersect (caps1, caps2);
g_print ("%s\n", gst_caps_to_string (caps));
gst_caps_unref (caps);
gst_caps_unref (caps1);
gst_caps_unref (caps2);
}
void
test3 (void)
{
GstCaps *caps1;
GstCaps *caps2;
caps1 = gst_caps_new_any ();
caps2 = gst_caps_new_simple ("audio/raw", NULL);
gst_caps_append (caps1, caps2);
g_print ("%s\n", gst_caps_to_string (caps1));
g_assert (gst_caps_is_any (caps1));
g_assert (gst_caps_get_size (caps1) == 0);
gst_caps_unref (caps1);
}
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
test1 ();
test2 ();
test3 ();
return 0;
}

View file

@ -1,18 +0,0 @@
#include <glib.h>
/* defines an array of strings named caps_list, that contains a list of caps for
general tests. So if you don't know what caps to use to write a test, just
include this file */
static const gchar *caps_list[] = {
"audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)g726; audio/x-adpcm, layout=(string)g726",
"video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)I420; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUY2; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y42B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUV9; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y41B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234",
"video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]",
"video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]",
"video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]",
"video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]",
"video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]",
"ANY",
"EMPTY"
};

File diff suppressed because one or more lines are too long

View file

@ -1,93 +0,0 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int)[1,2]");
GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int)1");
GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){YV12,YUY2}, "
"width=(int)[16,4096], " "height=(int)[16,4096]");
GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc)YUY2, " "height=(int)[16,256]");
GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){YV12,YUY2}, " "height=(int)[16,4096]");
#if 0
/* these caps aren't used yet */
GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YV12\", \"YUYV\"}, " "height=(int)[16,4096]");
GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YUYV\", \"YUY2\"}, " "height=(int)[16,4096]");
#endif
GstStaticCaps rawcaps6 = GST_STATIC_CAPS ("video/raw, "
"format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YUYV\"");
GstStaticCaps rawcaps7 = GST_STATIC_CAPS ("video/raw, "
"format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YV12\"");
int
main (int argc, char *argv[])
{
gboolean testret;
gint ret = 0;
gst_init (&argc, &argv);
testret = gst_caps_is_always_compatible (gst_static_caps_get (&mp1parsecaps),
gst_static_caps_get (&rawcaps));
g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&mp1parsecaps),
gst_static_caps_get (&sinkcaps));
g_print ("4 <-> 1 == %d (valid, subset)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&sinkcaps),
gst_static_caps_get (&mp1parsecaps));
g_print ("1 <-> 4 == %d (invalid, superset)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps),
gst_static_caps_get (&rawcaps2));
g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps),
gst_static_caps_get (&rawcaps3));
g_print ("2 <-> 5 == %d (valid)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps3),
gst_static_caps_get (&rawcaps));
g_print ("5 <-> 2 == %d (invalid)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps2),
gst_static_caps_get (&rawcaps3));
g_print ("3 <-> 5 == %d (valid)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps2),
gst_static_caps_get (&rawcaps));
g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps),
gst_static_caps_get (&rawcaps));
g_print ("2 <-> 2 == %d (valid, same caps)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps6),
gst_static_caps_get (&rawcaps7));
g_print ("6 <-> 7 == %d (invalid, second caps doesn't fit)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
return ret;
}

View file

@ -1,85 +0,0 @@
#include <gst/gst.h>
#include <string.h>
/* The caps_strings file is created using:
*
* grep '^.caps' /home/ds/.gstreamer-0.8/registry.xml | \
* sed 's/^.caps.\(.*\)..caps.$/\1/' | awk '{print length($ln) " " $ln; }' | \
* sort -n | uniq | sed 's/^[^ ]* //' >caps_strings
*
*/
int
main (int argc, char *argv[])
{
char *filename;
char *data;
char **list;
int i;
guint length;
GstCaps *caps;
gst_init (&argc, &argv);
if (argc > 1) {
filename = g_strdup (argv[1]);
} else {
const char *srcdir = g_getenv ("srcdir");
if (srcdir) {
filename = g_build_filename (srcdir, "caps_strings", NULL);
} else {
filename = g_strdup ("caps_strings");
}
}
if (!g_file_get_contents (filename, &data, &length, NULL)) {
g_print ("could not open file %s\n", filename);
abort ();
}
list = g_strsplit (data, "\n", 0);
for (i = 0; list[i] != NULL; i++) {
if (list[i][0] == 0) {
g_free (list[i]);
continue;
}
caps = gst_caps_from_string (list[i]);
if (caps == NULL) {
char **list2;
int j;
g_print ("Could not parse: %s\n", list[i]);
g_print ("Trying each structure...\n");
list2 = g_strsplit (list[i], ";", 0);
for (j = 0; list2[j] != NULL; j++) {
caps = gst_caps_from_string (list2[j]);
if (caps == NULL) {
g_print ("Could not parse %s\n", list2[j]);
abort ();
}
gst_caps_unref (caps);
}
g_print ("parsed each structure individually\n");
abort ();
}
gst_caps_unref (caps);
g_free (list[i]);
}
g_free (list);
g_free (data);
g_free (filename);
return 0;
}

View file

@ -1,95 +0,0 @@
/* GStreamer test
* (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gst/gst.h>
typedef enum
{
TEST_YES,
TEST_NO
}
TestBool;
#define TEST_BOOL_TYPE (test_bool_get_type ())
GType
test_bool_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
{TEST_YES, "TEST_YES", "yes"},
{TEST_NO, "TEST_NO", "no"},
{0, NULL, NULL}
};
etype = g_enum_register_static ("TestBool", values);
}
return etype;
}
gint
main (gint argc, gchar * argv[])
{
gchar *str;
GstCaps *caps, *res_caps;
GstStructure *strc;
GValue value = { 0 };
TestBool yes, no;
/* register multichannel type */
gst_init (&argc, &argv);
test_bool_get_type ();
/* test some caps */
caps = gst_caps_new_simple ("application/x-gst-test", NULL);
str = gst_caps_to_string (caps);
g_assert (str);
g_free (str);
/* set enums in list */
strc = gst_caps_get_structure (caps, 0);
g_value_init (&value, TEST_BOOL_TYPE);
g_value_set_enum (&value, TEST_YES);
gst_structure_set_value (strc, "yes", &value);
g_value_set_enum (&value, TEST_NO);
gst_structure_set_value (strc, "no", &value);
g_value_unset (&value);
/* test to-/from-string conversions for enums */
str = gst_caps_to_string (caps);
g_assert (str);
res_caps = gst_caps_from_string (str);
g_free (str);
/* see if all worked */
strc = gst_caps_get_structure (res_caps, 0);
yes = g_value_get_enum (gst_structure_get_value (strc, "yes"));
no = g_value_get_enum (gst_structure_get_value (strc, "no"));
g_assert (yes == TEST_YES && no == TEST_NO);
gst_caps_unref (caps);
gst_caps_unref (res_caps);
/* yes */
return 0;
}

View file

@ -1,71 +0,0 @@
/*
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
#include <stdlib.h>
#define MAX_SIEVE 20
static void
eratosthenes (GValue * sieve, gboolean up, int size)
{
guint i, j;
GValue temp = { 0, };
GValue list = { 0, };
g_value_init (sieve, GST_TYPE_INT_RANGE);
gst_value_set_int_range (sieve, 2, size * size);
for (i = up ? 2 : size; up ? (i <= size) : (i >= 2); i += up ? 1 : -1) {
g_value_init (&list, GST_TYPE_LIST);
for (j = 2 * i; j <= size * size; j += i) {
GValue v = { 0, };
g_value_init (&v, G_TYPE_INT);
g_value_set_int (&v, j);
gst_value_list_append_value (&list, &v);
g_value_unset (&v);
}
gst_value_subtract (&temp, sieve, &list);
g_value_unset (sieve);
gst_value_init_and_copy (sieve, &temp);
g_value_unset (&temp);
g_value_unset (&list);
/* g_print ("%2u: %s\n", i, gst_value_serialize (sieve)); */
}
g_print ("%s\n", gst_value_serialize (sieve));
}
gint
main (gint argc, gchar ** argv)
{
GValue up = { 0, };
GValue down = { 0, };
guint size = MAX_SIEVE;
gst_init (&argc, &argv);
if (argc > 1)
size = atol (argv[1]);
eratosthenes (&up, TRUE, size);
eratosthenes (&down, FALSE, size);
g_assert (gst_value_compare (&up, &down) == GST_VALUE_EQUAL);
return 0;
}

View file

@ -1,49 +0,0 @@
/*
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
gint
main (gint argc, gchar ** argv)
{
GstCaps *caps;
GstElement *sink, *identity;
GstElement *pipeline;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("pipeline");
g_assert (pipeline);
identity = gst_element_factory_make ("identity", NULL);
g_assert (identity);
sink = gst_element_factory_make ("fakesink", NULL);
g_assert (sink);
gst_bin_add_many (GST_BIN (pipeline), identity, sink, NULL);
gst_element_link_filtered (identity, sink,
gst_caps_new_simple ("audio/x-raw-int", NULL));
caps = gst_pad_get_caps (gst_element_get_pad (identity, "sink"));
g_print ("caps: %s\n", gst_caps_to_string (caps));
g_assert (!gst_caps_is_any (caps));
caps = gst_pad_get_allowed_caps (gst_element_get_pad (identity, "sink"));
g_print ("allowed caps: %s\n", gst_caps_to_string (caps));
/* get_allowed_caps doesn't mean anything if you aren't connected */
g_assert (!caps);
return 0;
}

View file

@ -1,82 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
gint
main (gint argc, gchar * argv[])
{
#if 0
GstCaps *caps;
gst_init (&argc, &argv);
caps = GST_CAPS_NEW ("testcaps", "unknown/unknown", NULL);
/* newly crrated caps without props is fixed */
g_assert (GST_CAPS_IS_FIXED (caps));
entry = gst_props_entry_new ("foo", GST_PROPS_INT (5));
/* this entry is fixed */
g_assert (gst_props_entry_is_fixed (entry));
props = gst_props_empty_new ();
/* props are fixed when created */
g_assert (GST_PROPS_IS_FIXED (props));
gst_props_add_entry (props, entry);
/* props should still be fixed */
g_assert (GST_PROPS_IS_FIXED (props));
gst_caps_set_props (caps, props);
/* caps should still be fixed */
g_assert (GST_CAPS_IS_FIXED (caps));
entry = gst_props_entry_new ("bar", GST_PROPS_INT_RANGE (1, 5));
/* this entry is variable */
g_assert (!gst_props_entry_is_fixed (entry));
gst_props_add_entry (props, entry);
/* props should be variable now */
g_assert (!GST_PROPS_IS_FIXED (props));
/* caps too */
g_assert (!GST_CAPS_IS_FIXED (caps));
gst_props_remove_entry_by_name (props, "bar");
/* props should be fixed again now */
g_assert (GST_PROPS_IS_FIXED (props));
/* caps too */
g_assert (GST_CAPS_IS_FIXED (caps));
gst_props_set (props, "foo", GST_PROPS_INT_RANGE (1, 5));
/* props should be variable again now */
g_assert (!GST_PROPS_IS_FIXED (props));
/* caps too */
g_assert (!GST_CAPS_IS_FIXED (caps));
gst_props_set (props, "foo", GST_PROPS_INT (5));
/* props should be fixed again now */
g_assert (GST_PROPS_IS_FIXED (props));
/* caps too */
g_assert (GST_CAPS_IS_FIXED (caps));
#endif
return 0;
}

View file

@ -1,139 +0,0 @@
/* GStreamer
*
* fraction-convert.c: test for GstFraction transform
*
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <math.h>
#include <gst/gst.h>
#include <glib.h>
static void
check_from_double_convert (gdouble value, gint num, gint denom, gdouble prec)
{
GValue value1 = { 0 };
GValue value2 = { 0 };
gdouble check;
gint res_num, res_denom;
g_value_init (&value1, G_TYPE_DOUBLE);
g_value_init (&value2, GST_TYPE_FRACTION);
g_value_set_double (&value1, value);
g_value_transform (&value1, &value2);
g_print ("%s = %s ? (expected: %d/%d )\n",
gst_value_serialize (&value1), gst_value_serialize (&value2), num, denom);
res_num = gst_value_get_fraction_numerator (&value2);
res_denom = gst_value_get_fraction_denominator (&value2);
if (res_num == num && res_denom == denom) {
g_print ("best conversion.\n");
} else {
if (fabs (value - res_num / (gdouble) res_denom) <= prec) {
g_print ("acceptable suboptimal conversion.\n");
} else {
g_print ("unacceptable suboptimal conversion.\n");
g_assert_not_reached ();
}
}
g_value_transform (&value2, &value1);
g_print ("%s = %s\n",
gst_value_serialize (&value2), gst_value_serialize (&value1));
check = g_value_get_double (&value1);
g_assert (fabs (value - check) <= prec);
}
static void
check_from_fraction_convert (gint num, gint denom, gdouble prec)
{
GValue value1 = { 0 };
GValue value2 = { 0 };
gdouble value;
gint res_num, res_denom;
g_value_init (&value1, GST_TYPE_FRACTION);
g_value_init (&value2, G_TYPE_DOUBLE);
gst_value_set_fraction (&value1, num, denom);
g_value_transform (&value1, &value2);
value = g_value_get_double (&value2);
g_assert (fabs (value - ((gdouble) num) / denom) < prec);
g_print ("%s = %s, %2.50lf as double\n",
gst_value_serialize (&value1), gst_value_serialize (&value2), value);
g_value_transform (&value2, &value1);
g_print ("%s = %s ? (expected: %d/%d )\n",
gst_value_serialize (&value2), gst_value_serialize (&value1), num, denom);
value = g_value_get_double (&value2);
res_num = gst_value_get_fraction_numerator (&value1);
res_denom = gst_value_get_fraction_denominator (&value1);
if (res_num == num && res_denom == denom) {
g_print ("best conversion.\n");
} else {
if (fabs (value - res_num / (gdouble) res_denom) <= prec) {
g_print ("acceptable suboptimal conversion.\n");
} else {
g_print ("unacceptable suboptimal conversion.\n");
g_assert_not_reached ();
}
}
g_value_unset (&value2);
g_value_unset (&value1);
}
static void
transform_test (void)
{
check_from_fraction_convert (30000, 1001, 1.0e-9);
check_from_fraction_convert (1, G_MAXINT, 1.0e-9);
check_from_fraction_convert (G_MAXINT, 1, 1.0e-9);
check_from_double_convert (0.0, 0, 1, 1.0e-9);
check_from_double_convert (1.0, 1, 1, 1.0e-9);
check_from_double_convert (-1.0, -1, 1, 1.0e-9);
check_from_double_convert (M_PI, 1881244168, 598818617, 1.0e-9);
check_from_double_convert (-M_PI, -1881244168, 598818617, 1.0e-9);
check_from_double_convert (G_MAXDOUBLE, G_MAXINT, 1, G_MAXDOUBLE);
check_from_double_convert (G_MINDOUBLE, 0, 1, G_MAXDOUBLE);
check_from_double_convert (-G_MAXDOUBLE, -G_MAXINT, 1, G_MAXDOUBLE);
check_from_double_convert (-G_MINDOUBLE, 0, 1, G_MAXDOUBLE);
check_from_double_convert (((gdouble) G_MAXINT) + 1, G_MAXINT, 1,
G_MAXDOUBLE);
check_from_double_convert (((gdouble) G_MININT) - 1, G_MININT + 1, 1,
G_MAXDOUBLE);
check_from_double_convert (G_MAXINT - 1, G_MAXINT - 1, 1, 0);
check_from_double_convert (G_MININT + 1, G_MININT + 1, 1, 0);
}
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
transform_test ();
return 0;
}

View file

@ -1,131 +0,0 @@
/* GStreamer
*
* fraction.c: test for all GstFraction operations
*
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
#include <glib.h>
static void
check_multiplication (int num1, int den1, int num2, int den2, int num_result,
int den_result)
{
GValue value1 = { 0 };
GValue value2 = { 0 };
GValue value3 = { 0 };
g_value_init (&value1, GST_TYPE_FRACTION);
g_value_init (&value2, GST_TYPE_FRACTION);
g_value_init (&value3, GST_TYPE_FRACTION);
gst_value_set_fraction (&value1, num1, den1);
gst_value_set_fraction (&value2, num2, den2);
g_print ("%d/%d * %d/%d = ", num1, den1, num2, den2);
gst_value_fraction_multiply (&value3, &value1, &value2);
g_print ("%d/%d (should be %d/%d)\n",
gst_value_get_fraction_numerator (&value3),
gst_value_get_fraction_denominator (&value3), num_result, den_result);
g_assert (gst_value_get_fraction_numerator (&value3) == num_result);
g_assert (gst_value_get_fraction_denominator (&value3) == den_result);
g_value_unset (&value1);
g_value_unset (&value2);
g_value_unset (&value3);
}
static void
check_equal (int num1, int den1, int num2, int den2)
{
GValue value1 = { 0 };
GValue value2 = { 0 };
g_value_init (&value1, GST_TYPE_FRACTION);
g_value_init (&value2, GST_TYPE_FRACTION);
gst_value_set_fraction (&value1, num1, den1);
gst_value_set_fraction (&value2, num2, den2);
g_print ("%d/%d == %d/%d ? ", num1, den1, num2, den2);
g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL);
g_print ("yes\n");
g_value_unset (&value1);
g_value_unset (&value2);
}
static void
zero_test (void)
{
GValue value1 = { 0 };
g_value_init (&value1, GST_TYPE_FRACTION);
/* fractions are initialized at 0 */
g_assert (gst_value_get_fraction_numerator (&value1) == 0);
g_assert (gst_value_get_fraction_denominator (&value1) == 1);
/* every zero value is set to 0/1 */
gst_value_set_fraction (&value1, 0, 235);
g_assert (gst_value_get_fraction_numerator (&value1) == 0);
g_assert (gst_value_get_fraction_denominator (&value1) == 1);
gst_value_set_fraction (&value1, 0, -G_MAXINT);
g_assert (gst_value_get_fraction_numerator (&value1) == 0);
g_assert (gst_value_get_fraction_denominator (&value1) == 1);
g_value_unset (&value1);
}
int
main (int argc, char *argv[])
{
GValue value1 = { 0 };
GValue value2 = { 0 };
GValue value3 = { 0 };
gst_init (&argc, &argv);
g_value_init (&value1, GST_TYPE_FRACTION);
g_value_init (&value2, GST_TYPE_FRACTION);
g_value_init (&value3, GST_TYPE_FRACTION);
/*** zeroes ***/
/* basic zero tests */
zero_test ();
/* check all zeroes are zeroes */
check_equal (0, 1, 0, 12345);
check_equal (0, 1, 0, -1);
/* check multiplying with zeroes results in zeroes */
check_multiplication (0, 1, 17, 18, 0, 1);
check_multiplication (0, -13, -G_MAXINT, 2736, 0, 1);
/*** large numbers ***/
/* check multiplying large numbers works */
check_multiplication (G_MAXINT, 1, G_MAXINT - 1, G_MAXINT, G_MAXINT - 1, 1);
check_multiplication (-G_MAXINT, 1, -G_MAXINT + 1, -G_MAXINT, -G_MAXINT + 1,
1);
check_multiplication (G_MAXINT / 28, 459, -28, -G_MAXINT / 459,
G_MAXINT / 28 * 28, G_MAXINT / 459 * 459);
check_multiplication (3117 * 13, -17, 3117 * 17, 13, -3117 * 3117, 1);
return 0;
}

View file

@ -1,121 +0,0 @@
#include <gst/gst.h>
GstStaticCaps rawcaps1 = GST_STATIC_CAPS ("video/x-raw-yuv, "
"fourcc:fourcc=\"YUYV\", "
"height:int=640, "
"width:int=480, "
"framerate:float=30.0; "
"video/x-raw-yuv, "
"fourcc:fourcc=\"I420\", "
"height:int=640, " "width:int=480, " "framerate:float=30.0");
GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/x-raw-yuv");
GstStaticCaps rawcaps3 =
GST_STATIC_CAPS ("video/x-raw-yuv, height=(int) [ 0, MAX ]");
GstStaticCaps rawcaps4 =
GST_STATIC_CAPS
("video/x-raw-yuv, format=(fourcc)YUY2; video/x-raw-yuv, format=(fourcc)UYVY");
GstStaticCaps rawcaps5 =
GST_STATIC_CAPS
("video/x-raw-yuv, format=(fourcc)YUY2, framerate=(double)[0,1.79769e+308], width=(int)[0,2147483647], height=(int)[0,2147483647]; video/x-raw-yuv, format=(fourcc)UYVY, framerate=(double)[0,1.79769e+308], width=(int)[0,2147483647], height=(int)[0,2147483647]");
GstStaticCaps rawcaps6 =
GST_STATIC_CAPS
("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240");
GstStaticCaps rawcaps7 =
GST_STATIC_CAPS
("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[0,2147483647], height=(int)[0,2147483647], framerate=(double)[0,1.79769e+308]");
GstStaticCaps rawcaps8 =
GST_STATIC_CAPS
("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240");
GstStaticCaps rawcaps9 =
GST_STATIC_CAPS
("audio/x-raw-float, "
"channel-positions=(int)< "
"{ 1, 2, 3, 4, 5, 6 }, "
"{ 1, 2 }, "
"{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 4, 5, 6 }, " "6 >");
GstStaticCaps rawcaps10 =
GST_STATIC_CAPS
("audio/x-raw-float, "
"channel-positions=(int)< 1, { 2, 3, 4, 5, 6 }, 3, 4, {4, 5, 6 }, "
"{ 4, 5, 6 } >");
int
main (int argc, char *argv[])
{
GstCaps *caps1;
GstCaps *caps2;
GstCaps *caps3;
GstCaps *caps4;
GstCaps *caps;
gst_init (&argc, &argv);
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps1));
caps2 =
gst_caps_new_full (gst_structure_copy (gst_caps_get_structure
(gst_static_caps_get (&rawcaps1), 0)), NULL);
#if 0
gst_caps_set (caps1, "height", GST_PROPS_INT (640));
gst_caps_set (caps1, "width", GST_PROPS_INT (480));
gst_caps_set (caps1, "framerate", GST_PROPS_FLOAT (30.0));
#endif
caps = gst_caps_intersect (caps1, caps2);
g_print ("caps %s\n", gst_caps_to_string (caps));
if (gst_caps_is_empty (caps))
return 1;
gst_caps_unref (caps1);
gst_caps_unref (caps2);
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps2));
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps3));
caps = gst_caps_intersect (caps1, caps2);
g_print ("caps %s\n", gst_caps_to_string (caps));
if (gst_caps_is_empty (caps))
return 1;
gst_caps_unref (caps1);
gst_caps_unref (caps2);
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps4));
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps5));
caps3 = gst_caps_copy (gst_static_caps_get (&rawcaps6));
caps4 = gst_caps_intersect (caps1, caps2);
caps = gst_caps_intersect (caps3, caps4);
g_print ("caps4 %s\n", gst_caps_to_string (caps4));
g_print ("caps %s\n", gst_caps_to_string (caps));
gst_caps_unref (caps1);
gst_caps_unref (caps2);
gst_caps_unref (caps3);
gst_caps_unref (caps4);
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps7));
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps8));
caps = gst_caps_intersect (caps1, caps2);
g_print ("caps %s\n", gst_caps_to_string (caps));
if (gst_caps_is_empty (caps))
return 1;
gst_caps_unref (caps1);
gst_caps_unref (caps2);
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps9));
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps10));
caps = gst_caps_intersect (caps1, caps2);
g_print ("caps %s\n", gst_caps_to_string (caps));
if (gst_caps_is_empty (caps))
return 1;
gst_caps_unref (caps1);
gst_caps_unref (caps2);
return 0;
}

View file

@ -1,109 +0,0 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, "
"mpegtype=(int)1, "
"foo1=(int)[20,40], " "foo2=(int)[20,40], " "foo3=(int)[10,20]");
GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, "
"mpegtype=(int)1, "
"foo1=(int)30, " "foo2=(int)[20,30], " "foo3=(int)[20,30]");
GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, "
"width=(int)[16,4096], " "height=(int)[16,4096]");
GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, "
"height=(int)[16,256], " "depth=(int)16");
GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YUY2\", \"YV12\" }, " "height=(int)[16,4096]");
GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YUY2\",\"YV12\",\"YUYV\" }, " "height=(int)[16,4096]");
GstStaticCaps rawcaps5 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YUYV\",\"YUY2\"}, " "height=(int)[16,4096]");
GstStaticCaps rawcaps6 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc)\"YUYV\", "
"height=(int)640, "
"width=(int)480, "
"framerate=(double)30.0; "
"video/raw, "
"fourcc=(fourcc)\"I420\", "
"height=(int)640, " "width=(int)480, " "framerate=(double)30.0");
GstStaticCaps rawcaps7 =
GST_STATIC_CAPS
("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[1,2147483647], height=(int)[1,2147483647], framerate=(double)[0,1.79769e+308]");
GstStaticCaps rawcaps8 =
GST_STATIC_CAPS
("video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2 }, width=(int)[16,4096], height=(int)[16,4096], framerate=(double)[0,1.79769e+308]");
int
main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
gst_init (&argc, &argv);
doc = xmlNewDoc ((const xmlChar *) "1.0");
doc->xmlRootNode =
xmlNewDocNode (doc, NULL, (const xmlChar *) "Capabilities", NULL);
/*
for (i = 0; i<100000; i++) {
caps = gst_caps_intersect (gst_static_caps_get (rawcaps3), GST_CAPS_GET (rawcaps4));
gst_caps_unref (caps);
}
*/
caps = gst_caps_intersect (gst_static_caps_get (&sinkcaps),
gst_static_caps_get (&mp1parsecaps));
parent =
xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities1",
NULL);
gst_caps_save_thyself (caps, parent);
caps = gst_caps_intersect (gst_static_caps_get (&rawcaps),
gst_static_caps_get (&rawcaps2));
parent =
xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities2",
NULL);
gst_caps_save_thyself (caps, parent);
caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3),
gst_static_caps_get (&rawcaps4));
parent =
xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities3",
NULL);
gst_caps_save_thyself (caps, parent);
caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3),
gst_static_caps_get (&rawcaps5));
parent =
xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities4",
NULL);
gst_caps_save_thyself (caps, parent);
caps = gst_caps_intersect (gst_static_caps_get (&rawcaps6),
gst_caps_new_full (gst_structure_copy (gst_caps_get_structure
(gst_static_caps_get (&rawcaps6), 0)), NULL));
parent =
xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities5",
NULL);
gst_caps_save_thyself (caps, parent);
caps = gst_caps_intersect (gst_static_caps_get (&rawcaps7),
gst_static_caps_get (&rawcaps8));
g_print ("intersection: %s\n", gst_caps_to_string (caps));
xmlDocDump (stdout, doc);
return 0;
}

View file

@ -1,85 +0,0 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, "
"fourcc=(fourcc){\"YV12\",\"YUY2\"}, "
"foo1=(int)[20,40], " "foo2=(int)[20,40], " "foo3=(int)[10,20]");
GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, "
"fourcc=(fourcc){\"YV12\",\"YUY2\"}, " "foo4=(fourcc){\"YV12\",\"YUY2\"}");
GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, "
"width=(int)[16,4096], "
"height=(int)[16,4096], " "fourcc=(fourcc){\"YV12\",\"YUY2\"}");
GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, "
"width=(int)[16,256], "
"height=(int)16; " "video/raw, " "width=(int)[16,256], " "height=(int)16");
GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, "
"width=(int)[16,256], "
"height=(int)16; "
"video/raw, "
"width=(int)[16,256], "
"height=(int)16; "
"video/raw, "
"fourcc=(fourcc){\"YV12\",\"YUY2\"}, " "height=(int)[16,4096]");
GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("x, "
"y=(int){1,2}, " "z=(int){3,4}; " "a, " "b=(int){5,6}, " "c=(int){7,8}");
/* defined, not used
GST_CAPS_FACTORY (rawcaps4,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
);
GST_CAPS_FACTORY (rawcaps5,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
);
*/
int
main (int argc, char *argv[])
{
GstCaps *caps;
gst_init (&argc, &argv);
caps = gst_caps_normalize (gst_static_caps_get (&sinkcaps));
g_print ("\n%s\n", gst_caps_to_string (caps));
caps = gst_caps_normalize (gst_static_caps_get (&mp1parsecaps));
g_print ("\n%s\n", gst_caps_to_string (caps));
caps = gst_caps_normalize (gst_static_caps_get (&rawcaps));
g_print ("\n%s\n", gst_caps_to_string (caps));
caps = gst_caps_normalize (gst_static_caps_get (&rawcaps2));
g_print ("\n%s\n", gst_caps_to_string (caps));
caps = gst_caps_normalize (gst_static_caps_get (&rawcaps3));
g_print ("\n%s\n", gst_caps_to_string (caps));
caps = gst_caps_normalize (gst_static_caps_get (&rawcaps4));
g_assert (gst_caps_get_size (caps) == 8);
g_print ("\n%s\n", gst_caps_to_string (caps));
return 0;
}

View file

@ -1,69 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
void
assert_on_error (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
GstDebugMessage * message, gpointer data)
{
g_assert (level != GST_LEVEL_ERROR);
}
gint
main (gint argc, gchar * argv[])
{
/* this file contains random tests for stuff that went wrong in some version
* and should be tested so we're sure it works right now
* Please add what exactly the code tests for in your test */
gst_init (&argc, &argv);
/* TEST 1:
* gstcaps.c 1.120 used a code path that caused a GST_ERROR for the tested
* caps when simplifying even though that is absolutely valid */
{
GstCaps *caps =
gst_caps_from_string
("some/type, a=(int)2, b=(int)3, c=bla; some/type, a=(int)2, c=bla");
gst_debug_add_log_function (assert_on_error, NULL);
gst_caps_do_simplify (caps);
gst_debug_remove_log_function (assert_on_error);
gst_caps_unref (caps);
}
/* TEST 2:
* gstvalue.c 1.34 had a broken comparison function for int ranges that
* returned GST_VALUE_EQUAL even though the range end was different */
{
GValue v1 = { 0, };
GValue v2 = { 0, };
g_value_init (&v1, GST_TYPE_INT_RANGE);
g_value_init (&v2, GST_TYPE_INT_RANGE);
gst_value_set_int_range (&v1, 1, 2);
gst_value_set_int_range (&v2, 1, 3);
g_assert (gst_value_compare (&v1, &v2) != GST_VALUE_EQUAL);
g_value_unset (&v1);
g_value_unset (&v2);
}
return 0;
}

View file

@ -1,150 +0,0 @@
#include <gst/gst.h>
#include <string.h>
#include <unistd.h>
static GstPad *sinesrcpad;
static GstStaticCaps caps1 = GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness=(int)1234, "
"signed=(boolean)true, "
"width=(int)16, " "depth=(int)16, " "rate=(int)48000, " "channels=(int)1");
static GstStaticCaps caps2 = GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness=(int)1234, "
"signed=(boolean)true, "
"width=(int)16, " "depth=(int)16, " "rate=(int)44100, " "channels=(int)1");
int stage = 0;
static GstCaps *
my_fixate (GstPad * pad, GstCaps * caps, gpointer user_data)
{
const char *element_name;
const char *pad_name;
element_name = gst_element_get_name (gst_pad_get_parent (pad));
pad_name = gst_pad_get_name (pad);
g_print ("%s:%s: %s\n", element_name, pad_name, gst_caps_to_string (caps));
if (strcmp (element_name, "sinesrc0") == 0 && strcmp (pad_name, "src") == 0) {
GstCaps *icaps;
const GstCaps *mycaps;
int rate;
sinesrcpad = pad;
if (stage == 0) {
mycaps = gst_static_caps_get (&caps1);
rate = 48000;
} else {
mycaps = gst_static_caps_get (&caps2);
rate = 44100;
}
icaps = gst_caps_intersect (caps, mycaps);
if (!gst_caps_is_empty (icaps)) {
gst_caps_unref (icaps);
g_print ("returning %d\n", rate);
return gst_caps_copy (mycaps);
}
gst_caps_unref (icaps);
}
return NULL;
}
int
main (int argc, char *argv[])
{
GstElement *pipeline;
GError *error = NULL;
GstIterator *iter1, *iter2;
gint done1 = FALSE, done2 = FALSE;
gpointer element;
gst_init (&argc, &argv);
/* change sinesrk to sinesrc once gst_parse_launch is fixed */
pipeline = gst_parse_launch ("sinesrc ! audioconvert ! "
"audio/x-raw-int, channels=2, rate=48000;"
"audio/x-raw-int, channels=1, rate=44100 !" "fakesink", &error);
if (error != NULL) {
g_print
("oops, couldn't build pipeline. You probably don't have audioconvert or sinesrc\n"
"the error was: %s\n", error->message);
g_error_free (error);
exit (0);
}
iter1 = gst_bin_iterate_elements (GST_BIN (pipeline));
while (!done1) {
switch (gst_iterator_next (iter1, &element)) {
case GST_ITERATOR_OK:
{
gpointer pad;
iter2 = gst_element_iterate_pads (element);
while (!done2) {
switch (gst_iterator_next (iter2, &pad)) {
case GST_ITERATOR_OK:
if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
g_signal_connect (G_OBJECT (pad), "fixate",
G_CALLBACK (my_fixate), NULL);
}
gst_object_unref (pad);
break;
case GST_ITERATOR_DONE:
done2 = TRUE;
break;
case GST_ITERATOR_RESYNC:
case GST_ITERATOR_ERROR:
exit (1);
break;
}
}
gst_iterator_free (iter2);
gst_object_unref (element);
break;
}
case GST_ITERATOR_DONE:
done1 = TRUE;
break;
case GST_ITERATOR_RESYNC:
case GST_ITERATOR_ERROR:
exit (1);
break;
}
}
gst_iterator_free (iter1);
/*g_signal_connect (pipeline, "deep_notify",
G_CALLBACK (gst_element_default_deep_notify), NULL); */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/*
i = 0;
while (1) {
gst_bin_iterate (GST_BIN (pipeline));
i++;
if (i == 10) {
stage = 1;
g_print ("10 iterations\n");
ret = gst_pad_renegotiate (sinesrcpad);
g_print ("negotiation returned %d\n", ret);
}
if (i == 20) {
g_print ("20 iterations\n");
exit (0);
}
}
*/
/* Like totally not sure how to do this in THREADED. Punting for now! */
sleep (5);
return 0;
}

View file

@ -1,81 +0,0 @@
/*
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
#include <string.h>
#include "caps.h"
static void
check_caps (const gchar * eins, const gchar * zwei)
{
GstCaps *one, *two, *test, *test2, *test3, *test4;
one = gst_caps_from_string (eins);
two = gst_caps_from_string (zwei);
g_print (" A = %u\n", strlen (eins));
g_print (" B = %u\n", strlen (zwei));
test = gst_caps_intersect (one, two);
if (gst_caps_is_equal (one, two)) {
g_print (" EQUAL\n\n");
g_assert (gst_caps_is_equal (one, test));
g_assert (gst_caps_is_equal (two, test));
} else if (!gst_caps_is_any (one) || gst_caps_is_empty (two)) {
test2 = gst_caps_subtract (one, test);
g_print (" A - B = %u\n", strlen (gst_caps_to_string (test2)));
/* test2 = one - (one A two) = one - two */
test3 = gst_caps_intersect (test2, two);
g_print (" empty = %s\n", gst_caps_to_string (test3));
g_assert (gst_caps_is_empty (test3));
gst_caps_unref (test3);
test3 = gst_caps_union (test2, two);
g_print (" A + B = %u\n", strlen (gst_caps_to_string (test3)));
/* test3 = one - two + two = one + two */
g_print (" A + B = %s\n", gst_caps_to_string (gst_caps_subtract (one,
test3)));
g_assert (gst_caps_is_subset (one, test3));
test4 = gst_caps_union (one, two);
g_assert (gst_caps_is_equal (test3, test4));
g_print (" NOT EQUAL\n\n");
gst_caps_unref (test2);
gst_caps_unref (test3);
gst_caps_unref (test4);
} else {
g_print (" ANY CAPS\n\n");
}
gst_caps_unref (test);
gst_caps_unref (two);
gst_caps_unref (one);
}
gint
main (gint argc, gchar ** argv)
{
guint i, j;
gst_init (&argc, &argv);
for (i = 0; i < G_N_ELEMENTS (caps_list); i++) {
for (j = 0; j < G_N_ELEMENTS (caps_list); j++) {
g_print ("%u - %u\n", i, j);
check_caps (caps_list[i], caps_list[j]);
}
}
return 0;
}

View file

@ -1,125 +0,0 @@
/*
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
#include <string.h>
#include "caps.h"
/* statistics junkie!!! */
static guint size_before = 0, size_after = 0;
static guint length_before = 0, length_after = 0;
static guint impossible = 0, success = 0, failure = 0;
static void
check_caps (GstCaps * caps)
{
gchar *before, *after;
GstCaps *old;
before = gst_caps_to_string (caps);
old = gst_caps_copy (caps);
gst_caps_do_simplify (caps);
after = gst_caps_to_string (caps);
g_assert (gst_caps_get_size (caps) <= gst_caps_get_size (old));
if (gst_caps_get_size (caps) == gst_caps_get_size (old))
g_assert (strlen (after) <= strlen (before));
g_assert (gst_caps_is_equal (caps, old));
g_print ("%s %2u/%-4u => %2u/%-4u\n",
gst_caps_get_size (caps) < gst_caps_get_size (old) ||
strlen (after) < strlen (before) ? "REDUCED" :
(gst_caps_get_size (old) < 2 ? " --- " : " "),
gst_caps_get_size (old), strlen (before),
gst_caps_get_size (caps), strlen (after));
size_before += gst_caps_get_size (old);
size_after += gst_caps_get_size (caps);
length_before += strlen (before);
length_after += strlen (after);
if (gst_caps_get_size (old) < 2) {
impossible++;
} else if (gst_caps_get_size (caps) < gst_caps_get_size (old) ||
strlen (after) < strlen (before)) {
success++;
} else {
failure++;
}
g_free (before);
g_free (after);
gst_caps_unref (old);
}
gint
main (gint argc, gchar ** argv)
{
guint i, j;
gst_init (&argc, &argv);
for (i = 0; i < G_N_ELEMENTS (caps_list); i++) {
GstCaps *caps = gst_caps_from_string (caps_list[i]);
g_print (" %2u ", i);
check_caps (caps);
if (!gst_caps_is_any (caps)) {
for (j = 0; j < G_N_ELEMENTS (caps_list); j++) {
GstCaps *temp, *temp2;
GstCaps *caps2 = gst_caps_from_string (caps_list[j]);
/* subtraction */
temp = gst_caps_subtract (caps, caps2);
g_print ("%2u - %2u ", i, j);
check_caps (temp);
gst_caps_unref (temp);
/* union */
temp = gst_caps_union (caps, caps2);
g_print ("%2u + %2u ", i, j);
check_caps (temp);
if (i == j)
g_assert (gst_caps_get_size (caps) == gst_caps_get_size (temp));
g_assert (gst_caps_is_subset (caps, temp));
g_assert (gst_caps_is_subset (caps2, temp));
/* appending (union without simplifying) */
temp2 = gst_caps_copy (caps);
gst_caps_append (temp2, caps2);
g_assert (gst_caps_is_equal (temp, temp2));
gst_caps_unref (temp2);
gst_caps_unref (temp);
}
}
gst_caps_unref (caps);
}
g_print ("\n\nSTATISTICS:\n");
g_print ("\nOf all caps tried\n");
g_print ("%3u (%02.4g%%) caps were already at minimum size.\n", impossible,
100.0 * ((double) impossible) / (impossible + success + failure));
g_print ("%3u (%02.4g%%) caps were successfully reduced.\n", success,
100.0 * ((double) success) / (impossible + success + failure));
g_print ("%3u (%02.4g%%) caps could not be reduced.\n", failure,
100.0 * ((double) failure) / (impossible + success + failure));
g_print ("\nOf all caps that could possibly be reduced\n");
g_print ("%02.4g%% were reduced\n",
100.0 * ((double) success) / (success + failure));
g_print ("%02.4g%% average reduction in caps structure amount\n",
100.0 * (1.0 - ((double) size_after) / size_before));
g_print ("%02.4g%% average reduction in caps serialization length\n",
100.0 * (1.0 - ((double) length_after) / length_before));
return 0;
}

View file

@ -1,205 +0,0 @@
#include <gst/gst.h>
#include <string.h>
GstStaticCaps caps1 = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int){1,2}");
GstStaticCaps caps2 = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int){1}");
GstStaticCaps caps3 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YV12\",\"YUY2\"}, "
"width=(int)[16,4096], " "height=(int)[16,4096]");
GstStaticCaps caps4 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc)\"YV12\", " "height=(int)[16,256]");
GstStaticCaps caps5 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YV12\",\"YUY2\"}, " "height=(int)[16,4096]");
GstStaticCaps caps6 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YV12\",\"YUYV\"}, " "height=(int)[16,4096]");
GstStaticCaps caps7 = GST_STATIC_CAPS ("video/raw, "
"fourcc=(fourcc){\"YVYV\",\"YUY2\"}, " "height=(int)[16,4096],"
"pixel-aspect-ratio=(fraction)16/15");
GstStaticCaps caps8 = GST_STATIC_CAPS ("video/raw, "
"format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YUYV\"");
GstStaticCaps caps9 = GST_STATIC_CAPS ("video/raw, "
"format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YV12\"");
static gint test = 0;
static gint failures = 0;
#define TEST_START g_print ("%3d, START\n", ++test)
#define TEST_FAIL g_print ("%3d, FAIL : failure %d\n", test, ++failures)
#define TEST_SUCCESS g_print ("%3d, SUCCESS\n", test)
#define TEST_END(result) G_STMT_START{ \
if (result) { \
TEST_SUCCESS; \
} else { \
TEST_FAIL; \
} \
}G_STMT_END
static void
test_caps_func (const GstCaps * caps)
{
gchar *str1, *str2;
gboolean ret = FALSE;
str1 = gst_caps_to_string (caps);
caps = gst_caps_from_string (str1);
if (!caps) {
g_print ("%3d, INFO : no caps from %s\n", test, str1);
TEST_END (ret);
return;
}
str2 = gst_caps_to_string (caps);
g_print ("%3d, INFO : %s <==> %s\n", test, str1, str2);
ret = strcmp (str1, str2) == 0;
g_free (str1);
g_free (str2);
TEST_END (ret);
}
static void
test_caps (const GstCaps * caps)
{
TEST_START;
test_caps_func (caps);
}
static void
test_string (gchar * str)
{
GstCaps *caps;
TEST_START;
g_print ("%3d, INFO : checking %s\n", test, str);
caps = gst_caps_from_string (str);
if (!caps) {
g_print ("%3d, INFO : no caps from %s\n", test, str);
TEST_FAIL;
return;
}
test_caps_func (caps);
}
static void
test_string_fail (gchar * str)
{
GstCaps *caps;
TEST_START;
g_print ("%3d, INFO : checking %s for failure\n", test, str);
caps = gst_caps_from_string (str);
g_print ("got %p\n", caps);
TEST_END (caps == NULL);
}
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
goto bla;
bla:
/* stupidity tests */
test_caps (gst_caps_new_simple ("audio/raw", NULL));
/* all sorts of caps */
test_caps (gst_static_caps_get (&caps1));
test_caps (gst_static_caps_get (&caps2));
test_caps (gst_static_caps_get (&caps3));
test_caps (gst_static_caps_get (&caps4));
test_caps (gst_static_caps_get (&caps5));
test_caps (gst_static_caps_get (&caps6));
test_caps (gst_static_caps_get (&caps7));
test_caps (gst_static_caps_get (&caps8));
test_caps (gst_static_caps_get (&caps9));
/* mime types */
test_string ("audio/raw");
test_string ("\"audio/raw\"");
/* fixed props entries */
test_string ("audio/raw ,test=(int)1");
test_string ("audio/raw ,test=(double) 1");
test_string ("audio/raw, test=(fourcc )1");
test_string ("audio/raw ,test=(i)1");
test_string ("audio/raw ,test=(d) 1");
test_string ("audio/raw, test=(4 )1");
test_string ("audio/raw,test=( fourcc ) 0x0000001");
test_string ("audio/raw,test =(fourcc) \"RGB \"");
test_string ("audio/raw , test=( string)1");
test_string ("audio/raw,test= 1");
test_string ("audio/raw,test = 1.0");
test_string ("audio/raw ,test= \"1.0\"");
test_string ("audio/raw,test=( str) \"1\"");
test_string ("audio/raw ,test=(b)False");
test_string ("audio/raw ,test =(bool) trUE");
test_string ("audio/raw ,test=(b ) yes");
test_string ("audio/raw ,test =( boolean)no");
test_string ("audio/raw ,test = < 1, 2, 3 >");
test_string ("video/raw ,test =( fraction)9/8");
/* buffers */
test_string ("audio/raw ,test=(buffer)0123456789abcdef");
test_string ("audio/raw ,test= < (buffer)0123, (buffer)4567 >");
/* unfixed props entries */
test_string ("audio/raw, test= [ 1, 2 ]");
test_string_fail ("audio/raw, test= [ 1.0 , 2]");
test_string_fail ("audio/raw, test = [1, 2.5 ]");
test_string ("audio/raw, test= [1.3, 2.1 ]");
test_string ("audio/raw, test =(int ) [1,2]");
test_string ("audio/raw, test =(double ) [1,2]");
test_string ("audio/raw, test= [(int) 1, 2 ]");
test_string ("audio/raw, test=(d) [ (double)1.0 , 2]");
test_string ("audio/raw, test=(double) [1.3, (double)2.1 ]");
test_string ("audio/raw, test =(i) [(int)1,2]");
test_string ("audio/raw, test={(int)1,2}");
test_string
("audio/raw, test= {(int)1 ,2,3 ,(int) 4 , 5 ,6 , (int )7 ,8 , (int ) 9, 10}");
test_string ("audio/raw, test= {1.0}");
test_string ("audio/raw, test= {\"hi\", \"i dig ya\", dude}");
test_string ("audio/raw, test= {(int)1,2}");
test_string ("audio/raw, test= {(int)1,2}");
/* prop concatenations */
test_string ("audio/raw, test=(double) [1.3, (double)2.1 ], test2= [ 1, 2 ]");
test_string ("audio/raw , test=(fourcc) \"RGB \",test2=(int)1");
test_string
("audio/raw, test= [(int ) 1, 2 ] ,test2 =(fourcc) \"RGB \"");
test_string ("audio/raw, test= [1.3, 2.1 ] , test2= {1.0}");
test_string
("audio/raw, test= {(int)1 ,2,3 ,(int) 4 , 5 ,6 , (int )7 ,8 , (int ) 9, 10}, test2 = [1.0, 2.5 ] , test3= (string)1 ,test4=(i)1");
/* caps concatenations */
test_string
("audio/raw, test= [(int ) 1, 2 ] ,test2 =(fourcc) \"RGB \";\"audio/raw\"");
test_string
("audio/raw, test =(double ) [1,2] ; audio/raw, test=(fourcc )1 ;audio/raw, test= {\"hi\", \"i dig ya\", dude}");
test_string
("audio/raw, test=(double) [1.3, (double)2.1 ];audio/raw, test =(i) [(int)1,2]");
/* mimes */
test_string_fail ("audio/raw\\");
test_string_fail ("'audio/raw");
test_string_fail ("'audio/raw\"");
/* wrong type */
test_string_fail ("audio/raw, test=(int) [1.0,2]");
test_string_fail ("audio/raw, test=(int) [1 ,0.2]");
test_string_fail ("audio/raw, test=(int) [1.0, 2.000]");
test_string_fail ("audio/raw, test=(int) <1.0, 2.000>");
/* unmatched */
test_string_fail ("audio/raw, test=(int = [");
test_string_fail ("audio/raw, test= {");
test_string_fail ("audio/raw, test= <");
test_string_fail ("audio/raw, test = \"dood'");
test_string_fail ("audio/raw, test= '");
if (failures) {
g_print ("\n FAILURES : %d\n", failures);
} else {
g_print ("\n DONE\n");
}
return failures;
}

View file

@ -1,25 +0,0 @@
#include <gst/gst.h>
void
test1 (void)
{
GstStructure *structure;
g_print ("type is %d\n", (int) gst_structure_get_type ());
structure = gst_structure_empty_new ("moo");
g_assert (structure != NULL);
g_assert (GST_IS_STRUCTURE (structure));
}
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
test1 ();
return 0;
}

View file

@ -1,63 +0,0 @@
/*
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
static void
check_caps (const gchar * set, const gchar * subset)
{
GstCaps *one, *two, *test, *test2;
g_print (" A = %s\n", set);
one = gst_caps_from_string (set);
g_print (" B = %s\n", subset);
two = gst_caps_from_string (subset);
/* basics */
test = gst_caps_subtract (one, one);
g_assert (gst_caps_is_empty (test));
gst_caps_unref (test);
test = gst_caps_subtract (two, two);
g_assert (gst_caps_is_empty (test));
gst_caps_unref (test);
test = gst_caps_subtract (two, one);
g_assert (gst_caps_is_empty (test));
gst_caps_unref (test);
/* now the nice part */
test = gst_caps_subtract (one, two);
g_assert (!gst_caps_is_empty (test));
g_print (" A - B = %s\n", gst_caps_to_string (test));
test2 = gst_caps_union (test, two);
g_print ("A - B + B = %s\n", gst_caps_to_string (test2));
gst_caps_unref (test);
test = gst_caps_subtract (test2, one);
g_assert (gst_caps_is_empty (test));
gst_caps_unref (test);
}
gint
main (gint argc, gchar ** argv)
{
gst_init (&argc, &argv);
check_caps ("some/mime, _int = [ 1, 2 ], list = { \"A\", \"B\", \"C\" }",
"some/mime, _int = 1, list = \"A\"");
check_caps ("some/mime, _double = (double) 1.0; other/mime, _int = { 1, 2 }",
"some/mime, _double = (double) 1.0");
return 0;
}

View file

@ -1,34 +0,0 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, "
"mpegtype:int=1, "
"foo1:int=[20,40], " "foo2:int=[20,40], " "foo3:int=[10,20]");
GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, "
"mpegtype:int=1, " "foo1:int=30, " "foo2:int=[20,30], " "foo3:int=[20,30]");
int
main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
gst_init (&argc, &argv);
doc = xmlNewDoc ((const xmlChar *) "1.0");
doc->xmlRootNode =
xmlNewDocNode (doc, NULL, (const xmlChar *) "Capabilities", NULL);
caps = gst_caps_union (gst_static_caps_get (&sinkcaps),
gst_static_caps_get (&mp1parsecaps));
parent =
xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities1",
NULL);
gst_caps_save_thyself (caps, parent);
xmlDocDump (stdout, doc);
return 0;
}

View file

@ -1,5 +0,0 @@
category
commandline
global
output
printf_extension

View file

@ -1,5 +0,0 @@
include ../Rules
tests_pass = commandline category output printf_extension
tests_fail =
tests_ignore = global

View file

@ -1,84 +0,0 @@
/*
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* category.c: test the categories
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
#include <string.h>
GST_DEBUG_CATEGORY (cat);
#define GST_CAT_DEFAULT cat
GST_DEBUG_CATEGORY_STATIC (cat_static);
gint
main (gint argc, gchar * argv[])
{
GSList *before, *after;
unsetenv ("GST_DEBUG");
gst_init (&argc, &argv);
before = gst_debug_get_all_categories ();
GST_DEBUG_CATEGORY_INIT (cat, "cat", GST_DEBUG_FG_GREEN,
"default category for this test");
GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static",
GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_RED,
"static category for this test");
after = gst_debug_get_all_categories ();
g_print ("removing default log function\n");
#ifdef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 0);
#else
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
g_print
("checking, if the two new categories are put into the category list correctly...\n");
g_assert (g_slist_length (after) - g_slist_length (before) == 2);
/* check the _get stuff */
g_print
("checking, if the gst_debug_category_get_* stuff works with the categories...\n");
g_assert (strcmp (gst_debug_category_get_name (cat), "cat") == 0);
g_assert (gst_debug_category_get_color (cat) == GST_DEBUG_FG_GREEN);
g_assert (strcmp (gst_debug_category_get_description (cat),
"default category for this test") == 0);
g_assert (gst_debug_category_get_threshold (cat) ==
gst_debug_get_default_threshold ());
g_assert (strcmp (gst_debug_category_get_name (cat_static),
"cat_static") == 0);
g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_FG_GREEN);
g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BG_RED);
g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BOLD);
g_assert (strcmp (gst_debug_category_get_description (cat_static),
"static category for this test") == 0);
g_assert (gst_debug_category_get_threshold (cat_static) ==
gst_debug_get_default_threshold ());
/* check if setting levels for names work */
g_print
("checking if changing threshold for names affects existing categories...\n");
gst_debug_set_threshold_for_name ("cat", GST_LEVEL_DEBUG);
g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG);
g_assert (gst_debug_category_get_threshold (cat_static) ==
gst_debug_get_default_threshold ());
gst_debug_set_threshold_for_name ("cat_static", GST_LEVEL_INFO);
g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG);
g_assert (gst_debug_category_get_threshold (cat_static) == GST_LEVEL_INFO);
#endif
g_print ("everything ok.\n");
return 0;
}

View file

@ -1,118 +0,0 @@
/*
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* commandline.c: Test if the command line arguments work
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
GST_DEBUG_CATEGORY (cat);
GST_DEBUG_CATEGORY_STATIC (cat_static);
#ifndef GST_DISABLE_GST_DEBUG
static const gchar *lines[] = {
"--gst-debug-disable",
"--gst-debug-no-color",
"--gst-debug-level=4",
"--gst-debug=cat:4,cat_*:3",
"--gst-debug-level=4 --gst-debug=cat_*:5"
};
static void
debug_not_reached (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
GstDebugMessage * message, gpointer thread)
{
g_assert_not_reached ();
}
#endif
gint
main (gint argc, gchar * argv[])
{
if (argc == 1) {
/* this is the main run that calls the others */
unsetenv ("GST_DEBUG");
gst_init (&argc, &argv);
#ifndef GST_DISABLE_GST_DEBUG
{
gint i, runs, exit;
gchar *command;
runs = G_N_ELEMENTS (lines);
for (i = 0; i < runs; i++) {
int ret;
command = g_strdup_printf ("./commandline %s %d", lines[i], i);
g_print ("running \"%s\"\n", command);
ret = g_spawn_command_line_sync (command, NULL, NULL, &exit, NULL);
g_assert (ret == TRUE);
g_assert (exit == 0);
g_print ("\"%s\" worked as expected.\n", command);
g_free (command);
}
}
#endif
return 0;
} else {
gst_init (&argc, &argv);
if (argc != 2) {
g_print
("something funny happened to the command line arguments, aborting.\n");
return 1;
}
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
#endif
GST_DEBUG_CATEGORY_INIT (cat, "cat", 0, "non-static category");
GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", 0, "static category");
switch (argv[1][0]) {
case '0':
g_assert (gst_debug_is_active () == FALSE);
#ifndef GST_DISABLE_GST_DEBUG
gst_debug_add_log_function (debug_not_reached, NULL);
#endif
GST_ERROR ("This will not be seen");
return 0;
case '1':
return gst_debug_is_colored ()? 1 : 0;
case '2':
g_assert (gst_debug_get_default_threshold () == 4);
g_assert (gst_debug_category_get_threshold (cat) == 4);
return 0;
case '3':
g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT);
g_assert (gst_debug_category_get_threshold (cat) == 4);
g_assert (gst_debug_category_get_threshold (cat_static) == 3);
return 0;
case '4':
g_assert (gst_debug_get_default_threshold () == 4);
g_assert (gst_debug_category_get_threshold (cat) == 4);
g_assert (gst_debug_category_get_threshold (cat_static) == 5);
return 0;
default:
g_print ("usupported command, aborting...\n");
return -1;
}
}
g_assert_not_reached ();
}

View file

@ -1,112 +0,0 @@
/*
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* global.c: Test global parameter setting/getting
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#define THREAD_COUNT 5
#define ITERATIONS 20
/* stupid logging functions */
static void
gst_debug_log_one (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line, GObject * object, GstDebugMessage * message, gpointer data)
G_GNUC_NO_INSTRUMENT;
static void gst_debug_log_two (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line, GObject * object, GstDebugMessage * message, gpointer thread)
G_GNUC_NO_INSTRUMENT;
static void
gst_debug_log_one (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
GstDebugMessage * message, gpointer data)
{
}
static void
gst_debug_log_two (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
GstDebugMessage * message, gpointer data)
{
}
static gpointer
thread_main (gpointer threadnum)
{
gint num;
gint i;
num = GPOINTER_TO_INT (threadnum);
for (i = 0; i < ITERATIONS; i++) {
g_print ("iteration %d of thread %d starting\n", i, num);
/* do some stuff with global settings */
gst_debug_set_default_threshold (GST_LEVEL_DEBUG);
gst_debug_add_log_function (gst_debug_log_one, g_thread_self ());
gst_debug_add_log_function (gst_debug_log_two, NULL);
/* reset all the stuff we did */
gst_debug_set_default_threshold (GST_LEVEL_DEFAULT);
g_assert (gst_debug_remove_log_function_by_data (g_thread_self ()) == 1);
}
g_print ("Thread %d is done.\n", num);
return threadnum;
}
gint
main (gint argc, gchar * argv[])
{
gint i;
GThread *threads[THREAD_COUNT];
g_print ("initializing GStreamer\n");
gst_init (&argc, &argv);
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
/* some checks for defaults */
g_print ("Doing startup checks\n");
g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT);
g_print ("creating %d threads\n", THREAD_COUNT);
for (i = 0; i < THREAD_COUNT; i++) {
g_assert ((threads[i] =
g_thread_create (thread_main, GINT_TO_POINTER (i), TRUE, NULL)));
}
g_print ("joining %d threads\n", THREAD_COUNT);
for (i = 0; i < THREAD_COUNT; i++) {
g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i);
}
/* some checks if everything worked */
g_print ("Doing shutdown checks\n");
g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT);
g_assert (gst_debug_remove_log_function (gst_debug_log_two) ==
THREAD_COUNT * ITERATIONS);
return 0;
}

View file

@ -1,127 +0,0 @@
/*
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* output.c: Test if the debugging output macros work
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
GST_DEBUG_CATEGORY_STATIC (cat_default);
#define GST_CAT_DEFAULT cat_default
GST_DEBUG_CATEGORY_STATIC (cat2);
static gint count = -1;
static GstElement *pipeline;
#ifndef GST_DISABLE_GST_DEBUG
static void
check_message (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
GstDebugMessage * message, gpointer unused)
{
gint temp;
/* these checks require count to be set right. So the order in the main
funtion is actually important. */
/* <0 means no checks */
if (count < 0)
return;
g_print ("expecting \"%s\"...", (gchar *) message);
/* level */
temp = (count % 5) + 1;
g_assert (level == temp);
/* category */
temp = (count % 10) / 5;
g_assert (category == (temp ? cat2 : cat_default));
/* object */
temp = (count % 20) / 10;
g_assert (object == (GObject *) (temp ? pipeline : NULL));
g_print ("[OK]\n");
}
#endif
gint
main (gint argc, gchar * argv[])
{
gst_init (&argc, &argv);
GST_DEBUG_CATEGORY_INIT (cat_default, "GST_Check_default", 0,
"default category for this test");
GST_DEBUG_CATEGORY_INIT (cat2, "GST_Check_2", 0,
"second category for this test");
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
#endif
gst_debug_add_log_function (check_message, NULL);
count = 0;
GST_ERROR ("This is an error.");
++count;
GST_WARNING ("This is a warning.");
++count;
GST_INFO ("This is an info message.");
++count;
GST_DEBUG ("This is a debug message.");
++count;
GST_LOG ("This is a log message.");
++count;
GST_CAT_ERROR (cat2, "This is an error with category.");
++count;
GST_CAT_WARNING (cat2, "This is a warning with category.");
++count;
GST_CAT_INFO (cat2, "This is an info message with category.");
++count;
GST_CAT_DEBUG (cat2, "This is a debug message with category.");
++count;
GST_CAT_LOG (cat2, "This is a log message with category.");
count = -1;
pipeline = gst_element_factory_make ("pipeline", "testelement");
count = 10;
GST_ERROR_OBJECT (pipeline, "This is an error with object.");
++count;
GST_WARNING_OBJECT (pipeline, "This is a warning with object.");
++count;
GST_INFO_OBJECT (pipeline, "This is an info message with object.");
++count;
GST_DEBUG_OBJECT (pipeline, "This is a debug message with object.");
++count;
GST_LOG_OBJECT (pipeline, "This is a log message with object.");
++count;
GST_CAT_ERROR_OBJECT (cat2, pipeline,
"This is an error with category and object.");
++count;
GST_CAT_WARNING_OBJECT (cat2, pipeline,
"This is a warning with category and object.");
++count;
GST_CAT_INFO_OBJECT (cat2, pipeline,
"This is an info message with category and object.");
++count;
GST_CAT_DEBUG_OBJECT (cat2, pipeline,
"This is a debug message with category and object.");
++count;
GST_CAT_LOG_OBJECT (cat2, pipeline,
"This is a log message with category and object.");
count = -1;
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (check_message) == 1);
#endif
return 0;
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (C) 2004 David A. Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
gint
main (gint argc, gchar * argv[])
{
GstCaps *caps;
GstElement *element;
G_GNUC_UNUSED gpointer null = NULL;
/* G_GNUC_UNUSED int zero = 0; */
gst_init (&argc, &argv);
caps = gst_caps_from_string ("audio/x-raw-int, rate=44100");
element = gst_element_factory_make ("identity", NULL);
GST_ERROR ("This should print caps: %" GST_PTR_FORMAT, caps);
GST_ERROR ("This should print an object: %" GST_PTR_FORMAT, element);
GST_ERROR ("This should print null: %" GST_PTR_FORMAT, NULL);
GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, &null);
/* 64 bit address to a 32 bit int will cause the GObject interpretation
* to segfault; since GST_PTR_FORMAT only works on stuff with
* sizeof(gpointer) */
/* GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, &zero); */
/* GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, (void *)1); */
return 0;
}

View file

@ -1 +0,0 @@
dlopen_gst

View file

@ -1,41 +0,0 @@
# ../Rules is not included because we specifically don't want the normal
# AM_CFLAGS, etc.
plugin_LTLIBRARIES = libloadgst.la
tests_pass = dlopen_gst
tests_fail =
tests_ignore =
libloadgst_la_SOURCES = loadgst.c
libloadgst_la_CFLAGS = $(GST_OBJ_CFLAGS)
libloadgst_la_LDFLAGS = -module -avoid-version $(GST_OBJ_LIBS)
dlopen_gst_CFLAGS = $(GLIB_CFLAGS)
dlopen_gst_LDFLAGS = $(GLIB_LIBS)
TESTS_ENVIRONMENT= \
G_DEBUG=fatal_warnings \
GST_PLUGIN_PATH=$(top_builddir)/gst:. \
GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml
check_PROGRAMS = $(tests_pass) $(tests_fail) $(tests_ignore)
# make all tests depend on the versioned gst-register
$(tests_pass) $(tests_fail): $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@
# rebuild gst-register-@GST_MAJORMINOR@ if needed
# the EXEEXT is because am 1.6 complained about overrides
$(top_builddir)/tools/gst-register-@GST_MAJORMINOR@$(EXEEXT):
cd $(top_builddir)/tools && make
TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(tests_pass) $(tests_fail)
XFAIL_TESTS = $(tests_fail)
# override to _not_ install the test plugins
install-pluginLTLIBRARIES:
# This rule is here so make distcheck works on machines where core
# dumps have PIDs appended
CLEANFILES = core.*

View file

@ -1,28 +0,0 @@
#include <gmodule.h>
int
main (int argc, char *argv[])
{
GModule *module;
void (*symbol) (void);
gboolean ret;
module = g_module_open (".libs/libloadgst.so",
#ifdef HAVE_G_MODULE_BIND_LOCAL
G_MODULE_BIND_LOCAL |
#endif
G_MODULE_BIND_LAZY);
g_assert (module != NULL);
ret = g_module_symbol (module, "gst_init", (gpointer *) & symbol);
g_print ("'gst_init' is %s\n", ret ? "visible" : "not visible");
ret = g_module_symbol (module, "do_test", (gpointer *) & symbol);
g_assert (ret);
symbol ();
exit (0);
}

View file

@ -1,26 +0,0 @@
#include <gst/gst.h>
void
do_test (void)
{
GstElement *pipeline;
int i;
gst_init (NULL, NULL);
pipeline = gst_parse_launch ("fakesrc ! fakesink", NULL);
g_assert (pipeline != NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
for (i = 0; i < 100; i++) {
g_usleep (1000);
g_print ("%s", (i & 1) ? "+" : "-");
}
g_print ("\n");
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
}

View file

@ -1,16 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
fake
name
property
tee
gst-inspect-check
gst-compprep-check
static
struct_size

View file

@ -1,15 +0,0 @@
include ../Rules
tests_pass = gst-inspect-check struct_size
tests_fail =
tests_ignore =
noinst_HEADERS = struct_i386.h
gst_inspect_check_SOURCES =
gst-inspect-check$(EXEEXT): $(srcdir)/gst-inspect-check.in
sed s/@[G]ST_MAJORMINOR@/@GST_MAJORMINOR@/ \
$(srcdir)/gst-inspect-check.in >gst-inspect-check$(EXEEXT)
chmod +x gst-inspect-check$(EXEEXT)
EXTRA_DIST = gst-inspect-check.in

View file

@ -1,90 +0,0 @@
#!/usr/bin/perl -w
# checks all built plugins by running gst-inspect on each element
# and checking for warnings on stderr
### packages
use File::Basename;
print " _______\n";
print " (__) / \\\n";
print " (oo) ( M O O )\n";
print " /-------\\/ --'\\_______/\n";
print " / | ||\n";
print "* ||----||\n";
print " ^^ ^^\n";
my $num_warnings = 0;
my $path = `dirname $0`;
chomp $path;
$path = "../../tools";
$gst_inspect = "$path/gst-inspect-@GST_MAJORMINOR@";
sub check_all_elements
{
#send stderr to /dev/null
my $command = "$gst_inspect 2>/dev/null";
my @lines = `$command`;
if (!@lines) {
print ("gst-inspect returned nothing\n");
return -1;
}
while ($_ = shift(@lines)){
my @matches = m/^\w+:\s+(\w+):/;
if(@matches){
check_element($matches[0]);
}
}
if ($num_warnings > 0){
print("there are $num_warnings warnings to be fixed\n");
return -1;
}
return 0;
}
sub check_element($)
{
my ($element) = @_;
print "running inspect on $element\n";
# capture stderr, send stdout to /dev/null
my $command = "$gst_inspect $element 2>&1 1>/dev/null";
my @lines = `$command`;
while ($_ = shift(@lines)){
# ignore INFO lines, they are ok
if (! /INFO/){
print $_;
# do this to ignore empty lines
if (length > 1){
$num_warnings++;
}
}
}
system("$gst_inspect $element 2>/dev/null 1>/dev/null");
if ($? != 0){
my $exit_value = $? >> 8;
my $signal_num = $? & 127;
my $dumped_core = $? & 128;
if ($exit_value){
print("error value on exit: $exit_value\n");
}
if ($signal_num){
print("signal caused exit: $signal_num\n");
}
if ($dumped_core){
print("dumped core: $dumped_core\n");
}
$num_warnings++
}
}
### main
exit check_all_elements ();

View file

@ -1,148 +0,0 @@
/* Generated by GStreamer-0.8.4.1 */
Struct list[] = {
{"GstPoptOption", sizeof (GstPoptOption), 28}
,
{"GstBuffer", sizeof (GstBuffer), 108}
,
{"GstCaps", sizeof (GstCaps), 28}
,
{"GstStaticCaps", sizeof (GstStaticCaps), 48}
,
{"GstClockEntry", sizeof (GstClockEntry), 36}
,
{"GstClock", sizeof (GstClock), 128}
,
{"GstClockClass", sizeof (GstClockClass), 172}
,
{"GstData", sizeof (GstData), 40}
,
{"GstElementDetails", sizeof (GstElementDetails), 32}
,
{"GstElementFactory", sizeof (GstElementFactory), 112}
,
{"GstElementFactoryClass", sizeof (GstElementFactoryClass), 104}
,
{"GstFormatDefinition", sizeof (GstFormatDefinition), 12}
,
{"GstIndexEntry", sizeof (GstIndexEntry), 20}
,
{"GstIndexGroup", sizeof (GstIndexGroup), 16}
,
{"GstIndex", sizeof (GstIndex), 100}
,
{"GstIndexClass", sizeof (GstIndexClass), 156}
,
{"GstIndexAssociation", sizeof (GstIndexAssociation), 12}
,
{"GstIndexFactory", sizeof (GstIndexFactory), 64}
,
{"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 104}
,
{"GstDebugCategory", sizeof (GstDebugCategory), 16}
,
{"GstRealPad", sizeof (GstRealPad), 196}
,
{"GstRealPadClass", sizeof (GstRealPadClass), 168}
,
{"GstGhostPad", sizeof (GstGhostPad), 88}
,
{"GstGhostPadClass", sizeof (GstGhostPadClass), 152}
,
{"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 60}
,
{"GstPipeline", sizeof (GstPipeline), 180}
,
{"GstPipelineClass", sizeof (GstPipelineClass), 328}
,
{"GstPlugin", sizeof (GstPlugin), 92}
,
{"GstPluginDesc", sizeof (GstPluginDesc), 56}
,
{"GstPluginFeature", sizeof (GstPluginFeature), 40}
,
{"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 88}
,
{"GstProbe", sizeof (GstProbe), 12}
,
{"GstProbeDispatcher", sizeof (GstProbeDispatcher), 8}
,
{"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 12}
,
{"GstQueue", sizeof (GstQueue), 252}
,
{"GstQueueSize", sizeof (GstQueueSize), 16}
,
{"GstQueueClass", sizeof (GstQueueClass), 300}
,
{"GstRegistry", sizeof (GstRegistry), 56}
,
{"GstRegistryClass", sizeof (GstRegistryClass), 116}
,
{"GstSchedulerFactory", sizeof (GstSchedulerFactory), 64}
,
{"GstSchedulerFactoryClass", sizeof (GstSchedulerFactoryClass), 104}
,
{"GstStructure", sizeof (GstStructure), 28}
,
{"GstSystemClock", sizeof (GstSystemClock), 152}
,
{"GstSystemClockClass", sizeof (GstSystemClockClass), 188}
,
{"GstTagSetterIFace", sizeof (GstTagSetterIFace), 8}
,
{"GstThread", sizeof (GstThread), 196}
,
{"GstThreadClass", sizeof (GstThreadClass), 332}
,
{"GstTrace", sizeof (GstTrace), 20}
,
{"GstTraceEntry", sizeof (GstTraceEntry), 128}
,
{"GstAllocTrace", sizeof (GstAllocTrace), 16}
,
{"GstTrashStack", sizeof (GstTrashStack), 12}
,
{"GstTrashStackElement", sizeof (GstTrashStackElement), 4}
,
{"GstTypeFind", sizeof (GstTypeFind), 32}
,
{"GstTypeFindFactory", sizeof (GstTypeFindFactory), 72}
,
{"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 104}
,
{"GstObject", sizeof (GstObject), 44}
,
{"GstObjectClass", sizeof (GstObjectClass), 120}
,
{"GstPad", sizeof (GstPad), 68}
,
{"GstPadClass", sizeof (GstPadClass), 136}
,
{"GstPadTemplate", sizeof (GstPadTemplate), 76}
,
{"GstPadTemplateClass", sizeof (GstPadTemplateClass), 140}
,
{"GstElement", sizeof (GstElement), 124}
,
{"GstElementClass", sizeof (GstElementClass), 272}
,
{"GstBin", sizeof (GstBin), 164}
,
{"GstBinClass", sizeof (GstBinClass), 312}
,
{"GstScheduler", sizeof (GstScheduler), 92}
,
{"GstSchedulerClass", sizeof (GstSchedulerClass), 216}
,
{"GstEvent", sizeof (GstEvent), 176}
,
{"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 44}
,
{"GstValueTable", sizeof (GstValueTable), 32}
,
{"GstXML", sizeof (GstXML), 68}
,
{"GstXMLClass", sizeof (GstXMLClass), 144}
,
{NULL, 0, 0}
};

View file

@ -1,69 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <gst/gstqueue.h>
#include <gst/gsttrashstack.h>
#include <stdlib.h>
typedef struct
{
char *name;
int size;
int abi_size;
}
Struct;
#ifdef HAVE_CPU_I386
#include "struct_i386.h"
#define HAVE_ABI_SIZES
#else
/* in case someone wants to generate a new arch */
#include "struct_i386.h"
#endif
int
main (int argc, char *argv[])
{
int i;
if (argc > 1) {
g_print ("/* Generated by GStreamer-%s */\n", GST_VERSION);
g_print ("Struct list[] = {\n");
for (i = 0; list[i].name; i++) {
g_print (" { \"%s\", sizeof (%s), %d },\n",
list[i].name, list[i].name, list[i].size);
}
g_print (" { NULL, 0, 0}\n");
g_print ("};\n");
} else {
g_print ("Run './struct_size regen' to regenerate structs.h\n");
#ifdef HAVE_ABI_SIZES
{
gboolean ok = TRUE;
for (i = 0; list[i].name; i++) {
if (list[i].size != list[i].abi_size) {
ok = FALSE;
g_print ("sizeof(%s) is %d, expected %d\n",
list[i].name, list[i].size, list[i].abi_size);
}
}
if (ok) {
g_print ("All structures expected size\n");
} else {
g_print ("failed\n");
exit (1);
}
}
#else
g_print ("No structure size list was generated for this architecture\n");
g_print ("ignoring\n");
#endif
}
exit (0);
}

View file

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

View file

@ -1,5 +0,0 @@
include ../Rules
tests_pass = cache1 indexdump
tests_fail =
tests_ignore =

View file

@ -1,114 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
static void
lookup (GstIndex * index, GstIndexLookupMethod method,
GstFormat src_format, gint64 src_value,
GstFormat dest_format, gint64 expecting)
{
GstIndexEntry *entry;
gint64 result;
entry = gst_index_get_assoc_entry (index, 0, method, 0,
src_format, src_value);
if (entry) {
gst_index_entry_assoc_map (entry, dest_format, &result);
if (result == expecting) {
g_print ("OK (%" G_GINT64_FORMAT ")\n", result);
} else {
g_print ("FAIL - expecting %" G_GINT64_FORMAT ", got %" G_GINT64_FORMAT
"\n", expecting, result);
}
} else {
const GstFormatDefinition *def = gst_format_get_details (src_format);
if (expecting == -1)
g_print ("OK (not found)\n");
else
g_print ("FAIL - no index entry found for %" G_GINT64_FORMAT
" %s, expecting %" G_GINT64_FORMAT "\n", src_value, def->nick,
expecting);
}
}
typedef struct _GstIndexTestCase
{
GstIndexLookupMethod method;
GstFormat src_format;
gint64 src_value;
GstFormat dest_format;
gint64 expecting;
} GstIndexTestCase;
const static GstIndexTestCase cases[] = {
{GST_INDEX_LOOKUP_EXACT, GST_FORMAT_BYTES, 3, GST_FORMAT_TIME, 3000},
{GST_INDEX_LOOKUP_EXACT, GST_FORMAT_TIME, 5000, GST_FORMAT_BYTES, 5},
{GST_INDEX_LOOKUP_EXACT, GST_FORMAT_TIME, 5010, GST_FORMAT_BYTES, -1},
{GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, 5010, GST_FORMAT_BYTES, 5},
{GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, 5010, GST_FORMAT_BYTES, 6},
{GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, 0, GST_FORMAT_BYTES, 0},
{GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, G_MAXINT64, GST_FORMAT_BYTES, -1},
{GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, 0, GST_FORMAT_BYTES, 0},
{GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, -1, GST_FORMAT_BYTES, -1},
{GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, G_MAXINT64, GST_FORMAT_BYTES,
99999},
{GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, G_MAXINT64, GST_FORMAT_BYTES, -1},
};
gint
main (gint argc, gchar * argv[])
{
GstIndex *index;
GstElement *element;
gint i, id;
gst_init (&argc, &argv);
if (argc != 2) {
g_print ("usage: cache1 (memindex | fileindex)\n");
exit (0);
}
index = gst_index_factory_make (argv[1]);
g_assert (index != NULL);
element = gst_element_factory_make ("identity", "element");
g_assert (element != NULL);
gst_index_get_writer_id (index, GST_OBJECT (element), &id);
g_print ("Building index...\n");
for (i = 0; i < 100000; i++) {
gst_index_add_association (index, 0, 0, GST_FORMAT_BYTES, (gint64) i,
GST_FORMAT_TIME, (gint64) (i * 1000), 0);
}
g_print ("Testing index...\n");
for (i = 0; i < (sizeof (cases) / sizeof (GstIndexTestCase)); i++) {
lookup (index, cases[i].method, cases[i].src_format, cases[i].src_value,
cases[i].dest_format, cases[i].expecting);
}
return 0;
}

View file

@ -1,81 +0,0 @@
/* GStreamer
* Copyright (C) 2003 Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
static void
my_resolver (GstIndex * index, GstObject * _ign, gchar ** writer_string,
gpointer user_data)
{
*writer_string = user_data;
}
gint
main (gint argc, gchar * argv[])
{
GstIndex *index;
GstObject *identity;
gint id;
gint64 cur;
gst_init (&argc, &argv);
if (argc != 3) {
g_print ("usage: dumpfileindex /path/to/fileindex writer_id\n");
exit (0);
}
index = gst_index_factory_make ("fileindex");
g_assert (index != NULL);
g_object_set (index, "location", argv[1], NULL);
gst_index_set_resolver (index, (GstIndexResolver) my_resolver, argv[2]);
identity = (GstObject *) gst_element_factory_make ("identity", "element");
g_assert (identity);
gst_index_get_writer_id (index, identity, &id);
cur = 0;
while (1) {
gint fx;
GstIndexEntry *entry =
gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_AFTER, 0,
GST_FORMAT_TIME, cur);
if (!entry)
break;
g_print ("%x", GST_INDEX_ASSOC_FLAGS (entry));
for (fx = 0; fx < GST_INDEX_NASSOCS (entry); fx++) {
GstFormat fmt = GST_INDEX_ASSOC_FORMAT (entry, fx);
const GstFormatDefinition *def = gst_format_get_details (fmt);
if (fmt == GST_FORMAT_TIME) {
cur = GST_INDEX_ASSOC_VALUE (entry, fx) + 1;
g_print (" time %.4f",
GST_INDEX_ASSOC_VALUE (entry, fx) / (double) GST_SECOND);
} else
g_print (" %s %" G_GINT64_FORMAT, def->nick,
GST_INDEX_ASSOC_VALUE (entry, fx));
}
g_print ("\n");
}
return 0;
}

View file

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

View file

@ -1,5 +0,0 @@
include ../Rules
tests_pass = parse1 parse2
tests_fail =
tests_ignore =

View file

@ -1,229 +0,0 @@
/*
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* parse1.c: Test various parsing stuff
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
#include <string.h>
#include <unistd.h>
/* variables used by the TEST_* macros */
static gint test = 0;
static guint iterations;
static GstElement *cur = NULL;
static GError *error = NULL;
/* variables needed for checking */
static gint i;
static gboolean b;
static gchar *s;
#define TEST_CHECK_FAIL(condition) G_STMT_START{ \
if (condition) { \
g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
} else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
#condition); \
return -test; \
} \
}G_STMT_END
#define TEST_START(pipeline) G_STMT_START{ \
g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, \
pipeline); \
cur = gst_parse_launch (pipeline, &error); \
if (error == NULL) { \
g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
} else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
error->message); \
g_error_free (error); \
return -test; \
} \
}G_STMT_END
#define TEST_OK G_STMT_START{ \
gst_object_unref (cur); \
cur = NULL; \
g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
}G_STMT_END
#define TEST_RUN G_STMT_START{ \
alarm(10); \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
if (gst_element_set_state (cur, GST_STATE_PLAYING) \
== GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be set to PLAYING\n", test, __LINE__); \
return -test; \
} \
iterations = 0; \
while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
if (gst_element_set_state (cur, GST_STATE_NULL) \
== GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \
} \
g_print ("TEST %2d line %3d STOPPED : %u iterations\n", \
test, __LINE__, iterations); \
alarm(0); \
}G_STMT_END
#define PIPELINE1 "fakesrc"
#define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data"
#define PIPELINE3 "fakesrc identity fakesink"
#define PIPELINE4 "fakesrc num-buffers=4 .src ! identity !.sink identity .src ! .sink fakesink"
#define PIPELINE5 "fakesrc num-buffers=4 name=src identity name=id1 identity name = id2 fakesink name =sink src. ! id1. id1.! id2.sink id2.src!sink.sink"
#define PIPELINE6 "pipeline.(name=\"john\" fakesrc num-buffers=4 ( thread. ( ! queue ! identity !{ queue ! fakesink }) ))"
#define PIPELINE7 "fakesrc num-buffers=4 ! tee name=tee .src%d! fakesink tee.src%d ! fakesink fakesink name =\"foo\" tee.src%d ! foo."
/* aggregator is borked
#define PIPELINE8 "fakesrc num-buffers=4 ! tee name=tee1 .src0,src1 ! .sink0, sink1 aggregator ! fakesink"
*/
#define PIPELINE8 "fakesrc num-buffers=4 ! fakesink"
#define PIPELINE9 "fakesrc num-buffers=4 ! test. fakesink name=test"
#define PIPELINE10 "( fakesrc num-buffers=\"4\" ! ) identity ! fakesink"
#define PIPELINE11 "fakesink name = sink identity name=id ( fakesrc num-buffers=\"4\" ! id. ) id. ! sink."
#define PIPELINE12 "fakesrc num-buffers=4 name=a:b a:b. ! fakesink"
gint
main (gint argc, gchar * argv[])
{
gst_init (&argc, &argv);
/**
* checks:
* - specifying an element works :)
* - if only 1 element is requested, no bin is returned, but the element
*/
TEST_START (PIPELINE1);
TEST_CHECK_FAIL (G_OBJECT_TYPE (cur) == g_type_from_name ("GstFakeSrc"));
TEST_OK;
/**
* checks:
* - properties works
* - string, int, boolean and enums can be properly set
* (note: eos should be false)
* - first test of escaping strings
*/
TEST_START (PIPELINE2);
g_object_get (G_OBJECT (cur), "name", &s, "num-buffers", &i, "silent", &b,
NULL);
TEST_CHECK_FAIL (strcmp (s, "donald") == 0);
TEST_CHECK_FAIL (i == 27);
TEST_CHECK_FAIL (b == TRUE);
g_object_get (G_OBJECT (cur), "eos", &b, "sizetype", &i, NULL);
TEST_CHECK_FAIL (i == 3);
TEST_CHECK_FAIL (b == FALSE);
g_object_get (G_OBJECT (cur), "data", &i, NULL);
TEST_CHECK_FAIL (i == 2);
TEST_OK;
/**
* checks:
* - specifying multiple elements without links works
* - if multiple toplevel elements exist, a pipeline is returned
*/
TEST_START (PIPELINE3);
TEST_CHECK_FAIL (GST_BIN (cur)->numchildren == 3); /* a bit hacky here */
TEST_CHECK_FAIL (GST_IS_PIPELINE (cur));
TEST_OK;
/**
* checks:
* - test default link "!"
* - test if specifying pads on links works
*/
TEST_START (PIPELINE4);
TEST_RUN;
TEST_OK;
/**
* checks:
* - test if appending the links works, too
* - check if the pipeline constructed works the same as the one before (how?)
*/
TEST_START (PIPELINE5);
TEST_RUN;
TEST_OK;
/**
* checks:
* - test various types of bins
* - test if linking across bins works
* - test if escaping strings works
*/
TEST_START (PIPELINE6);
TEST_CHECK_FAIL (GST_IS_PIPELINE (cur));
g_object_get (G_OBJECT (cur), "name", &s, NULL);
TEST_CHECK_FAIL (strcmp (s, "john") == 0);
TEST_RUN;
TEST_OK;
/**
* checks:
* - test request pads
*/
TEST_START (PIPELINE7);
TEST_RUN;
TEST_OK;
/**
* checks:
* - multiple pads on 1 link
*/
TEST_START (PIPELINE8);
TEST_RUN;
TEST_OK;
/**
* checks:
* - failed in grammar.y cvs version 1.17
*/
TEST_START (PIPELINE9);
TEST_RUN;
TEST_OK;
/**
* checks:
* - failed in grammar.y cvs version 1.17
*/
TEST_START (PIPELINE10);
TEST_RUN;
TEST_OK;
/**
* checks:
* - failed in grammar.y cvs version 1.18
*/
TEST_START (PIPELINE11);
TEST_RUN;
TEST_OK;
/**
* checks:
* - fails because a:b. is not a valid element reference in parse.l cvs rev 1.29
*/
TEST_START (PIPELINE12);
TEST_RUN;
TEST_OK;
return 0;
}

View file

@ -1,212 +0,0 @@
/*
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* parse1.c: Test common pipelines (need various plugins)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gst/gst.h>
#include <string.h>
/* variables used by the TEST_* macros */
static gint test = 0;
static guint iterations;
static GstElement *cur = NULL;
static GError *error = NULL;
static char *audio_file = NULL;
static char *video_file = NULL;
/* variables needed for checking */
#define TEST_CHECK_FAIL(condition) G_STMT_START{ \
if (condition) { \
g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
} else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, #condition); \
return -test; \
} \
}G_STMT_END
#ifdef G_HAVE_ISO_VARARGS
#define TEST_START(...) G_STMT_START{ \
gchar *pipeline = g_strdup_printf (__VA_ARGS__); \
g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \
cur = gst_parse_launch (pipeline, &error); \
if (error == NULL) { \
g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
} else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \
g_error_free (error); \
return -test; \
} \
g_free (pipeline); \
}G_STMT_END
#elif defined(G_HAVE_GNUC_VARARGS)
#define TEST_START(pipe...) G_STMT_START{ \
gchar *pipeline = g_strdup_printf ( ## pipe ); \
g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \
cur = gst_parse_launch (pipeline, &error); \
if (error == NULL) { \
g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
} else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \
g_error_free (error); \
return -test; \
} \
g_free (pipeline); \
}G_STMT_END
#else
#error Please fix this macro here
#define TEST_START(pipe...) G_STMT_START{ \
gchar *pipeline = g_strdup_printf (__VA_ARGS__); \
g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \
cur = gst_parse_launch (pipeline, &error); \
if (error == NULL) { \
g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
} else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \
g_error_free (error); \
return -test; \
} \
g_free (pipeline); \
}G_STMT_END
#endif
#define TEST_OK G_STMT_START{ \
gst_object_unref (cur); \
cur = NULL; \
g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
}G_STMT_END
#define TEST_RUN(iters) G_STMT_START{ \
gint it = iters; \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \
return -test; \
} \
iterations = 0; \
while (gst_bin_iterate (GST_BIN (cur)) && it != 0) { \
iterations++; \
it--; \
} \
if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \
} \
g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \
}G_STMT_END
#define TEST_FINISH G_STMT_START{ \
g_print("\n"); \
g_print("To run this test there are things required that you do not have. (see above)\n"); \
g_print("Please correct the above mentioned problem if you want to run this test.\n"); \
g_print("Currently the following tests will be ignored.\n"); \
g_print("\n"); \
exit (0); \
}G_STMT_END
#define TEST_REQUIRE(condition, error) G_STMT_START{ \
if (condition) { \
g_print ("REQUIRE line %3d OK\n", __LINE__); \
} else { \
g_print ("REQUIRE line %3d EXIT : %s\n", __LINE__, (error)); \
TEST_FINISH; \
} \
}G_STMT_END
#define TEST_REQUIRE_ELEMENT(element_name) G_STMT_START{ \
GstElement *element = gst_element_factory_make ((element_name), NULL); \
if (element) { \
g_print ("REQUIRE line %3d OK\n", __LINE__); \
gst_object_unref (element); \
} else { \
g_print ("REQUIRE line %3d EXIT : No element of type \"%s\" available. Exiting.\n", __LINE__, (element_name)); \
TEST_FINISH; \
} \
}G_STMT_END
#define PIPELINE1 "filesrc blocksize =8192 location=%s ! mad ! osssink"
#define PIPELINE2 "filesrc location=%s ! mpegdemux ! mpeg2dec ! xvimagesink"
#define PIPELINE3 "filesrc location=%s ! mpegdemux name = demux ! mpeg2dec ! { queue ! xvimagesink } demux.audio_00 ! mad ! osssink"
#define PIPELINE4 "pipeline. ( { filesrc location=%s ! spider name=spider ! { queue ! volume ! ( tee name=tee ! { queue ! ( goom ) ! colorspace ! ( xvimagesink ) } tee. ! { queue ! ( osssink ) } ) } spider. ! { queue ! colorspace ( xvimagesink ) } } )"
#define PIPELINE5 "pipeline. ( { filesrc location=%s ! spider name=spider ! ( tee name=tee ! { queue ! spider ! ( goom ) ! colorspace ! ( xvimagesink ) } tee. ! { queue ! volume ! ( osssink ) } ) spider. ! { queue! colorspace ( xvimagesink ) } } )"
/* FIXME: Should this run, too?
#define PIPELINE3 "filesrc location=%s ! mpegdemux name = demux ! mpeg2dec ! { queue ! xvimagesink } demux.audio_%%02d ! mad ! osssink"
*/
gint
main (gint argc, gchar * argv[])
{
gst_init (&argc, &argv);
goto here;
here:
/**
* checks:
* - default playback pipeline
* - unsigned parameters
*/
audio_file = g_build_filename (g_get_home_dir (), "music.mp3", NULL);
TEST_REQUIRE (g_file_test (audio_file, G_FILE_TEST_EXISTS),
"The following tests requires a valid mp3 file music.mp3 in your home directory.");
TEST_REQUIRE_ELEMENT ("mad");
TEST_REQUIRE_ELEMENT ("osssink");
TEST_START (PIPELINE1, audio_file);
TEST_RUN (10);
TEST_OK;
/**
* checks:
* - default video playback pipeline (without audio)
* - SOMETIMES pads
*/
video_file = g_build_filename (g_get_home_dir (), "video.mpeg", NULL);
TEST_REQUIRE (g_file_test (video_file, G_FILE_TEST_EXISTS),
"The following tests requires a valid mpeg file video.mpeg in your home directory.");
TEST_REQUIRE_ELEMENT ("mpegdemux");
TEST_REQUIRE_ELEMENT ("mpeg2dec");
TEST_REQUIRE_ELEMENT ("xvimagesink");
TEST_START (PIPELINE2, video_file);
TEST_RUN (50);
TEST_OK;
/**
* checks:
* - default video playback pipeline (with audio)
* - more SOMETIMES pads
*/
TEST_START (PIPELINE3, video_file);
TEST_RUN (200);
TEST_OK;
/**
* checks:
* - default new gst-player pipeline
*/
TEST_START (PIPELINE4, video_file);
TEST_RUN (500);
TEST_OK;
/**
* checks:
* - default old gst-player pipeline
*/
TEST_START (PIPELINE5, video_file);
TEST_RUN (500);
TEST_OK;
g_free (audio_file);
g_free (video_file);
return 0;
}

Some files were not shown because too many files have changed in this diff Show more