summaryrefslogtreecommitdiffstats
path: root/libvo/vo_directx.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-04-14 13:39:53 +0200
committerwm4 <wm4@mplayer2.org>2012-04-14 17:03:11 +0200
commit923f353d2ab9fa24d3a3989c23cec88499068b77 (patch)
tree3bdebdf5a426b7bcc50a4d6bb6efe2a7f9a7ffdb /libvo/vo_directx.c
parent8c041127d1a3445e482472cb5cff8116c07dab25 (diff)
downloadmpv-923f353d2ab9fa24d3a3989c23cec88499068b77.tar.bz2
mpv-923f353d2ab9fa24d3a3989c23cec88499068b77.tar.xz
win32: move global variables into a struct & some refactoring
This reflects the changes done to x11_common in mplayer2 some years ago. It makes it possible to open multiple VOs at once. The removed defines are probably for ancient versions of MinGW with incomplete headers. Remove some minor code duplication.
Diffstat (limited to 'libvo/vo_directx.c')
-rw-r--r--libvo/vo_directx.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c
index f4ab2a7f7f..0a20e5e33a 100644
--- a/libvo/vo_directx.c
+++ b/libvo/vo_directx.c
@@ -36,6 +36,8 @@
#include "sub/sub.h"
#include "w32_common.h"
+#define vo_w32_window (global_vo->w32->window)
+
static LPDIRECTDRAWCOLORCONTROL g_cc = NULL; //color control interface
static LPDIRECTDRAW7 g_lpdd = NULL; //DirectDraw Object
static LPDIRECTDRAWSURFACE7 g_lpddsPrimary = NULL; //Primary Surface: viewport through the Desktop
@@ -335,7 +337,7 @@ static void uninit(void)
hddraw_dll = NULL;
mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>ddraw.dll freed\n");
mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>uninitialized\n");
- vo_w32_uninit();
+ vo_w32_uninit(global_vo);
}
static BOOL WINAPI EnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm)
@@ -607,15 +609,15 @@ static uint32_t Directx_ManageDisplay(void)
static void check_events(void)
{
- int evt = vo_w32_check_events();
+ int evt = vo_w32_check_events(global_vo);
if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE))
Directx_ManageDisplay();
if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE | VO_EVENT_EXPOSE)) {
- HDC dc = vo_w32_get_dc(vo_w32_window);
+ HDC dc = vo_w32_get_dc(global_vo, vo_w32_window);
RECT r;
GetClientRect(vo_w32_window, &r);
FillRect(dc, &r, vo_fs || vidmode ? blackbrush : colorbrush);
- vo_w32_release_dc(vo_w32_window, dc);
+ vo_w32_release_dc(global_vo, vo_w32_window, dc);
}
}
@@ -749,9 +751,9 @@ static int preinit(const char *arg)
windowcolor = vo_colorkey;
colorbrush = CreateSolidBrush(windowcolor);
blackbrush = (HBRUSH)GetStockObject(BLACK_BRUSH);
- if (!vo_w32_init())
+ if (!vo_w32_init(global_vo))
return 1;
- if (!vo_w32_config(100, 100, VOFLAG_HIDDEN))
+ if (!vo_w32_config(global_vo, 100, 100, VOFLAG_HIDDEN))
return 1;
if (Directx_InitDirectDraw() != 0)
@@ -958,7 +960,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
g_lpddsPrimary = NULL;
mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>overlay surfaces released\n");
- if (!vo_w32_config(d_width, d_height, options))
+ if (!vo_w32_config(global_vo, d_width, d_height, options))
return 1;
/*create the surfaces*/
@@ -1108,11 +1110,11 @@ static int control(uint32_t request, void *data)
case VOCTRL_DRAW_IMAGE:
return put_image(data);
case VOCTRL_BORDER:
- vo_w32_border();
+ vo_w32_border(global_vo);
Directx_ManageDisplay();
return VO_TRUE;
case VOCTRL_ONTOP:
- vo_w32_ontop();
+ vo_w32_ontop(global_vo);
return VO_TRUE;
case VOCTRL_ROOTWIN:
if (WinID != -1)
@@ -1128,7 +1130,7 @@ static int control(uint32_t request, void *data)
}
return VO_TRUE;
case VOCTRL_FULLSCREEN:
- vo_w32_fullscreen();
+ vo_w32_fullscreen(global_vo);
Directx_ManageDisplay();
return VO_TRUE;
case VOCTRL_SET_EQUALIZER: {
@@ -1140,7 +1142,7 @@ static int control(uint32_t request, void *data)
return color_ctrl_get(args->name, args->valueptr);
}
case VOCTRL_UPDATE_SCREENINFO:
- w32_update_xinerama_info();
+ w32_update_xinerama_info(global_vo);
return VO_TRUE;
}
return VO_NOTIMPL;