From 72aef06e4930180ca06e9b98fd514d1fba69799c Mon Sep 17 00:00:00 2001 From: Christian Schaller Date: Fri, 17 Feb 2006 10:53:38 +0000 Subject: add Jurg's patch for multidevice support Original commit message from CVS: add Jurg's patch for multidevice support --- ext/gconf/gconf.c | 27 ++++++++- ext/gconf/gconf.h | 10 +++- ext/gconf/gstgconfaudiosink.c | 117 +++++++++++++++++++++++++++++++++++-- ext/gconf/gstgconfaudiosink.h | 2 + gconf/gstreamer.schemas.in | 132 ++++++++++++++++++++++++++++++++++++++++++ gst-plugins-good.spec.in | 6 +- 6 files changed, 285 insertions(+), 9 deletions(-) diff --git a/ext/gconf/gconf.c b/ext/gconf/gconf.c index 997087b6..c5c05d00 100644 --- a/ext/gconf/gconf.c +++ b/ext/gconf/gconf.c @@ -1,5 +1,6 @@ /* GStreamer * Copyright (C) <2002> Thomas Vander Stichele + * Copyright (C) <2006> Jürg Billeter * * 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); diff --git a/ext/gconf/gconf.h b/ext/gconf/gconf.h index b1892da4..3a747d5a 100644 --- a/ext/gconf/gconf.h +++ b/ext/gconf/gconf.h @@ -1,5 +1,6 @@ /* GStreamer * Copyright (C) <2002> Thomas Vander Stichele + * Copyright (C) <2006> Jürg Billeter * * 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); diff --git a/ext/gconf/gstgconfaudiosink.c b/ext/gconf/gstgconfaudiosink.c index 5e409519..4929c25b 100644 --- a/ext/gconf/gstgconfaudiosink.c +++ b/ext/gconf/gstgconfaudiosink.c @@ -1,5 +1,6 @@ /* GStreamer * (c) 2005 Ronald S. Bultje + * (c) 2006 Jürg Billeter * * 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) diff --git a/ext/gconf/gstgconfaudiosink.h b/ext/gconf/gstgconfaudiosink.h index 4b5fb709..66acd18a 100644 --- a/ext/gconf/gstgconfaudiosink.h +++ b/ext/gconf/gstgconfaudiosink.h @@ -43,6 +43,8 @@ typedef struct _GstGConfAudioSink { /* explicit pointers to stuff used */ GConfClient *client; + int profile; + guint connection; GstElement *kid; GstPad *pad; diff --git a/gconf/gstreamer.schemas.in b/gconf/gstreamer.schemas.in index e3d893c1..bc1ff44f 100644 --- a/gconf/gstreamer.schemas.in +++ b/gconf/gstreamer.schemas.in @@ -11,6 +11,116 @@ 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. + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description + /system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description + gstreamer + string + Default + + description for default GStreamer audiosink + Describes the selected output element. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink + /system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink + gstreamer + string + @DEFAULT_AUDIOSINK@ + + GStreamer audiosink for Music and Movies + 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. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description + /system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description + gstreamer + string + Default + + description for GStreamer audiosink for Music and Movies + Describes the selected output element for Music and Movies. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink + /system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink + gstreamer + string + @DEFAULT_AUDIOSINK@ + + GStreamer audiosink for Audio/Video Conferencing + 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. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description + /system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description + gstreamer + string + Default + + description for GStreamer audiosink for Audio/Video Conferencing + Describes the selected output element for Audio/Video Conferencing. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description + /system/gstreamer/@GST_MAJORMINOR@/default/audiosink_description + gstreamer + string + Default + + description for default GStreamer audiosink + Describes the selected output element. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink + /system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink + gstreamer + string + @DEFAULT_AUDIOSINK@ + + GStreamer audiosink for Music and Movies + 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. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description + /system/gstreamer/@GST_MAJORMINOR@/default/musicaudiosink_description + gstreamer + string + Default + + description for GStreamer audiosink for Music and Movies + Describes the selected output element for Music and Movies. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink + /system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink + gstreamer + string + @DEFAULT_AUDIOSINK@ + + GStreamer audiosink for Audio/Video Conferencing + 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. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description + /system/gstreamer/@GST_MAJORMINOR@/default/chataudiosink_description + gstreamer + string + Default + + description for GStreamer audiosink for Audio/Video Conferencing + Describes the selected output element for Audio/Video Conferencing. + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/videosink /system/gstreamer/@GST_MAJORMINOR@/default/videosink @@ -33,6 +143,28 @@ 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. + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description + /system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description + gstreamer + string + Default + + description for default GStreamer audiosrc + Describes the selected input element. + + + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description + /system/gstreamer/@GST_MAJORMINOR@/default/audiosrc_description + gstreamer + string + Default + + description for default GStreamer audiosrc + Describes the selected input element. + + /schemas/system/gstreamer/@GST_MAJORMINOR@/default/videosrc /system/gstreamer/@GST_MAJORMINOR@/default/videosrc diff --git a/gst-plugins-good.spec.in b/gst-plugins-good.spec.in index ea9f893f..9a90343c 100644 --- a/gst-plugins-good.spec.in +++ b/gst-plugins-good.spec.in @@ -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 -- cgit