[GnomeMeeting-devel-list] [patch] flip local video



Hi,

I found annoying that the local video was not like a mirror (you always
move in the wrong direction when the cam is misplaced).

The following patch against latest stable (but applies against current cvs),
flip the local video. It should be configurable but i don't know how to
write the menu part, so if someone wants to do it or help me to do it...

The patch use the function gdk_pixbuf_flip which is only available with
gtk+-2.6.

There is still one problem, it reverses the animated logo... otherwise
it works fine fore me.

regards,

Benoit

-- 
powered by bash/screen/(urxvt/fvwm|linux-console)/gentoo/gnu/linux OS
diff -Naurp gnomemeeting-1.2.0/src/gdkvideoio.cpp gnomemeeting-1.2.0.new/src/gdkvideoio.cpp
--- gnomemeeting-1.2.0/src/gdkvideoio.cpp	2004-11-25 20:59:24.000000000 +0100
+++ gnomemeeting-1.2.0.new/src/gdkvideoio.cpp	2005-02-16 20:02:32.000000000 +0100
@@ -80,6 +82,11 @@ GDKVideoOutputDevice::GDKVideoOutputDevi
 
     gm_conf_set_float (VIDEO_DISPLAY_KEY "zoom_factor", -1.0);
   }
+  /* Change the flip values if unset */
+  if (gm_conf_get_bool (VIDEO_DISPLAY_KEY "remote_flip") == -1)
+    gm_conf_set_bool (VIDEO_DISPLAY_KEY "remote_flip", FALSE);
+  if (gm_conf_get_bool (VIDEO_DISPLAY_KEY "local_flip") == -1)
+    gm_conf_set_bool (VIDEO_DISPLAY_KEY "local_flip", TRUE);
   gnomemeeting_threads_leave ();
 }
 
@@ -102,6 +109,8 @@ BOOL GDKVideoOutputDevice::Redraw ()
   double zoom = 1.0;
   double rzoom = 1.0;
   double lzoom = 1.0;
+  gboolean rflip = FALSE;
+  gboolean lflip = FALSE;
   int display = LOCAL_VIDEO;
 
   gboolean bilinear_filtering = FALSE;
@@ -124,6 +133,8 @@ BOOL GDKVideoOutputDevice::Redraw ()
   if (zoom != 0.0 && zoom != 0.5 && zoom != 1.00 
       && zoom != 2.00 && zoom != -1.00)
     zoom = 1.0;
+  rflip = gm_conf_get_bool (VIDEO_DISPLAY_KEY "remote_flip");
+  lflip = gm_conf_get_bool (VIDEO_DISPLAY_KEY "local_flip");
   gnomemeeting_threads_leave ();
 
   
@@ -198,9 +209,9 @@ BOOL GDKVideoOutputDevice::Redraw ()
   
   gm_main_window_update_video (main_window,
 			       (const guchar *) lframeStore,
-			       lf_width, lf_height, lzoom,
+			       lf_width, lf_height, lzoom, lflip,
 			       (const guchar *) rframeStore,
-			       rf_width, rf_height, rzoom,
+			       rf_width, rf_height, rzoom, rflip,
 			       display, FALSE);
   gnomemeeting_threads_leave ();
   redraw_mutex.Signal ();
diff -Naurp gnomemeeting-1.2.0/src/main_window.cpp gnomemeeting-1.2.0.new/src/main_window.cpp
--- gnomemeeting-1.2.0/src/main_window.cpp	2004-11-20 14:54:23.000000000 +0100
+++ gnomemeeting-1.2.0.new/src/main_window.cpp	2005-02-16 20:33:56.000000000 +0100
@@ -2508,18 +2532,22 @@ gm_main_window_update_video (GtkWidget *
 			     int lf_width,
 			     int lf_height,
 			     double lzoom,
+			     gboolean lflip,
 			     const guchar *rbuffer,
 			     int rf_width,
 			     int rf_height,
 			     double rzoom,
+			     gboolean rflip,
 			     int display_type,
 			     gboolean bilinear_filtering)
 {
   GmWindow *mw = NULL;
 
   GdkPixbuf *lsrc_pic = NULL;
+  GdkPixbuf *flsrc_pic = NULL;
   GdkPixbuf *zlsrc_pic = NULL;
   GdkPixbuf *rsrc_pic = NULL;
+  GdkPixbuf *frsrc_pic = NULL;
   GdkPixbuf *zrsrc_pic = NULL;
 
 #ifdef HAS_SDL
@@ -2585,15 +2613,27 @@ gm_main_window_update_video (GtkWidget *
 				  FALSE, 8, lf_width, lf_height, 
 				  lf_width * 3, 
 				  NULL, NULL);
+      if (lflip)
+        flsrc_pic = gdk_pixbuf_flip (lsrc_pic, true);
+      else {
+	flsrc_pic = lsrc_pic;
+        g_object_ref (flsrc_pic);
+      }
+      
       if (lzoom != 1.0 && lzoom > 0)
 	zlsrc_pic = 
-	  gdk_pixbuf_scale_simple (lsrc_pic, 
+	  gdk_pixbuf_scale_simple (flsrc_pic, 
 				   (int) (lf_width * lzoom),
 				   (int) (lf_height * lzoom),
 				   bilinear_filtering?
 				   GDK_INTERP_BILINEAR:GDK_INTERP_NEAREST);
-      else
-	zlsrc_pic = gdk_pixbuf_copy (lsrc_pic);
+      else {
+        zlsrc_pic = flsrc_pic;
+        g_object_ref (zlsrc_pic);
+      }
+
+      g_object_unref (lsrc_pic);
+      g_object_unref (flsrc_pic);
     }
   }
   
@@ -2606,17 +2646,27 @@ gm_main_window_update_video (GtkWidget *
 				  FALSE, 8, rf_width, rf_height, 
 				  rf_width * 3, 
 				  NULL, NULL);
+      if (rflip)
+        frsrc_pic = gdk_pixbuf_flip (rsrc_pic, true);
+      else {
+        frsrc_pic = rsrc_pic;
+        g_object_ref (frsrc_pic);
+      }
+      
       if (rzoom != 1.0 && rzoom > 0) 
 	zrsrc_pic = 
-	  gdk_pixbuf_scale_simple (rsrc_pic, 
+	  gdk_pixbuf_scale_simple (frsrc_pic, 
 				   (int) (rf_width * rzoom),
 				   (int) (rf_height * rzoom),
 				   bilinear_filtering?
 				   GDK_INTERP_BILINEAR:GDK_INTERP_NEAREST);
-      else
-	zrsrc_pic = gdk_pixbuf_copy (rsrc_pic);
+      else {
+	zrsrc_pic = frsrc_pic;
+        g_object_ref (zrsrc_pic);
+      }
 
       g_object_unref (rsrc_pic);
+      g_object_unref (frsrc_pic);
     }
   }
 
diff -Naurp gnomemeeting-1.2.0/src/main_window.h gnomemeeting-1.2.0.new/src/main_window.h
--- gnomemeeting-1.2.0/src/main_window.h	2004-10-19 21:36:29.000000000 +0200
+++ gnomemeeting-1.2.0.new/src/main_window.h	2005-02-16 18:03:46.000000000 +0100
@@ -67,10 +67,12 @@ void gm_main_window_update_video (GtkWid
 				  int,
 				  int,
 				  double,
+				  gboolean,
 				  const guchar *,
 				  int,
 				  int,
 				  double,
+				  gboolean,
 				  int,
 				  gboolean);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]