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;
42 #ifdef MODULE_NAME_IS_wingapi
43 typedef struct GXDisplayProperties {
50 } GXDisplayProperties;
52 typedef struct GXScreenRect {
59 # define GX_FULLSCREEN 0x01
60 # define GX_NORMALKEYS 0x02
61 # define GX_LANDSCAPEKEYS 0x03
64 # define kfLandscape 0x8
65 # define kfPalette 0x10
66 # define kfDirect 0x20
67 # define kfDirect555 0x40
68 # define kfDirect565 0x80
69 # define kfDirect888 0x100
70 # define kfDirect444 0x200
71 # define kfDirectInverted 0x400
78 /*****************************************************************************
79 * vout_sys_t: video output method descriptor
80 *****************************************************************************
81 * This structure is part of the video output thread descriptor.
82 * It describes the module specific properties of an output thread.
83 *****************************************************************************/
86 HWND hwnd; /* Handle of the main window */
87 HWND hvideownd; /* Handle of the video sub-window */
88 struct vout_window_t *parent_window; /* Parent window VLC object */
89 HWND hparent; /* Handle of the parent window */
90 HWND hfswnd; /* Handle of the fullscreen window */
91 WNDPROC pf_wndproc; /* Window handling callback */
93 /* Multi-monitor support */
94 HMONITOR hmonitor; /* handle of the current monitor */
95 GUID *p_display_driver;
96 HMONITOR (WINAPI* MonitorFromWindow)( HWND, DWORD );
97 BOOL (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
99 /* size of the display */
103 /* size of the overall window (including black bands) */
106 /* Window position and size */
113 volatile uint16_t i_changes; /* changes made to the video display */
116 volatile bool b_cursor_hidden;
117 volatile mtime_t i_lastmoved;
118 mtime_t i_mouse_hide_timeout;
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 /*****************************************************************************
270 * Prototypes from common.c
271 *****************************************************************************/
272 int CommonInit( vout_thread_t * );
273 void CommonClean( vout_thread_t * );
275 int Control( vout_thread_t *p_vout, int i_query, va_list args );
277 void UpdateRects ( vout_thread_t *p_vout, bool b_force );
278 void Win32ToggleFullscreen ( vout_thread_t *p_vout );
279 void ExitFullscreen( vout_thread_t *p_vout );
281 void DisableScreensaver ( vout_thread_t *p_vout );
282 void RestoreScreensaver ( vout_thread_t *p_vout );
285 /*****************************************************************************
287 *****************************************************************************/
288 #define WM_VLC_HIDE_MOUSE WM_APP
289 #define WM_VLC_SHOW_MOUSE WM_APP + 1
290 #define WM_VLC_CHANGE_TEXT WM_APP + 2
291 #define IDM_TOGGLE_ON_TOP WM_USER + 1
292 #define DX_POSITION_CHANGE 0x1000
293 #define DX_WALLPAPER_CHANGE 0x2000
294 #define DX_DESKTOP_CHANGE 0x4000
296 /*****************************************************************************
298 *****************************************************************************/
301 #define AdjustWindowRect(a,b,c)
303 #ifndef GCL_HBRBACKGROUND
304 # define GCL_HBRBACKGROUND (-10)
307 //#define FindWindowEx(a,b,c,d) 0
309 #define GetWindowPlacement(a,b)
310 #define SetWindowPlacement(a,b)
311 /*typedef struct _WINDOWPLACEMENT {
317 RECT rcNormalPosition;
320 #ifndef WM_NCMOUSEMOVE
321 # define WM_NCMOUSEMOVE 160
326 #ifndef SC_SCREENSAVE
327 # define SC_SCREENSAVE 0xF140
329 #ifndef SC_MONITORPOWER
330 # define SC_MONITORPOWER 0xF170
333 # define WM_NCPAINT 133
335 #ifndef WS_OVERLAPPEDWINDOW
336 # define WS_OVERLAPPEDWINDOW 0xcf0000
338 #ifndef WS_EX_NOPARENTNOTIFY
339 # define WS_EX_NOPARENTNOTIFY 4
341 #ifndef WS_EX_APPWINDOW
342 #define WS_EX_APPWINDOW 0x40000
345 //#define SetWindowLongPtr SetWindowLong
346 //#define GetWindowLongPtr GetWindowLong
347 //#define GWLP_USERDATA GWL_USERDATA