[empathy] video-src: factor out dup_color_balance()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] video-src: factor out dup_color_balance()
- Date: Fri, 9 Sep 2011 12:29:14 +0000 (UTC)
commit 890efc4f52b81bf90fb5d130124d68fe071abc3f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Sep 9 13:39:44 2011 +0200
video-src: factor out dup_color_balance()
https://bugzilla.gnome.org/show_bug.cgi?id=658584
src/empathy-video-src.c | 47 +++++++++++++++++++++++------------------------
1 files changed, 23 insertions(+), 24 deletions(-)
---
diff --git a/src/empathy-video-src.c b/src/empathy-video-src.c
index 25d257f..da86eda 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]