1 <chapter id="chapter-intgration">
2 <title>Integration</title>
4 &GStreamer; tries to integrate closely with operating systems (such
5 as Linux and UNIX-like operating systems, OS X or Windows) and desktop
6 environments (such as GNOME or KDE). In this chapter, we'll mention
7 some specific techniques to integrate your application with your
8 operating system or desktop environment of choice.
11 <!-- ####################################################################### -->
12 <!-- ####################################################################### -->
13 <!-- ####################################################################### -->
15 <sect1 id="section-integration-nix">
16 <title>Linux and UNIX-like operating systems</title>
18 &GStreamer; provides a basic set of elements that are useful when
19 integrating with Linux or a UNIX-like operating system.
24 For audio input and output, &GStreamer; provides input and
25 output elements for several audio subsystems. Amongst others,
26 &GStreamer; includes elements for ALSA (alsasrc,
27 alsasink), OSS (osssrc, osssink) Pulesaudio (pulsesrc, pulsesink)
28 and Sun audio (sunaudiosrc, sunaudiomixer, sunaudiosink).
33 For video input, &GStreamer; contains source elements for
34 Video4linux2 (v4l2src, v4l2element, v4l2sink).
39 For video output, &GStreamer; provides elements for output
40 to X-windows (ximagesink), Xv-windows (xvimagesink; for
41 hardware-accelerated video), direct-framebuffer (dfbimagesink)
42 and openGL image contexts (glsink).
48 <!-- ####################################################################### -->
49 <!-- ####################################################################### -->
50 <!-- ####################################################################### -->
52 <sect1 id="section-integration-gnome">
53 <title>GNOME desktop</title>
55 &GStreamer; has been the media backend of the <ulink type="http"
56 url="http://www.gnome.org/">GNOME</ulink> desktop since GNOME-2.2
57 onwards. Nowadays, a whole bunch of GNOME applications make use of
58 &GStreamer; for media-processing, including (but not limited to)
59 <ulink type="http" url="http://www.rhythmbox.org/">Rhythmbox</ulink>,
60 <ulink type="http" url="https://wiki.gnome.org/Apps/Videos">Videos</ulink>
61 and <ulink type="http"
62 url="https://wiki.gnome.org/Apps/SoundJuicer">Sound
66 Most of these GNOME applications make use of some specific techniques
67 to integrate as closely as possible with the GNOME desktop:
72 GNOME applications usually call <function>gtk_init ()</function>
73 to parse command-line options and initialize GTK. &GStreamer;
74 applications would normally call <function>gst_init ()</function>
75 to do the same for GStreamer.
76 This would mean that only one of the two can parse command-line
77 options. To work around this issue, &GStreamer; can provide a
78 GLib <classname>GOptionGroup</classname> which can be passed to
79 <function>gnome_program_init ()</function>. The following
80 example requires GTK 2.6 or newer (previous GTK versions
81 do not support command line parsing via GOption yet)
83 <programlisting><!-- example-begin gnome.c a -->
84 #include <gtk/gtk.h>
85 #include <gst/gst.h>
87 static gchar **cmd_filenames = NULL;
89 static GOptionEntries cmd_options[] = {
90 /* here you can add command line options for your application. Check
91 * the GOption section in the GLib API reference for a more elaborate
92 * example of how to add your own command line options here */
94 /* at the end we have a special option that collects all remaining
95 * command line arguments (like filenames) for us. If you don't
96 * need this, you can safely remove it */
97 { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &cmd_filenames,
98 "Special option that collects any remaining arguments for us" },
100 /* mark the end of the options array with a NULL option */
104 /* this should usually be defined in your config.h */
105 #define VERSION "0.0.1"
108 main (gint argc, gchar **argv)
110 GOptionContext *context;
111 GOptionGroup *gstreamer_group, *gtk_group;
114 context = g_option_context_new ("gtk-demo-app");
116 /* get command line options from GStreamer and add them to the group */
117 gstreamer_group = gst_init_get_option_group ();
118 g_option_context_add_group (context, gstreamer_group);
119 gtk_group = gtk_get_option_group (TRUE);
120 g_option_context_add_group (context, gtk_group);
122 /* add our own options. If you are using gettext for translation of your
123 * strings, use GETTEXT_PACKAGE here instead of NULL */
124 g_option_context_add_main_entries (context, cmd_options, NULL);
126 /* now parse the commandline options, note that this already
127 * calls gtk_init() and gst_init() */
128 if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
129 g_print ("Error initializing: %s\n", err->message);
130 g_clear_error (&err);
131 g_option_context_free (ctx);
134 g_option_context_free (ctx);
136 /* any filenames we got passed on the command line? parse them! */
137 if (cmd_filenames != NULL) {
140 num = g_strv_length (cmd_filenames);
141 for (i = 0; i < num; ++i) {
142 /* do something with the filename ... */
143 g_print ("Adding to play queue: %s\n", cmd_filenames[i]);
146 g_strfreev (cmd_filenames);
147 cmd_filenames = NULL;
149 <!-- example-end gnome.c a -->
150 [..]<!-- example-begin gnome.c b --><!--
152 --><!-- example-end gnome.c b -->
153 <!-- example-begin gnome.c c -->
155 <!-- example-end gnome.c c --></programlisting>
159 GNOME uses Pulseaudio for audio, use the pulsesrc and
160 pulsesink elements to have access to all the features.
165 &GStreamer; provides data input/output elements for use with the
166 GIO VFS system. These elements are called <quote>giosrc</quote>
167 and <quote>giosink</quote>.
168 The deprecated GNOME-VFS system is supported too but shouldn't be
169 used for any new applications.
175 <!-- ####################################################################### -->
176 <!-- ####################################################################### -->
177 <!-- ####################################################################### -->
181 <sect1 id="section-integration-kde">
182 <title>KDE desktop</title>
184 &GStreamer; has been proposed for inclusion in KDE-4.0. Currently,
185 &GStreamer; is included as an optional component, and it's used by
186 several KDE applications, including <ulink type="http"
187 url="http://amarok.kde.org/">AmaroK</ulink>, <ulink type="http"
188 url="http://developer.kde.org/~wheeler/juk.html">JuK</ulink>,
190 url="http://www.xs4all.nl/~jjvrieze/kmplayer.html">KMPlayer</ulink> and
192 url="http://kaffeine.sourceforge.net/">Kaffeine</ulink>.
195 Although not yet as complete as the GNOME integration bits, there
196 are already some KDE integration specifics available. This list will
197 probably grow as &GStreamer; starts to be used in KDE-4.0:
202 AmaroK contains a kiosrc element, which is a source element that
203 integrates with the KDE VFS subsystem KIO.
209 <!-- ####################################################################### -->
210 <!-- ####################################################################### -->
211 <!-- ####################################################################### -->
213 <sect1 id="section-integration-osx">
216 &GStreamer; provides native video and audio output elements for OS X.
217 It builds using the standard development tools for OS X.
221 <!-- ####################################################################### -->
222 <!-- ####################################################################### -->
223 <!-- ####################################################################### -->
225 <sect1 id="section-integration-win32">
226 <title>Windows</title>
230 Note: this section is out of date. GStreamer-1.0 has much better
231 support for win32 than previous versions though and should usually compile
232 and work out-of-the-box both using MSYS/MinGW or Microsoft compilers. The
233 <ulink url="http://gstreamer.freedesktop.org">GStreamer web site</ulink> and the
234 <ulink url="http://news.gmane.org/gmane.comp.video.gstreamer.devel">mailing list
235 archives</ulink> are a good place to check the latest win32-related news.
241 &GStreamer; builds using Microsoft Visual C .NET 2003 and using Cygwin.
244 <sect2 id="section-win32-build">
245 <title>Building <application>GStreamer</application> under Win32</title>
247 <para>There are different makefiles that can be used to build GStreamer with the usual Microsoft
248 compiling tools.</para>
250 <para>The Makefile is meant to be used with the GNU make program and the free
251 version of the Microsoft compiler (<ulink url="http://msdn.microsoft.com/visualc/vctoolkit2003/">http://msdn.microsoft.com/visualc/vctoolkit2003/</ulink>). You also
252 have to modify your system environment variables to use it from the command-line. You will also
253 need a working Platform SDK for Windows that is available for free from Microsoft.</para>
255 <para>The projects/makefiles will generate automatically some source files needed to compile
256 GStreamer. That requires that you have installed on your system some GNU tools and that they are
257 available in your system PATH.</para>
259 <para>The GStreamer project depends on other libraries, namely :</para>
261 <listitem><para>GLib</para></listitem>
262 <listitem><para>libxml2</para></listitem>
263 <listitem><para>libintl</para></listitem>
264 <listitem><para>libiconv</para></listitem>
267 <para>Work is being done to provide pre-compiled GStreamer-1.0 libraries as
268 a packages for win32. Check the <ulink url="http://gstreamer.freedesktop.org">
269 GStreamer web site</ulink> and check our
270 <ulink url="http://news.gmane.org/gmane.comp.video.gstreamer.devel">mailing list
271 </ulink> for the latest developments in this respect.</para>
276 <para>GNU tools needed that you can find on <ulink url="http://gnuwin32.sourceforge.net/">http://gnuwin32.sourceforge.net/</ulink></para>
278 <listitem><para>GNU flex (tested with 2.5.4)</para></listitem>
279 <listitem><para>GNU bison (tested with 1.35)</para></listitem>
282 <para>and <ulink url="http://www.mingw.org/">http://www.mingw.org/</ulink></para>
284 <listitem><para>GNU make (tested with 3.80)</para></listitem>
287 <para>the generated files from the -auto makefiles will be available soon separately on the net
288 for convenience (people who don't want to install GNU tools).</para>
292 <sect2 id="section-win32-install">
293 <title>Installation on the system</title>
295 <para>FIXME: This section needs be updated for GStreamer-1.0.</para>
298 <para>By default, GStreamer needs a registry. You have to generate it using "gst-register.exe". It will create
299 the file in c:\gstreamer\registry.xml that will hold all the plugins you can use.</para>
301 <para>You should install the GStreamer core in c:\gstreamer\bin and the plugins in c:\gstreamer\plugins. Both
302 directories should be added to your system PATH. The library dependencies should be installed in c:\usr</para>
304 <para>For example, my current setup is :</para>
307 <listitem><para><filename>c:\gstreamer\registry.xml</filename></para></listitem>
308 <listitem><para><filename>c:\gstreamer\bin\gst-inspect.exe</filename></para></listitem>
309 <listitem><para><filename>c:\gstreamer\bin\gst-launch.exe</filename></para></listitem>
310 <listitem><para><filename>c:\gstreamer\bin\gst-register.exe</filename></para></listitem>
311 <listitem><para><filename>c:\gstreamer\bin\gstbytestream.dll</filename></para></listitem>
312 <listitem><para><filename>c:\gstreamer\bin\gstelements.dll</filename></para></listitem>
313 <listitem><para><filename>c:\gstreamer\bin\gstoptimalscheduler.dll</filename></para></listitem>
314 <listitem><para><filename>c:\gstreamer\bin\gstspider.dll</filename></para></listitem>
315 <listitem><para><filename>c:\gstreamer\bin\libgtreamer-0.8.dll</filename></para></listitem>
316 <listitem><para><filename>c:\gstreamer\plugins\gst-libs.dll</filename></para></listitem>
317 <listitem><para><filename>c:\gstreamer\plugins\gstmatroska.dll</filename></para></listitem>
318 <listitem><para><filename>c:\usr\bin\iconv.dll</filename></para></listitem>
319 <listitem><para><filename>c:\usr\bin\intl.dll</filename></para></listitem>
320 <listitem><para><filename>c:\usr\bin\libglib-2.0-0.dll</filename></para></listitem>
321 <listitem><para><filename>c:\usr\bin\libgmodule-2.0-0.dll</filename></para></listitem>
322 <listitem><para><filename>c:\usr\bin\libgobject-2.0-0.dll</filename></para></listitem>
323 <listitem><para><filename>c:\usr\bin\libgthread-2.0-0.dll</filename></para></listitem>
324 <listitem><para><filename>c:\usr\bin\libxml2.dll</filename></para></listitem>