mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 23:32:26 +00:00
add a switch, slave command, and vo control to toggle borderless window.
includes documentation. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16969 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8318fcd06b
commit
8901ee0b0a
@ -2085,6 +2085,13 @@ Override the autodetected color depth.
|
||||
Only supported by the fbdev, dga, svga, vesa video output drivers.
|
||||
.
|
||||
.TP
|
||||
.B \-border
|
||||
Play movie with window border and decorations.
|
||||
Since this is on by default, use \-noborder to disable the standard window
|
||||
decorations.
|
||||
Supported by directx video output driver.
|
||||
.
|
||||
.TP
|
||||
.B \-brightness <-100\-100>
|
||||
Adjust the brightness of the video signal (default: 0).
|
||||
Not supported by all video output drivers.
|
||||
|
@ -63,6 +63,8 @@ Each vo driver _has_ to implement these:
|
||||
Makes the player window stay-on-top. Only supported (currently)
|
||||
by drivers which use X11, except SDL, as well as directx and
|
||||
gl2 under Windows.
|
||||
VOCTRL_BORDER
|
||||
Makes the player window borderless. Only supported by directx.
|
||||
|
||||
config():
|
||||
Set up the video system. You get the dimensions and flags.
|
||||
|
@ -270,6 +270,9 @@ vo_ontop
|
||||
vo_rootwin
|
||||
Toggle playback on the root window.
|
||||
|
||||
vo_border
|
||||
Toggle borderless display.
|
||||
|
||||
volume <value>
|
||||
Increase/decrease volume.
|
||||
|
||||
|
@ -45,6 +45,7 @@ extern int vo_gamma_contrast;
|
||||
extern int vo_gamma_hue;
|
||||
extern char *vo_geometry;
|
||||
extern int vo_ontop;
|
||||
extern int vo_border;
|
||||
extern int vo_keepaspect;
|
||||
extern int vo_rootwin;
|
||||
|
||||
@ -144,6 +145,8 @@ m_option_t mplayer_opts[]={
|
||||
{"ontop", &vo_ontop, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||
{"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{"border", &vo_border, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{"noborder", &vo_border, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||
|
||||
{"aop", "-aop is deprecated, use -af instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
||||
{"dsp", "Use -ao oss:dsp_path.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
||||
|
@ -219,6 +219,7 @@ static char help_text[]=
|
||||
#define MSGTR_OSDSpeed "Speed: x %6.2f"
|
||||
#define MSGTR_OSDStayOnTop "Stay on top: %s"
|
||||
#define MSGTR_OSDRootwin "Rootwin: %s"
|
||||
#define MSGTR_OSDBorder "Border: %s"
|
||||
#define MSGTR_OSDFramedrop "Framedropping: %s"
|
||||
#define MSGTR_OSDFramedropOn "on"
|
||||
#define MSGTR_OSDFramedropHard "hard"
|
||||
|
@ -108,6 +108,7 @@ static mp_cmd_t mp_cmds[] = {
|
||||
{ MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_VO_ONTOP, "vo_ontop", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_VO_ROOTWIN, "vo_rootwin", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_VO_BORDER, "vo_border", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_SCREENSHOT, "screenshot", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_PANSCAN, "panscan",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_SWITCH_VSYNC, "switch_vsync", 0, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
|
@ -68,6 +68,7 @@
|
||||
#define MP_CMD_SUB_LOAD 64
|
||||
#define MP_CMD_SUB_REMOVE 65
|
||||
#define MP_CMD_KEYDOWN_EVENTS 66
|
||||
#define MP_CMD_VO_BORDER 67
|
||||
|
||||
#define MP_CMD_GUI_EVENTS 5000
|
||||
#define MP_CMD_GUI_LOADFILE 5001
|
||||
|
@ -45,6 +45,7 @@ int vo_adapter_num=0;
|
||||
int vo_refresh_rate=0;
|
||||
int vo_keepaspect=1;
|
||||
int vo_rootwin=0;
|
||||
int vo_border=1;
|
||||
int WinID = -1;
|
||||
|
||||
int vo_pts=0; // for hw decoding
|
||||
|
@ -57,6 +57,7 @@
|
||||
|
||||
#define VOCTRL_ONTOP 25
|
||||
#define VOCTRL_ROOTWIN 26
|
||||
#define VOCTRL_BORDER 27
|
||||
|
||||
// Vo can be used by xover
|
||||
#define VOCTRL_XOVERLAY_SUPPORT 22
|
||||
@ -202,6 +203,7 @@ extern int vo_refresh_rate;
|
||||
extern int vo_keepaspect;
|
||||
extern int vo_rootwin;
|
||||
extern int vo_ontop;
|
||||
extern int vo_border;
|
||||
|
||||
extern int vo_gamma_brightness;
|
||||
extern int vo_gamma_saturation;
|
||||
|
@ -670,6 +670,7 @@ static uint32_t Directx_ManageDisplay()
|
||||
if(!vidmode && !vo_fs){
|
||||
if(WinID == -1) {
|
||||
RECT rdw=rd;
|
||||
if (vo_border)
|
||||
AdjustWindowRect(&rdw,WNDSTYLE,FALSE);
|
||||
// printf("window: %i %i %ix%i\n",rdw.left,rdw.top,rdw.right - rdw.left,rdw.bottom - rdw.top);
|
||||
rdw.left += monitor_rect.left; /* move to global coordinate space */
|
||||
@ -1039,7 +1040,7 @@ static int preinit(const char *arg)
|
||||
if (WinID != -1) hWnd = WinID;
|
||||
else
|
||||
hWnd = CreateWindowEx(vidmode?WS_EX_TOPMOST:0,
|
||||
WNDCLASSNAME_WINDOWED,"",(vidmode)?WS_POPUP:WNDSTYLE,
|
||||
WNDCLASSNAME_WINDOWED,"",(vidmode || !vo_border)?WS_POPUP:WNDSTYLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,NULL,NULL,hInstance,NULL);
|
||||
wc.hbrBackground = blackbrush;
|
||||
wc.lpszClassName = WNDCLASSNAME_FULLSCREEN;
|
||||
@ -1295,6 +1296,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
|
||||
rd.right = rd.left + d_image_width;
|
||||
rd.bottom = rd.top + d_image_height;
|
||||
if (WinID == -1) {
|
||||
if (vo_border)
|
||||
AdjustWindowRect(&rd,WNDSTYLE,FALSE);
|
||||
SetWindowPos(hWnd,NULL, vo_dx, vo_dy,rd.right-rd.left,rd.bottom-rd.top,SWP_SHOWWINDOW|SWP_NOOWNERZORDER);
|
||||
}
|
||||
@ -1449,6 +1451,30 @@ static int control(uint32_t request, void *data, ...)
|
||||
return query_format(*((uint32_t*)data));
|
||||
case VOCTRL_DRAW_IMAGE:
|
||||
return put_image(data);
|
||||
case VOCTRL_BORDER:
|
||||
if(WinID != -1) return VO_TRUE;
|
||||
if(vidmode)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>border has no meaning in exclusive mode\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(vo_border) {
|
||||
vo_border = 0;
|
||||
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
|
||||
} else {
|
||||
vo_border = 1;
|
||||
SetWindowLong(hWnd, GWL_STYLE, WNDSTYLE);
|
||||
}
|
||||
// needed AFAICT to force the window to
|
||||
// redisplay with the new style. --Joey
|
||||
if (!vo_fs) {
|
||||
ShowWindow(hWnd,SW_HIDE);
|
||||
ShowWindow(hWnd,SW_SHOW);
|
||||
}
|
||||
Directx_ManageDisplay();
|
||||
}
|
||||
return VO_TRUE;
|
||||
case VOCTRL_ONTOP:
|
||||
if(WinID != -1) return VO_TRUE;
|
||||
if(vidmode)
|
||||
|
15
mplayer.c
15
mplayer.c
@ -1062,6 +1062,7 @@ int osd_show_percentage = 0;
|
||||
int osd_show_tv_channel = 25;
|
||||
int osd_show_ontop = 0;
|
||||
int osd_show_rootwin = 0;
|
||||
int osd_show_border = 0;
|
||||
int osd_show_framedropping = 0;
|
||||
int osd_show_status = 0;
|
||||
|
||||
@ -3441,6 +3442,17 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
|
||||
#endif
|
||||
}
|
||||
|
||||
} break;
|
||||
case MP_CMD_VO_BORDER:
|
||||
{
|
||||
if(video_out && vo_config_count) {
|
||||
video_out->control(VOCTRL_BORDER, 0);
|
||||
#ifdef USE_OSD
|
||||
osd_show_border=10;
|
||||
vo_osd_changed(OSDTYPE_SUBTITLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
} break;
|
||||
case MP_CMD_PANSCAN : {
|
||||
if ( !video_out ) break;
|
||||
@ -4212,6 +4224,9 @@ if ((user_muted | edl_muted) != mixer.muted) mixer_mute(&mixer);
|
||||
} else if (osd_show_rootwin) {
|
||||
snprintf(osd_text_tmp, 63, MSGTR_OSDRootwin, vo_rootwin? MSGTR_OSDenabled : MSGTR_OSDdisabled);
|
||||
osd_show_rootwin--;
|
||||
} else if (osd_show_border) {
|
||||
snprintf(osd_text_tmp, 63, MSGTR_OSDBorder, vo_border? MSGTR_OSDenabled : MSGTR_OSDdisabled);
|
||||
osd_show_border--;
|
||||
} else if (osd_show_framedropping) {
|
||||
snprintf(osd_text_tmp, 63, MSGTR_OSDFramedrop,
|
||||
(frame_dropping == 1 ? MSGTR_OSDFramedropOn :
|
||||
|
Loading…
Reference in New Issue
Block a user