]>
Commit | Line | Data |
---|---|---|
1a680109 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7ec69821 | 2 | // Name: src/msw/mediactrl.cpp |
ff4aedc5 | 3 | // Purpose: Built-in Media Backends for Windows |
1a680109 | 4 | // Author: Ryan Norton <wxprojects@comcast.net> |
72259e00 | 5 | // Modified by: |
1a680109 RN |
6 | // Created: 11/07/04 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Ryan Norton | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
b1ec2381 DS |
12 | // FIXME FIXME FIXME: |
13 | // extract different backends in different files (better yet, make backends | |
14 | // dynamically loadable...), they have nothing to do with each other and this | |
15 | // file is huge and also separate the standard contents from our code itself | |
16 | ||
aa200e97 | 17 | |
ff4aedc5 RN |
18 | //=========================================================================== |
19 | // DECLARATIONS | |
20 | //=========================================================================== | |
21 | ||
1a680109 | 22 | //--------------------------------------------------------------------------- |
ff4aedc5 | 23 | // Pre-compiled header stuff |
1a680109 RN |
24 | //--------------------------------------------------------------------------- |
25 | ||
1a680109 RN |
26 | // For compilers that support precompilation, includes "wx.h". |
27 | #include "wx/wxprec.h" | |
28 | ||
29 | #ifdef __BORLANDC__ | |
e4db172a | 30 | #pragma hdrstop |
1a680109 RN |
31 | #endif |
32 | ||
e4db172a WS |
33 | #if wxUSE_MEDIACTRL |
34 | ||
1a680109 RN |
35 | #include "wx/mediactrl.h" |
36 | ||
e4db172a WS |
37 | #ifndef WX_PRECOMP |
38 | #include "wx/log.h" | |
ed4b0fdc | 39 | #include "wx/dcclient.h" |
c0badb70 | 40 | #include "wx/timer.h" |
18680f86 | 41 | #include "wx/math.h" // log10 & pow |
e4db172a | 42 | #endif |
1a680109 | 43 | |
9d7d3b1f | 44 | #include "wx/msw/private.h" // user info and wndproc setting/getting |
40d4efa8 | 45 | #include "wx/dynlib.h" |
b195b4fa | 46 | |
1a680109 | 47 | //--------------------------------------------------------------------------- |
c5191fbd | 48 | // Externals (somewhere in src/msw/app.cpp and src/msw/window.cpp) |
1a680109 | 49 | //--------------------------------------------------------------------------- |
ff4aedc5 | 50 | extern "C" WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(void); |
316d19ac | 51 | extern WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName; |
1a680109 | 52 | |
c5191fbd VZ |
53 | LRESULT WXDLLIMPEXP_CORE APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, |
54 | WPARAM wParam, LPARAM lParam); | |
55 | ||
de63b922 JS |
56 | //--------------------------------------------------------------------------- |
57 | // Killed MSVC warnings | |
58 | //--------------------------------------------------------------------------- | |
59 | //disable "cast truncates constant value" for VARIANT_BOOL values | |
60 | //passed as parameters in VC5 and up | |
61 | #ifdef _MSC_VER | |
62 | #pragma warning (disable:4310) | |
63 | #endif | |
64 | ||
ff4aedc5 | 65 | //=========================================================================== |
9d7d3b1f | 66 | // BACKEND DECLARATIONS |
ff4aedc5 | 67 | //=========================================================================== |
1a680109 RN |
68 | |
69 | //--------------------------------------------------------------------------- | |
9d7d3b1f | 70 | // wxAMMediaBackend |
1a680109 RN |
71 | //--------------------------------------------------------------------------- |
72 | ||
ff4aedc5 | 73 | //--------------------------------------------------------------------------- |
9d7d3b1f | 74 | // wxActiveXContainer - includes all the COM-specific stuff we need |
920a7c15 | 75 | //--------------------------------------------------------------------------- |
bf354396 | 76 | #include "wx/msw/ole/activex.h" |
c5191fbd | 77 | |
a2a444e3 | 78 | //--------------------------------------------------------------------------- |
9d7d3b1f | 79 | // IIDS - used by CoCreateInstance and IUnknown::QueryInterface |
c5191fbd VZ |
80 | // |
81 | // [idl name] [idl decription] | |
82 | // amcompat.idl Microsoft Active Movie Control (Ver 2.0) | |
83 | // nscompat.idl Microsoft NetShow Player (Ver 1.0) | |
84 | // msdxm.idl Windows Media Player (Ver 1.0) | |
85 | // quartz.idl | |
86 | // | |
9d7d3b1f DS |
87 | // First, when I say I "from XXX.idl", I mean I go into the COM Browser |
88 | // ($Microsoft Visual Studio$/Common/Tools/OLEVIEW.EXE), open | |
89 | // "type libraries", open a specific type library (for quartz for example its | |
90 | // "ActiveMovie control type library (V1.0)"), save it as an .idl, compile the | |
91 | // idl using the midl compiler that comes with visual studio | |
92 | // ($Microsoft Visual Studio$/VC98/bin/midl.exe on VC6) with the /h argument | |
93 | // to make it generate stubs (a .h & .c file), then clean up the generated | |
94 | // interfaces I want with the STDMETHOD wrappers and then put them into | |
95 | // mediactrl.cpp. | |
c5191fbd | 96 | // |
9d7d3b1f DS |
97 | // According to the MSDN docs, IMediaPlayer requires Windows 98 SE |
98 | // or greater. NetShow is available on Windows 3.1 and I'm guessing | |
99 | // IActiveMovie is too. IMediaPlayer is essentially the Windows Media | |
100 | // Player 6.4 SDK. | |
920a7c15 | 101 | // |
9d7d3b1f DS |
102 | // IWMP is from PlayerOCX.idl on PocketPC 2000, which uses CLSID_MediaPlayer |
103 | // as well as the main windows line. | |
c137ddc9 | 104 | // |
9d7d3b1f | 105 | // Some of these are not used but are kept here for future reference anyway |
a2a444e3 | 106 | //--------------------------------------------------------------------------- |
c5191fbd VZ |
107 | const IID IID_IActiveMovie = {0x05589FA2,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}}; |
108 | const IID IID_IActiveMovie2 = {0xB6CD6554,0xE9CB,0x11D0,{0x82,0x1F,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}}; | |
109 | const IID IID_IActiveMovie3 = {0x265EC140,0xAE62,0x11D1,{0x85,0x00,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}}; | |
920a7c15 | 110 | |
c5191fbd VZ |
111 | const IID IID_INSOPlay = {0x2179C5D1,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}}; |
112 | const IID IID_INSPlay = {0xE7C4BE80,0x7960,0x11D0,{0xB7,0x27,0x00,0xAA,0x00,0xB4,0xE2,0x20}}; | |
113 | const IID IID_INSPlay1 = {0x265EC141,0xAE62,0x11D1,{0x85,0x00,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}}; | |
114 | ||
115 | const IID IID_IMediaPlayer = {0x22D6F311,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}}; | |
116 | const IID IID_IMediaPlayer2 = {0x20D4F5E0,0x5475,0x11D2,{0x97,0x74,0x00,0x00,0xF8,0x08,0x55,0xE6}}; | |
a2a444e3 | 117 | |
c137ddc9 JS |
118 | const IID IID_IWMP = {0x136B66EC,0xF30D,0x46A8,{0x88,0xDD,0xF2,0xD0,0x55,0x16,0x3E,0x49}}; |
119 | ||
c5191fbd VZ |
120 | const CLSID CLSID_ActiveMovie = {0x05589FA1,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}}; |
121 | const CLSID CLSID_MediaPlayer = {0x22D6F312,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}}; | |
122 | const CLSID CLSID_NSPlay = {0x2179C5D3,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}}; | |
920a7c15 | 123 | |
c5191fbd VZ |
124 | const IID IID_IAMOpenProgress = {0x8E1C39A1, 0xDE53, 0x11CF,{0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D}}; |
125 | ||
126 | // QUARTZ | |
127 | const CLSID CLSID_FilgraphManager = {0xE436EBB3,0x524F,0x11CE,{0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70}}; | |
128 | const IID IID_IMediaEvent = {0x56A868B6,0x0AD4,0x11CE,{0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70}}; | |
920a7c15 JS |
129 | |
130 | //?? QUARTZ Also? | |
c5191fbd VZ |
131 | const CLSID CLSID_VideoMixingRenderer9 ={0x51B4ABF3, 0x748F, 0x4E3B,{0xA2, 0x76, 0xC8, 0x28, 0x33, 0x0E, 0x92, 0x6A}}; |
132 | const IID IID_IVMRWindowlessControl9 = {0x8F537D09, 0xF85E, 0x4414,{0xB2, 0x3B, 0x50, 0x2E, 0x54, 0xC7, 0x99, 0x27}}; | |
920a7c15 JS |
133 | const IID IID_IFilterGraph = {0x56A8689F, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}}; |
134 | const IID IID_IGraphBuilder = {0x56A868A9, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}}; | |
c5191fbd | 135 | const IID IID_IVMRFilterConfig9 = {0x5A804648, 0x4F66, 0x4867,{0x9C, 0x43, 0x4F, 0x5C, 0x82, 0x2C, 0xF1, 0xB8}}; |
920a7c15 JS |
136 | const IID IID_IBaseFilter = {0x56A86895, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}}; |
137 | ||
138 | //--------------------------------------------------------------------------- | |
c5191fbd | 139 | // QUARTZ COM INTERFACES (dumped from quartz.idl from MSVC COM Browser) |
920a7c15 | 140 | //--------------------------------------------------------------------------- |
920a7c15 | 141 | |
c5191fbd VZ |
142 | struct IAMOpenProgress : public IUnknown |
143 | { | |
144 | STDMETHOD(QueryProgress)(LONGLONG *pllTotal, LONGLONG *pllCurrent) PURE; | |
145 | STDMETHOD(AbortOperation)(void) PURE; | |
146 | }; | |
920a7c15 | 147 | |
c5191fbd | 148 | struct IMediaEvent : public IDispatch |
920a7c15 | 149 | { |
c5191fbd VZ |
150 | STDMETHOD(GetEventHandle)(LONG_PTR *) PURE; |
151 | STDMETHOD(GetEvent)(long *, LONG_PTR *, LONG_PTR *, long) PURE; | |
152 | STDMETHOD(WaitForCompletion)(long, long *) PURE; | |
153 | STDMETHOD(CancelDefaultHandling)(long) PURE; | |
154 | STDMETHOD(RestoreDefaultHandling)(long) PURE; | |
155 | STDMETHOD(FreeEventParams)(long, LONG_PTR, LONG_PTR) PURE; | |
a2a444e3 RN |
156 | }; |
157 | ||
c5191fbd | 158 | //--------------------------------------------------------------------------- |
9d7d3b1f | 159 | // ACTIVEMOVIE COM INTERFACES (dumped from amcompat.idl from MSVC COM Browser) |
c5191fbd VZ |
160 | //--------------------------------------------------------------------------- |
161 | ||
162 | enum ReadyStateConstants | |
a2a444e3 | 163 | { |
7ec69821 WS |
164 | amvUninitialized = 0, |
165 | amvLoading = 1, | |
c5191fbd | 166 | amvInteractive = 3, |
7ec69821 | 167 | amvComplete = 4 |
a2a444e3 RN |
168 | }; |
169 | ||
c5191fbd VZ |
170 | enum StateConstants |
171 | { | |
172 | amvNotLoaded = -1, | |
7ec69821 WS |
173 | amvStopped = 0, |
174 | amvPaused = 1, | |
175 | amvRunning = 2 | |
a2a444e3 RN |
176 | }; |
177 | ||
c5191fbd VZ |
178 | enum DisplayModeConstants |
179 | { | |
7ec69821 | 180 | amvTime = 0, |
c5191fbd | 181 | amvFrames = 1 |
920a7c15 | 182 | }; |
32f65e50 | 183 | |
c5191fbd | 184 | enum WindowSizeConstants |
a2a444e3 | 185 | { |
c5191fbd VZ |
186 | amvOriginalSize = 0, |
187 | amvDoubleOriginalSize = 1, | |
188 | amvOneSixteenthScreen = 2, | |
189 | amvOneFourthScreen = 3, | |
190 | amvOneHalfScreen = 4 | |
a2a444e3 | 191 | }; |
b11eba7e | 192 | |
c5191fbd | 193 | enum AppearanceConstants |
a2a444e3 | 194 | { |
c5191fbd VZ |
195 | amvFlat = 0, |
196 | amv3D = 1 | |
a2a444e3 RN |
197 | }; |
198 | ||
c5191fbd | 199 | enum BorderStyleConstants |
a2a444e3 | 200 | { |
c5191fbd VZ |
201 | amvNone = 0, |
202 | amvFixedSingle = 1 | |
a2a444e3 | 203 | }; |
b11eba7e | 204 | |
c5191fbd | 205 | struct IActiveMovie : public IDispatch |
a2a444e3 | 206 | { |
c5191fbd VZ |
207 | STDMETHOD(AboutBox)( void) PURE; |
208 | STDMETHOD(Run)( void) PURE; | |
209 | STDMETHOD(Pause)( void) PURE; | |
210 | STDMETHOD(Stop)( void) PURE; | |
211 | STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE; | |
212 | STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE; | |
213 | STDMETHOD(get_Author)(BSTR __RPC_FAR *pbstrAuthor) PURE; | |
214 | STDMETHOD(get_Title)(BSTR __RPC_FAR *pbstrTitle) PURE; | |
215 | STDMETHOD(get_Copyright)(BSTR __RPC_FAR *pbstrCopyright) PURE; | |
216 | STDMETHOD(get_Description)(BSTR __RPC_FAR *pbstrDescription) PURE; | |
217 | STDMETHOD(get_Rating)(BSTR __RPC_FAR *pbstrRating) PURE; | |
218 | STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE; | |
219 | STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE; | |
220 | STDMETHOD(get_Duration)(double __RPC_FAR *pValue) PURE; | |
221 | STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pValue) PURE; | |
222 | STDMETHOD(put_CurrentPosition)(double pValue) PURE; | |
223 | STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE; | |
224 | STDMETHOD(put_PlayCount)(long pPlayCount) PURE; | |
225 | STDMETHOD(get_SelectionStart)(double __RPC_FAR *pValue) PURE; | |
226 | STDMETHOD(put_SelectionStart)(double pValue) PURE; | |
227 | STDMETHOD(get_SelectionEnd)(double __RPC_FAR *pValue) PURE; | |
228 | STDMETHOD(put_SelectionEnd)(double pValue) PURE; | |
229 | STDMETHOD(get_CurrentState)(StateConstants __RPC_FAR *pState) PURE; | |
230 | STDMETHOD(get_Rate)(double __RPC_FAR *pValue) PURE; | |
231 | STDMETHOD(put_Rate)(double pValue) PURE; | |
232 | STDMETHOD(get_Volume)(long __RPC_FAR *pValue) PURE; | |
233 | STDMETHOD(put_Volume)(long pValue) PURE; | |
234 | STDMETHOD(get_Balance)(long __RPC_FAR *pValue) PURE; | |
235 | STDMETHOD(put_Balance)(long pValue) PURE; | |
236 | STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnable) PURE; | |
237 | STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnable) PURE; | |
238 | STDMETHOD(get_ShowDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
239 | STDMETHOD(put_ShowDisplay)(VARIANT_BOOL Show) PURE; | |
240 | STDMETHOD(get_ShowControls)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
241 | STDMETHOD(put_ShowControls)(VARIANT_BOOL Show) PURE; | |
242 | STDMETHOD(get_ShowPositionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
243 | STDMETHOD(put_ShowPositionControls)(VARIANT_BOOL Show) PURE; | |
244 | STDMETHOD(get_ShowSelectionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
245 | STDMETHOD(put_ShowSelectionControls)(VARIANT_BOOL Show) PURE; | |
246 | STDMETHOD(get_ShowTracker)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
247 | STDMETHOD(put_ShowTracker)(VARIANT_BOOL Show) PURE; | |
248 | STDMETHOD(get_EnablePositionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE; | |
249 | STDMETHOD(put_EnablePositionControls)(VARIANT_BOOL Enable) PURE; | |
250 | STDMETHOD(get_EnableSelectionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE; | |
251 | STDMETHOD(put_EnableSelectionControls)(VARIANT_BOOL Enable) PURE; | |
252 | STDMETHOD(get_EnableTracker)(VARIANT_BOOL __RPC_FAR *Enable) PURE; | |
253 | STDMETHOD(put_EnableTracker)(VARIANT_BOOL Enable) PURE; | |
254 | STDMETHOD(get_AllowHideDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
255 | STDMETHOD(put_AllowHideDisplay)(VARIANT_BOOL Show) PURE; | |
256 | STDMETHOD(get_AllowHideControls)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
257 | STDMETHOD(put_AllowHideControls)(VARIANT_BOOL Show) PURE; | |
258 | STDMETHOD(get_DisplayMode)(DisplayModeConstants __RPC_FAR *pValue) PURE; | |
259 | STDMETHOD(put_DisplayMode)(DisplayModeConstants pValue) PURE; | |
260 | STDMETHOD(get_AllowChangeDisplayMode)(VARIANT_BOOL __RPC_FAR *fAllow) PURE; | |
261 | STDMETHOD(put_AllowChangeDisplayMode)(VARIANT_BOOL fAllow) PURE; | |
262 | STDMETHOD(get_FilterGraph)(IUnknown __RPC_FAR *__RPC_FAR *ppFilterGraph) PURE; | |
263 | STDMETHOD(put_FilterGraph)(IUnknown __RPC_FAR *ppFilterGraph) PURE; | |
264 | STDMETHOD(get_FilterGraphDispatch)(IDispatch __RPC_FAR *__RPC_FAR *pDispatch) PURE; | |
265 | STDMETHOD(get_DisplayForeColor)(unsigned long __RPC_FAR *ForeColor) PURE; | |
266 | STDMETHOD(put_DisplayForeColor)(unsigned long ForeColor) PURE; | |
267 | STDMETHOD(get_DisplayBackColor)(unsigned long __RPC_FAR *BackColor) PURE; | |
268 | STDMETHOD(put_DisplayBackColor)(unsigned long BackColor) PURE; | |
269 | STDMETHOD(get_MovieWindowSize)(WindowSizeConstants __RPC_FAR *WindowSize) PURE; | |
270 | STDMETHOD(put_MovieWindowSize)(WindowSizeConstants WindowSize) PURE; | |
271 | STDMETHOD(get_FullScreenMode)(VARIANT_BOOL __RPC_FAR *pEnable) PURE; | |
272 | STDMETHOD(put_FullScreenMode)(VARIANT_BOOL pEnable) PURE; | |
273 | STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pEnable) PURE; | |
274 | STDMETHOD(put_AutoStart)(VARIANT_BOOL pEnable) PURE; | |
275 | STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pEnable) PURE; | |
276 | STDMETHOD(put_AutoRewind)(VARIANT_BOOL pEnable) PURE; | |
277 | STDMETHOD(get_hWnd)(long __RPC_FAR *hWnd) PURE; | |
278 | STDMETHOD(get_Appearance)(AppearanceConstants __RPC_FAR *pAppearance) PURE; | |
279 | STDMETHOD(put_Appearance)(AppearanceConstants pAppearance) PURE; | |
280 | STDMETHOD(get_BorderStyle)(BorderStyleConstants __RPC_FAR *pBorderStyle) PURE; | |
281 | STDMETHOD(put_BorderStyle)(BorderStyleConstants pBorderStyle) PURE; | |
282 | STDMETHOD(get_Enabled)(VARIANT_BOOL __RPC_FAR *pEnabled) PURE; | |
283 | STDMETHOD(put_Enabled)(VARIANT_BOOL pEnabled) PURE; | |
284 | STDMETHOD(get_Info)(long __RPC_FAR *ppInfo) PURE; | |
920a7c15 | 285 | }; |
b11eba7e | 286 | |
c5191fbd | 287 | |
c5191fbd VZ |
288 | struct IActiveMovie2 : public IActiveMovie |
289 | { | |
290 | STDMETHOD(IsSoundCardEnabled)(VARIANT_BOOL __RPC_FAR *pbSoundCard) PURE; | |
291 | STDMETHOD(get_ReadyState)(ReadyStateConstants __RPC_FAR *pValue) PURE; | |
a2a444e3 | 292 | }; |
1a680109 | 293 | |
c5191fbd | 294 | struct IActiveMovie3 : public IActiveMovie2 |
a2a444e3 | 295 | { |
c5191fbd | 296 | STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch) PURE; |
a2a444e3 | 297 | }; |
b11eba7e | 298 | |
c5191fbd | 299 | |
920a7c15 | 300 | //--------------------------------------------------------------------------- |
c5191fbd | 301 | // MEDIAPLAYER COM INTERFACES (dumped from msdxm.idl from MSVC COM Browser) |
920a7c15 | 302 | //--------------------------------------------------------------------------- |
c5191fbd VZ |
303 | |
304 | enum MPPlayStateConstants | |
a2a444e3 | 305 | { |
c5191fbd VZ |
306 | mpStopped = 0, |
307 | mpPaused = 1, | |
308 | mpPlaying = 2, | |
309 | mpWaiting = 3, | |
310 | mpScanForward = 4, | |
311 | mpScanReverse = 5, | |
312 | mpClosed = 6 | |
920a7c15 | 313 | }; |
b11eba7e | 314 | |
c5191fbd VZ |
315 | enum MPDisplaySizeConstants |
316 | { | |
317 | mpDefaultSize = 0, | |
318 | mpHalfSize = 1, | |
319 | mpDoubleSize = 2, | |
320 | mpFullScreen = 3, | |
321 | mpFitToSize = 4, | |
322 | mpOneSixteenthScreen = 5, | |
323 | mpOneFourthScreen = 6, | |
324 | mpOneHalfScreen = 7 | |
a2a444e3 | 325 | }; |
b11eba7e | 326 | |
c5191fbd | 327 | enum MPReadyStateConstants |
a2a444e3 | 328 | { |
c5191fbd VZ |
329 | mpReadyStateUninitialized = 0, |
330 | mpReadyStateLoading = 1, | |
331 | mpReadyStateInteractive = 3, | |
332 | mpReadyStateComplete = 4 | |
a2a444e3 RN |
333 | }; |
334 | ||
c5191fbd VZ |
335 | typedef unsigned long VB_OLE_COLOR; |
336 | ||
337 | enum MPDisplayModeConstants | |
a2a444e3 | 338 | { |
c5191fbd VZ |
339 | mpTime = 0, |
340 | mpFrames = 1 | |
920a7c15 | 341 | }; |
b11eba7e | 342 | |
c5191fbd VZ |
343 | enum MPMoreInfoType |
344 | { | |
345 | mpShowURL = 0, | |
346 | mpClipURL = 1, | |
347 | mpBannerURL = 2 | |
a2a444e3 | 348 | }; |
b11eba7e | 349 | |
c5191fbd | 350 | enum MPMediaInfoType |
a2a444e3 | 351 | { |
c5191fbd VZ |
352 | mpShowFilename = 0, |
353 | mpShowTitle = 1, | |
354 | mpShowAuthor = 2, | |
355 | mpShowCopyright = 3, | |
356 | mpShowRating = 4, | |
357 | mpShowDescription = 5, | |
358 | mpShowLogoIcon = 6, | |
359 | mpClipFilename = 7, | |
360 | mpClipTitle = 8, | |
361 | mpClipAuthor = 9, | |
362 | mpClipCopyright = 10, | |
363 | mpClipRating = 11, | |
364 | mpClipDescription = 12, | |
365 | mpClipLogoIcon = 13, | |
366 | mpBannerImage = 14, | |
367 | mpBannerMoreInfo = 15, | |
368 | mpWatermark = 16 | |
369 | }; | |
370 | ||
371 | enum DVDMenuIDConstants | |
372 | { | |
373 | dvdMenu_Title = 2, | |
374 | dvdMenu_Root = 3, | |
375 | dvdMenu_Subpicture = 4, | |
376 | dvdMenu_Audio = 5, | |
377 | dvdMenu_Angle = 6, | |
378 | dvdMenu_Chapter = 7 | |
379 | }; | |
380 | ||
381 | enum MPShowDialogConstants | |
382 | { | |
383 | mpShowDialogHelp = 0, | |
384 | mpShowDialogStatistics = 1, | |
385 | mpShowDialogOptions = 2, | |
386 | mpShowDialogContextMenu = 3 | |
387 | }; | |
388 | ||
389 | ||
390 | struct IMediaPlayer : public IDispatch | |
391 | { | |
392 | STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pCurrentPosition) PURE; | |
393 | STDMETHOD(put_CurrentPosition)(double pCurrentPosition) PURE; | |
394 | STDMETHOD(get_Duration)(double __RPC_FAR *pDuration) PURE; | |
395 | STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE; | |
396 | STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE; | |
397 | STDMETHOD(get_MarkerCount)(long __RPC_FAR *pMarkerCount) PURE; | |
398 | STDMETHOD(get_CanScan)(VARIANT_BOOL __RPC_FAR *pCanScan) PURE; | |
399 | STDMETHOD(get_CanSeek)(VARIANT_BOOL __RPC_FAR *pCanSeek) PURE; | |
400 | STDMETHOD(get_CanSeekToMarkers)(VARIANT_BOOL __RPC_FAR *pCanSeekToMarkers) PURE; | |
401 | STDMETHOD(get_CurrentMarker)(long __RPC_FAR *pCurrentMarker) PURE; | |
402 | STDMETHOD(put_CurrentMarker)(long pCurrentMarker) PURE; | |
403 | STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE; | |
404 | STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE; | |
405 | STDMETHOD(get_SourceLink)(BSTR __RPC_FAR *pbstrSourceLink) PURE; | |
406 | STDMETHOD(get_CreationDate)(DATE __RPC_FAR *pCreationDate) PURE; | |
407 | STDMETHOD(get_ErrorCorrection)(BSTR __RPC_FAR *pbstrErrorCorrection) PURE; | |
408 | STDMETHOD(get_Bandwidth)(long __RPC_FAR *pBandwidth) PURE; | |
409 | STDMETHOD(get_SourceProtocol)(long __RPC_FAR *pSourceProtocol) PURE; | |
410 | STDMETHOD(get_ReceivedPackets)(long __RPC_FAR *pReceivedPackets) PURE; | |
411 | STDMETHOD(get_RecoveredPackets)(long __RPC_FAR *pRecoveredPackets) PURE; | |
412 | STDMETHOD(get_LostPackets)(long __RPC_FAR *pLostPackets) PURE; | |
413 | STDMETHOD(get_ReceptionQuality)(long __RPC_FAR *pReceptionQuality) PURE; | |
414 | STDMETHOD(get_BufferingCount)(long __RPC_FAR *pBufferingCount) PURE; | |
415 | STDMETHOD(get_IsBroadcast)(VARIANT_BOOL __RPC_FAR *pIsBroadcast) PURE; | |
416 | STDMETHOD(get_BufferingProgress)(long __RPC_FAR *pBufferingProgress) PURE; | |
417 | STDMETHOD(get_ChannelName)(BSTR __RPC_FAR *pbstrChannelName) PURE; | |
418 | STDMETHOD(get_ChannelDescription)(BSTR __RPC_FAR *pbstrChannelDescription) PURE; | |
419 | STDMETHOD(get_ChannelURL)(BSTR __RPC_FAR *pbstrChannelURL) PURE; | |
420 | STDMETHOD(get_ContactAddress)(BSTR __RPC_FAR *pbstrContactAddress) PURE; | |
421 | STDMETHOD(get_ContactPhone)(BSTR __RPC_FAR *pbstrContactPhone) PURE; | |
422 | STDMETHOD(get_ContactEmail)(BSTR __RPC_FAR *pbstrContactEmail) PURE; | |
423 | STDMETHOD(get_BufferingTime)(double __RPC_FAR *pBufferingTime) PURE; | |
424 | STDMETHOD(put_BufferingTime)(double pBufferingTime) PURE; | |
425 | STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pAutoStart) PURE; | |
426 | STDMETHOD(put_AutoStart)(VARIANT_BOOL pAutoStart) PURE; | |
427 | STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pAutoRewind) PURE; | |
428 | STDMETHOD(put_AutoRewind)(VARIANT_BOOL pAutoRewind) PURE; | |
429 | STDMETHOD(get_Rate)(double __RPC_FAR *pRate) PURE; | |
430 | STDMETHOD(put_Rate)(double pRate) PURE; | |
431 | STDMETHOD(get_SendKeyboardEvents)(VARIANT_BOOL __RPC_FAR *pSendKeyboardEvents) PURE; | |
432 | STDMETHOD(put_SendKeyboardEvents)(VARIANT_BOOL pSendKeyboardEvents) PURE; | |
433 | STDMETHOD(get_SendMouseClickEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseClickEvents) PURE; | |
434 | STDMETHOD(put_SendMouseClickEvents)(VARIANT_BOOL pSendMouseClickEvents) PURE; | |
435 | STDMETHOD(get_SendMouseMoveEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseMoveEvents) PURE; | |
436 | STDMETHOD(put_SendMouseMoveEvents)(VARIANT_BOOL pSendMouseMoveEvents) PURE; | |
437 | STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE; | |
438 | STDMETHOD(put_PlayCount)(long pPlayCount) PURE; | |
439 | STDMETHOD(get_ClickToPlay)(VARIANT_BOOL __RPC_FAR *pClickToPlay) PURE; | |
440 | STDMETHOD(put_ClickToPlay)(VARIANT_BOOL pClickToPlay) PURE; | |
441 | STDMETHOD(get_AllowScan)(VARIANT_BOOL __RPC_FAR *pAllowScan) PURE; | |
442 | STDMETHOD(put_AllowScan)(VARIANT_BOOL pAllowScan) PURE; | |
443 | STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnableContextMenu) PURE; | |
444 | STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnableContextMenu) PURE; | |
445 | STDMETHOD(get_CursorType)(long __RPC_FAR *pCursorType) PURE; | |
446 | STDMETHOD(put_CursorType)(long pCursorType) PURE; | |
447 | STDMETHOD(get_CodecCount)(long __RPC_FAR *pCodecCount) PURE; | |
448 | STDMETHOD(get_AllowChangeDisplaySize)(VARIANT_BOOL __RPC_FAR *pAllowChangeDisplaySize) PURE; | |
449 | STDMETHOD(put_AllowChangeDisplaySize)( VARIANT_BOOL pAllowChangeDisplaySize) PURE; | |
450 | STDMETHOD(get_IsDurationValid)(VARIANT_BOOL __RPC_FAR *pIsDurationValid) PURE; | |
451 | STDMETHOD(get_OpenState)(long __RPC_FAR *pOpenState) PURE; | |
452 | STDMETHOD(get_SendOpenStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendOpenStateChangeEvents) PURE; | |
453 | STDMETHOD(put_SendOpenStateChangeEvents)(VARIANT_BOOL pSendOpenStateChangeEvents) PURE; | |
454 | STDMETHOD(get_SendWarningEvents)( VARIANT_BOOL __RPC_FAR *pSendWarningEvents) PURE; | |
455 | STDMETHOD(put_SendWarningEvents)(VARIANT_BOOL pSendWarningEvents) PURE; | |
456 | STDMETHOD(get_SendErrorEvents)(VARIANT_BOOL __RPC_FAR *pSendErrorEvents) PURE; | |
457 | STDMETHOD(put_SendErrorEvents)(VARIANT_BOOL pSendErrorEvents) PURE; | |
458 | STDMETHOD(get_PlayState)(MPPlayStateConstants __RPC_FAR *pPlayState) PURE; | |
459 | STDMETHOD(get_SendPlayStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendPlayStateChangeEvents) PURE; | |
460 | STDMETHOD(put_SendPlayStateChangeEvents)(VARIANT_BOOL pSendPlayStateChangeEvents) PURE; | |
461 | STDMETHOD(get_DisplaySize)(MPDisplaySizeConstants __RPC_FAR *pDisplaySize) PURE; | |
462 | STDMETHOD(put_DisplaySize)(MPDisplaySizeConstants pDisplaySize) PURE; | |
463 | STDMETHOD(get_InvokeURLs)(VARIANT_BOOL __RPC_FAR *pInvokeURLs) PURE; | |
464 | STDMETHOD(put_InvokeURLs)(VARIANT_BOOL pInvokeURLs) PURE; | |
465 | STDMETHOD(get_BaseURL)(BSTR __RPC_FAR *pbstrBaseURL) PURE; | |
466 | STDMETHOD(put_BaseURL)(BSTR pbstrBaseURL) PURE; | |
467 | STDMETHOD(get_DefaultFrame)(BSTR __RPC_FAR *pbstrDefaultFrame) PURE; | |
468 | STDMETHOD(put_DefaultFrame)(BSTR pbstrDefaultFrame) PURE; | |
469 | STDMETHOD(get_HasError)(VARIANT_BOOL __RPC_FAR *pHasError) PURE; | |
470 | STDMETHOD(get_ErrorDescription)(BSTR __RPC_FAR *pbstrErrorDescription) PURE; | |
471 | STDMETHOD(get_ErrorCode)(long __RPC_FAR *pErrorCode) PURE; | |
472 | STDMETHOD(get_AnimationAtStart)(VARIANT_BOOL __RPC_FAR *pAnimationAtStart) PURE; | |
473 | STDMETHOD(put_AnimationAtStart)(VARIANT_BOOL pAnimationAtStart) PURE; | |
474 | STDMETHOD(get_TransparentAtStart)( VARIANT_BOOL __RPC_FAR *pTransparentAtStart) PURE; | |
475 | STDMETHOD(put_TransparentAtStart)(VARIANT_BOOL pTransparentAtStart) PURE; | |
476 | STDMETHOD(get_Volume)(long __RPC_FAR *pVolume) PURE; | |
477 | STDMETHOD(put_Volume)(long pVolume) PURE; | |
478 | STDMETHOD(get_Balance)(long __RPC_FAR *pBalance) PURE; | |
479 | STDMETHOD(put_Balance)(long pBalance) PURE; | |
480 | STDMETHOD(get_ReadyState)(MPReadyStateConstants __RPC_FAR *pValue) PURE; | |
481 | STDMETHOD(get_SelectionStart)(double __RPC_FAR *pValue) PURE; | |
482 | STDMETHOD(put_SelectionStart)(double pValue) PURE; | |
483 | STDMETHOD(get_SelectionEnd)(double __RPC_FAR *pValue) PURE; | |
484 | STDMETHOD(put_SelectionEnd)(double pValue) PURE; | |
485 | STDMETHOD(get_ShowDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
486 | STDMETHOD(put_ShowDisplay)(VARIANT_BOOL Show) PURE; | |
487 | STDMETHOD(get_ShowControls)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
488 | STDMETHOD(put_ShowControls)(VARIANT_BOOL Show) PURE; | |
489 | STDMETHOD(get_ShowPositionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
490 | STDMETHOD(put_ShowPositionControls)(VARIANT_BOOL Show) PURE; | |
491 | STDMETHOD(get_ShowTracker)(VARIANT_BOOL __RPC_FAR *Show) PURE; | |
492 | STDMETHOD(put_ShowTracker)(VARIANT_BOOL Show) PURE; | |
493 | STDMETHOD(get_EnablePositionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE; | |
494 | STDMETHOD(put_EnablePositionControls)(VARIANT_BOOL Enable) PURE; | |
495 | STDMETHOD(get_EnableTracker)(VARIANT_BOOL __RPC_FAR *Enable) PURE; | |
496 | STDMETHOD(put_EnableTracker)(VARIANT_BOOL Enable) PURE; | |
497 | STDMETHOD(get_Enabled)(VARIANT_BOOL __RPC_FAR *pEnabled) PURE; | |
498 | STDMETHOD(put_Enabled)(VARIANT_BOOL pEnabled) PURE; | |
499 | STDMETHOD(get_DisplayForeColor)(VB_OLE_COLOR __RPC_FAR *ForeColor) PURE; | |
500 | STDMETHOD(put_DisplayForeColor)(VB_OLE_COLOR ForeColor) PURE; | |
501 | STDMETHOD(get_DisplayBackColor)(VB_OLE_COLOR __RPC_FAR *BackColor) PURE; | |
502 | STDMETHOD(put_DisplayBackColor)(VB_OLE_COLOR BackColor) PURE; | |
503 | STDMETHOD(get_DisplayMode)(MPDisplayModeConstants __RPC_FAR *pValue) PURE; | |
504 | STDMETHOD(put_DisplayMode)(MPDisplayModeConstants pValue) PURE; | |
505 | STDMETHOD(get_VideoBorder3D)(VARIANT_BOOL __RPC_FAR *pVideoBorderWidth) PURE; | |
506 | STDMETHOD(put_VideoBorder3D)(VARIANT_BOOL pVideoBorderWidth) PURE; | |
507 | STDMETHOD(get_VideoBorderWidth)(long __RPC_FAR *pVideoBorderWidth) PURE; | |
508 | STDMETHOD(put_VideoBorderWidth)(long pVideoBorderWidth) PURE; | |
509 | STDMETHOD(get_VideoBorderColor)(VB_OLE_COLOR __RPC_FAR *pVideoBorderWidth) PURE; | |
510 | STDMETHOD(put_VideoBorderColor)(VB_OLE_COLOR pVideoBorderWidth) PURE; | |
511 | STDMETHOD(get_ShowGotoBar)(VARIANT_BOOL __RPC_FAR *pbool) PURE; | |
512 | STDMETHOD(put_ShowGotoBar)(VARIANT_BOOL pbool) PURE; | |
513 | STDMETHOD(get_ShowStatusBar)(VARIANT_BOOL __RPC_FAR *pbool) PURE; | |
514 | STDMETHOD(put_ShowStatusBar)(VARIANT_BOOL pbool) PURE; | |
515 | STDMETHOD(get_ShowCaptioning)(VARIANT_BOOL __RPC_FAR *pbool) PURE; | |
516 | STDMETHOD(put_ShowCaptioning)(VARIANT_BOOL pbool) PURE; | |
517 | STDMETHOD(get_ShowAudioControls)(VARIANT_BOOL __RPC_FAR *pbool) PURE; | |
518 | STDMETHOD(put_ShowAudioControls)(VARIANT_BOOL pbool) PURE; | |
519 | STDMETHOD(get_CaptioningID)( BSTR __RPC_FAR *pstrText) PURE; | |
520 | STDMETHOD(put_CaptioningID)(BSTR pstrText) PURE; | |
521 | STDMETHOD(get_Mute)(VARIANT_BOOL __RPC_FAR *vbool) PURE; | |
522 | STDMETHOD(put_Mute)(VARIANT_BOOL vbool) PURE; | |
523 | STDMETHOD(get_CanPreview)(VARIANT_BOOL __RPC_FAR *pCanPreview) PURE; | |
524 | STDMETHOD(get_PreviewMode)(VARIANT_BOOL __RPC_FAR *pPreviewMode) PURE; | |
525 | STDMETHOD(put_PreviewMode)(VARIANT_BOOL pPreviewMode) PURE; | |
526 | STDMETHOD(get_HasMultipleItems)(VARIANT_BOOL __RPC_FAR *pHasMuliItems) PURE; | |
527 | STDMETHOD(get_Language)(long __RPC_FAR *pLanguage) PURE; | |
528 | STDMETHOD(put_Language)(long pLanguage) PURE; | |
529 | STDMETHOD(get_AudioStream)(long __RPC_FAR *pStream) PURE; | |
530 | STDMETHOD(put_AudioStream)(long pStream) PURE; | |
531 | STDMETHOD(get_SAMIStyle)(BSTR __RPC_FAR *pbstrStyle) PURE; | |
532 | STDMETHOD(put_SAMIStyle)(BSTR pbstrStyle) PURE; | |
533 | STDMETHOD(get_SAMILang)(BSTR __RPC_FAR *pbstrLang) PURE; | |
534 | STDMETHOD(put_SAMILang)(BSTR pbstrLang) PURE; | |
535 | STDMETHOD(get_SAMIFileName)(BSTR __RPC_FAR *pbstrFileName) PURE; | |
536 | STDMETHOD(put_SAMIFileName)(BSTR pbstrFileName) PURE; | |
537 | STDMETHOD(get_StreamCount)( long __RPC_FAR *pStreamCount) PURE; | |
538 | STDMETHOD(get_ClientId)(BSTR __RPC_FAR *pbstrClientId) PURE; | |
539 | STDMETHOD(get_ConnectionSpeed)(long __RPC_FAR *plConnectionSpeed) PURE; | |
540 | STDMETHOD(get_AutoSize)(VARIANT_BOOL __RPC_FAR *pbool) PURE; | |
541 | STDMETHOD(put_AutoSize)(VARIANT_BOOL pbool) PURE; | |
542 | STDMETHOD(get_EnableFullScreenControls)(VARIANT_BOOL __RPC_FAR *pbVal) PURE; | |
543 | STDMETHOD(put_EnableFullScreenControls)(VARIANT_BOOL pbVal) PURE; | |
544 | STDMETHOD(get_ActiveMovie)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE; | |
545 | STDMETHOD(get_NSPlay)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE; | |
546 | STDMETHOD(get_WindowlessVideo)(VARIANT_BOOL __RPC_FAR *pbool) PURE; | |
547 | STDMETHOD(put_WindowlessVideo)(VARIANT_BOOL pbool) PURE; | |
548 | STDMETHOD(Play)(void) PURE; | |
549 | STDMETHOD(Stop)(void) PURE; | |
550 | STDMETHOD(Pause)(void) PURE; | |
551 | STDMETHOD(GetMarkerTime)(long MarkerNum, | |
552 | double __RPC_FAR *pMarkerTime) PURE; | |
553 | STDMETHOD(GetMarkerName)(long MarkerNum, | |
554 | BSTR __RPC_FAR *pbstrMarkerName) PURE; | |
555 | STDMETHOD(AboutBox)(void) PURE; | |
556 | STDMETHOD(GetCodecInstalled)(long CodecNum, | |
557 | VARIANT_BOOL __RPC_FAR *pCodecInstalled) PURE; | |
558 | STDMETHOD(GetCodecDescription)(long CodecNum, | |
559 | BSTR __RPC_FAR *pbstrCodecDescription) PURE; | |
560 | STDMETHOD(GetCodecURL)(long CodecNum, | |
561 | BSTR __RPC_FAR *pbstrCodecURL) PURE; | |
562 | STDMETHOD(GetMoreInfoURL)(MPMoreInfoType MoreInfoType, | |
563 | BSTR __RPC_FAR *pbstrMoreInfoURL) PURE; | |
564 | STDMETHOD(GetMediaInfoString)(MPMediaInfoType MediaInfoType, | |
565 | BSTR __RPC_FAR *pbstrMediaInfo) PURE; | |
566 | STDMETHOD(Cancel)(void) PURE; | |
567 | STDMETHOD(Open)(BSTR bstrFileName) PURE; | |
568 | STDMETHOD(IsSoundCardEnabled)(VARIANT_BOOL __RPC_FAR *pbSoundCard) PURE; | |
569 | STDMETHOD(Next)(void) PURE; | |
570 | STDMETHOD(Previous)(void) PURE; | |
571 | STDMETHOD(StreamSelect)(long StreamNum) PURE; | |
572 | STDMETHOD(FastForward)(void) PURE; | |
573 | STDMETHOD(FastReverse)(void) PURE; | |
574 | STDMETHOD(GetStreamName)(long StreamNum, | |
575 | BSTR __RPC_FAR *pbstrStreamName) PURE; | |
576 | STDMETHOD(GetStreamGroup)(long StreamNum, | |
577 | long __RPC_FAR *pStreamGroup) PURE; | |
578 | STDMETHOD(GetStreamSelected)(long StreamNum, VARIANT_BOOL __RPC_FAR *pStreamSelected) PURE; | |
579 | }; | |
580 | ||
581 | struct IMediaPlayer2 : public IMediaPlayer | |
582 | { | |
583 | STDMETHOD(get_DVD)(struct IMediaPlayerDvd __RPC_FAR *__RPC_FAR *ppdispatch) PURE; | |
584 | STDMETHOD(GetMediaParameter)(long EntryNum, BSTR bstrParameterName, BSTR __RPC_FAR *pbstrParameterValue) PURE; | |
585 | STDMETHOD(GetMediaParameterName(long EntryNum, long Index, BSTR __RPC_FAR *pbstrParameterName) PURE; | |
586 | STDMETHOD(get_EntryCount)(long __RPC_FAR *pNumberEntries) PURE; | |
587 | STDMETHOD(GetCurrentEntry)(long __RPC_FAR *pEntryNumber) PURE; | |
588 | STDMETHOD(SetCurrentEntry)(long EntryNumber) PURE; | |
589 | STDMETHOD(ShowDialog)(MPShowDialogConstants mpDialogIndex) PURE; | |
a2a444e3 | 590 | }; |
b11eba7e | 591 | |
920a7c15 | 592 | //--------------------------------------------------------------------------- |
c5191fbd | 593 | // NETSHOW COM INTERFACES (dumped from nscompat.idl from MSVC COM Browser) |
920a7c15 | 594 | //--------------------------------------------------------------------------- |
c5191fbd VZ |
595 | |
596 | struct INSOPlay : public IDispatch | |
597 | { | |
598 | STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE; | |
599 | STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE; | |
600 | STDMETHOD(get_Duration)(double __RPC_FAR *pDuration) PURE; | |
601 | STDMETHOD(get_Author)(BSTR __RPC_FAR *pbstrAuthor) PURE; | |
602 | STDMETHOD(get_Copyright)(BSTR __RPC_FAR *pbstrCopyright) PURE; | |
603 | STDMETHOD(get_Description)(BSTR __RPC_FAR *pbstrDescription) PURE; | |
604 | STDMETHOD(get_Rating)(BSTR __RPC_FAR *pbstrRating) PURE; | |
605 | STDMETHOD(get_Title)(BSTR __RPC_FAR *pbstrTitle) PURE; | |
606 | STDMETHOD(get_SourceLink)(BSTR __RPC_FAR *pbstrSourceLink) PURE; | |
607 | STDMETHOD(get_MarkerCount)(long __RPC_FAR *pMarkerCount) PURE; | |
608 | STDMETHOD(get_CanScan)(VARIANT_BOOL __RPC_FAR *pCanScan) PURE; | |
609 | STDMETHOD(get_CanSeek)(VARIANT_BOOL __RPC_FAR *pCanSeek) PURE; | |
610 | STDMETHOD(get_CanSeekToMarkers)(VARIANT_BOOL __RPC_FAR *pCanSeekToMarkers) PURE; | |
611 | STDMETHOD(get_CreationDate)(DATE __RPC_FAR *pCreationDate) PURE; | |
612 | STDMETHOD(get_Bandwidth)(long __RPC_FAR *pBandwidth) PURE; | |
613 | STDMETHOD(get_ErrorCorrection)(BSTR __RPC_FAR *pbstrErrorCorrection) PURE; | |
614 | STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pAutoStart) PURE; | |
615 | STDMETHOD(put_AutoStart)(VARIANT_BOOL pAutoStart) PURE; | |
616 | STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pAutoRewind) PURE; | |
617 | STDMETHOD(put_AutoRewind)(VARIANT_BOOL pAutoRewind) PURE; | |
618 | STDMETHOD(get_AllowChangeControlType)(VARIANT_BOOL __RPC_FAR *pAllowChangeControlType) PURE; | |
619 | STDMETHOD(put_AllowChangeControlType)(VARIANT_BOOL pAllowChangeControlType) PURE; | |
620 | STDMETHOD(get_InvokeURLs)(VARIANT_BOOL __RPC_FAR *pInvokeURLs) PURE; | |
621 | STDMETHOD(put_InvokeURLs)(VARIANT_BOOL pInvokeURLs) PURE; | |
622 | STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnableContextMenu) PURE; | |
623 | STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnableContextMenu) PURE; | |
624 | STDMETHOD(get_TransparentAtStart)(VARIANT_BOOL __RPC_FAR *pTransparentAtStart) PURE; | |
625 | STDMETHOD(put_TransparentAtStart)(VARIANT_BOOL pTransparentAtStart) PURE; | |
626 | STDMETHOD(get_TransparentOnStop)(VARIANT_BOOL __RPC_FAR *pTransparentOnStop) PURE; | |
627 | STDMETHOD(put_TransparentOnStop)(VARIANT_BOOL pTransparentOnStop) PURE; | |
628 | STDMETHOD(get_ClickToPlay)(VARIANT_BOOL __RPC_FAR *pClickToPlay) PURE; | |
629 | STDMETHOD(put_ClickToPlay)(VARIANT_BOOL pClickToPlay) PURE; | |
630 | STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE; | |
631 | STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE; | |
632 | STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pCurrentPosition) PURE; | |
633 | STDMETHOD(put_CurrentPosition)(double pCurrentPosition) PURE; | |
634 | STDMETHOD(get_Rate)(double __RPC_FAR *pRate) PURE; | |
635 | STDMETHOD(put_Rate)(double pRate) PURE; | |
636 | STDMETHOD(get_CurrentMarker)(long __RPC_FAR *pCurrentMarker) PURE; | |
637 | STDMETHOD(put_CurrentMarker)(long pCurrentMarker) PURE; | |
638 | STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE; | |
639 | STDMETHOD(put_PlayCount)(long pPlayCount) PURE; | |
640 | STDMETHOD(get_CurrentState)(long __RPC_FAR *pCurrentState) PURE; | |
641 | STDMETHOD(get_DisplaySize)(long __RPC_FAR *pDisplaySize) PURE; | |
642 | STDMETHOD(put_DisplaySize)(long pDisplaySize) PURE; | |
643 | STDMETHOD(get_MainWindow)(long __RPC_FAR *pMainWindow) PURE; | |
644 | STDMETHOD(get_ControlType)(long __RPC_FAR *pControlType) PURE; | |
645 | STDMETHOD(put_ControlType)(long pControlType) PURE; | |
646 | STDMETHOD(get_AllowScan)(VARIANT_BOOL __RPC_FAR *pAllowScan) PURE; | |
647 | STDMETHOD(put_AllowScan)(VARIANT_BOOL pAllowScan) PURE; | |
648 | STDMETHOD(get_SendKeyboardEvents)(VARIANT_BOOL __RPC_FAR *pSendKeyboardEvents) PURE; | |
649 | STDMETHOD(put_SendKeyboardEvents)(VARIANT_BOOL pSendKeyboardEvents) PURE; | |
650 | STDMETHOD(get_SendMouseClickEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseClickEvents) PURE; | |
651 | STDMETHOD(put_SendMouseClickEvents)(VARIANT_BOOL pSendMouseClickEvents) PURE; | |
652 | STDMETHOD(get_SendMouseMoveEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseMoveEvents) PURE; | |
653 | STDMETHOD(put_SendMouseMoveEvents)(VARIANT_BOOL pSendMouseMoveEvents) PURE; | |
654 | STDMETHOD(get_SendStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendStateChangeEvents) PURE; | |
655 | STDMETHOD(put_SendStateChangeEvents)(VARIANT_BOOL pSendStateChangeEvents) PURE; | |
656 | STDMETHOD(get_ReceivedPackets)(long __RPC_FAR *pReceivedPackets) PURE; | |
657 | STDMETHOD(get_RecoveredPackets)(long __RPC_FAR *pRecoveredPackets) PURE; | |
658 | STDMETHOD(get_LostPackets)(long __RPC_FAR *pLostPackets) PURE; | |
659 | STDMETHOD(get_ReceptionQuality)(long __RPC_FAR *pReceptionQuality) PURE; | |
660 | STDMETHOD(get_BufferingCount)(long __RPC_FAR *pBufferingCount) PURE; | |
661 | STDMETHOD(get_CursorType)(long __RPC_FAR *pCursorType) PURE; | |
662 | STDMETHOD(put_CursorType)(long pCursorType) PURE; | |
663 | STDMETHOD(get_AnimationAtStart)(VARIANT_BOOL __RPC_FAR *pAnimationAtStart) PURE; | |
664 | STDMETHOD(put_AnimationAtStart)(VARIANT_BOOL pAnimationAtStart) PURE; | |
665 | STDMETHOD(get_AnimationOnStop)(VARIANT_BOOL __RPC_FAR *pAnimationOnStop) PURE; | |
666 | STDMETHOD(put_AnimationOnStop)(VARIANT_BOOL pAnimationOnStop) PURE; | |
667 | STDMETHOD(Play)(void) PURE; | |
668 | STDMETHOD(Pause)(void) PURE; | |
669 | STDMETHOD(Stop)(void) PURE; | |
670 | STDMETHOD(GetMarkerTime)(long MarkerNum, double __RPC_FAR *pMarkerTime) PURE; | |
671 | STDMETHOD(GetMarkerName)(long MarkerNum, BSTR __RPC_FAR *pbstrMarkerName) PURE; | |
920a7c15 | 672 | }; |
b11eba7e | 673 | |
c5191fbd VZ |
674 | struct INSPlay : public INSOPlay |
675 | { | |
676 | STDMETHOD(get_ChannelName)(BSTR __RPC_FAR *pbstrChannelName) PURE; | |
677 | STDMETHOD(get_ChannelDescription)(BSTR __RPC_FAR *pbstrChannelDescription) PURE; | |
678 | STDMETHOD(get_ChannelURL)(BSTR __RPC_FAR *pbstrChannelURL) PURE; | |
679 | STDMETHOD(get_ContactAddress)(BSTR __RPC_FAR *pbstrContactAddress) PURE; | |
680 | STDMETHOD(get_ContactPhone)(BSTR __RPC_FAR *pbstrContactPhone) PURE; | |
681 | STDMETHOD(get_ContactEmail)(BSTR __RPC_FAR *pbstrContactEmail) PURE; | |
682 | STDMETHOD(get_AllowChangeDisplaySize)(VARIANT_BOOL __RPC_FAR *pAllowChangeDisplaySize) PURE; | |
683 | STDMETHOD(put_AllowChangeDisplaySize)(VARIANT_BOOL pAllowChangeDisplaySize) PURE; | |
684 | STDMETHOD(get_CodecCount)(long __RPC_FAR *pCodecCount) PURE; | |
685 | STDMETHOD(get_IsBroadcast)(VARIANT_BOOL __RPC_FAR *pIsBroadcast) PURE; | |
686 | STDMETHOD(get_IsDurationValid)(VARIANT_BOOL __RPC_FAR *pIsDurationValid) PURE; | |
687 | STDMETHOD(get_SourceProtocol)(long __RPC_FAR *pSourceProtocol) PURE; | |
688 | STDMETHOD(get_OpenState)(long __RPC_FAR *pOpenState) PURE; | |
689 | STDMETHOD(get_SendOpenStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendOpenStateChangeEvents) PURE; | |
690 | STDMETHOD(put_SendOpenStateChangeEvents)(VARIANT_BOOL pSendOpenStateChangeEvents) PURE; | |
691 | STDMETHOD(get_SendWarningEvents)(VARIANT_BOOL __RPC_FAR *pSendWarningEvents) PURE; | |
692 | STDMETHOD(put_SendWarningEvents)(VARIANT_BOOL pSendWarningEvents) PURE; | |
693 | STDMETHOD(get_SendErrorEvents)(VARIANT_BOOL __RPC_FAR *pSendErrorEvents) PURE; | |
694 | STDMETHOD(put_SendErrorEvents)(VARIANT_BOOL pSendErrorEvents) PURE; | |
695 | STDMETHOD(get_HasError)(VARIANT_BOOL __RPC_FAR *pHasError) PURE; | |
696 | STDMETHOD(get_ErrorDescription)(BSTR __RPC_FAR *pbstrErrorDescription) PURE; | |
697 | STDMETHOD(get_ErrorCode)(long __RPC_FAR *pErrorCode) PURE; | |
698 | STDMETHOD(get_PlayState)(long __RPC_FAR *pPlayState) PURE; | |
699 | STDMETHOD(get_SendPlayStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendPlayStateChangeEvents) PURE; | |
700 | STDMETHOD(put_SendPlayStateChangeEvents)(VARIANT_BOOL pSendPlayStateChangeEvents) PURE; | |
701 | STDMETHOD(get_BufferingTime)(double __RPC_FAR *pBufferingTime) PURE; | |
702 | STDMETHOD(put_BufferingTime)(double pBufferingTime) PURE; | |
703 | STDMETHOD(get_UseFixedUDPPort)(VARIANT_BOOL __RPC_FAR *pUseFixedUDPPort) PURE; | |
704 | STDMETHOD(put_UseFixedUDPPort)(VARIANT_BOOL pUseFixedUDPPort) PURE; | |
705 | STDMETHOD(get_FixedUDPPort)(long __RPC_FAR *pFixedUDPPort) PURE; | |
706 | STDMETHOD(put_FixedUDPPort)(long pFixedUDPPort) PURE; | |
707 | STDMETHOD(get_UseHTTPProxy)(VARIANT_BOOL __RPC_FAR *pUseHTTPProxy) PURE; | |
708 | STDMETHOD(put_UseHTTPProxy)(VARIANT_BOOL pUseHTTPProxy) PURE; | |
709 | STDMETHOD(get_EnableAutoProxy)(VARIANT_BOOL __RPC_FAR *pEnableAutoProxy) PURE; | |
710 | STDMETHOD(put_EnableAutoProxy)(VARIANT_BOOL pEnableAutoProxy) PURE; | |
711 | STDMETHOD(get_HTTPProxyHost)(BSTR __RPC_FAR *pbstrHTTPProxyHost) PURE; | |
712 | STDMETHOD(put_HTTPProxyHost)(BSTR pbstrHTTPProxyHost) PURE; | |
713 | STDMETHOD(get_HTTPProxyPort)(long __RPC_FAR *pHTTPProxyPort) PURE; | |
714 | STDMETHOD(put_HTTPProxyPort)(long pHTTPProxyPort) PURE; | |
715 | STDMETHOD(get_EnableMulticast)(VARIANT_BOOL __RPC_FAR *pEnableMulticast) PURE; | |
716 | STDMETHOD(put_EnableMulticast)(VARIANT_BOOL pEnableMulticast) PURE; | |
717 | STDMETHOD(get_EnableUDP)(VARIANT_BOOL __RPC_FAR *pEnableUDP) PURE; | |
718 | STDMETHOD(put_EnableUDP)(VARIANT_BOOL pEnableUDP) PURE; | |
719 | STDMETHOD(get_EnableTCP)(VARIANT_BOOL __RPC_FAR *pEnableTCP) PURE; | |
720 | STDMETHOD(put_EnableTCP)(VARIANT_BOOL pEnableTCP) PURE; | |
721 | STDMETHOD(get_EnableHTTP)(VARIANT_BOOL __RPC_FAR *pEnableHTTP) PURE; | |
722 | STDMETHOD(put_EnableHTTP)(VARIANT_BOOL pEnableHTTP) PURE; | |
723 | STDMETHOD(get_BufferingProgress)(long __RPC_FAR *pBufferingProgress) PURE; | |
724 | STDMETHOD(get_BaseURL)(BSTR __RPC_FAR *pbstrBaseURL) PURE; | |
725 | STDMETHOD(put_BaseURL)(BSTR pbstrBaseURL) PURE; | |
726 | STDMETHOD(get_DefaultFrame)(BSTR __RPC_FAR *pbstrDefaultFrame) PURE; | |
727 | STDMETHOD(put_DefaultFrame)(BSTR pbstrDefaultFrame) PURE; | |
728 | STDMETHOD(AboutBox))(void) PURE; | |
729 | STDMETHOD(Cancel)(void) PURE; | |
730 | STDMETHOD(GetCodecInstalled)(long CodecNum, VARIANT_BOOL __RPC_FAR *pCodecInstalled) PURE; | |
731 | STDMETHOD(GetCodecDescription)(long CodecNum, BSTR __RPC_FAR *pbstrCodecDescription) PURE; | |
732 | STDMETHOD(GetCodecURL)(long CodecNum, BSTR __RPC_FAR *pbstrCodecURL) PURE; | |
733 | STDMETHOD(Open)(BSTR bstrFileName) PURE; | |
734 | }; | |
b11eba7e | 735 | |
c5191fbd VZ |
736 | |
737 | struct INSPlay1 : public INSPlay | |
920a7c15 | 738 | { |
c5191fbd | 739 | STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE; |
920a7c15 | 740 | }; |
32f65e50 | 741 | |
c137ddc9 JS |
742 | //--------------------------------------------------------------------------- |
743 | // IWMP (PocketPC 2000) COM INTERFACES (dumped from PlayerOCX.idl) | |
744 | //--------------------------------------------------------------------------- | |
745 | ||
746 | struct IWMP : public IDispatch | |
747 | { | |
748 | public: | |
9d7d3b1f | 749 | virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoSize( |
c137ddc9 | 750 | /* [in] */ VARIANT_BOOL vbool) = 0; |
9d7d3b1f DS |
751 | |
752 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoSize( | |
c137ddc9 | 753 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0; |
9d7d3b1f DS |
754 | |
755 | virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_BorderStyle( | |
c137ddc9 | 756 | /* [in] */ long style) = 0; |
9d7d3b1f DS |
757 | |
758 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_BorderStyle( | |
c137ddc9 | 759 | /* [retval][out] */ long __RPC_FAR *pstyle) = 0; |
9d7d3b1f DS |
760 | |
761 | virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Enabled( | |
c137ddc9 | 762 | /* [in] */ VARIANT_BOOL vbool) = 0; |
9d7d3b1f DS |
763 | |
764 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Enabled( | |
c137ddc9 | 765 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0; |
9d7d3b1f DS |
766 | |
767 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_FileName( | |
c137ddc9 | 768 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
769 | |
770 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_FileName( | |
c137ddc9 | 771 | /* [in] */ BSTR newVal) = 0; |
9d7d3b1f DS |
772 | |
773 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Volume( | |
c137ddc9 | 774 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
775 | |
776 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Volume( | |
c137ddc9 | 777 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
778 | |
779 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Mute( | |
c137ddc9 | 780 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
781 | |
782 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Mute( | |
c137ddc9 | 783 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
784 | |
785 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoStart( | |
c137ddc9 | 786 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
787 | |
788 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoStart( | |
c137ddc9 | 789 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
790 | |
791 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayCount( | |
c137ddc9 | 792 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
793 | |
794 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PlayCount( | |
c137ddc9 | 795 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
796 | |
797 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowStatusBar( | |
c137ddc9 | 798 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
799 | |
800 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowStatusBar( | |
c137ddc9 | 801 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
802 | |
803 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowAudioControls( | |
c137ddc9 | 804 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
805 | |
806 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowAudioControls( | |
c137ddc9 | 807 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
808 | |
809 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowCaptioning( | |
c137ddc9 | 810 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
811 | |
812 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowCaptioning( | |
c137ddc9 | 813 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
814 | |
815 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowControls( | |
c137ddc9 | 816 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
817 | |
818 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowControls( | |
c137ddc9 | 819 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
820 | |
821 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowDisplay( | |
c137ddc9 | 822 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
823 | |
824 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowDisplay( | |
c137ddc9 | 825 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
826 | |
827 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowGotoBar( | |
c137ddc9 | 828 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
829 | |
830 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowGotoBar( | |
c137ddc9 | 831 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
832 | |
833 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowPositionControls( | |
c137ddc9 | 834 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
835 | |
836 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowPositionControls( | |
c137ddc9 | 837 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
838 | |
839 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowTracker( | |
c137ddc9 | 840 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
841 | |
842 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowTracker( | |
c137ddc9 | 843 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
844 | |
845 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Startup( void ) = 0; | |
846 | ||
847 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Shutdown( void ) = 0; | |
848 | ||
849 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bandwidth( | |
c137ddc9 | 850 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
851 | |
852 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BaseURL( | |
c137ddc9 | 853 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
854 | |
855 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_BaseURL( | |
c137ddc9 | 856 | /* [in] */ BSTR pVal) = 0; |
9d7d3b1f DS |
857 | |
858 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingCount( | |
c137ddc9 | 859 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
860 | |
861 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingProgress( | |
c137ddc9 | 862 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
863 | |
864 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingTime( | |
c137ddc9 | 865 | /* [retval][out] */ double __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
866 | |
867 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeek( | |
c137ddc9 | 868 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
869 | |
870 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeekToMarkers( | |
c137ddc9 | 871 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
872 | |
873 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelDescription( | |
c137ddc9 | 874 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
875 | |
876 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelName( | |
c137ddc9 | 877 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
878 | |
879 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelURL( | |
c137ddc9 | 880 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
881 | |
882 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClientID( | |
c137ddc9 | 883 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
884 | |
885 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ConnectionSpeed( | |
c137ddc9 | 886 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
887 | |
888 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactAddress( | |
c137ddc9 | 889 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
890 | |
891 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactEmail( | |
c137ddc9 | 892 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
893 | |
894 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactPhone( | |
c137ddc9 | 895 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
896 | |
897 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentMarker( | |
c137ddc9 | 898 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
899 | |
900 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentMarker( | |
c137ddc9 | 901 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
902 | |
903 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentPosition( | |
c137ddc9 | 904 | /* [retval][out] */ double __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
905 | |
906 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentPosition( | |
c137ddc9 | 907 | /* [in] */ double newVal) = 0; |
9d7d3b1f DS |
908 | |
909 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DefaultFrame( | |
c137ddc9 | 910 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
911 | |
912 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DefaultFrame( | |
c137ddc9 | 913 | /* [in] */ BSTR newVal) = 0; |
9d7d3b1f DS |
914 | |
915 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration( | |
c137ddc9 | 916 | /* [retval][out] */ double __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
917 | |
918 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EntryCount( | |
c137ddc9 | 919 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
920 | |
921 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCode( | |
c137ddc9 | 922 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
923 | |
924 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorDescription( | |
c137ddc9 | 925 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
926 | |
927 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasError( | |
c137ddc9 | 928 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
929 | |
930 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasMultipleItems( | |
c137ddc9 | 931 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
932 | |
933 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceHeight( | |
c137ddc9 | 934 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
935 | |
936 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceWidth( | |
c137ddc9 | 937 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
938 | |
939 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InvokeURLs( | |
c137ddc9 | 940 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
941 | |
942 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_InvokeURLs( | |
c137ddc9 | 943 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
944 | |
945 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsBroadcast( | |
c137ddc9 | 946 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
947 | |
948 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsDurationValid( | |
c137ddc9 | 949 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
950 | |
951 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_LostPackets( | |
c137ddc9 | 952 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
953 | |
954 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MarkerCount( | |
c137ddc9 | 955 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
956 | |
957 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OpenState( | |
c137ddc9 | 958 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
959 | |
960 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayState( | |
c137ddc9 | 961 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
962 | |
963 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PreviewMode( | |
c137ddc9 | 964 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
965 | |
966 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PreviewMode( | |
c137ddc9 | 967 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
968 | |
969 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReadyState( | |
c137ddc9 | 970 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
971 | |
972 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceivedPackets( | |
c137ddc9 | 973 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
974 | |
975 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceptionQuality( | |
c137ddc9 | 976 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
977 | |
978 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_RecoveredPackets( | |
c137ddc9 | 979 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
980 | |
981 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIFileName( | |
c137ddc9 | 982 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
983 | |
984 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIFileName( | |
c137ddc9 | 985 | /* [in] */ BSTR newVal) = 0; |
9d7d3b1f DS |
986 | |
987 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMILang( | |
c137ddc9 | 988 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
989 | |
990 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMILang( | |
c137ddc9 | 991 | /* [in] */ BSTR newVal) = 0; |
9d7d3b1f DS |
992 | |
993 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIStyle( | |
c137ddc9 | 994 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
995 | |
996 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIStyle( | |
c137ddc9 | 997 | /* [in] */ BSTR newVal) = 0; |
9d7d3b1f DS |
998 | |
999 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionEnd( | |
c137ddc9 | 1000 | /* [retval][out] */ double __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1001 | |
1002 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionEnd( | |
c137ddc9 | 1003 | /* [in] */ double newVal) = 0; |
9d7d3b1f DS |
1004 | |
1005 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionStart( | |
c137ddc9 | 1006 | /* [retval][out] */ double __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1007 | |
1008 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionStart( | |
c137ddc9 | 1009 | /* [in] */ double newVal) = 0; |
9d7d3b1f DS |
1010 | |
1011 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendErrorEvents( | |
c137ddc9 | 1012 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1013 | |
1014 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendErrorEvents( | |
c137ddc9 | 1015 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1016 | |
1017 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendKeyboardEvents( | |
c137ddc9 | 1018 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1019 | |
1020 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendKeyboardEvents( | |
c137ddc9 | 1021 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1022 | |
1023 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseClickEvents( | |
c137ddc9 | 1024 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1025 | |
1026 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseClickEvents( | |
c137ddc9 | 1027 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1028 | |
1029 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseMoveEvents( | |
c137ddc9 | 1030 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1031 | |
1032 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseMoveEvents( | |
c137ddc9 | 1033 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1034 | |
1035 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendOpenStateChangeEvents( | |
c137ddc9 | 1036 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1037 | |
1038 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendOpenStateChangeEvents( | |
c137ddc9 | 1039 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1040 | |
1041 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendPlayStateChangeEvents( | |
c137ddc9 | 1042 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1043 | |
1044 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendPlayStateChangeEvents( | |
c137ddc9 | 1045 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1046 | |
1047 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendWarningEvents( | |
c137ddc9 | 1048 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1049 | |
1050 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendWarningEvents( | |
c137ddc9 | 1051 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1052 | |
1053 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceLink( | |
c137ddc9 | 1054 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f | 1055 | |
c137ddc9 | 1056 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AboutBox( void) = 0; |
9d7d3b1f | 1057 | |
c137ddc9 | 1058 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Cancel( void) = 0; |
9d7d3b1f DS |
1059 | |
1060 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecDescription( | |
c137ddc9 JS |
1061 | /* [in] */ long nCodec, |
1062 | /* [retval][out] */ BSTR __RPC_FAR *pDescription) = 0; | |
9d7d3b1f DS |
1063 | |
1064 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecInstalled( | |
c137ddc9 JS |
1065 | /* [in] */ BSTR __RPC_FAR *pstrCodec, |
1066 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pIsInstalled) = 0; | |
9d7d3b1f DS |
1067 | |
1068 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCurrentEntry( | |
c137ddc9 | 1069 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1070 | |
1071 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerName( | |
c137ddc9 JS |
1072 | /* [in] */ long nMarker, |
1073 | /* [retval][out] */ BSTR __RPC_FAR *pMarkerName) = 0; | |
9d7d3b1f DS |
1074 | |
1075 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerTime( | |
c137ddc9 JS |
1076 | /* [in] */ long nMarker, |
1077 | /* [retval][out] */ double __RPC_FAR *pMarkerTime) = 0; | |
9d7d3b1f DS |
1078 | |
1079 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaInfoString( | |
c137ddc9 JS |
1080 | /* [in] */ long MPMediaInfoType, |
1081 | /* [retval][out] */ BSTR __RPC_FAR *pstrMediaInfo) = 0; | |
9d7d3b1f | 1082 | |
c137ddc9 | 1083 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Next( void) = 0; |
9d7d3b1f DS |
1084 | |
1085 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Open( | |
c137ddc9 | 1086 | BSTR pstrClip) = 0; |
9d7d3b1f | 1087 | |
c137ddc9 | 1088 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; |
9d7d3b1f | 1089 | |
c137ddc9 | 1090 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Play( void) = 0; |
9d7d3b1f | 1091 | |
c137ddc9 | 1092 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Previous( void) = 0; |
9d7d3b1f | 1093 | |
c137ddc9 | 1094 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; |
9d7d3b1f DS |
1095 | |
1096 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Rate( | |
c137ddc9 | 1097 | /* [retval][out] */ double __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1098 | |
1099 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Rate( | |
c137ddc9 | 1100 | /* [in] */ double newVal) = 0; |
9d7d3b1f DS |
1101 | |
1102 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplaySize( | |
c137ddc9 | 1103 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1104 | |
1105 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplaySize( | |
c137ddc9 | 1106 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
1107 | |
1108 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceProtocol( | |
c137ddc9 | 1109 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1110 | |
1111 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCorrection( | |
c137ddc9 | 1112 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f | 1113 | |
c137ddc9 | 1114 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FinalConstruct( void) = 0; |
9d7d3b1f DS |
1115 | |
1116 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowChangeDisplaySize( | |
c137ddc9 | 1117 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1118 | |
1119 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowChangeDisplaySize( | |
c137ddc9 | 1120 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1121 | |
1122 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowScan( | |
c137ddc9 | 1123 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1124 | |
1125 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowScan( | |
c137ddc9 | 1126 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1127 | |
1128 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AnimationAtStart( | |
c137ddc9 | 1129 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1130 | |
1131 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AnimationAtStart( | |
c137ddc9 | 1132 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1133 | |
1134 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStream( | |
c137ddc9 | 1135 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1136 | |
1137 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AudioStream( | |
c137ddc9 | 1138 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
1139 | |
1140 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoRewind( | |
c137ddc9 | 1141 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1142 | |
1143 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoRewind( | |
c137ddc9 | 1144 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1145 | |
1146 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Balance( | |
c137ddc9 | 1147 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1148 | |
1149 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Balance( | |
c137ddc9 | 1150 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
1151 | |
1152 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanPreview( | |
c137ddc9 | 1153 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1154 | |
1155 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanScan( | |
c137ddc9 | 1156 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1157 | |
1158 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CaptioningID( | |
c137ddc9 | 1159 | /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1160 | |
1161 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClickToPlay( | |
c137ddc9 | 1162 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1163 | |
1164 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ClickToPlay( | |
c137ddc9 | 1165 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1166 | |
1167 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CodecCount( | |
c137ddc9 | 1168 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1169 | |
1170 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CreationDate( | |
c137ddc9 | 1171 | /* [retval][out] */ DATE __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1172 | |
1173 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CursorType( | |
c137ddc9 | 1174 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1175 | |
1176 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CursorType( | |
c137ddc9 | 1177 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
1178 | |
1179 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayBackColor( | |
c137ddc9 | 1180 | /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1181 | |
1182 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayBackColor( | |
c137ddc9 | 1183 | /* [in] */ VB_OLE_COLOR newVal) = 0; |
9d7d3b1f DS |
1184 | |
1185 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayForeColor( | |
c137ddc9 | 1186 | /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1187 | |
1188 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayForeColor( | |
c137ddc9 | 1189 | /* [in] */ VB_OLE_COLOR newVal) = 0; |
9d7d3b1f DS |
1190 | |
1191 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayMode( | |
c137ddc9 | 1192 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1193 | |
1194 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayMode( | |
c137ddc9 | 1195 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
1196 | |
1197 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableContextMenu( | |
c137ddc9 | 1198 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1199 | |
1200 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableContextMenu( | |
c137ddc9 | 1201 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1202 | |
1203 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableFullScreenControls( | |
c137ddc9 | 1204 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1205 | |
1206 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableFullScreenControls( | |
c137ddc9 | 1207 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1208 | |
1209 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnablePositionControls( | |
c137ddc9 | 1210 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1211 | |
1212 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnablePositionControls( | |
c137ddc9 | 1213 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1214 | |
1215 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableTracker( | |
c137ddc9 | 1216 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1217 | |
1218 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableTracker( | |
c137ddc9 | 1219 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1220 | |
1221 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Language( | |
c137ddc9 | 1222 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1223 | |
1224 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamCount( | |
c137ddc9 | 1225 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1226 | |
1227 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TransparentAtStart( | |
c137ddc9 | 1228 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1229 | |
1230 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_TransparentAtStart( | |
c137ddc9 | 1231 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1232 | |
1233 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorder3D( | |
c137ddc9 | 1234 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1235 | |
1236 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorder3D( | |
c137ddc9 | 1237 | /* [in] */ VARIANT_BOOL newVal) = 0; |
9d7d3b1f DS |
1238 | |
1239 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderColor( | |
c137ddc9 | 1240 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1241 | |
1242 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderColor( | |
c137ddc9 | 1243 | /* [in] */ long newVal) = 0; |
9d7d3b1f DS |
1244 | |
1245 | virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderWidth( | |
c137ddc9 | 1246 | /* [retval][out] */ long __RPC_FAR *pVal) = 0; |
9d7d3b1f DS |
1247 | |
1248 | virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderWidth( | |
c137ddc9 | 1249 | /* [in] */ long newVal) = 0; |
9d7d3b1f | 1250 | |
c137ddc9 | 1251 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastForward( void) = 0; |
9d7d3b1f | 1252 | |
c137ddc9 | 1253 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastReverse( void) = 0; |
9d7d3b1f DS |
1254 | |
1255 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecURL( | |
c137ddc9 | 1256 | /* [retval][out] */ BSTR __RPC_FAR *pstrCodecURL) = 0; |
9d7d3b1f DS |
1257 | |
1258 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameter( | |
c137ddc9 JS |
1259 | /* [in] */ long nParam, |
1260 | BSTR szParameterName, | |
1261 | /* [retval][out] */ BSTR __RPC_FAR *pstrParameterValue) = 0; | |
9d7d3b1f DS |
1262 | |
1263 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameterName( | |
c137ddc9 JS |
1264 | /* [in] */ long nParam, |
1265 | long nIndex, | |
1266 | /* [retval][out] */ BSTR __RPC_FAR *pstrParameterName) = 0; | |
9d7d3b1f DS |
1267 | |
1268 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMoreInfoURL( | |
c137ddc9 | 1269 | /* [retval][out] */ BSTR __RPC_FAR *pstrMoreInfoURL) = 0; |
9d7d3b1f DS |
1270 | |
1271 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamGroup( | |
c137ddc9 | 1272 | /* [retval][out] */ BSTR __RPC_FAR *pstrStreamGroup) = 0; |
9d7d3b1f DS |
1273 | |
1274 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamName( | |
c137ddc9 | 1275 | /* [retval][out] */ BSTR __RPC_FAR *pstrStreamName) = 0; |
9d7d3b1f DS |
1276 | |
1277 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamSelected( | |
c137ddc9 JS |
1278 | /* [in] */ long nStream, |
1279 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsSelected) = 0; | |
9d7d3b1f DS |
1280 | |
1281 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsSoundCardEnabled( | |
c137ddc9 | 1282 | /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsEnabled) = 0; |
9d7d3b1f DS |
1283 | |
1284 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetCurrentEntry( | |
c137ddc9 | 1285 | long nValue) = 0; |
9d7d3b1f DS |
1286 | |
1287 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ShowDialog( | |
c137ddc9 | 1288 | long nValue) = 0; |
9d7d3b1f DS |
1289 | |
1290 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE StreamSelect( | |
c137ddc9 | 1291 | long nSelect) = 0; |
9d7d3b1f DS |
1292 | |
1293 | virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnWindowMessage( | |
c137ddc9 JS |
1294 | UINT msg, |
1295 | WPARAM wParam, | |
1296 | LPARAM lParam, | |
1297 | LRESULT __RPC_FAR *plResult) = 0; | |
c137ddc9 JS |
1298 | }; |
1299 | ||
c5191fbd VZ |
1300 | //--------------------------------------------------------------------------- |
1301 | // MISC COM INTERFACES | |
1302 | //--------------------------------------------------------------------------- | |
1303 | typedef enum _FilterState | |
1304 | { | |
1305 | State_Stopped, | |
1306 | State_Paused, | |
1307 | State_Running | |
b1ec2381 DS |
1308 | } |
1309 | FILTER_STATE; | |
1310 | ||
1311 | typedef enum _PinDirection | |
1312 | { | |
c5191fbd VZ |
1313 | PINDIR_INPUT, |
1314 | PINDIR_OUTPUT | |
b1ec2381 DS |
1315 | } |
1316 | PIN_DIRECTION; | |
c5191fbd | 1317 | |
b1ec2381 DS |
1318 | typedef struct _FilterInfo |
1319 | { | |
c5191fbd VZ |
1320 | WCHAR achName[128]; |
1321 | struct IFilterGraph *pGraph; | |
b1ec2381 DS |
1322 | } |
1323 | FILTER_INFO; | |
c5191fbd | 1324 | |
b1ec2381 DS |
1325 | typedef struct _PinInfo |
1326 | { | |
c5191fbd VZ |
1327 | struct IBaseFilter *pFilter; |
1328 | PIN_DIRECTION dir; | |
1329 | WCHAR achName[128]; | |
b1ec2381 DS |
1330 | } |
1331 | PIN_INFO; | |
c5191fbd VZ |
1332 | |
1333 | struct IBaseFilter; | |
1334 | struct IPin; | |
1335 | struct IEnumFilters; | |
b1ec2381 DS |
1336 | typedef struct _MediaType |
1337 | { | |
c5191fbd VZ |
1338 | GUID majortype; |
1339 | GUID subtype; | |
1340 | BOOL bFixedSizeSamples; | |
1341 | BOOL bTemporalCompression; | |
1342 | ULONG lSampleSize; | |
1343 | GUID formattype; | |
1344 | IUnknown *pUnk; | |
1345 | ULONG cbFormat; | |
1346 | BYTE *pbFormat; | |
b1ec2381 DS |
1347 | } |
1348 | AM_MEDIA_TYPE; | |
920a7c15 JS |
1349 | |
1350 | struct IFilterGraph : public IUnknown | |
1351 | { | |
1352 | STDMETHOD(AddFilter)(IBaseFilter *, LPCWSTR) PURE; | |
1353 | STDMETHOD(RemoveFilter)(IBaseFilter *) PURE; | |
1354 | STDMETHOD(EnumFilters)(IEnumFilters **) PURE; | |
1355 | STDMETHOD(FindFilterByName)(LPCWSTR, IBaseFilter **) PURE; | |
1356 | STDMETHOD(ConnectDirect)(IPin *, IPin *, const AM_MEDIA_TYPE *) PURE; | |
1357 | STDMETHOD(Reconnect)(IPin *) PURE; | |
1358 | STDMETHOD(Disconnect)(IPin *) PURE; | |
1359 | STDMETHOD(SetDefaultSyncSource)() PURE; | |
a2a444e3 | 1360 | }; |
b11eba7e | 1361 | |
920a7c15 | 1362 | struct IGraphBuilder : public IFilterGraph |
a2a444e3 | 1363 | { |
920a7c15 JS |
1364 | STDMETHOD(Connect)(IPin *, IPin *) PURE; |
1365 | STDMETHOD(Render)(IPin *) PURE; | |
1366 | STDMETHOD(RenderFile)(LPCWSTR, LPCWSTR) PURE; | |
1367 | STDMETHOD(AddSourceFilter)(LPCWSTR, LPCWSTR, IBaseFilter **) PURE; | |
1368 | STDMETHOD(SetLogFile)(DWORD_PTR) PURE; | |
1369 | STDMETHOD(Abort)() PURE; | |
1370 | STDMETHOD(ShouldOperationContinue)() PURE; | |
a2a444e3 | 1371 | }; |
b11eba7e | 1372 | |
c5191fbd VZ |
1373 | struct IReferenceClock; |
1374 | struct IEnumPins; | |
1375 | #define REFERENCE_TIME LONGLONG | |
1376 | struct IMediaFilter : public IPersist | |
1377 | { | |
1378 | STDMETHOD(Stop)( void) PURE; | |
1379 | STDMETHOD(Pause)( void) PURE; | |
1380 | STDMETHOD(Run)(REFERENCE_TIME tStart) PURE; | |
1381 | STDMETHOD(GetState)(DWORD dwMilliSecsTimeout, | |
1382 | FILTER_STATE *State) PURE; | |
1383 | STDMETHOD(SetSyncSource)(IReferenceClock *pClock) PURE; | |
1384 | STDMETHOD(GetSyncSource)(IReferenceClock **pClock) PURE; | |
1385 | }; | |
1386 | ||
1387 | struct IBaseFilter : public IMediaFilter | |
a2a444e3 | 1388 | { |
c5191fbd VZ |
1389 | STDMETHOD(EnumPins)(IEnumPins **ppEnum) PURE; |
1390 | STDMETHOD(FindPin)(LPCWSTR Id, IPin **ppPin) PURE; | |
1391 | STDMETHOD(QueryFilterInfo)(FILTER_INFO *pInfo) PURE; | |
1392 | STDMETHOD(JoinFilterGraph)(IFilterGraph *pGraph, LPCWSTR pName) PURE; | |
1393 | STDMETHOD(QueryVendorInfo)(LPWSTR *pVendorInfo) PURE; | |
1394 | }; | |
1395 | ||
c5191fbd | 1396 | |
b1ec2381 | 1397 | //--------------------------------------------------------------------------- |
c5191fbd | 1398 | // wxAMMediaBackend |
b1ec2381 | 1399 | //--------------------------------------------------------------------------- |
c5191fbd VZ |
1400 | |
1401 | typedef BOOL (WINAPI* LPAMGETERRORTEXT)(HRESULT, wxChar *, DWORD); | |
1402 | ||
7e41b689 | 1403 | class WXDLLIMPEXP_MEDIA wxAMMediaBackend : public wxMediaBackendCommonBase |
1a680109 RN |
1404 | { |
1405 | public: | |
ff4aedc5 | 1406 | wxAMMediaBackend(); |
ff4aedc5 | 1407 | virtual ~wxAMMediaBackend(); |
c5191fbd | 1408 | void Clear(); |
1a680109 | 1409 | |
226ec5a7 | 1410 | virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, |
ff4aedc5 | 1411 | wxWindowID id, |
226ec5a7 | 1412 | const wxPoint& pos, |
ff4aedc5 | 1413 | const wxSize& size, |
226ec5a7 | 1414 | long style, |
ff4aedc5 RN |
1415 | const wxValidator& validator, |
1416 | const wxString& name); | |
1a680109 RN |
1417 | |
1418 | virtual bool Play(); | |
1419 | virtual bool Pause(); | |
1420 | virtual bool Stop(); | |
1421 | ||
1422 | virtual bool Load(const wxString& fileName); | |
1423 | virtual bool Load(const wxURI& location); | |
c5191fbd VZ |
1424 | virtual bool Load(const wxURI& location, const wxURI& proxy); |
1425 | ||
1426 | bool DoLoad(const wxString& location); | |
1427 | void FinishLoad(); | |
1a680109 RN |
1428 | |
1429 | virtual wxMediaState GetState(); | |
1430 | ||
ff4aedc5 RN |
1431 | virtual bool SetPosition(wxLongLong where); |
1432 | virtual wxLongLong GetPosition(); | |
1433 | virtual wxLongLong GetDuration(); | |
1a680109 | 1434 | |
ff4aedc5 RN |
1435 | virtual void Move(int x, int y, int w, int h); |
1436 | wxSize GetVideoSize() const; | |
1a680109 RN |
1437 | |
1438 | virtual double GetPlaybackRate(); | |
1439 | virtual bool SetPlaybackRate(double); | |
1440 | ||
6f8c67e7 JS |
1441 | virtual double GetVolume(); |
1442 | virtual bool SetVolume(double); | |
1443 | ||
c5191fbd | 1444 | virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags); |
1a680109 | 1445 | void Cleanup(); |
920a7c15 | 1446 | |
c5191fbd | 1447 | void DoGetDownloadProgress(wxLongLong*, wxLongLong*); |
b1ec2381 | 1448 | |
c5191fbd VZ |
1449 | virtual wxLongLong GetDownloadProgress() |
1450 | { | |
1451 | wxLongLong progress, total; | |
1452 | DoGetDownloadProgress(&progress, &total); | |
1453 | return progress; | |
1454 | } | |
b1ec2381 | 1455 | |
c5191fbd VZ |
1456 | virtual wxLongLong GetDownloadTotal() |
1457 | { | |
1458 | wxLongLong progress, total; | |
1459 | DoGetDownloadProgress(&progress, &total); | |
1460 | return total; | |
1461 | } | |
1a680109 | 1462 | |
9d7d3b1f | 1463 | // WinCE helpers |
c137ddc9 | 1464 | |
bf354396 | 1465 | wxActiveXContainer* m_pAX; |
9d7d3b1f | 1466 | |
c137ddc9 JS |
1467 | #ifdef __WXWINCE__ |
1468 | IWMP* m_pWMP; | |
1469 | ||
09e28f7f DS |
1470 | IWMP* GetMP() { return m_pWMP; } |
1471 | IWMP* GetAM() { return m_pWMP; } | |
c137ddc9 | 1472 | #else |
c5191fbd VZ |
1473 | IActiveMovie* m_pAM; |
1474 | IMediaPlayer* m_pMP; | |
c137ddc9 | 1475 | |
09e28f7f DS |
1476 | IMediaPlayer* GetMP() { return m_pMP; } |
1477 | IActiveMovie* GetAM() { return m_pAM; } | |
c137ddc9 | 1478 | #endif |
9d7d3b1f | 1479 | |
c5191fbd | 1480 | wxTimer* m_pTimer; |
1a680109 | 1481 | wxSize m_bestSize; |
aa200e97 | 1482 | |
920a7c15 | 1483 | #ifdef __WXDEBUG__ |
aa200e97 | 1484 | wxDynamicLibrary m_dllQuartz; |
920a7c15 | 1485 | LPAMGETERRORTEXT m_lpAMGetErrorText; |
a3c1ce50 | 1486 | wxString GetErrorString(HRESULT hrdsv); |
b1ec2381 | 1487 | #endif |
920a7c15 | 1488 | |
19b6f122 | 1489 | DECLARE_DYNAMIC_CLASS(wxAMMediaBackend) |
1a680109 RN |
1490 | }; |
1491 | ||
1a680109 | 1492 | //--------------------------------------------------------------------------- |
ff4aedc5 | 1493 | // wxMCIMediaBackend |
1a680109 RN |
1494 | //--------------------------------------------------------------------------- |
1495 | ||
ff4aedc5 RN |
1496 | //--------------------------------------------------------------------------- |
1497 | // MCI Includes | |
1498 | //--------------------------------------------------------------------------- | |
a45d2855 | 1499 | #ifndef __WXWINCE__ |
1a680109 | 1500 | #include <mmsystem.h> |
1a680109 | 1501 | |
7e41b689 | 1502 | class WXDLLIMPEXP_MEDIA wxMCIMediaBackend : public wxMediaBackendCommonBase |
1a680109 RN |
1503 | { |
1504 | public: | |
ff4aedc5 | 1505 | wxMCIMediaBackend(); |
d3c7fc99 | 1506 | virtual ~wxMCIMediaBackend(); |
1a680109 | 1507 | |
226ec5a7 | 1508 | virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, |
ff4aedc5 | 1509 | wxWindowID id, |
226ec5a7 | 1510 | const wxPoint& pos, |
ff4aedc5 | 1511 | const wxSize& size, |
226ec5a7 | 1512 | long style, |
ff4aedc5 RN |
1513 | const wxValidator& validator, |
1514 | const wxString& name); | |
1a680109 RN |
1515 | |
1516 | virtual bool Play(); | |
1517 | virtual bool Pause(); | |
1518 | virtual bool Stop(); | |
1519 | ||
3832f946 WS |
1520 | virtual bool Load(const wxURI& location, |
1521 | const wxURI& proxy) | |
1522 | { return wxMediaBackend::Load(location, proxy); } | |
1523 | ||
1a680109 RN |
1524 | virtual bool Load(const wxString& fileName); |
1525 | virtual bool Load(const wxURI& location); | |
1526 | ||
1527 | virtual wxMediaState GetState(); | |
1528 | ||
ff4aedc5 RN |
1529 | virtual bool SetPosition(wxLongLong where); |
1530 | virtual wxLongLong GetPosition(); | |
1531 | virtual wxLongLong GetDuration(); | |
1a680109 | 1532 | |
ff4aedc5 RN |
1533 | virtual void Move(int x, int y, int w, int h); |
1534 | wxSize GetVideoSize() const; | |
1a680109 RN |
1535 | |
1536 | virtual double GetPlaybackRate(); | |
ff4aedc5 | 1537 | virtual bool SetPlaybackRate(double dRate); |
3f9a3bf9 | 1538 | |
6f8c67e7 JS |
1539 | virtual double GetVolume(); |
1540 | virtual bool SetVolume(double); | |
1541 | ||
226ec5a7 | 1542 | static LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT nMsg, |
ff4aedc5 | 1543 | WPARAM wParam, LPARAM lParam); |
5987f174 | 1544 | |
226ec5a7 | 1545 | LRESULT CALLBACK OnNotifyWndProc(HWND hWnd, UINT nMsg, |
ff4aedc5 | 1546 | WPARAM wParam, LPARAM lParam); |
1a680109 | 1547 | |
ff4aedc5 | 1548 | MCIDEVICEID m_hDev; //Our MCI Device ID/Handler |
ff4aedc5 RN |
1549 | HWND m_hNotifyWnd; //Window to use for MCI events |
1550 | bool m_bVideo; //Whether or not we have video | |
1551 | ||
3839f37e | 1552 | DECLARE_DYNAMIC_CLASS(wxMCIMediaBackend) |
ff4aedc5 | 1553 | }; |
a45d2855 | 1554 | #endif |
1a680109 RN |
1555 | |
1556 | //--------------------------------------------------------------------------- | |
ff4aedc5 | 1557 | // wxQTMediaBackend |
1a680109 | 1558 | // |
c5191fbd VZ |
1559 | // We don't include Quicktime headers here and define all the types |
1560 | // ourselves because looking for the quicktime libaries etc. would | |
1561 | // be tricky to do and making this a dependency for the MSVC projects | |
1562 | // would be unrealistic. | |
1563 | // | |
1564 | // Thanks to Robert Roebling for the wxDL macro/library idea | |
1a680109 RN |
1565 | //--------------------------------------------------------------------------- |
1566 | ||
ff4aedc5 RN |
1567 | //--------------------------------------------------------------------------- |
1568 | // QT Includes | |
1569 | //--------------------------------------------------------------------------- | |
9d7d3b1f DS |
1570 | //#include <qtml.h> // Windoze QT include |
1571 | //#include <QuickTimeComponents.h> // Standard QT stuff | |
d7a9c895 RN |
1572 | #include "wx/dynlib.h" |
1573 | ||
1574 | //--------------------------------------------------------------------------- | |
1575 | // QT Types | |
1576 | //--------------------------------------------------------------------------- | |
1577 | typedef struct MovieRecord* Movie; | |
1578 | typedef wxInt16 OSErr; | |
1579 | typedef wxInt32 OSStatus; | |
1580 | #define noErr 0 | |
1581 | #define fsRdPerm 1 | |
1582 | typedef unsigned char Str255[256]; | |
1583 | #define StringPtr unsigned char* | |
1584 | #define newMovieActive 1 | |
c5191fbd | 1585 | #define newMovieAsyncOK (1 << 8) |
b11eba7e | 1586 | #define Ptr char* |
d7a9c895 RN |
1587 | #define Handle Ptr* |
1588 | #define Fixed long | |
1589 | #define OSType unsigned long | |
b11eba7e | 1590 | #define CGrafPtr struct GrafPort * |
d7a9c895 | 1591 | #define TimeScale long |
b11eba7e | 1592 | #define TimeBase struct TimeBaseRecord * |
c5191fbd VZ |
1593 | typedef struct ComponentInstanceRecord * ComponentInstance; |
1594 | #define kMovieLoadStatePlayable 10000 | |
1595 | #define Boolean int | |
1596 | #define MovieController ComponentInstance | |
d7a9c895 | 1597 | |
19b6f122 WS |
1598 | #ifndef URLDataHandlerSubType |
1599 | #if defined(__WATCOMC__) || defined(__MINGW32__) | |
1600 | // use magic numbers for compilers which complain about multicharacter integers | |
1601 | const OSType URLDataHandlerSubType = 1970433056; | |
1602 | const OSType VisualMediaCharacteristic = 1702454643; | |
1603 | #else | |
1604 | const OSType URLDataHandlerSubType = 'url '; | |
1605 | const OSType VisualMediaCharacteristic = 'eyes'; | |
1606 | #endif | |
1607 | #endif | |
1608 | ||
b1ec2381 DS |
1609 | struct FSSpec |
1610 | { | |
600ffb32 WS |
1611 | short vRefNum; |
1612 | long parID; | |
b1ec2381 | 1613 | Str255 name; // Str63 on mac, Str255 on msw |
d7a9c895 RN |
1614 | }; |
1615 | ||
b1ec2381 DS |
1616 | struct Rect |
1617 | { | |
600ffb32 WS |
1618 | short top; |
1619 | short left; | |
1620 | short bottom; | |
1621 | short right; | |
d7a9c895 RN |
1622 | }; |
1623 | ||
b1ec2381 DS |
1624 | struct wide |
1625 | { | |
600ffb32 WS |
1626 | wxInt32 hi; |
1627 | wxUint32 lo; | |
d7a9c895 RN |
1628 | }; |
1629 | ||
b1ec2381 DS |
1630 | struct TimeRecord |
1631 | { | |
1632 | wide value; // units | |
1633 | TimeScale scale; // units per second | |
600ffb32 | 1634 | TimeBase base; |
d7a9c895 RN |
1635 | }; |
1636 | ||
b1ec2381 DS |
1637 | struct Point |
1638 | { | |
c5191fbd VZ |
1639 | short v; |
1640 | short h; | |
1641 | }; | |
1642 | ||
b1ec2381 DS |
1643 | struct EventRecord |
1644 | { | |
c5191fbd VZ |
1645 | wxUint16 what; |
1646 | wxUint32 message; | |
1647 | wxUint32 when; | |
1648 | Point where; | |
1649 | wxUint16 modifiers; | |
1650 | }; | |
1651 | ||
9d7d3b1f DS |
1652 | enum |
1653 | { | |
c5191fbd VZ |
1654 | mcTopLeftMovie = 1, |
1655 | mcScaleMovieToFit = 2, | |
1656 | mcWithBadge = 4, | |
1657 | mcNotVisible = 8, | |
1658 | mcWithFrame = 16 | |
1659 | }; | |
1660 | ||
d7a9c895 RN |
1661 | //--------------------------------------------------------------------------- |
1662 | // QT Library | |
1663 | //--------------------------------------------------------------------------- | |
d7a9c895 | 1664 | |
b11eba7e | 1665 | class WXDLLIMPEXP_MEDIA wxQuickTimeLibrary |
d7a9c895 RN |
1666 | { |
1667 | public: | |
1668 | ~wxQuickTimeLibrary() | |
b11eba7e | 1669 | { |
b1ec2381 | 1670 | if (m_dll.IsLoaded()) |
d7a9c895 RN |
1671 | m_dll.Unload(); |
1672 | } | |
1673 | ||
1674 | bool Initialize(); | |
1675 | bool IsOk() const {return m_ok;} | |
1676 | ||
1677 | protected: | |
1678 | wxDynamicLibrary m_dll; | |
1679 | bool m_ok; | |
1680 | ||
1681 | public: | |
1682 | wxDL_VOIDMETHOD_DEFINE( StartMovie, (Movie m), (m) ); | |
1683 | wxDL_VOIDMETHOD_DEFINE( StopMovie, (Movie m), (m) ); | |
1684 | wxDL_METHOD_DEFINE( bool, IsMovieDone, (Movie m), (m), false); | |
1685 | wxDL_VOIDMETHOD_DEFINE( GoToBeginningOfMovie, (Movie m), (m) ); | |
1686 | wxDL_METHOD_DEFINE( OSErr, GetMoviesError, (), (), -1); | |
1687 | wxDL_METHOD_DEFINE( OSErr, EnterMovies, (), (), -1); | |
1688 | wxDL_VOIDMETHOD_DEFINE( ExitMovies, (), () ); | |
1689 | wxDL_METHOD_DEFINE( OSErr, InitializeQTML, (long flags), (flags), -1); | |
1690 | wxDL_VOIDMETHOD_DEFINE( TerminateQTML, (), () ); | |
1691 | ||
b11eba7e WS |
1692 | wxDL_METHOD_DEFINE( OSErr, NativePathNameToFSSpec, |
1693 | (char* inName, FSSpec* outFile, long flags), | |
d7a9c895 RN |
1694 | (inName, outFile, flags), -1); |
1695 | ||
b11eba7e | 1696 | wxDL_METHOD_DEFINE( OSErr, OpenMovieFile, |
d7a9c895 RN |
1697 | (const FSSpec * fileSpec, short * resRefNum, wxInt8 permission), |
1698 | (fileSpec, resRefNum, permission), -1 ); | |
1699 | ||
1700 | wxDL_METHOD_DEFINE( OSErr, CloseMovieFile, | |
1701 | (short resRefNum), (resRefNum), -1); | |
1702 | ||
1703 | wxDL_METHOD_DEFINE( OSErr, NewMovieFromFile, | |
1704 | (Movie * theMovie, short resRefNum, short * resId, | |
1705 | StringPtr resName, short newMovieFlags, | |
b11eba7e | 1706 | bool * dataRefWasChanged), |
d7a9c895 RN |
1707 | (theMovie, resRefNum, resId, resName, newMovieFlags, |
1708 | dataRefWasChanged), -1); | |
1709 | ||
1710 | wxDL_VOIDMETHOD_DEFINE( SetMovieRate, (Movie m, Fixed rate), (m, rate) ); | |
1711 | wxDL_METHOD_DEFINE( Fixed, GetMovieRate, (Movie m), (m), 0); | |
1712 | wxDL_VOIDMETHOD_DEFINE( MoviesTask, (Movie m, long maxms), (m, maxms) ); | |
b11eba7e | 1713 | wxDL_VOIDMETHOD_DEFINE( BlockMove, |
d7a9c895 RN |
1714 | (const char* p1, const char* p2, long s), (p1,p2,s) ); |
1715 | wxDL_METHOD_DEFINE( Handle, NewHandleClear, (long s), (s), NULL ); | |
1716 | ||
b11eba7e | 1717 | wxDL_METHOD_DEFINE( OSErr, NewMovieFromDataRef, |
d7a9c895 RN |
1718 | (Movie * m, short flags, short * id, |
1719 | Handle dataRef, OSType dataRefType), | |
1720 | (m,flags,id,dataRef,dataRefType), -1 ); | |
1721 | ||
1722 | wxDL_VOIDMETHOD_DEFINE( DisposeHandle, (Handle h), (h) ); | |
1723 | wxDL_VOIDMETHOD_DEFINE( GetMovieNaturalBoundsRect, (Movie m, Rect* r), (m,r) ); | |
b11eba7e WS |
1724 | wxDL_METHOD_DEFINE( void*, GetMovieIndTrackType, |
1725 | (Movie m, long index, OSType type, long flags), | |
d7a9c895 | 1726 | (m,index,type,flags), NULL ); |
b11eba7e | 1727 | wxDL_VOIDMETHOD_DEFINE( CreatePortAssociation, |
d7a9c895 RN |
1728 | (void* hWnd, void* junk, long morejunk), (hWnd, junk, morejunk) ); |
1729 | wxDL_METHOD_DEFINE(void*, GetNativeWindowPort, (void* hWnd), (hWnd), NULL); | |
1730 | wxDL_VOIDMETHOD_DEFINE(SetMovieGWorld, (Movie m, CGrafPtr port, void* whatever), | |
1731 | (m, port, whatever) ); | |
1732 | wxDL_VOIDMETHOD_DEFINE(DisposeMovie, (Movie m), (m) ); | |
1733 | wxDL_VOIDMETHOD_DEFINE(SetMovieBox, (Movie m, Rect* r), (m,r)); | |
1734 | wxDL_VOIDMETHOD_DEFINE(SetMovieTimeScale, (Movie m, long s), (m,s)); | |
1735 | wxDL_METHOD_DEFINE(long, GetMovieDuration, (Movie m), (m), 0); | |
1736 | wxDL_METHOD_DEFINE(TimeBase, GetMovieTimeBase, (Movie m), (m), 0); | |
1737 | wxDL_METHOD_DEFINE(TimeScale, GetMovieTimeScale, (Movie m), (m), 0); | |
1738 | wxDL_METHOD_DEFINE(long, GetMovieTime, (Movie m, void* cruft), (m,cruft), 0); | |
1739 | wxDL_VOIDMETHOD_DEFINE(SetMovieTime, (Movie m, TimeRecord* tr), (m,tr) ); | |
6f8c67e7 JS |
1740 | wxDL_METHOD_DEFINE(short, GetMovieVolume, (Movie m), (m), 0); |
1741 | wxDL_VOIDMETHOD_DEFINE(SetMovieVolume, (Movie m, short sVolume), (m,sVolume) ); | |
c5191fbd VZ |
1742 | wxDL_VOIDMETHOD_DEFINE(SetMovieTimeValue, (Movie m, long s), (m,s)); |
1743 | wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), 0); | |
1744 | wxDL_VOIDMETHOD_DEFINE(DisposeMovieController, (ComponentInstance ci), (ci)); | |
1745 | wxDL_METHOD_DEFINE(int, MCSetVisible, (ComponentInstance m, int b), (m, b), 0); | |
1746 | ||
c5191fbd VZ |
1747 | wxDL_VOIDMETHOD_DEFINE(PrePrerollMovie, (Movie m, long t, Fixed r, WXFARPROC p1, void* p2), (m,t,r,p1,p2) ); |
1748 | wxDL_VOIDMETHOD_DEFINE(PrerollMovie, (Movie m, long t, Fixed r), (m,t,r) ); | |
1749 | wxDL_METHOD_DEFINE(Fixed, GetMoviePreferredRate, (Movie m), (m), 0); | |
1750 | wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0); | |
1751 | wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), 0); | |
1752 | wxDL_VOIDMETHOD_DEFINE(DisposeRoutineDescriptor, (void* f), (f)); | |
1753 | wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), 0); | |
1754 | wxDL_METHOD_DEFINE(int, MCDoAction, (ComponentInstance ci, long f, void* p), (ci,f,p), 0); | |
1755 | wxDL_VOIDMETHOD_DEFINE(MCSetControllerBoundsRect, (ComponentInstance ci, Rect* r), (ci,r)); | |
1756 | wxDL_VOIDMETHOD_DEFINE(DestroyPortAssociation, (CGrafPtr g), (g)); | |
1757 | wxDL_VOIDMETHOD_DEFINE(NativeEventToMacEvent, (MSG* p1, EventRecord* p2), (p1,p2)); | |
1758 | wxDL_VOIDMETHOD_DEFINE(MCIsPlayerEvent, (ComponentInstance ci, EventRecord* p2), (ci, p2)); | |
a843caf3 | 1759 | wxDL_METHOD_DEFINE(int, MCSetMovie, (ComponentInstance ci, Movie m, void* p1, Point w), |
c5191fbd VZ |
1760 | (ci,m,p1,w),0); |
1761 | wxDL_VOIDMETHOD_DEFINE(MCPositionController, | |
1762 | (ComponentInstance ci, Rect* r, void* junk, void* morejunk), (ci,r,junk,morejunk)); | |
1763 | wxDL_VOIDMETHOD_DEFINE(MCSetActionFilterWithRefCon, | |
1764 | (ComponentInstance ci, WXFARPROC cb, void* ref), (ci,cb,ref)); | |
1765 | wxDL_VOIDMETHOD_DEFINE(MCGetControllerInfo, (MovieController mc, long* flags), (mc,flags)); | |
1766 | wxDL_VOIDMETHOD_DEFINE(BeginUpdate, (CGrafPtr port), (port)); | |
1767 | wxDL_VOIDMETHOD_DEFINE(UpdateMovie, (Movie m), (m)); | |
1768 | wxDL_VOIDMETHOD_DEFINE(EndUpdate, (CGrafPtr port), (port)); | |
1769 | wxDL_METHOD_DEFINE( OSErr, GetMoviesStickyError, (), (), -1); | |
d7a9c895 RN |
1770 | }; |
1771 | ||
1772 | bool wxQuickTimeLibrary::Initialize() | |
1773 | { | |
d0914b9d VZ |
1774 | // Turn off the wxDynamicLibrary logging as we're prepared to handle the |
1775 | // errors | |
1776 | wxLogNull nolog; | |
32f65e50 | 1777 | |
ced3df77 VZ |
1778 | m_ok = m_dll.Load(wxT("qtmlClient.dll")); |
1779 | if ( !m_ok ) | |
d7a9c895 RN |
1780 | return false; |
1781 | ||
ced3df77 VZ |
1782 | wxDL_METHOD_LOAD( m_dll, StartMovie ); |
1783 | wxDL_METHOD_LOAD( m_dll, StopMovie ); | |
1784 | wxDL_METHOD_LOAD( m_dll, IsMovieDone ); | |
1785 | wxDL_METHOD_LOAD( m_dll, GoToBeginningOfMovie ); | |
1786 | wxDL_METHOD_LOAD( m_dll, GetMoviesError ); | |
1787 | wxDL_METHOD_LOAD( m_dll, EnterMovies ); | |
1788 | wxDL_METHOD_LOAD( m_dll, ExitMovies ); | |
1789 | wxDL_METHOD_LOAD( m_dll, InitializeQTML ); | |
1790 | wxDL_METHOD_LOAD( m_dll, TerminateQTML ); | |
1791 | wxDL_METHOD_LOAD( m_dll, NativePathNameToFSSpec ); | |
1792 | wxDL_METHOD_LOAD( m_dll, OpenMovieFile ); | |
1793 | wxDL_METHOD_LOAD( m_dll, CloseMovieFile ); | |
1794 | wxDL_METHOD_LOAD( m_dll, NewMovieFromFile ); | |
1795 | wxDL_METHOD_LOAD( m_dll, GetMovieRate ); | |
1796 | wxDL_METHOD_LOAD( m_dll, SetMovieRate ); | |
1797 | wxDL_METHOD_LOAD( m_dll, MoviesTask ); | |
1798 | wxDL_METHOD_LOAD( m_dll, BlockMove ); | |
1799 | wxDL_METHOD_LOAD( m_dll, NewHandleClear ); | |
1800 | wxDL_METHOD_LOAD( m_dll, NewMovieFromDataRef ); | |
1801 | wxDL_METHOD_LOAD( m_dll, DisposeHandle ); | |
1802 | wxDL_METHOD_LOAD( m_dll, GetMovieNaturalBoundsRect ); | |
1803 | wxDL_METHOD_LOAD( m_dll, GetMovieIndTrackType ); | |
1804 | wxDL_METHOD_LOAD( m_dll, CreatePortAssociation ); | |
1805 | wxDL_METHOD_LOAD( m_dll, DestroyPortAssociation ); | |
1806 | wxDL_METHOD_LOAD( m_dll, GetNativeWindowPort ); | |
1807 | wxDL_METHOD_LOAD( m_dll, SetMovieGWorld ); | |
1808 | wxDL_METHOD_LOAD( m_dll, DisposeMovie ); | |
1809 | wxDL_METHOD_LOAD( m_dll, SetMovieBox ); | |
1810 | wxDL_METHOD_LOAD( m_dll, SetMovieTimeScale ); | |
1811 | wxDL_METHOD_LOAD( m_dll, GetMovieDuration ); | |
1812 | wxDL_METHOD_LOAD( m_dll, GetMovieTimeBase ); | |
1813 | wxDL_METHOD_LOAD( m_dll, GetMovieTimeScale ); | |
1814 | wxDL_METHOD_LOAD( m_dll, GetMovieTime ); | |
1815 | wxDL_METHOD_LOAD( m_dll, SetMovieTime ); | |
1816 | wxDL_METHOD_LOAD( m_dll, GetMovieVolume ); | |
1817 | wxDL_METHOD_LOAD( m_dll, SetMovieVolume ); | |
1818 | wxDL_METHOD_LOAD( m_dll, SetMovieTimeValue ); | |
1819 | wxDL_METHOD_LOAD( m_dll, NewMovieController ); | |
1820 | wxDL_METHOD_LOAD( m_dll, DisposeMovieController ); | |
1821 | wxDL_METHOD_LOAD( m_dll, MCSetVisible ); | |
1822 | wxDL_METHOD_LOAD( m_dll, PrePrerollMovie ); | |
1823 | wxDL_METHOD_LOAD( m_dll, PrerollMovie ); | |
1824 | wxDL_METHOD_LOAD( m_dll, GetMoviePreferredRate ); | |
1825 | wxDL_METHOD_LOAD( m_dll, GetMovieLoadState ); | |
1826 | wxDL_METHOD_LOAD( m_dll, MCDoAction ); | |
1827 | wxDL_METHOD_LOAD( m_dll, MCSetControllerBoundsRect ); | |
1828 | wxDL_METHOD_LOAD( m_dll, NativeEventToMacEvent ); | |
1829 | wxDL_METHOD_LOAD( m_dll, MCIsPlayerEvent ); | |
1830 | wxDL_METHOD_LOAD( m_dll, MCSetMovie ); | |
1831 | wxDL_METHOD_LOAD( m_dll, MCSetActionFilterWithRefCon ); | |
1832 | wxDL_METHOD_LOAD( m_dll, MCGetControllerInfo ); | |
1833 | wxDL_METHOD_LOAD( m_dll, BeginUpdate ); | |
1834 | wxDL_METHOD_LOAD( m_dll, UpdateMovie ); | |
1835 | wxDL_METHOD_LOAD( m_dll, EndUpdate ); | |
1836 | wxDL_METHOD_LOAD( m_dll, GetMoviesStickyError ); | |
1837 | ||
1838 | return m_ok; | |
d7a9c895 | 1839 | } |
1a680109 | 1840 | |
7e41b689 | 1841 | class WXDLLIMPEXP_MEDIA wxQTMediaBackend : public wxMediaBackendCommonBase |
ff4aedc5 RN |
1842 | { |
1843 | public: | |
ff4aedc5 | 1844 | wxQTMediaBackend(); |
d3c7fc99 | 1845 | virtual ~wxQTMediaBackend(); |
1a680109 | 1846 | |
226ec5a7 | 1847 | virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, |
ff4aedc5 | 1848 | wxWindowID id, |
226ec5a7 | 1849 | const wxPoint& pos, |
ff4aedc5 | 1850 | const wxSize& size, |
226ec5a7 | 1851 | long style, |
ff4aedc5 RN |
1852 | const wxValidator& validator, |
1853 | const wxString& name); | |
1a680109 | 1854 | |
ff4aedc5 RN |
1855 | virtual bool Play(); |
1856 | virtual bool Pause(); | |
1857 | virtual bool Stop(); | |
1a680109 | 1858 | |
3832f946 WS |
1859 | virtual bool Load(const wxURI& location, |
1860 | const wxURI& proxy) | |
1861 | { return wxMediaBackend::Load(location, proxy); } | |
1862 | ||
ff4aedc5 RN |
1863 | virtual bool Load(const wxString& fileName); |
1864 | virtual bool Load(const wxURI& location); | |
1a680109 | 1865 | |
ff4aedc5 | 1866 | virtual wxMediaState GetState(); |
1a680109 | 1867 | |
ff4aedc5 RN |
1868 | virtual bool SetPosition(wxLongLong where); |
1869 | virtual wxLongLong GetPosition(); | |
1870 | virtual wxLongLong GetDuration(); | |
1a680109 | 1871 | |
ff4aedc5 RN |
1872 | virtual void Move(int x, int y, int w, int h); |
1873 | wxSize GetVideoSize() const; | |
1a680109 | 1874 | |
ff4aedc5 RN |
1875 | virtual double GetPlaybackRate(); |
1876 | virtual bool SetPlaybackRate(double dRate); | |
1a680109 | 1877 | |
6f8c67e7 JS |
1878 | virtual double GetVolume(); |
1879 | virtual bool SetVolume(double); | |
1880 | ||
ff4aedc5 RN |
1881 | void Cleanup(); |
1882 | void FinishLoad(); | |
1a680109 | 1883 | |
c5191fbd | 1884 | static void PPRMProc (Movie theMovie, OSErr theErr, void* theRefCon); |
b1ec2381 DS |
1885 | |
1886 | // TODO: Last param actually long - does this work on 64bit machines? | |
09e28f7f | 1887 | static Boolean MCFilterProc(MovieController theController, |
c5191fbd VZ |
1888 | short action, void *params, LONG_PTR refCon); |
1889 | ||
1890 | static LRESULT CALLBACK QTWndProc(HWND, UINT, WPARAM, LPARAM); | |
1891 | ||
1892 | virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags); | |
1893 | ||
b1ec2381 DS |
1894 | wxSize m_bestSize; // Original movie size |
1895 | Movie m_movie; // QT Movie handle/instance | |
1896 | bool m_bVideo; // Whether or not we have video | |
1897 | bool m_bPlaying; // Whether or not movie is playing | |
1898 | wxTimer* m_timer; // Load or Play timer | |
1899 | wxQuickTimeLibrary m_lib; // DLL to load functions from | |
1900 | ComponentInstance m_pMC; // Movie Controller | |
d7a9c895 | 1901 | |
bf354396 | 1902 | friend class wxQTMediaEvtHandler; |
9d7d3b1f | 1903 | |
19b6f122 | 1904 | DECLARE_DYNAMIC_CLASS(wxQTMediaBackend) |
ff4aedc5 | 1905 | }; |
1a680109 | 1906 | |
6ab9bf57 VZ |
1907 | // helper to hijack background erasing for the QT window |
1908 | class WXDLLIMPEXP_MEDIA wxQTMediaEvtHandler : public wxEvtHandler | |
1909 | { | |
1910 | public: | |
7e41b689 VZ |
1911 | wxQTMediaEvtHandler(wxQTMediaBackend *qtb, WXHWND hwnd) |
1912 | { | |
1913 | m_qtb = qtb; | |
1914 | m_hwnd = hwnd; | |
bf354396 VZ |
1915 | |
1916 | m_qtb->m_ctrl->Connect(m_qtb->m_ctrl->GetId(), | |
7ec69821 | 1917 | wxEVT_ERASE_BACKGROUND, |
bf354396 | 1918 | wxEraseEventHandler(wxQTMediaEvtHandler::OnEraseBackground), |
b1ec2381 | 1919 | NULL, this); |
7e41b689 | 1920 | } |
6ab9bf57 VZ |
1921 | |
1922 | void OnEraseBackground(wxEraseEvent& event); | |
1923 | ||
1924 | private: | |
1925 | wxQTMediaBackend *m_qtb; | |
7e41b689 | 1926 | WXHWND m_hwnd; |
6ab9bf57 VZ |
1927 | |
1928 | DECLARE_NO_COPY_CLASS(wxQTMediaEvtHandler) | |
1929 | }; | |
1930 | ||
1a680109 | 1931 | |
ff4aedc5 RN |
1932 | //=========================================================================== |
1933 | // IMPLEMENTATION | |
1934 | //=========================================================================== | |
1a680109 | 1935 | |
b1ec2381 | 1936 | //--------------------------------------------------------------------------- |
ff4aedc5 | 1937 | // wxAMMediaBackend |
b1ec2381 | 1938 | //--------------------------------------------------------------------------- |
1a680109 | 1939 | |
412e0d47 | 1940 | IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend) |
1a680109 | 1941 | |
ff4aedc5 RN |
1942 | //--------------------------------------------------------------------------- |
1943 | // Usual debugging macros | |
1944 | //--------------------------------------------------------------------------- | |
1945 | #ifdef __WXDEBUG__ | |
920a7c15 | 1946 | #define MAX_ERROR_TEXT_LEN 160 |
a3c1ce50 | 1947 | |
b1ec2381 | 1948 | // Get the error string for Active Movie |
a3c1ce50 JS |
1949 | wxString wxAMMediaBackend::GetErrorString(HRESULT hrdsv) |
1950 | { | |
32f65e50 | 1951 | wxChar szError[MAX_ERROR_TEXT_LEN]; |
b1ec2381 DS |
1952 | if ( m_lpAMGetErrorText != NULL && |
1953 | (*m_lpAMGetErrorText)(hrdsv, szError, MAX_ERROR_TEXT_LEN) == 0) | |
32f65e50 | 1954 | { |
a3c1ce50 | 1955 | return wxString::Format(wxT("DirectShow error \"%s\" \n") |
c5191fbd | 1956 | wxT("(numeric %X)\n") |
6a17b868 | 1957 | wxT("occurred"), |
c5191fbd | 1958 | szError, (int)hrdsv); |
32f65e50 WS |
1959 | } |
1960 | else | |
1961 | { | |
c5191fbd VZ |
1962 | return wxString::Format(wxT("Unknown error \n") |
1963 | wxT("(numeric %X)\n") | |
6a17b868 | 1964 | wxT("occurred"), |
c5191fbd | 1965 | (int)hrdsv); |
32f65e50 | 1966 | } |
1a680109 | 1967 | } |
a3c1ce50 | 1968 | |
c5191fbd VZ |
1969 | #define wxAMFAIL(x) wxFAIL_MSG(GetErrorString(x)); |
1970 | #define wxVERIFY(x) wxASSERT((x)) | |
1971 | #define wxAMLOG(x) wxLogDebug(GetErrorString(x)) | |
1972 | #else | |
c5191fbd VZ |
1973 | #define wxVERIFY(x) (x) |
1974 | #define wxAMLOG(x) | |
1975 | #define wxAMFAIL(x) | |
1976 | #endif | |
1977 | ||
1978 | //--------------------------------------------------------------------------- | |
1979 | // Standard macros for ease of use | |
1980 | //--------------------------------------------------------------------------- | |
1981 | #define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; } | |
1982 | ||
1983 | //--------------------------------------------------------------------------- | |
1984 | // wxAMLoadTimer | |
1985 | // | |
1986 | // Queries the control periodically to see if it has reached the point | |
1987 | // in its loading cycle where we can begin playing the media - if so | |
1988 | // then we finish up some things like getting the original size of the video | |
1989 | // and then sending the loaded event to our handler | |
1990 | //--------------------------------------------------------------------------- | |
1991 | class wxAMLoadTimer : public wxTimer | |
1992 | { | |
1993 | public: | |
1994 | wxAMLoadTimer(wxAMMediaBackend* parent) : | |
1995 | m_parent(parent) {} | |
1996 | ||
1997 | void Notify() | |
1998 | { | |
c137ddc9 | 1999 | if (m_parent->GetMP()) |
c5191fbd VZ |
2000 | { |
2001 | MPReadyStateConstants nState; | |
9d7d3b1f | 2002 | |
c137ddc9 JS |
2003 | #ifdef __WXWINCE__ //Cast to long needed for IWMP (??) |
2004 | m_parent->GetMP()->get_ReadyState((long*)&nState); | |
2005 | #else | |
2006 | m_parent->GetMP()->get_ReadyState(&nState); | |
2007 | #endif | |
9d7d3b1f | 2008 | |
b1ec2381 | 2009 | if (nState != mpReadyStateLoading) |
c5191fbd VZ |
2010 | { |
2011 | Stop(); | |
2012 | m_parent->FinishLoad(); | |
2013 | delete this; | |
2014 | } | |
2015 | } | |
2016 | else | |
2017 | { | |
2018 | IActiveMovie2* pAM2 = NULL; | |
2019 | ReadyStateConstants nState; | |
c137ddc9 | 2020 | if (m_parent->GetAM()->QueryInterface(IID_IActiveMovie2, (void**)&pAM2) == 0 |
b1ec2381 | 2021 | && pAM2->get_ReadyState(&nState) == 0) |
c5191fbd VZ |
2022 | { |
2023 | pAM2->Release(); | |
b1ec2381 | 2024 | if (nState != amvLoading) |
c5191fbd VZ |
2025 | { |
2026 | Stop(); | |
2027 | m_parent->FinishLoad(); | |
2028 | delete this; | |
2029 | } | |
2030 | } | |
2031 | else | |
2032 | { | |
b1ec2381 | 2033 | if (pAM2) |
c5191fbd VZ |
2034 | pAM2->Release(); |
2035 | ||
2036 | Stop(); | |
2037 | m_parent->FinishLoad(); | |
2038 | delete this; | |
2039 | } | |
2040 | } | |
c5191fbd VZ |
2041 | } |
2042 | ||
2043 | protected: | |
9d7d3b1f | 2044 | wxAMMediaBackend* m_parent; // Backend pointer |
c5191fbd VZ |
2045 | }; |
2046 | ||
2047 | //--------------------------------------------------------------------------- | |
2048 | // wxAMPlayTimer | |
2049 | // | |
2050 | // Sets m_hNotifyWnd to NULL to signify that we haven't loaded anything yet | |
2051 | // Queries the control periodically to see if it has stopped - | |
2052 | // if it has it sends the stop event | |
2053 | //--------------------------------------------------------------------------- | |
2054 | class wxAMPlayTimer : public wxTimer | |
2055 | { | |
2056 | public: | |
2057 | wxAMPlayTimer(wxAMMediaBackend* parent) : | |
2058 | m_parent(parent) {} | |
2059 | ||
2060 | void Notify() | |
2061 | { | |
09e28f7f DS |
2062 | // NB: Stop events could get triggered by the interface |
2063 | // if ShowPlayerControls is enabled, so the "GetPosition == GetDuration" | |
2064 | // hack is needed here to make an attempt at it not getting sent | |
2065 | // - but its far from ideal - they can still get sent in some cases | |
b1ec2381 DS |
2066 | if (m_parent->GetState() == wxMEDIASTATE_STOPPED && |
2067 | m_parent->GetPosition() == m_parent->GetDuration()) | |
c5191fbd | 2068 | { |
7e41b689 | 2069 | if ( m_parent->SendStopEvent() ) |
c5191fbd | 2070 | { |
b1ec2381 | 2071 | // seek to beginning of movie |
c5191fbd VZ |
2072 | m_parent->wxAMMediaBackend::SetPosition(0); |
2073 | Stop(); | |
2074 | ||
b1ec2381 | 2075 | // send the event to our child |
7e41b689 | 2076 | m_parent->QueueFinishEvent(); |
c5191fbd VZ |
2077 | } |
2078 | } | |
2079 | } | |
2080 | ||
2081 | protected: | |
2082 | wxAMMediaBackend* m_parent; //Backend pointer | |
2083 | }; | |
2084 | ||
2085 | ||
b1ec2381 | 2086 | #if 0 |
c5191fbd VZ |
2087 | // The following is an alternative way - but it doesn't seem |
2088 | // to work with the IActiveMovie control - it probably processes | |
2089 | // its own events | |
2090 | //--------------------------------------------------------------------------- | |
2091 | // wxAMPlayTimer | |
2092 | // | |
2093 | // Query the IMediaEvent interface from the embedded WMP's | |
2094 | // filtergraph, then process the events from it - sending | |
2095 | // EC_COMPLETE events as stop events to the media control. | |
2096 | //--------------------------------------------------------------------------- | |
2097 | class wxAMPlayTimer : public wxTimer | |
2098 | { | |
2099 | public: | |
2100 | wxAMPlayTimer(wxAMMediaBackend* pBE) : m_pBE(pBE), m_pME(NULL) | |
2101 | { | |
2102 | HRESULT hr; | |
2103 | IUnknown* pGB; | |
c137ddc9 | 2104 | hr = m_pBE->GetAM()->get_FilterGraph(&pGB); |
c5191fbd VZ |
2105 | wxASSERT(SUCCEEDED(hr)); |
2106 | hr = pGB->QueryInterface(IID_IMediaEvent, (void**)&m_pME); | |
2107 | wxASSERT(SUCCEEDED(hr)); | |
2108 | pGB->Release(); | |
2109 | } | |
2110 | ||
d3c7fc99 | 2111 | virtual ~wxAMPlayTimer() |
c5191fbd VZ |
2112 | { |
2113 | SAFE_RELEASE(m_pME); | |
2114 | } | |
2115 | ||
2116 | void Notify() | |
2117 | { | |
2118 | LONG evCode; | |
6591df24 | 2119 | LONG_PTR evParam1, evParam2; |
c5191fbd | 2120 | |
c5191fbd | 2121 | // DirectShow keeps a list of queued events, and we need |
6591df24 | 2122 | // to go through them one by one, stopping at (hopefully only one) |
c5191fbd | 2123 | // EC_COMPLETE message |
6591df24 | 2124 | while ( m_pME->GetEvent(&evCode, &evParam1, &evParam2, 0) == 0 ) |
c5191fbd VZ |
2125 | { |
2126 | // Cleanup memory that GetEvent allocated | |
6591df24 | 2127 | HRESULT hr = m_pME->FreeEventParams(evCode, evParam1, evParam2); |
b1ec2381 | 2128 | if (hr != 0) |
c5191fbd | 2129 | { |
6591df24 DS |
2130 | // Even though this makes a messagebox, this is Windows, |
2131 | // where we can do GUI stuff in separate threads :) | |
c5191fbd VZ |
2132 | wxFAIL_MSG(m_pBE->GetErrorString(hr)); |
2133 | } | |
2134 | // If this is the end of the clip, notify handler | |
b1ec2381 | 2135 | else if (1 == evCode) // EC_COMPLETE |
c5191fbd | 2136 | { |
7e41b689 | 2137 | if ( m_pBE->SendStopEvent() ) |
c5191fbd VZ |
2138 | { |
2139 | Stop(); | |
7e41b689 | 2140 | m_pBE->QueueFinishEvent(); |
c5191fbd VZ |
2141 | } |
2142 | } | |
2143 | } | |
2144 | } | |
1a680109 | 2145 | |
c5191fbd | 2146 | protected: |
b1ec2381 DS |
2147 | wxAMMediaBackend* m_pBE; // Backend pointer |
2148 | IMediaEvent* m_pME; // To determine when to send stop event | |
c5191fbd | 2149 | }; |
b1ec2381 | 2150 | #endif |
1a680109 | 2151 | |
ff4aedc5 RN |
2152 | //--------------------------------------------------------------------------- |
2153 | // wxAMMediaBackend Constructor | |
226ec5a7 | 2154 | //--------------------------------------------------------------------------- |
32f65e50 | 2155 | wxAMMediaBackend::wxAMMediaBackend() |
c5191fbd | 2156 | :m_pAX(NULL), |
c137ddc9 JS |
2157 | #ifdef __WXWINCE__ |
2158 | m_pWMP(NULL), | |
2159 | #else | |
c5191fbd VZ |
2160 | m_pAM(NULL), |
2161 | m_pMP(NULL), | |
c137ddc9 | 2162 | #endif |
c5191fbd | 2163 | m_pTimer(NULL) |
1a680109 | 2164 | { |
1a680109 RN |
2165 | } |
2166 | ||
ff4aedc5 RN |
2167 | //--------------------------------------------------------------------------- |
2168 | // wxAMMediaBackend Destructor | |
226ec5a7 | 2169 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2170 | wxAMMediaBackend::~wxAMMediaBackend() |
1a680109 | 2171 | { |
6591df24 DS |
2172 | // Free memory from Load() |
2173 | Clear(); | |
c5191fbd | 2174 | |
b1ec2381 | 2175 | if (m_pAX) |
c5191fbd | 2176 | { |
9d7d3b1f | 2177 | m_pAX->DissociateHandle(); |
c5191fbd | 2178 | delete m_pAX; |
9d7d3b1f | 2179 | |
c137ddc9 | 2180 | #ifndef __WXWINCE__ |
c5191fbd | 2181 | m_pAM->Release(); |
c137ddc9 | 2182 | #endif |
c5191fbd | 2183 | |
c137ddc9 JS |
2184 | if (GetMP()) |
2185 | GetMP()->Release(); | |
c5191fbd | 2186 | } |
1a680109 RN |
2187 | } |
2188 | ||
1a680109 | 2189 | //--------------------------------------------------------------------------- |
c5191fbd | 2190 | // wxAMMediaBackend::Clear |
1a680109 | 2191 | // |
c5191fbd VZ |
2192 | // Free up interfaces and memory allocated by LoadXXX |
2193 | //--------------------------------------------------------------------------- | |
2194 | void wxAMMediaBackend::Clear() | |
2195 | { | |
b1ec2381 | 2196 | if (m_pTimer) |
f3ebbc0a | 2197 | { |
c5191fbd | 2198 | delete m_pTimer; |
f3ebbc0a RD |
2199 | m_pTimer = NULL; |
2200 | } | |
c5191fbd VZ |
2201 | } |
2202 | ||
2203 | //--------------------------------------------------------------------------- | |
2204 | // wxAMMediaBackend::CreateControl | |
226ec5a7 WS |
2205 | //--------------------------------------------------------------------------- |
2206 | bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, | |
ff4aedc5 | 2207 | wxWindowID id, |
226ec5a7 | 2208 | const wxPoint& pos, |
ff4aedc5 | 2209 | const wxSize& size, |
226ec5a7 | 2210 | long style, |
ff4aedc5 RN |
2211 | const wxValidator& validator, |
2212 | const wxString& name) | |
226ec5a7 | 2213 | { |
9d7d3b1f DS |
2214 | // First get the AMGetErrorText procedure in |
2215 | // debug mode for more meaningful messages | |
920a7c15 | 2216 | #ifdef __WXDEBUG__ |
aa200e97 | 2217 | if ( m_dllQuartz.Load(_T("quartz.dll"), wxDL_VERBATIM) ) |
920a7c15 | 2218 | { |
aa200e97 VZ |
2219 | m_lpAMGetErrorText = (LPAMGETERRORTEXT) |
2220 | m_dllQuartz.GetSymbolAorW(wxT("AMGetErrorText")); | |
920a7c15 | 2221 | } |
b1ec2381 | 2222 | #endif |
aa200e97 | 2223 | |
be96ed8c JS |
2224 | #ifdef __WXWINCE__ |
2225 | CLSID clsid; | |
be96ed8c | 2226 | |
9d7d3b1f DS |
2227 | // Try progids first - *.WMP is PocketPC and Mediaplayer.1 is CE.NET |
2228 | // later versions support straight creation from CLSID | |
c137ddc9 JS |
2229 | if (CLSIDFromProgID(L"WPCEOCX.WMP", &clsid) != S_OK && |
2230 | CLSIDFromProgID(L"MediaPlayer.MediaPlayer.1", &clsid) != S_OK) | |
2231 | { | |
2232 | clsid = CLSID_MediaPlayer; | |
2233 | } | |
2234 | ||
9d7d3b1f DS |
2235 | // While the CLSID is the same as CLSID_MediaPlayer |
2236 | // CE only supports the IWMP interface | |
be96ed8c JS |
2237 | if ( ::CoCreateInstance(clsid, NULL, |
2238 | CLSCTX_INPROC_SERVER, | |
c137ddc9 | 2239 | IID_IWMP, (void**)&m_pWMP) != 0 ) |
be96ed8c JS |
2240 | { |
2241 | return false; | |
2242 | } | |
c137ddc9 | 2243 | |
be96ed8c JS |
2244 | #else |
2245 | // determine which (if any) media player interface | |
2246 | // is available - IMediaPlayer or IActiveMovie | |
2247 | if ( ::CoCreateInstance(CLSID_MediaPlayer, NULL, | |
2248 | CLSCTX_INPROC_SERVER, | |
2249 | IID_IMediaPlayer, (void**)&m_pMP) != 0 ) | |
2250 | { | |
2251 | if ( ::CoCreateInstance(CLSID_ActiveMovie, NULL, | |
2252 | CLSCTX_INPROC_SERVER, | |
2253 | IID_IActiveMovie, (void**)&m_pAM) != 0 ) | |
2254 | { | |
2255 | return false; | |
2256 | } | |
2257 | ||
2258 | m_pAM->QueryInterface(IID_IMediaPlayer, (void**)&m_pMP); | |
2259 | } | |
2260 | else | |
2261 | { | |
2262 | m_pMP->QueryInterface(IID_IActiveMovie, (void**)&m_pAM); | |
2263 | } | |
2264 | #endif | |
b1ec2381 | 2265 | |
ff4aedc5 RN |
2266 | // Create window |
2267 | // By default wxWindow(s) is created with a border - | |
c5191fbd VZ |
2268 | // so we need to get rid of those |
2269 | // | |
2270 | // Since we don't have a child window like most other | |
2271 | // backends, we don't need wxCLIP_CHILDREN | |
ff4aedc5 | 2272 | if ( !ctrl->wxControl::Create(parent, id, pos, size, |
c5191fbd | 2273 | (style & ~wxBORDER_MASK) | wxBORDER_NONE, |
ff4aedc5 | 2274 | validator, name) ) |
6591df24 | 2275 | { |
ff4aedc5 | 2276 | return false; |
6591df24 | 2277 | } |
1a680109 | 2278 | |
6591df24 | 2279 | // Create the ActiveX container along with the media player |
c5191fbd | 2280 | // interface and query them |
bf354396 VZ |
2281 | m_ctrl = wxStaticCast(ctrl, wxMediaCtrl); |
2282 | m_pAX = new wxActiveXContainer(ctrl, | |
c137ddc9 JS |
2283 | #ifdef __WXWINCE__ |
2284 | IID_IWMP, m_pWMP | |
2285 | #else | |
2286 | m_pMP ? IID_IMediaPlayer : IID_IActiveMovie, m_pAM | |
2287 | #endif | |
2288 | ); | |
ff4aedc5 | 2289 | |
6591df24 DS |
2290 | // Set up wx-specific stuff for the default |
2291 | // settings wxMediaCtrl says it will conform to (???) | |
c137ddc9 | 2292 | if (GetMP()) |
1a680109 | 2293 | { |
c137ddc9 | 2294 | GetMP()->put_DisplaySize(mpFitToSize); |
b1ec2381 | 2295 | |
09e28f7f | 2296 | #ifndef __WXWINCE__ // Not in CE's IWMP |
c5191fbd | 2297 | // TODO: Unsure what actual effect this has |
c137ddc9 JS |
2298 | GetMP()->put_WindowlessVideo(VARIANT_TRUE); |
2299 | #endif | |
1a680109 | 2300 | } |
09e28f7f | 2301 | #ifndef __WXWINCE__ // Not in CE's IWMP |
920a7c15 | 2302 | else |
c137ddc9 JS |
2303 | GetAM()->put_MovieWindowSize(amvDoubleOriginalSize); |
2304 | #endif | |
c5191fbd | 2305 | |
b1ec2381 | 2306 | // by default true |
c137ddc9 | 2307 | GetAM()->put_AutoStart(VARIANT_FALSE); |
b1ec2381 DS |
2308 | |
2309 | // by default enabled | |
c5191fbd | 2310 | wxAMMediaBackend::ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_NONE); |
b1ec2381 DS |
2311 | |
2312 | // by default with AM only 0.5 | |
c5191fbd VZ |
2313 | wxAMMediaBackend::SetVolume(1.0); |
2314 | ||
b1ec2381 DS |
2315 | // don't erase the background of our control window |
2316 | // so that resizing is a bit smoother | |
6ab9bf57 | 2317 | m_ctrl->SetBackgroundStyle(wxBG_STYLE_CUSTOM); |
ff4aedc5 | 2318 | |
c5191fbd | 2319 | // success |
32f65e50 | 2320 | return true; |
920a7c15 | 2321 | } |
1a680109 | 2322 | |
920a7c15 JS |
2323 | //--------------------------------------------------------------------------- |
2324 | // wxAMMediaBackend::Load (file version) | |
920a7c15 JS |
2325 | //--------------------------------------------------------------------------- |
2326 | bool wxAMMediaBackend::Load(const wxString& fileName) | |
2327 | { | |
c5191fbd VZ |
2328 | return DoLoad(fileName); |
2329 | } | |
920a7c15 | 2330 | |
c5191fbd VZ |
2331 | //--------------------------------------------------------------------------- |
2332 | // wxAMMediaBackend::Load (URL Version) | |
2333 | //--------------------------------------------------------------------------- | |
2334 | bool wxAMMediaBackend::Load(const wxURI& location) | |
2335 | { | |
6591df24 | 2336 | // Turn off loading from a proxy, as user may have set it previously |
c5191fbd | 2337 | INSPlay* pPlay = NULL; |
c137ddc9 | 2338 | GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay); |
b1ec2381 | 2339 | if (pPlay) |
c5191fbd VZ |
2340 | { |
2341 | pPlay->put_UseHTTPProxy(VARIANT_FALSE); | |
2342 | pPlay->Release(); | |
2343 | } | |
920a7c15 | 2344 | |
c5191fbd VZ |
2345 | return DoLoad(location.BuildURI()); |
2346 | } | |
920a7c15 | 2347 | |
c5191fbd VZ |
2348 | //--------------------------------------------------------------------------- |
2349 | // wxAMMediaBackend::Load (URL Version with Proxy) | |
2350 | //--------------------------------------------------------------------------- | |
2351 | bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy) | |
2352 | { | |
2353 | // Set the proxy of the NETSHOW interface | |
2354 | INSPlay* pPlay = NULL; | |
c137ddc9 | 2355 | GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay); |
a3c1ce50 | 2356 | |
b1ec2381 | 2357 | if (pPlay) |
920a7c15 | 2358 | { |
c5191fbd VZ |
2359 | pPlay->put_UseHTTPProxy(VARIANT_TRUE); |
2360 | pPlay->put_HTTPProxyHost(wxBasicString(proxy.GetServer()).Get()); | |
2361 | pPlay->put_HTTPProxyPort(wxAtoi(proxy.GetPort())); | |
2362 | pPlay->Release(); | |
ff4aedc5 | 2363 | } |
226ec5a7 | 2364 | |
c5191fbd VZ |
2365 | return DoLoad(location.BuildURI()); |
2366 | } | |
1a680109 | 2367 | |
c5191fbd VZ |
2368 | //--------------------------------------------------------------------------- |
2369 | // wxAMMediaBackend::DoLoad | |
2370 | // | |
2371 | // Called by all functions - this actually renders | |
2372 | // the file and sets up the filter graph | |
2373 | //--------------------------------------------------------------------------- | |
2374 | bool wxAMMediaBackend::DoLoad(const wxString& location) | |
2375 | { | |
6591df24 DS |
2376 | //Clear up previously allocated memory |
2377 | Clear(); | |
a3c1ce50 | 2378 | |
c5191fbd VZ |
2379 | HRESULT hr; |
2380 | ||
6591df24 DS |
2381 | // Play the movie the normal way through the embedded WMP. |
2382 | // Supposedly, Open is better in theory because | |
c5191fbd | 2383 | // the docs say its async and put_FileName is not - |
6591df24 | 2384 | // but in practice they both appear to be async anyway |
c137ddc9 JS |
2385 | if (GetMP()) |
2386 | hr = GetMP()->Open( wxBasicString(location).Get() ); | |
c5191fbd | 2387 | else |
c137ddc9 | 2388 | hr = GetAM()->put_FileName( wxBasicString(location).Get() ); |
a3c1ce50 | 2389 | |
b1ec2381 | 2390 | if (FAILED(hr)) |
a3c1ce50 JS |
2391 | { |
2392 | wxAMLOG(hr); | |
2393 | return false; | |
2394 | } | |
2395 | ||
c5191fbd VZ |
2396 | // In AM playing will FAIL if |
2397 | // the user plays before the media is loaded | |
2398 | m_pTimer = new wxAMLoadTimer(this); | |
2399 | m_pTimer->Start(20); | |
b1ec2381 | 2400 | |
c5191fbd VZ |
2401 | return true; |
2402 | } | |
2403 | ||
2404 | //--------------------------------------------------------------------------- | |
2405 | // wxAMMediaBackend::FinishLoad | |
2406 | // | |
2407 | // Called by our wxAMLoadTimer when the | |
2408 | // embedded WMP tells its the media is ready to play. | |
2409 | // | |
2410 | // Here we get the original size of the video and | |
2411 | // send the loaded event to our watcher :). | |
2412 | //--------------------------------------------------------------------------- | |
2413 | void wxAMMediaBackend::FinishLoad() | |
2414 | { | |
09e28f7f | 2415 | // Get the original video size |
c137ddc9 JS |
2416 | GetAM()->get_ImageSourceWidth((long*)&m_bestSize.x); |
2417 | GetAM()->get_ImageSourceHeight((long*)&m_bestSize.y); | |
1a680109 | 2418 | |
6591df24 DS |
2419 | // Start the play timer to catch stop events |
2420 | // Previous load timer cleans up itself | |
c5191fbd | 2421 | m_pTimer = new wxAMPlayTimer(this); |
96339a78 | 2422 | |
7e41b689 | 2423 | NotifyMovieLoaded(); |
1a680109 RN |
2424 | } |
2425 | ||
a3c1ce50 | 2426 | //--------------------------------------------------------------------------- |
c5191fbd | 2427 | // wxAMMediaBackend::ShowPlayerControls |
a3c1ce50 | 2428 | //--------------------------------------------------------------------------- |
c5191fbd | 2429 | bool wxAMMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) |
a3c1ce50 | 2430 | { |
c5191fbd VZ |
2431 | // Note that IMediaPlayer doesn't have a statusbar by |
2432 | // default but IActiveMovie does - so lets try to keep | |
2433 | // the interface consistant | |
b1ec2381 | 2434 | if (!flags) |
c5191fbd | 2435 | { |
c137ddc9 JS |
2436 | GetAM()->put_Enabled(VARIANT_FALSE); |
2437 | GetAM()->put_ShowControls(VARIANT_FALSE); | |
2438 | if (GetMP()) | |
2439 | GetMP()->put_ShowStatusBar(VARIANT_FALSE); | |
c5191fbd VZ |
2440 | } |
2441 | else | |
a3c1ce50 | 2442 | { |
c137ddc9 JS |
2443 | GetAM()->put_Enabled(VARIANT_TRUE); |
2444 | GetAM()->put_ShowControls(VARIANT_TRUE); | |
c5191fbd | 2445 | |
c137ddc9 | 2446 | GetAM()->put_ShowPositionControls( |
c5191fbd VZ |
2447 | (flags & wxMEDIACTRLPLAYERCONTROLS_STEP) ? |
2448 | VARIANT_TRUE : VARIANT_FALSE); | |
2449 | ||
c137ddc9 | 2450 | if (GetMP()) |
c5191fbd | 2451 | { |
c137ddc9 JS |
2452 | GetMP()->put_ShowStatusBar(VARIANT_TRUE); |
2453 | GetMP()->put_ShowAudioControls( | |
c5191fbd VZ |
2454 | (flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME) ? |
2455 | VARIANT_TRUE : VARIANT_FALSE); | |
2456 | } | |
a3c1ce50 JS |
2457 | } |
2458 | ||
c5191fbd | 2459 | return true; |
a3c1ce50 JS |
2460 | } |
2461 | ||
ff4aedc5 RN |
2462 | //--------------------------------------------------------------------------- |
2463 | // wxAMMediaBackend::Play | |
2464 | // | |
920a7c15 JS |
2465 | // Plays the stream. If it is non-seekable, it will restart it (implicit). |
2466 | // | |
2467 | // Note that we use SUCCEEDED here because run/pause/stop tend to be overly | |
2468 | // picky and return warnings on pretty much every call | |
226ec5a7 | 2469 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2470 | bool wxAMMediaBackend::Play() |
1a680109 | 2471 | { |
f3ebbc0a | 2472 | // Actually try to play the movie, even though it may not be loaded yet. |
c137ddc9 JS |
2473 | #ifdef __WXWINCE__ |
2474 | HRESULT hr = m_pWMP->Play(); | |
2475 | #else | |
2476 | HRESULT hr = GetAM()->Run(); | |
2477 | #endif | |
b1ec2381 | 2478 | if (SUCCEEDED(hr)) |
920a7c15 | 2479 | { |
c5191fbd | 2480 | m_pTimer->Start(20); |
920a7c15 JS |
2481 | return true; |
2482 | } | |
b1ec2381 | 2483 | |
c5191fbd | 2484 | wxAMLOG(hr); |
b1ec2381 | 2485 | |
920a7c15 | 2486 | return false; |
1a680109 RN |
2487 | } |
2488 | ||
ff4aedc5 RN |
2489 | //--------------------------------------------------------------------------- |
2490 | // wxAMMediaBackend::Pause | |
2491 | // | |
2492 | // Pauses the stream. | |
226ec5a7 | 2493 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2494 | bool wxAMMediaBackend::Pause() |
1a680109 | 2495 | { |
c137ddc9 | 2496 | HRESULT hr = GetAM()->Pause(); |
b1ec2381 | 2497 | if (SUCCEEDED(hr)) |
920a7c15 | 2498 | return true; |
b1ec2381 | 2499 | |
c5191fbd | 2500 | wxAMLOG(hr); |
b1ec2381 | 2501 | |
920a7c15 | 2502 | return false; |
1a680109 RN |
2503 | } |
2504 | ||
ff4aedc5 RN |
2505 | //--------------------------------------------------------------------------- |
2506 | // wxAMMediaBackend::Stop | |
2507 | // | |
2508 | // Stops the stream. | |
226ec5a7 | 2509 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2510 | bool wxAMMediaBackend::Stop() |
1a680109 | 2511 | { |
c137ddc9 | 2512 | HRESULT hr = GetAM()->Stop(); |
b1ec2381 | 2513 | if (SUCCEEDED(hr)) |
920a7c15 | 2514 | { |
b1ec2381 | 2515 | // Seek to beginning |
920a7c15 | 2516 | wxAMMediaBackend::SetPosition(0); |
b1ec2381 DS |
2517 | |
2518 | // Stop stop event timer | |
c5191fbd | 2519 | m_pTimer->Stop(); |
920a7c15 JS |
2520 | return true; |
2521 | } | |
b1ec2381 | 2522 | |
c5191fbd | 2523 | wxAMLOG(hr); |
b1ec2381 | 2524 | |
920a7c15 | 2525 | return false; |
1a680109 RN |
2526 | } |
2527 | ||
ff4aedc5 RN |
2528 | //--------------------------------------------------------------------------- |
2529 | // wxAMMediaBackend::SetPosition | |
2530 | // | |
226ec5a7 | 2531 | // 1) Translates the current position's time to directshow time, |
a2a444e3 | 2532 | // which is in a scale of 1 second (in a double) |
ff4aedc5 RN |
2533 | // 2) Sets the play position of the IMediaSeeking interface - |
2534 | // passing NULL as the stop position means to keep the old | |
2535 | // stop position | |
226ec5a7 | 2536 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2537 | bool wxAMMediaBackend::SetPosition(wxLongLong where) |
1a680109 | 2538 | { |
c137ddc9 | 2539 | HRESULT hr = GetAM()->put_CurrentPosition( |
09e28f7f | 2540 | ((LONGLONG)where.GetValue()) / 1000.0 ); |
b1ec2381 | 2541 | if (FAILED(hr)) |
a3c1ce50 JS |
2542 | { |
2543 | wxAMLOG(hr); | |
2544 | return false; | |
2545 | } | |
2546 | ||
2547 | return true; | |
1a680109 RN |
2548 | } |
2549 | ||
ff4aedc5 RN |
2550 | //--------------------------------------------------------------------------- |
2551 | // wxAMMediaBackend::GetPosition | |
2552 | // | |
2553 | // 1) Obtains the current play and stop positions from IMediaSeeking | |
2554 | // 2) Returns the play position translated to our time base | |
226ec5a7 | 2555 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2556 | wxLongLong wxAMMediaBackend::GetPosition() |
1a680109 | 2557 | { |
a2a444e3 | 2558 | double outCur; |
c137ddc9 | 2559 | HRESULT hr = GetAM()->get_CurrentPosition(&outCur); |
b1ec2381 | 2560 | if (FAILED(hr)) |
a3c1ce50 JS |
2561 | { |
2562 | wxAMLOG(hr); | |
2563 | return 0; | |
2564 | } | |
1a680109 | 2565 | |
b1ec2381 | 2566 | // h,m,s,milli - outdur is in 1 second (double) |
600ffb32 WS |
2567 | outCur *= 1000; |
2568 | wxLongLong ll; | |
2569 | ll.Assign(outCur); | |
2570 | ||
2571 | return ll; | |
1a680109 RN |
2572 | } |
2573 | ||
6f8c67e7 | 2574 | //--------------------------------------------------------------------------- |
a3c1ce50 | 2575 | // wxAMMediaBackend::GetVolume |
6f8c67e7 | 2576 | // |
a3c1ce50 | 2577 | // Gets the volume through the IBasicAudio interface - |
6f8c67e7 JS |
2578 | // value ranges from 0 (MAX volume) to -10000 (minimum volume). |
2579 | // -100 per decibel. | |
2580 | //--------------------------------------------------------------------------- | |
a3c1ce50 | 2581 | double wxAMMediaBackend::GetVolume() |
b11eba7e | 2582 | { |
b1ec2381 | 2583 | long lVolume; |
c137ddc9 | 2584 | HRESULT hr = GetAM()->get_Volume(&lVolume); |
b1ec2381 DS |
2585 | if (FAILED(hr)) |
2586 | { | |
2587 | wxAMLOG(hr); | |
2588 | return 0.0; | |
a3c1ce50 | 2589 | } |
b1ec2381 DS |
2590 | |
2591 | return pow(10.0, lVolume / 2000.0); | |
b11eba7e | 2592 | } |
6f8c67e7 JS |
2593 | |
2594 | //--------------------------------------------------------------------------- | |
a3c1ce50 | 2595 | // wxAMMediaBackend::SetVolume |
6f8c67e7 | 2596 | // |
a3c1ce50 | 2597 | // Sets the volume through the IBasicAudio interface - |
6f8c67e7 JS |
2598 | // value ranges from 0 (MAX volume) to -10000 (minimum volume). |
2599 | // -100 per decibel. | |
2600 | //--------------------------------------------------------------------------- | |
a3c1ce50 | 2601 | bool wxAMMediaBackend::SetVolume(double dVolume) |
6f8c67e7 | 2602 | { |
b1ec2381 DS |
2603 | // pow(10.0, -80.0) to correct 0 == -INF |
2604 | long lVolume = (long)(2000.0 * log10( pow( 10.0, -80.0) + dVolume ) ); | |
c137ddc9 | 2605 | HRESULT hr = GetAM()->put_Volume( lVolume ); |
b1ec2381 DS |
2606 | if (FAILED(hr)) |
2607 | { | |
2608 | wxAMLOG(hr); | |
2609 | return false; | |
2610 | } | |
2611 | ||
2612 | return true; | |
6f8c67e7 | 2613 | } |
b11eba7e | 2614 | |
ff4aedc5 RN |
2615 | //--------------------------------------------------------------------------- |
2616 | // wxAMMediaBackend::GetDuration | |
2617 | // | |
920a7c15 | 2618 | // 1) Obtains the duration of the media from IAMMultiMediaStream |
ff4aedc5 | 2619 | // 2) Converts that value to our time base, and returns it |
920a7c15 | 2620 | // |
32f65e50 | 2621 | // NB: With VBR MP3 files the default DirectShow MP3 render does not |
920a7c15 JS |
2622 | // read the Xing header correctly, resulting in skewed values for duration |
2623 | // and seeking | |
226ec5a7 | 2624 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2625 | wxLongLong wxAMMediaBackend::GetDuration() |
1a680109 | 2626 | { |
a2a444e3 | 2627 | double outDuration; |
c137ddc9 | 2628 | HRESULT hr = GetAM()->get_Duration(&outDuration); |
b1ec2381 | 2629 | if (FAILED(hr)) |
a3c1ce50 JS |
2630 | { |
2631 | wxAMLOG(hr); | |
2632 | return 0; | |
2633 | } | |
1a680109 | 2634 | |
b1ec2381 | 2635 | // h,m,s,milli - outdur is in 1 second (double) |
600ffb32 WS |
2636 | outDuration *= 1000; |
2637 | wxLongLong ll; | |
2638 | ll.Assign(outDuration); | |
2639 | ||
2640 | return ll; | |
1a680109 RN |
2641 | } |
2642 | ||
ff4aedc5 RN |
2643 | //--------------------------------------------------------------------------- |
2644 | // wxAMMediaBackend::GetState | |
2645 | // | |
920a7c15 | 2646 | // Returns the cached state |
226ec5a7 | 2647 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2648 | wxMediaState wxAMMediaBackend::GetState() |
1a680109 | 2649 | { |
c5191fbd | 2650 | StateConstants nState; |
c137ddc9 JS |
2651 | #ifdef __WXWINCE__ |
2652 | HRESULT hr = m_pWMP->get_PlayState((long*)&nState); | |
2653 | #else | |
2654 | HRESULT hr = GetAM()->get_CurrentState(&nState); | |
2655 | #endif | |
b1ec2381 | 2656 | if (FAILED(hr)) |
c5191fbd VZ |
2657 | { |
2658 | wxAMLOG(hr); | |
2659 | return wxMEDIASTATE_STOPPED; | |
2660 | } | |
2661 | ||
2662 | return (wxMediaState)nState; | |
1a680109 RN |
2663 | } |
2664 | ||
ff4aedc5 RN |
2665 | //--------------------------------------------------------------------------- |
2666 | // wxAMMediaBackend::GetPlaybackRate | |
2667 | // | |
2668 | // Pretty simple way of obtaining the playback rate from | |
2669 | // the IMediaSeeking interface | |
226ec5a7 | 2670 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2671 | double wxAMMediaBackend::GetPlaybackRate() |
1a680109 RN |
2672 | { |
2673 | double dRate; | |
c137ddc9 | 2674 | HRESULT hr = GetAM()->get_Rate(&dRate); |
b1ec2381 | 2675 | if (FAILED(hr)) |
a3c1ce50 JS |
2676 | { |
2677 | wxAMLOG(hr); | |
2678 | return 0.0; | |
2679 | } | |
b1ec2381 | 2680 | |
1a680109 RN |
2681 | return dRate; |
2682 | } | |
2683 | ||
ff4aedc5 RN |
2684 | //--------------------------------------------------------------------------- |
2685 | // wxAMMediaBackend::SetPlaybackRate | |
2686 | // | |
2687 | // Sets the playback rate of the media - DirectShow is pretty good | |
2688 | // about this, actually | |
226ec5a7 | 2689 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2690 | bool wxAMMediaBackend::SetPlaybackRate(double dRate) |
c5191fbd | 2691 | { |
c137ddc9 | 2692 | HRESULT hr = GetAM()->put_Rate(dRate); |
b1ec2381 | 2693 | if (FAILED(hr)) |
c5191fbd VZ |
2694 | { |
2695 | wxAMLOG(hr); | |
2696 | return false; | |
920a7c15 | 2697 | } |
c5191fbd VZ |
2698 | |
2699 | return true; | |
920a7c15 JS |
2700 | } |
2701 | ||
920a7c15 | 2702 | //--------------------------------------------------------------------------- |
c5191fbd | 2703 | // wxAMMediaBackend::GetDownloadXXX |
920a7c15 | 2704 | // |
c5191fbd VZ |
2705 | // Queries for and gets the total size of the file and the current |
2706 | // progress in downloading that file from the IAMOpenProgress | |
2707 | // interface from the media player interface's filter graph | |
920a7c15 | 2708 | //--------------------------------------------------------------------------- |
c5191fbd VZ |
2709 | void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong* pLoadProgress, |
2710 | wxLongLong* pLoadTotal) | |
1a680109 | 2711 | { |
c137ddc9 | 2712 | #ifndef __WXWINCE__ |
c5191fbd VZ |
2713 | LONGLONG loadTotal = 0, loadProgress = 0; |
2714 | IUnknown* pFG; | |
2715 | IAMOpenProgress* pOP; | |
2716 | HRESULT hr; | |
c137ddc9 | 2717 | hr = GetAM()->get_FilterGraph(&pFG); |
b1ec2381 DS |
2718 | if (SUCCEEDED(hr)) |
2719 | { | |
c5191fbd | 2720 | hr = pFG->QueryInterface(IID_IAMOpenProgress, (void**)&pOP); |
b1ec2381 | 2721 | if (SUCCEEDED(hr)) |
c5191fbd VZ |
2722 | { |
2723 | hr = pOP->QueryProgress(&loadTotal, &loadProgress); | |
2724 | pOP->Release(); | |
2725 | } | |
b1ec2381 | 2726 | |
c5191fbd VZ |
2727 | pFG->Release(); |
2728 | } | |
2729 | ||
b1ec2381 DS |
2730 | if (SUCCEEDED(hr)) |
2731 | { | |
c5191fbd VZ |
2732 | *pLoadProgress = loadProgress; |
2733 | *pLoadTotal = loadTotal; | |
b1ec2381 | 2734 | } |
c5191fbd | 2735 | else |
c137ddc9 | 2736 | #endif |
b1ec2381 DS |
2737 | { |
2738 | // When not loading from a URL QueryProgress will return | |
2739 | // E_NOINTERFACE or whatever | |
2740 | // wxAMFAIL(hr); | |
c5191fbd VZ |
2741 | *pLoadProgress = 0; |
2742 | *pLoadTotal = 0; | |
920a7c15 | 2743 | } |
920a7c15 JS |
2744 | } |
2745 | ||
920a7c15 | 2746 | //--------------------------------------------------------------------------- |
c5191fbd | 2747 | // wxAMMediaBackend::GetVideoSize |
920a7c15 | 2748 | // |
c5191fbd | 2749 | // Obtains the cached original video size |
920a7c15 | 2750 | //--------------------------------------------------------------------------- |
c5191fbd | 2751 | wxSize wxAMMediaBackend::GetVideoSize() const |
920a7c15 | 2752 | { |
c5191fbd VZ |
2753 | return m_bestSize; |
2754 | } | |
b81383bb | 2755 | |
c5191fbd VZ |
2756 | //--------------------------------------------------------------------------- |
2757 | // wxAMMediaBackend::Move | |
2758 | // | |
2759 | // We take care of this in our redrawing | |
2760 | //--------------------------------------------------------------------------- | |
2761 | void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), | |
2762 | int WXUNUSED(w), int WXUNUSED(h)) | |
2763 | { | |
1a680109 RN |
2764 | } |
2765 | ||
ff4aedc5 RN |
2766 | //--------------------------------------------------------------------------- |
2767 | // End of wxAMMediaBackend | |
2768 | //--------------------------------------------------------------------------- | |
1a680109 | 2769 | |
9d7d3b1f | 2770 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2771 | // wxMCIMediaBackend |
9d7d3b1f | 2772 | //--------------------------------------------------------------------------- |
ff4aedc5 | 2773 | |
a45d2855 | 2774 | #ifndef __WXWINCE__ |
412e0d47 | 2775 | IMPLEMENT_DYNAMIC_CLASS(wxMCIMediaBackend, wxMediaBackend) |
ff4aedc5 RN |
2776 | |
2777 | //--------------------------------------------------------------------------- | |
2778 | // Usual debugging macros for MCI returns | |
1a680109 RN |
2779 | //--------------------------------------------------------------------------- |
2780 | ||
ff4aedc5 RN |
2781 | #ifdef __WXDEBUG__ |
2782 | #define wxMCIVERIFY(arg) \ | |
2783 | { \ | |
2784 | DWORD nRet; \ | |
2785 | if ( (nRet = (arg)) != 0) \ | |
2786 | { \ | |
2787 | TCHAR sz[5000]; \ | |
2788 | mciGetErrorString(nRet, sz, 5000); \ | |
2789 | wxFAIL_MSG(wxString::Format(_T("MCI Error:%s"), sz)); \ | |
2790 | } \ | |
2791 | } | |
2792 | #else | |
2793 | #define wxMCIVERIFY(arg) (arg); | |
2794 | #endif | |
2795 | ||
2796 | //--------------------------------------------------------------------------- | |
2797 | // Simulation for <digitalv.h> | |
33d8e2fc | 2798 | // |
ff4aedc5 | 2799 | // Mingw and possibly other compilers don't have the digitalv.h header |
226ec5a7 | 2800 | // that is needed to have some essential features of mci work with |
ff4aedc5 RN |
2801 | // windows - so we provide the declarations for the types we use here |
2802 | //--------------------------------------------------------------------------- | |
33d8e2fc | 2803 | |
b1ec2381 DS |
2804 | typedef struct |
2805 | { | |
33d8e2fc RN |
2806 | DWORD_PTR dwCallback; |
2807 | #ifdef MCI_USE_OFFEXT | |
2808 | POINT ptOffset; | |
2809 | POINT ptExtent; | |
226ec5a7 | 2810 | #else |
33d8e2fc RN |
2811 | RECT rc; |
2812 | #endif | |
b1ec2381 DS |
2813 | } |
2814 | MCI_DGV_RECT_PARMS; | |
33d8e2fc | 2815 | |
b1ec2381 DS |
2816 | typedef struct |
2817 | { | |
33d8e2fc RN |
2818 | DWORD_PTR dwCallback; |
2819 | HWND hWnd; | |
2820 | #ifndef _WIN32 | |
2821 | WORD wReserved1; | |
2822 | #endif | |
2823 | UINT nCmdShow; | |
2824 | #ifndef _WIN32 | |
2825 | WORD wReserved2; | |
2826 | #endif | |
ff4aedc5 | 2827 | wxChar* lpstrText; |
b1ec2381 DS |
2828 | } |
2829 | MCI_DGV_WINDOW_PARMS; | |
33d8e2fc | 2830 | |
b1ec2381 DS |
2831 | typedef struct |
2832 | { | |
226ec5a7 WS |
2833 | DWORD_PTR dwCallback; |
2834 | DWORD dwTimeFormat; | |
2835 | DWORD dwAudio; | |
2836 | DWORD dwFileFormat; | |
2837 | DWORD dwSpeed; | |
b1ec2381 DS |
2838 | } |
2839 | MCI_DGV_SET_PARMS; | |
33d8e2fc | 2840 | |
b1ec2381 DS |
2841 | typedef struct |
2842 | { | |
6f8c67e7 JS |
2843 | DWORD_PTR dwCallback; |
2844 | DWORD dwItem; | |
2845 | DWORD dwValue; | |
2846 | DWORD dwOver; | |
2847 | wxChar* lpstrAlgorithm; | |
2848 | wxChar* lpstrQuality; | |
b1ec2381 DS |
2849 | } |
2850 | MCI_DGV_SETAUDIO_PARMS; | |
6f8c67e7 | 2851 | |
ff4aedc5 RN |
2852 | //--------------------------------------------------------------------------- |
2853 | // wxMCIMediaBackend Constructor | |
2854 | // | |
2855 | // Here we don't need to do much except say we don't have any video :) | |
2856 | //--------------------------------------------------------------------------- | |
2857 | wxMCIMediaBackend::wxMCIMediaBackend() : m_hNotifyWnd(NULL), m_bVideo(false) | |
2858 | { | |
3f9a3bf9 RN |
2859 | } |
2860 | ||
ff4aedc5 RN |
2861 | //--------------------------------------------------------------------------- |
2862 | // wxMCIMediaBackend Destructor | |
2863 | // | |
9d7d3b1f | 2864 | // We close the MCI device - note that there may not be an MCI device here, |
ff4aedc5 RN |
2865 | // or it may fail - but we don't really care, since we're destructing |
2866 | //--------------------------------------------------------------------------- | |
2867 | wxMCIMediaBackend::~wxMCIMediaBackend() | |
3f9a3bf9 | 2868 | { |
b1ec2381 | 2869 | if (m_hNotifyWnd) |
ff4aedc5 RN |
2870 | { |
2871 | mciSendCommand(m_hDev, MCI_CLOSE, 0, 0); | |
2872 | DestroyWindow(m_hNotifyWnd); | |
2873 | m_hNotifyWnd = NULL; | |
2874 | } | |
3f9a3bf9 RN |
2875 | } |
2876 | ||
ff4aedc5 RN |
2877 | //--------------------------------------------------------------------------- |
2878 | // wxMCIMediaBackend::Create | |
2879 | // | |
9d7d3b1f | 2880 | // Here we just tell wxMediaCtrl that MCI does exist (which it does, on all |
ff4aedc5 RN |
2881 | // msw systems, at least in some form dating back to win16 days) |
2882 | //--------------------------------------------------------------------------- | |
226ec5a7 | 2883 | bool wxMCIMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, |
ff4aedc5 | 2884 | wxWindowID id, |
226ec5a7 | 2885 | const wxPoint& pos, |
ff4aedc5 | 2886 | const wxSize& size, |
226ec5a7 | 2887 | long style, |
ff4aedc5 RN |
2888 | const wxValidator& validator, |
2889 | const wxString& name) | |
72259e00 | 2890 | { |
ff4aedc5 RN |
2891 | // Create window |
2892 | // By default wxWindow(s) is created with a border - | |
2893 | // so we need to get rid of those, and create with | |
2894 | // wxCLIP_CHILDREN, so that if the driver/backend | |
2895 | // is a child window, it refereshes properly | |
ff4aedc5 | 2896 | if ( !ctrl->wxControl::Create(parent, id, pos, size, |
11085e4b | 2897 | (style & ~wxBORDER_MASK) | wxBORDER_NONE | wxCLIP_CHILDREN, |
ff4aedc5 RN |
2898 | validator, name) ) |
2899 | return false; | |
2900 | ||
bf354396 | 2901 | m_ctrl = wxStaticCast(ctrl, wxMediaCtrl); |
b1ec2381 | 2902 | |
3f9a3bf9 RN |
2903 | return true; |
2904 | } | |
2905 | ||
ff4aedc5 RN |
2906 | //--------------------------------------------------------------------------- |
2907 | // wxMCIMediaBackend::Load (file version) | |
2908 | // | |
2909 | // Here we have MCI load a file and device, set the time format to our | |
2910 | // default (milliseconds), and set the video (if any) to play in the control | |
2911 | //--------------------------------------------------------------------------- | |
2912 | bool wxMCIMediaBackend::Load(const wxString& fileName) | |
3f9a3bf9 | 2913 | { |
b1ec2381 DS |
2914 | // if the user already called load close the previous MCI device |
2915 | if (m_hNotifyWnd) | |
ff4aedc5 | 2916 | { |
3f9a3bf9 | 2917 | mciSendCommand(m_hDev, MCI_CLOSE, 0, 0); |
ff4aedc5 RN |
2918 | DestroyWindow(m_hNotifyWnd); |
2919 | m_hNotifyWnd = NULL; | |
2920 | } | |
3f9a3bf9 | 2921 | |
b1ec2381 DS |
2922 | // Opens a file and has MCI select a device. Normally you'd put |
2923 | // MCI_OPEN_TYPE in addition to MCI_OPEN_ELEMENT - however if you | |
2924 | // omit this it tells MCI to select the device instead. This is good | |
2925 | // because we have no reliable way of "enumerating" the devices in MCI | |
3f9a3bf9 | 2926 | MCI_OPEN_PARMS openParms; |
07594601 | 2927 | openParms.lpstrElementName = fileName.wx_str(); |
3f9a3bf9 | 2928 | |
9d7d3b1f | 2929 | if (mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT, |
ff4aedc5 | 2930 | (DWORD)(LPVOID)&openParms) != 0) |
a7d5151d | 2931 | { |
ff4aedc5 | 2932 | return false; |
a7d5151d | 2933 | } |
3f9a3bf9 RN |
2934 | |
2935 | m_hDev = openParms.wDeviceID; | |
2936 | ||
b1ec2381 | 2937 | // set the time format for the device to milliseconds |
ff4aedc5 | 2938 | MCI_SET_PARMS setParms; |
3f9a3bf9 RN |
2939 | setParms.dwCallback = 0; |
2940 | setParms.dwTimeFormat = MCI_FORMAT_MILLISECONDS; | |
2941 | ||
2942 | if (mciSendCommand(m_hDev, MCI_SET, MCI_SET_TIME_FORMAT, | |
2943 | (DWORD)(LPVOID)&setParms) != 0) | |
b1ec2381 | 2944 | { |
3f9a3bf9 | 2945 | return false; |
a7d5151d | 2946 | } |
3f9a3bf9 | 2947 | |
b1ec2381 | 2948 | // tell the MCI device to display the video in our wxMediaCtrl |
3f9a3bf9 | 2949 | MCI_DGV_WINDOW_PARMS windowParms; |
5987f174 | 2950 | windowParms.hWnd = (HWND)m_ctrl->GetHandle(); |
3f9a3bf9 | 2951 | |
226ec5a7 | 2952 | m_bVideo = (mciSendCommand(m_hDev, MCI_WINDOW, |
b1ec2381 | 2953 | 0x00010000L, // MCI_DGV_WINDOW_HWND |
ff4aedc5 RN |
2954 | (DWORD)(LPVOID)&windowParms) == 0); |
2955 | ||
b1ec2381 | 2956 | // Create a hidden window and register to handle MCI events |
226ec5a7 | 2957 | // Note that wxCanvasClassName is already registered |
ff4aedc5 | 2958 | // and used by all wxWindows and normal wxControls |
b1ec2381 | 2959 | m_hNotifyWnd = ::CreateWindow( |
ff4aedc5 RN |
2960 | wxCanvasClassName, |
2961 | NULL, | |
2962 | 0, 0, 0, 0, | |
2963 | 0, | |
2964 | (HWND) NULL, | |
2965 | (HMENU)NULL, | |
2966 | wxGetInstance(), | |
b1ec2381 | 2967 | (LPVOID)NULL ); |
ff4aedc5 | 2968 | |
b1ec2381 | 2969 | if (!m_hNotifyWnd) |
ff4aedc5 RN |
2970 | { |
2971 | wxLogSysError( wxT("Could not create hidden needed for ") | |
c5191fbd | 2972 | wxT("registering for MCI events!") ); |
ff4aedc5 RN |
2973 | |
2974 | return false; | |
2975 | } | |
226ec5a7 | 2976 | |
1146983c | 2977 | wxSetWindowProc(m_hNotifyWnd, wxMCIMediaBackend::NotifyWndProc); |
c5191fbd | 2978 | wxSetWindowUserData(m_hNotifyWnd, this); |
ff4aedc5 | 2979 | |
7e41b689 | 2980 | NotifyMovieLoaded(); |
c5191fbd | 2981 | |
3f9a3bf9 RN |
2982 | return true; |
2983 | } | |
2984 | ||
ff4aedc5 RN |
2985 | //--------------------------------------------------------------------------- |
2986 | // wxMCIMediaBackend::Load (URL version) | |
2987 | // | |
2988 | // MCI doesn't support URLs directly (?) | |
2989 | // | |
9d7d3b1f | 2990 | // TODO: Use wxURL/wxFileSystem and mmioInstallProc |
ff4aedc5 RN |
2991 | //--------------------------------------------------------------------------- |
2992 | bool wxMCIMediaBackend::Load(const wxURI& WXUNUSED(location)) | |
3f9a3bf9 RN |
2993 | { |
2994 | return false; | |
2995 | } | |
2996 | ||
ff4aedc5 RN |
2997 | //--------------------------------------------------------------------------- |
2998 | // wxMCIMediaBackend::Play | |
2999 | // | |
3000 | // Plays/Resumes the MCI device... a couple notes: | |
3001 | // 1) Certain drivers will crash and burn if we don't pass them an | |
3002 | // MCI_PLAY_PARMS, despite the documentation that says otherwise... | |
3003 | // 2) There is a MCI_RESUME command, but MCI_PLAY does the same thing | |
226ec5a7 | 3004 | // and will resume from a stopped state also, so there's no need to |
ff4aedc5 RN |
3005 | // call both, for example |
3006 | //--------------------------------------------------------------------------- | |
3007 | bool wxMCIMediaBackend::Play() | |
5987f174 | 3008 | { |
5987f174 | 3009 | MCI_PLAY_PARMS playParms; |
ff4aedc5 RN |
3010 | playParms.dwCallback = (DWORD)m_hNotifyWnd; |
3011 | ||
9d7d3b1f DS |
3012 | bool bOK = (mciSendCommand(m_hDev, MCI_PLAY, MCI_NOTIFY, |
3013 | (DWORD)(LPVOID)&playParms) == 0); | |
11219c9e | 3014 | |
b1ec2381 | 3015 | if (bOK) |
11219c9e RN |
3016 | m_ctrl->Show(m_bVideo); |
3017 | ||
3018 | return bOK; | |
5987f174 RN |
3019 | } |
3020 | ||
ff4aedc5 RN |
3021 | //--------------------------------------------------------------------------- |
3022 | // wxMCIMediaBackend::Pause | |
3023 | // | |
3024 | // Pauses the MCI device - nothing special | |
226ec5a7 | 3025 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3026 | bool wxMCIMediaBackend::Pause() |
5987f174 RN |
3027 | { |
3028 | return (mciSendCommand(m_hDev, MCI_PAUSE, MCI_WAIT, 0) == 0); | |
3029 | } | |
3030 | ||
ff4aedc5 RN |
3031 | //--------------------------------------------------------------------------- |
3032 | // wxMCIMediaBackend::Stop | |
3033 | // | |
3034 | // Stops the MCI device & seeks to the beginning as wxMediaCtrl docs outline | |
226ec5a7 | 3035 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3036 | bool wxMCIMediaBackend::Stop() |
5987f174 RN |
3037 | { |
3038 | return (mciSendCommand(m_hDev, MCI_STOP, MCI_WAIT, 0) == 0) && | |
3039 | (mciSendCommand(m_hDev, MCI_SEEK, MCI_SEEK_TO_START, 0) == 0); | |
3040 | } | |
3041 | ||
ff4aedc5 RN |
3042 | //--------------------------------------------------------------------------- |
3043 | // wxMCIMediaBackend::GetState | |
3044 | // | |
3045 | // Here we get the state and convert it to a wxMediaState - | |
3046 | // since we use direct comparisons with MCI_MODE_PLAY and | |
3047 | // MCI_MODE_PAUSE, we don't care if the MCI_STATUS call | |
3048 | // fails or not | |
226ec5a7 | 3049 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3050 | wxMediaState wxMCIMediaBackend::GetState() |
3f9a3bf9 RN |
3051 | { |
3052 | MCI_STATUS_PARMS statusParms; | |
3053 | statusParms.dwItem = MCI_STATUS_MODE; | |
ff4aedc5 | 3054 | |
3f9a3bf9 RN |
3055 | mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, |
3056 | (DWORD)(LPVOID)&statusParms); | |
3057 | ||
b1ec2381 | 3058 | if (statusParms.dwReturn == MCI_MODE_PAUSE) |
3f9a3bf9 | 3059 | return wxMEDIASTATE_PAUSED; |
b1ec2381 | 3060 | else if (statusParms.dwReturn == MCI_MODE_PLAY) |
3f9a3bf9 RN |
3061 | return wxMEDIASTATE_PLAYING; |
3062 | else | |
3063 | return wxMEDIASTATE_STOPPED; | |
3064 | } | |
3065 | ||
ff4aedc5 RN |
3066 | //--------------------------------------------------------------------------- |
3067 | // wxMCIMediaBackend::SetPosition | |
3068 | // | |
3069 | // Here we set the position of the device in the stream. | |
226ec5a7 | 3070 | // Note that MCI actually stops the device after you seek it if the |
ff4aedc5 | 3071 | // device is playing/paused, so we need to play the file after |
226ec5a7 WS |
3072 | // MCI seeks like normal APIs would |
3073 | //--------------------------------------------------------------------------- | |
ff4aedc5 | 3074 | bool wxMCIMediaBackend::SetPosition(wxLongLong where) |
3f9a3bf9 RN |
3075 | { |
3076 | MCI_SEEK_PARMS seekParms; | |
3077 | seekParms.dwCallback = 0; | |
b1ec2381 | 3078 | |
e70fda0e | 3079 | #if wxUSE_LONGLONG_NATIVE && !wxUSE_LONGLONG_WX |
226ec5a7 | 3080 | seekParms.dwTo = (DWORD)where.GetValue(); |
b1ec2381 DS |
3081 | #else // wxUSE_LONGLONG_WX |
3082 | // no way to return it in one piece | |
3083 | wxASSERT( where.GetHi() == 0 ); | |
e70fda0e | 3084 | seekParms.dwTo = (DWORD)where.GetLo(); |
b1ec2381 | 3085 | #endif |
3f9a3bf9 | 3086 | |
b1ec2381 | 3087 | // device was playing? |
3f9a3bf9 RN |
3088 | bool bReplay = GetState() == wxMEDIASTATE_PLAYING; |
3089 | ||
b1ec2381 | 3090 | if ( mciSendCommand(m_hDev, MCI_SEEK, MCI_TO, |
ff4aedc5 | 3091 | (DWORD)(LPVOID)&seekParms) != 0) |
b1ec2381 | 3092 | { |
3f9a3bf9 | 3093 | return false; |
b1ec2381 | 3094 | } |
3f9a3bf9 | 3095 | |
b1ec2381 | 3096 | // If the device was playing, resume it |
3f9a3bf9 RN |
3097 | if (bReplay) |
3098 | return Play(); | |
3099 | else | |
3100 | return true; | |
3101 | } | |
3102 | ||
ff4aedc5 RN |
3103 | //--------------------------------------------------------------------------- |
3104 | // wxMCIMediaBackend::GetPosition | |
3105 | // | |
3106 | // Gets the position of the device in the stream using the current | |
3107 | // time format... nothing special here... | |
226ec5a7 | 3108 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3109 | wxLongLong wxMCIMediaBackend::GetPosition() |
3f9a3bf9 RN |
3110 | { |
3111 | MCI_STATUS_PARMS statusParms; | |
72259e00 | 3112 | statusParms.dwItem = MCI_STATUS_POSITION; |
ff4aedc5 | 3113 | |
72259e00 | 3114 | if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, |
ff4aedc5 | 3115 | (DWORD)(LPSTR)&statusParms) != 0) |
a7d5151d | 3116 | { |
3f9a3bf9 | 3117 | return 0; |
a7d5151d | 3118 | } |
3f9a3bf9 RN |
3119 | |
3120 | return statusParms.dwReturn; | |
3121 | } | |
3122 | ||
6f8c67e7 JS |
3123 | //--------------------------------------------------------------------------- |
3124 | // wxMCIMediaBackend::GetVolume | |
3125 | // | |
3126 | // Gets the volume of the current media via the MCI_DGV_STATUS_VOLUME | |
3127 | // message. Value ranges from 0 (minimum) to 1000 (maximum volume). | |
3128 | //--------------------------------------------------------------------------- | |
3129 | double wxMCIMediaBackend::GetVolume() | |
3130 | { | |
3131 | MCI_STATUS_PARMS statusParms; | |
600ffb32 | 3132 | statusParms.dwCallback = 0; |
b1ec2381 | 3133 | statusParms.dwItem = 0x4019; // MCI_DGV_STATUS_VOLUME |
6f8c67e7 JS |
3134 | |
3135 | if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, | |
3136 | (DWORD)(LPSTR)&statusParms) != 0) | |
a7d5151d | 3137 | { |
6f8c67e7 | 3138 | return 0; |
a7d5151d | 3139 | } |
6f8c67e7 JS |
3140 | |
3141 | return ((double)statusParms.dwReturn) / 1000.0; | |
3142 | } | |
3143 | ||
3144 | //--------------------------------------------------------------------------- | |
3145 | // wxMCIMediaBackend::SetVolume | |
3146 | // | |
3147 | // Sets the volume of the current media via the MCI_DGV_SETAUDIO_VOLUME | |
3148 | // message. Value ranges from 0 (minimum) to 1000 (maximum volume). | |
3149 | //--------------------------------------------------------------------------- | |
3150 | bool wxMCIMediaBackend::SetVolume(double dVolume) | |
3151 | { | |
3152 | MCI_DGV_SETAUDIO_PARMS audioParms; | |
600ffb32 | 3153 | audioParms.dwCallback = 0; |
b1ec2381 | 3154 | audioParms.dwItem = 0x4002; // MCI_DGV_SETAUDIO_VOLUME |
6f8c67e7 JS |
3155 | audioParms.dwValue = (DWORD) (dVolume * 1000.0); |
3156 | audioParms.dwOver = 0; | |
3157 | audioParms.lpstrAlgorithm = NULL; | |
3158 | audioParms.lpstrQuality = NULL; | |
3159 | ||
b1ec2381 DS |
3160 | if (mciSendCommand(m_hDev, 0x0873, // MCI_SETAUDIO |
3161 | // MCI_DGV_SETAUDIO + (_ITEM | _VALUE) | |
c5191fbd | 3162 | 0x00800000L | 0x01000000L, |
6f8c67e7 | 3163 | (DWORD)(LPSTR)&audioParms) != 0) |
a7d5151d | 3164 | { |
6f8c67e7 | 3165 | return false; |
a7d5151d | 3166 | } |
b1ec2381 | 3167 | |
6f8c67e7 JS |
3168 | return true; |
3169 | } | |
3170 | ||
ff4aedc5 RN |
3171 | //--------------------------------------------------------------------------- |
3172 | // wxMCIMediaBackend::GetDuration | |
3173 | // | |
3174 | // Gets the duration of the stream... nothing special | |
226ec5a7 | 3175 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3176 | wxLongLong wxMCIMediaBackend::GetDuration() |
3f9a3bf9 RN |
3177 | { |
3178 | MCI_STATUS_PARMS statusParms; | |
72259e00 | 3179 | statusParms.dwItem = MCI_STATUS_LENGTH; |
ff4aedc5 | 3180 | |
72259e00 | 3181 | if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, |
ff4aedc5 | 3182 | (DWORD)(LPSTR)&statusParms) != 0) |
a7d5151d | 3183 | { |
3f9a3bf9 | 3184 | return 0; |
a7d5151d | 3185 | } |
3f9a3bf9 RN |
3186 | |
3187 | return statusParms.dwReturn; | |
3188 | } | |
3189 | ||
ff4aedc5 RN |
3190 | //--------------------------------------------------------------------------- |
3191 | // wxMCIMediaBackend::Move | |
3192 | // | |
3193 | // Moves the window to a location | |
226ec5a7 | 3194 | //--------------------------------------------------------------------------- |
b1ec2381 | 3195 | void wxMCIMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h) |
3f9a3bf9 | 3196 | { |
ff4aedc5 RN |
3197 | if (m_hNotifyWnd && m_bVideo) |
3198 | { | |
b1ec2381 | 3199 | MCI_DGV_RECT_PARMS putParms; // ifdefed MCI_DGV_PUT_PARMS |
b11eba7e | 3200 | memset(&putParms, 0, sizeof(MCI_DGV_RECT_PARMS)); |
ff4aedc5 | 3201 | putParms.rc.bottom = h; |
b11eba7e | 3202 | putParms.rc.right = w; |
7c4a4505 | 3203 | |
b1ec2381 DS |
3204 | // wxStackWalker will crash and burn here on assert |
3205 | // and MCI doesn't like 0 and 0 for some reason (out of range) | |
3206 | // so just don't it in that case | |
3207 | if (w || h) | |
b11eba7e | 3208 | { |
7c4a4505 | 3209 | wxMCIVERIFY( mciSendCommand(m_hDev, MCI_PUT, |
b1ec2381 | 3210 | 0x00040000L, // MCI_DGV_PUT_DESTINATION |
ff4aedc5 | 3211 | (DWORD)(LPSTR)&putParms) ); |
7c4a4505 | 3212 | } |
ff4aedc5 | 3213 | } |
3f9a3bf9 RN |
3214 | } |
3215 | ||
ff4aedc5 RN |
3216 | //--------------------------------------------------------------------------- |
3217 | // wxMCIMediaBackend::GetVideoSize | |
3218 | // | |
3219 | // Gets the original size of the movie for sizers | |
226ec5a7 | 3220 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3221 | wxSize wxMCIMediaBackend::GetVideoSize() const |
3f9a3bf9 | 3222 | { |
b1ec2381 | 3223 | if (m_bVideo) |
3f9a3bf9 | 3224 | { |
b1ec2381 | 3225 | MCI_DGV_RECT_PARMS whereParms; // ifdefed MCI_DGV_WHERE_PARMS |
3f9a3bf9 | 3226 | |
226ec5a7 | 3227 | wxMCIVERIFY( mciSendCommand(m_hDev, MCI_WHERE, |
b1ec2381 | 3228 | 0x00020000L, // MCI_DGV_WHERE_SOURCE |
ff4aedc5 | 3229 | (DWORD)(LPSTR)&whereParms) ); |
226ec5a7 | 3230 | |
ff4aedc5 | 3231 | return wxSize(whereParms.rc.right, whereParms.rc.bottom); |
3f9a3bf9 | 3232 | } |
9d7d3b1f | 3233 | |
b1ec2381 | 3234 | return wxSize(0, 0); |
3f9a3bf9 RN |
3235 | } |
3236 | ||
ff4aedc5 RN |
3237 | //--------------------------------------------------------------------------- |
3238 | // wxMCIMediaBackend::GetPlaybackRate | |
3239 | // | |
3240 | // TODO | |
226ec5a7 | 3241 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3242 | double wxMCIMediaBackend::GetPlaybackRate() |
3f9a3bf9 RN |
3243 | { |
3244 | return 1.0; | |
3245 | } | |
3246 | ||
ff4aedc5 RN |
3247 | //--------------------------------------------------------------------------- |
3248 | // wxMCIMediaBackend::SetPlaybackRate | |
3249 | // | |
3250 | // TODO | |
226ec5a7 | 3251 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3252 | bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate)) |
3f9a3bf9 | 3253 | { |
b1ec2381 | 3254 | #if 0 |
ff4aedc5 RN |
3255 | MCI_WAVE_SET_SAMPLESPERSEC |
3256 | MCI_DGV_SET_PARMS setParms; | |
3257 | setParms.dwSpeed = (DWORD) (dRate * 1000.0); | |
3258 | ||
226ec5a7 | 3259 | return (mciSendCommand(m_hDev, MCI_SET, |
b1ec2381 | 3260 | 0x00020000L, // MCI_DGV_SET_SPEED |
ff4aedc5 | 3261 | (DWORD)(LPSTR)&setParms) == 0); |
b1ec2381 DS |
3262 | #endif |
3263 | ||
3f9a3bf9 RN |
3264 | return false; |
3265 | } | |
3266 | ||
ff4aedc5 RN |
3267 | //--------------------------------------------------------------------------- |
3268 | // [static] wxMCIMediaBackend::MSWWindowProc | |
3269 | // | |
226ec5a7 | 3270 | // Here we process a message when MCI reaches the stopping point |
ff4aedc5 | 3271 | // in the stream |
226ec5a7 WS |
3272 | //--------------------------------------------------------------------------- |
3273 | LRESULT CALLBACK wxMCIMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg, | |
3274 | WPARAM wParam, | |
ff4aedc5 RN |
3275 | LPARAM lParam) |
3276 | { | |
c5191fbd VZ |
3277 | wxMCIMediaBackend* backend = |
3278 | (wxMCIMediaBackend*)wxGetWindowUserData(hWnd); | |
ff4aedc5 RN |
3279 | |
3280 | return backend->OnNotifyWndProc(hWnd, nMsg, wParam, lParam); | |
3281 | } | |
3282 | ||
226ec5a7 WS |
3283 | LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg, |
3284 | WPARAM wParam, | |
ff4aedc5 | 3285 | LPARAM lParam) |
3f9a3bf9 | 3286 | { |
b1ec2381 | 3287 | if (nMsg == MM_MCINOTIFY) |
5987f174 | 3288 | { |
ff4aedc5 | 3289 | wxASSERT(lParam == (LPARAM) m_hDev); |
b1ec2381 | 3290 | if (wParam == MCI_NOTIFY_SUCCESSFUL && lParam == (LPARAM)m_hDev) |
5987f174 | 3291 | { |
7e41b689 | 3292 | if ( SendStopEvent() ) |
ff4aedc5 | 3293 | { |
b1ec2381 | 3294 | wxMCIVERIFY( mciSendCommand(m_hDev, MCI_SEEK, MCI_SEEK_TO_START, 0) ); |
7e41b689 | 3295 | QueueFinishEvent(); |
ff4aedc5 | 3296 | } |
5987f174 | 3297 | } |
5987f174 | 3298 | } |
ff4aedc5 | 3299 | return DefWindowProc(hWnd, nMsg, wParam, lParam); |
3f9a3bf9 | 3300 | } |
b1ec2381 DS |
3301 | #endif // __WXWINCE__ |
3302 | ||
9d7d3b1f | 3303 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3304 | // wxQTMediaBackend |
226ec5a7 | 3305 | // |
b1ec2381 | 3306 | // TODO: Use a less kludgy way to pause/get state/set state |
c5191fbd | 3307 | // FIXME: Greg Hazel reports that sometimes files that cannot be played |
b1ec2381 | 3308 | // with this backend are treated as playable anyway - not verified though. |
9d7d3b1f | 3309 | //--------------------------------------------------------------------------- |
ff4aedc5 | 3310 | |
412e0d47 | 3311 | IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend) |
ff4aedc5 | 3312 | |
b1ec2381 DS |
3313 | // Time between timer calls - this is the Apple recommendation to the TCL |
3314 | // team I believe | |
c5191fbd | 3315 | #define MOVIE_DELAY 20 |
ff4aedc5 | 3316 | |
c5191fbd | 3317 | //--------------------------------------------------------------------------- |
9d7d3b1f | 3318 | // wxQTLoadTimer |
c5191fbd VZ |
3319 | // |
3320 | // QT, esp. QT for Windows is very picky about how you go about | |
3321 | // async loading. If you were to go through a Windows message loop | |
3322 | // or a MoviesTask or both and then check the movie load state | |
3323 | // it would still return 1000 (loading)... even (pre)prerolling doesn't | |
3324 | // help. However, making a load timer like this works | |
3325 | //--------------------------------------------------------------------------- | |
3326 | class wxQTLoadTimer : public wxTimer | |
ff4aedc5 RN |
3327 | { |
3328 | public: | |
c5191fbd VZ |
3329 | wxQTLoadTimer(Movie movie, wxQTMediaBackend* parent, wxQuickTimeLibrary* pLib) : |
3330 | m_movie(movie), m_parent(parent), m_pLib(pLib) {} | |
ff4aedc5 | 3331 | |
c5191fbd | 3332 | void Notify() |
ff4aedc5 | 3333 | { |
c5191fbd | 3334 | m_pLib->MoviesTask(m_movie, 0); |
9d7d3b1f | 3335 | // kMovieLoadStatePlayable |
b1ec2381 DS |
3336 | if (m_pLib->GetMovieLoadState(m_movie) >= 10000) |
3337 | { | |
c5191fbd VZ |
3338 | m_parent->FinishLoad(); |
3339 | delete this; | |
b1ec2381 | 3340 | } |
ff4aedc5 RN |
3341 | } |
3342 | ||
c5191fbd VZ |
3343 | protected: |
3344 | Movie m_movie; //Our movie instance | |
3345 | wxQTMediaBackend* m_parent; //Backend pointer | |
3346 | wxQuickTimeLibrary* m_pLib; //Interfaces | |
3347 | }; | |
3348 | ||
3349 | ||
3350 | // -------------------------------------------------------------------------- | |
9d7d3b1f | 3351 | // wxQTPlayTimer - Handle Asyncronous Playing |
c5191fbd VZ |
3352 | // |
3353 | // 1) Checks to see if the movie is done, and if not continues | |
3354 | // streaming the movie | |
3355 | // 2) Sends the wxEVT_MEDIA_STOP event if we have reached the end of | |
3356 | // the movie. | |
3357 | // -------------------------------------------------------------------------- | |
3358 | class wxQTPlayTimer : public wxTimer | |
3359 | { | |
3360 | public: | |
3361 | wxQTPlayTimer(Movie movie, wxQTMediaBackend* parent, | |
3362 | wxQuickTimeLibrary* pLib) : | |
3363 | m_movie(movie), m_parent(parent), m_pLib(pLib) {} | |
ff4aedc5 | 3364 | |
ff4aedc5 RN |
3365 | void Notify() |
3366 | { | |
c5191fbd VZ |
3367 | // |
3368 | // OK, a little explaining - basically originally | |
3369 | // we only called MoviesTask if the movie was actually | |
3370 | // playing (not paused or stopped)... this was before | |
3371 | // we realized MoviesTask actually handles repainting | |
3372 | // of the current frame - so if you were to resize | |
3373 | // or something it would previously not redraw that | |
3374 | // portion of the movie. | |
3375 | // | |
3376 | // So now we call MoviesTask always so that it repaints | |
3377 | // correctly. | |
3378 | // | |
3379 | m_pLib->MoviesTask(m_movie, 0); | |
3380 | ||
3381 | // | |
b1ec2381 DS |
3382 | // Handle the stop event - if the movie has reached |
3383 | // the end, notify our handler | |
c5191fbd VZ |
3384 | // |
3385 | // m_bPlaying == !(Stopped | Paused) | |
3386 | // | |
3387 | if (m_parent->m_bPlaying) | |
ff4aedc5 | 3388 | { |
b1ec2381 | 3389 | if (m_pLib->IsMovieDone(m_movie)) |
ff4aedc5 | 3390 | { |
7e41b689 | 3391 | if ( m_parent->SendStopEvent() ) |
ff4aedc5 | 3392 | { |
ff4aedc5 | 3393 | m_parent->Stop(); |
d7a9c895 | 3394 | wxASSERT(m_pLib->GetMoviesError() == noErr); |
ff4aedc5 | 3395 | |
7e41b689 | 3396 | m_parent->QueueFinishEvent(); |
ff4aedc5 RN |
3397 | } |
3398 | } | |
3399 | } | |
3400 | } | |
3401 | ||
3402 | protected: | |
b1ec2381 | 3403 | Movie m_movie; // Our movie instance |
ff4aedc5 | 3404 | wxQTMediaBackend* m_parent; //Backend pointer |
d7a9c895 | 3405 | wxQuickTimeLibrary* m_pLib; //Interfaces |
ff4aedc5 RN |
3406 | }; |
3407 | ||
c5191fbd VZ |
3408 | |
3409 | //--------------------------------------------------------------------------- | |
3410 | // wxQTMediaBackend::QTWndProc | |
3411 | // | |
3412 | // Forwards events to the Movie Controller so that it can | |
3413 | // redraw itself/process messages etc.. | |
3414 | //--------------------------------------------------------------------------- | |
3415 | LRESULT CALLBACK wxQTMediaBackend::QTWndProc(HWND hWnd, UINT nMsg, | |
3416 | WPARAM wParam, LPARAM lParam) | |
3417 | { | |
3418 | wxQTMediaBackend* pThis = (wxQTMediaBackend*)wxGetWindowUserData(hWnd); | |
3419 | ||
3420 | MSG msg; | |
3421 | msg.hwnd = hWnd; | |
3422 | msg.message = nMsg; | |
3423 | msg.wParam = wParam; | |
3424 | msg.lParam = lParam; | |
3425 | msg.time = 0; | |
3426 | msg.pt.x = 0; | |
3427 | msg.pt.y = 0; | |
3428 | EventRecord theEvent; | |
3429 | pThis->m_lib.NativeEventToMacEvent(&msg, &theEvent); | |
3430 | pThis->m_lib.MCIsPlayerEvent(pThis->m_pMC, &theEvent); | |
b1ec2381 | 3431 | |
c5191fbd VZ |
3432 | return pThis->m_ctrl->MSWWindowProc(nMsg, wParam, lParam); |
3433 | } | |
3434 | ||
ff4aedc5 RN |
3435 | //--------------------------------------------------------------------------- |
3436 | // wxQTMediaBackend Destructor | |
3437 | // | |
3438 | // Sets m_timer to NULL signifying we havn't loaded anything yet | |
3439 | //--------------------------------------------------------------------------- | |
c5191fbd VZ |
3440 | wxQTMediaBackend::wxQTMediaBackend() |
3441 | : m_movie(NULL), m_bPlaying(false), m_timer(NULL), m_pMC(NULL) | |
ff4aedc5 RN |
3442 | { |
3443 | } | |
3444 | ||
3445 | //--------------------------------------------------------------------------- | |
3446 | // wxQTMediaBackend Destructor | |
3447 | // | |
3448 | // 1) Cleans up the QuickTime movie instance | |
3449 | // 2) Decrements the QuickTime reference counter - if this reaches | |
3450 | // 0, QuickTime shuts down | |
3451 | // 3) Decrements the QuickTime Windows Media Layer reference counter - | |
3452 | // if this reaches 0, QuickTime shuts down the Windows Media Layer | |
3453 | //--------------------------------------------------------------------------- | |
3454 | wxQTMediaBackend::~wxQTMediaBackend() | |
3455 | { | |
b1ec2381 | 3456 | if (m_movie) |
ff4aedc5 RN |
3457 | Cleanup(); |
3458 | ||
b1ec2381 | 3459 | if (m_lib.IsOk()) |
d7a9c895 | 3460 | { |
b1ec2381 | 3461 | if (m_pMC) |
c5191fbd VZ |
3462 | { |
3463 | m_lib.DisposeMovieController(m_pMC); | |
b1ec2381 | 3464 | // m_pMC = NULL; |
c5191fbd VZ |
3465 | } |
3466 | ||
6ab9bf57 VZ |
3467 | // destroy wxQTMediaEvtHandler we pushed on it |
3468 | m_ctrl->PopEventHandler(true); | |
3469 | ||
c5191fbd VZ |
3470 | m_lib.DestroyPortAssociation( |
3471 | (CGrafPtr)m_lib.GetNativeWindowPort(m_ctrl->GetHWND())); | |
3472 | ||
3103e8a9 | 3473 | //Note that ExitMovies() is not necessary, but |
d7a9c895 RN |
3474 | //the docs are fuzzy on whether or not TerminateQTML is |
3475 | m_lib.ExitMovies(); | |
3476 | m_lib.TerminateQTML(); | |
3477 | } | |
ff4aedc5 RN |
3478 | } |
3479 | ||
3480 | //--------------------------------------------------------------------------- | |
3481 | // wxQTMediaBackend::CreateControl | |
3482 | // | |
3483 | // 1) Intializes QuickTime | |
3484 | // 2) Creates the control window | |
3485 | //--------------------------------------------------------------------------- | |
226ec5a7 | 3486 | bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, |
ff4aedc5 | 3487 | wxWindowID id, |
226ec5a7 | 3488 | const wxPoint& pos, |
ff4aedc5 | 3489 | const wxSize& size, |
226ec5a7 | 3490 | long style, |
ff4aedc5 RN |
3491 | const wxValidator& validator, |
3492 | const wxString& name) | |
3493 | { | |
b1ec2381 | 3494 | if (!m_lib.Initialize()) |
d7a9c895 | 3495 | return false; |
b11eba7e | 3496 | |
600ffb32 WS |
3497 | int nError = m_lib.InitializeQTML(0); |
3498 | if (nError != noErr) //-2093 no dll | |
ff4aedc5 | 3499 | { |
b1ec2381 | 3500 | wxFAIL_MSG(wxString::Format(wxT("Couldn't Initialize Quicktime-%i"), nError)); |
ff4aedc5 RN |
3501 | return false; |
3502 | } | |
b1ec2381 | 3503 | |
d7a9c895 | 3504 | m_lib.EnterMovies(); |
ff4aedc5 | 3505 | |
ff4aedc5 RN |
3506 | // Create window |
3507 | // By default wxWindow(s) is created with a border - | |
3508 | // so we need to get rid of those | |
3509 | // | |
3510 | // Since we don't have a child window like most other | |
3511 | // backends, we don't need wxCLIP_CHILDREN | |
ff4aedc5 | 3512 | if ( !ctrl->wxControl::Create(parent, id, pos, size, |
11085e4b | 3513 | (style & ~wxBORDER_MASK) | wxBORDER_NONE, |
ff4aedc5 | 3514 | validator, name) ) |
b1ec2381 | 3515 | { |
ff4aedc5 | 3516 | return false; |
b1ec2381 | 3517 | } |
c5191fbd | 3518 | |
bf354396 | 3519 | m_ctrl = wxStaticCast(ctrl, wxMediaCtrl); |
c5191fbd VZ |
3520 | |
3521 | // Create a port association for our window so we | |
3522 | // can use it as a WindowRef | |
3523 | m_lib.CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L); | |
3524 | ||
b1ec2381 DS |
3525 | // Part of a suggestion from Greg Hazel |
3526 | // to repaint movie when idle | |
7e41b689 | 3527 | m_ctrl->PushEventHandler(new wxQTMediaEvtHandler(this, m_ctrl->GetHWND())); |
c5191fbd VZ |
3528 | |
3529 | // done | |
ff4aedc5 RN |
3530 | return true; |
3531 | } | |
3532 | ||
3533 | //--------------------------------------------------------------------------- | |
3534 | // wxQTMediaBackend::Load (file version) | |
3535 | // | |
3536 | // 1) Get an FSSpec from the Windows path name | |
3537 | // 2) Open the movie | |
3538 | // 3) Obtain the movie instance from the movie resource | |
c5191fbd VZ |
3539 | // 4) Close the movie resource |
3540 | // 5) Finish loading | |
ff4aedc5 RN |
3541 | //--------------------------------------------------------------------------- |
3542 | bool wxQTMediaBackend::Load(const wxString& fileName) | |
3543 | { | |
b1ec2381 | 3544 | if (m_movie) |
ff4aedc5 | 3545 | Cleanup(); |
9d7d3b1f | 3546 | |
a7d5151d DS |
3547 | bool result = true; |
3548 | OSErr err = noErr; | |
920a7c15 | 3549 | short movieResFile = 0; //= 0 because of annoying VC6 warning |
ff4aedc5 RN |
3550 | FSSpec sfFile; |
3551 | ||
a7d5151d | 3552 | err = m_lib.NativePathNameToFSSpec( |
b1ec2381 | 3553 | (char*) (const char*) fileName.mb_str(), |
a7d5151d DS |
3554 | &sfFile, 0); |
3555 | result = (err == noErr); | |
3556 | ||
3557 | if (result) | |
b1ec2381 | 3558 | { |
a7d5151d DS |
3559 | err = m_lib.OpenMovieFile(&sfFile, &movieResFile, fsRdPerm); |
3560 | result = (err == noErr); | |
b1ec2381 | 3561 | } |
226ec5a7 | 3562 | |
a7d5151d DS |
3563 | if (result) |
3564 | { | |
3565 | short movieResID = 0; | |
3566 | Str255 movieName; | |
ff4aedc5 | 3567 | |
a7d5151d | 3568 | err = m_lib.NewMovieFromFile( |
600ffb32 WS |
3569 | &m_movie, |
3570 | movieResFile, | |
3571 | &movieResID, | |
3572 | movieName, | |
3573 | newMovieActive, | |
a7d5151d DS |
3574 | NULL ); // wasChanged |
3575 | result = (err == noErr && m_lib.GetMoviesStickyError() == noErr); | |
3576 | ||
3577 | // check m_lib.GetMoviesStickyError() because it may not find the | |
3578 | // proper codec and play black video and other strange effects, | |
3579 | // not to mention mess up the dynamic backend loading scheme | |
3580 | // of wxMediaCtrl - so it just does what the QuickTime player does | |
3581 | if (result) | |
3582 | { | |
3583 | m_lib.CloseMovieFile(movieResFile); | |
3584 | FinishLoad(); | |
3585 | } | |
c5191fbd | 3586 | } |
a7d5151d DS |
3587 | |
3588 | return result; | |
c5191fbd | 3589 | } |
ff4aedc5 | 3590 | |
c5191fbd VZ |
3591 | //--------------------------------------------------------------------------- |
3592 | // wxQTMediaBackend::PPRMProc (static) | |
3593 | // | |
3594 | // Called when done PrePrerolling the movie. | |
3595 | // Note that in 99% of the cases this does nothing... | |
3596 | // Anyway we set up the loading timer here to tell us when the movie is done | |
3597 | //--------------------------------------------------------------------------- | |
3832f946 WS |
3598 | void wxQTMediaBackend::PPRMProc (Movie theMovie, |
3599 | OSErr WXUNUSED_UNLESS_DEBUG(theErr), | |
3600 | void* theRefCon) | |
c5191fbd VZ |
3601 | { |
3602 | wxASSERT( theMovie ); | |
3603 | wxASSERT( theRefCon ); | |
3604 | wxASSERT( theErr == noErr ); | |
3605 | ||
3606 | wxQTMediaBackend* pBE = (wxQTMediaBackend*) theRefCon; | |
3607 | ||
3608 | long lTime = pBE->m_lib.GetMovieTime(theMovie,NULL); | |
3609 | Fixed rate = pBE->m_lib.GetMoviePreferredRate(theMovie); | |
a7d5151d | 3610 | pBE->m_lib.PrerollMovie(theMovie, lTime, rate); |
c5191fbd VZ |
3611 | pBE->m_timer = new wxQTLoadTimer(pBE->m_movie, pBE, &pBE->m_lib); |
3612 | pBE->m_timer->Start(MOVIE_DELAY); | |
ff4aedc5 RN |
3613 | } |
3614 | ||
3615 | //--------------------------------------------------------------------------- | |
c5191fbd | 3616 | // wxQTMediaBackend::Load (URL Version) |
ff4aedc5 | 3617 | // |
c5191fbd VZ |
3618 | // 1) Build an escaped URI from location |
3619 | // 2) Create a handle to store the URI string | |
3620 | // 3) Put the URI string inside the handle | |
3621 | // 4) Make a QuickTime URL data ref from the handle with the URI in it | |
3622 | // 5) Clean up the URI string handle | |
3623 | // 6) Do some prerolling | |
3624 | // 7) Finish Loading | |
ff4aedc5 RN |
3625 | //--------------------------------------------------------------------------- |
3626 | bool wxQTMediaBackend::Load(const wxURI& location) | |
3627 | { | |
b1ec2381 | 3628 | if (m_movie) |
ff4aedc5 RN |
3629 | Cleanup(); |
3630 | ||
3631 | wxString theURI = location.BuildURI(); | |
3632 | ||
d7a9c895 | 3633 | Handle theHandle = m_lib.NewHandleClear(theURI.length() + 1); |
ff4aedc5 RN |
3634 | wxASSERT(theHandle); |
3635 | ||
d7a9c895 | 3636 | m_lib.BlockMove(theURI.mb_str(), *theHandle, theURI.length() + 1); |
ff4aedc5 | 3637 | |
b1ec2381 | 3638 | // create the movie from the handle that refers to the URI |
c5191fbd VZ |
3639 | OSErr err = m_lib.NewMovieFromDataRef(&m_movie, newMovieActive | |
3640 | newMovieAsyncOK | |
9d7d3b1f | 3641 | /* | newMovieIdleImportOK */, |
226ec5a7 | 3642 | NULL, theHandle, |
19b6f122 | 3643 | URLDataHandlerSubType); |
ff4aedc5 | 3644 | |
d7a9c895 | 3645 | m_lib.DisposeHandle(theHandle); |
ff4aedc5 | 3646 | |
c5191fbd VZ |
3647 | if (err == noErr) |
3648 | { | |
3649 | long timeNow; | |
b1ec2381 | 3650 | Fixed playRate; |
ff4aedc5 | 3651 | |
c5191fbd VZ |
3652 | timeNow = m_lib.GetMovieTime(m_movie, NULL); |
3653 | wxASSERT(m_lib.GetMoviesError() == noErr); | |
ff4aedc5 | 3654 | |
c5191fbd VZ |
3655 | playRate = m_lib.GetMoviePreferredRate(m_movie); |
3656 | wxASSERT(m_lib.GetMoviesError() == noErr); | |
3657 | ||
a7d5151d DS |
3658 | // Note that the callback here is optional, |
3659 | // but without it PrePrerollMovie can be buggy | |
3660 | // (see Apple ml). Also, some may wonder | |
3661 | // why we need this at all - this is because | |
3662 | // Apple docs say QuickTime streamed movies | |
3663 | // require it if you don't use a Movie Controller, | |
3664 | // which we don't by default. | |
c5191fbd VZ |
3665 | // |
3666 | m_lib.PrePrerollMovie(m_movie, timeNow, playRate, | |
3667 | (WXFARPROC)wxQTMediaBackend::PPRMProc, | |
3668 | (void*)this); | |
a7d5151d | 3669 | |
c5191fbd VZ |
3670 | return true; |
3671 | } | |
3672 | else | |
3673 | return false; | |
ff4aedc5 RN |
3674 | } |
3675 | ||
3676 | //--------------------------------------------------------------------------- | |
c5191fbd | 3677 | // wxQTMediaBackend::FinishLoad |
ff4aedc5 | 3678 | // |
c5191fbd VZ |
3679 | // 1) Create the movie timer |
3680 | // 2) Get real size of movie for GetBestSize/sizers | |
3681 | // 3) Set the movie time scale to something usable so that seeking | |
3682 | // etc. will work correctly | |
3683 | // 4) Set our Movie Controller to display the movie if it exists, | |
3684 | // otherwise set the bounds of the Movie | |
3685 | // 5) Refresh parent window | |
ff4aedc5 RN |
3686 | //--------------------------------------------------------------------------- |
3687 | void wxQTMediaBackend::FinishLoad() | |
3688 | { | |
c5191fbd VZ |
3689 | // Create the playing/streaming timer |
3690 | m_timer = new wxQTPlayTimer(m_movie, (wxQTMediaBackend*) this, &m_lib); | |
ff4aedc5 | 3691 | wxASSERT(m_timer); |
a7d5151d | 3692 | |
c5191fbd | 3693 | m_timer->Start(MOVIE_DELAY, wxTIMER_CONTINUOUS); |
ff4aedc5 | 3694 | |
b1ec2381 | 3695 | // get the real size of the movie |
ff4aedc5 | 3696 | Rect outRect; |
a7d5151d | 3697 | memset(&outRect, 0, sizeof(Rect)); // suppress annoying VC6 warning |
d7a9c895 RN |
3698 | m_lib.GetMovieNaturalBoundsRect (m_movie, &outRect); |
3699 | wxASSERT(m_lib.GetMoviesError() == noErr); | |
ff4aedc5 RN |
3700 | |
3701 | m_bestSize.x = outRect.right - outRect.left; | |
3702 | m_bestSize.y = outRect.bottom - outRect.top; | |
226ec5a7 | 3703 | |
c5191fbd | 3704 | // Handle the movie GWorld |
b1ec2381 | 3705 | if (m_pMC) |
c5191fbd VZ |
3706 | { |
3707 | Point thePoint; | |
3708 | thePoint.h = thePoint.v = 0; | |
3709 | m_lib.MCSetMovie(m_pMC, m_movie, | |
3710 | m_lib.GetNativeWindowPort(m_ctrl->GetHandle()), | |
3711 | thePoint); | |
3712 | m_lib.MCSetVisible(m_pMC, true); | |
3713 | m_bestSize.y += 16; | |
3714 | } | |
3715 | else | |
ff4aedc5 | 3716 | { |
d7a9c895 RN |
3717 | m_lib.SetMovieGWorld(m_movie, |
3718 | (CGrafPtr) m_lib.GetNativeWindowPort(m_ctrl->GetHWND()), | |
3719 | NULL); | |
ff4aedc5 RN |
3720 | } |
3721 | ||
c5191fbd | 3722 | // Set the movie to millisecond precision |
d7a9c895 RN |
3723 | m_lib.SetMovieTimeScale(m_movie, 1000); |
3724 | wxASSERT(m_lib.GetMoviesError() == noErr); | |
ff4aedc5 | 3725 | |
7e41b689 | 3726 | NotifyMovieLoaded(); |
ff4aedc5 RN |
3727 | } |
3728 | ||
3729 | //--------------------------------------------------------------------------- | |
c5191fbd | 3730 | // wxQTMediaBackend::Play |
ff4aedc5 | 3731 | // |
c5191fbd VZ |
3732 | // 1) Start the QT movie |
3733 | // 2) Start the movie loading timer | |
3734 | // | |
3735 | // NOTE: This will still return success even when | |
3736 | // the movie is still loading, and as mentioned in wxQTLoadTimer | |
3737 | // I don't know of a way to force this to be sync - so if its | |
3738 | // still loading the function will return true but the movie will | |
3739 | // still be in the stopped state | |
ff4aedc5 RN |
3740 | //--------------------------------------------------------------------------- |
3741 | bool wxQTMediaBackend::Play() | |
3742 | { | |
d7a9c895 | 3743 | m_lib.StartMovie(m_movie); |
c5191fbd | 3744 | m_bPlaying = true; |
b1ec2381 | 3745 | |
d7a9c895 | 3746 | return m_lib.GetMoviesError() == noErr; |
ff4aedc5 RN |
3747 | } |
3748 | ||
3749 | //--------------------------------------------------------------------------- | |
c5191fbd | 3750 | // wxQTMediaBackend::Pause |
ff4aedc5 | 3751 | // |
c5191fbd VZ |
3752 | // 1) Stop the movie |
3753 | // 2) Stop the movie timer | |
ff4aedc5 RN |
3754 | //--------------------------------------------------------------------------- |
3755 | bool wxQTMediaBackend::Pause() | |
3756 | { | |
c5191fbd | 3757 | m_bPlaying = false; |
d7a9c895 | 3758 | m_lib.StopMovie(m_movie); |
b1ec2381 | 3759 | |
d7a9c895 | 3760 | return m_lib.GetMoviesError() == noErr; |
ff4aedc5 RN |
3761 | } |
3762 | ||
3763 | //--------------------------------------------------------------------------- | |
c5191fbd | 3764 | // wxQTMediaBackend::Stop |
ff4aedc5 | 3765 | // |
c5191fbd VZ |
3766 | // 1) Stop the movie |
3767 | // 2) Stop the movie timer | |
3768 | // 3) Seek to the beginning of the movie | |
ff4aedc5 RN |
3769 | //--------------------------------------------------------------------------- |
3770 | bool wxQTMediaBackend::Stop() | |
3771 | { | |
c5191fbd | 3772 | m_bPlaying = false; |
ff4aedc5 | 3773 | |
d7a9c895 | 3774 | m_lib.StopMovie(m_movie); |
b1ec2381 DS |
3775 | if (m_lib.GetMoviesError() == noErr) |
3776 | m_lib.GoToBeginningOfMovie(m_movie); | |
226ec5a7 | 3777 | |
d7a9c895 | 3778 | return m_lib.GetMoviesError() == noErr; |
ff4aedc5 RN |
3779 | } |
3780 | ||
3781 | //--------------------------------------------------------------------------- | |
c5191fbd | 3782 | // wxQTMediaBackend::GetPlaybackRate |
ff4aedc5 | 3783 | // |
a7d5151d | 3784 | // Get the movie playback rate from ::GetMovieRate |
ff4aedc5 RN |
3785 | //--------------------------------------------------------------------------- |
3786 | double wxQTMediaBackend::GetPlaybackRate() | |
3787 | { | |
d7a9c895 | 3788 | return ( ((double)m_lib.GetMovieRate(m_movie)) / 0x10000); |
ff4aedc5 RN |
3789 | } |
3790 | ||
3791 | //--------------------------------------------------------------------------- | |
c5191fbd | 3792 | // wxQTMediaBackend::SetPlaybackRate |
ff4aedc5 | 3793 | // |
a7d5151d | 3794 | // Convert dRate to Fixed and Set the movie rate through SetMovieRate |
ff4aedc5 RN |
3795 | //--------------------------------------------------------------------------- |
3796 | bool wxQTMediaBackend::SetPlaybackRate(double dRate) | |
3797 | { | |
d7a9c895 | 3798 | m_lib.SetMovieRate(m_movie, (Fixed) (dRate * 0x10000)); |
b1ec2381 | 3799 | |
d7a9c895 | 3800 | return m_lib.GetMoviesError() == noErr; |
ff4aedc5 RN |
3801 | } |
3802 | ||
3803 | //--------------------------------------------------------------------------- | |
c5191fbd | 3804 | // wxQTMediaBackend::SetPosition |
ff4aedc5 | 3805 | // |
c5191fbd VZ |
3806 | // 1) Create a time record struct (TimeRecord) with appropriate values |
3807 | // 2) Pass struct to SetMovieTime | |
ff4aedc5 RN |
3808 | //--------------------------------------------------------------------------- |
3809 | bool wxQTMediaBackend::SetPosition(wxLongLong where) | |
3810 | { | |
a7d5151d DS |
3811 | // NB: For some reason SetMovieTime does not work |
3812 | // correctly with the Quicktime Windows SDK (6) | |
3813 | // From Muskelkatermann at the wxForum | |
3814 | // http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=2957 | |
3815 | // RN - note that I have not verified this but there | |
3816 | // is no harm in calling SetMovieTimeValue instead | |
c5191fbd | 3817 | #if 0 |
ff4aedc5 RN |
3818 | TimeRecord theTimeRecord; |
3819 | memset(&theTimeRecord, 0, sizeof(TimeRecord)); | |
600ffb32 | 3820 | theTimeRecord.value.lo = where.GetLo(); |
d7a9c895 RN |
3821 | theTimeRecord.scale = m_lib.GetMovieTimeScale(m_movie); |
3822 | theTimeRecord.base = m_lib.GetMovieTimeBase(m_movie); | |
3823 | m_lib.SetMovieTime(m_movie, &theTimeRecord); | |
c5191fbd VZ |
3824 | #else |
3825 | m_lib.SetMovieTimeValue(m_movie, where.GetLo()); | |
3826 | #endif | |
ff4aedc5 | 3827 | |
b1ec2381 | 3828 | return (m_lib.GetMoviesError() == noErr); |
ff4aedc5 RN |
3829 | } |
3830 | ||
3831 | //--------------------------------------------------------------------------- | |
e163773d | 3832 | // wxQTMediaBackend::GetPosition |
ff4aedc5 | 3833 | // |
e163773d | 3834 | // 1) Calls GetMovieTime to get the position we are in in the movie |
8b5d5223 | 3835 | // in milliseconds (we called |
ff4aedc5 RN |
3836 | //--------------------------------------------------------------------------- |
3837 | wxLongLong wxQTMediaBackend::GetPosition() | |
3838 | { | |
d7a9c895 | 3839 | return m_lib.GetMovieTime(m_movie, NULL); |
ff4aedc5 RN |
3840 | } |
3841 | ||
6f8c67e7 JS |
3842 | //--------------------------------------------------------------------------- |
3843 | // wxQTMediaBackend::GetVolume | |
3844 | // | |
3845 | // Gets the volume through GetMovieVolume - which returns a 16 bit short - | |
3846 | // | |
3847 | // +--------+--------+ | |
3848 | // + (1) + (2) + | |
3849 | // +--------+--------+ | |
3850 | // | |
3851 | // (1) first 8 bits are value before decimal | |
3852 | // (2) second 8 bits are value after decimal | |
3853 | // | |
3854 | // Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to | |
3855 | // 1 (full gain and sound) | |
3856 | //--------------------------------------------------------------------------- | |
3857 | double wxQTMediaBackend::GetVolume() | |
3858 | { | |
3859 | short sVolume = m_lib.GetMovieVolume(m_movie); | |
c5191fbd | 3860 | wxASSERT(m_lib.GetMoviesError() == noErr); |
b11eba7e | 3861 | |
b1ec2381 | 3862 | if (sVolume & (128 << 8)) //negative - no sound |
6f8c67e7 JS |
3863 | return 0.0; |
3864 | ||
b1ec2381 | 3865 | return sVolume / 256.0; |
6f8c67e7 JS |
3866 | } |
3867 | ||
3868 | //--------------------------------------------------------------------------- | |
3869 | // wxQTMediaBackend::SetVolume | |
3870 | // | |
3871 | // Sets the volume through SetMovieVolume - which takes a 16 bit short - | |
3872 | // | |
3873 | // +--------+--------+ | |
3874 | // + (1) + (2) + | |
3875 | // +--------+--------+ | |
3876 | // | |
3877 | // (1) first 8 bits are value before decimal | |
3878 | // (2) second 8 bits are value after decimal | |
3879 | // | |
3880 | // Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to | |
3881 | // 1 (full gain and sound) | |
3882 | //--------------------------------------------------------------------------- | |
3883 | bool wxQTMediaBackend::SetVolume(double dVolume) | |
3884 | { | |
c5191fbd VZ |
3885 | m_lib.SetMovieVolume(m_movie, (short) (dVolume * 256)); |
3886 | return m_lib.GetMoviesError() == noErr; | |
6f8c67e7 JS |
3887 | } |
3888 | ||
ff4aedc5 | 3889 | //--------------------------------------------------------------------------- |
c5191fbd | 3890 | // wxQTMediaBackend::GetDuration |
ff4aedc5 | 3891 | // |
c5191fbd | 3892 | // Calls GetMovieDuration |
ff4aedc5 RN |
3893 | //--------------------------------------------------------------------------- |
3894 | wxLongLong wxQTMediaBackend::GetDuration() | |
3895 | { | |
d7a9c895 | 3896 | return m_lib.GetMovieDuration(m_movie); |
ff4aedc5 RN |
3897 | } |
3898 | ||
3899 | //--------------------------------------------------------------------------- | |
c5191fbd | 3900 | // wxQTMediaBackend::GetState |
ff4aedc5 | 3901 | // |
a7d5151d DS |
3902 | // Determines the current state: |
3903 | // if we are at the beginning, then we are stopped | |
ff4aedc5 RN |
3904 | //--------------------------------------------------------------------------- |
3905 | wxMediaState wxQTMediaBackend::GetState() | |
3906 | { | |
b1ec2381 | 3907 | if (m_bPlaying) |
ff4aedc5 | 3908 | return wxMEDIASTATE_PLAYING; |
b1ec2381 | 3909 | else if ( !m_movie || wxQTMediaBackend::GetPosition() == 0 ) |
c5191fbd | 3910 | return wxMEDIASTATE_STOPPED; |
ff4aedc5 RN |
3911 | else |
3912 | return wxMEDIASTATE_PAUSED; | |
3913 | } | |
3914 | ||
3915 | //--------------------------------------------------------------------------- | |
c5191fbd | 3916 | // wxQTMediaBackend::Cleanup |
ff4aedc5 | 3917 | // |
c5191fbd VZ |
3918 | // Diposes of the movie timer, Disassociates the Movie Controller with |
3919 | // movie and hides it if it exists, and stops and disposes | |
3920 | // of the QT movie | |
ff4aedc5 RN |
3921 | //--------------------------------------------------------------------------- |
3922 | void wxQTMediaBackend::Cleanup() | |
3923 | { | |
c5191fbd VZ |
3924 | m_bPlaying = false; |
3925 | ||
b1ec2381 | 3926 | if (m_timer) |
c5191fbd | 3927 | { |
b1ec2381 DS |
3928 | delete m_timer; |
3929 | m_timer = NULL; | |
c5191fbd | 3930 | } |
ff4aedc5 | 3931 | |
d7a9c895 | 3932 | m_lib.StopMovie(m_movie); |
c5191fbd | 3933 | |
b1ec2381 | 3934 | if (m_pMC) |
c5191fbd VZ |
3935 | { |
3936 | Point thePoint; | |
3937 | thePoint.h = thePoint.v = 0; | |
3938 | m_lib.MCSetVisible(m_pMC, false); | |
3939 | m_lib.MCSetMovie(m_pMC, NULL, NULL, thePoint); | |
3940 | } | |
3941 | ||
d7a9c895 | 3942 | m_lib.DisposeMovie(m_movie); |
c5191fbd | 3943 | m_movie = NULL; |
ff4aedc5 RN |
3944 | } |
3945 | ||
3946 | //--------------------------------------------------------------------------- | |
c5191fbd | 3947 | // wxQTMediaBackend::ShowPlayerControls |
ff4aedc5 | 3948 | // |
c5191fbd VZ |
3949 | // Creates a movie controller for the Movie if the user wants it |
3950 | //--------------------------------------------------------------------------- | |
3951 | bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) | |
3952 | { | |
b1ec2381 | 3953 | if (m_pMC) |
c5191fbd | 3954 | { |
a7d5151d | 3955 | // restore old wndproc |
c5191fbd VZ |
3956 | wxSetWindowProc((HWND)m_ctrl->GetHWND(), wxWndProc); |
3957 | m_lib.DisposeMovieController(m_pMC); | |
3958 | m_pMC = NULL; | |
a7d5151d DS |
3959 | |
3960 | // movie controller height | |
3961 | m_bestSize.y -= 16; | |
c5191fbd VZ |
3962 | } |
3963 | ||
b1ec2381 | 3964 | if (flags && m_movie) |
c5191fbd VZ |
3965 | { |
3966 | Rect rect; | |
3967 | wxRect wxrect = m_ctrl->GetClientRect(); | |
3968 | ||
a7d5151d | 3969 | // make room for controller |
b1ec2381 | 3970 | if (wxrect.width < 320) |
c5191fbd VZ |
3971 | wxrect.width = 320; |
3972 | ||
3832f946 WS |
3973 | rect.top = (short)wxrect.y; |
3974 | rect.left = (short)wxrect.x; | |
3975 | rect.right = (short)(rect.left + wxrect.width); | |
3976 | rect.bottom = (short)(rect.top + wxrect.height); | |
c5191fbd | 3977 | |
b1ec2381 | 3978 | if (!m_pMC) |
c5191fbd VZ |
3979 | { |
3980 | m_pMC = m_lib.NewMovieController(m_movie, &rect, mcTopLeftMovie | | |
3981 | // mcScaleMovieToFit | | |
3982 | // mcWithBadge | | |
3983 | mcWithFrame); | |
09e28f7f | 3984 | m_lib.MCDoAction(m_pMC, 32, (void*)true); // mcActionSetKeysEnabled |
c5191fbd VZ |
3985 | m_lib.MCSetActionFilterWithRefCon(m_pMC, |
3986 | (WXFARPROC)wxQTMediaBackend::MCFilterProc, (void*)this); | |
a7d5151d DS |
3987 | m_bestSize.y += 16; // movie controller height |
3988 | ||
3989 | // By default the movie controller uses its own colour palette | |
3990 | // for the movie which can be bad on some files, so turn it off. | |
09e28f7f | 3991 | // Also turn off its frame / border for the movie |
a7d5151d | 3992 | // Also take care of a couple of the interface flags here |
c5191fbd VZ |
3993 | long mcFlags = 0; |
3994 | m_lib.MCDoAction(m_pMC, 39/*mcActionGetFlags*/, (void*)&mcFlags); | |
a7d5151d | 3995 | |
9d7d3b1f | 3996 | mcFlags |= |
a7d5151d DS |
3997 | // (1<< 0) /*mcFlagSuppressMovieFrame*/ | |
3998 | (1<< 3) /*mcFlagsUseWindowPalette*/ | |
3999 | | ((flags & wxMEDIACTRLPLAYERCONTROLS_STEP) | |
b1ec2381 | 4000 | ? 0 : (1<< 1) /*mcFlagSuppressStepButtons*/) |
a7d5151d | 4001 | | ((flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME) |
b1ec2381 | 4002 | ? 0 : (1<< 2) /*mcFlagSuppressSpeakerButton*/) |
a7d5151d DS |
4003 | // | (1<< 4) /*mcFlagDontInvalidate*/ // if we take care of repainting ourselves |
4004 | ; | |
4005 | ||
c5191fbd VZ |
4006 | m_lib.MCDoAction(m_pMC, 38/*mcActionSetFlags*/, (void*)mcFlags); |
4007 | ||
a7d5151d DS |
4008 | // intercept the wndproc of our control window |
4009 | wxSetWindowProc((HWND)m_ctrl->GetHWND(), wxQTMediaBackend::QTWndProc); | |
c5191fbd | 4010 | |
a7d5151d | 4011 | // set the user data of our window |
c5191fbd VZ |
4012 | wxSetWindowUserData((HWND)m_ctrl->GetHWND(), this); |
4013 | } | |
4014 | } | |
4015 | ||
7e41b689 | 4016 | NotifyMovieSizeChanged(); |
c5191fbd VZ |
4017 | |
4018 | return m_lib.GetMoviesError() == noErr; | |
4019 | } | |
4020 | ||
4021 | //--------------------------------------------------------------------------- | |
4022 | // wxQTMediaBackend::MCFilterProc (static) | |
4023 | // | |
4024 | // Callback for when the movie controller recieves a message | |
4025 | //--------------------------------------------------------------------------- | |
a7d5151d | 4026 | Boolean wxQTMediaBackend::MCFilterProc(MovieController WXUNUSED(theController), |
c5191fbd VZ |
4027 | short action, |
4028 | void * WXUNUSED(params), | |
4029 | LONG_PTR refCon) | |
4030 | { | |
09e28f7f DS |
4031 | // NB: potential optimisation |
4032 | // if (action == 1) | |
4033 | // return 0; | |
4034 | ||
a7d5151d | 4035 | wxQTMediaBackend* pThis = (wxQTMediaBackend*)refCon; |
c5191fbd | 4036 | |
a7d5151d DS |
4037 | switch (action) |
4038 | { | |
09e28f7f DS |
4039 | case 1: |
4040 | // don't process idle events | |
4041 | break; | |
4042 | ||
a7d5151d DS |
4043 | case 8: |
4044 | // play button triggered - MC will set movie to opposite state | |
4045 | // of current - playing ? paused : playing | |
4046 | if (pThis) | |
c5191fbd VZ |
4047 | pThis->m_bPlaying = !(pThis->m_bPlaying); |
4048 | ||
a7d5151d DS |
4049 | // NB: Sometimes it doesn't redraw properly - |
4050 | // if you click on the button but don't move the mouse | |
4051 | // the button will not change its state until you move | |
4052 | // mcActionDraw and Refresh/Update combo do nothing | |
4053 | // to help this unfortunately | |
4054 | break; | |
b1ec2381 | 4055 | |
a7d5151d DS |
4056 | default: |
4057 | break; | |
c5191fbd | 4058 | } |
a7d5151d | 4059 | |
c5191fbd VZ |
4060 | return 0; |
4061 | } | |
4062 | ||
4063 | //--------------------------------------------------------------------------- | |
4064 | // wxQTMediaBackend::GetVideoSize | |
4065 | // | |
4066 | // Returns the actual size of the QT movie | |
ff4aedc5 RN |
4067 | //--------------------------------------------------------------------------- |
4068 | wxSize wxQTMediaBackend::GetVideoSize() const | |
4069 | { | |
4070 | return m_bestSize; | |
4071 | } | |
4072 | ||
4073 | //--------------------------------------------------------------------------- | |
4074 | // wxQTMediaBackend::Move | |
4075 | // | |
c5191fbd | 4076 | // Sets the bounds of either the Movie or Movie Controller |
ff4aedc5 | 4077 | //--------------------------------------------------------------------------- |
d7a9c895 | 4078 | void wxQTMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h) |
ff4aedc5 | 4079 | { |
b1ec2381 | 4080 | if (m_movie) |
ff4aedc5 | 4081 | { |
a7d5151d | 4082 | // make room for controller |
b1ec2381 | 4083 | if (m_pMC) |
c5191fbd | 4084 | { |
b1ec2381 | 4085 | if (w < 320) |
c5191fbd | 4086 | w = 320; |
ff4aedc5 | 4087 | |
c5191fbd VZ |
4088 | Rect theRect = {0, 0, (short)h, (short)w}; |
4089 | m_lib.MCSetControllerBoundsRect(m_pMC, &theRect); | |
4090 | } | |
4091 | else | |
4092 | { | |
4093 | Rect theRect = {0, 0, (short)h, (short)w}; | |
b1ec2381 | 4094 | m_lib.SetMovieBox(m_movie, &theRect); |
c5191fbd VZ |
4095 | } |
4096 | ||
d7a9c895 | 4097 | wxASSERT(m_lib.GetMoviesError() == noErr); |
ff4aedc5 RN |
4098 | } |
4099 | } | |
4100 | ||
c5191fbd VZ |
4101 | //--------------------------------------------------------------------------- |
4102 | // wxQTMediaBackend::OnEraseBackground | |
4103 | // | |
4104 | // Suggestion from Greg Hazel to repaint the movie when idle | |
4105 | // (on pause also) | |
4106 | // | |
a7d5151d DS |
4107 | // TODO: We may be repainting too much here - under what exact circumstances |
4108 | // do we need this? I think Move also repaints correctly for the Movie | |
c5191fbd VZ |
4109 | // Controller, so in that instance we don't need this either |
4110 | //--------------------------------------------------------------------------- | |
4111 | void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt) | |
4112 | { | |
6ab9bf57 | 4113 | wxQuickTimeLibrary& m_pLib = m_qtb->m_lib; |
c5191fbd | 4114 | |
6ab9bf57 | 4115 | if ( m_qtb->m_pMC ) |
c5191fbd | 4116 | { |
f10747d8 | 4117 | // repaint movie controller |
6ab9bf57 | 4118 | m_pLib.MCDoAction(m_qtb->m_pMC, 2 /*mcActionDraw*/, |
7e41b689 | 4119 | m_pLib.GetNativeWindowPort(m_hwnd)); |
c5191fbd | 4120 | } |
a7d5151d | 4121 | else if ( m_qtb->m_movie ) |
c5191fbd | 4122 | { |
a7d5151d DS |
4123 | // no movie controller |
4124 | CGrafPtr port = (CGrafPtr)m_pLib.GetNativeWindowPort(m_hwnd); | |
c5191fbd | 4125 | |
a7d5151d DS |
4126 | m_pLib.BeginUpdate(port); |
4127 | m_pLib.UpdateMovie(m_qtb->m_movie); | |
4128 | wxASSERT(m_pLib.GetMoviesError() == noErr); | |
4129 | m_pLib.EndUpdate(port); | |
4130 | } | |
4131 | else | |
4132 | { | |
4133 | // no movie | |
4134 | // let the system repaint the window | |
4135 | evt.Skip(); | |
c5191fbd | 4136 | } |
c5191fbd VZ |
4137 | } |
4138 | ||
ff4aedc5 | 4139 | //--------------------------------------------------------------------------- |
1146983c | 4140 | // End QT Backend |
ff4aedc5 | 4141 | //--------------------------------------------------------------------------- |
ff4aedc5 RN |
4142 | |
4143 | //in source file that contains stuff you don't directly use | |
7ec69821 | 4144 | #include "wx/html/forcelnk.h" |
412e0d47 | 4145 | FORCE_LINK_ME(basewxmediabackends) |
ff4aedc5 | 4146 | |
72259e00 | 4147 | #endif //wxUSE_MEDIACTRL |