summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst/gconf
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch)
treef863b467dea9559a6ec9c48affbfae11f8104164 /gst-libs/gst/gconf
parenta19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff)
downloadgst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst-libs/gst/gconf')
-rw-r--r--gst-libs/gst/gconf/gconf.c70
-rw-r--r--gst-libs/gst/gconf/gconf.h19
-rw-r--r--gst-libs/gst/gconf/test-gconf.c16
3 files changed, 49 insertions, 56 deletions
diff --git a/gst-libs/gst/gconf/gconf.c b/gst-libs/gst/gconf/gconf.c
index a96b786f..1887b718 100644
--- a/gst-libs/gst/gconf/gconf.c
+++ b/gst-libs/gst/gconf/gconf.c
@@ -31,7 +31,7 @@
#error "GST_GCONF_DIR is not defined !"
#endif
-static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
+static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
/* internal functions */
@@ -48,7 +48,7 @@ gst_gconf_get_client (void)
/* go through a bin, finding the one pad that is unconnected in the given
* * direction, and return that pad */
static GstPad *
-gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
+gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction)
{
GstPad *pad = NULL;
GList *elements = NULL;
@@ -57,22 +57,19 @@ gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
elements = (GList *) gst_bin_get_list (bin);
/* traverse all elements looking for unconnected pads */
- while (elements && pad == NULL)
- {
+ while (elements && pad == NULL) {
element = GST_ELEMENT (elements->data);
pads = gst_element_get_pad_list (element);
- while (pads)
- {
+ while (pads) {
/* check if the direction matches */
- if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction)
- {
- if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL)
- {
- /* found it ! */
+ if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) {
+ if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
+ /* found it ! */
pad = GST_PAD (pads->data);
}
}
- if (pad) break; /* found one already */
+ if (pad)
+ break; /* found one already */
pads = g_list_next (pads);
}
elements = g_list_next (elements);
@@ -91,7 +88,7 @@ gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
* Returns: a #gchar string containing @key's value.
*/
gchar *
-gst_gconf_get_string (const gchar *key)
+gst_gconf_get_string (const gchar * key)
{
GError *error = NULL;
gchar *value = NULL;
@@ -101,8 +98,7 @@ gst_gconf_get_string (const gchar *key)
value = gconf_client_get_string (gst_gconf_get_client (), full_key, &error);
g_free (full_key);
- if (error)
- {
+ if (error) {
g_print ("gst_gconf_get_string: error: %s\n", error->message);
g_error_free (error);
}
@@ -118,14 +114,13 @@ gst_gconf_get_string (const gchar *key)
* Set GConf key @key to string value @value.
*/
void
-gst_gconf_set_string (const gchar *key, const gchar *value)
+gst_gconf_set_string (const gchar * key, const gchar * value)
{
GError *error = NULL;
gchar *full_key = g_strdup_printf ("%s/%s", GST_GCONF_DIR, key);
gconf_client_set_string (gst_gconf_get_client (), full_key, value, &error);
- if (error)
- {
+ if (error) {
g_print ("gst_gconf_set_string: error: %s\n", error->message);
g_error_free (error);
}
@@ -141,7 +136,7 @@ gst_gconf_set_string (const gchar *key, const gchar *value)
* Returns: a #GstElement containing the rendered bin.
*/
GstElement *
-gst_gconf_render_bin_from_description (const gchar *description)
+gst_gconf_render_bin_from_description (const gchar * description)
{
GstElement *bin = NULL;
GstPad *pad = NULL;
@@ -152,19 +147,18 @@ gst_gconf_render_bin_from_description (const gchar *description)
desc = g_strdup_printf ("bin.( %s )", description);
bin = GST_ELEMENT (gst_parse_launch (desc, &error));
g_free (desc);
- if (error)
- {
+ if (error) {
g_print ("DEBUG: gstgconf: error parsing pipeline %s\n%s\n",
- description, error->message);
+ description, error->message);
g_error_free (error);
return NULL;
}
/* find pads and ghost them if necessary */
- if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))){
+ if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))) {
gst_element_add_ghost_pad (bin, pad, "src");
}
- if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SINK))){
+ if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SINK))) {
gst_element_add_ghost_pad (bin, pad, "sink");
}
return bin;
@@ -179,11 +173,11 @@ gst_gconf_render_bin_from_description (const gchar *description)
* Returns: a #GstElement containing the rendered bin.
*/
GstElement *
-gst_gconf_render_bin_from_key (const gchar *key)
+gst_gconf_render_bin_from_key (const gchar * key)
{
GstElement *bin = NULL;
gchar *value;
-
+
value = gst_gconf_get_string (key);
if (value)
bin = gst_gconf_render_bin_from_description (value);
@@ -203,10 +197,10 @@ 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
@@ -229,10 +223,10 @@ 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 ("ximagesink", NULL);
-
+
if (!ret)
g_warning ("No GConf default video sink key and ximagesink doesn't work");
else
@@ -255,10 +249,10 @@ GstElement *
gst_gconf_get_default_audio_src (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/audiosrc");
-
+
if (!ret) {
ret = gst_element_factory_make ("osssrc", NULL);
-
+
if (!ret)
g_warning ("No GConf default audio src key and osssrc doesn't work");
else
@@ -282,10 +276,10 @@ GstElement *
gst_gconf_get_default_video_src (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/videosrc");
-
+
if (!ret) {
ret = gst_element_factory_make ("videotestsrc", NULL);
-
+
if (!ret)
g_warning ("No GConf default video src key and videotestrc doesn't work");
else
@@ -308,16 +302,16 @@ GstElement *
gst_gconf_get_default_visualization_element (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/visualization");
-
+
if (!ret) {
ret = gst_element_factory_make ("goom", NULL);
-
+
if (!ret)
- g_warning ("No GConf default visualization plugin key and goom doesn't work");
+ g_warning
+ ("No GConf default visualization plugin key and goom doesn't work");
else
g_print ("GConf visualization plugin not found, using goom\n");
}
return ret;
}
-
diff --git a/gst-libs/gst/gconf/gconf.h b/gst-libs/gst/gconf/gconf.h
index 70007f77..79546a7a 100644
--- a/gst-libs/gst/gconf/gconf.h
+++ b/gst-libs/gst/gconf/gconf.h
@@ -27,17 +27,16 @@
#include <gst/gst.h>
#include <gconf/gconf-client.h>
-gchar * gst_gconf_get_string (const gchar *key);
-void gst_gconf_set_string (const gchar *key,
- const gchar *value);
+gchar *gst_gconf_get_string (const gchar * key);
+void gst_gconf_set_string (const gchar * key, const gchar * value);
-GstElement * gst_gconf_render_bin_from_key (const gchar *key);
-GstElement * gst_gconf_render_bin_from_description (const gchar *description);
+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);
-GstElement * gst_gconf_get_default_video_src (void);
-GstElement * gst_gconf_get_default_audio_src (void);
-GstElement * gst_gconf_get_default_visualization_element (void);
+GstElement *gst_gconf_get_default_video_sink (void);
+GstElement *gst_gconf_get_default_audio_sink (void);
+GstElement *gst_gconf_get_default_video_src (void);
+GstElement *gst_gconf_get_default_audio_src (void);
+GstElement *gst_gconf_get_default_visualization_element (void);
#endif /* GST_GCONF_H */
diff --git a/gst-libs/gst/gconf/test-gconf.c b/gst-libs/gst/gconf/test-gconf.c
index 06d5b61d..a3c99646 100644
--- a/gst-libs/gst/gconf/test-gconf.c
+++ b/gst-libs/gst/gconf/test-gconf.c
@@ -22,13 +22,13 @@
int
main (int argc, char *argv[])
{
- printf ("Default video sink : %s\n",
- gst_gconf_get_string ("default/videosink"));
- printf ("Default audio sink : %s\n",
- gst_gconf_get_string ("default/audiosink"));
- printf ("Default video src : %s\n",
- gst_gconf_get_string ("default/videosrc"));
- printf ("Default audio src : %s\n",
- gst_gconf_get_string ("default/audiosrc"));
+ printf ("Default video sink : %s\n",
+ gst_gconf_get_string ("default/videosink"));
+ printf ("Default audio sink : %s\n",
+ gst_gconf_get_string ("default/audiosink"));
+ printf ("Default video src : %s\n",
+ gst_gconf_get_string ("default/videosrc"));
+ printf ("Default audio src : %s\n",
+ gst_gconf_get_string ("default/audiosrc"));
return 0;
}