mirror of https://github.com/mpv-player/mpv
use vo_fs + geometry support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10901 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
c588626f12
commit
cc9ba80f50
|
@ -31,6 +31,7 @@
|
||||||
#include "../osdep/keycodes.h"
|
#include "../osdep/keycodes.h"
|
||||||
#include "../mp_msg.h"
|
#include "../mp_msg.h"
|
||||||
#include "aspect.h"
|
#include "aspect.h"
|
||||||
|
#include "geometry.h"
|
||||||
|
|
||||||
static LPDIRECTDRAW2 g_lpdd = NULL; //DirectDraw Object
|
static LPDIRECTDRAW2 g_lpdd = NULL; //DirectDraw Object
|
||||||
static LPDIRECTDRAWSURFACE g_lpddsPrimary = NULL; //Primary Surface: viewport through the Desktop
|
static LPDIRECTDRAWSURFACE g_lpddsPrimary = NULL; //Primary Surface: viewport through the Desktop
|
||||||
|
@ -49,7 +50,6 @@ static uint8_t *image=NULL; //image data
|
||||||
static uint32_t image_format=0; //image format
|
static uint32_t image_format=0; //image format
|
||||||
static uint32_t primary_image_format;
|
static uint32_t primary_image_format;
|
||||||
static uint32_t vm = 0; //exclusive mode, allows resolution switching (not implemented yet)
|
static uint32_t vm = 0; //exclusive mode, allows resolution switching (not implemented yet)
|
||||||
static uint32_t fs = 0; //display in window or fullscreen
|
|
||||||
static uint32_t dstride; //surface stride
|
static uint32_t dstride; //surface stride
|
||||||
static uint32_t nooverlay = 0; //NonOverlay mode
|
static uint32_t nooverlay = 0; //NonOverlay mode
|
||||||
static DWORD destcolorkey; //colorkey for our surface
|
static DWORD destcolorkey; //colorkey for our surface
|
||||||
|
@ -58,6 +58,7 @@ static COLORREF windowcolor = RGB(0,0,16); //windowcolor == colorkey
|
||||||
extern void mplayer_put_key(int code); //let mplayer handel the keyevents
|
extern void mplayer_put_key(int code); //let mplayer handel the keyevents
|
||||||
extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
|
extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
|
||||||
extern int vo_doublebuffering; //tribblebuffering
|
extern int vo_doublebuffering; //tribblebuffering
|
||||||
|
extern int vo_fs;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* DirectDraw GUIDs.
|
* DirectDraw GUIDs.
|
||||||
|
@ -384,7 +385,7 @@ static uint32_t Directx_ManageDisplay(uint32_t width,uint32_t height)
|
||||||
uint32_t xscreen = GetSystemMetrics(SM_CXSCREEN);
|
uint32_t xscreen = GetSystemMetrics(SM_CXSCREEN);
|
||||||
uint32_t yscreen = GetSystemMetrics(SM_CYSCREEN);
|
uint32_t yscreen = GetSystemMetrics(SM_CYSCREEN);
|
||||||
POINT point_window;
|
POINT point_window;
|
||||||
if(fs)
|
if(vo_fs)
|
||||||
{
|
{
|
||||||
/*center and zoom image*/
|
/*center and zoom image*/
|
||||||
rd_window.top = 0;
|
rd_window.top = 0;
|
||||||
|
@ -466,7 +467,7 @@ static uint32_t Directx_ManageDisplay(uint32_t width,uint32_t height)
|
||||||
rs.right=image_width;
|
rs.right=image_width;
|
||||||
rs.top=0;
|
rs.top=0;
|
||||||
rs.bottom=image_height;
|
rs.bottom=image_height;
|
||||||
if(!fs)rd_window = rd; /*don't crop the window !!!*/
|
if(!vo_fs)rd_window = rd; /*don't crop the window !!!*/
|
||||||
if(rd.left < 0) //move out left
|
if(rd.left < 0) //move out left
|
||||||
{
|
{
|
||||||
rs.left=(-rd.left*1000)/xstretch1000;
|
rs.left=(-rd.left*1000)/xstretch1000;
|
||||||
|
@ -501,17 +502,17 @@ static uint32_t Directx_ManageDisplay(uint32_t width,uint32_t height)
|
||||||
if ((capsDrv.dwCaps & DDCAPS_ALIGNBOUNDARYDEST) && capsDrv.dwAlignBoundaryDest)
|
if ((capsDrv.dwCaps & DDCAPS_ALIGNBOUNDARYDEST) && capsDrv.dwAlignBoundaryDest)
|
||||||
{
|
{
|
||||||
rd.left = (rd.left + capsDrv.dwAlignBoundaryDest / 2) & -(signed)(capsDrv.dwAlignBoundaryDest);
|
rd.left = (rd.left + capsDrv.dwAlignBoundaryDest / 2) & -(signed)(capsDrv.dwAlignBoundaryDest);
|
||||||
if(!fs)rd_window.left = (rd_window.left + capsDrv.dwAlignBoundaryDest / 2) & -(signed)(capsDrv.dwAlignBoundaryDest); //don't forget the window
|
if(!vo_fs)rd_window.left = (rd_window.left + capsDrv.dwAlignBoundaryDest / 2) & -(signed)(capsDrv.dwAlignBoundaryDest); //don't forget the window
|
||||||
}
|
}
|
||||||
if ((capsDrv.dwCaps & DDCAPS_ALIGNSIZEDEST) && capsDrv.dwAlignSizeDest)
|
if ((capsDrv.dwCaps & DDCAPS_ALIGNSIZEDEST) && capsDrv.dwAlignSizeDest)
|
||||||
{
|
{
|
||||||
rd.right = rd.left + ((rd.right - rd.left) & -(signed) (capsDrv.dwAlignSizeDest));
|
rd.right = rd.left + ((rd.right - rd.left) & -(signed) (capsDrv.dwAlignSizeDest));
|
||||||
if(!fs)rd_window.right = rd_window.left + ((rd_window.right - rd_window.left) & -(signed) (capsDrv.dwAlignSizeDest)); //don't forget the window
|
if(!vo_fs)rd_window.right = rd_window.left + ((rd_window.right - rd_window.left) & -(signed) (capsDrv.dwAlignSizeDest)); //don't forget the window
|
||||||
}
|
}
|
||||||
/*create an overlay FX structure to specify a destination color key*/
|
/*create an overlay FX structure to specify a destination color key*/
|
||||||
ZeroMemory(&ovfx, sizeof(ovfx));
|
ZeroMemory(&ovfx, sizeof(ovfx));
|
||||||
ovfx.dwSize = sizeof(ovfx);
|
ovfx.dwSize = sizeof(ovfx);
|
||||||
if(fs)
|
if(vo_fs)
|
||||||
{
|
{
|
||||||
ovfx.dckDestColorkey.dwColorSpaceLowValue = 0;
|
ovfx.dckDestColorkey.dwColorSpaceLowValue = 0;
|
||||||
ovfx.dckDestColorkey.dwColorSpaceHighValue = 0;
|
ovfx.dckDestColorkey.dwColorSpaceHighValue = 0;
|
||||||
|
@ -528,9 +529,9 @@ static uint32_t Directx_ManageDisplay(uint32_t width,uint32_t height)
|
||||||
else ontop = 1;
|
else ontop = 1;
|
||||||
}
|
}
|
||||||
/*calculate window rect with borders*/
|
/*calculate window rect with borders*/
|
||||||
if(!fs)AdjustWindowRect(&rd_window,WS_OVERLAPPEDWINDOW|WS_SIZEBOX,0);
|
if(!vo_fs)AdjustWindowRect(&rd_window,WS_OVERLAPPEDWINDOW|WS_SIZEBOX,0);
|
||||||
|
|
||||||
if((fs) || (!fs && ontop))hWndafter=HWND_TOPMOST;
|
if((vo_fs) || (!vo_fs && ontop))hWndafter=HWND_TOPMOST;
|
||||||
else hWndafter=HWND_NOTOPMOST;
|
else hWndafter=HWND_NOTOPMOST;
|
||||||
|
|
||||||
/*display the window*/
|
/*display the window*/
|
||||||
|
@ -1042,7 +1043,9 @@ static uint32_t put_image(mp_image_t *mpi){
|
||||||
static uint32_t
|
static uint32_t
|
||||||
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t options, char *title, uint32_t format)
|
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t options, char *title, uint32_t format)
|
||||||
{
|
{
|
||||||
fs = options & 0x01;
|
int wx=-1;
|
||||||
|
int wy=-1;
|
||||||
|
vo_fs = options & 0x01;
|
||||||
vm = options & 0x02;
|
vm = options & 0x02;
|
||||||
image_format = format;
|
image_format = format;
|
||||||
image_width = width;
|
image_width = width;
|
||||||
|
@ -1053,8 +1056,11 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
|
||||||
aspect_save_orig(image_width,image_height);
|
aspect_save_orig(image_width,image_height);
|
||||||
aspect_save_prescale(d_image_width,d_image_height);
|
aspect_save_prescale(d_image_width,d_image_height);
|
||||||
aspect_save_screenres(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
|
aspect_save_screenres(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
|
||||||
|
geometry(&wx, &wy, &d_image_width, &d_image_height,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
|
||||||
aspect(&d_image_width,&d_image_height,A_NOZOOM);
|
aspect(&d_image_width,&d_image_height,A_NOZOOM);
|
||||||
|
if(wx !=-1)SetWindowPos(hWnd,NULL, wx, wy,d_image_width,d_image_height,SWP_SHOWWINDOW|SWP_NOOWNERZORDER);
|
||||||
SetWindowText(hWnd,title);
|
SetWindowText(hWnd,title);
|
||||||
|
|
||||||
/*release all surfaces*/
|
/*release all surfaces*/
|
||||||
if (g_lpddsBack != NULL) g_lpddsBack->lpVtbl->Release(g_lpddsBack);
|
if (g_lpddsBack != NULL) g_lpddsBack->lpVtbl->Release(g_lpddsBack);
|
||||||
g_lpddsBack = NULL;
|
g_lpddsBack = NULL;
|
||||||
|
@ -1069,7 +1075,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
|
||||||
/*set cooperativelevel*/
|
/*set cooperativelevel*/
|
||||||
if(vm) /*exclusive mode*/
|
if(vm) /*exclusive mode*/
|
||||||
{
|
{
|
||||||
fs=1;
|
vo_fs=1;
|
||||||
if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) != DD_OK)
|
if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) != DD_OK)
|
||||||
{
|
{
|
||||||
mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't set cooperativelevel for exclusive mode");
|
mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't set cooperativelevel for exclusive mode");
|
||||||
|
@ -1094,7 +1100,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
|
||||||
}
|
}
|
||||||
mp_msg(MSGT_VO, MSGL_V,"<vo_directx><INFO>using normal cooperativelevel\n");
|
mp_msg(MSGT_VO, MSGL_V,"<vo_directx><INFO>using normal cooperativelevel\n");
|
||||||
}
|
}
|
||||||
if(fs)
|
if(vo_fs)
|
||||||
{
|
{
|
||||||
/*remove the borders*/
|
/*remove the borders*/
|
||||||
SetWindowLong( hWnd, GWL_STYLE, 0 );
|
SetWindowLong( hWnd, GWL_STYLE, 0 );
|
||||||
|
@ -1164,9 +1170,9 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||||
uint32_t height = 0;
|
uint32_t height = 0;
|
||||||
window_placement.length = sizeof(WINDOWPLACEMENT);
|
window_placement.length = sizeof(WINDOWPLACEMENT);
|
||||||
GetWindowPlacement(hWnd, &window_placement);
|
GetWindowPlacement(hWnd, &window_placement);
|
||||||
if(fs) /*go to windowed*/
|
if(vo_fs) /*go to windowed*/
|
||||||
{
|
{
|
||||||
fs = 0;
|
vo_fs = 0;
|
||||||
/*prevent the screen being filled with garbage*/
|
/*prevent the screen being filled with garbage*/
|
||||||
window_placement.showCmd = SW_SHOWMINIMIZED;
|
window_placement.showCmd = SW_SHOWMINIMIZED;
|
||||||
SetWindowPlacement(hWnd,&window_placement);
|
SetWindowPlacement(hWnd,&window_placement);
|
||||||
|
@ -1188,7 +1194,7 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||||
}
|
}
|
||||||
else /*go to fullscreen*/
|
else /*go to fullscreen*/
|
||||||
{
|
{
|
||||||
fs = 1;
|
vo_fs = 1;
|
||||||
/*remove decoration and maximize*/
|
/*remove decoration and maximize*/
|
||||||
SetWindowLong(hWnd,GWL_STYLE,0);
|
SetWindowLong(hWnd,GWL_STYLE,0);
|
||||||
window_placement.showCmd = SW_SHOWMAXIMIZED;
|
window_placement.showCmd = SW_SHOWMAXIMIZED;
|
||||||
|
|
Loading…
Reference in New Issue