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 334f669..84b4633 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 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:
          update for version
 
index f74c531..1c0e4e6 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 8abf238..2012bb2 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 a08128d..25c625e 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;