aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-09 19:39:44 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-09 19:46:02 +0800
commit890efc4f52b81bf90fb5d130124d68fe071abc3f (patch)
tree02a9c8649f5e30dbf3598a40cab6ca62f50760c3 /src
parent3dd675c21527cabb74cd9b4301ea82324e0f17b6 (diff)
downloadgsoc2013-empathy-890efc4f52b81bf90fb5d130124d68fe071abc3f.tar
gsoc2013-empathy-890efc4f52b81bf90fb5d130124d68fe071abc3f.tar.gz
gsoc2013-empathy-890efc4f52b81bf90fb5d130124d68fe071abc3f.tar.bz2
gsoc2013-empathy-890efc4f52b81bf90fb5d130124d68fe071abc3f.tar.lz
gsoc2013-empathy-890efc4f52b81bf90fb5d130124d68fe071abc3f.tar.xz
gsoc2013-empathy-890efc4f52b81bf90fb5d130124d68fe071abc3f.tar.zst
gsoc2013-empathy-890efc4f52b81bf90fb5d130124d68fe071abc3f.zip
video-src: factor out dup_color_balance()
https://bugzilla.gnome.org/show_bug.cgi?id=658584
Diffstat (limited to 'src')
-rw-r--r--src/empathy-video-src.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/empathy-video-src.c b/src/empathy-video-src.c
index 25d257f3d..da86eda93 100644
--- a/src/empathy-video-src.c
+++ b/src/empathy-video-src.c
@@ -245,23 +245,32 @@ empathy_video_src_new (void)
return gst_element_factory_make ("empathyvideosrc", NULL);
}
+static GstColorBalance *
+dup_color_balance (GstElement *src)
+{
+ GstElement *color;
+
+ /* Find something supporting GstColorBalance */
+ color = gst_bin_get_by_interface (GST_BIN (src), GST_TYPE_COLOR_BALANCE);
+
+ if (color == NULL)
+ return NULL;
+
+ return GST_COLOR_BALANCE (color);
+}
+
void
empathy_video_src_set_channel (GstElement *src,
EmpathyGstVideoSrcChannel channel, guint percent)
{
- GstElement *color;
GstColorBalance *balance;
const GList *channels;
GList *l;
- /* Find something supporting GstColorBalance */
- color = gst_bin_get_by_interface (GST_BIN (src), GST_TYPE_COLOR_BALANCE);
-
- if (color == NULL)
+ balance = dup_color_balance (src);
+ if (balance == NULL)
return;
- balance = GST_COLOR_BALANCE (color);
-
channels = gst_color_balance_list_channels (balance);
for (l = (GList *) channels; l != NULL; l = g_list_next (l))
@@ -277,27 +286,22 @@ empathy_video_src_set_channel (GstElement *src,
}
}
- g_object_unref (color);
+ g_object_unref (balance);
}
guint
empathy_video_src_get_channel (GstElement *src,
EmpathyGstVideoSrcChannel channel)
{
- GstElement *color;
GstColorBalance *balance;
const GList *channels;
GList *l;
guint percent = 0;
- /* Find something supporting GstColorBalance */
- color = gst_bin_get_by_interface (GST_BIN (src), GST_TYPE_COLOR_BALANCE);
-
- if (color == NULL)
+ balance = dup_color_balance (src);
+ if (balance == NULL)
return percent;
- balance = GST_COLOR_BALANCE (color);
-
channels = gst_color_balance_list_channels (balance);
for (l = (GList *) channels; l != NULL; l = g_list_next (l))
@@ -315,7 +319,7 @@ empathy_video_src_get_channel (GstElement *src,
}
}
- g_object_unref (color);
+ g_object_unref (balance);
return percent;
}
@@ -324,20 +328,15 @@ empathy_video_src_get_channel (GstElement *src,
guint
empathy_video_src_get_supported_channels (GstElement *src)
{
- GstElement *color;
GstColorBalance *balance;
const GList *channels;
GList *l;
guint result = 0;
- /* Find something supporting GstColorBalance */
- color = gst_bin_get_by_interface (GST_BIN (src), GST_TYPE_COLOR_BALANCE);
-
- if (color == NULL)
+ balance = dup_color_balance (src);
+ if (balance == NULL)
goto out;
- balance = GST_COLOR_BALANCE (color);
-
channels = gst_color_balance_list_channels (balance);
for (l = (GList *) channels; l != NULL; l = g_list_next (l))
@@ -355,7 +354,7 @@ empathy_video_src_get_supported_channels (GstElement *src)
}
}
- g_object_unref (color);
+ g_object_unref (balance);
out:
return result;