1 /*****************************************************************************
2 * common.h: Windows video output header file
3 *****************************************************************************
4 * Copyright (C) 2001-2009 VLC authors and VideoLAN
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 it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifdef MODULE_NAME_IS_directdraw
28 #ifdef MODULE_NAME_IS_direct3d
30 # include <d3dx9effect.h>
32 #ifdef MODULE_NAME_IS_glwin32
33 # include "../opengl.h"
35 #ifdef MODULE_NAME_IS_direct2d
39 /*****************************************************************************
40 * event_thread_t: event thread
41 *****************************************************************************/
44 /*****************************************************************************
45 * vout_sys_t: video output method descriptor
46 *****************************************************************************
47 * This structure is part of the video output thread descriptor.
48 * It describes the module specific properties of an output thread.
49 *****************************************************************************/
50 struct vout_display_sys_t
53 event_thread_t *event;
56 HWND hwnd; /* Handle of the main window */
57 HWND hvideownd; /* Handle of the video sub-window */
58 struct vout_window_t *parent_window; /* Parent window VLC object */
59 HWND hparent; /* Handle of the parent window */
60 HWND hfswnd; /* Handle of the fullscreen window */
62 /* size of the display */
65 /* size of the overall window (including black bands) */
68 unsigned changes; /* changes made to the video display */
71 bool is_first_display;
74 /* screensaver system settings to be restored when vout is closed */
75 UINT i_spi_screensaveactive;
77 /* Coordinates of src and dest images (used when blitting to display) */
79 RECT rect_src_clipped;
81 RECT rect_dest_clipped;
85 #ifdef MODULE_NAME_IS_directdraw
86 /* Multi-monitor support */
87 HMONITOR hmonitor; /* handle of the current monitor */
90 /* Overlay alignment restrictions */
91 int i_align_src_boundary;
93 int i_align_dest_boundary;
94 int i_align_dest_size;
96 bool use_wallpaper; /* show as desktop wallpaper ? */
98 bool use_overlay; /* Are we using an overlay surface */
101 /* DDraw capabilities */
102 bool can_blit_fourcc;
104 uint32_t i_rgb_colorkey; /* colorkey in RGB used by the overlay */
105 uint32_t i_colorkey; /* colorkey used by the overlay */
108 COLORREF color_bkgtxt;
110 LPDIRECTDRAW2 ddobject; /* DirectDraw object */
111 LPDIRECTDRAWSURFACE2 display; /* Display device */
112 LPDIRECTDRAWCLIPPER clipper; /* clipper used for blitting */
113 HINSTANCE hddraw_dll; /* handle of the opened ddraw dll */
115 picture_sys_t *picsys;
117 /* It protects the following variables */
120 bool wallpaper_requested;
123 #ifdef MODULE_NAME_IS_glwin32
127 vout_display_opengl_t *vgl;
128 HDC affinityHDC; // DC for the selected GPU
131 #ifdef MODULE_NAME_IS_direct2d
132 HINSTANCE d2_dll; /* handle of the opened d2d1 dll */
133 ID2D1Factory *d2_factory; /* D2D factory */
134 ID2D1HwndRenderTarget *d2_render_target; /* D2D rendering target */
135 ID2D1Bitmap *d2_bitmap; /* D2 bitmap */
138 #ifdef MODULE_NAME_IS_direct3d
139 bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */
140 /* show video on desktop window ? */
147 vout_display_cfg_t cfg_saved; /* configuration used before going into desktop mode */
150 HINSTANCE hd3d9_dll; /* handle of the opened d3d9 dll */
151 HINSTANCE hd3d9x_dll; /* handle of the opened d3d9x dll */
152 IDirect3DPixelShader9* d3dx_shader;
155 LPDIRECT3DDEVICE9 d3ddev;
156 D3DPRESENT_PARAMETERS d3dpp;
159 LPDIRECT3DTEXTURE9 d3dtex;
160 LPDIRECT3DVERTEXBUFFER9 d3dvtc;
161 D3DFORMAT d3dregion_format;
163 struct d3d_region_t *d3dregion;
165 picture_sys_t *picsys;
173 /* It protects the following variables */
176 bool desktop_requested;
179 #if defined(MODULE_NAME_IS_wingdi)
182 /* Our offscreen bitmap and its framebuffer */
188 BITMAPINFO bitmapinfo;
196 /*****************************************************************************
197 * Prototypes from common.c
198 *****************************************************************************/
199 int CommonInit(vout_display_t *);
200 void CommonClean(vout_display_t *);
201 void CommonManage(vout_display_t *);
202 int CommonControl(vout_display_t *, int , va_list );
203 void CommonDisplay(vout_display_t *);
204 int CommonUpdatePicture(picture_t *, picture_t **, uint8_t *, unsigned);
206 void UpdateRects (vout_display_t *,
207 const vout_display_cfg_t *,
208 const video_format_t *,
210 void AlignRect(RECT *, int align_boundary, int align_size);
212 /*****************************************************************************
214 *****************************************************************************/
215 #define IDM_TOGGLE_ON_TOP WM_USER + 1
216 #define DX_POSITION_CHANGE 0x1000
217 #define DX_WALLPAPER_CHANGE 0x2000
218 #define DX_DESKTOP_CHANGE 0x4000