Skip to content

Commit

Permalink
libvo: implement fs-borders.
Browse files Browse the repository at this point in the history
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.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@37376 b3059339-0415-0410-9bf9-f77b7e298cf2
  • Loading branch information
cigaes committed Feb 27, 2015
1 parent aeecd1e commit 3641b45
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 1 deletion.
12 changes: 12 additions & 0 deletions DOCS/man/en/mplayer.1
Expand Up @@ -3511,6 +3511,18 @@ Fixes fullscreen switching on OpenBox 1.x.
.PD 1
.
.TP
.B \-fs-border-left <pixels>
.TP
.B \-fs-border-right <pixels>
.TP
.B \-fs-border-top <pixels>
.TP
.B \-fs-border-bottom <pixels>
Specify extra borders in full screen mode.
The borders apply to all displayed elements: video, OSD and EOSD.
The number of pixels is specified in terms of screen resolution.
Currently only supported with by the gl video output driver.
.TP
.B \-gamma <\-100\-100>
Adjust the gamma of the video signal (default: 0).
Not supported by all video output drivers.
Expand Down
4 changes: 4 additions & 0 deletions cfg-mplayer.h
Expand Up @@ -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},
Expand Down
4 changes: 4 additions & 0 deletions libvo/video_out.c
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions libvo/video_out.h
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions libvo/vo_gl.c
Expand Up @@ -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);

Expand Down
21 changes: 20 additions & 1 deletion libvo/x11_common.c
Expand Up @@ -963,6 +963,19 @@ int vo_x11_check_events(Display * mydisplay)
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.
*/
Expand Down Expand Up @@ -1145,6 +1158,7 @@ void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
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;
Expand Down Expand Up @@ -1189,6 +1203,7 @@ void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
// set the size values right.
vo_dwidth = vo_screenwidth;
vo_dheight = vo_screenheight;
vo_x11_update_fs_borders();
}
final:
if (vo_gc != None)
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 3641b45

Please sign in to comment.