]> git.sesse.net Git - vlc/blob - modules/video_output/directx/vout.h
* modules/video_output/directx/*: mostly unicode ready + WinCE compilation fixes.
[vlc] / modules / video_output / directx / vout.h
1 /*****************************************************************************
2  * vout.h: Windows DirectX video output header file
3  *****************************************************************************
4  * Copyright (C) 2001-2004 VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * event_thread_t: DirectX event thread
26  *****************************************************************************/
27 typedef struct event_thread_t
28 {
29     VLC_COMMON_MEMBERS
30
31     vout_thread_t * p_vout;
32
33 } event_thread_t;
34
35 /*****************************************************************************
36  * vout_sys_t: video output DirectX method descriptor
37  *****************************************************************************
38  * This structure is part of the video output thread descriptor.
39  * It describes the DirectX specific properties of an output thread.
40  *****************************************************************************/
41 struct vout_sys_t
42 {
43     LPDIRECTDRAW2        p_ddobject;                    /* DirectDraw object */
44     LPDIRECTDRAWSURFACE2 p_display;                        /* Display device */
45     LPDIRECTDRAWSURFACE2 p_current_surface;   /* surface currently displayed */
46     LPDIRECTDRAWCLIPPER  p_clipper;             /* clipper used for blitting */
47     HINSTANCE            hddraw_dll;       /* handle of the opened ddraw dll */
48
49     HWND                 hwnd;                  /* Handle of the main window */
50     HWND                 hvideownd;        /* Handle of the video sub-window */
51     HWND                 hparent;             /* Handle of the parent window */
52     HWND                 hfswnd;          /* Handle of the fullscreen window */
53     WNDPROC              pf_wndproc;             /* Window handling callback */
54
55     /* Multi-monitor support */
56     HMONITOR             hmonitor;          /* handle of the current monitor */
57     GUID                 *p_display_driver;
58     HMONITOR             (WINAPI* MonitorFromWindow)( HWND, DWORD );
59     BOOL                 (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
60
61     vlc_bool_t   b_using_overlay;         /* Are we using an overlay surface */
62     vlc_bool_t   b_use_sysmem;   /* Should we use system memory for surfaces */
63     vlc_bool_t   b_hw_yuv;    /* Should we use hardware YUV->RGB conversions */
64     vlc_bool_t   b_3buf_overlay;   /* Should we use triple buffered overlays */
65
66     /* size of the display */
67     RECT         rect_display;
68     int          i_display_depth;
69
70     /* Window position and size */
71     int          i_window_x;
72     int          i_window_y;
73     int          i_window_width;
74     int          i_window_height;
75
76     /* Coordinates of src and dest images (used when blitting to display) */
77     RECT         rect_src;
78     RECT         rect_src_clipped;
79     RECT         rect_dest;
80     RECT         rect_dest_clipped;
81     RECT         rect_parent;
82
83     /* Overlay alignment restrictions */
84     int          i_align_src_boundary;
85     int          i_align_src_size;
86     int          i_align_dest_boundary;
87     int          i_align_dest_size;
88
89     /* DDraw capabilities */
90     int          b_caps_overlay_clipping;
91
92     int          i_rgb_colorkey;      /* colorkey in RGB used by the overlay */
93     int          i_colorkey;                 /* colorkey used by the overlay */
94
95     volatile uint16_t i_changes;        /* changes made to the video display */
96
97     /* Mouse */
98     volatile vlc_bool_t b_cursor_hidden;
99     volatile mtime_t    i_lastmoved;
100
101     /* Misc */
102     vlc_bool_t      b_on_top_change;
103
104     vlc_bool_t      b_wallpaper;
105     COLORREF        color_bkg;
106     COLORREF        color_bkgtxt;
107
108 #ifdef MODULE_NAME_IS_glwin32
109     HDC hGLDC;
110     HGLRC hGLRC;
111 #endif
112
113     event_thread_t *p_event;
114     vlc_mutex_t    lock;
115 };
116
117 /*****************************************************************************
118  * picture_sys_t: direct buffer method descriptor
119  *****************************************************************************
120  * This structure is part of the picture descriptor, it describes the
121  * DirectX specific properties of a direct buffer.
122  *****************************************************************************/
123 struct picture_sys_t
124 {
125     LPDIRECTDRAWSURFACE2 p_surface;
126     DDSURFACEDESC        ddsd;
127     LPDIRECTDRAWSURFACE2 p_front_surface;
128 };
129
130 /*****************************************************************************
131  * Prototypes from vout.c
132  *****************************************************************************/
133 int DirectXUpdateOverlay( vout_thread_t *p_vout );
134
135 /*****************************************************************************
136  * Prototypes from events.c
137  *****************************************************************************/
138 void DirectXEventThread ( event_thread_t *p_event );
139 void DirectXUpdateRects ( vout_thread_t *p_vout, vlc_bool_t b_force );
140
141 /*****************************************************************************
142  * Constants
143  *****************************************************************************/
144 #define WM_VLC_HIDE_MOUSE WM_APP
145 #define WM_VLC_SHOW_MOUSE WM_APP + 1
146 #define WM_VLC_CREATE_VIDEO_WIN WM_APP + 2
147 #define WM_VLC_CHANGE_TEXT WM_APP + 3
148 #define IDM_TOGGLE_ON_TOP WM_USER + 1
149 #define DX_POSITION_CHANGE 0x1000
150 #define DX_WALLPAPER_CHANGE 0x2000
151
152 #ifndef _T
153 #   ifdef UNICODE
154 #       define _T(q) L##q
155 #   else
156 #       define _T(q) q
157 #   endif
158 #endif
159
160 /*****************************************************************************
161  * WinCE helpers
162  *****************************************************************************/
163 #ifdef UNDER_CE
164
165 #define AdjustWindowRect(a,b,c)
166
167 #ifndef GCL_HBRBACKGROUND
168 #   define GCL_HBRBACKGROUND (-10)
169 #endif
170
171 #define FindWindowEx(a,b,c,d) 0
172
173 #define GetWindowPlacement(a,b)
174 #define SetWindowPlacement(a,b)
175 typedef struct _WINDOWPLACEMENT {
176     UINT length;
177     UINT flags;
178     UINT showCmd;
179     POINT ptMinPosition;
180     POINT ptMaxPosition;
181     RECT rcNormalPosition;
182 } WINDOWPLACEMENT;
183
184 #ifndef WM_NCMOUSEMOVE
185 #   define WM_NCMOUSEMOVE 160
186 #endif
187 #ifndef CS_OWNDC
188 #   define CS_OWNDC 32
189 #endif
190 #ifndef SC_SCREENSAVE
191 #   define SC_SCREENSAVE 0xF140
192 #endif
193 #ifndef SC_MONITORPOWER
194 #   define SC_MONITORPOWER 0xF170
195 #endif
196 #ifndef WM_NCPAINT
197 #   define WM_NCPAINT 133
198 #endif
199 #ifndef WS_OVERLAPPEDWINDOW
200 #   define WS_OVERLAPPEDWINDOW 0xcf0000
201 #endif
202 #ifndef WS_EX_NOPARENTNOTIFY
203 #   define WS_EX_NOPARENTNOTIFY 4
204 #endif
205 #ifndef WS_EX_APPWINDOW
206 #define WS_EX_APPWINDOW 0x40000
207 #endif
208
209 #define SetWindowLongPtr SetWindowLong
210 #define GetWindowLongPtr GetWindowLong
211 #define GWLP_USERDATA GWL_USERDATA
212
213 #endif //UNDER_CE