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 *****************************************************************************/
30 vout_thread_t *p_vout;
41 volatile bool b_cursor_hidden;
42 volatile mtime_t i_lastmoved;
43 mtime_t i_mouse_hide_timeout;
47 #ifdef MODULE_NAME_IS_wingapi
48 typedef struct GXDisplayProperties {
55 } GXDisplayProperties;
57 typedef struct GXScreenRect {
64 # define GX_FULLSCREEN 0x01
65 # define GX_NORMALKEYS 0x02
66 # define GX_LANDSCAPEKEYS 0x03
69 # define kfLandscape 0x8
70 # define kfPalette 0x10
71 # define kfDirect 0x20
72 # define kfDirect555 0x40
73 # define kfDirect565 0x80
74 # define kfDirect888 0x100
75 # define kfDirect444 0x200
76 # define kfDirectInverted 0x400
83 /*****************************************************************************
84 * vout_sys_t: video output method descriptor
85 *****************************************************************************
86 * This structure is part of the video output thread descriptor.
87 * It describes the module specific properties of an output thread.
88 *****************************************************************************/
91 HWND hwnd; /* Handle of the main window */
92 HWND hvideownd; /* Handle of the video sub-window */
93 struct vout_window_t *parent_window; /* Parent window VLC object */
94 HWND hparent; /* Handle of the parent window */
95 HWND hfswnd; /* Handle of the fullscreen window */
96 WNDPROC pf_wndproc; /* Window handling callback */
98 /* Multi-monitor support */
99 HMONITOR hmonitor; /* handle of the current monitor */
100 GUID *p_display_driver;
101 HMONITOR (WINAPI* MonitorFromWindow)( HWND, DWORD );
102 BOOL (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
104 /* size of the display */
108 /* size of the overall window (including black bands) */
111 /* Window position and size */
118 volatile uint16_t i_changes; /* changes made to the video display */
121 bool b_on_top_change;
125 /* screensaver system settings to be restored when vout is closed */
126 UINT i_spi_lowpowertimeout;
127 UINT i_spi_powerofftimeout;
128 UINT i_spi_screensavetimeout;
132 /* Coordinates of src and dest images (used when blitting to display) */
134 RECT rect_src_clipped;
136 RECT rect_dest_clipped;
138 bool b_hw_yuv; /* Should we use hardware YUV->RGB conversions */
141 #ifdef MODULE_NAME_IS_directx
142 /* Overlay alignment restrictions */
143 int i_align_src_boundary;
144 int i_align_src_size;
145 int i_align_dest_boundary;
146 int i_align_dest_size;
148 bool b_wallpaper; /* show as desktop wallpaper ? */
150 bool b_using_overlay; /* Are we using an overlay surface */
151 bool b_use_sysmem; /* Should we use system memory for surfaces */
152 bool b_3buf_overlay; /* Should we use triple buffered overlays */
154 /* DDraw capabilities */
155 int b_caps_overlay_clipping;
157 unsigned int i_rgb_colorkey; /* colorkey in RGB used by the overlay */
158 unsigned int i_colorkey; /* colorkey used by the overlay */
161 COLORREF color_bkgtxt;
163 LPDIRECTDRAW2 p_ddobject; /* DirectDraw object */
164 LPDIRECTDRAWSURFACE2 p_display; /* Display device */
165 LPDIRECTDRAWSURFACE2 p_current_surface; /* surface currently displayed */
166 LPDIRECTDRAWCLIPPER p_clipper; /* clipper used for blitting */
167 HINSTANCE hddraw_dll; /* handle of the opened ddraw dll */
170 #ifdef MODULE_NAME_IS_glwin32
175 #ifdef MODULE_NAME_IS_direct3d
176 /* show video on desktop window ? */
180 HINSTANCE hd3d9_dll; /* handle of the opened d3d9 dll */
181 LPDIRECT3D9 p_d3dobj;
182 LPDIRECT3DDEVICE9 p_d3ddev;
185 LPDIRECT3DTEXTURE9 p_d3dtex;
186 LPDIRECT3DVERTEXBUFFER9 p_d3dvtc;
189 #ifdef MODULE_NAME_IS_wingdi
193 /* Our offscreen bitmap and its framebuffer */
196 uint8_t * p_pic_buffer;
198 int i_pic_pixel_pitch;
200 BITMAPINFO bitmapinfo;
206 #ifdef MODULE_NAME_IS_wingapi
210 /* Our offscreen bitmap and its framebuffer */
213 uint8_t * p_pic_buffer;
215 int i_pic_pixel_pitch;
217 BITMAPINFO bitmapinfo;
225 HINSTANCE gapi_dll; /* handle of the opened gapi dll */
228 int (*GXOpenDisplay)( HWND hWnd, DWORD dwFlags );
229 int (*GXCloseDisplay)();
230 void *(*GXBeginDraw)();
232 GXDisplayProperties (*GXGetDisplayProperties)();
238 /* suspend display */
239 bool b_suspend_display;
242 event_thread_t *p_event;
246 #ifdef MODULE_NAME_IS_wingapi
247 # define GXOpenDisplay p_vout->p_sys->GXOpenDisplay
248 # define GXCloseDisplay p_vout->p_sys->GXCloseDisplay
249 # define GXBeginDraw p_vout->p_sys->GXBeginDraw
250 # define GXEndDraw p_vout->p_sys->GXEndDraw
251 # define GXGetDisplayProperties p_vout->p_sys->GXGetDisplayProperties
252 # define GXSuspend p_vout->p_sys->GXSuspend
253 # define GXResume p_vout->p_sys->GXResume
256 /*****************************************************************************
257 * Prototypes from directx.c
258 *****************************************************************************/
259 int DirectDrawUpdateOverlay( vout_thread_t *p_vout );
261 /*****************************************************************************
262 * Prototypes from events.c
263 *****************************************************************************/
264 event_thread_t *EventThreadCreate( vout_thread_t * );
265 void EventThreadDestroy( event_thread_t * );
266 int EventThreadStart( event_thread_t * );
267 void EventThreadStop( event_thread_t * );
269 void EventThreadMouseAutoHide( event_thread_t * );
271 /*****************************************************************************
272 * Prototypes from common.c
273 *****************************************************************************/
274 int CommonInit( vout_thread_t * );
275 void CommonClean( vout_thread_t * );
276 void CommonManage( vout_thread_t * );
278 int Control( vout_thread_t *p_vout, int i_query, va_list args );
280 void UpdateRects ( vout_thread_t *p_vout, bool b_force );
281 void Win32ToggleFullscreen ( vout_thread_t *p_vout );
282 void ExitFullscreen( vout_thread_t *p_vout );
284 void DisableScreensaver ( vout_thread_t *p_vout );
285 void RestoreScreensaver ( vout_thread_t *p_vout );
288 /*****************************************************************************
290 *****************************************************************************/
291 #define WM_VLC_HIDE_MOUSE WM_APP
292 #define WM_VLC_SHOW_MOUSE WM_APP + 1
293 #define WM_VLC_CHANGE_TEXT WM_APP + 2
294 #define IDM_TOGGLE_ON_TOP WM_USER + 1
295 #define DX_POSITION_CHANGE 0x1000
296 #define DX_WALLPAPER_CHANGE 0x2000
297 #define DX_DESKTOP_CHANGE 0x4000
299 /*****************************************************************************
301 *****************************************************************************/
304 #define AdjustWindowRect(a,b,c)
306 #ifndef GCL_HBRBACKGROUND
307 # define GCL_HBRBACKGROUND (-10)
310 //#define FindWindowEx(a,b,c,d) 0
312 #define GetWindowPlacement(a,b)
313 #define SetWindowPlacement(a,b)
314 /*typedef struct _WINDOWPLACEMENT {
320 RECT rcNormalPosition;
323 #ifndef WM_NCMOUSEMOVE
324 # define WM_NCMOUSEMOVE 160
329 #ifndef SC_SCREENSAVE
330 # define SC_SCREENSAVE 0xF140
332 #ifndef SC_MONITORPOWER
333 # define SC_MONITORPOWER 0xF170
336 # define WM_NCPAINT 133
338 #ifndef WS_OVERLAPPEDWINDOW
339 # define WS_OVERLAPPEDWINDOW 0xcf0000
341 #ifndef WS_EX_NOPARENTNOTIFY
342 # define WS_EX_NOPARENTNOTIFY 4
344 #ifndef WS_EX_APPWINDOW
345 #define WS_EX_APPWINDOW 0x40000
348 //#define SetWindowLongPtr SetWindowLong
349 //#define GetWindowLongPtr GetWindowLong
350 //#define GWLP_USERDATA GWL_USERDATA