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