[MPlayer-cvslog] r37376 - in trunk: DOCS/man/en/mplayer.1 cfg-mplayer.h libvo/video_out.c libvo/video_out.h libvo/vo_gl.c libvo/x11_common.c

cigaes subversion at mplayerhq.hu
Fri Feb 27 19:14:02 CET 2015


Author: cigaes
Date: Fri Feb 27 19:14:02 2015
New Revision: 37376

Log:
libvo: implement fs-borders.

Allow to specify extra borders in full screen mode.
This is useful if part of the screen is unusuable,
for example with a video projector overlapping on the
furniture.

Modified:
   trunk/cfg-mplayer.h
   trunk/libvo/video_out.c
   trunk/libvo/video_out.h
   trunk/libvo/vo_gl.c
   trunk/libvo/x11_common.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/cfg-mplayer.h
==============================================================================
--- trunk/cfg-mplayer.h	Tue Feb 24 21:16:35 2015	(r37375)
+++ trunk/cfg-mplayer.h	Fri Feb 27 19:14:02 2015	(r37376)
@@ -175,6 +175,10 @@ const m_option_t mplayer_opts[]={
     {"panscanrange", &vo_panscanrange, CONF_TYPE_FLOAT, CONF_RANGE, -19.0, 99.0, NULL},
     {"border-pos-x", &vo_border_pos_x, CONF_TYPE_FLOAT, CONF_RANGE, -1, 2, NULL},
     {"border-pos-y", &vo_border_pos_y, CONF_TYPE_FLOAT, CONF_RANGE, -1, 2, NULL},
+    {"fs-border-left",   &vo_fs_border_l, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
+    {"fs-border-right",  &vo_fs_border_r, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
+    {"fs-border-top",    &vo_fs_border_t, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
+    {"fs-border-bottom", &vo_fs_border_b, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
     {"monitor-orientation", &vo_rotate, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
 
     {"grabpointer", &vo_grabpointer, CONF_TYPE_FLAG, 0, 0, 1, NULL},

Modified: trunk/libvo/video_out.c
==============================================================================
--- trunk/libvo/video_out.c	Tue Feb 24 21:16:35 2015	(r37375)
+++ trunk/libvo/video_out.c	Fri Feb 27 19:14:02 2015	(r37376)
@@ -67,6 +67,10 @@ int vo_fsmode = 0;
 float vo_panscan = 0.0f;
 float vo_border_pos_x = 0.5;
 float vo_border_pos_y = 0.5;
+int vo_fs_border_l = 0;
+int vo_fs_border_r = 0;
+int vo_fs_border_t = 0;
+int vo_fs_border_b = 0;
 int vo_rotate;
 int vo_ontop = 0;
 int vo_adapter_num=0;

Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h	Tue Feb 24 21:16:35 2015	(r37375)
+++ trunk/libvo/video_out.h	Fri Feb 27 19:14:02 2015	(r37376)
@@ -233,6 +233,10 @@ extern int vo_fsmode;
 extern float vo_panscan;
 extern float vo_border_pos_x;
 extern float vo_border_pos_y;
+extern int vo_fs_border_l;
+extern int vo_fs_border_r;
+extern int vo_fs_border_t;
+extern int vo_fs_border_b;
 extern int vo_rotate;
 extern int vo_adapter_num;
 extern int vo_refresh_rate;

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Tue Feb 24 21:16:35 2015	(r37375)
+++ trunk/libvo/vo_gl.c	Fri Feb 27 19:14:02 2015	(r37376)
@@ -203,6 +203,8 @@ static void resize(void) {
     geometry(&left, &top, &w, &h, vo_dwidth, vo_dheight);
     top = vo_dheight - h - top;
     mpglViewport(left, top, w, h);
+  } else if (vo_fs) {
+    mpglViewport(vo_fs_border_l, vo_fs_border_b, vo_dwidth, vo_dheight);
   } else
     mpglViewport(0, 0, vo_dwidth, vo_dheight);
 

Modified: trunk/libvo/x11_common.c
==============================================================================
--- trunk/libvo/x11_common.c	Tue Feb 24 21:16:35 2015	(r37375)
+++ trunk/libvo/x11_common.c	Fri Feb 27 19:14:02 2015	(r37376)
@@ -963,6 +963,19 @@ int vo_x11_check_events(Display * mydisp
     return ret;
 }
 
+static void vo_x11_update_fs_borders(void)
+{
+    if (!vo_fs)
+        return;
+    if (vo_dwidth  <= vo_fs_border_l + vo_fs_border_r ||
+        vo_dheight <= vo_fs_border_t + vo_fs_border_b) {
+        mp_msg(MSGT_VO, MSGL_ERR, "[x11] borders too wide, ignored.\n");
+        return;
+    }
+    vo_dwidth  -= vo_fs_border_l + vo_fs_border_r;
+    vo_dheight -= vo_fs_border_t + vo_fs_border_b;
+}
+
 /**
  * \brief sets the size and position of the non-fullscreen window.
  */
@@ -1145,6 +1158,7 @@ void vo_x11_create_vo_window(XVisualInfo
     vo_fs = 0;
     vo_dwidth = width;
     vo_dheight = height;
+    vo_x11_update_fs_borders();
     vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vis->visual,
                       x, y, width, height, vis->depth, col_map);
     window_state = VOFLAG_HIDDEN;
@@ -1189,6 +1203,7 @@ void vo_x11_create_vo_window(XVisualInfo
     // set the size values right.
     vo_dwidth  = vo_screenwidth;
     vo_dheight = vo_screenheight;
+    vo_x11_update_fs_borders();
   }
 final:
   if (vo_gc != None)
@@ -1381,7 +1396,11 @@ int vo_x11_update_geometry(void) {
     Window dummy_win;
     XGetGeometry(mDisplay, vo_window, &dummy_win, &dummy_int, &dummy_int,
                  &w, &h, &dummy_int, &depth);
-    if (w <= INT_MAX && h <= INT_MAX) { vo_dwidth = w; vo_dheight = h; }
+    if (w <= INT_MAX && h <= INT_MAX) {
+        vo_dwidth = w;
+        vo_dheight = h;
+        vo_x11_update_fs_borders();
+    }
     XTranslateCoordinates(mDisplay, vo_window, mRootWin, 0, 0, &vo_dx, &vo_dy,
                           &dummy_win);
 


More information about the MPlayer-cvslog mailing list