<para>
When writing a &GStreamer; application, you can simply include
<filename>gst/gst.h</filename> to get access to the library
- functions. Besides that, you will also need to intialize the
+ functions. Besides that, you will also need to initialize the
&GStreamer; library.
</para>
<title>Initializing GStreamer</title>
<programlisting>
<!-- example-begin init.c -->
+#include <stdio.h>
#include <gst/gst.h>
int
{ NULL }
};
- /* we must initialise the threading system before using any
- * other GLib funtion, such as g_option_context_new() */
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
ctx = g_option_context_new ("- Your application");
g_option_context_add_main_entries (ctx, entries, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
g_print ("Failed to initialize: %s\n", err->message);
- g_error_free (err);
+ g_clear_error (&err);
+ g_option_context_free (ctx);
return 1;
}
+ g_option_context_free (ctx);
printf ("Run me with --help to see the Application options appended.\n");
</example>
<para>
As shown in this fragment, you can use a <ulink
- url="http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html"
+ url="http://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html"
type="http">GOption</ulink> table to define your application-specific
command line options, and pass this table to the GLib initialization
function along with the option group returned from the