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