2004-12-23 14:26:14 +00:00
<chapter id= "chapter-intgration" >
<title > Integration</title>
<para >
&GStreamer; tries to integrate closely with operating systems (such
as Linux and UNIX-like operating systems, OS X or Windows) and desktop
environments (such as GNOME or KDE). In this chapter, we'll mention
some specific techniques to integrate your application with your
operating system or desktop environment of choice.
2004-12-15 07:30:55 +00:00
</para>
2008-06-25 14:44:52 +00:00
<!-- ####################################################################### -->
<!-- ####################################################################### -->
<!-- ####################################################################### -->
2004-12-23 14:26:14 +00:00
<sect1 id= "section-integration-nix" >
<title > Linux and UNIX-like operating systems</title>
2004-12-15 07:30:55 +00:00
<para >
2004-12-23 14:26:14 +00:00
&GStreamer; provides a basic set of elements that are useful when
integrating with Linux or a UNIX-like operating system.
2004-12-15 07:30:55 +00:00
</para>
2004-12-23 14:26:14 +00:00
<itemizedlist >
<listitem >
<para >
For audio input and output, &GStreamer; provides input and
output elements for several audio subsystems. Amongst others,
2012-09-25 12:40:20 +00:00
&GStreamer; includes elements for ALSA (alsasrc,
alsasink), OSS (osssrc, osssink) Pulesaudio (pulsesrc, pulsesink)
and Sun audio (sunaudiosrc, sunaudiomixer, sunaudiosink).
2004-12-23 14:26:14 +00:00
</para>
</listitem>
<listitem >
<para >
For video input, &GStreamer; contains source elements for
2012-09-25 12:40:20 +00:00
Video4linux2 (v4l2src, v4l2element, v4l2sink).
2004-12-23 14:26:14 +00:00
</para>
</listitem>
<listitem >
<para >
For video output, &GStreamer; provides elements for output
to X-windows (ximagesink), Xv-windows (xvimagesink; for
hardware-accelerated video), direct-framebuffer (dfbimagesink)
and openGL image contexts (glsink).
</para>
</listitem>
</itemizedlist>
</sect1>
2004-12-15 07:30:55 +00:00
2008-06-25 14:44:52 +00:00
<!-- ####################################################################### -->
<!-- ####################################################################### -->
<!-- ####################################################################### -->
2004-12-23 14:26:14 +00:00
<sect1 id= "section-integration-gnome" >
<title > GNOME desktop</title>
<para >
&GStreamer; has been the media backend of the <ulink type= "http"
url="http://www.gnome.org/">GNOME</ulink> desktop since GNOME-2.2
onwards. Nowadays, a whole bunch of GNOME applications make use of
&GStreamer; for media-processing, including (but not limited to)
<ulink type= "http" url= "http://www.rhythmbox.org/" > Rhythmbox</ulink> ,
2013-12-18 10:19:46 +00:00
<ulink type= "http" url= "https://wiki.gnome.org/Apps/Videos" > Videos</ulink>
2004-12-23 14:26:14 +00:00
and <ulink type= "http"
2013-12-18 10:19:46 +00:00
url="https://wiki.gnome.org/Apps/SoundJuicer">Sound
2004-12-23 14:26:14 +00:00
Juicer</ulink> .
</para>
<para >
Most of these GNOME applications make use of some specific techniques
to integrate as closely as possible with the GNOME desktop:
</para>
<itemizedlist >
<listitem >
<para >
2009-08-19 14:24:39 +00:00
GNOME applications usually call <function > gtk_init ()</function>
to parse command-line options and initialize GTK. &GStreamer;
applications would normally call <function > gst_init ()</function>
to do the same for GStreamer.
2004-12-23 14:26:14 +00:00
This would mean that only one of the two can parse command-line
options. To work around this issue, &GStreamer; can provide a
2006-01-13 19:17:05 +00:00
GLib <classname > GOptionGroup</classname> which can be passed to
<function > gnome_program_init ()</function> . The following
2009-08-19 14:24:39 +00:00
example requires GTK 2.6 or newer (previous GTK versions
do not support command line parsing via GOption yet)
2004-12-23 14:26:14 +00:00
</para>
<programlisting > <!-- example - begin gnome.c a -->
2009-08-19 14:24:39 +00:00
#include < gtk/gtk.h>
2004-12-15 17:32:49 +00:00
#include < gst/gst.h>
2004-12-15 07:30:55 +00:00
2006-01-13 19:17:05 +00:00
static gchar **cmd_filenames = NULL;
static GOptionEntries cmd_options[] = {
/* here you can add command line options for your application. Check
* the GOption section in the GLib API reference for a more elaborate
* example of how to add your own command line options here */
/* at the end we have a special option that collects all remaining
2008-06-24 19:56:51 +00:00
* command line arguments (like filenames) for us. If you don' t
2006-01-13 19:17:05 +00:00
* need this, you can safely remove it */
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, & cmd_filenames,
"Special option that collects any remaining arguments for us" },
/* mark the end of the options array with a NULL option */
{ NULL, }
};
/* this should usually be defined in your config.h */
#define VERSION "0.0.1"
2004-12-23 14:26:14 +00:00
gint
2006-01-13 19:17:05 +00:00
main (gint argc, gchar **argv)
2004-12-15 07:30:55 +00:00
{
2006-01-13 19:17:05 +00:00
GOptionContext *context;
2009-08-19 14:24:39 +00:00
GOptionGroup *gstreamer_group, *gtk_group;
GError *err = NULL;
2006-01-13 19:17:05 +00:00
2009-08-19 14:24:39 +00:00
context = g_option_context_new ("gtk-demo-app");
2006-01-13 19:17:05 +00:00
/* get command line options from GStreamer and add them to the group */
gstreamer_group = gst_init_get_option_group ();
g_option_context_add_group (context, gstreamer_group);
2009-08-19 14:24:39 +00:00
gtk_group = gtk_get_option_group (TRUE);
g_option_context_add_group (context, gtk_group);
2006-01-13 19:17:05 +00:00
/* add our own options. If you are using gettext for translation of your
* strings, use GETTEXT_PACKAGE here instead of NULL */
g_option_context_add_main_entries (context, cmd_options, NULL);
2009-08-19 14:24:39 +00:00
/* now parse the commandline options, note that this already
* calls gtk_init() and gst_init() */
if (!g_option_context_parse (ctx, & argc, & argv, & err)) {
g_print ("Error initializing: %s\n", err->message);
2015-08-20 07:21:59 +00:00
g_clear_error (& err);
g_option_context_free (ctx);
2009-08-19 14:24:39 +00:00
exit (1);
}
2015-08-20 07:21:59 +00:00
g_option_context_free (ctx);
2006-01-13 19:17:05 +00:00
/* any filenames we got passed on the command line? parse them! */
if (cmd_filenames != NULL) {
guint i, num;
num = g_strv_length (cmd_filenames);
for (i = 0; i < num; ++i) {
/* do something with the filename ... */
g_print ("Adding to play queue: %s\n", cmd_filenames[i]);
}
2004-12-15 07:30:55 +00:00
2006-01-13 19:17:05 +00:00
g_strfreev (cmd_filenames);
cmd_filenames = NULL;
}
2004-12-23 14:26:14 +00:00
<!-- example - end gnome.c a -->
[..]<!-- example - begin gnome.c b --> <!--
2004-12-15 07:30:55 +00:00
return 0;
2004-12-23 14:26:14 +00:00
--><!-- example - end gnome.c b -->
<!-- example - begin gnome.c c -->
2004-12-15 07:30:55 +00:00
}
2004-12-23 14:26:14 +00:00
<!-- example - end gnome.c c --> </programlisting>
</listitem>
<listitem >
<para >
2013-05-24 07:24:10 +00:00
GNOME uses Pulseaudio for audio, use the pulsesrc and
pulsesink elements to have access to all the features.
2004-12-23 14:26:14 +00:00
</para>
</listitem>
<listitem >
<para >
&GStreamer; provides data input/output elements for use with the
2009-08-19 14:24:39 +00:00
GIO VFS system. These elements are called <quote > giosrc</quote>
and <quote > giosink</quote> .
The deprecated GNOME-VFS system is supported too but shouldn't be
used for any new applications.
2004-12-23 14:26:14 +00:00
</para>
</listitem>
</itemizedlist>
</sect1>
2008-06-25 14:44:52 +00:00
<!-- ####################################################################### -->
<!-- ####################################################################### -->
<!-- ####################################################################### -->
2004-12-23 14:26:14 +00:00
<sect1 id= "section-integration-kde" >
<title > KDE desktop</title>
<para >
&GStreamer; has been proposed for inclusion in KDE-4.0. Currently,
&GStreamer; is included as an optional component, and it's used by
several KDE applications, including <ulink type= "http"
2005-06-30 12:32:17 +00:00
url="http://amarok.kde.org/">AmaroK</ulink> , <ulink type= "http"
url="http://developer.kde.org/~wheeler/juk.html">JuK</ulink> ,
<ulink type= "http"
url="http://www.xs4all.nl/~jjvrieze/kmplayer.html">KMPlayer</ulink> and
<ulink type= "http"
url="http://kaffeine.sourceforge.net/">Kaffeine</ulink> .
2004-12-23 14:26:14 +00:00
</para>
<para >
Although not yet as complete as the GNOME integration bits, there
are already some KDE integration specifics available. This list will
probably grow as &GStreamer; starts to be used in KDE-4.0:
</para>
<itemizedlist >
<listitem >
<para >
AmaroK contains a kiosrc element, which is a source element that
integrates with the KDE VFS subsystem KIO.
</para>
</listitem>
</itemizedlist>
</sect1>
2008-06-25 14:44:52 +00:00
<!-- ####################################################################### -->
<!-- ####################################################################### -->
<!-- ####################################################################### -->
2004-12-23 14:26:14 +00:00
<sect1 id= "section-integration-osx" >
<title > OS X</title>
2004-12-15 07:30:55 +00:00
<para >
2004-12-23 14:26:14 +00:00
&GStreamer; provides native video and audio output elements for OS X.
It builds using the standard development tools for OS X.
2004-12-15 07:30:55 +00:00
</para>
2004-12-23 14:26:14 +00:00
</sect1>
2008-06-25 14:44:52 +00:00
<!-- ####################################################################### -->
<!-- ####################################################################### -->
<!-- ####################################################################### -->
2004-12-23 14:26:14 +00:00
<sect1 id= "section-integration-win32" >
<title > Windows</title>
2008-06-25 14:44:52 +00:00
<warning >
<para >
2012-10-02 11:22:35 +00:00
Note: this section is out of date. GStreamer-1.0 has much better
2008-06-25 14:44:52 +00:00
support for win32 than previous versions though and should usually compile
and work out-of-the-box both using MSYS/MinGW or Microsoft compilers. The
<ulink url= "http://gstreamer.freedesktop.org" > GStreamer web site</ulink> and the
<ulink url= "http://news.gmane.org/gmane.comp.video.gstreamer.devel" > mailing list
archives</ulink> are a good place to check the latest win32-related news.
</para>
</warning>
2004-12-15 07:30:55 +00:00
<para >
2004-12-23 14:26:14 +00:00
&GStreamer; builds using Microsoft Visual C .NET 2003 and using Cygwin.
2004-12-15 07:30:55 +00:00
</para>
2008-06-25 14:44:52 +00:00
<sect2 id= "section-win32-build" >
<title > Building <application > GStreamer</application> under Win32</title>
<para > There are different makefiles that can be used to build GStreamer with the usual Microsoft
compiling tools.</para>
<para > The Makefile is meant to be used with the GNU make program and the free
version of the Microsoft compiler (<ulink url= "http://msdn.microsoft.com/visualc/vctoolkit2003/" > http://msdn.microsoft.com/visualc/vctoolkit2003/</ulink> ). You also
have to modify your system environment variables to use it from the command-line. You will also
need a working Platform SDK for Windows that is available for free from Microsoft.</para>
<para > The projects/makefiles will generate automatically some source files needed to compile
GStreamer. That requires that you have installed on your system some GNU tools and that they are
available in your system PATH.</para>
<para > The GStreamer project depends on other libraries, namely :</para>
<itemizedlist >
<listitem > <para > GLib</para> </listitem>
<listitem > <para > libxml2</para> </listitem>
<listitem > <para > libintl</para> </listitem>
<listitem > <para > libiconv</para> </listitem>
</itemizedlist>
2012-10-02 11:22:35 +00:00
<para > Work is being done to provide pre-compiled GStreamer-1.0 libraries as
2008-06-25 14:44:52 +00:00
a packages for win32. Check the <ulink url= "http://gstreamer.freedesktop.org" >
GStreamer web site</ulink> and check our
<ulink url= "http://news.gmane.org/gmane.comp.video.gstreamer.devel" > mailing list
</ulink> for the latest developments in this respect.</para>
<note >
<title > Notes</title>
<para > GNU tools needed that you can find on <ulink url= "http://gnuwin32.sourceforge.net/" > http://gnuwin32.sourceforge.net/</ulink> </para>
<itemizedlist >
<listitem > <para > GNU flex (tested with 2.5.4)</para> </listitem>
<listitem > <para > GNU bison (tested with 1.35)</para> </listitem>
</itemizedlist>
<para > and <ulink url= "http://www.mingw.org/" > http://www.mingw.org/</ulink> </para>
<itemizedlist >
<listitem > <para > GNU make (tested with 3.80)</para> </listitem>
</itemizedlist>
<para > the generated files from the -auto makefiles will be available soon separately on the net
for convenience (people who don't want to install GNU tools).</para>
</note>
</sect2>
<sect2 id= "section-win32-install" >
<title > Installation on the system</title>
2012-10-02 11:22:35 +00:00
<para > FIXME: This section needs be updated for GStreamer-1.0.</para>
2008-06-25 14:44:52 +00:00
<!--
<para > By default, GStreamer needs a registry. You have to generate it using "gst-register.exe". It will create
the file in c:\gstreamer\registry.xml that will hold all the plugins you can use.</para>
<para > You should install the GStreamer core in c:\gstreamer\bin and the plugins in c:\gstreamer\plugins. Both
directories should be added to your system PATH. The library dependencies should be installed in c:\usr</para>
<para > For example, my current setup is :</para>
<itemizedlist >
<listitem > <para > <filename > c:\gstreamer\registry.xml</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\gst-inspect.exe</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\gst-launch.exe</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\gst-register.exe</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\gstbytestream.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\gstelements.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\gstoptimalscheduler.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\gstspider.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\bin\libgtreamer-0.8.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\plugins\gst-libs.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\gstreamer\plugins\gstmatroska.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\usr\bin\iconv.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\usr\bin\intl.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\usr\bin\libglib-2.0-0.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\usr\bin\libgmodule-2.0-0.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\usr\bin\libgobject-2.0-0.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\usr\bin\libgthread-2.0-0.dll</filename> </para> </listitem>
<listitem > <para > <filename > c:\usr\bin\libxml2.dll</filename> </para> </listitem>
</itemizedlist>
-->
</sect2>
2004-12-15 07:30:55 +00:00
</sect1>
2008-06-25 14:44:52 +00:00
2004-12-15 07:30:55 +00:00
</chapter>