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