changeset 28250:a4aa7ecd8cbe

Factor calc_drwXY out of vo_xv and vo_xvmc.
author cehoyos
date Fri, 09 Jan 2009 15:25:24 +0000
parents bad33548d2eb
children 87ca91cfba34
files libvo/vo_xv.c libvo/vo_xvmc.c libvo/x11_common.c libvo/x11_common.h
diffstat 4 files changed, 22 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Fri Jan 09 10:32:01 2009 +0000
+++ b/libvo/vo_xv.c	Fri Jan 09 15:25:24 2009 +0000
@@ -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();
     
@@ -391,7 +375,7 @@
 
     if (e & VO_EVENT_RESIZE)
     {
-        calc_drwXY(&drwX, &drwY);
+        vo_calc_drwXY(&drwX, &drwY);
     }
 
     if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
--- a/libvo/vo_xvmc.c	Fri Jan 09 10:32:01 2009 +0000
+++ b/libvo/vo_xvmc.c	Fri Jan 09 15:25:24 2009 +0000
@@ -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();
 
--- a/libvo/x11_common.c	Fri Jan 09 10:32:01 2009 +0000
+++ b/libvo/x11_common.c	Fri Jan 09 15:25:24 2009 +0000
@@ -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,23 @@
     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)
 {
--- a/libvo/x11_common.h	Fri Jan 09 10:32:01 2009 +0000
+++ b/libvo/x11_common.h	Fri Jan 09 15:25:24 2009 +0000
@@ -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 */