1 /*****************************************************************************
2 * vout.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 typedef struct event_thread_t
32 vout_thread_t * p_vout;
37 #ifdef MODULE_NAME_IS_wingapi
38 typedef struct GXDisplayProperties {
45 } GXDisplayProperties;
47 typedef struct GXScreenRect {
54 # define GX_FULLSCREEN 0x01
55 # define GX_NORMALKEYS 0x02
56 # define GX_LANDSCAPEKEYS 0x03
59 # define kfLandscape 0x8
60 # define kfPalette 0x10
61 # define kfDirect 0x20
62 # define kfDirect555 0x40
63 # define kfDirect565 0x80
64 # define kfDirect888 0x100
65 # define kfDirect444 0x200
66 # define kfDirectInverted 0x400
73 /*****************************************************************************
74 * vout_sys_t: video output method descriptor
75 *****************************************************************************
76 * This structure is part of the video output thread descriptor.
77 * It describes the module specific properties of an output thread.
78 *****************************************************************************/
81 HWND hwnd; /* Handle of the main window */
82 HWND hvideownd; /* Handle of the video sub-window */
83 struct vout_window_t *parent_window; /* Parent window VLC object */
84 HWND hparent; /* Handle of the parent window */
85 HWND hfswnd; /* Handle of the fullscreen window */
86 WNDPROC pf_wndproc; /* Window handling callback */
88 /* Multi-monitor support */
89 HMONITOR hmonitor; /* handle of the current monitor */
90 GUID *p_display_driver;
91 HMONITOR (WINAPI* MonitorFromWindow)( HWND, DWORD );
92 BOOL (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
94 /* size of the display */
98 /* size of the overall window (including black bands) */
101 /* Window position and size */
108 volatile uint16_t i_changes; /* changes made to the video display */
111 volatile bool b_cursor_hidden;
112 volatile mtime_t i_lastmoved;
113 mtime_t i_mouse_hide_timeout;
116 bool b_on_top_change;
120 /* screensaver system settings to be restored when vout is closed */
121 UINT i_spi_lowpowertimeout;
122 UINT i_spi_powerofftimeout;
123 UINT i_spi_screensavetimeout;
127 /* Coordinates of src and dest images (used when blitting to display) */
129 RECT rect_src_clipped;
131 RECT rect_dest_clipped;
133 bool b_hw_yuv; /* Should we use hardware YUV->RGB conversions */
136 #ifdef MODULE_NAME_IS_vout_directx
137 /* Overlay alignment restrictions */
138 int i_align_src_boundary;
139 int i_align_src_size;
140 int i_align_dest_boundary;
141 int i_align_dest_size;
143 bool b_wallpaper; /* show as desktop wallpaper ? */
145 bool b_using_overlay; /* Are we using an overlay surface */
146 bool b_use_sysmem; /* Should we use system memory for surfaces */
147 bool b_3buf_overlay; /* Should we use triple buffered overlays */
149 /* DDraw capabilities */
150 int b_caps_overlay_clipping;
152 int i_rgb_colorkey; /* colorkey in RGB used by the overlay */
153 int i_colorkey; /* colorkey used by the overlay */
156 COLORREF color_bkgtxt;
158 LPDIRECTDRAW2 p_ddobject; /* DirectDraw object */
159 LPDIRECTDRAWSURFACE2 p_display; /* Display device */
160 LPDIRECTDRAWSURFACE2 p_current_surface; /* surface currently displayed */
161 LPDIRECTDRAWCLIPPER p_clipper; /* clipper used for blitting */
162 HINSTANCE hddraw_dll; /* handle of the opened ddraw dll */
165 #ifdef MODULE_NAME_IS_glwin32
170 #ifdef MODULE_NAME_IS_direct3d
172 HINSTANCE hd3d9_dll; /* handle of the opened d3d9 dll */
173 LPDIRECT3D9 p_d3dobj;
174 LPDIRECT3DDEVICE9 p_d3ddev;
177 LPDIRECT3DTEXTURE9 p_d3dtex;
178 LPDIRECT3DVERTEXBUFFER9 p_d3dvtc;
181 #ifdef MODULE_NAME_IS_wingdi
185 /* Our offscreen bitmap and its framebuffer */
188 uint8_t * p_pic_buffer;
190 int i_pic_pixel_pitch;
192 BITMAPINFO bitmapinfo;
198 #ifdef MODULE_NAME_IS_wingapi
202 /* Our offscreen bitmap and its framebuffer */
205 uint8_t * p_pic_buffer;
207 int i_pic_pixel_pitch;
209 BITMAPINFO bitmapinfo;
217 HINSTANCE gapi_dll; /* handle of the opened gapi dll */
220 int (*GXOpenDisplay)( HWND hWnd, DWORD dwFlags );
221 int (*GXCloseDisplay)();
222 void *(*GXBeginDraw)();
224 GXDisplayProperties (*GXGetDisplayProperties)();
230 /* suspend display */
231 bool b_suspend_display;
234 event_thread_t *p_event;
238 #ifdef MODULE_NAME_IS_wingapi
239 # define GXOpenDisplay p_vout->p_sys->GXOpenDisplay
240 # define GXCloseDisplay p_vout->p_sys->GXCloseDisplay
241 # define GXBeginDraw p_vout->p_sys->GXBeginDraw
242 # define GXEndDraw p_vout->p_sys->GXEndDraw
243 # define GXGetDisplayProperties p_vout->p_sys->GXGetDisplayProperties
244 # define GXSuspend p_vout->p_sys->GXSuspend
245 # define GXResume p_vout->p_sys->GXResume
248 /*****************************************************************************
249 * Prototypes from directx.c
250 *****************************************************************************/
251 int DirectDrawUpdateOverlay( vout_thread_t *p_vout );
253 /*****************************************************************************
254 * Prototypes from events.c
255 *****************************************************************************/
256 void* EventThread ( vlc_object_t *p_this );
257 void UpdateRects ( vout_thread_t *p_vout, bool b_force );
258 void Win32ToggleFullscreen ( vout_thread_t *p_vout );
260 /*****************************************************************************
262 *****************************************************************************/
263 #define WM_VLC_HIDE_MOUSE WM_APP
264 #define WM_VLC_SHOW_MOUSE WM_APP + 1
265 #define WM_VLC_CHANGE_TEXT WM_APP + 2
266 #define IDM_TOGGLE_ON_TOP WM_USER + 1
267 #define DX_POSITION_CHANGE 0x1000
268 #define DX_WALLPAPER_CHANGE 0x2000
270 /*****************************************************************************
272 *****************************************************************************/
275 #define AdjustWindowRect(a,b,c)
277 #ifndef GCL_HBRBACKGROUND
278 # define GCL_HBRBACKGROUND (-10)
281 //#define FindWindowEx(a,b,c,d) 0
283 #define GetWindowPlacement(a,b)
284 #define SetWindowPlacement(a,b)
285 /*typedef struct _WINDOWPLACEMENT {
291 RECT rcNormalPosition;
294 #ifndef WM_NCMOUSEMOVE
295 # define WM_NCMOUSEMOVE 160
300 #ifndef SC_SCREENSAVE
301 # define SC_SCREENSAVE 0xF140
303 #ifndef SC_MONITORPOWER
304 # define SC_MONITORPOWER 0xF170
307 # define WM_NCPAINT 133
309 #ifndef WS_OVERLAPPEDWINDOW
310 # define WS_OVERLAPPEDWINDOW 0xcf0000
312 #ifndef WS_EX_NOPARENTNOTIFY
313 # define WS_EX_NOPARENTNOTIFY 4
315 #ifndef WS_EX_APPWINDOW
316 #define WS_EX_APPWINDOW 0x40000
319 //#define SetWindowLongPtr SetWindowLong
320 //#define GetWindowLongPtr GetWindowLong
321 //#define GWLP_USERDATA GWL_USERDATA