Extract the manual examples again like we used to do.
authorThomas Vander Stichele <thomas@apestaart.org>
Sat, 16 Sep 2006 10:49:47 +0000 (10:49 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Sat, 16 Sep 2006 10:49:47 +0000 (10:49 +0000)
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.

ChangeLog
configure.ac
docs/manual/advanced-autoplugging.xml
tests/examples/Makefile.am
tests/examples/manual/.gitignore [new file with mode: 0644]
tests/examples/manual/Makefile.am [new file with mode: 0644]
tests/examples/manual/extract.pl [new file with mode: 0755]

index 334f66951791c2266e7ac4808edc35f13a83fa3d..84b4633a3b27055b4a467ffaaf249aa02670544d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index f74c531984e73174c85c74e06412a51aaf4e2d7e..1c0e4e6182f5f95f033515844e5dec2ae6a27c17 100644 (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
index 8abf2383295e56373733d16b4e2dd4e4ceada161..2012bb223d99f264c8e0cabebee11feb00846b74 100644 (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;
 
index a08128df058cea0e3cb43a552f0cc64c15fbe961..25c625e8393de9cab9df3c699988a22d9423d23e 100644 (file)
@@ -13,6 +13,7 @@ endif
 always_dirs = \
        controller                      \
        helloworld                      \
+       manual                          \
        metadata                        \
        queue
 
diff --git a/tests/examples/manual/.gitignore b/tests/examples/manual/.gitignore
new file mode 100644 (file)
index 0000000..5ad13ef
--- /dev/null
@@ -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
diff --git a/tests/examples/manual/Makefile.am b/tests/examples/manual/Makefile.am
new file mode 100644 (file)
index 0000000..a058858
--- /dev/null
@@ -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)
diff --git a/tests/examples/manual/extract.pl b/tests/examples/manual/extract.pl
new file mode 100755 (executable)
index 0000000..5c257c7
--- /dev/null
@@ -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;