]> git.sesse.net Git - vlc/blob - modules/video_output/directx/vout.h
* modules/video_output/directx/*:
[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     WNDPROC              pf_wndproc;             /* Window handling callback */
53
54     /* Multi-monitor support */
55     HMONITOR             hmonitor;          /* handle of the current monitor */
56     GUID                 *p_display_driver;
57     HMONITOR             (WINAPI* MonitorFromWindow)( HWND, DWORD );
58     BOOL                 (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
59
60     vlc_bool_t   b_using_overlay;         /* Are we using an overlay surface */
61     vlc_bool_t   b_use_sysmem;   /* Should we use system memory for surfaces */
62     vlc_bool_t   b_hw_yuv;    /* Should we use hardware YUV->RGB conversions */
63     vlc_bool_t   b_3buf_overlay;   /* Should we use triple buffered overlays */
64
65     /* size of the display */
66     RECT         rect_display;
67     int          i_display_depth;
68
69     /* Window position and size */
70     int          i_window_x;
71     int          i_window_y;
72     int          i_window_width;
73     int          i_window_height;
74
75     /* Coordinates of src and dest images (used when blitting to display) */
76     RECT         rect_src;
77     RECT         rect_src_clipped;
78     RECT         rect_dest;
79     RECT         rect_dest_clipped;
80
81     /* Overlay alignment restrictions */
82     int          i_align_src_boundary;
83     int          i_align_src_size;
84     int          i_align_dest_boundary;
85     int          i_align_dest_size;
86
87     /* DDraw capabilities */
88     int          b_caps_overlay_clipping;
89
90     int          i_rgb_colorkey;      /* colorkey in RGB used by the overlay */
91     int          i_colorkey;                 /* colorkey used by the overlay */
92
93     volatile uint16_t i_changes;        /* changes made to the video display */
94
95     /* Mouse */
96     volatile vlc_bool_t b_cursor_hidden;
97     volatile mtime_t    i_lastmoved;
98
99     /* Misc */
100     vlc_bool_t          b_on_top_change;
101
102     event_thread_t *    p_event;
103 };
104
105 /*****************************************************************************
106  * picture_sys_t: direct buffer method descriptor
107  *****************************************************************************
108  * This structure is part of the picture descriptor, it describes the
109  * DirectX specific properties of a direct buffer.
110  *****************************************************************************/
111 struct picture_sys_t
112 {
113     LPDIRECTDRAWSURFACE2 p_surface;
114     DDSURFACEDESC        ddsd;
115     LPDIRECTDRAWSURFACE2 p_front_surface;
116 };
117
118 /*****************************************************************************
119  * Prototypes from vout.c
120  *****************************************************************************/
121 int DirectXUpdateOverlay( vout_thread_t *p_vout );
122
123 /*****************************************************************************
124  * Prototypes from events.c
125  *****************************************************************************/
126 void DirectXEventThread ( event_thread_t *p_event );
127 void DirectXUpdateRects ( vout_thread_t *p_vout, vlc_bool_t b_force );
128
129 /*****************************************************************************
130  * Constants
131  *****************************************************************************/
132 #define WM_VLC_HIDE_MOUSE WM_APP
133 #define WM_VLC_CREATE_VIDEO_WIN WM_APP + 1
134 #define WM_VLC_DESTROY_VIDEO_WIN WM_APP + 2
135 #define WM_VLC_CHANGE_TEXT WM_APP + 3
136 #define IDM_TOGGLE_ON_TOP WM_USER + 1
137 #define DX_POSITION_CHANGE 0x1000