Integration
&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.
Linux and UNIX-like operating systems
&GStreamer; provides a basic set of elements that are useful when
integrating with Linux or a UNIX-like operating system.
For audio input and output, &GStreamer; provides input and
output elements for several audio subsystems. Amongst others,
&GStreamer; includes elements for ALSA (alsasrc, alsamixer,
alsasink), OSS (osssrc, ossmixer, osssink) and Sun audio
(sunaudiosrc, sunaudiomixer, sunaudiosink).
For video input, &GStreamer; contains source elements for
Video4linux (v4lsrc, v4lmjpegsrc, v4lelement and v4lmjpegisnk)
and Video4linux2 (v4l2src, v4l2element).
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).
GNOME desktop
&GStreamer; has been the media backend of the GNOME 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)
Rhythmbox,
Totem
and Sound
Juicer.
Most of these GNOME applications make use of some specific techniques
to integrate as closely as possible with the GNOME desktop:
GNOME applications call gnome_program_init ()
to parse command-line options and initialize the necessary gnome
modules. &GStreamer; applications would normally call
gst_init () to do the same for GStreamer.
This would mean that only one of the two can parse command-line
options. To work around this issue, &GStreamer; can provide a
poptOption array which can be passed to
gnome_program_init ().
#include <gnome.h>
#include <gst/gst.h>
gint
main (gint argc,
gchar *argv[])
{
struct poptOption options[] = {
{NULL, '\0', POPT_ARG_INCLUDE_TABLE, NULL, 0, "GStreamer", NULL},
POPT_TABLEEND
};
/* init GStreamer and GNOME using the GStreamer popt tables */
options[0].arg = (void *) gst_init_get_popt_table ();
gnome_program_init ("my-application", "0.0.1", LIBGNOMEUI_MODULE, argc, argv,
GNOME_PARAM_POPT_TABLE, options,
NULL);
[..]
}
GNOME stores the default video and audio sources and sinks in GConf.
&GStreamer; provides a small utility library that can be used to
get the elements from the registry using functions such as
gst_gconf_get_default_video_sink (). See the
header file (gst/gconf/gconf.h) for details.
All GNOME applications are recommended to use those variables.
&GStreamer; provides data input/output elements for use with the
GNOME-VFS system. These elements are called gnomevfssrc
and gnomevfssink
.
KDE desktop
&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 AmaroK and JuK. A
backend for KMPlayer
is currently under development.
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:
AmaroK contains a kiosrc element, which is a source element that
integrates with the KDE VFS subsystem KIO.
OS X
&GStreamer; provides native video and audio output elements for OS X.
It builds using the standard development tools for OS X.
Windows
&GStreamer; builds using Microsoft Visual C .NET 2003 and using Cygwin.