[MPlayer-dev-eng] [PATCH]Move calc_drwXY

Carl Eugen Hoyos cehoyos at rainbow.studorg.tuwien.ac.at
Fri Jan 9 02:48:10 CET 2009


Hi!

Attached patch is hopefully what Reimar suggested to avoid code 
duplication in vo_vdpau.

Please comment, Carl Eugen
-------------- next part --------------
Index: libvo/x11_common.h
===================================================================
--- libvo/x11_common.h	(revision 28281)
+++ libvo/x11_common.h	(working copy)
@@ -129,5 +129,6 @@
 void update_xinerama_info(void);
 
 int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return);
+void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY);
 
 #endif /* MPLAYER_X11_COMMON_H */
Index: libvo/x11_common.c
===================================================================
--- libvo/x11_common.c	(revision 28281)
+++ libvo/x11_common.c	(working copy)
@@ -8,6 +8,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "mp_fifo.h"
+#include "libavutil/common.h"
 #include "x11_common.h"
 
 #ifdef X11_FULLSCREEN
@@ -1854,6 +1855,22 @@
     return VO_TRUE;
 }
 
+void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY) {
+  *drwX = *drwY = 0;
+  if (vo_fs) {
+    aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
+    vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
+    vo_dheight = FFMIN(vo_dheight, vo_screenheight);
+    *drwX = (vo_screenwidth - vo_dwidth) / 2;
+    *drwY = (vo_screenheight - vo_dheight) / 2;
+    mp_msg(MSGT_VO, MSGL_V, "[vo-fs] dx: %d dy: %d dw: %d dh: %d\n",
+           *drwX, *drwY, vo_dwidth, vo_dheight);
+  } else if (WinID == 0) {
+    *drwX = vo_dx;
+    *drwY = vo_dy;
+  }
+}
+
 #ifdef CONFIG_XV
 int vo_xv_set_eq(uint32_t xv_port, char *name, int value)
 {
Index: libvo/vo_xv.c
===================================================================
--- libvo/vo_xv.c	(revision 28281)
+++ libvo/vo_xv.c	(working copy)
@@ -140,22 +140,6 @@
 
 static void deallocate_xvimage(int foo);
 
-static void calc_drwXY(uint32_t *drwX, uint32_t *drwY) {
-  *drwX = *drwY = 0;
-  if (vo_fs) {
-    aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
-    vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
-    vo_dheight = FFMIN(vo_dheight, vo_screenheight);
-    *drwX = (vo_screenwidth - vo_dwidth) / 2;
-    *drwY = (vo_screenheight - vo_dheight) / 2;
-    mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",
-           *drwX, *drwY, vo_dwidth, vo_dheight);
-  } else if (WinID == 0) {
-    *drwX = vo_dx;
-    *drwY = vo_dy;
-  }
-}
-
 /*
  * connect to server, create and map window,
  * allocate colors and (shared) memory
@@ -286,7 +270,7 @@
     current_ip_buf = 0;
 
     if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1;
-    calc_drwXY(&drwX, &drwY);
+    vo_calc_drwXY(&drwX, &drwY);
 
     panscan_calc();
     
Index: libvo/vo_xvmc.c
===================================================================
--- libvo/vo_xvmc.c	(revision 28281)
+++ libvo/vo_xvmc.c	(working copy)
@@ -431,22 +431,6 @@
    return 0;
 }
 
-static void calc_drwXY(uint32_t *drwX, uint32_t *drwY) {
-  *drwX = *drwY = 0;
-  if (vo_fs) {
-    aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
-    vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
-    vo_dheight = FFMIN(vo_dheight, vo_screenheight);
-    *drwX = (vo_screenwidth - vo_dwidth) / 2;
-    *drwY = (vo_screenheight - vo_dheight) / 2;
-    mp_msg(MSGT_VO, MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n",
-           *drwX, *drwY, vo_dwidth, vo_dheight);
-  } else if (WinID == 0) {
-    *drwX = vo_dx;
-    *drwY = vo_dy;
-  }
-}
-
 static int config(uint32_t width, uint32_t height,
 		       uint32_t d_width, uint32_t d_height,
 		       uint32_t flags, char *title, uint32_t format){
@@ -674,7 +658,7 @@
    }
 
    if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1;
-   calc_drwXY(&drwX, &drwY);
+   vo_calc_drwXY(&drwX, &drwY);
 
    panscan_calc();
 


More information about the MPlayer-dev-eng mailing list