1 /*****************************************************************************
2 * common.h: Windows video output header file
3 *****************************************************************************
4 * Copyright (C) 2001-2009 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@videolan.org>
8 * Damien Fouilleul <damienf@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
26 * event_thread_t: event thread
27 *****************************************************************************/
28 #include <vlc_picture_pool.h>
31 #ifdef MODULE_NAME_IS_wingapi
32 typedef struct GXDisplayProperties {
39 } GXDisplayProperties;
41 typedef struct GXScreenRect {
48 # define GX_FULLSCREEN 0x01
49 # define GX_NORMALKEYS 0x02
50 # define GX_LANDSCAPEKEYS 0x03
53 # define kfLandscape 0x8
54 # define kfPalette 0x10
55 # define kfDirect 0x20
56 # define kfDirect555 0x40
57 # define kfDirect565 0x80
58 # define kfDirect888 0x100
59 # define kfDirect444 0x200
60 # define kfDirectInverted 0x400
65 /*****************************************************************************
66 * vout_sys_t: video output method descriptor
67 *****************************************************************************
68 * This structure is part of the video output thread descriptor.
69 * It describes the module specific properties of an output thread.
70 *****************************************************************************/
71 struct vout_display_sys_t
74 event_thread_t *event;
77 HWND hwnd; /* Handle of the main window */
78 HWND hvideownd; /* Handle of the video sub-window */
79 struct vout_window_t *parent_window; /* Parent window VLC object */
80 HWND hparent; /* Handle of the parent window */
81 HWND hfswnd; /* Handle of the fullscreen window */
83 /* size of the display */
87 /* size of the overall window (including black bands) */
90 unsigned changes; /* changes made to the video display */
93 bool is_first_display;
98 /* screensaver system settings to be restored when vout is closed */
99 UINT i_spi_lowpowertimeout;
100 UINT i_spi_powerofftimeout;
101 UINT i_spi_screensavetimeout;
105 /* Coordinates of src and dest images (used when blitting to display) */
107 RECT rect_src_clipped;
109 RECT rect_dest_clipped;
111 picture_pool_t *pool;
113 #ifdef MODULE_NAME_IS_directx
114 /* Multi-monitor support */
115 HMONITOR hmonitor; /* handle of the current monitor */
116 GUID *display_driver;
117 HMONITOR (WINAPI* MonitorFromWindow)(HWND, DWORD);
118 BOOL (WINAPI* GetMonitorInfo)(HMONITOR, LPMONITORINFO);
120 /* Overlay alignment restrictions */
121 int i_align_src_boundary;
122 int i_align_src_size;
123 int i_align_dest_boundary;
124 int i_align_dest_size;
126 bool use_wallpaper; /* show as desktop wallpaper ? */
128 bool use_overlay; /* Are we using an overlay surface */
129 bool restore_overlay;
131 /* DDraw capabilities */
132 bool can_blit_fourcc;
134 uint32_t i_rgb_colorkey; /* colorkey in RGB used by the overlay */
135 uint32_t i_colorkey; /* colorkey used by the overlay */
138 COLORREF color_bkgtxt;
140 LPDIRECTDRAW2 ddobject; /* DirectDraw object */
141 LPDIRECTDRAWSURFACE2 display; /* Display device */
142 LPDIRECTDRAWCLIPPER clipper; /* clipper used for blitting */
143 HINSTANCE hddraw_dll; /* handle of the opened ddraw dll */
145 picture_resource_t resource;
147 /* It protects the following variables */
150 bool wallpaper_requested;
153 #ifdef MODULE_NAME_IS_glwin32
157 vout_display_opengl_t vgl;
160 #ifdef MODULE_NAME_IS_direct3d
161 bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */
162 /* show video on desktop window ? */
169 vout_display_cfg_t cfg_saved; /* configuration used before going into desktop mode */
172 HINSTANCE hd3d9_dll; /* handle of the opened d3d9 dll */
174 LPDIRECT3DDEVICE9 d3ddev;
175 D3DPRESENT_PARAMETERS d3dpp;
177 LPDIRECT3DTEXTURE9 d3dtex;
178 LPDIRECT3DVERTEXBUFFER9 d3dvtc;
180 picture_resource_t resource;
186 /* It protects the following variables */
189 bool desktop_requested;
192 #if defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
195 /* Our offscreen bitmap and its framebuffer */
201 BITMAPINFO bitmapinfo;
207 # ifdef MODULE_NAME_IS_wingapi
208 HINSTANCE gapi_dll; /* handle of the opened gapi dll */
211 int (*GXOpenDisplay)(HWND hWnd, DWORD dwFlags);
212 int (*GXCloseDisplay)();
213 void *(*GXBeginDraw)();
215 GXDisplayProperties (*GXGetDisplayProperties)();
222 #ifdef MODULE_NAME_IS_wingapi
223 # define GXOpenDisplay vd->sys->GXOpenDisplay
224 # define GXCloseDisplay vd->sys->GXCloseDisplay
225 # define GXBeginDraw vd->sys->GXBeginDraw
226 # define GXEndDraw vd->sys->GXEndDraw
227 # define GXGetDisplayProperties vd->sys->GXGetDisplayProperties
228 # define GXSuspend vd->sys->GXSuspend
229 # define GXResume vd->sys->GXResume
232 /*****************************************************************************
233 * Prototypes from common.c
234 *****************************************************************************/
235 int CommonInit(vout_display_t *);
236 void CommonClean(vout_display_t *);
237 void CommonManage(vout_display_t *);
238 int CommonControl(vout_display_t *, int , va_list );
239 void CommonDisplay(vout_display_t *);
240 int CommonUpdatePicture(picture_t *, picture_t **, uint8_t *, unsigned);
242 void UpdateRects (vout_display_t *,
243 const vout_display_cfg_t *,
244 const video_format_t *,
246 void AlignRect(RECT *, int align_boundary, int align_size);
248 /*****************************************************************************
250 *****************************************************************************/
251 #define IDM_TOGGLE_ON_TOP WM_USER + 1
252 #define DX_POSITION_CHANGE 0x1000
253 #define DX_WALLPAPER_CHANGE 0x2000
254 #define DX_DESKTOP_CHANGE 0x4000
256 /*****************************************************************************
258 *****************************************************************************/
261 #define AdjustWindowRect(a,b,c) AdjustWindowRectEx(a,b,c,0)
263 #ifndef GCL_HBRBACKGROUND
264 # define GCL_HBRBACKGROUND (-10)
267 //#define FindWindowEx(a,b,c,d) 0
269 #define GetWindowPlacement(a,b)
270 #define SetWindowPlacement(a,b)
271 /*typedef struct _WINDOWPLACEMENT {
277 RECT rcNormalPosition;
280 #ifndef WM_NCMOUSEMOVE
281 # define WM_NCMOUSEMOVE 160
286 #ifndef SC_SCREENSAVE
287 # define SC_SCREENSAVE 0xF140
289 #ifndef SC_MONITORPOWER
290 # define SC_MONITORPOWER 0xF170
293 # define WM_NCPAINT 133
295 #ifndef WS_OVERLAPPEDWINDOW
296 # define WS_OVERLAPPEDWINDOW 0xcf0000
298 #ifndef WS_EX_NOPARENTNOTIFY
299 # define WS_EX_NOPARENTNOTIFY 4
301 #ifndef WS_EX_APPWINDOW
302 #define WS_EX_APPWINDOW 0x40000
305 //#define SetWindowLongPtr SetWindowLong
306 //#define GetWindowLongPtr GetWindowLong
307 //#define GWLP_USERDATA GWL_USERDATA