]> git.sesse.net Git - vlc/blob - modules/video_output/msw/vout.h
WinCE: fix compilation of vout
[vlc] / modules / video_output / msw / vout.h
1 /*****************************************************************************
2  * vout.h: Windows video output header file
3  *****************************************************************************
4  * Copyright (C) 2001-2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *          Damien Fouilleul <damienf@videolan.org>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 /*****************************************************************************
26  * event_thread_t: event thread
27  *****************************************************************************/
28 typedef struct event_thread_t
29 {
30     VLC_COMMON_MEMBERS
31
32     vout_thread_t * p_vout;
33
34 } event_thread_t;
35
36 #ifdef MODULE_NAME_IS_wingapi
37     typedef struct GXDisplayProperties {
38         DWORD cxWidth;
39         DWORD cyHeight;
40         long cbxPitch;
41         long cbyPitch;
42         long cBPP;
43         DWORD ffFormat;
44     } GXDisplayProperties;
45
46     typedef struct GXScreenRect {
47         DWORD dwTop;
48         DWORD dwLeft;
49         DWORD dwWidth;
50         DWORD dwHeight;
51     } GXScreenRect;
52
53 #   define GX_FULLSCREEN    0x01
54 #   define GX_NORMALKEYS    0x02
55 #   define GX_LANDSCAPEKEYS 0x03
56
57 #   ifndef kfLandscape
58 #       define kfLandscape      0x8
59 #       define kfPalette        0x10
60 #       define kfDirect         0x20
61 #       define kfDirect555      0x40
62 #       define kfDirect565      0x80
63 #       define kfDirect888      0x100
64 #       define kfDirect444      0x200
65 #       define kfDirectInverted 0x400
66 #   endif
67
68 #endif
69
70 /*****************************************************************************
71  * vout_sys_t: video output method descriptor
72  *****************************************************************************
73  * This structure is part of the video output thread descriptor.
74  * It describes the module specific properties of an output thread.
75  *****************************************************************************/
76 struct vout_sys_t
77 {
78     HWND                 hwnd;                  /* Handle of the main window */
79     HWND                 hvideownd;        /* Handle of the video sub-window */
80     HWND                 hparent;             /* Handle of the parent window */
81     HWND                 hfswnd;          /* Handle of the fullscreen window */
82     WNDPROC              pf_wndproc;             /* Window handling callback */
83
84     /* Multi-monitor support */
85     HMONITOR             hmonitor;          /* handle of the current monitor */
86     GUID                 *p_display_driver;
87     HMONITOR             (WINAPI* MonitorFromWindow)( HWND, DWORD );
88     BOOL                 (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
89
90     /* size of the display */
91     RECT         rect_display;
92     int          i_display_depth;
93
94     /* size of the overall window (including black bands) */
95     RECT         rect_parent;
96
97     /* Window position and size */
98     int          i_window_x;
99     int          i_window_y;
100     int          i_window_width;
101     int          i_window_height;
102     int          i_window_style;
103
104     volatile uint16_t i_changes;        /* changes made to the video display */
105
106     /* Mouse */
107     volatile bool b_cursor_hidden;
108     volatile mtime_t    i_lastmoved;
109     mtime_t             i_mouse_hide_timeout;
110
111     /* Misc */
112     bool      b_on_top_change;
113
114 #ifndef UNDER_CE
115
116     /* screensaver system settings to be restored when vout is closed */
117     UINT i_spi_lowpowertimeout;
118     UINT i_spi_powerofftimeout;
119     UINT i_spi_screensavetimeout;
120
121 #endif
122
123     /* Coordinates of src and dest images (used when blitting to display) */
124     RECT         rect_src;
125     RECT         rect_src_clipped;
126     RECT         rect_dest;
127     RECT         rect_dest_clipped;
128
129     bool   b_hw_yuv;    /* Should we use hardware YUV->RGB conversions */
130
131
132 #ifdef MODULE_NAME_IS_vout_directx
133     /* Overlay alignment restrictions */
134     int          i_align_src_boundary;
135     int          i_align_src_size;
136     int          i_align_dest_boundary;
137     int          i_align_dest_size;
138
139     bool      b_wallpaper;    /* show as desktop wallpaper ? */
140
141     bool   b_using_overlay;         /* Are we using an overlay surface */
142     bool   b_use_sysmem;   /* Should we use system memory for surfaces */
143     bool   b_3buf_overlay;   /* Should we use triple buffered overlays */
144
145     /* DDraw capabilities */
146     int          b_caps_overlay_clipping;
147
148     int          i_rgb_colorkey;      /* colorkey in RGB used by the overlay */
149     int          i_colorkey;                 /* colorkey used by the overlay */
150
151     COLORREF        color_bkg;
152     COLORREF        color_bkgtxt;
153
154     LPDIRECTDRAW2        p_ddobject;                    /* DirectDraw object */
155     LPDIRECTDRAWSURFACE2 p_display;                        /* Display device */
156     LPDIRECTDRAWSURFACE2 p_current_surface;   /* surface currently displayed */
157     LPDIRECTDRAWCLIPPER  p_clipper;             /* clipper used for blitting */
158     HINSTANCE            hddraw_dll;       /* handle of the opened ddraw dll */
159 #endif
160
161 #ifdef MODULE_NAME_IS_glwin32
162     HDC hGLDC;
163     HGLRC hGLRC;
164 #endif
165
166 #ifdef MODULE_NAME_IS_direct3d
167     // core objects
168     HINSTANCE               hd3d9_dll;       /* handle of the opened d3d9 dll */
169     LPDIRECT3D9             p_d3dobj;
170     LPDIRECT3DDEVICE9       p_d3ddev;
171     D3DFORMAT               bbFormat;
172     // scene objects
173     LPDIRECT3DTEXTURE9      p_d3dtex;
174     LPDIRECT3DVERTEXBUFFER9 p_d3dvtc;
175 #endif
176
177 #ifdef MODULE_NAME_IS_wingdi
178
179     int  i_depth;
180
181     /* Our offscreen bitmap and its framebuffer */
182     HDC        off_dc;
183     HBITMAP    off_bitmap;
184     uint8_t *  p_pic_buffer;
185     int        i_pic_pitch;
186     int        i_pic_pixel_pitch;
187
188     BITMAPINFO bitmapinfo;
189     RGBQUAD    red;
190     RGBQUAD    green;
191     RGBQUAD    blue;
192 #endif
193
194 #ifdef MODULE_NAME_IS_wingapi
195     int        i_depth;
196     int        render_width;
197     int        render_height;
198             /* Our offscreen bitmap and its framebuffer */
199     HDC        off_dc;
200     HBITMAP    off_bitmap;
201     uint8_t *  p_pic_buffer;
202     int        i_pic_pitch;
203     int        i_pic_pixel_pitch;
204
205     BITMAPINFO bitmapinfo;
206     RGBQUAD    red;
207     RGBQUAD    green;
208     RGBQUAD    blue;
209
210     bool b_focus;
211     bool b_parent_focus;
212
213     HINSTANCE  gapi_dll;                   /* handle of the opened gapi dll */
214
215     /* GAPI functions */
216     int (*GXOpenDisplay)( HWND hWnd, DWORD dwFlags );
217     int (*GXCloseDisplay)();
218     void *(*GXBeginDraw)();
219     int (*GXEndDraw)();
220     GXDisplayProperties (*GXGetDisplayProperties)();
221     int (*GXSuspend)();
222     int (*GXResume)();
223 #endif
224
225 #ifndef UNDER_CE
226     /* suspend display */
227     bool   b_suspend_display;
228 #endif
229
230     event_thread_t *p_event;
231     vlc_mutex_t    lock;
232 };
233
234 #ifdef MODULE_NAME_IS_wingapi
235 #   define GXOpenDisplay p_vout->p_sys->GXOpenDisplay
236 #   define GXCloseDisplay p_vout->p_sys->GXCloseDisplay
237 #   define GXBeginDraw p_vout->p_sys->GXBeginDraw
238 #   define GXEndDraw p_vout->p_sys->GXEndDraw
239 #   define GXGetDisplayProperties p_vout->p_sys->GXGetDisplayProperties
240 #   define GXSuspend p_vout->p_sys->GXSuspend
241 #   define GXResume p_vout->p_sys->GXResume
242 #endif
243
244 /*****************************************************************************
245  * Prototypes from directx.c
246  *****************************************************************************/
247 int DirectDrawUpdateOverlay( vout_thread_t *p_vout );
248
249 /*****************************************************************************
250  * Prototypes from events.c
251  *****************************************************************************/
252 void* EventThread ( vlc_object_t *p_this );
253 void UpdateRects ( vout_thread_t *p_vout, bool b_force );
254 void Win32ToggleFullscreen ( vout_thread_t *p_vout );
255
256 /*****************************************************************************
257  * Constants
258  *****************************************************************************/
259 #define WM_VLC_HIDE_MOUSE WM_APP
260 #define WM_VLC_SHOW_MOUSE WM_APP + 1
261 #define WM_VLC_CHANGE_TEXT WM_APP + 2
262 #define IDM_TOGGLE_ON_TOP WM_USER + 1
263 #define DX_POSITION_CHANGE 0x1000
264 #define DX_WALLPAPER_CHANGE 0x2000
265
266 /*****************************************************************************
267  * WinCE helpers
268  *****************************************************************************/
269 #ifdef UNDER_CE
270
271 #define AdjustWindowRect(a,b,c)
272
273 #ifndef GCL_HBRBACKGROUND
274 #   define GCL_HBRBACKGROUND (-10)
275 #endif
276
277 //#define FindWindowEx(a,b,c,d) 0
278
279 #define GetWindowPlacement(a,b)
280 #define SetWindowPlacement(a,b)
281 /*typedef struct _WINDOWPLACEMENT {
282     UINT length;
283     UINT flags;
284     UINT showCmd;
285     POINT ptMinPosition;
286     POINT ptMaxPosition;
287     RECT rcNormalPosition;
288 } WINDOWPLACEMENT;*/
289
290 #ifndef WM_NCMOUSEMOVE
291 #   define WM_NCMOUSEMOVE 160
292 #endif
293 #ifndef CS_OWNDC
294 #   define CS_OWNDC 32
295 #endif
296 #ifndef SC_SCREENSAVE
297 #   define SC_SCREENSAVE 0xF140
298 #endif
299 #ifndef SC_MONITORPOWER
300 #   define SC_MONITORPOWER 0xF170
301 #endif
302 #ifndef WM_NCPAINT
303 #   define WM_NCPAINT 133
304 #endif
305 #ifndef WS_OVERLAPPEDWINDOW
306 #   define WS_OVERLAPPEDWINDOW 0xcf0000
307 #endif
308 #ifndef WS_EX_NOPARENTNOTIFY
309 #   define WS_EX_NOPARENTNOTIFY 4
310 #endif
311 #ifndef WS_EX_APPWINDOW
312 #define WS_EX_APPWINDOW 0x40000
313 #endif
314
315 //#define SetWindowLongPtr SetWindowLong
316 //#define GetWindowLongPtr GetWindowLong
317 //#define GWLP_USERDATA GWL_USERDATA
318
319 #endif //UNDER_CE