add Jurg's patch for multidevice support

Original commit message from CVS:
add Jurg's patch for multidevice support
This commit is contained in:
Christian Schaller 2006-02-17 10:53:38 +00:00
parent 1514ba29e9
commit 72aef06e49
6 changed files with 285 additions and 9 deletions

View file

@ -1,5 +1,6 @@
/* GStreamer
* Copyright (C) <2002> Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) <2006> Jürg Billeter <j@bitron.ch>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -128,6 +129,7 @@ gst_gconf_render_bin_from_key (const gchar * key)
/**
* gst_gconf_get_default_audio_sink:
* @profile: the appropriate application profile.
*
* Render audio output bin from GStreamer GConf key : "default/audiosink".
* If key is invalid, the default audio sink for the platform is used
@ -137,9 +139,30 @@ gst_gconf_render_bin_from_key (const gchar * key)
* everything failed.
*/
GstElement *
gst_gconf_get_default_audio_sink (void)
gst_gconf_get_default_audio_sink (int profile)
{
GstElement *ret = gst_gconf_render_bin_from_key (GST_GCONF_AUDIOSINK_KEY);
GstElement *ret;
gchar *key;
const gchar *profile_string;
switch (profile) {
case GCONF_PROFILE_SOUNDS:
profile_string = "";
break;
case GCONF_PROFILE_MUSIC:
profile_string = "music";
break;
case GCONF_PROFILE_CHAT:
profile_string = "chat";
break;
default:
g_return_val_if_reached (NULL);
}
key = g_strdup_printf ("default/%saudiosink", profile_string);
ret = gst_gconf_render_bin_from_key (key);
g_free (key);
if (!ret) {
ret = gst_element_factory_make (DEFAULT_AUDIOSINK, NULL);

View file

@ -1,5 +1,6 @@
/* GStreamer
* Copyright (C) <2002> Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) <2006> Jürg Billeter <j@bitron.ch>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -34,6 +35,13 @@ G_BEGIN_DECLS
#define GST_GCONF_VIDEOSRC_KEY "default/videosrc"
#define GST_GCONF_VIDEOSINK_KEY "default/videosink"
enum
{
GCONF_PROFILE_SOUNDS,
GCONF_PROFILE_MUSIC,
GCONF_PROFILE_CHAT
};
gchar * gst_gconf_get_string (const gchar *key);
void gst_gconf_set_string (const gchar *key,
const gchar *value);
@ -41,7 +49,7 @@ void gst_gconf_set_string (const gchar *key,
GstElement * gst_gconf_render_bin_from_key (const gchar *key);
GstElement * gst_gconf_get_default_video_sink (void);
GstElement * gst_gconf_get_default_audio_sink (void);
GstElement * gst_gconf_get_default_audio_sink (int profile);
GstElement * gst_gconf_get_default_video_src (void);
GstElement * gst_gconf_get_default_audio_src (void);
GstElement * gst_gconf_get_default_visualization_element (void);

View file

@ -1,5 +1,6 @@
/* GStreamer
* (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* (c) 2006 Jürg Billeter <j@bitron.ch>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -33,8 +34,19 @@ static GstStateChangeReturn
gst_gconf_audio_sink_change_state (GstElement * element,
GstStateChange transition);
enum
{
PROP_0,
PROP_PROFILE
};
GST_BOILERPLATE (GstGConfAudioSink, gst_gconf_audio_sink, GstBin, GST_TYPE_BIN);
static void gst_gconf_audio_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_gconf_audio_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
gst_gconf_audio_sink_base_init (gpointer klass)
{
@ -55,14 +67,39 @@ gst_gconf_audio_sink_base_init (gpointer klass)
gst_element_class_set_details (eklass, &gst_gconf_audio_sink_details);
}
#define GST_TYPE_GCONF_PROFILE (gst_gconf_profile_get_type())
static GType
gst_gconf_profile_get_type (void)
{
static GType gconf_profile_type = 0;
static GEnumValue gconf_profiles[] = {
{GCONF_PROFILE_SOUNDS, "Sound Events", "sounds"},
{GCONF_PROFILE_MUSIC, "Music and Movies", "music"},
{GCONF_PROFILE_CHAT, "Audio/Video Conferencing", "chat"},
{0, NULL, NULL}
};
if (!gconf_profile_type) {
gconf_profile_type =
g_enum_register_static ("GstGConfProfile", gconf_profiles);
}
return gconf_profile_type;
}
static void
gst_gconf_audio_sink_class_init (GstGConfAudioSinkClass * klass)
{
GObjectClass *oklass = G_OBJECT_CLASS (klass);
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
oklass->set_property = gst_gconf_audio_sink_set_property;
oklass->get_property = gst_gconf_audio_sink_get_property;
oklass->dispose = gst_gconf_audio_sink_dispose;
eklass->change_state = gst_gconf_audio_sink_change_state;
g_object_class_install_property (oklass, PROP_PROFILE,
g_param_spec_enum ("profile", "Profile", "Profile",
GST_TYPE_GCONF_PROFILE, GCONF_PROFILE_SOUNDS, G_PARAM_READWRITE));
}
/*
@ -88,6 +125,26 @@ gst_gconf_audio_sink_reset (GstGConfAudioSink * sink)
g_free (sink->gconf_str);
sink->gconf_str = NULL;
if (sink->connection) {
gconf_client_notify_remove (sink->client, sink->connection);
sink->connection = 0;
}
}
static const gchar *
get_gconf_key_for_profile (int profile)
{
switch (profile) {
case GCONF_PROFILE_SOUNDS:
return GST_GCONF_DIR "/default/audiosink";
case GCONF_PROFILE_MUSIC:
return GST_GCONF_DIR "/default/musicaudiosink";
case GCONF_PROFILE_CHAT:
return GST_GCONF_DIR "/default/chataudiosink";
default:
g_return_val_if_reached (NULL);
}
}
static void
@ -102,9 +159,11 @@ gst_gconf_audio_sink_init (GstGConfAudioSink * sink,
sink->client = gconf_client_get_default ();
gconf_client_add_dir (sink->client, GST_GCONF_DIR,
GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
gconf_client_notify_add (sink->client,
GST_GCONF_DIR "/" GST_GCONF_AUDIOSINK_KEY,
cb_toggle_element, sink, NULL, NULL);
sink->profile = GCONF_PROFILE_SOUNDS;
sink->connection = gconf_client_notify_add (sink->client,
get_gconf_key_for_profile (sink->profile), cb_toggle_element,
sink, NULL, NULL);
}
static void
@ -113,6 +172,11 @@ gst_gconf_audio_sink_dispose (GObject * object)
GstGConfAudioSink *sink = GST_GCONF_AUDIO_SINK (object);
if (sink->client) {
if (sink->connection) {
gconf_client_notify_remove (sink->client, sink->connection);
sink->connection = 0;
}
g_object_unref (G_OBJECT (sink->client));
sink->client = NULL;
}
@ -168,7 +232,7 @@ do_toggle_element (GstGConfAudioSink * sink)
}
GST_DEBUG_OBJECT (sink, "Creating new kid");
if (!(sink->kid = gst_gconf_get_default_audio_sink ())) {
if (!(sink->kid = gst_gconf_get_default_audio_sink (sink->profile))) {
GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
("Failed to render audio sink from GConf"));
g_free (sink->gconf_str);
@ -188,6 +252,51 @@ do_toggle_element (GstGConfAudioSink * sink)
return TRUE;
}
static void
gst_gconf_audio_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstGConfAudioSink *sink;
g_return_if_fail (GST_IS_GCONF_AUDIO_SINK (object));
sink = GST_GCONF_AUDIO_SINK (object);
switch (prop_id) {
case PROP_PROFILE:
sink->profile = g_value_get_enum (value);
if (sink->connection) {
gconf_client_notify_remove (sink->client, sink->connection);
}
sink->connection = gconf_client_notify_add (sink->client,
get_gconf_key_for_profile (sink->profile), cb_toggle_element,
sink, NULL, NULL);
break;
default:
break;
}
}
static void
gst_gconf_audio_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstGConfAudioSink *sink;
g_return_if_fail (GST_IS_GCONF_AUDIO_SINK (object));
sink = GST_GCONF_AUDIO_SINK (object);
switch (prop_id) {
case PROP_PROFILE:
g_value_set_enum (value, sink->profile);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
cb_toggle_element (GConfClient * client,
guint connection_id, GConfEntry * entry, gpointer data)

View file

@ -43,6 +43,8 @@ typedef struct _GstGConfAudioSink {
/* explicit pointers to stuff used */
GConfClient *client;
int profile;
guint connection;
GstElement *kid;
GstPad *pad;

View file

@ -11,6 +11,116 @@
<long>GStreamer can play audio using any number of output elements. Some possible choices are osssink, esdsink and alsasink. The audiosink can be a partial pipeline instead of just one element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for default GStreamer audiosink</short>
<long>Describes the selected output element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>@DEFAULT_AUDIOSINK@</default>
<locale name="C">
<short>GStreamer audiosink for Music and Movies</short>
<long>GStreamer can play audio using any number of output elements. Some possible choices are osssink, esdsink and alsasink. The audiosink can be a partial pipeline instead of just one element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for GStreamer audiosink for Music and Movies</short>
<long>Describes the selected output element for Music and Movies.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>@DEFAULT_AUDIOSINK@</default>
<locale name="C">
<short>GStreamer audiosink for Audio/Video Conferencing</short>
<long>GStreamer can play audio using any number of output elements. Some possible choices are osssink, esdsink and alsasink. The audiosink can be a partial pipeline instead of just one element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for GStreamer audiosink for Audio/Video Conferencing</short>
<long>Describes the selected output element for Audio/Video Conferencing.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for default GStreamer audiosink</short>
<long>Describes the selected output element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>@DEFAULT_AUDIOSINK@</default>
<locale name="C">
<short>GStreamer audiosink for Music and Movies</short>
<long>GStreamer can play audio using any number of output elements. Some possible choices are osssink, esdsink and alsasink. The audiosink can be a partial pipeline instead of just one element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for GStreamer audiosink for Music and Movies</short>
<long>Describes the selected output element for Music and Movies.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>@DEFAULT_AUDIOSINK@</default>
<locale name="C">
<short>GStreamer audiosink for Audio/Video Conferencing</short>
<long>GStreamer can play audio using any number of output elements. Some possible choices are osssink, esdsink and alsasink. The audiosink can be a partial pipeline instead of just one element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for GStreamer audiosink for Audio/Video Conferencing</short>
<long>Describes the selected output element for Audio/Video Conferencing.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/videosink</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/videosink</applyto>
@ -33,6 +143,28 @@
<long>GStreamer can record audio using any number of input elements. Some possible choices are osssrc, esdsrc and alsasrc. The audio source can be a partial pipeline instead of just one element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for default GStreamer audiosrc</short>
<long>Describes the selected input element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description</applyto>
<owner>gstreamer</owner>
<type>string</type>
<default>Default</default>
<locale name="C">
<short>description for default GStreamer audiosrc</short>
<long>Describes the selected input element.</long>
</locale>
</schema>
<schema>
<key>/schemas/system/gstreamer/@GST_MAJORMINOR@/default/videosrc</key>
<applyto>/system/gstreamer/@GST_MAJORMINOR@/default/videosrc</applyto>

View file

@ -36,7 +36,7 @@ BuildRequires: gcc-c++
# @USE_RAW1394_TRUE@BuildRequires: libraw1394-devel
# @USE_RAW1394_TRUE@BuildRequires: libavc1394-devel
@USE_SPEEX_TRUE@BuildRequires: speex-devel
@USE_HAL_TRUE@BuildRequires: hal-devel
@USE_SHOUT2_TRUE@BuildRequires: libshout-devel >= 2.0
@USE_LADSPA_TRUE@BuildRequires: ladspa-devel
@USE_AALIB_TRUE@BuildRequires: aalib-devel >= 1.3
@ -112,6 +112,8 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/gstreamer-%{majorminor}/libgstmultipart.so
%{_libdir}/gstreamer-%{majorminor}/libgstid3demux.so
%{_libdir}/gstreamer-%{majorminor}/libgstcdio.so
%{_libdir}/gstreamer-%{majorminor}/libgstapetag.so
# gstreamer-plugins with external dependencies but in the main package
@USE_LIBCACA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstcacasink.so
@USE_ESD_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstesd.so
@ -123,7 +125,7 @@ rm -rf $RPM_BUILD_ROOT
## @USE_RAW1394_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgst1394.so
@USE_SPEEX_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstspeex.so
@USE_GCONF_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstgconfelements.so
@USE_HAL_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgsthalelements.so
# @USE_LADSPA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstladspa.so
@USE_SHOUT2_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstshout2.so
@USE_AALIB_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstaasink.so