+2004-12-15 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * 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 <wim@fluendo.com>
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
2004-11-29 Stefan Kost <ensonic@users.sf.net>
* 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 <otte@gnome.org>
* 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.
* 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 <as at gnome.org>
* 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.
2004-10-22 Stefan Kost <ensonic@users.sf.net>
* 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 <wim at fluendo dot com>
<para>
<programlisting>
-/* example-begin threads.c */
-#include <gst/gst.h>
+<!-- example-begin threads.c a -->
+<![CDATA[
+#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 */
exit (0);
}
-/* example-end threads.c */
+]]>
+<!-- example-end threads.c a -->
</programlisting>
</para>
</sect1>
</para>
<programlisting>
-/* example-begin gnome.c */
-#include <gnome.h>
-#include <gst/gst.h>
+<!-- example-begin gnome.c a -->
+<![CDATA[
+#include <gnome.h>
+#include <gst/gst.h>
int
main (int argc, char **argv)
return 0;
}
-/* example-end gnome.c */
+]]>
+<!-- example-end gnome.c a -->
</programlisting>
<para>
If you try out this program, you will see that when called with
</para>
<programlisting>
-/* example-begin gnome.c */
-#include <gnome.h>
-#include <gst/gst.h>
+<!-- example-begin gnome.c a -->
+<![CDATA[
+#include <gnome.h>
+#include <gst/gst.h>
int
main (int argc, char **argv)
return 0;
}
-/* example-end gnome.c */
+]]>
+<!-- example-end gnome.c a -->
</programlisting>
<para>
If you try out this program, you will see that when called with
</para>
<programlisting>
+<!-- example-begin init.c a -->
<![CDATA[
-/* example-begin init.c */
-
#include <gst/gst.h>
int
return 0;
}
-/* example-end init.c */
]]>
+<!-- example-end init.c a -->
</programlisting>
<para>
Use the <symbol>GST_VERSION_MAJOR</symbol>,
next example:
</para>
<programlisting>
-/* example-begin popt.c */
-
-#include <gst/gst.h>
+<!-- example-begin popt.c a -->
+<![CDATA[
+#include <gst/gst.h>
int
main(int argc, char *argv[])
return 0;
}
-/* example-end popt.c */
+]]>
+<!-- example-end popt.c a -->
+
</programlisting>
<para>
As shown in this fragment, you can use a <ulink
We'll start with a simple main function:
</para>
<programlisting>
-
-/* example-begin dynamic.c */
-#include <string.h>
-#include <gst/gst.h>
+<!-- example-begin dynamic.c a -->
+<![CDATA[
+#include <string.h>
+#include <gst/gst.h>
void
eof (GstElement *src)
return 0;
}
-/* example-end dynamic.c */
+]]>
+<!-- example-end dynamic.c a -->
</programlisting>
<para>
We create two elements: a file source and an MPEG demuxer.
After checking, it unrefs the element.
</para>
<programlisting>
+<!-- example-begin elementmake.c a -->
<![CDATA[
-/* example-begin elementmake.c */
#include <gst/gst.h>
gst_init (&argc, &argv);
element = gst_element_factory_make ("fakesrc", "source");
+]]>
+<!-- example-end elementmake.c a -->
+<!-- example-begin elementmake.c b -->
+<![CDATA[
if (!element) {
g_error ("Could not create an element from 'fakesrc' factory.\n");
}
return 0;
}
-
-/* example-end elementmake.c */
]]>
+<!-- example-end elementmake.c b -->
</programlisting>
<para>
<function>gst_element_factory_make</function> is actually a shorthand
<classname>GObject</classname> property mechanism as shown below.
</para>
<programlisting>
+<!-- example-begin elementget.c a -->
<![CDATA[
-/* example-begin elementget.c */
-
#include <gst/gst.h>
int
return 0;
}
-
-/* example-end elementget.c */
]]>
+<!-- example-end elementget.c a -->
</programlisting>
<para>
Most plugins provide additional properties to provide more information
</para>
<programlisting>
-/* example-begin gnome.c */
-#include <gnome.h>
-#include <gst/gst.h>
+<!-- example-begin gnome.c a -->
+<![CDATA[
+#include <gnome.h>
+#include <gst/gst.h>
int
main (int argc, char **argv)
return 0;
}
-/* example-end gnome.c */
+]]>
+<!-- example-end gnome.c a -->
</programlisting>
<para>
If you try out this program, you will see that when called with
</para>
<programlisting>
-/* example-begin helloworld2.c */
-#include <gst/gst.h>
+<!-- example-begin helloworld2.c a -->
+<![CDATA[
+#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);
exit(0);
}
-/* example-end helloworld2.c */
+]]>
+<!-- example-end helloworld2.c a -->
</programlisting>
<para>
We start by constructing a 'filesrc' element and an 'autobin' element that
</para>
<programlisting>
-/* example-begin xml-mp3.c */
-#include <stdlib.h>
-#include <gst/gst.h>
+
+<!-- example-begin xml-mp3.c a -->
+<![CDATA[
+#include <stdlib.h>
+#include <gst/gst.h>
gboolean playing;
exit (0);
}
-/* example-end xml-mp3.c */
+]]>
+<!-- example-end xml-mp3.c a -->
</programlisting>
<para>
The most important line is:
</para>
<programlisting>
+<!-- example-begin init.c a -->
<![CDATA[
-/* example-begin init.c */
-
#include <gst/gst.h>
int
return 0;
}
-/* example-end init.c */
]]>
+<!-- example-end init.c a -->
</programlisting>
<para>
Use the <symbol>GST_VERSION_MAJOR</symbol>,
next example:
</para>
<programlisting>
-/* example-begin popt.c */
-
-#include <gst/gst.h>
+<!-- example-begin popt.c a -->
+<![CDATA[
+#include <gst/gst.h>
int
main(int argc, char *argv[])
return 0;
}
-/* example-end popt.c */
+]]>
+<!-- example-end popt.c a -->
+
</programlisting>
<para>
As shown in this fragment, you can use a <ulink
</para>
<programlisting>
-/* example-begin queue.c */
-#include <stdlib.h>
-#include <gst/gst.h>
+<!-- example-begin queue.c a -->
+<![CDATA[
+#include <stdlib.h>
+#include <gst/gst.h>
gboolean playing;
return 0;
}
-/* example-end queue.c */
+]]>
+<!-- example-end queue.c a -->
</programlisting>
-
-
-
</chapter>
<para>
<programlisting>
-/* example-begin threads.c */
-#include <gst/gst.h>
+<!-- example-begin threads.c a -->
+<![CDATA[
+#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 */
exit (0);
}
-/* example-end threads.c */
+]]>
+<!-- example-end threads.c a -->
</programlisting>
</para>
</sect1>
</para>
<programlisting>
-/* example-begin xml-mp3.c */
-#include <stdlib.h>
-#include <gst/gst.h>
+
+<!-- example-begin xml-mp3.c a -->
+<![CDATA[
+#include <stdlib.h>
+#include <gst/gst.h>
gboolean playing;
exit (0);
}
-/* example-end xml-mp3.c */
+]]>
+<!-- example-end xml-mp3.c a -->
</programlisting>
<para>
The most important line is:
# main
# decodes xml by translating & < > back to what they should be
+# and also ignore
+# <![CDATA[
+# and
+# ]]>
sub
xml_decode ($)
{
$input =~ s/</</g;
$input =~ s/>/>/g;
+ if ($input =~ /<!\[CDATA\[/) { $input = ""; }
+ if ($input =~ /]]>/) { $input = ""; }
+
+ #print "Returning line $input";
return $input;
}
my $output = shift @ARGV;
$found = 0;
+%blocks = ();
foreach $file (@ARGV)
{
while ($line = <FILE>)
{
- if ($line =~ /\/\* example-begin $output \*\//)
+ if ($line =~ /<!-- example-begin $output (.*) -->/)
{
- print "Extracting $output from $file\n";
$found = 1;
- open OUTPUT, ">$output";
- print OUTPUT xml_decode ($line);
- my $example = 1;
- while (($line = <FILE>) && $example)
+ $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/)
- {
- print OUTPUT xml_decode ($line);
- close OUTPUT;
- $example = 0;
- }
- else
+ if ($line =~ /<!-- example-end $output (.*) -->/)
{
- 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;
# main
# decodes xml by translating & < > back to what they should be
+# and also ignore
+# <![CDATA[
+# and
+# ]]>
sub
xml_decode ($)
{
$input =~ s/</</g;
$input =~ s/>/>/g;
+ if ($input =~ /<!\[CDATA\[/) { $input = ""; }
+ if ($input =~ /]]>/) { $input = ""; }
+
+ #print "Returning line $input";
return $input;
}
my $output = shift @ARGV;
$found = 0;
+%blocks = ();
foreach $file (@ARGV)
{
while ($line = <FILE>)
{
- if ($line =~ /\/\* example-begin $output \*\//)
+ if ($line =~ /<!-- example-begin $output (.*) -->/)
{
- print "Extracting $output from $file\n";
$found = 1;
- open OUTPUT, ">$output";
- print OUTPUT xml_decode ($line);
- my $example = 1;
- while (($line = <FILE>) && $example)
+ $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/)
- {
- print OUTPUT xml_decode ($line);
- close OUTPUT;
- $example = 0;
- }
- else
+ if ($line =~ /<!-- example-end $output (.*) -->/)
{
- 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;