mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
Some updates to the manual, mostly glib2 related.
Original commit message from CVS: Some updates to the manual, mostly glib2 related.
This commit is contained in:
parent
5d2a56cd7c
commit
42297d86bd
14 changed files with 85 additions and 90 deletions
|
@ -139,7 +139,7 @@
|
||||||
// create the mp3player element
|
// create the mp3player element
|
||||||
GstElement *mp3player = gst_elementfactory_make ("mp3player", "mp3player");
|
GstElement *mp3player = gst_elementfactory_make ("mp3player", "mp3player");
|
||||||
// set the source mp3 audio file
|
// set the source mp3 audio file
|
||||||
gtk_object_set(GTK_OBJECT(mp3player), "location", "helloworld.mp3", NULL);
|
g_object_set (G_OBJECT (mp3player), "location", "helloworld.mp3", NULL);
|
||||||
// start playback
|
// start playback
|
||||||
gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_PLAYING);
|
||||||
...
|
...
|
||||||
|
|
|
@ -46,7 +46,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
src = gst_elementfactory_make ("disksrc", "src");
|
src = gst_elementfactory_make ("disksrc", "src");
|
||||||
g_return_val_if_fail (src != NULL, -1);
|
g_return_val_if_fail (src != NULL, -1);
|
||||||
gtk_object_set (GTK_OBJECT (src), "location", argv[1], NULL);
|
g_object_set (G_OBJECT (src), "location", argv[1], NULL);
|
||||||
|
|
||||||
parse = gst_elementfactory_make ("mpeg1parse", "parse");
|
parse = gst_elementfactory_make ("mpeg1parse", "parse");
|
||||||
g_return_val_if_fail (parse != NULL, -1);
|
g_return_val_if_fail (parse != NULL, -1);
|
||||||
|
@ -54,11 +54,11 @@ main(int argc, char *argv[])
|
||||||
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (src));
|
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (src));
|
||||||
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (parse));
|
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (parse));
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (parse), "new_pad",
|
g_signal_connectc (G_OBJECT (parse), "new_pad",
|
||||||
GTK_SIGNAL_FUNC (new_pad_created), pipeline);
|
G_CALLBACK (new_pad_created), pipeline, FALSE);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (src), "eos",
|
g_signal_connectc (G_OBJECT (src), "eos",
|
||||||
GTK_SIGNAL_FUNC (eof), NULL);
|
G_CALLBACK (eof), NULL, FALSE);
|
||||||
|
|
||||||
gst_pad_connect (gst_element_get_pad (src, "src"),
|
gst_pad_connect (gst_element_get_pad (src, "src"),
|
||||||
gst_element_get_pad (parse, "sink"));
|
gst_element_get_pad (parse, "sink"));
|
||||||
|
@ -83,8 +83,8 @@ main(int argc, char *argv[])
|
||||||
'new_pad' that we connected to the mpeg1parser using:
|
'new_pad' that we connected to the mpeg1parser using:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
gtk_signal_connect (GTK_OBJECT (parse), "new_pad",
|
g_signal_connectc (G_OBJECT (parse), "new_pad",
|
||||||
GTK_SIGNAL_FUNC (new_pad_created), pipeline);
|
G_CALLBACK (new_pad_created), pipeline, FALSE);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
When an elementary stream has been detected in the system stream,
|
When an elementary stream has been detected in the system stream,
|
||||||
|
@ -191,7 +191,7 @@ new_pad_created (GstElement *parse, GstPad *pad, GstElement *pipeline)
|
||||||
gst_element_get_pad (video_thread, "sink"));
|
gst_element_get_pad (video_thread, "sink"));
|
||||||
|
|
||||||
// set up thread state and kick things off
|
// set up thread state and kick things off
|
||||||
gtk_object_set (GTK_OBJECT (video_thread), "create_thread", TRUE, NULL);
|
g_object_set (G_OBJECT (video_thread), "create_thread", TRUE, NULL);
|
||||||
g_print ("setting to READY state\n");
|
g_print ("setting to READY state\n");
|
||||||
gst_element_set_state (GST_ELEMENT (video_thread), GST_STATE_READY);
|
gst_element_set_state (GST_ELEMENT (video_thread), GST_STATE_READY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
<sect2 id="sec-goals-object">
|
<sect2 id="sec-goals-object">
|
||||||
<title>Object oriented</title>
|
<title>Object oriented</title>
|
||||||
<para>
|
<para>
|
||||||
Adhere as much as possible to the GTK+ object model. A programmer familiar
|
Adhere as much as possible to the glib2.0 object model. A programmer familiar
|
||||||
with GTK+ will be confortable with GStreamer.
|
with glib2 and GTK+ will be confortable with GStreamer.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
GStreamer uses the mechanism of signals and object arguments.
|
GStreamer uses the mechanism of signals and object arguments.
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<sect2 id="sec-goals-extensible">
|
<sect2 id="sec-goals-extensible">
|
||||||
<title>Extensible</title>
|
<title>Extensible</title>
|
||||||
<para>
|
<para>
|
||||||
All GStreamer Objects can be extended using the GTK+ inheritance methods.
|
All GStreamer Objects can be extended using the glib2 inheritance methods.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
All plugins are loaded dynamically and can be extended and upgraded
|
All plugins are loaded dynamically and can be extended and upgraded
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
<title>Allow binary only plugins</title>
|
<title>Allow binary only plugins</title>
|
||||||
<para>
|
<para>
|
||||||
plugins are shared libraries that are loaded at runtime. since all the
|
plugins are shared libraries that are loaded at runtime. since all the
|
||||||
properties of the plugin can be set using the GtkObject arguments, there
|
properties of the plugin can be set using the GObject properties, there
|
||||||
is no need to have any header files installed for the plugins.
|
is no need to have any header files installed for the plugins.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -67,8 +67,8 @@
|
||||||
The first chapter of the book gives you an overview of <application>GStreamer</application>
|
The first chapter of the book gives you an overview of <application>GStreamer</application>
|
||||||
design goals. Chapter 2 rapidly covers the basics of <application>GStreamer</application>
|
design goals. Chapter 2 rapidly covers the basics of <application>GStreamer</application>
|
||||||
programming. In chapter 3 we will move on to the examples.
|
programming. In chapter 3 we will move on to the examples.
|
||||||
Since <application>GStreamer</application> adheres to the GTK+ programming model, the reader is
|
Since <application>GStreamer</application> adheres to the GTK+/glib2 programming model, the reader is
|
||||||
assumed to understand the basics of GTK+.
|
assumed to understand the basics of GTK+ and the glib2.0 object model.
|
||||||
For a gentle introduction to GTK+, you may wish to read the <emphasis>GTK+
|
For a gentle introduction to GTK+, you may wish to read the <emphasis>GTK+
|
||||||
Tutorial</emphasis> or Eric Harlow's book <emphasis>Developing Linux
|
Tutorial</emphasis> or Eric Harlow's book <emphasis>Developing Linux
|
||||||
Applications with GTK+ and GDK</emphasis>.
|
Applications with GTK+ and GDK</emphasis>.
|
||||||
|
|
|
@ -36,7 +36,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
/* create a disk reader */
|
/* create a disk reader */
|
||||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||||
gtk_object_set (GTK_OBJECT (disksrc),"location", argv[1], NULL);
|
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||||
|
|
||||||
/* now it's time to get the parser */
|
/* now it's time to get the parser */
|
||||||
parse = gst_elementfactory_make ("mp3parse", "parse");
|
parse = gst_elementfactory_make ("mp3parse", "parse");
|
||||||
|
@ -127,13 +127,13 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
We then create a disk source element. The disk source element is able to
|
We then create a disk source element. The disk source element is able to
|
||||||
read from a file. We use the standard GTK+ argument mechanism to set
|
read from a file. We use the standard GObject property mechanism to set
|
||||||
a property of the element: the file to read from.
|
a property of the element: the file to read from.
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
/* create a disk reader */
|
/* create a disk reader */
|
||||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||||
gtk_object_set (GTK_OBJECT (disksrc),"location", argv[1], NULL);
|
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -52,9 +52,9 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
/* create a disk reader */
|
/* create a disk reader */
|
||||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||||
gtk_object_set (GTK_OBJECT (disksrc), "location", argv[1], NULL);
|
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||||
gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
|
g_signal_connectc (G_OBJECT (disksrc), "eos",
|
||||||
GTK_SIGNAL_FUNC (eos), NULL);
|
G_CALLBACK (eos), NULL, FALSE);
|
||||||
|
|
||||||
/* and an audio sink */
|
/* and an audio sink */
|
||||||
audiosink = gst_elementfactory_make ("audiosink", "play_audio");
|
audiosink = gst_elementfactory_make ("audiosink", "play_audio");
|
||||||
|
|
|
@ -105,7 +105,7 @@ main(int argc, char *argv[])
|
||||||
...
|
...
|
||||||
|
|
||||||
mpeg2parser = gst_elementfactory_make ("mpeg2parse", "mpeg2parse");
|
mpeg2parser = gst_elementfactory_make ("mpeg2parse", "mpeg2parse");
|
||||||
gtk_signal_connect (GTK_OBJECT (mpeg2parser), "new_pad", pad_connect_func, pipeline);
|
g_signal_connectc (G_OBJECT (mpeg2parser), "new_pad", pad_connect_func, pipeline, FALSE);
|
||||||
...
|
...
|
||||||
|
|
||||||
// start the pipeline
|
// start the pipeline
|
||||||
|
@ -411,7 +411,7 @@ GstProps* gst_props_new (const gchar *firstname, ...);
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
All of the above values can be given with a list too using:
|
All of the above values can be given with a list too, using:
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The standard <application>GStreamer</application> queue implementation has some
|
The standard <application>GStreamer</application> queue implementation has some
|
||||||
properties that can be changed using the gtk_objet_set () method. To set the
|
properties that can be changed using the g_objet_set () method. To set the
|
||||||
maximum number of buffers that can be queued to 30, do:
|
maximum number of buffers that can be queued to 30, do:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
gtk_object_set (GTK_OBJECT (queue), "max_level", 30, NULL);
|
g_object_set (G_OBJECT (queue), "max_level", 30, NULL);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -81,9 +81,9 @@ main (int argc, char *argv[])
|
||||||
/* create a disk reader */
|
/* create a disk reader */
|
||||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||||
g_assert (disksrc != NULL);
|
g_assert (disksrc != NULL);
|
||||||
gtk_object_set (GTK_OBJECT (disksrc), "location", argv[1], NULL);
|
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||||
gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
|
g_signal_connectc (G_OBJECT (disksrc), "eos",
|
||||||
GTK_SIGNAL_FUNC (eos), thread);
|
G_CALLBACK (eos), thread, FALSE);
|
||||||
|
|
||||||
queue = gst_elementfactory_make ("queue", "queue");
|
queue = gst_elementfactory_make ("queue", "queue");
|
||||||
|
|
||||||
|
@ -114,8 +114,6 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (bin), thread);
|
gst_bin_add (GST_BIN (bin), thread);
|
||||||
|
|
||||||
/* make it ready */
|
|
||||||
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
|
|
||||||
/* start playing */
|
/* start playing */
|
||||||
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,9 @@ main (int argc, char *argv[])
|
||||||
/* create a disk reader */
|
/* create a disk reader */
|
||||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||||
g_assert (disksrc != NULL);
|
g_assert (disksrc != NULL);
|
||||||
gtk_object_set (GTK_OBJECT (disksrc), "location", argv[1], NULL);
|
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||||
gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
|
g_signal_connectc (G_OBJECT (disksrc), "eos",
|
||||||
GTK_SIGNAL_FUNC (eos), thread);
|
G_CALLBACK (eos), thread, FALSE);
|
||||||
|
|
||||||
/* and an audio sink */
|
/* and an audio sink */
|
||||||
audiosink = gst_elementfactory_make ("audiosink", "play_audio");
|
audiosink = gst_elementfactory_make ("audiosink", "play_audio");
|
||||||
|
|
|
@ -75,7 +75,7 @@ main(int argc, char *argv[])
|
||||||
/* create a disk reader */
|
/* create a disk reader */
|
||||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||||
g_assert (disksrc != NULL);
|
g_assert (disksrc != NULL);
|
||||||
gtk_object_set(GTK_OBJECT(disksrc),"location", argv[1],NULL);
|
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||||
|
|
||||||
/* create the typefind element */
|
/* create the typefind element */
|
||||||
typefind = gst_elementfactory_make ("typefind", "typefind");
|
typefind = gst_elementfactory_make ("typefind", "typefind");
|
||||||
|
@ -85,8 +85,8 @@ main(int argc, char *argv[])
|
||||||
gst_bin_add (GST_BIN (bin), disksrc);
|
gst_bin_add (GST_BIN (bin), disksrc);
|
||||||
gst_bin_add (GST_BIN (bin), typefind);
|
gst_bin_add (GST_BIN (bin), typefind);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (typefind), "have_type",
|
g_signal_connectc (G_OBJECT (typefind), "have_type",
|
||||||
type_found, NULL);
|
G_CALLBACK (type_found), NULL, FALSE);
|
||||||
|
|
||||||
gst_pad_connect (gst_element_get_pad (disksrc, "src"),
|
gst_pad_connect (gst_element_get_pad (disksrc, "src"),
|
||||||
gst_element_get_pad (typefind, "sink"));
|
gst_element_get_pad (typefind, "sink"));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<chapter id="cha-utility">
|
<chapter id="cha-utility">
|
||||||
<title>Utility functions</title>
|
<title>Utility functions</title>
|
||||||
<para>
|
<para>
|
||||||
while you can use the regular gtk_object_getv () function to
|
while you can use the regular g_object_getv () function to
|
||||||
query the value of an object property, <application>GStreamer</application>
|
query the value of an object property, <application>GStreamer</application>
|
||||||
provides some easy wrappers for this common operation.
|
provides some easy wrappers for this common operation.
|
||||||
</para>
|
</para>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
guchar *value;
|
guchar *value;
|
||||||
|
|
||||||
arg.name = argname;
|
arg.name = argname;
|
||||||
gtk_object_getv (GTK_OBJECT (object), 1, &arg);
|
g_object_getv (G_OBJECT (object), 1, &arg);
|
||||||
value = GTK_VALUE_STRING (arg);
|
value = GTK_VALUE_STRING (arg);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
|
@ -61,11 +61,6 @@
|
||||||
gpointer: with gst_util_get_pointer_arg ();
|
gpointer: with gst_util_get_pointer_arg ();
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
GtkWidget*: with gst_util_get_widget_arg ();
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -55,7 +55,7 @@ main (int argc, char *argv[])
|
||||||
/* create a disk reader */
|
/* create a disk reader */
|
||||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||||
g_assert (disksrc != NULL);
|
g_assert (disksrc != NULL);
|
||||||
gtk_object_set (GTK_OBJECT (disksrc), "location", argv[1], NULL);
|
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||||
|
|
||||||
queue = gst_elementfactory_make ("queue", "queue");
|
queue = gst_elementfactory_make ("queue", "queue");
|
||||||
queue2 = gst_elementfactory_make ("queue", "queue2");
|
queue2 = gst_elementfactory_make ("queue", "queue2");
|
||||||
|
@ -196,7 +196,8 @@ xmlNsPtr ns;
|
||||||
ns = xmlNewNs (NULL, "http://gstreamer.net/gst-test/1.0/", "test");
|
ns = xmlNewNs (NULL, "http://gstreamer.net/gst-test/1.0/", "test");
|
||||||
...
|
...
|
||||||
thread = gst_elementfactory_make ("thread", "thread");
|
thread = gst_elementfactory_make ("thread", "thread");
|
||||||
gtk_signal_connect (GTK_OBJECT (thread), "object_saved", object_saved, g_strdup ("decoder thread"));
|
g_signal_connectc (G_OBJECT (thread), "object_saved",
|
||||||
|
G_CALLBACK (object_saved), g_strdup ("decoder thread"), FALSE);
|
||||||
...
|
...
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
|
@ -245,7 +246,8 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
|
||||||
<programlisting>
|
<programlisting>
|
||||||
xml = gst_xml_new ();
|
xml = gst_xml_new ();
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (xml), "object_loaded", xml_loaded, xml);
|
g_signal_connectc (G_OBJECT (xml), "object_loaded",
|
||||||
|
G_CALLBACK (xml_loaded), xml);
|
||||||
|
|
||||||
ret = gst_xml_parse_file (xml, "xmlTest.gst", NULL);
|
ret = gst_xml_parse_file (xml, "xmlTest.gst", NULL);
|
||||||
g_assert (ret == TRUE);
|
g_assert (ret == TRUE);
|
||||||
|
|
Loading…
Reference in a new issue