blob: eae9e7ec4f1384674545e32c498164107be58a12 [file] [log] [blame]
Ronald S. Bultje1fef2702004-12-23 14:26:14 +00001<chapter id="chapter-intgration">
2 <title>Integration</title>
3 <para>
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.
Thomas Vander Stichelee4383152004-12-15 07:30:55 +00009 </para>
10
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000011 <sect1 id="section-integration-nix">
12 <title>Linux and UNIX-like operating systems</title>
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000013 <para>
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000014 &GStreamer; provides a basic set of elements that are useful when
15 integrating with Linux or a UNIX-like operating system.
16 </para>
17 <itemizedlist>
18 <listitem>
19 <para>
20 For audio input and output, &GStreamer; provides input and
21 output elements for several audio subsystems. Amongst others,
22 &GStreamer; includes elements for ALSA (alsasrc, alsamixer,
23 alsasink), OSS (osssrc, ossmixer, osssink) and Sun audio
24 (sunaudiosrc, sunaudiomixer, sunaudiosink).
25 </para>
26 </listitem>
27 <listitem>
28 <para>
29 For video input, &GStreamer; contains source elements for
30 Video4linux (v4lsrc, v4lmjpegsrc, v4lelement and v4lmjpegisnk)
31 and Video4linux2 (v4l2src, v4l2element).
32 </para>
33 </listitem>
34 <listitem>
35 <para>
36 For video output, &GStreamer; provides elements for output
37 to X-windows (ximagesink), Xv-windows (xvimagesink; for
38 hardware-accelerated video), direct-framebuffer (dfbimagesink)
39 and openGL image contexts (glsink).
40 </para>
41 </listitem>
42 </itemizedlist>
43 </sect1>
44
45 <sect1 id="section-integration-gnome">
46 <title>GNOME desktop</title>
47 <para>
48 &GStreamer; has been the media backend of the <ulink type="http"
49 url="http://www.gnome.org/">GNOME</ulink> desktop since GNOME-2.2
50 onwards. Nowadays, a whole bunch of GNOME applications make use of
51 &GStreamer; for media-processing, including (but not limited to)
52 <ulink type="http" url="http://www.rhythmbox.org/">Rhythmbox</ulink>,
53 <ulink type="http" url="http://www.hadess.net/totem.php3">Totem</ulink>
54 and <ulink type="http"
55 url="http://www.burtonini.com/blog/computers/sound-juicer">Sound
56 Juicer</ulink>.
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000057 </para>
58 <para>
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000059 Most of these GNOME applications make use of some specific techniques
60 to integrate as closely as possible with the GNOME desktop:
61 </para>
62 <itemizedlist>
63 <listitem>
64 <para>
65 GNOME applications call <function>gnome_program_init ()</function>
66 to parse command-line options and initialize the necessary gnome
67 modules. &GStreamer; applications would normally call
68 <function>gst_init ()</function> to do the same for GStreamer.
69 This would mean that only one of the two can parse command-line
70 options. To work around this issue, &GStreamer; can provide a
71 <classname>poptOption</classname> array which can be passed to
72 <function>gnome_program_init ()</function>.
73 </para>
74 <programlisting><!-- example-begin gnome.c a -->
Ronald S. Bultjed0bcc342004-12-15 17:32:49 +000075#include &lt;gnome.h&gt;
76#include &lt;gst/gst.h&gt;
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000077
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000078gint
79main (gint argc,
80 gchar *argv[])
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000081{
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000082 struct poptOption options[] = {
83 {NULL, '\0', POPT_ARG_INCLUDE_TABLE, NULL, 0, "GStreamer", NULL},
84 POPT_TABLEEND
85 };
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000086
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000087 /* init GStreamer and GNOME using the GStreamer popt tables */
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000088 options[0].arg = (void *) gst_init_get_popt_table ();
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000089 gnome_program_init ("my-application", "0.0.1", LIBGNOMEUI_MODULE, argc, argv,
90 GNOME_PARAM_POPT_TABLE, options,
91 NULL);
92<!-- example-end gnome.c a -->
93[..]<!-- example-begin gnome.c b --><!--
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000094 return 0;
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000095--><!-- example-end gnome.c b -->
96<!-- example-begin gnome.c c -->
Thomas Vander Stichelee4383152004-12-15 07:30:55 +000097}
Ronald S. Bultje1fef2702004-12-23 14:26:14 +000098 <!-- example-end gnome.c c --></programlisting>
99 </listitem>
100 <listitem>
101 <para>
102 GNOME stores the default video and audio sources and sinks in GConf.
103 &GStreamer; provides a small utility library that can be used to
104 get the elements from the registry using functions such as
105 <function>gst_gconf_get_default_video_sink ()</function>. See the
106 header file (<filename>gst/gconf/gconf.h</filename>) for details.
107 All GNOME applications are recommended to use those variables.
108 </para>
109 </listitem>
110 <listitem>
111 <para>
112 &GStreamer; provides data input/output elements for use with the
113 GNOME-VFS system. These elements are called <quote>gnomevfssrc</quote>
114 and <quote>gnomevfssink</quote>.
115 </para>
116 </listitem>
117 </itemizedlist>
118 </sect1>
119
120 <sect1 id="section-integration-kde">
121 <title>KDE desktop</title>
Thomas Vander Stichelee4383152004-12-15 07:30:55 +0000122 <para>
Ronald S. Bultje1fef2702004-12-23 14:26:14 +0000123 &GStreamer; has been proposed for inclusion in KDE-4.0. Currently,
124 &GStreamer; is included as an optional component, and it's used by
125 several KDE applications, including <ulink type="http"
Ronald S. Bultjeedcaf2c2005-06-30 12:32:17 +0000126 url="http://amarok.kde.org/">AmaroK</ulink>, <ulink type="http"
127 url="http://developer.kde.org/~wheeler/juk.html">JuK</ulink>,
128 <ulink type="http"
129 url="http://www.xs4all.nl/~jjvrieze/kmplayer.html">KMPlayer</ulink> and
130 <ulink type="http"
131 url="http://kaffeine.sourceforge.net/">Kaffeine</ulink>.
Thomas Vander Stichelee4383152004-12-15 07:30:55 +0000132 </para>
133 <para>
Ronald S. Bultje1fef2702004-12-23 14:26:14 +0000134 Although not yet as complete as the GNOME integration bits, there
135 are already some KDE integration specifics available. This list will
136 probably grow as &GStreamer; starts to be used in KDE-4.0:
137 </para>
138 <itemizedlist>
139 <listitem>
140 <para>
141 AmaroK contains a kiosrc element, which is a source element that
142 integrates with the KDE VFS subsystem KIO.
143 </para>
144 </listitem>
145 </itemizedlist>
146 </sect1>
147
148 <sect1 id="section-integration-osx">
149 <title>OS X</title>
150 <para>
151 &GStreamer; provides native video and audio output elements for OS X.
152 It builds using the standard development tools for OS X.
153 </para>
154 </sect1>
155
156 <sect1 id="section-integration-win32">
157 <title>Windows</title>
158 <para>
159 &GStreamer; builds using Microsoft Visual C .NET 2003 and using Cygwin.
Thomas Vander Stichelee4383152004-12-15 07:30:55 +0000160 </para>
161 </sect1>
162</chapter>