[Cogl] [PATCH 11/13] cogl-gst: video-sink: add video balance support

Lionel Landwerlin llandwerlin at gmail.com
Mon Dec 9 03:17:58 PST 2013


---
 cogl-gst/cogl-gst-video-sink.c | 81 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 80 insertions(+), 1 deletion(-)

diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index ad7f76b..7d48824 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -72,6 +72,8 @@
 #define COGL_GST_PARAM_READWRITE     \
   (G_PARAM_READABLE | G_PARAM_WRITABLE | COGL_GST_PARAM_STATIC)
 
+static void color_balance_iface_init (GstColorBalanceInterface *iface);
+
 static const char cogl_gst_video_sink_caps_str[] =
   GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, BASE_SINK_CAPS)
   ";" GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "RGBA");
@@ -82,7 +84,10 @@ static GstStaticPadTemplate sinktemplate_all =
                            GST_PAD_ALWAYS,
                            GST_STATIC_CAPS (cogl_gst_video_sink_caps_str));
 
-G_DEFINE_TYPE (CoglGstVideoSink, cogl_gst_video_sink, GST_TYPE_BASE_SINK);
+G_DEFINE_TYPE_WITH_CODE (CoglGstVideoSink,
+                         cogl_gst_video_sink,
+                         GST_TYPE_BASE_SINK,
+                         G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE, color_balance_iface_init))
 
 enum
 {
@@ -182,6 +187,80 @@ struct _CoglGstVideoSinkPrivate
   GstVideoInfo info;
 };
 
+
+
+static const GList *
+cogl_gst_video_sink_color_balance_list_channels (GstColorBalance *balance)
+{
+  static GList *channels = NULL;
+
+  if (channels == NULL) {
+    GstColorBalanceChannel *channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
+    channel->label = g_strdup ("BRIGHTNESS");
+    channel->min_value = 0;
+    channel->max_value = 1;
+    channels = g_list_prepend (channels, channel);
+    channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
+    channel->label = g_strdup ("CONTRAST");
+    channel->min_value = 0;
+    channel->max_value = 1;
+    channels = g_list_prepend (channels, channel);
+    channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
+    channel->label = g_strdup ("HUE");
+    channel->min_value = 0;
+    channel->max_value = 1;
+    channels = g_list_prepend (channels, channel);
+    channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
+    channel->label = g_strdup ("SATURATION");
+    channel->min_value = 0;
+    channel->max_value = 1;
+    channels = g_list_prepend (channels, channel);
+  }
+
+  return channels;
+}
+
+static void
+cogl_gst_video_sink_color_balance_set_value (GstColorBalance        *balance,
+                                             GstColorBalanceChannel *channel,
+                                             gint                    value)
+{
+}
+
+static gint
+cogl_gst_video_sink_color_balance_get_value (GstColorBalance        *balance,
+                                             GstColorBalanceChannel *channel)
+{
+  return 0;
+}
+
+static GstColorBalanceType
+cogl_gst_video_sink_color_balance_get_balance_type (GstColorBalance *balance)
+{
+  return GST_COLOR_BALANCE_HARDWARE;
+}
+
+static void
+cogl_gst_video_sink_color_balance_value_changed (GstColorBalance        *balance,
+                                                 GstColorBalanceChannel *channel,
+                                                 gint                    value)
+{
+
+}
+
+static void
+color_balance_iface_init (GstColorBalanceInterface *iface)
+{
+  iface->list_channels = cogl_gst_video_sink_color_balance_list_channels;
+  iface->set_value = cogl_gst_video_sink_color_balance_set_value;
+  iface->get_value = cogl_gst_video_sink_color_balance_get_value;
+
+  iface->get_balance_type = cogl_gst_video_sink_color_balance_get_balance_type;
+
+  iface->value_changed = cogl_gst_video_sink_color_balance_value_changed;
+}
+
+
 static void
 cogl_gst_source_finalize (GSource *source)
 {
-- 
1.8.5



More information about the Cogl mailing list