gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interf...
authorJulien Moutte <julien@moutte.net>
Wed, 14 Jan 2004 23:01:49 +0000 (23:01 +0000)
committerJulien Moutte <julien@moutte.net>
Wed, 14 Jan 2004 23:01:49 +0000 (23:01 +0000)
Original commit message from CVS:
2004-01-14  Julien MOUTTE  <julien@moutte.net>

* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.

ChangeLog
sys/ximage/ximagesink.c
sys/ximage/ximagesink.h
sys/xvimage/xvimagesink.c
sys/xvimage/xvimagesink.h

index 0bc01192917ca7ff7c21737c0c39cfc784a737fa..f031e6b9532e741b4b1e0e1967a0e55f781149f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2004-01-14  Julien MOUTTE  <julien@moutte.net>
+
+       * gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
+       (gst_videobalance_colorbalance_set_value),
+       (gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
+       for colorbalance interface implementation.
+       * sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
+       (gst_ximagesink_set_property), (gst_ximagesink_get_property),
+       (gst_ximagesink_dispose), (gst_ximagesink_init),
+       (gst_ximagesink_class_init): Adding DISPLAY property.
+       * sys/ximage/ximagesink.h: Adding display_name to store display.
+       * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
+       (gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
+       (gst_xvimagesink_dispose), (gst_xvimagesink_init),
+       (gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
+       properties (they still need polishing though for gst-launch use : no
+       xcontext yet, i ll do that tomorrow).
+       * sys/xvimage/xvimagesink.h: Adding display_name to store display.
+
 2004-01-14  Julien MOUTTE  <julien@moutte.net>
 
        * gst-libs/gst/play/gstplay.c: (gst_play_pipeline_setup),
index 2035670e31a93b5e965c3feca389fdab74c26269..ac21d127f93cc85ef252343ed756526734ca5d09 100644 (file)
@@ -49,6 +49,12 @@ GST_STATIC_PAD_TEMPLATE (
     "height = (int) [ 0, MAX ]")
 );
 
+enum {
+  ARG_0,
+  ARG_DISPLAY
+  /* FILL ME */
+};
+
 static GstVideoSinkClass *parent_class = NULL;
 
 /* ============================================================= */
@@ -434,7 +440,7 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
   
   g_mutex_lock (ximagesink->x_lock);
   
-  xcontext->disp = XOpenDisplay (NULL);
+  xcontext->disp = XOpenDisplay (ximagesink->display_name);
   
   if (!xcontext->disp)
     {
@@ -1067,6 +1073,48 @@ gst_ximagesink_xoverlay_init (GstXOverlayClass *iface)
 /*                                             */
 /* =========================================== */
 
+static void
+gst_ximagesink_set_property (GObject *object, guint prop_id,
+                             const GValue *value, GParamSpec *pspec)
+{
+  GstXImageSink *ximagesink;
+  
+  g_return_if_fail (GST_IS_XIMAGESINK (object));
+  
+  ximagesink = GST_XIMAGESINK (object);
+  
+  switch (prop_id)
+    {
+      case ARG_DISPLAY:
+        ximagesink->display_name = g_strdup (g_value_get_string (value));
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+static void
+gst_ximagesink_get_property (GObject *object, guint prop_id,
+                             GValue *value, GParamSpec *pspec)
+{
+  GstXImageSink *ximagesink;
+  
+  g_return_if_fail (GST_IS_XIMAGESINK (object));
+  
+  ximagesink = GST_XIMAGESINK (object);
+  
+  switch (prop_id)
+    {
+      case ARG_DISPLAY:
+        g_value_set_string (value, g_strdup (ximagesink->display_name));
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
 static void
 gst_ximagesink_dispose (GObject *object)
 {
@@ -1074,6 +1122,12 @@ gst_ximagesink_dispose (GObject *object)
 
   ximagesink = GST_XIMAGESINK (object);
 
+  if (ximagesink->display_name)
+    {
+      g_free (ximagesink->display_name);
+      ximagesink->display_name = NULL;
+    }
+    
   if (ximagesink->ximage)
     {
       gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
@@ -1119,6 +1173,7 @@ gst_ximagesink_init (GstXImageSink *ximagesink)
   gst_pad_set_bufferalloc_function (GST_VIDEOSINK_PAD (ximagesink),
                                     gst_ximagesink_buffer_alloc);
   
+  ximagesink->display_name = NULL;
   ximagesink->xcontext = NULL;
   ximagesink->xwindow = NULL;
   ximagesink->ximage = NULL;
@@ -1158,7 +1213,13 @@ gst_ximagesink_class_init (GstXImageSinkClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_VIDEOSINK);
 
+  g_object_class_install_property (gobject_class, ARG_DISPLAY,
+    g_param_spec_string ("display", "Display", "X Display name",
+                         NULL, G_PARAM_READWRITE));
+  
   gobject_class->dispose = gst_ximagesink_dispose;
+  gobject_class->set_property = gst_ximagesink_set_property;
+  gobject_class->get_property = gst_ximagesink_get_property;
   
   gstelement_class->change_state = gst_ximagesink_change_state;
 }
index f59b202364cb26fe85a3ab095027fa3e8d070102..c26d8037cf34ce8f3dd3ba092f611fe250d24950 100644 (file)
@@ -106,6 +106,8 @@ struct _GstXImageSink {
   /* Our element stuff */
   GstVideoSink videosink;
 
+  char *display_name;
+  
   GstXContext *xcontext;
   GstXWindow *xwindow;
   GstXImage *ximage;
index 51b604424d447f675bec42533a6a0782c44b56da..21e350e88c41d715464a914fbedbf6aea7d63ca6 100644 (file)
@@ -56,6 +56,16 @@ GST_STATIC_PAD_TEMPLATE (
   )
 );
 
+enum {
+  ARG_0,
+  ARG_CONTRAST,
+  ARG_BRIGHTNESS,
+  ARG_HUE,
+  ARG_SATURATION,
+  ARG_DISPLAY
+  /* FILL ME */
+};
+
 static GstVideoSinkClass *parent_class = NULL;
 
 /* ============================================================= */
@@ -541,7 +551,7 @@ gst_xvimagesink_xcontext_get (GstXvImageSink *xvimagesink)
   
   g_mutex_lock (xvimagesink->x_lock);
   
-  xcontext->disp = XOpenDisplay (NULL);
+  xcontext->disp = XOpenDisplay (xvimagesink->display_name);
   
   if (!xcontext->disp)
     {
@@ -1309,6 +1319,136 @@ gst_xvimagesink_colorbalance_init (GstColorBalanceClass *iface)
 /*                                             */
 /* =========================================== */
 
+static void
+gst_xvimagesink_set_property (GObject *object, guint prop_id,
+                              const GValue *value, GParamSpec *pspec)
+{
+  GstXvImageSink *xvimagesink;
+  
+  g_return_if_fail (GST_IS_XVIMAGESINK (object));
+  
+  xvimagesink = GST_XVIMAGESINK (object);
+  
+  switch (prop_id)
+    {
+      case ARG_HUE:
+        g_mutex_lock (xvimagesink->x_lock);
+        XvSetPortAttribute (xvimagesink->xcontext->disp,
+                            xvimagesink->xcontext->xv_port_id,
+                            XInternAtom (xvimagesink->xcontext->disp,
+                                         "XV_HUE", 1),
+                            g_value_get_int (value));
+        g_mutex_unlock (xvimagesink->x_lock);
+        break;
+      case ARG_CONTRAST:
+        g_mutex_lock (xvimagesink->x_lock);
+        XvSetPortAttribute (xvimagesink->xcontext->disp,
+                            xvimagesink->xcontext->xv_port_id,
+                            XInternAtom (xvimagesink->xcontext->disp,
+                                         "XV_CONTRAST", 1),
+                            g_value_get_int (value));
+        g_mutex_unlock (xvimagesink->x_lock);
+        break;
+      case ARG_BRIGHTNESS:
+        g_mutex_lock (xvimagesink->x_lock);
+        XvSetPortAttribute (xvimagesink->xcontext->disp,
+                            xvimagesink->xcontext->xv_port_id,
+                            XInternAtom (xvimagesink->xcontext->disp,
+                                         "XV_BRIGHTNESS", 1),
+                            g_value_get_int (value));
+        g_mutex_unlock (xvimagesink->x_lock);
+        break;
+      case ARG_SATURATION:
+        g_mutex_lock (xvimagesink->x_lock);
+        XvSetPortAttribute (xvimagesink->xcontext->disp,
+                            xvimagesink->xcontext->xv_port_id,
+                            XInternAtom (xvimagesink->xcontext->disp,
+                                         "XV_SATURATION", 1),
+                            g_value_get_int (value));
+        g_mutex_unlock (xvimagesink->x_lock);
+        break;
+      case ARG_DISPLAY:
+        xvimagesink->display_name = g_strdup (g_value_get_string (value));
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+static void
+gst_xvimagesink_get_property (GObject *object, guint prop_id,
+                             GValue *value, GParamSpec *pspec)
+{
+  GstXvImageSink *xvimagesink;
+  
+  g_return_if_fail (GST_IS_XVIMAGESINK (object));
+  
+  xvimagesink = GST_XVIMAGESINK (object);
+  
+  switch (prop_id)
+    {
+      case ARG_HUE:
+        {
+          gint l_value;
+          g_mutex_lock (xvimagesink->x_lock);
+          XvGetPortAttribute (xvimagesink->xcontext->disp,
+                              xvimagesink->xcontext->xv_port_id,
+                              XInternAtom (xvimagesink->xcontext->disp,
+                                           "XV_HUE", 1),
+                              &l_value);
+          g_mutex_unlock (xvimagesink->x_lock);
+          g_value_set_int (value, l_value);
+        }
+        break;
+      case ARG_CONTRAST:
+        {
+          gint l_value;
+          g_mutex_lock (xvimagesink->x_lock);
+          XvGetPortAttribute (xvimagesink->xcontext->disp,
+                              xvimagesink->xcontext->xv_port_id,
+                              XInternAtom (xvimagesink->xcontext->disp,
+                                           "XV_CONTRAST", 1),
+                              &l_value);
+          g_mutex_unlock (xvimagesink->x_lock);
+          g_value_set_int (value, l_value);
+        }
+        break;
+      case ARG_BRIGHTNESS:
+        {
+          gint l_value;
+          g_mutex_lock (xvimagesink->x_lock);
+          XvGetPortAttribute (xvimagesink->xcontext->disp,
+                              xvimagesink->xcontext->xv_port_id,
+                              XInternAtom (xvimagesink->xcontext->disp,
+                                           "XV_BRIGHTNESS", 1),
+                              &l_value);
+          g_mutex_unlock (xvimagesink->x_lock);
+          g_value_set_int (value, l_value);
+        }
+        break;
+      case ARG_SATURATION:
+        {
+          gint l_value;
+          g_mutex_lock (xvimagesink->x_lock);
+          XvGetPortAttribute (xvimagesink->xcontext->disp,
+                              xvimagesink->xcontext->xv_port_id,
+                              XInternAtom (xvimagesink->xcontext->disp,
+                                           "XV_SATURATION", 1),
+                              &l_value);
+          g_mutex_unlock (xvimagesink->x_lock);
+          g_value_set_int (value, l_value);
+        }
+        break;
+      case ARG_DISPLAY:
+        g_value_set_string (value, g_strdup (xvimagesink->display_name));
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
 static void
 gst_xvimagesink_dispose (GObject *object)
 {
@@ -1316,6 +1456,12 @@ gst_xvimagesink_dispose (GObject *object)
 
   xvimagesink = GST_XVIMAGESINK (object);
 
+  if (xvimagesink->display_name)
+    {
+      g_free (xvimagesink->display_name);
+      xvimagesink->display_name = NULL;
+    }
+    
   if (xvimagesink->xvimage)
     {
       gst_xvimagesink_xvimage_destroy (xvimagesink, xvimagesink->xvimage);
@@ -1361,6 +1507,7 @@ gst_xvimagesink_init (GstXvImageSink *xvimagesink)
   gst_pad_set_bufferalloc_function (GST_VIDEOSINK_PAD (xvimagesink),
                                     gst_xvimagesink_buffer_alloc);
   
+  xvimagesink->display_name = NULL;
   xvimagesink->xcontext = NULL;
   xvimagesink->xwindow = NULL;
   xvimagesink->xvimage = NULL;
@@ -1400,7 +1547,25 @@ gst_xvimagesink_class_init (GstXvImageSinkClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_VIDEOSINK);
 
+  g_object_class_install_property (gobject_class, ARG_CONTRAST,
+    g_param_spec_double ("contrast", "Contrast", "contrast",
+                           -1000, 2, 1, G_PARAM_READWRITE));
+  g_object_class_install_property(gobject_class, ARG_BRIGHTNESS,
+    g_param_spec_double ("brightness", "Brightness", "brightness",
+                         -1, 1, 0, G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class, ARG_HUE,
+    g_param_spec_double ("hue", "Hue", "hue",
+                         -1, 1, 0, G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class, ARG_SATURATION,
+    g_param_spec_double ("saturation", "Saturation", "saturation",
+                         0, 2, 1, G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class, ARG_DISPLAY,
+    g_param_spec_string ("display", "Display", "X Display name",
+                         NULL, G_PARAM_READWRITE));
+  
   gobject_class->dispose = gst_xvimagesink_dispose;
+  gobject_class->set_property = gst_xvimagesink_set_property;
+  gobject_class->get_property = gst_xvimagesink_get_property;
   
   gstelement_class->change_state = gst_xvimagesink_change_state;
 }
index 36c1a68e2e34c5ef7e1845f576bc682d6ab922c9..74d6b262befe04ac980f18d6ec4bedd6ed783d61 100644 (file)
@@ -122,6 +122,8 @@ struct _GstXvImageSink {
   /* Our element stuff */
   GstVideoSink videosink;
   
+  char *display_name;
+  
   GstXContext *xcontext;
   GstXWindow *xwindow;
   GstXvImage *xvimage;