diff --git a/ChangeLog b/ChangeLog index d0115d5c44..b111d5d913 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-12-15 Thomas Vander Stichele + + * docs/manual/dynamic.xml: + * docs/manual/elements-api.xml: + * docs/manual/gnome.xml: + * docs/manual/helloworld2.xml: + * docs/manual/init-api.xml: + * docs/manual/queues.xml: + * docs/manual/threads.xml: + * docs/manual/xml.xml: + * examples/manual/extract.pl: + Make it possible to extract example code from separate blocks. + Should make Ronald happy. + 2004-12-15 Wim Taymans * gst/schedulers/gstoptimalscheduler.c: (add_to_group), @@ -215,8 +229,8 @@ 2004-11-29 Stefan Kost * docs/manual/programs.xml: - Added a first batch of gst-launch examples, as provided by Ronald - and others from the devel-mlist + Added a first batch of gst-launch examples, as provided by Ronald + and others from the devel-mlist 2004-11-28 Benjamin Otte @@ -368,7 +382,7 @@ * testsuite/schedulers/.cvsignore: * testsuite/schedulers/Makefile.am: * testsuite/schedulers/queue_link.c: (main): - Added testcase for schduler segfault. + Added testcase for scheduler segfault. Fix scheduler segfault when removing a decoupled entry point as the last element from a group. @@ -402,7 +416,7 @@ * docs/gst/tmpl/gstutils.sgml: * docs/random/ensonic/interfaces.txt: * gst/gstinfo.h: - added some more docs, removed two obsolete defines + added some more docs, removed two obsolete defines 2004-11-02 Kjartan Maraas @@ -438,7 +452,7 @@ * gst/schedulers/gstoptimalscheduler.c: (add_to_group), (gst_opt_scheduler_iterate): - Aplied patch #154061. Running a pipeline in which an element + Applied patch #154061. Running a pipeline in which an element calls GST_ELEMENT_ERROR in the chain function, the opt scheduler doesn't unref the chain so it never gets freed. @@ -472,7 +486,7 @@ 2004-10-22 Stefan Kost * docs/pwg/building-boiler.xml: - exchanged GTK_ macros with G_TYPE macros (as pointed out by mathrick) + exchanged GTK_ macros with G_TYPE macros (as pointed out by mathrick) 2004-10-19 Wim Taymans diff --git a/docs/manual/advanced-threads.xml b/docs/manual/advanced-threads.xml index 05ea3cd8d1..0f19d74d2b 100644 --- a/docs/manual/advanced-threads.xml +++ b/docs/manual/advanced-threads.xml @@ -82,8 +82,9 @@ -/* example-begin threads.c */ -#include <gst/gst.h> + + /* we set this to TRUE right before gst_main (), but there could still be a race condition between setting it and entering the function */ @@ -161,7 +162,8 @@ main (int argc, char *argv[]) exit (0); } -/* example-end threads.c */ +]]> + diff --git a/docs/manual/appendix-gnome.xml b/docs/manual/appendix-gnome.xml index b2445cc2f0..44462b30ab 100644 --- a/docs/manual/appendix-gnome.xml +++ b/docs/manual/appendix-gnome.xml @@ -23,9 +23,10 @@ -/* example-begin gnome.c */ -#include <gnome.h> -#include <gst/gst.h> + + +#include int main (int argc, char **argv) @@ -78,7 +79,8 @@ main (int argc, char **argv) return 0; } -/* example-end gnome.c */ +]]> + If you try out this program, you will see that when called with diff --git a/docs/manual/appendix-integration.xml b/docs/manual/appendix-integration.xml index b2445cc2f0..44462b30ab 100644 --- a/docs/manual/appendix-integration.xml +++ b/docs/manual/appendix-integration.xml @@ -23,9 +23,10 @@ -/* example-begin gnome.c */ -#include <gnome.h> -#include <gst/gst.h> + + +#include int main (int argc, char **argv) @@ -78,7 +79,8 @@ main (int argc, char **argv) return 0; } -/* example-end gnome.c */ +]]> + If you try out this program, you will see that when called with diff --git a/docs/manual/basics-init.xml b/docs/manual/basics-init.xml index 054b7b5198..d47d1d186a 100644 --- a/docs/manual/basics-init.xml +++ b/docs/manual/basics-init.xml @@ -19,9 +19,8 @@ + int @@ -37,8 +36,8 @@ main (int argc, char *argv[]) return 0; } -/* example-end init.c */ ]]> + Use the GST_VERSION_MAJOR, @@ -60,9 +59,9 @@ You can also use a popt table to initialize your own parameters as shown in the next example: -/* example-begin popt.c */ - -#include <gst/gst.h> + + int main(int argc, char *argv[]) @@ -83,7 +82,9 @@ main(int argc, char *argv[]) return 0; } -/* example-end popt.c */ +]]> + + As shown in this fragment, you can use a - -/* example-begin dynamic.c */ -#include <string.h> -#include <gst/gst.h> + + +#include void eof (GstElement *src) @@ -164,7 +164,8 @@ main (int argc, char *argv[]) return 0; } -/* example-end dynamic.c */ +]]> + We create two elements: a file source and an MPEG demuxer. diff --git a/docs/manual/elements-api.xml b/docs/manual/elements-api.xml index c9c80fe1f3..236e6d86dd 100644 --- a/docs/manual/elements-api.xml +++ b/docs/manual/elements-api.xml @@ -31,8 +31,8 @@ The following example &EXAFOOT; shows how to create an element named After checking, it unrefs the element. + @@ -44,7 +44,11 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); element = gst_element_factory_make ("fakesrc", "source"); +]]> + + + + gst_element_factory_make is actually a shorthand @@ -121,9 +124,8 @@ will use the element factory to create an element with the given name. GObject property mechanism as shown below. + int @@ -143,9 +145,8 @@ main (int argc, char *argv[]) return 0; } - -/* example-end elementget.c */ ]]> + Most plugins provide additional properties to provide more information diff --git a/docs/manual/gnome.xml b/docs/manual/gnome.xml index b2445cc2f0..44462b30ab 100644 --- a/docs/manual/gnome.xml +++ b/docs/manual/gnome.xml @@ -23,9 +23,10 @@ -/* example-begin gnome.c */ -#include <gnome.h> -#include <gst/gst.h> + + +#include int main (int argc, char **argv) @@ -78,7 +79,8 @@ main (int argc, char **argv) return 0; } -/* example-end gnome.c */ +]]> + If you try out this program, you will see that when called with diff --git a/docs/manual/helloworld2.xml b/docs/manual/helloworld2.xml index 6f76885b9f..7d296607b6 100644 --- a/docs/manual/helloworld2.xml +++ b/docs/manual/helloworld2.xml @@ -20,8 +20,9 @@ -/* example-begin helloworld2.c */ -#include <gst/gst.h> + + static void gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline); static void gst_play_cache_empty (GstElement *element, GstElement *pipeline); @@ -156,7 +157,8 @@ main (int argc, char *argv[]) exit(0); } -/* example-end helloworld2.c */ +]]> + We start by constructing a 'filesrc' element and an 'autobin' element that diff --git a/docs/manual/highlevel-xml.xml b/docs/manual/highlevel-xml.xml index cd0104163f..e3e01bf76a 100644 --- a/docs/manual/highlevel-xml.xml +++ b/docs/manual/highlevel-xml.xml @@ -24,9 +24,11 @@ -/* example-begin xml-mp3.c */ -#include <stdlib.h> -#include <gst/gst.h> + + + +#include gboolean playing; @@ -88,7 +90,8 @@ main (int argc, char *argv[]) exit (0); } -/* example-end xml-mp3.c */ +]]> + The most important line is: diff --git a/docs/manual/init-api.xml b/docs/manual/init-api.xml index 054b7b5198..d47d1d186a 100644 --- a/docs/manual/init-api.xml +++ b/docs/manual/init-api.xml @@ -19,9 +19,8 @@ + int @@ -37,8 +36,8 @@ main (int argc, char *argv[]) return 0; } -/* example-end init.c */ ]]> + Use the GST_VERSION_MAJOR, @@ -60,9 +59,9 @@ You can also use a popt table to initialize your own parameters as shown in the next example: -/* example-begin popt.c */ - -#include <gst/gst.h> + + int main(int argc, char *argv[]) @@ -83,7 +82,9 @@ main(int argc, char *argv[]) return 0; } -/* example-end popt.c */ +]]> + + As shown in this fragment, you can use a -/* example-begin queue.c */ -#include <stdlib.h> -#include <gst/gst.h> + + +#include gboolean playing; @@ -121,9 +122,7 @@ main (int argc, char *argv[]) return 0; } -/* example-end queue.c */ +]]> + - - - diff --git a/docs/manual/threads.xml b/docs/manual/threads.xml index 05ea3cd8d1..0f19d74d2b 100644 --- a/docs/manual/threads.xml +++ b/docs/manual/threads.xml @@ -82,8 +82,9 @@ -/* example-begin threads.c */ -#include <gst/gst.h> + + /* we set this to TRUE right before gst_main (), but there could still be a race condition between setting it and entering the function */ @@ -161,7 +162,8 @@ main (int argc, char *argv[]) exit (0); } -/* example-end threads.c */ +]]> + diff --git a/docs/manual/xml.xml b/docs/manual/xml.xml index cd0104163f..e3e01bf76a 100644 --- a/docs/manual/xml.xml +++ b/docs/manual/xml.xml @@ -24,9 +24,11 @@ -/* example-begin xml-mp3.c */ -#include <stdlib.h> -#include <gst/gst.h> + + + +#include gboolean playing; @@ -88,7 +90,8 @@ main (int argc, char *argv[]) exit (0); } -/* example-end xml-mp3.c */ +]]> + The most important line is: diff --git a/examples/manual/extract.pl b/examples/manual/extract.pl index 578357d28b..3a0a9afa7f 100755 --- a/examples/manual/extract.pl +++ b/examples/manual/extract.pl @@ -7,6 +7,10 @@ # main # decodes xml by translating & < > back to what they should be +# and also ignore +# sub xml_decode ($) { @@ -16,6 +20,10 @@ xml_decode ($) $input =~ s/<//g; + if ($input =~ //) { $input = ""; } + + #print "Returning line $input"; return $input; } @@ -23,6 +31,7 @@ xml_decode ($) my $output = shift @ARGV; $found = 0; +%blocks = (); foreach $file (@ARGV) { @@ -30,31 +39,40 @@ foreach $file (@ARGV) while ($line = ) { - if ($line =~ /\/\* example-begin $output \*\//) + if ($line =~ //) { - print "Extracting $output from $file\n"; $found = 1; - open OUTPUT, ">$output"; - print OUTPUT xml_decode ($line); - my $example = 1; - while (($line = ) && $example) + $block_id = $1; + $block = "\n/*** block $block_id from $file ***/\n"; + + print "Extracting $output block $block_id from $file\n"; + + while ($line = ) { - if ($line =~ /\/\* example-end/) + if ($line =~ //) { - print OUTPUT xml_decode ($line); - close OUTPUT; - $example = 0; - } - else - { - print OUTPUT xml_decode ($line); + 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 block with id $block_id\n"; + print OUTPUT $blocks{$block_id}; +} +close OUTPUT; diff --git a/tests/old/examples/manual/extract.pl b/tests/old/examples/manual/extract.pl index 578357d28b..3a0a9afa7f 100755 --- a/tests/old/examples/manual/extract.pl +++ b/tests/old/examples/manual/extract.pl @@ -7,6 +7,10 @@ # main # decodes xml by translating & < > back to what they should be +# and also ignore +# sub xml_decode ($) { @@ -16,6 +20,10 @@ xml_decode ($) $input =~ s/<//g; + if ($input =~ //) { $input = ""; } + + #print "Returning line $input"; return $input; } @@ -23,6 +31,7 @@ xml_decode ($) my $output = shift @ARGV; $found = 0; +%blocks = (); foreach $file (@ARGV) { @@ -30,31 +39,40 @@ foreach $file (@ARGV) while ($line = ) { - if ($line =~ /\/\* example-begin $output \*\//) + if ($line =~ //) { - print "Extracting $output from $file\n"; $found = 1; - open OUTPUT, ">$output"; - print OUTPUT xml_decode ($line); - my $example = 1; - while (($line = ) && $example) + $block_id = $1; + $block = "\n/*** block $block_id from $file ***/\n"; + + print "Extracting $output block $block_id from $file\n"; + + while ($line = ) { - if ($line =~ /\/\* example-end/) + if ($line =~ //) { - print OUTPUT xml_decode ($line); - close OUTPUT; - $example = 0; - } - else - { - print OUTPUT xml_decode ($line); + 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 block with id $block_id\n"; + print OUTPUT $blocks{$block_id}; +} +close OUTPUT;