Extract the manual examples again like we used to do.

Original commit message from CVS:
* configure.ac:
* docs/manual/advanced-autoplugging.xml:
* tests/examples/Makefile.am:
* tests/examples/manual/.cvsignore:
* tests/examples/manual/Makefile.am:
* tests/examples/manual/extract.pl:
Extract the manual examples again like we used to do.
Fix one of them.
This commit is contained in:
Thomas Vander Stichele 2006-09-16 10:49:47 +00:00
parent ec7655a542
commit 147373d4a7
7 changed files with 222 additions and 1 deletions

View file

@ -1,3 +1,14 @@
2006-09-16 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac:
* docs/manual/advanced-autoplugging.xml:
* tests/examples/Makefile.am:
* tests/examples/manual/.cvsignore:
* tests/examples/manual/Makefile.am:
* tests/examples/manual/extract.pl:
Extract the manual examples again like we used to do.
Fix one of them.
2006-09-16 Thomas Vander Stichele <thomas at apestaart dot org>
* win32/common/config.h:

View file

@ -488,6 +488,7 @@ tests/examples/Makefile
tests/examples/controller/Makefile
tests/examples/helloworld/Makefile
tests/examples/launch/Makefile
tests/examples/manual/Makefile
tests/examples/metadata/Makefile
tests/examples/queue/Makefile
tests/examples/typefind/Makefile

View file

@ -306,7 +306,8 @@ static void
init_factories (void)
{
/* first filter out the interesting element factories */
factories = gst_registry_pool_feature_filter (
factories = gst_registry_feature_filter (
gst_registry_get_default (),
(GstPluginFeatureFilter) cb_feature_filter, FALSE, NULL);
/* sort them according to their ranks */
@ -547,6 +548,7 @@ main (gint argc,
{
GMainLoop *loop;
GstElement *typefind, *realsink;
GstBus *bus;
GError *err = NULL;
gchar *p;

View file

@ -13,6 +13,7 @@ endif
always_dirs = \
controller \
helloworld \
manual \
metadata \
queue

39
tests/examples/manual/.gitignore vendored Normal file
View file

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

View file

@ -0,0 +1,89 @@
# 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)
# gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
# gnome_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS)
EXTRA_DIST = extract.pl
EXAMPLES = \
dynamic \
$(GNOME) \
elementcreate \
elementmake \
elementfactory \
elementget \
elementlink \
bin \
pad \
ghostpad \
helloworld \
init \
query \
typefind \
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
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: $(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
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
TESTS = bin \
elementcreate elementfactory elementget elementlink elementmake \
ghostpad init
noinst_PROGRAMS = $(EXAMPLES)
LDADD = $(GST_OBJ_LIBS)

View file

@ -0,0 +1,78 @@
#!/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;