Some updates to the manual, mostly glib2 related.
authorWim Taymans <wim.taymans@gmail.com>
Sat, 7 Jul 2001 11:34:54 +0000 (11:34 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sat, 7 Jul 2001 11:34:54 +0000 (11:34 +0000)
Original commit message from CVS:
Some updates to the manual, mostly glib2 related.

14 files changed:
docs/manual/bins.sgml
docs/manual/dynamic.sgml
docs/manual/factories.sgml
docs/manual/goals.sgml
docs/manual/gstreamer-manual.sgml
docs/manual/helloworld.sgml
docs/manual/helloworld2.sgml
docs/manual/pads.sgml
docs/manual/programs.sgml
docs/manual/queues.sgml
docs/manual/threads.sgml
docs/manual/typedetection.sgml
docs/manual/utility.sgml
docs/manual/xml.sgml

index 04d46a8..988687b 100644 (file)
       <programlisting>
 
   // create the mp3player element
-  GstElement *mp3player = gst_elementfactory_make("mp3player","mp3player");
+  GstElement *mp3player = gst_elementfactory_make ("mp3player", "mp3player");
   // 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
-  gst_element_set_state(GST_ELEMENT(mp3player),GST_STATE_PLAYING);
+  gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_PLAYING);
    ...
   // pause playback
-  gst_element_set_state(GST_ELEMENT(mp3player),GST_STATE_PAUSED);
+  gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_PAUSED);
    ...
   // stop
-  gst_element_set_state(GST_ELEMENT(mp3player),GST_STATE_NULL);
+  gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_NULL);
       </programlisting>
 
       Custom bins can be created with a plugin or an XML description. You will find more 
index 23a5926..6cd753b 100644 (file)
@@ -46,7 +46,7 @@ main(int argc, char *argv[])
 
   src = gst_elementfactory_make ("disksrc", "src");
   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");
   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 (parse));
 
-  gtk_signal_connect (GTK_OBJECT (parse), "new_pad",
-                      GTK_SIGNAL_FUNC (new_pad_created), pipeline);
+  g_signal_connectc (G_OBJECT (parse), "new_pad",
+                     G_CALLBACK (new_pad_created), pipeline, FALSE);
 
-  gtk_signal_connect (GTK_OBJECT (src), "eos",
-                      GTK_SIGNAL_FUNC (eof), NULL);
+  g_signal_connectc (G_OBJECT (src), "eos",
+                     G_CALLBACK (eof), NULL, FALSE);
 
   gst_pad_connect (gst_element_get_pad (src, "src"),
                    gst_element_get_pad (parse, "sink"));
@@ -83,8 +83,8 @@ main(int argc, char *argv[])
     'new_pad' that we connected to the mpeg1parser using:
   </para>
   <programlisting>
-  gtk_signal_connect (GTK_OBJECT (parse), "new_pad",
-                      GTK_SIGNAL_FUNC (new_pad_created), pipeline);
+  g_signal_connectc (G_OBJECT (parse), "new_pad",
+                     G_CALLBACK (new_pad_created), pipeline, FALSE);
   </programlisting>
   <para> 
     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"));
 
     // 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");
     gst_element_set_state (GST_ELEMENT (video_thread), GST_STATE_READY);
   }
index d67146f..62490bb 100644 (file)
@@ -21,8 +21,8 @@
     <programlisting>
   ...    
   /* now it's time to get the parser */
-  parse = gst_elementfactory_make("mp3parse","parse");
-  decoder = gst_elementfactory_make("mpg123","decoder");
+  parse = gst_elementfactory_make ("mp3parse", "parse");
+  decoder = gst_elementfactory_make ("mpg123", "decoder");
   ...
     </programlisting>
 
@@ -158,7 +158,7 @@ struct _GstType {
       <programlisting>
   guint16 id;
   
-  id = gst_type_find_by_mime("audio/mpeg");
+  id = gst_type_find_by_mime ("audio/mpeg");
       </programlisting>
       <para> 
         This function will return 0 if the type was not known.
@@ -174,7 +174,7 @@ struct _GstType {
       <programlisting>
   GstType *type;
   
-  type = gst_type_find_by_id(id);
+  type = gst_type_find_by_id (id);
       </programlisting>
       <para> 
         This function will return NULL if the id was associated with
@@ -191,7 +191,7 @@ struct _GstType {
       <programlisting>
   guint16 id;
   
-  id = gst_type_find_by_ext(".mp3");
+  id = gst_type_find_by_ext (".mp3");
       </programlisting>
       <para> 
         This function will return 0 if the extension was not known.
@@ -211,7 +211,7 @@ struct _GstType {
       <programlisting>
   GList *list;
 
-  list = gst_type_gst_srcs(id);
+  list = gst_type_gst_srcs (id);
       </programlisting>
 
       <para>
@@ -220,7 +220,7 @@ struct _GstType {
       <programlisting>
   GList *list;
 
-  list = gst_type_gst_sinks(id);
+  list = gst_type_gst_sinks (id);
       </programlisting>
       <para>
         When you have a list of elements, you can simply take the first
@@ -269,7 +269,7 @@ struct _GstType {
       <programlisting>
   GList *list;
 
-  list = gst_type_gst_sink_to_src(sourceid, sinkid);
+  list = gst_type_gst_sink_to_src (sourceid, sinkid);
       </programlisting>
       <para>
         This piece of code will give you the elements needed to construct
@@ -293,7 +293,7 @@ struct _GstType {
   // obtain the factory
   factory = ... 
 
-  element = gst_elementfactory_create(factory, "name");
+  element = gst_elementfactory_create (factory, "name");
     </programlisting>
     <para>
       This way, you do not have to create elements by name which
index 1da2432..f8c5225 100644 (file)
@@ -38,8 +38,8 @@
     <sect2 id="sec-goals-object">
       <title>Object oriented</title>
       <para>
-        Adhere as much as possible to the GTK+ object model. A programmer familiar
-       with GTK+ will be confortable with GStreamer.
+        Adhere as much as possible to the glib2.0 object model. A programmer familiar
+       with glib2 and GTK+ will be confortable with GStreamer.
       </para> 
       <para>
         GStreamer uses the mechanism of signals and object arguments. 
@@ -53,7 +53,7 @@
     <sect2 id="sec-goals-extensible">
       <title>Extensible</title>
       <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> 
         All plugins are loaded dynamically and can be extended and upgraded
@@ -65,7 +65,7 @@
       <title>Allow binary only plugins</title>
       <para> 
         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.
       </para> 
       <para> 
index 363934f..de3bf95 100644 (file)
@@ -67,8 +67,8 @@
         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>
         programming. In chapter 3 we will move on to the examples. 
-        Since <application>GStreamer</application> adheres to the GTK+ programming model, the reader is 
-        assumed to understand the basics of GTK+.
+        Since <application>GStreamer</application> adheres to the GTK+/glib2 programming model, the reader is 
+        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+
         Tutorial</emphasis> or Eric Harlow's book <emphasis>Developing Linux
         Applications with GTK+ and GDK</emphasis>.  
index 9043639..0adcfc3 100644 (file)
@@ -36,7 +36,7 @@ main (int argc, char *argv[])
 
   /* create a disk reader */
   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 */
   parse = gst_elementfactory_make ("mp3parse", "parse");
@@ -127,13 +127,13 @@ main (int argc, char *argv[])
 
     <para>
       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.
     </para>
     <programlisting>
   /* create a disk reader */
   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>
     <note>
       <para>
index df97347..b10fa0b 100644 (file)
@@ -52,9 +52,9 @@ main (int argc, char *argv[])
 
   /* create a disk reader */
   disksrc = gst_elementfactory_make ("disksrc", "disk_source");
-  gtk_object_set (GTK_OBJECT (disksrc), "location", argv[1], NULL);
-  gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
-                      GTK_SIGNAL_FUNC (eos), NULL);
+  g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
+  g_signal_connectc (G_OBJECT (disksrc), "eos",
+                     G_CALLBACK (eos), NULL, FALSE);
 
   /* and an audio sink */
   audiosink = gst_elementfactory_make ("audiosink", "play_audio");
index 544d0b6..1e0886d 100644 (file)
@@ -105,7 +105,7 @@ main(int argc, char *argv[])
   ...
   
   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
@@ -411,7 +411,7 @@ GstProps*     gst_props_new   (const gchar *firstname, ...);
             </para>
           </listitem>
         </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>
           <listitem>
             <para>
index d5fbb6b..d61cf4d 100644 (file)
@@ -117,29 +117,29 @@ video_00! (mpeg2dec ! videosink)
 #include &lt;stdlib.h&gt;
 
 int 
-main(int argc, char *argv[]) 
+main (int argc, char *argv[]) 
 {
   GstElement *pipeline;
   char **argvn;
   gchar *cmdline;
   int i;
 
-  gst_init(&amp;argc,&amp;argv);
+  gst_init (&amp;argc, &amp;argv);
 
-  pipeline = gst_pipeline_new("launch");
+  pipeline = gst_pipeline_new ("launch");
 
   // make a null-terminated version of argv
-  argvn = g_new0(char *,argc);
-  memcpy(argvn,argv+1,sizeof(char*)*(argc-1));
+  argvn = g_new0 (char *,argc);
+  memcpy (argvn, argv+1, sizeof (char*) * (argc-1));
   // join the argvs together
-  cmdline = g_strjoinv(" ",argvn);
+  cmdline = g_strjoinv (" ", argvn);
   // free the null-terminated argv
-  g_free(argvn);
+  g_free (argvn);
 
-  gst_parse_launch(cmdline,pipeline);
+  gst_parse_launch (cmdline, pipeline);
 
   fprintf(stderr,"RUNNING pipeline\n");
-  gst_element_set_state(pipeline,GST_STATE_PLAYING);
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
 
   while (1)
     gst_bin_iterate (GST_BIN (pipeline));
index 2450e49..e8ad9d2 100644 (file)
 
   <para> 
     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:
   </para>
   <programlisting>
-  gtk_object_set (GTK_OBJECT (queue), "max_level", 30, NULL);
+  g_object_set (G_OBJECT (queue), "max_level", 30, NULL);
   </programlisting>
 
   <para> 
@@ -81,9 +81,9 @@ main (int argc, char *argv[])
   /* create a disk reader */
   disksrc = gst_elementfactory_make ("disksrc", "disk_source");
   g_assert (disksrc != NULL);
-  gtk_object_set (GTK_OBJECT (disksrc), "location", argv[1], NULL);
-  gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
-                      GTK_SIGNAL_FUNC (eos), thread);
+  g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
+  g_signal_connectc (G_OBJECT (disksrc), "eos",
+                     G_CALLBACK (eos), thread, FALSE);
 
   queue = gst_elementfactory_make ("queue", "queue");
 
@@ -114,8 +114,6 @@ main (int argc, char *argv[])
 
   gst_bin_add (GST_BIN (bin), thread);
 
-  /* make it ready */
-  gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
   /* start playing */
   gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
 
index b5f24f0..4349783 100644 (file)
@@ -94,9 +94,9 @@ main (int argc, char *argv[])
   /* create a disk reader */
   disksrc = gst_elementfactory_make ("disksrc", "disk_source");
   g_assert (disksrc != NULL);
-  gtk_object_set (GTK_OBJECT (disksrc), "location", argv[1], NULL);
-  gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
-                      GTK_SIGNAL_FUNC (eos), thread);
+  g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
+  g_signal_connectc (G_OBJECT (disksrc), "eos",
+                     G_CALLBACK (eos), thread, FALSE);
 
   /* and an audio sink */
   audiosink = gst_elementfactory_make ("audiosink", "play_audio");
index e9bb972..7cf294d 100644 (file)
@@ -61,44 +61,44 @@ main(int argc, char *argv[])
 {
   GstElement *bin, *disksrc, *typefind;
 
-  gst_init(&amp;argc,&amp;argv);
+  gst_init (&amp;argc, &amp;argv);
 
   if (argc != 2) {
-    g_print("usage: &percnt;s &lt;filename&gt;\n", argv[0]);
-    exit(-1);
+    g_print ("usage: &percnt;s &lt;filename&gt;\n", argv[0]);
+    exit (-1);
   }
 
   /* create a new bin to hold the elements */
-  bin = gst_bin_new("bin");
-  g_assert(bin != NULL);
+  bin = gst_bin_new ("bin");
+  g_assert (bin != NULL);
 
   /* create a disk reader */
-  disksrc = gst_elementfactory_make("disksrc", "disk_source");
-  g_assert(disksrc != NULL);
-  gtk_object_set(GTK_OBJECT(disksrc),"location", argv[1],NULL);
+  disksrc = gst_elementfactory_make ("disksrc", "disk_source");
+  g_assert (disksrc != NULL);
+  g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
 
   /* create the typefind element */
-  typefind = gst_elementfactory_make("typefind", "typefind");
-  g_assert(typefind != NULL);
+  typefind = gst_elementfactory_make ("typefind", "typefind");
+  g_assert (typefind != NULL);
 
   /* add objects to the main pipeline */
-  gst_bin_add(GST_BIN(bin), disksrc);
-  gst_bin_add(GST_BIN(bin), typefind);
+  gst_bin_add (GST_BIN (bin), disksrc);
+  gst_bin_add (GST_BIN (bin), typefind);
 
-  gtk_signal_connect (GTK_OBJECT (typefind), "have_type", 
-                 type_found, NULL);
+  g_signal_connectc (G_OBJECT (typefind), "have_type", 
+                    G_CALLBACK (type_found), NULL, FALSE);
 
-  gst_pad_connect(gst_element_get_pad(disksrc,"src"),
-                  gst_element_get_pad(typefind,"sink"));
+  gst_pad_connect (gst_element_get_pad (disksrc, "src"),
+                   gst_element_get_pad (typefind, "sink"));
 
   /* start playing */
-  gst_element_set_state(GST_ELEMENT(bin), GST_STATE_PLAYING);
+  gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
 
-  gst_bin_iterate(GST_BIN(bin));
+  gst_bin_iterate (GST_BIN (bin));
 
-  gst_element_set_state(GST_ELEMENT(bin), GST_STATE_NULL);
+  gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
 
-  exit(0);
+  exit (0);
 }
   </programlisting>
   <para>
index c8247bc..ca5a39b 100644 (file)
@@ -1,7 +1,7 @@
 <chapter id="cha-utility">
   <title>Utility functions</title>
   <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>
     provides some easy wrappers for this common operation.
   </para>
@@ -14,7 +14,7 @@
   guchar *value;
 
   arg.name = argname;
-  gtk_object_getv (GTK_OBJECT (object), 1, &amp;arg);
+  g_object_getv (G_OBJECT (object), 1, &amp;arg);
   value = GTK_VALUE_STRING (arg);
   </programlisting>
   <para> 
          gpointer: with gst_util_get_pointer_arg ();
         </para>
       </listitem>
-      <listitem>
-        <para>
-         GtkWidget*: with gst_util_get_widget_arg ();
-        </para>
-      </listitem>
     </itemizedlist>
   </para> 
   <para> 
@@ -75,7 +70,7 @@
     to by mem.
   </para> 
   <programlisting>
-  void gst_util_dump_mem(guchar *mem, guint size);
+  void gst_util_dump_mem (guchar *mem, guint size);
   </programlisting>
 
 </chapter>
index 18413f1..cf8d102 100644 (file)
@@ -55,7 +55,7 @@ main (int argc, char *argv[])
   /* create a disk reader */
   disksrc = gst_elementfactory_make ("disksrc", "disk_source");
   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");
   queue2 = gst_elementfactory_make ("queue", "queue2");
@@ -195,8 +195,9 @@ xmlNsPtr ns;
   ...
   ns = xmlNewNs (NULL, "http://gstreamer.net/gst-test/1.0/", "test");
     ...
-  thread = gst_elementfactory_make("thread", "thread");
-  gtk_signal_connect (GTK_OBJECT (thread), "object_saved", object_saved, g_strdup ("decoder thread"));
+  thread = gst_elementfactory_make ("thread", "thread");
+  g_signal_connectc (G_OBJECT (thread), "object_saved", 
+                    G_CALLBACK (object_saved), g_strdup ("decoder thread"), FALSE);
     ...
     </programlisting>
     <para>
@@ -209,8 +210,8 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
 {
   xmlNodePtr child;
 
-  child = xmlNewChild(parent, ns, "comment", NULL);
-  xmlNewChild(child, ns, "text", (gchar *)data);
+  child = xmlNewChild (parent, ns, "comment", NULL);
+  xmlNewChild (child, ns, "text", (gchar *)data);
 }
     </programlisting>
     <para>
@@ -245,9 +246,10 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
     <programlisting>
   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);
     </programlisting>