]> git.sesse.net Git - vlc/blob - modules/video_output/msw/vout.h
* modules/mux/mp4.c: typo opened -> opened spotted by alexvf
[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 /*****************************************************************************
37  * vout_sys_t: video output method descriptor
38  *****************************************************************************
39  * This structure is part of the video output thread descriptor.
40  * It describes the module specific properties of an output thread.
41  *****************************************************************************/
42 struct vout_sys_t
43 {
44     HWND                 hwnd;                  /* Handle of the main window */
45     HWND                 hvideownd;        /* Handle of the video sub-window */
46     HWND                 hparent;             /* Handle of the parent window */
47     HWND                 hfswnd;          /* Handle of the fullscreen window */
48     WNDPROC              pf_wndproc;             /* Window handling callback */
49
50     /* Multi-monitor support */
51     HMONITOR             hmonitor;          /* handle of the current monitor */
52     GUID                 *p_display_driver;
53     HMONITOR             (WINAPI* MonitorFromWindow)( HWND, DWORD );
54     BOOL                 (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
55
56     /* size of the display */
57     RECT         rect_display;
58     int          i_display_depth;
59
60     /* size of the overall window (including black bands) */
61     RECT         rect_parent;
62
63     /* Window position and size */
64     int          i_window_x;
65     int          i_window_y;
66     int          i_window_width;
67     int          i_window_height;
68     int          i_window_style;
69
70     volatile uint16_t i_changes;        /* changes made to the video display */
71
72     /* Mouse */
73     volatile vlc_bool_t b_cursor_hidden;
74     volatile mtime_t    i_lastmoved;
75
76     /* Misc */
77     vlc_bool_t      b_on_top_change;
78
79 #ifndef UNDER_CE
80
81     /* screensaver system settings to be restored when vout is closed */
82     UINT i_spi_lowpowertimeout;
83     UINT i_spi_powerofftimeout;
84     UINT i_spi_screensavetimeout;
85
86 #endif
87
88     /* Coordinates of src and dest images (used when blitting to display) */
89     RECT         rect_src;
90     RECT         rect_src_clipped;
91     RECT         rect_dest;
92     RECT         rect_dest_clipped;
93
94     vlc_bool_t   b_hw_yuv;    /* Should we use hardware YUV->RGB conversions */
95
96
97 #ifdef MODULE_NAME_IS_vout_directx
98     /* Overlay alignment restrictions */
99     int          i_align_src_boundary;
100     int          i_align_src_size;
101     int          i_align_dest_boundary;
102     int          i_align_dest_size;
103
104     vlc_bool_t      b_wallpaper;    /* show as desktop wallpaper ? */
105
106     vlc_bool_t   b_using_overlay;         /* Are we using an overlay surface */
107     vlc_bool_t   b_use_sysmem;   /* Should we use system memory for surfaces */
108     vlc_bool_t   b_3buf_overlay;   /* Should we use triple buffered overlays */
109
110     /* DDraw capabilities */
111     int          b_caps_overlay_clipping;
112
113     int          i_rgb_colorkey;      /* colorkey in RGB used by the overlay */
114     int          i_colorkey;                 /* colorkey used by the overlay */
115
116     COLORREF        color_bkg;
117     COLORREF        color_bkgtxt;
118
119     LPDIRECTDRAW2        p_ddobject;                    /* DirectDraw object */
120     LPDIRECTDRAWSURFACE2 p_display;                        /* Display device */
121     LPDIRECTDRAWSURFACE2 p_current_surface;   /* surface currently displayed */
122     LPDIRECTDRAWCLIPPER  p_clipper;             /* clipper used for blitting */
123     HINSTANCE            hddraw_dll;       /* handle of the opened ddraw dll */
124 #endif
125
126 #ifdef MODULE_NAME_IS_glwin32
127     HDC hGLDC;
128     HGLRC hGLRC;
129 #endif
130
131 #ifdef MODULE_NAME_IS_direct3d
132     // core objects
133     HINSTANCE               hd3d9_dll;       /* handle of the opened d3d9 dll */
134     LPDIRECT3D9             p_d3dobj;
135     LPDIRECT3DDEVICE9       p_d3ddev;
136     D3DFORMAT               bbFormat;
137     // scene objects
138     LPDIRECT3DTEXTURE9      p_d3dtex;
139     LPDIRECT3DVERTEXBUFFER9 p_d3dvtc;
140 #endif
141
142 #ifdef MODULE_NAME_IS_wingdi
143
144     int  i_depth;
145
146     /* Our offscreen bitmap and its framebuffer */
147     HDC        off_dc;
148     HBITMAP    off_bitmap;
149     uint8_t *  p_pic_buffer;
150     int        i_pic_pitch;
151     int        i_pic_pixel_pitch;
152
153     BITMAPINFO bitmapinfo;
154     RGBQUAD    red;
155     RGBQUAD    green;
156     RGBQUAD    blue;
157 #endif
158
159 #ifdef MODULE_NAME_IS_wingapi
160     int        i_depth;
161     int        render_width;
162     int        render_height;
163
164     vlc_bool_t b_focus;
165     vlc_bool_t b_parent_focus;
166
167     HINSTANCE  gapi_dll;                    /* handle of the opened gapi dll */
168
169     /* GAPI functions */
170     int (*GXOpenDisplay)( HWND hWnd, DWORD dwFlags );
171     int (*GXCloseDisplay)();
172     void *(*GXBeginDraw)();
173     int (*GXEndDraw)();
174     GXDisplayProperties (*GXGetDisplayProperties)();
175     int (*GXSuspend)();
176     int (*GXResume)();
177 #endif
178
179 #ifndef UNDER_CE
180     /* suspend display */
181     vlc_bool_t   b_suspend_display;
182 #endif
183
184     event_thread_t *p_event;
185     vlc_mutex_t    lock;
186 };
187
188 /*****************************************************************************
189  * Prototypes from directx.c
190  *****************************************************************************/
191 int DirectDrawUpdateOverlay( vout_thread_t *p_vout );
192
193 /*****************************************************************************
194  * Prototypes from events.c
195  *****************************************************************************/
196 void E_(EventThread) ( event_thread_t *p_event );
197 void E_(UpdateRects) ( vout_thread_t *p_vout, vlc_bool_t b_force );
198 void Win32ToggleFullscreen ( vout_thread_t *p_vout );
199
200 /*****************************************************************************
201  * Constants
202  *****************************************************************************/
203 #define WM_VLC_HIDE_MOUSE WM_APP
204 #define WM_VLC_SHOW_MOUSE WM_APP + 1
205 #define WM_VLC_CHANGE_TEXT WM_APP + 2
206 #define IDM_TOGGLE_ON_TOP WM_USER + 1
207 #define DX_POSITION_CHANGE 0x1000
208 #define DX_WALLPAPER_CHANGE 0x2000
209
210 /*****************************************************************************
211  * WinCE helpers
212  *****************************************************************************/
213 #ifdef UNDER_CE
214
215 #define AdjustWindowRect(a,b,c)
216
217 #ifndef GCL_HBRBACKGROUND
218 #   define GCL_HBRBACKGROUND (-10)
219 #endif
220
221 #define FindWindowEx(a,b,c,d) 0
222
223 #define GetWindowPlacement(a,b)
224 #define SetWindowPlacement(a,b)
225 typedef struct _WINDOWPLACEMENT {
226     UINT length;
227     UINT flags;
228     UINT showCmd;
229     POINT ptMinPosition;
230     POINT ptMaxPosition;
231     RECT rcNormalPosition;
232 } WINDOWPLACEMENT;
233
234 #ifndef WM_NCMOUSEMOVE
235 #   define WM_NCMOUSEMOVE 160
236 #endif
237 #ifndef CS_OWNDC
238 #   define CS_OWNDC 32
239 #endif
240 #ifndef SC_SCREENSAVE
241 #   define SC_SCREENSAVE 0xF140
242 #endif
243 #ifndef SC_MONITORPOWER
244 #   define SC_MONITORPOWER 0xF170
245 #endif
246 #ifndef WM_NCPAINT
247 #   define WM_NCPAINT 133
248 #endif
249 #ifndef WS_OVERLAPPEDWINDOW
250 #   define WS_OVERLAPPEDWINDOW 0xcf0000
251 #endif
252 #ifndef WS_EX_NOPARENTNOTIFY
253 #   define WS_EX_NOPARENTNOTIFY 4
254 #endif
255 #ifndef WS_EX_APPWINDOW
256 #define WS_EX_APPWINDOW 0x40000
257 #endif
258
259 #define SetWindowLongPtr SetWindowLong
260 #define GetWindowLongPtr GetWindowLong
261 #define GWLP_USERDATA GWL_USERDATA
262
263 #endif //UNDER_CE