aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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;