summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2002-10-16 19:47:05 +0000
committerAndy Wingo <wingo@pobox.com>2002-10-16 19:47:05 +0000
commit4754e4e8ccbdafd14e97b846f343500214060b99 (patch)
tree5425155bcf260f2c0b487d623dc9ce72672b0785
parent676ecc296a65ac490633149dde175661d77caa99 (diff)
downloadgstreamer-plugins-bad-4754e4e8ccbdafd14e97b846f343500214060b99.tar.gz
added functions gst_gconf_get_default_{audio,video}_sink -- this is so the defaults library (gstgconf) can be used by...
Original commit message from CVS: added functions gst_gconf_get_default_{audio,video}_sink -- this is so the defaults library (gstgconf) can be used by applications with uninstalled gstreamer (ie, no gconf keys). More specifically, these functions enable the player to work uninstalled, which is a good thing (tm).
-rw-r--r--gst-libs/gst/gconf/gconf.c44
-rw-r--r--gst-libs/gst/gconf/gconf.h3
2 files changed, 43 insertions, 4 deletions
diff --git a/gst-libs/gst/gconf/gconf.c b/gst-libs/gst/gconf/gconf.c
index 3da2c310a..f14a0a6c7 100644
--- a/gst-libs/gst/gconf/gconf.c
+++ b/gst-libs/gst/gconf/gconf.c
@@ -11,7 +11,7 @@ static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
/* internal functions */
-GConfClient *
+static GConfClient *
gst_gconf_get_client (void)
{
if (!_gst_gconf_client)
@@ -19,9 +19,10 @@ gst_gconf_get_client (void)
return _gst_gconf_client;
}
+
/* go through a bin, finding the one pad that is unconnected in the given
* * direction, and return that pad */
-GstPad *
+static GstPad *
gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
{
GstPad *pad = NULL;
@@ -117,11 +118,12 @@ gst_gconf_render_bin_from_description (const gchar *description)
GstElement *
gst_gconf_render_bin_from_key (const gchar *key)
{
- GstElement *bin;
+ GstElement *bin = NULL;
gchar *value;
value = gst_gconf_get_string (key);
- bin = gst_gconf_render_bin_from_description (value);
+ if (value)
+ bin = gst_gconf_render_bin_from_description (value);
return bin;
}
@@ -131,6 +133,40 @@ guint gst_gconf_notify_add (const gchar *key,
gpointer user_data);
*/
+GstElement *
+gst_gconf_get_default_audio_sink (void)
+{
+ GstElement *ret = gst_gconf_render_bin_from_key ("default/audiosink");
+
+ if (!ret) {
+ ret = gst_element_factory_make ("osssink", NULL);
+
+ if (!ret)
+ g_warning ("No GConf default audio sink key and osssink doesn't work");
+ else
+ g_warning ("GConf audio sink not found, using osssink");
+ }
+
+ return ret;
+}
+
+GstElement *
+gst_gconf_get_default_video_sink (void)
+{
+ GstElement *ret = gst_gconf_render_bin_from_key ("default/videosink");
+
+ if (!ret) {
+ ret = gst_element_factory_make ("xvideosink", NULL);
+
+ if (!ret)
+ g_warning ("No GConf default video sink key and xvideosink doesn't work");
+ else
+ g_warning ("GConf video sink not found, using xvideosink");
+ }
+
+ return ret;
+}
+
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{
diff --git a/gst-libs/gst/gconf/gconf.h b/gst-libs/gst/gconf/gconf.h
index a054dc3e8..c1ed9d420 100644
--- a/gst-libs/gst/gconf/gconf.h
+++ b/gst-libs/gst/gconf/gconf.h
@@ -15,6 +15,9 @@ void gst_gconf_set_string (const gchar *key,
GstElement * gst_gconf_render_bin_from_key (const gchar *key);
GstElement * gst_gconf_render_bin_from_description (const gchar *description);
+GstElement * gst_gconf_get_default_video_sink (void);
+GstElement * gst_gconf_get_default_audio_sink (void);
+
/*
guint gst_gconf_notify_add (const gchar *key,
GConfClientNotifyFunc func,