gst-libs/gst/colorbalance/colorbalance.h: Adding a type to the colorbalance interface...
authorJon Trowbridge <trow@ximian.com>
Tue, 13 Jan 2004 17:57:25 +0000 (17:57 +0000)
committerJulien Moutte <julien@moutte.net>
Tue, 13 Jan 2004 17:57:25 +0000 (17:57 +0000)
Original commit message from CVS:
2004-01-13  Julien MOUTTE <julien@moutte.net>

* gst-libs/gst/colorbalance/colorbalance.h: Adding a type to the
colorbalance interface stating if it is hardware based or software
based.
* gst/videofilter/gstvideobalance.c: (gst_videobalance_planar411):
Removing a trailing comma.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_colorbalance_init): Integrating a patch from Jon
Trowbridge <trow@ximian.com> querying Xv adaptor for min/max value as
the documentation seems to be wrong on the -1000 to 1000 interval.

ChangeLog
common
gst-libs/gst/colorbalance/colorbalance.h
gst-libs/gst/interfaces/colorbalance.h
sys/xvimage/xvimagesink.c

index b354fac..2197505 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-01-13  Julien MOUTTE <julien@moutte.net>
+
+       * gst-libs/gst/colorbalance/colorbalance.h: Adding a type to the
+       colorbalance interface stating if it is hardware based or software
+       based.
+       * gst/videofilter/gstvideobalance.c: (gst_videobalance_planar411):
+       Removing a trailing comma.
+       * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
+       (gst_xvimagesink_colorbalance_init): Integrating a patch from Jon
+       Trowbridge <trow@ximian.com> querying Xv adaptor for min/max value as
+       the documentation seems to be wrong on the -1000 to 1000 interval.
+
 2004-01-12  David Schleef  <ds@schleef.org>
 
        * gst/debug/efence.c: (gst_efence_init), (gst_efence_chain),
diff --git a/common b/common
index cd5507a..c81ad07 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit cd5507ae3df8dc48c07df9e37878846b6b79faa1
+Subproject commit c81ad072c76522175cbddead96d6f3c448068d67
index f4a0d78..3f36548 100644 (file)
@@ -43,10 +43,18 @@ G_BEGIN_DECLS
   (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceClass))
 
 typedef struct _GstColorBalance GstColorBalance;
+  
+typedef enum
+{
+  GST_COLOR_BALANCE_HARDWARE,
+  GST_COLOR_BALANCE_SOFTWARE
+} GstColorBalanceType;
 
 typedef struct _GstColorBalanceClass {
   GTypeInterface klass;
 
+  GstColorBalanceType balance_type;
+  
   /* virtual functions */
   const GList * (* list_channels) (GstColorBalance        *balance);
 
index f4a0d78..3f36548 100644 (file)
@@ -43,10 +43,18 @@ G_BEGIN_DECLS
   (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceClass))
 
 typedef struct _GstColorBalance GstColorBalance;
+  
+typedef enum
+{
+  GST_COLOR_BALANCE_HARDWARE,
+  GST_COLOR_BALANCE_SOFTWARE
+} GstColorBalanceType;
 
 typedef struct _GstColorBalanceClass {
   GTypeInterface klass;
 
+  GstColorBalanceType balance_type;
+  
   /* virtual functions */
   const GList * (* list_channels) (GstColorBalance        *balance);
 
index 1835887..00f9757 100644 (file)
@@ -529,7 +529,8 @@ gst_xvimagesink_xcontext_get (GstXvImageSink *xvimagesink)
 {
   GstXContext *xcontext = NULL;
   XPixmapFormatValues *px_formats = NULL;
-  gint nb_formats = 0, i;
+  gint nb_formats = 0, i, j, N_attr;
+  XvAttribute *xv_attr;
   char *channels[4] = { "XV_HUE", "XV_SATURATION",
                         "XV_BRIGHTNESS", "XV_CONTRAST" };
   
@@ -616,21 +617,38 @@ gst_xvimagesink_xcontext_get (GstXvImageSink *xvimagesink)
       g_free (xcontext);
       return NULL;
     }
-    
-  g_mutex_unlock (xvimagesink->x_lock);
+
+  xv_attr = XvQueryPortAttributes (xcontext->disp,
+                                   xcontext->xv_port_id,
+                                   &N_attr);
   
   /* Generate the channels list */
   for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++)
     {
       GstColorBalanceChannel *channel;
-    
+      XvAttribute *matching_attr = NULL;
+
+      if (xv_attr != NULL) 
+        {
+          for (j = 0; j < N_attr && matching_attr == NULL; ++j)
+            if (! g_ascii_strcasecmp (channels[i], xv_attr[j].name))
+              matching_attr = xv_attr + j;
+        }
+      
       channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
       channel->label = g_strdup (channels[i]);
-      channel->min_value = -1000;
-      channel->max_value = 1000;
+      channel->min_value = matching_attr ? matching_attr->min_value : -1000;
+      channel->max_value = matching_attr ? matching_attr->max_value : 1000;
+      
       xcontext->channels_list = g_list_append (xcontext->channels_list,
                                                channel);
     }
+
+  if (xv_attr)
+    XFree (xv_attr);
+
+  g_mutex_unlock (xvimagesink->x_lock);
     
   return xcontext;
 }
@@ -1283,6 +1301,7 @@ gst_xvimagesink_colorbalance_get_value (GstColorBalance        *balance,
 static void
 gst_xvimagesink_colorbalance_init (GstColorBalanceClass *iface)
 {
+  iface->balance_type = GST_COLOR_BALANCE_HARDWARE;
   iface->list_channels = gst_xvimagesink_colorbalance_list_channels;
   iface->set_value = gst_xvimagesink_colorbalance_set_value;
   iface->get_value = gst_xvimagesink_colorbalance_get_value;