1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/mediactrl.cpp
3 // Purpose: Built-in Media Backends for Windows
4 // Author: Ryan Norton <wxprojects@comcast.net>
8 // Copyright: (c) Ryan Norton
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
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
18 //===========================================================================
20 //===========================================================================
22 //---------------------------------------------------------------------------
23 // Pre-compiled header stuff
24 //---------------------------------------------------------------------------
26 // For compilers that support precompilation, includes "wx.h".
27 #include "wx/wxprec.h"
33 //---------------------------------------------------------------------------
35 //---------------------------------------------------------------------------
36 #include "wx/mediactrl.h"
38 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
43 //---------------------------------------------------------------------------
45 //---------------------------------------------------------------------------
46 #include "wx/log.h" //wxLogDebug
47 #include "wx/math.h" //log10 & pow
48 #include "wx/msw/private.h" //user info and wndproc setting/getting
49 #include "wx/dcclient.h"
51 #include "wx/dynlib.h"
53 //---------------------------------------------------------------------------
54 // Externals (somewhere in src/msw/app.cpp and src/msw/window.cpp)
55 //---------------------------------------------------------------------------
56 extern "C" WXDLLIMPEXP_BASE HINSTANCE
wxGetInstance(void);
58 extern WXDLLIMPEXP_CORE wxChar
*wxCanvasClassName
;
60 extern WXDLLIMPEXP_CORE
const wxChar
*wxCanvasClassName
;
63 LRESULT WXDLLIMPEXP_CORE APIENTRY _EXPORT
wxWndProc(HWND hWnd
, UINT message
,
64 WPARAM wParam
, LPARAM lParam
);
66 //===========================================================================
67 // BACKEND DECLARATIONS
68 //===========================================================================
70 //---------------------------------------------------------------------------
74 //---------------------------------------------------------------------------
76 //---------------------------------------------------------------------------
77 // wxActiveXContainer - includes all the COM-specific stuff we need
78 //---------------------------------------------------------------------------
79 #include "wx/msw/ole/activex.h"
81 //---------------------------------------------------------------------------
82 // IIDS - used by CoCreateInstance and IUnknown::QueryInterface
84 // [idl name] [idl decription]
85 // amcompat.idl Microsoft Active Movie Control (Ver 2.0)
86 // nscompat.idl Microsoft NetShow Player (Ver 1.0)
87 // msdxm.idl Windows Media Player (Ver 1.0)
90 // First, when I say I "from XXX.idl", I mean I go into the COM Browser
91 // ($Microsoft Visual Studio$/Common/Tools/OLEVIEW.EXE), open
92 // "type libraries", open a specific type library (for quartz for example its
93 // "ActiveMovie control type library (V1.0)"), save it as an .idl, compile the
94 // idl using the midl compiler that comes with visual studio
95 // ($Microsoft Visual Studio$/VC98/bin/midl.exe on VC6) with the /h argument
96 // to make it generate stubs (a .h & .c file), then clean up the generated
97 // interfaces I want with the STDMETHOD wrappers and then put them into
100 // According to the MSDN docs, IMediaPlayer requires Windows 98 SE
101 // or greater. NetShow is available on Windows 3.1 and I'm guessing
102 // IActiveMovie is too. IMediaPlayer is essentially the Windows Media
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}};
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}};
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}};
118 const CLSID CLSID_ActiveMovie
= {0x05589FA1,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}};
119 const CLSID CLSID_MediaPlayer
= {0x22D6F312,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}};
120 const CLSID CLSID_NSPlay
= {0x2179C5D3,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}};
122 const IID IID_IAMOpenProgress
= {0x8E1C39A1, 0xDE53, 0x11CF,{0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D}};
125 const CLSID CLSID_FilgraphManager
= {0xE436EBB3,0x524F,0x11CE,{0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70}};
126 const IID IID_IMediaEvent
= {0x56A868B6,0x0AD4,0x11CE,{0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70}};
129 const CLSID CLSID_VideoMixingRenderer9
={0x51B4ABF3, 0x748F, 0x4E3B,{0xA2, 0x76, 0xC8, 0x28, 0x33, 0x0E, 0x92, 0x6A}};
130 const IID IID_IVMRWindowlessControl9
= {0x8F537D09, 0xF85E, 0x4414,{0xB2, 0x3B, 0x50, 0x2E, 0x54, 0xC7, 0x99, 0x27}};
131 const IID IID_IFilterGraph
= {0x56A8689F, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
132 const IID IID_IGraphBuilder
= {0x56A868A9, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
133 const IID IID_IVMRFilterConfig9
= {0x5A804648, 0x4F66, 0x4867,{0x9C, 0x43, 0x4F, 0x5C, 0x82, 0x2C, 0xF1, 0xB8}};
134 const IID IID_IBaseFilter
= {0x56A86895, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
136 //---------------------------------------------------------------------------
137 // QUARTZ COM INTERFACES (dumped from quartz.idl from MSVC COM Browser)
138 //---------------------------------------------------------------------------
140 struct IAMOpenProgress
: public IUnknown
142 STDMETHOD(QueryProgress
)(LONGLONG
*pllTotal
, LONGLONG
*pllCurrent
) PURE
;
143 STDMETHOD(AbortOperation
)(void) PURE
;
146 struct IMediaEvent
: public IDispatch
148 STDMETHOD(GetEventHandle
)(LONG_PTR
*) PURE
;
149 STDMETHOD(GetEvent
)(long *, LONG_PTR
*, LONG_PTR
*, long) PURE
;
150 STDMETHOD(WaitForCompletion
)(long, long *) PURE
;
151 STDMETHOD(CancelDefaultHandling
)(long) PURE
;
152 STDMETHOD(RestoreDefaultHandling
)(long) PURE
;
153 STDMETHOD(FreeEventParams
)(long, LONG_PTR
, LONG_PTR
) PURE
;
156 //---------------------------------------------------------------------------
157 // ACTIVEMOVIE COM INTERFACES (dumped from amcompat.idl from MSVC COM Browser)
158 //---------------------------------------------------------------------------
160 enum ReadyStateConstants
162 amvUninitialized
= 0,
176 enum DisplayModeConstants
182 enum WindowSizeConstants
185 amvDoubleOriginalSize
= 1,
186 amvOneSixteenthScreen
= 2,
187 amvOneFourthScreen
= 3,
191 enum AppearanceConstants
197 enum BorderStyleConstants
203 struct IActiveMovie
: public IDispatch
205 STDMETHOD(AboutBox
)( void) PURE
;
206 STDMETHOD(Run
)( void) PURE
;
207 STDMETHOD(Pause
)( void) PURE
;
208 STDMETHOD(Stop
)( void) PURE
;
209 STDMETHOD(get_ImageSourceWidth
)(long __RPC_FAR
*pWidth
) PURE
;
210 STDMETHOD(get_ImageSourceHeight
)(long __RPC_FAR
*pHeight
) PURE
;
211 STDMETHOD(get_Author
)(BSTR __RPC_FAR
*pbstrAuthor
) PURE
;
212 STDMETHOD(get_Title
)(BSTR __RPC_FAR
*pbstrTitle
) PURE
;
213 STDMETHOD(get_Copyright
)(BSTR __RPC_FAR
*pbstrCopyright
) PURE
;
214 STDMETHOD(get_Description
)(BSTR __RPC_FAR
*pbstrDescription
) PURE
;
215 STDMETHOD(get_Rating
)(BSTR __RPC_FAR
*pbstrRating
) PURE
;
216 STDMETHOD(get_FileName
)(BSTR __RPC_FAR
*pbstrFileName
) PURE
;
217 STDMETHOD(put_FileName
)(BSTR pbstrFileName
) PURE
;
218 STDMETHOD(get_Duration
)(double __RPC_FAR
*pValue
) PURE
;
219 STDMETHOD(get_CurrentPosition
)(double __RPC_FAR
*pValue
) PURE
;
220 STDMETHOD(put_CurrentPosition
)(double pValue
) PURE
;
221 STDMETHOD(get_PlayCount
)(long __RPC_FAR
*pPlayCount
) PURE
;
222 STDMETHOD(put_PlayCount
)(long pPlayCount
) PURE
;
223 STDMETHOD(get_SelectionStart
)(double __RPC_FAR
*pValue
) PURE
;
224 STDMETHOD(put_SelectionStart
)(double pValue
) PURE
;
225 STDMETHOD(get_SelectionEnd
)(double __RPC_FAR
*pValue
) PURE
;
226 STDMETHOD(put_SelectionEnd
)(double pValue
) PURE
;
227 STDMETHOD(get_CurrentState
)(StateConstants __RPC_FAR
*pState
) PURE
;
228 STDMETHOD(get_Rate
)(double __RPC_FAR
*pValue
) PURE
;
229 STDMETHOD(put_Rate
)(double pValue
) PURE
;
230 STDMETHOD(get_Volume
)(long __RPC_FAR
*pValue
) PURE
;
231 STDMETHOD(put_Volume
)(long pValue
) PURE
;
232 STDMETHOD(get_Balance
)(long __RPC_FAR
*pValue
) PURE
;
233 STDMETHOD(put_Balance
)(long pValue
) PURE
;
234 STDMETHOD(get_EnableContextMenu
)(VARIANT_BOOL __RPC_FAR
*pEnable
) PURE
;
235 STDMETHOD(put_EnableContextMenu
)(VARIANT_BOOL pEnable
) PURE
;
236 STDMETHOD(get_ShowDisplay
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
237 STDMETHOD(put_ShowDisplay
)(VARIANT_BOOL Show
) PURE
;
238 STDMETHOD(get_ShowControls
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
239 STDMETHOD(put_ShowControls
)(VARIANT_BOOL Show
) PURE
;
240 STDMETHOD(get_ShowPositionControls
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
241 STDMETHOD(put_ShowPositionControls
)(VARIANT_BOOL Show
) PURE
;
242 STDMETHOD(get_ShowSelectionControls
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
243 STDMETHOD(put_ShowSelectionControls
)(VARIANT_BOOL Show
) PURE
;
244 STDMETHOD(get_ShowTracker
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
245 STDMETHOD(put_ShowTracker
)(VARIANT_BOOL Show
) PURE
;
246 STDMETHOD(get_EnablePositionControls
)(VARIANT_BOOL __RPC_FAR
*Enable
) PURE
;
247 STDMETHOD(put_EnablePositionControls
)(VARIANT_BOOL Enable
) PURE
;
248 STDMETHOD(get_EnableSelectionControls
)(VARIANT_BOOL __RPC_FAR
*Enable
) PURE
;
249 STDMETHOD(put_EnableSelectionControls
)(VARIANT_BOOL Enable
) PURE
;
250 STDMETHOD(get_EnableTracker
)(VARIANT_BOOL __RPC_FAR
*Enable
) PURE
;
251 STDMETHOD(put_EnableTracker
)(VARIANT_BOOL Enable
) PURE
;
252 STDMETHOD(get_AllowHideDisplay
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
253 STDMETHOD(put_AllowHideDisplay
)(VARIANT_BOOL Show
) PURE
;
254 STDMETHOD(get_AllowHideControls
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
255 STDMETHOD(put_AllowHideControls
)(VARIANT_BOOL Show
) PURE
;
256 STDMETHOD(get_DisplayMode
)(DisplayModeConstants __RPC_FAR
*pValue
) PURE
;
257 STDMETHOD(put_DisplayMode
)(DisplayModeConstants pValue
) PURE
;
258 STDMETHOD(get_AllowChangeDisplayMode
)(VARIANT_BOOL __RPC_FAR
*fAllow
) PURE
;
259 STDMETHOD(put_AllowChangeDisplayMode
)(VARIANT_BOOL fAllow
) PURE
;
260 STDMETHOD(get_FilterGraph
)(IUnknown __RPC_FAR
*__RPC_FAR
*ppFilterGraph
) PURE
;
261 STDMETHOD(put_FilterGraph
)(IUnknown __RPC_FAR
*ppFilterGraph
) PURE
;
262 STDMETHOD(get_FilterGraphDispatch
)(IDispatch __RPC_FAR
*__RPC_FAR
*pDispatch
) PURE
;
263 STDMETHOD(get_DisplayForeColor
)(unsigned long __RPC_FAR
*ForeColor
) PURE
;
264 STDMETHOD(put_DisplayForeColor
)(unsigned long ForeColor
) PURE
;
265 STDMETHOD(get_DisplayBackColor
)(unsigned long __RPC_FAR
*BackColor
) PURE
;
266 STDMETHOD(put_DisplayBackColor
)(unsigned long BackColor
) PURE
;
267 STDMETHOD(get_MovieWindowSize
)(WindowSizeConstants __RPC_FAR
*WindowSize
) PURE
;
268 STDMETHOD(put_MovieWindowSize
)(WindowSizeConstants WindowSize
) PURE
;
269 STDMETHOD(get_FullScreenMode
)(VARIANT_BOOL __RPC_FAR
*pEnable
) PURE
;
270 STDMETHOD(put_FullScreenMode
)(VARIANT_BOOL pEnable
) PURE
;
271 STDMETHOD(get_AutoStart
)(VARIANT_BOOL __RPC_FAR
*pEnable
) PURE
;
272 STDMETHOD(put_AutoStart
)(VARIANT_BOOL pEnable
) PURE
;
273 STDMETHOD(get_AutoRewind
)(VARIANT_BOOL __RPC_FAR
*pEnable
) PURE
;
274 STDMETHOD(put_AutoRewind
)(VARIANT_BOOL pEnable
) PURE
;
275 STDMETHOD(get_hWnd
)(long __RPC_FAR
*hWnd
) PURE
;
276 STDMETHOD(get_Appearance
)(AppearanceConstants __RPC_FAR
*pAppearance
) PURE
;
277 STDMETHOD(put_Appearance
)(AppearanceConstants pAppearance
) PURE
;
278 STDMETHOD(get_BorderStyle
)(BorderStyleConstants __RPC_FAR
*pBorderStyle
) PURE
;
279 STDMETHOD(put_BorderStyle
)(BorderStyleConstants pBorderStyle
) PURE
;
280 STDMETHOD(get_Enabled
)(VARIANT_BOOL __RPC_FAR
*pEnabled
) PURE
;
281 STDMETHOD(put_Enabled
)(VARIANT_BOOL pEnabled
) PURE
;
282 STDMETHOD(get_Info
)(long __RPC_FAR
*ppInfo
) PURE
;
286 struct IActiveMovie2
: public IActiveMovie
288 STDMETHOD(IsSoundCardEnabled
)(VARIANT_BOOL __RPC_FAR
*pbSoundCard
) PURE
;
289 STDMETHOD(get_ReadyState
)(ReadyStateConstants __RPC_FAR
*pValue
) PURE
;
292 struct IActiveMovie3
: public IActiveMovie2
294 STDMETHOD(get_MediaPlayer
)(IDispatch __RPC_FAR
*__RPC_FAR
*ppDispatch
) PURE
;
298 //---------------------------------------------------------------------------
299 // MEDIAPLAYER COM INTERFACES (dumped from msdxm.idl from MSVC COM Browser)
300 //---------------------------------------------------------------------------
302 enum MPPlayStateConstants
313 enum MPDisplaySizeConstants
320 mpOneSixteenthScreen
= 5,
321 mpOneFourthScreen
= 6,
325 enum MPReadyStateConstants
327 mpReadyStateUninitialized
= 0,
328 mpReadyStateLoading
= 1,
329 mpReadyStateInteractive
= 3,
330 mpReadyStateComplete
= 4
333 typedef unsigned long VB_OLE_COLOR
;
335 enum MPDisplayModeConstants
355 mpShowDescription
= 5,
360 mpClipCopyright
= 10,
362 mpClipDescription
= 12,
365 mpBannerMoreInfo
= 15,
369 enum DVDMenuIDConstants
373 dvdMenu_Subpicture
= 4,
379 enum MPShowDialogConstants
381 mpShowDialogHelp
= 0,
382 mpShowDialogStatistics
= 1,
383 mpShowDialogOptions
= 2,
384 mpShowDialogContextMenu
= 3
388 struct IMediaPlayer
: public IDispatch
390 STDMETHOD(get_CurrentPosition
)(double __RPC_FAR
*pCurrentPosition
) PURE
;
391 STDMETHOD(put_CurrentPosition
)(double pCurrentPosition
) PURE
;
392 STDMETHOD(get_Duration
)(double __RPC_FAR
*pDuration
) PURE
;
393 STDMETHOD(get_ImageSourceWidth
)(long __RPC_FAR
*pWidth
) PURE
;
394 STDMETHOD(get_ImageSourceHeight
)(long __RPC_FAR
*pHeight
) PURE
;
395 STDMETHOD(get_MarkerCount
)(long __RPC_FAR
*pMarkerCount
) PURE
;
396 STDMETHOD(get_CanScan
)(VARIANT_BOOL __RPC_FAR
*pCanScan
) PURE
;
397 STDMETHOD(get_CanSeek
)(VARIANT_BOOL __RPC_FAR
*pCanSeek
) PURE
;
398 STDMETHOD(get_CanSeekToMarkers
)(VARIANT_BOOL __RPC_FAR
*pCanSeekToMarkers
) PURE
;
399 STDMETHOD(get_CurrentMarker
)(long __RPC_FAR
*pCurrentMarker
) PURE
;
400 STDMETHOD(put_CurrentMarker
)(long pCurrentMarker
) PURE
;
401 STDMETHOD(get_FileName
)(BSTR __RPC_FAR
*pbstrFileName
) PURE
;
402 STDMETHOD(put_FileName
)(BSTR pbstrFileName
) PURE
;
403 STDMETHOD(get_SourceLink
)(BSTR __RPC_FAR
*pbstrSourceLink
) PURE
;
404 STDMETHOD(get_CreationDate
)(DATE __RPC_FAR
*pCreationDate
) PURE
;
405 STDMETHOD(get_ErrorCorrection
)(BSTR __RPC_FAR
*pbstrErrorCorrection
) PURE
;
406 STDMETHOD(get_Bandwidth
)(long __RPC_FAR
*pBandwidth
) PURE
;
407 STDMETHOD(get_SourceProtocol
)(long __RPC_FAR
*pSourceProtocol
) PURE
;
408 STDMETHOD(get_ReceivedPackets
)(long __RPC_FAR
*pReceivedPackets
) PURE
;
409 STDMETHOD(get_RecoveredPackets
)(long __RPC_FAR
*pRecoveredPackets
) PURE
;
410 STDMETHOD(get_LostPackets
)(long __RPC_FAR
*pLostPackets
) PURE
;
411 STDMETHOD(get_ReceptionQuality
)(long __RPC_FAR
*pReceptionQuality
) PURE
;
412 STDMETHOD(get_BufferingCount
)(long __RPC_FAR
*pBufferingCount
) PURE
;
413 STDMETHOD(get_IsBroadcast
)(VARIANT_BOOL __RPC_FAR
*pIsBroadcast
) PURE
;
414 STDMETHOD(get_BufferingProgress
)(long __RPC_FAR
*pBufferingProgress
) PURE
;
415 STDMETHOD(get_ChannelName
)(BSTR __RPC_FAR
*pbstrChannelName
) PURE
;
416 STDMETHOD(get_ChannelDescription
)(BSTR __RPC_FAR
*pbstrChannelDescription
) PURE
;
417 STDMETHOD(get_ChannelURL
)(BSTR __RPC_FAR
*pbstrChannelURL
) PURE
;
418 STDMETHOD(get_ContactAddress
)(BSTR __RPC_FAR
*pbstrContactAddress
) PURE
;
419 STDMETHOD(get_ContactPhone
)(BSTR __RPC_FAR
*pbstrContactPhone
) PURE
;
420 STDMETHOD(get_ContactEmail
)(BSTR __RPC_FAR
*pbstrContactEmail
) PURE
;
421 STDMETHOD(get_BufferingTime
)(double __RPC_FAR
*pBufferingTime
) PURE
;
422 STDMETHOD(put_BufferingTime
)(double pBufferingTime
) PURE
;
423 STDMETHOD(get_AutoStart
)(VARIANT_BOOL __RPC_FAR
*pAutoStart
) PURE
;
424 STDMETHOD(put_AutoStart
)(VARIANT_BOOL pAutoStart
) PURE
;
425 STDMETHOD(get_AutoRewind
)(VARIANT_BOOL __RPC_FAR
*pAutoRewind
) PURE
;
426 STDMETHOD(put_AutoRewind
)(VARIANT_BOOL pAutoRewind
) PURE
;
427 STDMETHOD(get_Rate
)(double __RPC_FAR
*pRate
) PURE
;
428 STDMETHOD(put_Rate
)(double pRate
) PURE
;
429 STDMETHOD(get_SendKeyboardEvents
)(VARIANT_BOOL __RPC_FAR
*pSendKeyboardEvents
) PURE
;
430 STDMETHOD(put_SendKeyboardEvents
)(VARIANT_BOOL pSendKeyboardEvents
) PURE
;
431 STDMETHOD(get_SendMouseClickEvents
)(VARIANT_BOOL __RPC_FAR
*pSendMouseClickEvents
) PURE
;
432 STDMETHOD(put_SendMouseClickEvents
)(VARIANT_BOOL pSendMouseClickEvents
) PURE
;
433 STDMETHOD(get_SendMouseMoveEvents
)(VARIANT_BOOL __RPC_FAR
*pSendMouseMoveEvents
) PURE
;
434 STDMETHOD(put_SendMouseMoveEvents
)(VARIANT_BOOL pSendMouseMoveEvents
) PURE
;
435 STDMETHOD(get_PlayCount
)(long __RPC_FAR
*pPlayCount
) PURE
;
436 STDMETHOD(put_PlayCount
)(long pPlayCount
) PURE
;
437 STDMETHOD(get_ClickToPlay
)(VARIANT_BOOL __RPC_FAR
*pClickToPlay
) PURE
;
438 STDMETHOD(put_ClickToPlay
)(VARIANT_BOOL pClickToPlay
) PURE
;
439 STDMETHOD(get_AllowScan
)(VARIANT_BOOL __RPC_FAR
*pAllowScan
) PURE
;
440 STDMETHOD(put_AllowScan
)(VARIANT_BOOL pAllowScan
) PURE
;
441 STDMETHOD(get_EnableContextMenu
)(VARIANT_BOOL __RPC_FAR
*pEnableContextMenu
) PURE
;
442 STDMETHOD(put_EnableContextMenu
)(VARIANT_BOOL pEnableContextMenu
) PURE
;
443 STDMETHOD(get_CursorType
)(long __RPC_FAR
*pCursorType
) PURE
;
444 STDMETHOD(put_CursorType
)(long pCursorType
) PURE
;
445 STDMETHOD(get_CodecCount
)(long __RPC_FAR
*pCodecCount
) PURE
;
446 STDMETHOD(get_AllowChangeDisplaySize
)(VARIANT_BOOL __RPC_FAR
*pAllowChangeDisplaySize
) PURE
;
447 STDMETHOD(put_AllowChangeDisplaySize
)( VARIANT_BOOL pAllowChangeDisplaySize
) PURE
;
448 STDMETHOD(get_IsDurationValid
)(VARIANT_BOOL __RPC_FAR
*pIsDurationValid
) PURE
;
449 STDMETHOD(get_OpenState
)(long __RPC_FAR
*pOpenState
) PURE
;
450 STDMETHOD(get_SendOpenStateChangeEvents
)(VARIANT_BOOL __RPC_FAR
*pSendOpenStateChangeEvents
) PURE
;
451 STDMETHOD(put_SendOpenStateChangeEvents
)(VARIANT_BOOL pSendOpenStateChangeEvents
) PURE
;
452 STDMETHOD(get_SendWarningEvents
)( VARIANT_BOOL __RPC_FAR
*pSendWarningEvents
) PURE
;
453 STDMETHOD(put_SendWarningEvents
)(VARIANT_BOOL pSendWarningEvents
) PURE
;
454 STDMETHOD(get_SendErrorEvents
)(VARIANT_BOOL __RPC_FAR
*pSendErrorEvents
) PURE
;
455 STDMETHOD(put_SendErrorEvents
)(VARIANT_BOOL pSendErrorEvents
) PURE
;
456 STDMETHOD(get_PlayState
)(MPPlayStateConstants __RPC_FAR
*pPlayState
) PURE
;
457 STDMETHOD(get_SendPlayStateChangeEvents
)(VARIANT_BOOL __RPC_FAR
*pSendPlayStateChangeEvents
) PURE
;
458 STDMETHOD(put_SendPlayStateChangeEvents
)(VARIANT_BOOL pSendPlayStateChangeEvents
) PURE
;
459 STDMETHOD(get_DisplaySize
)(MPDisplaySizeConstants __RPC_FAR
*pDisplaySize
) PURE
;
460 STDMETHOD(put_DisplaySize
)(MPDisplaySizeConstants pDisplaySize
) PURE
;
461 STDMETHOD(get_InvokeURLs
)(VARIANT_BOOL __RPC_FAR
*pInvokeURLs
) PURE
;
462 STDMETHOD(put_InvokeURLs
)(VARIANT_BOOL pInvokeURLs
) PURE
;
463 STDMETHOD(get_BaseURL
)(BSTR __RPC_FAR
*pbstrBaseURL
) PURE
;
464 STDMETHOD(put_BaseURL
)(BSTR pbstrBaseURL
) PURE
;
465 STDMETHOD(get_DefaultFrame
)(BSTR __RPC_FAR
*pbstrDefaultFrame
) PURE
;
466 STDMETHOD(put_DefaultFrame
)(BSTR pbstrDefaultFrame
) PURE
;
467 STDMETHOD(get_HasError
)(VARIANT_BOOL __RPC_FAR
*pHasError
) PURE
;
468 STDMETHOD(get_ErrorDescription
)(BSTR __RPC_FAR
*pbstrErrorDescription
) PURE
;
469 STDMETHOD(get_ErrorCode
)(long __RPC_FAR
*pErrorCode
) PURE
;
470 STDMETHOD(get_AnimationAtStart
)(VARIANT_BOOL __RPC_FAR
*pAnimationAtStart
) PURE
;
471 STDMETHOD(put_AnimationAtStart
)(VARIANT_BOOL pAnimationAtStart
) PURE
;
472 STDMETHOD(get_TransparentAtStart
)( VARIANT_BOOL __RPC_FAR
*pTransparentAtStart
) PURE
;
473 STDMETHOD(put_TransparentAtStart
)(VARIANT_BOOL pTransparentAtStart
) PURE
;
474 STDMETHOD(get_Volume
)(long __RPC_FAR
*pVolume
) PURE
;
475 STDMETHOD(put_Volume
)(long pVolume
) PURE
;
476 STDMETHOD(get_Balance
)(long __RPC_FAR
*pBalance
) PURE
;
477 STDMETHOD(put_Balance
)(long pBalance
) PURE
;
478 STDMETHOD(get_ReadyState
)(MPReadyStateConstants __RPC_FAR
*pValue
) PURE
;
479 STDMETHOD(get_SelectionStart
)(double __RPC_FAR
*pValue
) PURE
;
480 STDMETHOD(put_SelectionStart
)(double pValue
) PURE
;
481 STDMETHOD(get_SelectionEnd
)(double __RPC_FAR
*pValue
) PURE
;
482 STDMETHOD(put_SelectionEnd
)(double pValue
) PURE
;
483 STDMETHOD(get_ShowDisplay
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
484 STDMETHOD(put_ShowDisplay
)(VARIANT_BOOL Show
) PURE
;
485 STDMETHOD(get_ShowControls
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
486 STDMETHOD(put_ShowControls
)(VARIANT_BOOL Show
) PURE
;
487 STDMETHOD(get_ShowPositionControls
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
488 STDMETHOD(put_ShowPositionControls
)(VARIANT_BOOL Show
) PURE
;
489 STDMETHOD(get_ShowTracker
)(VARIANT_BOOL __RPC_FAR
*Show
) PURE
;
490 STDMETHOD(put_ShowTracker
)(VARIANT_BOOL Show
) PURE
;
491 STDMETHOD(get_EnablePositionControls
)(VARIANT_BOOL __RPC_FAR
*Enable
) PURE
;
492 STDMETHOD(put_EnablePositionControls
)(VARIANT_BOOL Enable
) PURE
;
493 STDMETHOD(get_EnableTracker
)(VARIANT_BOOL __RPC_FAR
*Enable
) PURE
;
494 STDMETHOD(put_EnableTracker
)(VARIANT_BOOL Enable
) PURE
;
495 STDMETHOD(get_Enabled
)(VARIANT_BOOL __RPC_FAR
*pEnabled
) PURE
;
496 STDMETHOD(put_Enabled
)(VARIANT_BOOL pEnabled
) PURE
;
497 STDMETHOD(get_DisplayForeColor
)(VB_OLE_COLOR __RPC_FAR
*ForeColor
) PURE
;
498 STDMETHOD(put_DisplayForeColor
)(VB_OLE_COLOR ForeColor
) PURE
;
499 STDMETHOD(get_DisplayBackColor
)(VB_OLE_COLOR __RPC_FAR
*BackColor
) PURE
;
500 STDMETHOD(put_DisplayBackColor
)(VB_OLE_COLOR BackColor
) PURE
;
501 STDMETHOD(get_DisplayMode
)(MPDisplayModeConstants __RPC_FAR
*pValue
) PURE
;
502 STDMETHOD(put_DisplayMode
)(MPDisplayModeConstants pValue
) PURE
;
503 STDMETHOD(get_VideoBorder3D
)(VARIANT_BOOL __RPC_FAR
*pVideoBorderWidth
) PURE
;
504 STDMETHOD(put_VideoBorder3D
)(VARIANT_BOOL pVideoBorderWidth
) PURE
;
505 STDMETHOD(get_VideoBorderWidth
)(long __RPC_FAR
*pVideoBorderWidth
) PURE
;
506 STDMETHOD(put_VideoBorderWidth
)(long pVideoBorderWidth
) PURE
;
507 STDMETHOD(get_VideoBorderColor
)(VB_OLE_COLOR __RPC_FAR
*pVideoBorderWidth
) PURE
;
508 STDMETHOD(put_VideoBorderColor
)(VB_OLE_COLOR pVideoBorderWidth
) PURE
;
509 STDMETHOD(get_ShowGotoBar
)(VARIANT_BOOL __RPC_FAR
*pbool
) PURE
;
510 STDMETHOD(put_ShowGotoBar
)(VARIANT_BOOL pbool
) PURE
;
511 STDMETHOD(get_ShowStatusBar
)(VARIANT_BOOL __RPC_FAR
*pbool
) PURE
;
512 STDMETHOD(put_ShowStatusBar
)(VARIANT_BOOL pbool
) PURE
;
513 STDMETHOD(get_ShowCaptioning
)(VARIANT_BOOL __RPC_FAR
*pbool
) PURE
;
514 STDMETHOD(put_ShowCaptioning
)(VARIANT_BOOL pbool
) PURE
;
515 STDMETHOD(get_ShowAudioControls
)(VARIANT_BOOL __RPC_FAR
*pbool
) PURE
;
516 STDMETHOD(put_ShowAudioControls
)(VARIANT_BOOL pbool
) PURE
;
517 STDMETHOD(get_CaptioningID
)( BSTR __RPC_FAR
*pstrText
) PURE
;
518 STDMETHOD(put_CaptioningID
)(BSTR pstrText
) PURE
;
519 STDMETHOD(get_Mute
)(VARIANT_BOOL __RPC_FAR
*vbool
) PURE
;
520 STDMETHOD(put_Mute
)(VARIANT_BOOL vbool
) PURE
;
521 STDMETHOD(get_CanPreview
)(VARIANT_BOOL __RPC_FAR
*pCanPreview
) PURE
;
522 STDMETHOD(get_PreviewMode
)(VARIANT_BOOL __RPC_FAR
*pPreviewMode
) PURE
;
523 STDMETHOD(put_PreviewMode
)(VARIANT_BOOL pPreviewMode
) PURE
;
524 STDMETHOD(get_HasMultipleItems
)(VARIANT_BOOL __RPC_FAR
*pHasMuliItems
) PURE
;
525 STDMETHOD(get_Language
)(long __RPC_FAR
*pLanguage
) PURE
;
526 STDMETHOD(put_Language
)(long pLanguage
) PURE
;
527 STDMETHOD(get_AudioStream
)(long __RPC_FAR
*pStream
) PURE
;
528 STDMETHOD(put_AudioStream
)(long pStream
) PURE
;
529 STDMETHOD(get_SAMIStyle
)(BSTR __RPC_FAR
*pbstrStyle
) PURE
;
530 STDMETHOD(put_SAMIStyle
)(BSTR pbstrStyle
) PURE
;
531 STDMETHOD(get_SAMILang
)(BSTR __RPC_FAR
*pbstrLang
) PURE
;
532 STDMETHOD(put_SAMILang
)(BSTR pbstrLang
) PURE
;
533 STDMETHOD(get_SAMIFileName
)(BSTR __RPC_FAR
*pbstrFileName
) PURE
;
534 STDMETHOD(put_SAMIFileName
)(BSTR pbstrFileName
) PURE
;
535 STDMETHOD(get_StreamCount
)( long __RPC_FAR
*pStreamCount
) PURE
;
536 STDMETHOD(get_ClientId
)(BSTR __RPC_FAR
*pbstrClientId
) PURE
;
537 STDMETHOD(get_ConnectionSpeed
)(long __RPC_FAR
*plConnectionSpeed
) PURE
;
538 STDMETHOD(get_AutoSize
)(VARIANT_BOOL __RPC_FAR
*pbool
) PURE
;
539 STDMETHOD(put_AutoSize
)(VARIANT_BOOL pbool
) PURE
;
540 STDMETHOD(get_EnableFullScreenControls
)(VARIANT_BOOL __RPC_FAR
*pbVal
) PURE
;
541 STDMETHOD(put_EnableFullScreenControls
)(VARIANT_BOOL pbVal
) PURE
;
542 STDMETHOD(get_ActiveMovie
)(IDispatch __RPC_FAR
*__RPC_FAR
*ppdispatch
) PURE
;
543 STDMETHOD(get_NSPlay
)(IDispatch __RPC_FAR
*__RPC_FAR
*ppdispatch
) PURE
;
544 STDMETHOD(get_WindowlessVideo
)(VARIANT_BOOL __RPC_FAR
*pbool
) PURE
;
545 STDMETHOD(put_WindowlessVideo
)(VARIANT_BOOL pbool
) PURE
;
546 STDMETHOD(Play
)(void) PURE
;
547 STDMETHOD(Stop
)(void) PURE
;
548 STDMETHOD(Pause
)(void) PURE
;
549 STDMETHOD(GetMarkerTime
)(long MarkerNum
,
550 double __RPC_FAR
*pMarkerTime
) PURE
;
551 STDMETHOD(GetMarkerName
)(long MarkerNum
,
552 BSTR __RPC_FAR
*pbstrMarkerName
) PURE
;
553 STDMETHOD(AboutBox
)(void) PURE
;
554 STDMETHOD(GetCodecInstalled
)(long CodecNum
,
555 VARIANT_BOOL __RPC_FAR
*pCodecInstalled
) PURE
;
556 STDMETHOD(GetCodecDescription
)(long CodecNum
,
557 BSTR __RPC_FAR
*pbstrCodecDescription
) PURE
;
558 STDMETHOD(GetCodecURL
)(long CodecNum
,
559 BSTR __RPC_FAR
*pbstrCodecURL
) PURE
;
560 STDMETHOD(GetMoreInfoURL
)(MPMoreInfoType MoreInfoType
,
561 BSTR __RPC_FAR
*pbstrMoreInfoURL
) PURE
;
562 STDMETHOD(GetMediaInfoString
)(MPMediaInfoType MediaInfoType
,
563 BSTR __RPC_FAR
*pbstrMediaInfo
) PURE
;
564 STDMETHOD(Cancel
)(void) PURE
;
565 STDMETHOD(Open
)(BSTR bstrFileName
) PURE
;
566 STDMETHOD(IsSoundCardEnabled
)(VARIANT_BOOL __RPC_FAR
*pbSoundCard
) PURE
;
567 STDMETHOD(Next
)(void) PURE
;
568 STDMETHOD(Previous
)(void) PURE
;
569 STDMETHOD(StreamSelect
)(long StreamNum
) PURE
;
570 STDMETHOD(FastForward
)(void) PURE
;
571 STDMETHOD(FastReverse
)(void) PURE
;
572 STDMETHOD(GetStreamName
)(long StreamNum
,
573 BSTR __RPC_FAR
*pbstrStreamName
) PURE
;
574 STDMETHOD(GetStreamGroup
)(long StreamNum
,
575 long __RPC_FAR
*pStreamGroup
) PURE
;
576 STDMETHOD(GetStreamSelected
)(long StreamNum
, VARIANT_BOOL __RPC_FAR
*pStreamSelected
) PURE
;
579 struct IMediaPlayer2
: public IMediaPlayer
581 STDMETHOD(get_DVD
)(struct IMediaPlayerDvd __RPC_FAR
*__RPC_FAR
*ppdispatch
) PURE
;
582 STDMETHOD(GetMediaParameter
)(long EntryNum
, BSTR bstrParameterName
, BSTR __RPC_FAR
*pbstrParameterValue
) PURE
;
583 STDMETHOD(GetMediaParameterName(long EntryNum
, long Index
, BSTR __RPC_FAR
*pbstrParameterName
) PURE
;
584 STDMETHOD(get_EntryCount
)(long __RPC_FAR
*pNumberEntries
) PURE
;
585 STDMETHOD(GetCurrentEntry
)(long __RPC_FAR
*pEntryNumber
) PURE
;
586 STDMETHOD(SetCurrentEntry
)(long EntryNumber
) PURE
;
587 STDMETHOD(ShowDialog
)(MPShowDialogConstants mpDialogIndex
) PURE
;
590 //---------------------------------------------------------------------------
591 // NETSHOW COM INTERFACES (dumped from nscompat.idl from MSVC COM Browser)
592 //---------------------------------------------------------------------------
594 struct INSOPlay
: public IDispatch
596 STDMETHOD(get_ImageSourceWidth
)(long __RPC_FAR
*pWidth
) PURE
;
597 STDMETHOD(get_ImageSourceHeight
)(long __RPC_FAR
*pHeight
) PURE
;
598 STDMETHOD(get_Duration
)(double __RPC_FAR
*pDuration
) PURE
;
599 STDMETHOD(get_Author
)(BSTR __RPC_FAR
*pbstrAuthor
) PURE
;
600 STDMETHOD(get_Copyright
)(BSTR __RPC_FAR
*pbstrCopyright
) PURE
;
601 STDMETHOD(get_Description
)(BSTR __RPC_FAR
*pbstrDescription
) PURE
;
602 STDMETHOD(get_Rating
)(BSTR __RPC_FAR
*pbstrRating
) PURE
;
603 STDMETHOD(get_Title
)(BSTR __RPC_FAR
*pbstrTitle
) PURE
;
604 STDMETHOD(get_SourceLink
)(BSTR __RPC_FAR
*pbstrSourceLink
) PURE
;
605 STDMETHOD(get_MarkerCount
)(long __RPC_FAR
*pMarkerCount
) PURE
;
606 STDMETHOD(get_CanScan
)(VARIANT_BOOL __RPC_FAR
*pCanScan
) PURE
;
607 STDMETHOD(get_CanSeek
)(VARIANT_BOOL __RPC_FAR
*pCanSeek
) PURE
;
608 STDMETHOD(get_CanSeekToMarkers
)(VARIANT_BOOL __RPC_FAR
*pCanSeekToMarkers
) PURE
;
609 STDMETHOD(get_CreationDate
)(DATE __RPC_FAR
*pCreationDate
) PURE
;
610 STDMETHOD(get_Bandwidth
)(long __RPC_FAR
*pBandwidth
) PURE
;
611 STDMETHOD(get_ErrorCorrection
)(BSTR __RPC_FAR
*pbstrErrorCorrection
) PURE
;
612 STDMETHOD(get_AutoStart
)(VARIANT_BOOL __RPC_FAR
*pAutoStart
) PURE
;
613 STDMETHOD(put_AutoStart
)(VARIANT_BOOL pAutoStart
) PURE
;
614 STDMETHOD(get_AutoRewind
)(VARIANT_BOOL __RPC_FAR
*pAutoRewind
) PURE
;
615 STDMETHOD(put_AutoRewind
)(VARIANT_BOOL pAutoRewind
) PURE
;
616 STDMETHOD(get_AllowChangeControlType
)(VARIANT_BOOL __RPC_FAR
*pAllowChangeControlType
) PURE
;
617 STDMETHOD(put_AllowChangeControlType
)(VARIANT_BOOL pAllowChangeControlType
) PURE
;
618 STDMETHOD(get_InvokeURLs
)(VARIANT_BOOL __RPC_FAR
*pInvokeURLs
) PURE
;
619 STDMETHOD(put_InvokeURLs
)(VARIANT_BOOL pInvokeURLs
) PURE
;
620 STDMETHOD(get_EnableContextMenu
)(VARIANT_BOOL __RPC_FAR
*pEnableContextMenu
) PURE
;
621 STDMETHOD(put_EnableContextMenu
)(VARIANT_BOOL pEnableContextMenu
) PURE
;
622 STDMETHOD(get_TransparentAtStart
)(VARIANT_BOOL __RPC_FAR
*pTransparentAtStart
) PURE
;
623 STDMETHOD(put_TransparentAtStart
)(VARIANT_BOOL pTransparentAtStart
) PURE
;
624 STDMETHOD(get_TransparentOnStop
)(VARIANT_BOOL __RPC_FAR
*pTransparentOnStop
) PURE
;
625 STDMETHOD(put_TransparentOnStop
)(VARIANT_BOOL pTransparentOnStop
) PURE
;
626 STDMETHOD(get_ClickToPlay
)(VARIANT_BOOL __RPC_FAR
*pClickToPlay
) PURE
;
627 STDMETHOD(put_ClickToPlay
)(VARIANT_BOOL pClickToPlay
) PURE
;
628 STDMETHOD(get_FileName
)(BSTR __RPC_FAR
*pbstrFileName
) PURE
;
629 STDMETHOD(put_FileName
)(BSTR pbstrFileName
) PURE
;
630 STDMETHOD(get_CurrentPosition
)(double __RPC_FAR
*pCurrentPosition
) PURE
;
631 STDMETHOD(put_CurrentPosition
)(double pCurrentPosition
) PURE
;
632 STDMETHOD(get_Rate
)(double __RPC_FAR
*pRate
) PURE
;
633 STDMETHOD(put_Rate
)(double pRate
) PURE
;
634 STDMETHOD(get_CurrentMarker
)(long __RPC_FAR
*pCurrentMarker
) PURE
;
635 STDMETHOD(put_CurrentMarker
)(long pCurrentMarker
) PURE
;
636 STDMETHOD(get_PlayCount
)(long __RPC_FAR
*pPlayCount
) PURE
;
637 STDMETHOD(put_PlayCount
)(long pPlayCount
) PURE
;
638 STDMETHOD(get_CurrentState
)(long __RPC_FAR
*pCurrentState
) PURE
;
639 STDMETHOD(get_DisplaySize
)(long __RPC_FAR
*pDisplaySize
) PURE
;
640 STDMETHOD(put_DisplaySize
)(long pDisplaySize
) PURE
;
641 STDMETHOD(get_MainWindow
)(long __RPC_FAR
*pMainWindow
) PURE
;
642 STDMETHOD(get_ControlType
)(long __RPC_FAR
*pControlType
) PURE
;
643 STDMETHOD(put_ControlType
)(long pControlType
) PURE
;
644 STDMETHOD(get_AllowScan
)(VARIANT_BOOL __RPC_FAR
*pAllowScan
) PURE
;
645 STDMETHOD(put_AllowScan
)(VARIANT_BOOL pAllowScan
) PURE
;
646 STDMETHOD(get_SendKeyboardEvents
)(VARIANT_BOOL __RPC_FAR
*pSendKeyboardEvents
) PURE
;
647 STDMETHOD(put_SendKeyboardEvents
)(VARIANT_BOOL pSendKeyboardEvents
) PURE
;
648 STDMETHOD(get_SendMouseClickEvents
)(VARIANT_BOOL __RPC_FAR
*pSendMouseClickEvents
) PURE
;
649 STDMETHOD(put_SendMouseClickEvents
)(VARIANT_BOOL pSendMouseClickEvents
) PURE
;
650 STDMETHOD(get_SendMouseMoveEvents
)(VARIANT_BOOL __RPC_FAR
*pSendMouseMoveEvents
) PURE
;
651 STDMETHOD(put_SendMouseMoveEvents
)(VARIANT_BOOL pSendMouseMoveEvents
) PURE
;
652 STDMETHOD(get_SendStateChangeEvents
)(VARIANT_BOOL __RPC_FAR
*pSendStateChangeEvents
) PURE
;
653 STDMETHOD(put_SendStateChangeEvents
)(VARIANT_BOOL pSendStateChangeEvents
) PURE
;
654 STDMETHOD(get_ReceivedPackets
)(long __RPC_FAR
*pReceivedPackets
) PURE
;
655 STDMETHOD(get_RecoveredPackets
)(long __RPC_FAR
*pRecoveredPackets
) PURE
;
656 STDMETHOD(get_LostPackets
)(long __RPC_FAR
*pLostPackets
) PURE
;
657 STDMETHOD(get_ReceptionQuality
)(long __RPC_FAR
*pReceptionQuality
) PURE
;
658 STDMETHOD(get_BufferingCount
)(long __RPC_FAR
*pBufferingCount
) PURE
;
659 STDMETHOD(get_CursorType
)(long __RPC_FAR
*pCursorType
) PURE
;
660 STDMETHOD(put_CursorType
)(long pCursorType
) PURE
;
661 STDMETHOD(get_AnimationAtStart
)(VARIANT_BOOL __RPC_FAR
*pAnimationAtStart
) PURE
;
662 STDMETHOD(put_AnimationAtStart
)(VARIANT_BOOL pAnimationAtStart
) PURE
;
663 STDMETHOD(get_AnimationOnStop
)(VARIANT_BOOL __RPC_FAR
*pAnimationOnStop
) PURE
;
664 STDMETHOD(put_AnimationOnStop
)(VARIANT_BOOL pAnimationOnStop
) PURE
;
665 STDMETHOD(Play
)(void) PURE
;
666 STDMETHOD(Pause
)(void) PURE
;
667 STDMETHOD(Stop
)(void) PURE
;
668 STDMETHOD(GetMarkerTime
)(long MarkerNum
, double __RPC_FAR
*pMarkerTime
) PURE
;
669 STDMETHOD(GetMarkerName
)(long MarkerNum
, BSTR __RPC_FAR
*pbstrMarkerName
) PURE
;
672 struct INSPlay
: public INSOPlay
674 STDMETHOD(get_ChannelName
)(BSTR __RPC_FAR
*pbstrChannelName
) PURE
;
675 STDMETHOD(get_ChannelDescription
)(BSTR __RPC_FAR
*pbstrChannelDescription
) PURE
;
676 STDMETHOD(get_ChannelURL
)(BSTR __RPC_FAR
*pbstrChannelURL
) PURE
;
677 STDMETHOD(get_ContactAddress
)(BSTR __RPC_FAR
*pbstrContactAddress
) PURE
;
678 STDMETHOD(get_ContactPhone
)(BSTR __RPC_FAR
*pbstrContactPhone
) PURE
;
679 STDMETHOD(get_ContactEmail
)(BSTR __RPC_FAR
*pbstrContactEmail
) PURE
;
680 STDMETHOD(get_AllowChangeDisplaySize
)(VARIANT_BOOL __RPC_FAR
*pAllowChangeDisplaySize
) PURE
;
681 STDMETHOD(put_AllowChangeDisplaySize
)(VARIANT_BOOL pAllowChangeDisplaySize
) PURE
;
682 STDMETHOD(get_CodecCount
)(long __RPC_FAR
*pCodecCount
) PURE
;
683 STDMETHOD(get_IsBroadcast
)(VARIANT_BOOL __RPC_FAR
*pIsBroadcast
) PURE
;
684 STDMETHOD(get_IsDurationValid
)(VARIANT_BOOL __RPC_FAR
*pIsDurationValid
) PURE
;
685 STDMETHOD(get_SourceProtocol
)(long __RPC_FAR
*pSourceProtocol
) PURE
;
686 STDMETHOD(get_OpenState
)(long __RPC_FAR
*pOpenState
) PURE
;
687 STDMETHOD(get_SendOpenStateChangeEvents
)(VARIANT_BOOL __RPC_FAR
*pSendOpenStateChangeEvents
) PURE
;
688 STDMETHOD(put_SendOpenStateChangeEvents
)(VARIANT_BOOL pSendOpenStateChangeEvents
) PURE
;
689 STDMETHOD(get_SendWarningEvents
)(VARIANT_BOOL __RPC_FAR
*pSendWarningEvents
) PURE
;
690 STDMETHOD(put_SendWarningEvents
)(VARIANT_BOOL pSendWarningEvents
) PURE
;
691 STDMETHOD(get_SendErrorEvents
)(VARIANT_BOOL __RPC_FAR
*pSendErrorEvents
) PURE
;
692 STDMETHOD(put_SendErrorEvents
)(VARIANT_BOOL pSendErrorEvents
) PURE
;
693 STDMETHOD(get_HasError
)(VARIANT_BOOL __RPC_FAR
*pHasError
) PURE
;
694 STDMETHOD(get_ErrorDescription
)(BSTR __RPC_FAR
*pbstrErrorDescription
) PURE
;
695 STDMETHOD(get_ErrorCode
)(long __RPC_FAR
*pErrorCode
) PURE
;
696 STDMETHOD(get_PlayState
)(long __RPC_FAR
*pPlayState
) PURE
;
697 STDMETHOD(get_SendPlayStateChangeEvents
)(VARIANT_BOOL __RPC_FAR
*pSendPlayStateChangeEvents
) PURE
;
698 STDMETHOD(put_SendPlayStateChangeEvents
)(VARIANT_BOOL pSendPlayStateChangeEvents
) PURE
;
699 STDMETHOD(get_BufferingTime
)(double __RPC_FAR
*pBufferingTime
) PURE
;
700 STDMETHOD(put_BufferingTime
)(double pBufferingTime
) PURE
;
701 STDMETHOD(get_UseFixedUDPPort
)(VARIANT_BOOL __RPC_FAR
*pUseFixedUDPPort
) PURE
;
702 STDMETHOD(put_UseFixedUDPPort
)(VARIANT_BOOL pUseFixedUDPPort
) PURE
;
703 STDMETHOD(get_FixedUDPPort
)(long __RPC_FAR
*pFixedUDPPort
) PURE
;
704 STDMETHOD(put_FixedUDPPort
)(long pFixedUDPPort
) PURE
;
705 STDMETHOD(get_UseHTTPProxy
)(VARIANT_BOOL __RPC_FAR
*pUseHTTPProxy
) PURE
;
706 STDMETHOD(put_UseHTTPProxy
)(VARIANT_BOOL pUseHTTPProxy
) PURE
;
707 STDMETHOD(get_EnableAutoProxy
)(VARIANT_BOOL __RPC_FAR
*pEnableAutoProxy
) PURE
;
708 STDMETHOD(put_EnableAutoProxy
)(VARIANT_BOOL pEnableAutoProxy
) PURE
;
709 STDMETHOD(get_HTTPProxyHost
)(BSTR __RPC_FAR
*pbstrHTTPProxyHost
) PURE
;
710 STDMETHOD(put_HTTPProxyHost
)(BSTR pbstrHTTPProxyHost
) PURE
;
711 STDMETHOD(get_HTTPProxyPort
)(long __RPC_FAR
*pHTTPProxyPort
) PURE
;
712 STDMETHOD(put_HTTPProxyPort
)(long pHTTPProxyPort
) PURE
;
713 STDMETHOD(get_EnableMulticast
)(VARIANT_BOOL __RPC_FAR
*pEnableMulticast
) PURE
;
714 STDMETHOD(put_EnableMulticast
)(VARIANT_BOOL pEnableMulticast
) PURE
;
715 STDMETHOD(get_EnableUDP
)(VARIANT_BOOL __RPC_FAR
*pEnableUDP
) PURE
;
716 STDMETHOD(put_EnableUDP
)(VARIANT_BOOL pEnableUDP
) PURE
;
717 STDMETHOD(get_EnableTCP
)(VARIANT_BOOL __RPC_FAR
*pEnableTCP
) PURE
;
718 STDMETHOD(put_EnableTCP
)(VARIANT_BOOL pEnableTCP
) PURE
;
719 STDMETHOD(get_EnableHTTP
)(VARIANT_BOOL __RPC_FAR
*pEnableHTTP
) PURE
;
720 STDMETHOD(put_EnableHTTP
)(VARIANT_BOOL pEnableHTTP
) PURE
;
721 STDMETHOD(get_BufferingProgress
)(long __RPC_FAR
*pBufferingProgress
) PURE
;
722 STDMETHOD(get_BaseURL
)(BSTR __RPC_FAR
*pbstrBaseURL
) PURE
;
723 STDMETHOD(put_BaseURL
)(BSTR pbstrBaseURL
) PURE
;
724 STDMETHOD(get_DefaultFrame
)(BSTR __RPC_FAR
*pbstrDefaultFrame
) PURE
;
725 STDMETHOD(put_DefaultFrame
)(BSTR pbstrDefaultFrame
) PURE
;
726 STDMETHOD(AboutBox
))(void) PURE
;
727 STDMETHOD(Cancel
)(void) PURE
;
728 STDMETHOD(GetCodecInstalled
)(long CodecNum
, VARIANT_BOOL __RPC_FAR
*pCodecInstalled
) PURE
;
729 STDMETHOD(GetCodecDescription
)(long CodecNum
, BSTR __RPC_FAR
*pbstrCodecDescription
) PURE
;
730 STDMETHOD(GetCodecURL
)(long CodecNum
, BSTR __RPC_FAR
*pbstrCodecURL
) PURE
;
731 STDMETHOD(Open
)(BSTR bstrFileName
) PURE
;
735 struct INSPlay1
: public INSPlay
737 STDMETHOD(get_MediaPlayer
)(IDispatch __RPC_FAR
*__RPC_FAR
*ppdispatch
) PURE
;
740 //---------------------------------------------------------------------------
741 // MISC COM INTERFACES
742 //---------------------------------------------------------------------------
743 typedef enum _FilterState
751 typedef enum _PinDirection
758 typedef struct _FilterInfo
761 struct IFilterGraph
*pGraph
;
765 typedef struct _PinInfo
767 struct IBaseFilter
*pFilter
;
776 typedef struct _MediaType
780 BOOL bFixedSizeSamples
;
781 BOOL bTemporalCompression
;
790 struct IFilterGraph
: public IUnknown
792 STDMETHOD(AddFilter
)(IBaseFilter
*, LPCWSTR
) PURE
;
793 STDMETHOD(RemoveFilter
)(IBaseFilter
*) PURE
;
794 STDMETHOD(EnumFilters
)(IEnumFilters
**) PURE
;
795 STDMETHOD(FindFilterByName
)(LPCWSTR
, IBaseFilter
**) PURE
;
796 STDMETHOD(ConnectDirect
)(IPin
*, IPin
*, const AM_MEDIA_TYPE
*) PURE
;
797 STDMETHOD(Reconnect
)(IPin
*) PURE
;
798 STDMETHOD(Disconnect
)(IPin
*) PURE
;
799 STDMETHOD(SetDefaultSyncSource
)() PURE
;
802 struct IGraphBuilder
: public IFilterGraph
804 STDMETHOD(Connect
)(IPin
*, IPin
*) PURE
;
805 STDMETHOD(Render
)(IPin
*) PURE
;
806 STDMETHOD(RenderFile
)(LPCWSTR
, LPCWSTR
) PURE
;
807 STDMETHOD(AddSourceFilter
)(LPCWSTR
, LPCWSTR
, IBaseFilter
**) PURE
;
808 STDMETHOD(SetLogFile
)(DWORD_PTR
) PURE
;
809 STDMETHOD(Abort
)() PURE
;
810 STDMETHOD(ShouldOperationContinue
)() PURE
;
813 struct IReferenceClock
;
815 #define REFERENCE_TIME LONGLONG
816 struct IMediaFilter
: public IPersist
818 STDMETHOD(Stop
)( void) PURE
;
819 STDMETHOD(Pause
)( void) PURE
;
820 STDMETHOD(Run
)(REFERENCE_TIME tStart
) PURE
;
821 STDMETHOD(GetState
)(DWORD dwMilliSecsTimeout
,
822 FILTER_STATE
*State
) PURE
;
823 STDMETHOD(SetSyncSource
)(IReferenceClock
*pClock
) PURE
;
824 STDMETHOD(GetSyncSource
)(IReferenceClock
**pClock
) PURE
;
827 struct IBaseFilter
: public IMediaFilter
829 STDMETHOD(EnumPins
)(IEnumPins
**ppEnum
) PURE
;
830 STDMETHOD(FindPin
)(LPCWSTR Id
, IPin
**ppPin
) PURE
;
831 STDMETHOD(QueryFilterInfo
)(FILTER_INFO
*pInfo
) PURE
;
832 STDMETHOD(JoinFilterGraph
)(IFilterGraph
*pGraph
, LPCWSTR pName
) PURE
;
833 STDMETHOD(QueryVendorInfo
)(LPWSTR
*pVendorInfo
) PURE
;
837 //---------------------------------------------------------------------------
839 //---------------------------------------------------------------------------
841 typedef BOOL (WINAPI
* LPAMGETERRORTEXT
)(HRESULT
, wxChar
*, DWORD
);
843 class WXDLLIMPEXP_MEDIA wxAMMediaBackend
: public wxMediaBackendCommonBase
847 virtual ~wxAMMediaBackend();
850 virtual bool CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
855 const wxValidator
& validator
,
856 const wxString
& name
);
859 virtual bool Pause();
862 virtual bool Load(const wxString
& fileName
);
863 virtual bool Load(const wxURI
& location
);
864 virtual bool Load(const wxURI
& location
, const wxURI
& proxy
);
866 bool DoLoad(const wxString
& location
);
869 virtual wxMediaState
GetState();
871 virtual bool SetPosition(wxLongLong where
);
872 virtual wxLongLong
GetPosition();
873 virtual wxLongLong
GetDuration();
875 virtual void Move(int x
, int y
, int w
, int h
);
876 wxSize
GetVideoSize() const;
878 virtual double GetPlaybackRate();
879 virtual bool SetPlaybackRate(double);
881 virtual double GetVolume();
882 virtual bool SetVolume(double);
884 virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags
);
887 void DoGetDownloadProgress(wxLongLong
*, wxLongLong
*);
889 virtual wxLongLong
GetDownloadProgress()
891 wxLongLong progress
, total
;
892 DoGetDownloadProgress(&progress
, &total
);
896 virtual wxLongLong
GetDownloadTotal()
898 wxLongLong progress
, total
;
899 DoGetDownloadProgress(&progress
, &total
);
903 wxActiveXContainer
* m_pAX
;
910 wxDynamicLibrary m_dllQuartz
;
911 LPAMGETERRORTEXT m_lpAMGetErrorText
;
912 wxString
GetErrorString(HRESULT hrdsv
);
915 DECLARE_DYNAMIC_CLASS(wxAMMediaBackend
)
918 //---------------------------------------------------------------------------
922 //---------------------------------------------------------------------------
924 //---------------------------------------------------------------------------
926 //---------------------------------------------------------------------------
928 #include <mmsystem.h>
930 class WXDLLIMPEXP_MEDIA wxMCIMediaBackend
: public wxMediaBackendCommonBase
935 ~wxMCIMediaBackend();
937 virtual bool CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
942 const wxValidator
& validator
,
943 const wxString
& name
);
946 virtual bool Pause();
949 virtual bool Load(const wxURI
& location
,
951 { return wxMediaBackend::Load(location
, proxy
); }
953 virtual bool Load(const wxString
& fileName
);
954 virtual bool Load(const wxURI
& location
);
956 virtual wxMediaState
GetState();
958 virtual bool SetPosition(wxLongLong where
);
959 virtual wxLongLong
GetPosition();
960 virtual wxLongLong
GetDuration();
962 virtual void Move(int x
, int y
, int w
, int h
);
963 wxSize
GetVideoSize() const;
965 virtual double GetPlaybackRate();
966 virtual bool SetPlaybackRate(double dRate
);
968 virtual double GetVolume();
969 virtual bool SetVolume(double);
971 static LRESULT CALLBACK
NotifyWndProc(HWND hWnd
, UINT nMsg
,
972 WPARAM wParam
, LPARAM lParam
);
974 LRESULT CALLBACK
OnNotifyWndProc(HWND hWnd
, UINT nMsg
,
975 WPARAM wParam
, LPARAM lParam
);
977 MCIDEVICEID m_hDev
; //Our MCI Device ID/Handler
978 HWND m_hNotifyWnd
; //Window to use for MCI events
979 bool m_bVideo
; //Whether or not we have video
981 DECLARE_DYNAMIC_CLASS(wxMCIMediaBackend
)
985 //---------------------------------------------------------------------------
989 // We don't include Quicktime headers here and define all the types
990 // ourselves because looking for the quicktime libaries etc. would
991 // be tricky to do and making this a dependency for the MSVC projects
992 // would be unrealistic.
994 // Thanks to Robert Roebling for the wxDL macro/library idea
995 //---------------------------------------------------------------------------
997 //---------------------------------------------------------------------------
999 //---------------------------------------------------------------------------
1000 //#include <qtml.h> //Windoze QT include
1001 //#include <QuickTimeComponents.h> //Standard QT stuff
1002 #include "wx/dynlib.h"
1004 //---------------------------------------------------------------------------
1006 //---------------------------------------------------------------------------
1007 typedef struct MovieRecord
* Movie
;
1008 typedef wxInt16 OSErr
;
1009 typedef wxInt32 OSStatus
;
1012 typedef unsigned char Str255
[256];
1013 #define StringPtr unsigned char*
1014 #define newMovieActive 1
1015 #define newMovieAsyncOK (1 << 8)
1019 #define OSType unsigned long
1020 #define CGrafPtr struct GrafPort *
1021 #define TimeScale long
1022 #define TimeBase struct TimeBaseRecord *
1023 typedef struct ComponentInstanceRecord
* ComponentInstance
;
1024 #define kMovieLoadStatePlayable 10000
1026 #define MovieController ComponentInstance
1028 #ifndef URLDataHandlerSubType
1029 #if defined(__WATCOMC__) || defined(__MINGW32__)
1030 // use magic numbers for compilers which complain about multicharacter integers
1031 const OSType URLDataHandlerSubType
= 1970433056;
1032 const OSType VisualMediaCharacteristic
= 1702454643;
1034 const OSType URLDataHandlerSubType
= 'url ';
1035 const OSType VisualMediaCharacteristic
= 'eyes';
1043 Str255 name
; // Str63 on mac, Str255 on msw
1062 wide value
; // units
1063 TimeScale scale
; // units per second
1084 mcScaleMovieToFit
= 2,
1090 //---------------------------------------------------------------------------
1092 //---------------------------------------------------------------------------
1093 #define wxDL_METHOD_DEFINE( rettype, name, args, shortargs, defret ) \
1094 typedef rettype (* name ## Type) args ; \
1095 name ## Type pfn_ ## name; \
1097 { if (m_ok) return pfn_ ## name shortargs ; return defret; }
1099 #define wxDL_VOIDMETHOD_DEFINE( name, args, shortargs ) \
1100 typedef void (* name ## Type) args ; \
1101 name ## Type pfn_ ## name; \
1103 { if (m_ok) pfn_ ## name shortargs ; }
1105 #define wxDL_METHOD_LOAD( lib, name, success ) \
1106 pfn_ ## name = (name ## Type) lib.GetSymbol( wxT(#name), &success ); \
1107 if (!success) { wxLog::EnableLogging(bWasLoggingEnabled); return false; }
1110 class WXDLLIMPEXP_MEDIA wxQuickTimeLibrary
1113 ~wxQuickTimeLibrary()
1115 if (m_dll
.IsLoaded())
1120 bool IsOk() const {return m_ok
;}
1123 wxDynamicLibrary m_dll
;
1127 wxDL_VOIDMETHOD_DEFINE( StartMovie
, (Movie m
), (m
) );
1128 wxDL_VOIDMETHOD_DEFINE( StopMovie
, (Movie m
), (m
) );
1129 wxDL_METHOD_DEFINE( bool, IsMovieDone
, (Movie m
), (m
), false);
1130 wxDL_VOIDMETHOD_DEFINE( GoToBeginningOfMovie
, (Movie m
), (m
) );
1131 wxDL_METHOD_DEFINE( OSErr
, GetMoviesError
, (), (), -1);
1132 wxDL_METHOD_DEFINE( OSErr
, EnterMovies
, (), (), -1);
1133 wxDL_VOIDMETHOD_DEFINE( ExitMovies
, (), () );
1134 wxDL_METHOD_DEFINE( OSErr
, InitializeQTML
, (long flags
), (flags
), -1);
1135 wxDL_VOIDMETHOD_DEFINE( TerminateQTML
, (), () );
1137 wxDL_METHOD_DEFINE( OSErr
, NativePathNameToFSSpec
,
1138 (char* inName
, FSSpec
* outFile
, long flags
),
1139 (inName
, outFile
, flags
), -1);
1141 wxDL_METHOD_DEFINE( OSErr
, OpenMovieFile
,
1142 (const FSSpec
* fileSpec
, short * resRefNum
, wxInt8 permission
),
1143 (fileSpec
, resRefNum
, permission
), -1 );
1145 wxDL_METHOD_DEFINE( OSErr
, CloseMovieFile
,
1146 (short resRefNum
), (resRefNum
), -1);
1148 wxDL_METHOD_DEFINE( OSErr
, NewMovieFromFile
,
1149 (Movie
* theMovie
, short resRefNum
, short * resId
,
1150 StringPtr resName
, short newMovieFlags
,
1151 bool * dataRefWasChanged
),
1152 (theMovie
, resRefNum
, resId
, resName
, newMovieFlags
,
1153 dataRefWasChanged
), -1);
1155 wxDL_VOIDMETHOD_DEFINE( SetMovieRate
, (Movie m
, Fixed rate
), (m
, rate
) );
1156 wxDL_METHOD_DEFINE( Fixed
, GetMovieRate
, (Movie m
), (m
), 0);
1157 wxDL_VOIDMETHOD_DEFINE( MoviesTask
, (Movie m
, long maxms
), (m
, maxms
) );
1158 wxDL_VOIDMETHOD_DEFINE( BlockMove
,
1159 (const char* p1
, const char* p2
, long s
), (p1
,p2
,s
) );
1160 wxDL_METHOD_DEFINE( Handle
, NewHandleClear
, (long s
), (s
), NULL
);
1162 wxDL_METHOD_DEFINE( OSErr
, NewMovieFromDataRef
,
1163 (Movie
* m
, short flags
, short * id
,
1164 Handle dataRef
, OSType dataRefType
),
1165 (m
,flags
,id
,dataRef
,dataRefType
), -1 );
1167 wxDL_VOIDMETHOD_DEFINE( DisposeHandle
, (Handle h
), (h
) );
1168 wxDL_VOIDMETHOD_DEFINE( GetMovieNaturalBoundsRect
, (Movie m
, Rect
* r
), (m
,r
) );
1169 wxDL_METHOD_DEFINE( void*, GetMovieIndTrackType
,
1170 (Movie m
, long index
, OSType type
, long flags
),
1171 (m
,index
,type
,flags
), NULL
);
1172 wxDL_VOIDMETHOD_DEFINE( CreatePortAssociation
,
1173 (void* hWnd
, void* junk
, long morejunk
), (hWnd
, junk
, morejunk
) );
1174 wxDL_METHOD_DEFINE(void*, GetNativeWindowPort
, (void* hWnd
), (hWnd
), NULL
);
1175 wxDL_VOIDMETHOD_DEFINE(SetMovieGWorld
, (Movie m
, CGrafPtr port
, void* whatever
),
1176 (m
, port
, whatever
) );
1177 wxDL_VOIDMETHOD_DEFINE(DisposeMovie
, (Movie m
), (m
) );
1178 wxDL_VOIDMETHOD_DEFINE(SetMovieBox
, (Movie m
, Rect
* r
), (m
,r
));
1179 wxDL_VOIDMETHOD_DEFINE(SetMovieTimeScale
, (Movie m
, long s
), (m
,s
));
1180 wxDL_METHOD_DEFINE(long, GetMovieDuration
, (Movie m
), (m
), 0);
1181 wxDL_METHOD_DEFINE(TimeBase
, GetMovieTimeBase
, (Movie m
), (m
), 0);
1182 wxDL_METHOD_DEFINE(TimeScale
, GetMovieTimeScale
, (Movie m
), (m
), 0);
1183 wxDL_METHOD_DEFINE(long, GetMovieTime
, (Movie m
, void* cruft
), (m
,cruft
), 0);
1184 wxDL_VOIDMETHOD_DEFINE(SetMovieTime
, (Movie m
, TimeRecord
* tr
), (m
,tr
) );
1185 wxDL_METHOD_DEFINE(short, GetMovieVolume
, (Movie m
), (m
), 0);
1186 wxDL_VOIDMETHOD_DEFINE(SetMovieVolume
, (Movie m
, short sVolume
), (m
,sVolume
) );
1187 wxDL_VOIDMETHOD_DEFINE(SetMovieTimeValue
, (Movie m
, long s
), (m
,s
));
1188 wxDL_METHOD_DEFINE(ComponentInstance
, NewMovieController
, (Movie m
, const Rect
* mr
, long fl
), (m
,mr
,fl
), 0);
1189 wxDL_VOIDMETHOD_DEFINE(DisposeMovieController
, (ComponentInstance ci
), (ci
));
1190 wxDL_METHOD_DEFINE(int, MCSetVisible
, (ComponentInstance m
, int b
), (m
, b
), 0);
1193 wxDL_VOIDMETHOD_DEFINE(PrePrerollMovie
, (Movie m
, long t
, Fixed r
, WXFARPROC p1
, void* p2
), (m
,t
,r
,p1
,p2
) );
1194 wxDL_VOIDMETHOD_DEFINE(PrerollMovie
, (Movie m
, long t
, Fixed r
), (m
,t
,r
) );
1195 wxDL_METHOD_DEFINE(Fixed
, GetMoviePreferredRate
, (Movie m
), (m
), 0);
1196 wxDL_METHOD_DEFINE(long, GetMovieLoadState
, (Movie m
), (m
), 0);
1197 wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor
, (WXFARPROC f
, int l
, void* junk
), (f
, l
, junk
), 0);
1198 wxDL_VOIDMETHOD_DEFINE(DisposeRoutineDescriptor
, (void* f
), (f
));
1199 wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture
, (), (), 0);
1200 wxDL_METHOD_DEFINE(int, MCDoAction
, (ComponentInstance ci
, long f
, void* p
), (ci
,f
,p
), 0);
1201 wxDL_VOIDMETHOD_DEFINE(MCSetControllerBoundsRect
, (ComponentInstance ci
, Rect
* r
), (ci
,r
));
1202 wxDL_VOIDMETHOD_DEFINE(DestroyPortAssociation
, (CGrafPtr g
), (g
));
1203 wxDL_VOIDMETHOD_DEFINE(NativeEventToMacEvent
, (MSG
* p1
, EventRecord
* p2
), (p1
,p2
));
1204 wxDL_VOIDMETHOD_DEFINE(MCIsPlayerEvent
, (ComponentInstance ci
, EventRecord
* p2
), (ci
, p2
));
1205 wxDL_METHOD_DEFINE(int, MCSetMovie
, (ComponentInstance ci
, Movie m
, void* p1
, Point w
),
1207 wxDL_VOIDMETHOD_DEFINE(MCPositionController
,
1208 (ComponentInstance ci
, Rect
* r
, void* junk
, void* morejunk
), (ci
,r
,junk
,morejunk
));
1209 wxDL_VOIDMETHOD_DEFINE(MCSetActionFilterWithRefCon
,
1210 (ComponentInstance ci
, WXFARPROC cb
, void* ref
), (ci
,cb
,ref
));
1211 wxDL_VOIDMETHOD_DEFINE(MCGetControllerInfo
, (MovieController mc
, long* flags
), (mc
,flags
));
1212 wxDL_VOIDMETHOD_DEFINE(BeginUpdate
, (CGrafPtr port
), (port
));
1213 wxDL_VOIDMETHOD_DEFINE(UpdateMovie
, (Movie m
), (m
));
1214 wxDL_VOIDMETHOD_DEFINE(EndUpdate
, (CGrafPtr port
), (port
));
1215 wxDL_METHOD_DEFINE( OSErr
, GetMoviesStickyError
, (), (), -1);
1218 bool wxQuickTimeLibrary::Initialize()
1222 // Turn off the wxDynamicLibrary logging
1223 bool bWasLoggingEnabled
= wxLog::EnableLogging(false);
1225 if (!m_dll
.Load(wxT("qtmlClient.dll")))
1227 wxLog::EnableLogging(bWasLoggingEnabled
);
1231 wxDL_METHOD_LOAD( m_dll
, StartMovie
, m_ok
);
1232 wxDL_METHOD_LOAD( m_dll
, StopMovie
, m_ok
);
1233 wxDL_METHOD_LOAD( m_dll
, IsMovieDone
, m_ok
);
1234 wxDL_METHOD_LOAD( m_dll
, GoToBeginningOfMovie
, m_ok
);
1235 wxDL_METHOD_LOAD( m_dll
, GetMoviesError
, m_ok
);
1236 wxDL_METHOD_LOAD( m_dll
, EnterMovies
, m_ok
);
1237 wxDL_METHOD_LOAD( m_dll
, ExitMovies
, m_ok
);
1238 wxDL_METHOD_LOAD( m_dll
, InitializeQTML
, m_ok
);
1239 wxDL_METHOD_LOAD( m_dll
, TerminateQTML
, m_ok
);
1240 wxDL_METHOD_LOAD( m_dll
, NativePathNameToFSSpec
, m_ok
);
1241 wxDL_METHOD_LOAD( m_dll
, OpenMovieFile
, m_ok
);
1242 wxDL_METHOD_LOAD( m_dll
, CloseMovieFile
, m_ok
);
1243 wxDL_METHOD_LOAD( m_dll
, NewMovieFromFile
, m_ok
);
1244 wxDL_METHOD_LOAD( m_dll
, GetMovieRate
, m_ok
);
1245 wxDL_METHOD_LOAD( m_dll
, SetMovieRate
, m_ok
);
1246 wxDL_METHOD_LOAD( m_dll
, MoviesTask
, m_ok
);
1247 wxDL_METHOD_LOAD( m_dll
, BlockMove
, m_ok
);
1248 wxDL_METHOD_LOAD( m_dll
, NewHandleClear
, m_ok
);
1249 wxDL_METHOD_LOAD( m_dll
, NewMovieFromDataRef
, m_ok
);
1250 wxDL_METHOD_LOAD( m_dll
, DisposeHandle
, m_ok
);
1251 wxDL_METHOD_LOAD( m_dll
, GetMovieNaturalBoundsRect
, m_ok
);
1252 wxDL_METHOD_LOAD( m_dll
, GetMovieIndTrackType
, m_ok
);
1253 wxDL_METHOD_LOAD( m_dll
, CreatePortAssociation
, m_ok
);
1254 wxDL_METHOD_LOAD( m_dll
, DestroyPortAssociation
, m_ok
);
1255 wxDL_METHOD_LOAD( m_dll
, GetNativeWindowPort
, m_ok
);
1256 wxDL_METHOD_LOAD( m_dll
, SetMovieGWorld
, m_ok
);
1257 wxDL_METHOD_LOAD( m_dll
, DisposeMovie
, m_ok
);
1258 wxDL_METHOD_LOAD( m_dll
, SetMovieBox
, m_ok
);
1259 wxDL_METHOD_LOAD( m_dll
, SetMovieTimeScale
, m_ok
);
1260 wxDL_METHOD_LOAD( m_dll
, GetMovieDuration
, m_ok
);
1261 wxDL_METHOD_LOAD( m_dll
, GetMovieTimeBase
, m_ok
);
1262 wxDL_METHOD_LOAD( m_dll
, GetMovieTimeScale
, m_ok
);
1263 wxDL_METHOD_LOAD( m_dll
, GetMovieTime
, m_ok
);
1264 wxDL_METHOD_LOAD( m_dll
, SetMovieTime
, m_ok
);
1265 wxDL_METHOD_LOAD( m_dll
, GetMovieVolume
, m_ok
);
1266 wxDL_METHOD_LOAD( m_dll
, SetMovieVolume
, m_ok
);
1267 wxDL_METHOD_LOAD( m_dll
, SetMovieTimeValue
, m_ok
);
1268 wxDL_METHOD_LOAD( m_dll
, NewMovieController
, m_ok
);
1269 wxDL_METHOD_LOAD( m_dll
, DisposeMovieController
, m_ok
);
1270 wxDL_METHOD_LOAD( m_dll
, MCSetVisible
, m_ok
);
1271 wxDL_METHOD_LOAD( m_dll
, PrePrerollMovie
, m_ok
);
1272 wxDL_METHOD_LOAD( m_dll
, PrerollMovie
, m_ok
);
1273 wxDL_METHOD_LOAD( m_dll
, GetMoviePreferredRate
, m_ok
);
1274 wxDL_METHOD_LOAD( m_dll
, GetMovieLoadState
, m_ok
);
1275 wxDL_METHOD_LOAD( m_dll
, MCDoAction
, m_ok
);
1276 wxDL_METHOD_LOAD( m_dll
, MCSetControllerBoundsRect
, m_ok
);
1277 wxDL_METHOD_LOAD( m_dll
, NativeEventToMacEvent
, m_ok
);
1278 wxDL_METHOD_LOAD( m_dll
, MCIsPlayerEvent
, m_ok
);
1279 wxDL_METHOD_LOAD( m_dll
, MCSetMovie
, m_ok
);
1280 wxDL_METHOD_LOAD( m_dll
, MCSetActionFilterWithRefCon
, m_ok
);
1281 wxDL_METHOD_LOAD( m_dll
, MCGetControllerInfo
, m_ok
);
1282 wxDL_METHOD_LOAD( m_dll
, BeginUpdate
, m_ok
);
1283 wxDL_METHOD_LOAD( m_dll
, UpdateMovie
, m_ok
);
1284 wxDL_METHOD_LOAD( m_dll
, EndUpdate
, m_ok
);
1285 wxDL_METHOD_LOAD( m_dll
, GetMoviesStickyError
, m_ok
);
1287 wxLog::EnableLogging(bWasLoggingEnabled
);
1293 class WXDLLIMPEXP_MEDIA wxQTMediaBackend
: public wxMediaBackendCommonBase
1297 ~wxQTMediaBackend();
1299 virtual bool CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
1304 const wxValidator
& validator
,
1305 const wxString
& name
);
1307 virtual bool Play();
1308 virtual bool Pause();
1309 virtual bool Stop();
1311 virtual bool Load(const wxURI
& location
,
1313 { return wxMediaBackend::Load(location
, proxy
); }
1315 virtual bool Load(const wxString
& fileName
);
1316 virtual bool Load(const wxURI
& location
);
1318 virtual wxMediaState
GetState();
1320 virtual bool SetPosition(wxLongLong where
);
1321 virtual wxLongLong
GetPosition();
1322 virtual wxLongLong
GetDuration();
1324 virtual void Move(int x
, int y
, int w
, int h
);
1325 wxSize
GetVideoSize() const;
1327 virtual double GetPlaybackRate();
1328 virtual bool SetPlaybackRate(double dRate
);
1330 virtual double GetVolume();
1331 virtual bool SetVolume(double);
1336 static void PPRMProc (Movie theMovie
, OSErr theErr
, void* theRefCon
);
1338 // TODO: Last param actually long - does this work on 64bit machines?
1339 static Boolean
MCFilterProc (MovieController theController
,
1340 short action
, void *params
, LONG_PTR refCon
);
1342 static LRESULT CALLBACK
QTWndProc(HWND
, UINT
, WPARAM
, LPARAM
);
1344 virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags
);
1346 wxSize m_bestSize
; // Original movie size
1347 Movie m_movie
; // QT Movie handle/instance
1348 bool m_bVideo
; // Whether or not we have video
1349 bool m_bPlaying
; // Whether or not movie is playing
1350 wxTimer
* m_timer
; // Load or Play timer
1351 wxQuickTimeLibrary m_lib
; // DLL to load functions from
1352 ComponentInstance m_pMC
; // Movie Controller
1354 friend class wxQTMediaEvtHandler
;
1355 DECLARE_DYNAMIC_CLASS(wxQTMediaBackend
)
1358 // helper to hijack background erasing for the QT window
1359 class WXDLLIMPEXP_MEDIA wxQTMediaEvtHandler
: public wxEvtHandler
1362 wxQTMediaEvtHandler(wxQTMediaBackend
*qtb
, WXHWND hwnd
)
1367 m_qtb
->m_ctrl
->Connect(m_qtb
->m_ctrl
->GetId(),
1368 wxEVT_ERASE_BACKGROUND
,
1369 wxEraseEventHandler(wxQTMediaEvtHandler::OnEraseBackground
),
1373 void OnEraseBackground(wxEraseEvent
& event
);
1376 wxQTMediaBackend
*m_qtb
;
1379 DECLARE_NO_COPY_CLASS(wxQTMediaEvtHandler
)
1383 //===========================================================================
1385 //===========================================================================
1387 //---------------------------------------------------------------------------
1389 //---------------------------------------------------------------------------
1391 IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend
, wxMediaBackend
)
1393 //---------------------------------------------------------------------------
1394 // Usual debugging macros
1395 //---------------------------------------------------------------------------
1397 #define MAX_ERROR_TEXT_LEN 160
1399 // Get the error string for Active Movie
1400 wxString
wxAMMediaBackend::GetErrorString(HRESULT hrdsv
)
1402 wxChar szError
[MAX_ERROR_TEXT_LEN
];
1403 if ( m_lpAMGetErrorText
!= NULL
&&
1404 (*m_lpAMGetErrorText
)(hrdsv
, szError
, MAX_ERROR_TEXT_LEN
) == 0)
1406 return wxString::Format(wxT("DirectShow error \"%s\" \n")
1407 wxT("(numeric %X)\n")
1409 szError
, (int)hrdsv
);
1413 return wxString::Format(wxT("Unknown error \n")
1414 wxT("(numeric %X)\n")
1420 #define wxAMFAIL(x) wxFAIL_MSG(GetErrorString(x));
1421 #define wxVERIFY(x) wxASSERT((x))
1422 #define wxAMLOG(x) wxLogDebug(GetErrorString(x))
1424 #define wxAMVERIFY(x) (x)
1425 #define wxVERIFY(x) (x)
1430 //---------------------------------------------------------------------------
1431 // Standard macros for ease of use
1432 //---------------------------------------------------------------------------
1433 #define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
1435 //---------------------------------------------------------------------------
1438 // Queries the control periodically to see if it has reached the point
1439 // in its loading cycle where we can begin playing the media - if so
1440 // then we finish up some things like getting the original size of the video
1441 // and then sending the loaded event to our handler
1442 //---------------------------------------------------------------------------
1443 class wxAMLoadTimer
: public wxTimer
1446 wxAMLoadTimer(wxAMMediaBackend
* parent
) :
1451 if (m_parent
->m_pMP
)
1453 MPReadyStateConstants nState
;
1454 m_parent
->m_pMP
->get_ReadyState(&nState
);
1455 if (nState
!= mpReadyStateLoading
)
1458 m_parent
->FinishLoad();
1464 IActiveMovie2
* pAM2
= NULL
;
1465 ReadyStateConstants nState
;
1466 if (m_parent
->m_pAM
->QueryInterface(IID_IActiveMovie2
, (void**)&pAM2
) == 0
1467 && pAM2
->get_ReadyState(&nState
) == 0)
1470 if (nState
!= amvLoading
)
1473 m_parent
->FinishLoad();
1483 m_parent
->FinishLoad();
1490 wxAMMediaBackend
* m_parent
; //Backend pointer
1493 //---------------------------------------------------------------------------
1496 // Sets m_hNotifyWnd to NULL to signify that we haven't loaded anything yet
1497 // Queries the control periodically to see if it has stopped -
1498 // if it has it sends the stop event
1499 //---------------------------------------------------------------------------
1500 class wxAMPlayTimer
: public wxTimer
1503 wxAMPlayTimer(wxAMMediaBackend
* parent
) :
1508 // NB: Stop events could get triggered by the interface
1509 // if ShowPlayerControls is enabled,
1510 // so we need this hack here to make an attempt
1511 // at it not getting sent - but its far from ideal -
1512 // they can still get sent in some cases
1513 if (m_parent
->GetState() == wxMEDIASTATE_STOPPED
&&
1514 m_parent
->GetPosition() == m_parent
->GetDuration())
1516 if ( m_parent
->SendStopEvent() )
1518 // seek to beginning of movie
1519 m_parent
->wxAMMediaBackend::SetPosition(0);
1522 // send the event to our child
1523 m_parent
->QueueFinishEvent();
1529 wxAMMediaBackend
* m_parent
; //Backend pointer
1534 // The following is an alternative way - but it doesn't seem
1535 // to work with the IActiveMovie control - it probably processes
1537 //---------------------------------------------------------------------------
1540 // Query the IMediaEvent interface from the embedded WMP's
1541 // filtergraph, then process the events from it - sending
1542 // EC_COMPLETE events as stop events to the media control.
1543 //---------------------------------------------------------------------------
1544 class wxAMPlayTimer
: public wxTimer
1547 wxAMPlayTimer(wxAMMediaBackend
* pBE
) : m_pBE(pBE
), m_pME(NULL
)
1551 hr
= m_pBE
->m_pAM
->get_FilterGraph(&pGB
);
1552 wxASSERT(SUCCEEDED(hr
));
1553 hr
= pGB
->QueryInterface(IID_IMediaEvent
, (void**)&m_pME
);
1554 wxASSERT(SUCCEEDED(hr
));
1560 SAFE_RELEASE(m_pME
);
1566 LONG_PTR evParam1
, evParam2
;
1568 // DirectShow keeps a list of queued events, and we need
1569 // to go through them one by one, stopping at (hopefully only one)
1570 // EC_COMPLETE message
1571 while ( m_pME
->GetEvent(&evCode
, &evParam1
, &evParam2
, 0) == 0 )
1573 // Cleanup memory that GetEvent allocated
1574 HRESULT hr
= m_pME
->FreeEventParams(evCode
, evParam1
, evParam2
);
1577 // Even though this makes a messagebox, this is Windows,
1578 // where we can do GUI stuff in separate threads :)
1579 wxFAIL_MSG(m_pBE
->GetErrorString(hr
));
1581 // If this is the end of the clip, notify handler
1582 else if (1 == evCode
) // EC_COMPLETE
1584 if ( m_pBE
->SendStopEvent() )
1587 m_pBE
->QueueFinishEvent();
1594 wxAMMediaBackend
* m_pBE
; // Backend pointer
1595 IMediaEvent
* m_pME
; // To determine when to send stop event
1599 //---------------------------------------------------------------------------
1600 // wxAMMediaBackend Constructor
1601 //---------------------------------------------------------------------------
1602 wxAMMediaBackend::wxAMMediaBackend()
1610 //---------------------------------------------------------------------------
1611 // wxAMMediaBackend Destructor
1612 //---------------------------------------------------------------------------
1613 wxAMMediaBackend::~wxAMMediaBackend()
1615 // Free memory from Load()
1620 m_pAX
->DissociateHandle();
1629 //---------------------------------------------------------------------------
1630 // wxAMMediaBackend::Clear
1632 // Free up interfaces and memory allocated by LoadXXX
1633 //---------------------------------------------------------------------------
1634 void wxAMMediaBackend::Clear()
1643 //---------------------------------------------------------------------------
1644 // wxAMMediaBackend::CreateControl
1645 //---------------------------------------------------------------------------
1646 bool wxAMMediaBackend::CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
1651 const wxValidator
& validator
,
1652 const wxString
& name
)
1654 // First get the AMGetErrorText procedure in debug
1655 // mode for more meaningful messages
1657 if ( m_dllQuartz
.Load(_T("quartz.dll"), wxDL_VERBATIM
) )
1659 m_lpAMGetErrorText
= (LPAMGETERRORTEXT
)
1660 m_dllQuartz
.GetSymbolAorW(wxT("AMGetErrorText"));
1666 if (CLSIDFromProgID(wxT("WPCEOCX.WMP"), &clsid
) != S_OK
&&
1667 CLSIDFromProgID(wxT("MediaPlayer.MediaPlayer.1"), &clsid
) != S_OK
)
1670 // determine which (if any) media player interface
1671 // is available - IMediaPlayer or IActiveMovie
1672 if ( ::CoCreateInstance(clsid
, NULL
,
1673 CLSCTX_INPROC_SERVER
,
1674 IID_IMediaPlayer
, (void**)&m_pMP
) != 0 )
1680 m_pMP
->QueryInterface(IID_IActiveMovie
, (void**)&m_pAM
);
1683 // determine which (if any) media player interface
1684 // is available - IMediaPlayer or IActiveMovie
1685 if ( ::CoCreateInstance(CLSID_MediaPlayer
, NULL
,
1686 CLSCTX_INPROC_SERVER
,
1687 IID_IMediaPlayer
, (void**)&m_pMP
) != 0 )
1689 if ( ::CoCreateInstance(CLSID_ActiveMovie
, NULL
,
1690 CLSCTX_INPROC_SERVER
,
1691 IID_IActiveMovie
, (void**)&m_pAM
) != 0 )
1696 m_pAM
->QueryInterface(IID_IMediaPlayer
, (void**)&m_pMP
);
1700 m_pMP
->QueryInterface(IID_IActiveMovie
, (void**)&m_pAM
);
1705 // By default wxWindow(s) is created with a border -
1706 // so we need to get rid of those
1708 // Since we don't have a child window like most other
1709 // backends, we don't need wxCLIP_CHILDREN
1710 if ( !ctrl
->wxControl::Create(parent
, id
, pos
, size
,
1711 (style
& ~wxBORDER_MASK
) | wxBORDER_NONE
,
1717 // Create the ActiveX container along with the media player
1718 // interface and query them
1719 m_ctrl
= wxStaticCast(ctrl
, wxMediaCtrl
);
1720 m_pAX
= new wxActiveXContainer(ctrl
,
1721 m_pMP
? IID_IMediaPlayer
: IID_IActiveMovie
,
1724 // Set up wx-specific stuff for the default
1725 // settings wxMediaCtrl says it will conform to (???)
1728 m_pMP
->put_DisplaySize(mpFitToSize
);
1730 // TODO: Unsure what actual effect this has
1731 m_pMP
->put_WindowlessVideo(VARIANT_TRUE
);
1734 m_pAM
->put_MovieWindowSize(amvDoubleOriginalSize
);
1737 m_pAM
->put_AutoStart(VARIANT_FALSE
);
1739 // by default enabled
1740 wxAMMediaBackend::ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_NONE
);
1742 // by default with AM only 0.5
1743 wxAMMediaBackend::SetVolume(1.0);
1745 // don't erase the background of our control window
1746 // so that resizing is a bit smoother
1747 m_ctrl
->SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
1753 //---------------------------------------------------------------------------
1754 // wxAMMediaBackend::Load (file version)
1755 //---------------------------------------------------------------------------
1756 bool wxAMMediaBackend::Load(const wxString
& fileName
)
1758 return DoLoad(fileName
);
1761 //---------------------------------------------------------------------------
1762 // wxAMMediaBackend::Load (URL Version)
1763 //---------------------------------------------------------------------------
1764 bool wxAMMediaBackend::Load(const wxURI
& location
)
1766 // Turn off loading from a proxy, as user may have set it previously
1767 INSPlay
* pPlay
= NULL
;
1768 m_pAM
->QueryInterface(IID_INSPlay
, (void**) &pPlay
);
1771 pPlay
->put_UseHTTPProxy(VARIANT_FALSE
);
1775 return DoLoad(location
.BuildURI());
1778 //---------------------------------------------------------------------------
1779 // wxAMMediaBackend::Load (URL Version with Proxy)
1780 //---------------------------------------------------------------------------
1781 bool wxAMMediaBackend::Load(const wxURI
& location
, const wxURI
& proxy
)
1783 // Set the proxy of the NETSHOW interface
1784 INSPlay
* pPlay
= NULL
;
1785 m_pAM
->QueryInterface(IID_INSPlay
, (void**) &pPlay
);
1789 pPlay
->put_UseHTTPProxy(VARIANT_TRUE
);
1790 pPlay
->put_HTTPProxyHost(wxBasicString(proxy
.GetServer()).Get());
1791 pPlay
->put_HTTPProxyPort(wxAtoi(proxy
.GetPort()));
1795 return DoLoad(location
.BuildURI());
1798 //---------------------------------------------------------------------------
1799 // wxAMMediaBackend::DoLoad
1801 // Called by all functions - this actually renders
1802 // the file and sets up the filter graph
1803 //---------------------------------------------------------------------------
1804 bool wxAMMediaBackend::DoLoad(const wxString
& location
)
1806 //Clear up previously allocated memory
1811 // Play the movie the normal way through the embedded WMP.
1812 // Supposedly, Open is better in theory because
1813 // the docs say its async and put_FileName is not -
1814 // but in practice they both appear to be async anyway
1816 hr
= m_pMP
->Open( wxBasicString(location
).Get() );
1818 hr
= m_pAM
->put_FileName( wxBasicString(location
).Get() );
1826 // In AM playing will FAIL if
1827 // the user plays before the media is loaded
1828 m_pTimer
= new wxAMLoadTimer(this);
1829 m_pTimer
->Start(20);
1834 //---------------------------------------------------------------------------
1835 // wxAMMediaBackend::FinishLoad
1837 // Called by our wxAMLoadTimer when the
1838 // embedded WMP tells its the media is ready to play.
1840 // Here we get the original size of the video and
1841 // send the loaded event to our watcher :).
1842 //---------------------------------------------------------------------------
1843 void wxAMMediaBackend::FinishLoad()
1845 //Get the original video size
1846 m_pAM
->get_ImageSourceWidth((long*)&m_bestSize
.x
);
1847 m_pAM
->get_ImageSourceHeight((long*)&m_bestSize
.y
);
1849 // Start the play timer to catch stop events
1850 // Previous load timer cleans up itself
1851 m_pTimer
= new wxAMPlayTimer(this);
1853 NotifyMovieLoaded();
1856 //---------------------------------------------------------------------------
1857 // wxAMMediaBackend::ShowPlayerControls
1858 //---------------------------------------------------------------------------
1859 bool wxAMMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags
)
1861 // Note that IMediaPlayer doesn't have a statusbar by
1862 // default but IActiveMovie does - so lets try to keep
1863 // the interface consistant
1866 m_pAM
->put_Enabled(VARIANT_FALSE
);
1867 m_pAM
->put_ShowControls(VARIANT_FALSE
);
1869 m_pMP
->put_ShowStatusBar(VARIANT_FALSE
);
1873 m_pAM
->put_Enabled(VARIANT_TRUE
);
1874 m_pAM
->put_ShowControls(VARIANT_TRUE
);
1876 m_pAM
->put_ShowPositionControls(
1877 (flags
& wxMEDIACTRLPLAYERCONTROLS_STEP
) ?
1878 VARIANT_TRUE
: VARIANT_FALSE
);
1882 m_pMP
->put_ShowStatusBar(VARIANT_TRUE
);
1883 m_pMP
->put_ShowAudioControls(
1884 (flags
& wxMEDIACTRLPLAYERCONTROLS_VOLUME
) ?
1885 VARIANT_TRUE
: VARIANT_FALSE
);
1892 //---------------------------------------------------------------------------
1893 // wxAMMediaBackend::Play
1895 // Plays the stream. If it is non-seekable, it will restart it (implicit).
1897 // Note that we use SUCCEEDED here because run/pause/stop tend to be overly
1898 // picky and return warnings on pretty much every call
1899 //---------------------------------------------------------------------------
1900 bool wxAMMediaBackend::Play()
1902 // Actually try to play the movie, even though it may not be loaded yet.
1903 HRESULT hr
= m_pAM
->Run();
1906 m_pTimer
->Start(20);
1915 //---------------------------------------------------------------------------
1916 // wxAMMediaBackend::Pause
1918 // Pauses the stream.
1919 //---------------------------------------------------------------------------
1920 bool wxAMMediaBackend::Pause()
1922 HRESULT hr
= m_pAM
->Pause();
1931 //---------------------------------------------------------------------------
1932 // wxAMMediaBackend::Stop
1934 // Stops the stream.
1935 //---------------------------------------------------------------------------
1936 bool wxAMMediaBackend::Stop()
1938 HRESULT hr
= m_pAM
->Stop();
1941 // Seek to beginning
1942 wxAMMediaBackend::SetPosition(0);
1944 // Stop stop event timer
1954 //---------------------------------------------------------------------------
1955 // wxAMMediaBackend::SetPosition
1957 // 1) Translates the current position's time to directshow time,
1958 // which is in a scale of 1 second (in a double)
1959 // 2) Sets the play position of the IMediaSeeking interface -
1960 // passing NULL as the stop position means to keep the old
1962 //---------------------------------------------------------------------------
1963 bool wxAMMediaBackend::SetPosition(wxLongLong where
)
1965 HRESULT hr
= m_pAM
->put_CurrentPosition(
1966 ((LONGLONG
)where
.GetValue()) / 1000.0
1977 //---------------------------------------------------------------------------
1978 // wxAMMediaBackend::GetPosition
1980 // 1) Obtains the current play and stop positions from IMediaSeeking
1981 // 2) Returns the play position translated to our time base
1982 //---------------------------------------------------------------------------
1983 wxLongLong
wxAMMediaBackend::GetPosition()
1986 HRESULT hr
= m_pAM
->get_CurrentPosition(&outCur
);
1993 // h,m,s,milli - outdur is in 1 second (double)
2001 //---------------------------------------------------------------------------
2002 // wxAMMediaBackend::GetVolume
2004 // Gets the volume through the IBasicAudio interface -
2005 // value ranges from 0 (MAX volume) to -10000 (minimum volume).
2006 // -100 per decibel.
2007 //---------------------------------------------------------------------------
2008 double wxAMMediaBackend::GetVolume()
2011 HRESULT hr
= m_pAM
->get_Volume(&lVolume
);
2018 return pow(10.0, lVolume
/ 2000.0);
2021 //---------------------------------------------------------------------------
2022 // wxAMMediaBackend::SetVolume
2024 // Sets the volume through the IBasicAudio interface -
2025 // value ranges from 0 (MAX volume) to -10000 (minimum volume).
2026 // -100 per decibel.
2027 //---------------------------------------------------------------------------
2028 bool wxAMMediaBackend::SetVolume(double dVolume
)
2030 // pow(10.0, -80.0) to correct 0 == -INF
2031 long lVolume
= (long)(2000.0 * log10( pow( 10.0, -80.0) + dVolume
) );
2032 HRESULT hr
= m_pAM
->put_Volume( lVolume
);
2042 //---------------------------------------------------------------------------
2043 // wxAMMediaBackend::GetDuration
2045 // 1) Obtains the duration of the media from IAMMultiMediaStream
2046 // 2) Converts that value to our time base, and returns it
2048 // NB: With VBR MP3 files the default DirectShow MP3 render does not
2049 // read the Xing header correctly, resulting in skewed values for duration
2051 //---------------------------------------------------------------------------
2052 wxLongLong
wxAMMediaBackend::GetDuration()
2055 HRESULT hr
= m_pAM
->get_Duration(&outDuration
);
2062 // h,m,s,milli - outdur is in 1 second (double)
2063 outDuration
*= 1000;
2065 ll
.Assign(outDuration
);
2070 //---------------------------------------------------------------------------
2071 // wxAMMediaBackend::GetState
2073 // Returns the cached state
2074 //---------------------------------------------------------------------------
2075 wxMediaState
wxAMMediaBackend::GetState()
2077 StateConstants nState
;
2078 HRESULT hr
= m_pAM
->get_CurrentState(&nState
);
2082 return wxMEDIASTATE_STOPPED
;
2085 return (wxMediaState
)nState
;
2088 //---------------------------------------------------------------------------
2089 // wxAMMediaBackend::GetPlaybackRate
2091 // Pretty simple way of obtaining the playback rate from
2092 // the IMediaSeeking interface
2093 //---------------------------------------------------------------------------
2094 double wxAMMediaBackend::GetPlaybackRate()
2097 HRESULT hr
= m_pAM
->get_Rate(&dRate
);
2107 //---------------------------------------------------------------------------
2108 // wxAMMediaBackend::SetPlaybackRate
2110 // Sets the playback rate of the media - DirectShow is pretty good
2111 // about this, actually
2112 //---------------------------------------------------------------------------
2113 bool wxAMMediaBackend::SetPlaybackRate(double dRate
)
2115 HRESULT hr
= m_pAM
->put_Rate(dRate
);
2125 //---------------------------------------------------------------------------
2126 // wxAMMediaBackend::GetDownloadXXX
2128 // Queries for and gets the total size of the file and the current
2129 // progress in downloading that file from the IAMOpenProgress
2130 // interface from the media player interface's filter graph
2131 //---------------------------------------------------------------------------
2132 void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong
* pLoadProgress
,
2133 wxLongLong
* pLoadTotal
)
2135 LONGLONG loadTotal
= 0, loadProgress
= 0;
2137 IAMOpenProgress
* pOP
;
2139 hr
= m_pAM
->get_FilterGraph(&pFG
);
2142 hr
= pFG
->QueryInterface(IID_IAMOpenProgress
, (void**)&pOP
);
2145 hr
= pOP
->QueryProgress(&loadTotal
, &loadProgress
);
2154 *pLoadProgress
= loadProgress
;
2155 *pLoadTotal
= loadTotal
;
2159 // When not loading from a URL QueryProgress will return
2160 // E_NOINTERFACE or whatever
2167 //---------------------------------------------------------------------------
2168 // wxAMMediaBackend::GetVideoSize
2170 // Obtains the cached original video size
2171 //---------------------------------------------------------------------------
2172 wxSize
wxAMMediaBackend::GetVideoSize() const
2177 //---------------------------------------------------------------------------
2178 // wxAMMediaBackend::Move
2180 // We take care of this in our redrawing
2181 //---------------------------------------------------------------------------
2182 void wxAMMediaBackend::Move(int WXUNUSED(x
), int WXUNUSED(y
),
2183 int WXUNUSED(w
), int WXUNUSED(h
))
2187 //---------------------------------------------------------------------------
2188 // End of wxAMMediaBackend
2189 //---------------------------------------------------------------------------
2191 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2193 // wxMCIMediaBackend
2195 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2198 IMPLEMENT_DYNAMIC_CLASS(wxMCIMediaBackend
, wxMediaBackend
)
2200 //---------------------------------------------------------------------------
2201 // Usual debugging macros for MCI returns
2202 //---------------------------------------------------------------------------
2205 #define wxMCIVERIFY(arg) \
2208 if ( (nRet = (arg)) != 0) \
2211 mciGetErrorString(nRet, sz, 5000); \
2212 wxFAIL_MSG(wxString::Format(_T("MCI Error:%s"), sz)); \
2216 #define wxMCIVERIFY(arg) (arg);
2219 //---------------------------------------------------------------------------
2220 // Simulation for <digitalv.h>
2222 // Mingw and possibly other compilers don't have the digitalv.h header
2223 // that is needed to have some essential features of mci work with
2224 // windows - so we provide the declarations for the types we use here
2225 //---------------------------------------------------------------------------
2229 DWORD_PTR dwCallback
;
2230 #ifdef MCI_USE_OFFEXT
2241 DWORD_PTR dwCallback
;
2252 MCI_DGV_WINDOW_PARMS
;
2256 DWORD_PTR dwCallback
;
2266 DWORD_PTR dwCallback
;
2270 wxChar
* lpstrAlgorithm
;
2271 wxChar
* lpstrQuality
;
2273 MCI_DGV_SETAUDIO_PARMS
;
2275 //---------------------------------------------------------------------------
2276 // wxMCIMediaBackend Constructor
2278 // Here we don't need to do much except say we don't have any video :)
2279 //---------------------------------------------------------------------------
2280 wxMCIMediaBackend::wxMCIMediaBackend() : m_hNotifyWnd(NULL
), m_bVideo(false)
2284 //---------------------------------------------------------------------------
2285 // wxMCIMediaBackend Destructor
2287 // We close the mci device - note that there may not be an mci device here,
2288 // or it may fail - but we don't really care, since we're destructing
2289 //---------------------------------------------------------------------------
2290 wxMCIMediaBackend::~wxMCIMediaBackend()
2294 mciSendCommand(m_hDev
, MCI_CLOSE
, 0, 0);
2295 DestroyWindow(m_hNotifyWnd
);
2296 m_hNotifyWnd
= NULL
;
2300 //---------------------------------------------------------------------------
2301 // wxMCIMediaBackend::Create
2303 // Here we just tell wxMediaCtrl that mci does exist (which it does, on all
2304 // msw systems, at least in some form dating back to win16 days)
2305 //---------------------------------------------------------------------------
2306 bool wxMCIMediaBackend::CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
2311 const wxValidator
& validator
,
2312 const wxString
& name
)
2315 // By default wxWindow(s) is created with a border -
2316 // so we need to get rid of those, and create with
2317 // wxCLIP_CHILDREN, so that if the driver/backend
2318 // is a child window, it refereshes properly
2319 if ( !ctrl
->wxControl::Create(parent
, id
, pos
, size
,
2320 (style
& ~wxBORDER_MASK
) | wxBORDER_NONE
| wxCLIP_CHILDREN
,
2324 m_ctrl
= wxStaticCast(ctrl
, wxMediaCtrl
);
2329 //---------------------------------------------------------------------------
2330 // wxMCIMediaBackend::Load (file version)
2332 // Here we have MCI load a file and device, set the time format to our
2333 // default (milliseconds), and set the video (if any) to play in the control
2334 //---------------------------------------------------------------------------
2335 bool wxMCIMediaBackend::Load(const wxString
& fileName
)
2337 // if the user already called load close the previous MCI device
2340 mciSendCommand(m_hDev
, MCI_CLOSE
, 0, 0);
2341 DestroyWindow(m_hNotifyWnd
);
2342 m_hNotifyWnd
= NULL
;
2345 // Opens a file and has MCI select a device. Normally you'd put
2346 // MCI_OPEN_TYPE in addition to MCI_OPEN_ELEMENT - however if you
2347 // omit this it tells MCI to select the device instead. This is good
2348 // because we have no reliable way of "enumerating" the devices in MCI
2349 MCI_OPEN_PARMS openParms
;
2350 openParms
.lpstrElementName
= (wxChar
*) fileName
.c_str();
2352 if ( mciSendCommand(0, MCI_OPEN
, MCI_OPEN_ELEMENT
,
2353 (DWORD
)(LPVOID
)&openParms
) != 0)
2358 m_hDev
= openParms
.wDeviceID
;
2360 // set the time format for the device to milliseconds
2361 MCI_SET_PARMS setParms
;
2362 setParms
.dwCallback
= 0;
2363 setParms
.dwTimeFormat
= MCI_FORMAT_MILLISECONDS
;
2365 if (mciSendCommand(m_hDev
, MCI_SET
, MCI_SET_TIME_FORMAT
,
2366 (DWORD
)(LPVOID
)&setParms
) != 0)
2371 // tell the MCI device to display the video in our wxMediaCtrl
2372 MCI_DGV_WINDOW_PARMS windowParms
;
2373 windowParms
.hWnd
= (HWND
)m_ctrl
->GetHandle();
2375 m_bVideo
= (mciSendCommand(m_hDev
, MCI_WINDOW
,
2376 0x00010000L
, // MCI_DGV_WINDOW_HWND
2377 (DWORD
)(LPVOID
)&windowParms
) == 0);
2379 // Create a hidden window and register to handle MCI events
2380 // Note that wxCanvasClassName is already registered
2381 // and used by all wxWindows and normal wxControls
2382 m_hNotifyWnd
= ::CreateWindow(
2394 wxLogSysError( wxT("Could not create hidden needed for ")
2395 wxT("registering for MCI events!") );
2400 wxSetWindowProc(m_hNotifyWnd
, wxMCIMediaBackend::NotifyWndProc
);
2401 wxSetWindowUserData(m_hNotifyWnd
, this);
2403 NotifyMovieLoaded();
2408 //---------------------------------------------------------------------------
2409 // wxMCIMediaBackend::Load (URL version)
2411 // MCI doesn't support URLs directly (?)
2413 // TODO: Use wxURL/wxFileSystem and mmioInstallProc
2414 //---------------------------------------------------------------------------
2415 bool wxMCIMediaBackend::Load(const wxURI
& WXUNUSED(location
))
2420 //---------------------------------------------------------------------------
2421 // wxMCIMediaBackend::Play
2423 // Plays/Resumes the MCI device... a couple notes:
2424 // 1) Certain drivers will crash and burn if we don't pass them an
2425 // MCI_PLAY_PARMS, despite the documentation that says otherwise...
2426 // 2) There is a MCI_RESUME command, but MCI_PLAY does the same thing
2427 // and will resume from a stopped state also, so there's no need to
2428 // call both, for example
2429 //---------------------------------------------------------------------------
2430 bool wxMCIMediaBackend::Play()
2432 MCI_PLAY_PARMS playParms
;
2433 playParms
.dwCallback
= (DWORD
)m_hNotifyWnd
;
2435 bool bOK
= ( mciSendCommand(m_hDev
, MCI_PLAY
, MCI_NOTIFY
,
2436 (DWORD
)(LPVOID
)&playParms
) == 0 );
2439 m_ctrl
->Show(m_bVideo
);
2444 //---------------------------------------------------------------------------
2445 // wxMCIMediaBackend::Pause
2447 // Pauses the MCI device - nothing special
2448 //---------------------------------------------------------------------------
2449 bool wxMCIMediaBackend::Pause()
2451 return (mciSendCommand(m_hDev
, MCI_PAUSE
, MCI_WAIT
, 0) == 0);
2454 //---------------------------------------------------------------------------
2455 // wxMCIMediaBackend::Stop
2457 // Stops the MCI device & seeks to the beginning as wxMediaCtrl docs outline
2458 //---------------------------------------------------------------------------
2459 bool wxMCIMediaBackend::Stop()
2461 return (mciSendCommand(m_hDev
, MCI_STOP
, MCI_WAIT
, 0) == 0) &&
2462 (mciSendCommand(m_hDev
, MCI_SEEK
, MCI_SEEK_TO_START
, 0) == 0);
2465 //---------------------------------------------------------------------------
2466 // wxMCIMediaBackend::GetState
2468 // Here we get the state and convert it to a wxMediaState -
2469 // since we use direct comparisons with MCI_MODE_PLAY and
2470 // MCI_MODE_PAUSE, we don't care if the MCI_STATUS call
2472 //---------------------------------------------------------------------------
2473 wxMediaState
wxMCIMediaBackend::GetState()
2475 MCI_STATUS_PARMS statusParms
;
2476 statusParms
.dwItem
= MCI_STATUS_MODE
;
2478 mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2479 (DWORD
)(LPVOID
)&statusParms
);
2481 if (statusParms
.dwReturn
== MCI_MODE_PAUSE
)
2482 return wxMEDIASTATE_PAUSED
;
2483 else if (statusParms
.dwReturn
== MCI_MODE_PLAY
)
2484 return wxMEDIASTATE_PLAYING
;
2486 return wxMEDIASTATE_STOPPED
;
2489 //---------------------------------------------------------------------------
2490 // wxMCIMediaBackend::SetPosition
2492 // Here we set the position of the device in the stream.
2493 // Note that MCI actually stops the device after you seek it if the
2494 // device is playing/paused, so we need to play the file after
2495 // MCI seeks like normal APIs would
2496 //---------------------------------------------------------------------------
2497 bool wxMCIMediaBackend::SetPosition(wxLongLong where
)
2499 MCI_SEEK_PARMS seekParms
;
2500 seekParms
.dwCallback
= 0;
2502 #if wxUSE_LONGLONG_NATIVE && !wxUSE_LONGLONG_WX
2503 seekParms
.dwTo
= (DWORD
)where
.GetValue();
2504 #else // wxUSE_LONGLONG_WX
2505 // no way to return it in one piece
2506 wxASSERT( where
.GetHi() == 0 );
2507 seekParms
.dwTo
= (DWORD
)where
.GetLo();
2510 // device was playing?
2511 bool bReplay
= GetState() == wxMEDIASTATE_PLAYING
;
2513 if ( mciSendCommand(m_hDev
, MCI_SEEK
, MCI_TO
,
2514 (DWORD
)(LPVOID
)&seekParms
) != 0)
2519 // If the device was playing, resume it
2526 //---------------------------------------------------------------------------
2527 // wxMCIMediaBackend::GetPosition
2529 // Gets the position of the device in the stream using the current
2530 // time format... nothing special here...
2531 //---------------------------------------------------------------------------
2532 wxLongLong
wxMCIMediaBackend::GetPosition()
2534 MCI_STATUS_PARMS statusParms
;
2535 statusParms
.dwItem
= MCI_STATUS_POSITION
;
2537 if (mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2538 (DWORD
)(LPSTR
)&statusParms
) != 0)
2543 return statusParms
.dwReturn
;
2546 //---------------------------------------------------------------------------
2547 // wxMCIMediaBackend::GetVolume
2549 // Gets the volume of the current media via the MCI_DGV_STATUS_VOLUME
2550 // message. Value ranges from 0 (minimum) to 1000 (maximum volume).
2551 //---------------------------------------------------------------------------
2552 double wxMCIMediaBackend::GetVolume()
2554 MCI_STATUS_PARMS statusParms
;
2555 statusParms
.dwCallback
= 0;
2556 statusParms
.dwItem
= 0x4019; // MCI_DGV_STATUS_VOLUME
2558 if (mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2559 (DWORD
)(LPSTR
)&statusParms
) != 0)
2564 return ((double)statusParms
.dwReturn
) / 1000.0;
2567 //---------------------------------------------------------------------------
2568 // wxMCIMediaBackend::SetVolume
2570 // Sets the volume of the current media via the MCI_DGV_SETAUDIO_VOLUME
2571 // message. Value ranges from 0 (minimum) to 1000 (maximum volume).
2572 //---------------------------------------------------------------------------
2573 bool wxMCIMediaBackend::SetVolume(double dVolume
)
2575 MCI_DGV_SETAUDIO_PARMS audioParms
;
2576 audioParms
.dwCallback
= 0;
2577 audioParms
.dwItem
= 0x4002; // MCI_DGV_SETAUDIO_VOLUME
2578 audioParms
.dwValue
= (DWORD
) (dVolume
* 1000.0);
2579 audioParms
.dwOver
= 0;
2580 audioParms
.lpstrAlgorithm
= NULL
;
2581 audioParms
.lpstrQuality
= NULL
;
2583 if (mciSendCommand(m_hDev
, 0x0873, // MCI_SETAUDIO
2584 // MCI_DGV_SETAUDIO + (_ITEM | _VALUE)
2585 0x00800000L
| 0x01000000L
,
2586 (DWORD
)(LPSTR
)&audioParms
) != 0)
2594 //---------------------------------------------------------------------------
2595 // wxMCIMediaBackend::GetDuration
2597 // Gets the duration of the stream... nothing special
2598 //---------------------------------------------------------------------------
2599 wxLongLong
wxMCIMediaBackend::GetDuration()
2601 MCI_STATUS_PARMS statusParms
;
2602 statusParms
.dwItem
= MCI_STATUS_LENGTH
;
2604 if (mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2605 (DWORD
)(LPSTR
)&statusParms
) != 0)
2610 return statusParms
.dwReturn
;
2613 //---------------------------------------------------------------------------
2614 // wxMCIMediaBackend::Move
2616 // Moves the window to a location
2617 //---------------------------------------------------------------------------
2618 void wxMCIMediaBackend::Move(int WXUNUSED(x
), int WXUNUSED(y
), int w
, int h
)
2620 if (m_hNotifyWnd
&& m_bVideo
)
2622 MCI_DGV_RECT_PARMS putParms
; // ifdefed MCI_DGV_PUT_PARMS
2623 memset(&putParms
, 0, sizeof(MCI_DGV_RECT_PARMS
));
2624 putParms
.rc
.bottom
= h
;
2625 putParms
.rc
.right
= w
;
2627 // wxStackWalker will crash and burn here on assert
2628 // and MCI doesn't like 0 and 0 for some reason (out of range)
2629 // so just don't it in that case
2632 wxMCIVERIFY( mciSendCommand(m_hDev
, MCI_PUT
,
2633 0x00040000L
, // MCI_DGV_PUT_DESTINATION
2634 (DWORD
)(LPSTR
)&putParms
) );
2639 //---------------------------------------------------------------------------
2640 // wxMCIMediaBackend::GetVideoSize
2642 // Gets the original size of the movie for sizers
2643 //---------------------------------------------------------------------------
2644 wxSize
wxMCIMediaBackend::GetVideoSize() const
2648 MCI_DGV_RECT_PARMS whereParms
; // ifdefed MCI_DGV_WHERE_PARMS
2650 wxMCIVERIFY( mciSendCommand(m_hDev
, MCI_WHERE
,
2651 0x00020000L
, // MCI_DGV_WHERE_SOURCE
2652 (DWORD
)(LPSTR
)&whereParms
) );
2654 return wxSize(whereParms
.rc
.right
, whereParms
.rc
.bottom
);
2656 return wxSize(0, 0);
2659 //---------------------------------------------------------------------------
2660 // wxMCIMediaBackend::GetPlaybackRate
2663 //---------------------------------------------------------------------------
2664 double wxMCIMediaBackend::GetPlaybackRate()
2669 //---------------------------------------------------------------------------
2670 // wxMCIMediaBackend::SetPlaybackRate
2673 //---------------------------------------------------------------------------
2674 bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate
))
2677 MCI_WAVE_SET_SAMPLESPERSEC
2678 MCI_DGV_SET_PARMS setParms
;
2679 setParms
.dwSpeed
= (DWORD
) (dRate
* 1000.0);
2681 return (mciSendCommand(m_hDev
, MCI_SET
,
2682 0x00020000L
, // MCI_DGV_SET_SPEED
2683 (DWORD
)(LPSTR
)&setParms
) == 0);
2689 //---------------------------------------------------------------------------
2690 // [static] wxMCIMediaBackend::MSWWindowProc
2692 // Here we process a message when MCI reaches the stopping point
2694 //---------------------------------------------------------------------------
2695 LRESULT CALLBACK
wxMCIMediaBackend::NotifyWndProc(HWND hWnd
, UINT nMsg
,
2699 wxMCIMediaBackend
* backend
=
2700 (wxMCIMediaBackend
*)wxGetWindowUserData(hWnd
);
2702 return backend
->OnNotifyWndProc(hWnd
, nMsg
, wParam
, lParam
);
2705 LRESULT CALLBACK
wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd
, UINT nMsg
,
2709 if (nMsg
== MM_MCINOTIFY
)
2711 wxASSERT(lParam
== (LPARAM
) m_hDev
);
2712 if (wParam
== MCI_NOTIFY_SUCCESSFUL
&& lParam
== (LPARAM
)m_hDev
)
2714 if ( SendStopEvent() )
2716 wxMCIVERIFY( mciSendCommand(m_hDev
, MCI_SEEK
, MCI_SEEK_TO_START
, 0) );
2721 return DefWindowProc(hWnd
, nMsg
, wParam
, lParam
);
2723 #endif // __WXWINCE__
2725 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2729 // TODO: Use a less kludgy way to pause/get state/set state
2730 // FIXME: Greg Hazel reports that sometimes files that cannot be played
2731 // with this backend are treated as playable anyway - not verified though.
2732 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2734 IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend
, wxMediaBackend
)
2736 // Time between timer calls - this is the Apple recommendation to the TCL
2738 #define MOVIE_DELAY 20
2740 #include "wx/timer.h"
2743 //---------------------------------------------------------------------------
2746 // QT, esp. QT for Windows is very picky about how you go about
2747 // async loading. If you were to go through a Windows message loop
2748 // or a MoviesTask or both and then check the movie load state
2749 // it would still return 1000 (loading)... even (pre)prerolling doesn't
2750 // help. However, making a load timer like this works
2751 //---------------------------------------------------------------------------
2752 class wxQTLoadTimer
: public wxTimer
2755 wxQTLoadTimer(Movie movie
, wxQTMediaBackend
* parent
, wxQuickTimeLibrary
* pLib
) :
2756 m_movie(movie
), m_parent(parent
), m_pLib(pLib
) {}
2760 m_pLib
->MoviesTask(m_movie
, 0);
2761 //kMovieLoadStatePlayable
2762 if (m_pLib
->GetMovieLoadState(m_movie
) >= 10000)
2764 m_parent
->FinishLoad();
2770 Movie m_movie
; //Our movie instance
2771 wxQTMediaBackend
* m_parent
; //Backend pointer
2772 wxQuickTimeLibrary
* m_pLib
; //Interfaces
2776 // --------------------------------------------------------------------------
2777 // wxQTPlayTimer - Handle Asyncronous Playing
2779 // 1) Checks to see if the movie is done, and if not continues
2780 // streaming the movie
2781 // 2) Sends the wxEVT_MEDIA_STOP event if we have reached the end of
2783 // --------------------------------------------------------------------------
2784 class wxQTPlayTimer
: public wxTimer
2787 wxQTPlayTimer(Movie movie
, wxQTMediaBackend
* parent
,
2788 wxQuickTimeLibrary
* pLib
) :
2789 m_movie(movie
), m_parent(parent
), m_pLib(pLib
) {}
2794 // OK, a little explaining - basically originally
2795 // we only called MoviesTask if the movie was actually
2796 // playing (not paused or stopped)... this was before
2797 // we realized MoviesTask actually handles repainting
2798 // of the current frame - so if you were to resize
2799 // or something it would previously not redraw that
2800 // portion of the movie.
2802 // So now we call MoviesTask always so that it repaints
2805 m_pLib
->MoviesTask(m_movie
, 0);
2808 // Handle the stop event - if the movie has reached
2809 // the end, notify our handler
2811 // m_bPlaying == !(Stopped | Paused)
2813 if (m_parent
->m_bPlaying
)
2815 if (m_pLib
->IsMovieDone(m_movie
))
2817 if ( m_parent
->SendStopEvent() )
2820 wxASSERT(m_pLib
->GetMoviesError() == noErr
);
2822 m_parent
->QueueFinishEvent();
2829 Movie m_movie
; // Our movie instance
2830 wxQTMediaBackend
* m_parent
; //Backend pointer
2831 wxQuickTimeLibrary
* m_pLib
; //Interfaces
2835 //---------------------------------------------------------------------------
2836 // wxQTMediaBackend::QTWndProc
2838 // Forwards events to the Movie Controller so that it can
2839 // redraw itself/process messages etc..
2840 //---------------------------------------------------------------------------
2841 LRESULT CALLBACK
wxQTMediaBackend::QTWndProc(HWND hWnd
, UINT nMsg
,
2842 WPARAM wParam
, LPARAM lParam
)
2844 wxQTMediaBackend
* pThis
= (wxQTMediaBackend
*)wxGetWindowUserData(hWnd
);
2849 msg
.wParam
= wParam
;
2850 msg
.lParam
= lParam
;
2854 EventRecord theEvent
;
2855 pThis
->m_lib
.NativeEventToMacEvent(&msg
, &theEvent
);
2856 pThis
->m_lib
.MCIsPlayerEvent(pThis
->m_pMC
, &theEvent
);
2858 return pThis
->m_ctrl
->MSWWindowProc(nMsg
, wParam
, lParam
);
2861 //---------------------------------------------------------------------------
2862 // wxQTMediaBackend Destructor
2864 // Sets m_timer to NULL signifying we havn't loaded anything yet
2865 //---------------------------------------------------------------------------
2866 wxQTMediaBackend::wxQTMediaBackend()
2867 : m_movie(NULL
), m_bPlaying(false), m_timer(NULL
), m_pMC(NULL
)
2871 //---------------------------------------------------------------------------
2872 // wxQTMediaBackend Destructor
2874 // 1) Cleans up the QuickTime movie instance
2875 // 2) Decrements the QuickTime reference counter - if this reaches
2876 // 0, QuickTime shuts down
2877 // 3) Decrements the QuickTime Windows Media Layer reference counter -
2878 // if this reaches 0, QuickTime shuts down the Windows Media Layer
2879 //---------------------------------------------------------------------------
2880 wxQTMediaBackend::~wxQTMediaBackend()
2889 m_lib
.DisposeMovieController(m_pMC
);
2893 // destroy wxQTMediaEvtHandler we pushed on it
2894 m_ctrl
->PopEventHandler(true);
2896 m_lib
.DestroyPortAssociation(
2897 (CGrafPtr
)m_lib
.GetNativeWindowPort(m_ctrl
->GetHWND()));
2899 //Note that ExitMovies() is not necessary, but
2900 //the docs are fuzzy on whether or not TerminateQTML is
2902 m_lib
.TerminateQTML();
2906 //---------------------------------------------------------------------------
2907 // wxQTMediaBackend::CreateControl
2909 // 1) Intializes QuickTime
2910 // 2) Creates the control window
2911 //---------------------------------------------------------------------------
2912 bool wxQTMediaBackend::CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
2917 const wxValidator
& validator
,
2918 const wxString
& name
)
2920 if (!m_lib
.Initialize())
2923 int nError
= m_lib
.InitializeQTML(0);
2924 if (nError
!= noErr
) //-2093 no dll
2926 wxFAIL_MSG(wxString::Format(wxT("Couldn't Initialize Quicktime-%i"), nError
));
2930 m_lib
.EnterMovies();
2933 // By default wxWindow(s) is created with a border -
2934 // so we need to get rid of those
2936 // Since we don't have a child window like most other
2937 // backends, we don't need wxCLIP_CHILDREN
2939 if ( !ctrl
->wxControl::Create(parent
, id
, pos
, size
,
2940 (style
& ~wxBORDER_MASK
) | wxBORDER_NONE
,
2946 m_ctrl
= wxStaticCast(ctrl
, wxMediaCtrl
);
2948 // Create a port association for our window so we
2949 // can use it as a WindowRef
2950 m_lib
.CreatePortAssociation(m_ctrl
->GetHWND(), NULL
, 0L);
2952 // Part of a suggestion from Greg Hazel
2953 // to repaint movie when idle
2954 m_ctrl
->PushEventHandler(new wxQTMediaEvtHandler(this, m_ctrl
->GetHWND()));
2960 //---------------------------------------------------------------------------
2961 // wxQTMediaBackend::Load (file version)
2963 // 1) Get an FSSpec from the Windows path name
2964 // 2) Open the movie
2965 // 3) Obtain the movie instance from the movie resource
2966 // 4) Close the movie resource
2967 // 5) Finish loading
2968 //---------------------------------------------------------------------------
2969 bool wxQTMediaBackend::Load(const wxString
& fileName
)
2976 short movieResFile
= 0; //= 0 because of annoying VC6 warning
2979 err
= m_lib
.NativePathNameToFSSpec(
2980 (char*) (const char*) fileName
.mb_str(),
2982 result
= (err
== noErr
);
2986 err
= m_lib
.OpenMovieFile(&sfFile
, &movieResFile
, fsRdPerm
);
2987 result
= (err
== noErr
);
2992 short movieResID
= 0;
2995 err
= m_lib
.NewMovieFromFile(
3001 NULL
); // wasChanged
3002 result
= (err
== noErr
&& m_lib
.GetMoviesStickyError() == noErr
);
3004 // check m_lib.GetMoviesStickyError() because it may not find the
3005 // proper codec and play black video and other strange effects,
3006 // not to mention mess up the dynamic backend loading scheme
3007 // of wxMediaCtrl - so it just does what the QuickTime player does
3010 m_lib
.CloseMovieFile(movieResFile
);
3018 //---------------------------------------------------------------------------
3019 // wxQTMediaBackend::PPRMProc (static)
3021 // Called when done PrePrerolling the movie.
3022 // Note that in 99% of the cases this does nothing...
3023 // Anyway we set up the loading timer here to tell us when the movie is done
3024 //---------------------------------------------------------------------------
3025 void wxQTMediaBackend::PPRMProc (Movie theMovie
,
3026 OSErr
WXUNUSED_UNLESS_DEBUG(theErr
),
3029 wxASSERT( theMovie
);
3030 wxASSERT( theRefCon
);
3031 wxASSERT( theErr
== noErr
);
3033 wxQTMediaBackend
* pBE
= (wxQTMediaBackend
*) theRefCon
;
3035 long lTime
= pBE
->m_lib
.GetMovieTime(theMovie
,NULL
);
3036 Fixed rate
= pBE
->m_lib
.GetMoviePreferredRate(theMovie
);
3037 pBE
->m_lib
.PrerollMovie(theMovie
, lTime
, rate
);
3038 pBE
->m_timer
= new wxQTLoadTimer(pBE
->m_movie
, pBE
, &pBE
->m_lib
);
3039 pBE
->m_timer
->Start(MOVIE_DELAY
);
3042 //---------------------------------------------------------------------------
3043 // wxQTMediaBackend::Load (URL Version)
3045 // 1) Build an escaped URI from location
3046 // 2) Create a handle to store the URI string
3047 // 3) Put the URI string inside the handle
3048 // 4) Make a QuickTime URL data ref from the handle with the URI in it
3049 // 5) Clean up the URI string handle
3050 // 6) Do some prerolling
3051 // 7) Finish Loading
3052 //---------------------------------------------------------------------------
3053 bool wxQTMediaBackend::Load(const wxURI
& location
)
3058 wxString theURI
= location
.BuildURI();
3060 Handle theHandle
= m_lib
.NewHandleClear(theURI
.length() + 1);
3061 wxASSERT(theHandle
);
3063 m_lib
.BlockMove(theURI
.mb_str(), *theHandle
, theURI
.length() + 1);
3065 // create the movie from the handle that refers to the URI
3066 OSErr err
= m_lib
.NewMovieFromDataRef(&m_movie
, newMovieActive
|
3068 /*|newMovieIdleImportOK*/,
3070 URLDataHandlerSubType
);
3072 m_lib
.DisposeHandle(theHandle
);
3079 timeNow
= m_lib
.GetMovieTime(m_movie
, NULL
);
3080 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3082 playRate
= m_lib
.GetMoviePreferredRate(m_movie
);
3083 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3085 // Note that the callback here is optional,
3086 // but without it PrePrerollMovie can be buggy
3087 // (see Apple ml). Also, some may wonder
3088 // why we need this at all - this is because
3089 // Apple docs say QuickTime streamed movies
3090 // require it if you don't use a Movie Controller,
3091 // which we don't by default.
3093 m_lib
.PrePrerollMovie(m_movie
, timeNow
, playRate
,
3094 (WXFARPROC
)wxQTMediaBackend::PPRMProc
,
3103 //---------------------------------------------------------------------------
3104 // wxQTMediaBackend::FinishLoad
3106 // 1) Create the movie timer
3107 // 2) Get real size of movie for GetBestSize/sizers
3108 // 3) Set the movie time scale to something usable so that seeking
3109 // etc. will work correctly
3110 // 4) Set our Movie Controller to display the movie if it exists,
3111 // otherwise set the bounds of the Movie
3112 // 5) Refresh parent window
3113 //---------------------------------------------------------------------------
3114 void wxQTMediaBackend::FinishLoad()
3116 // Create the playing/streaming timer
3117 m_timer
= new wxQTPlayTimer(m_movie
, (wxQTMediaBackend
*) this, &m_lib
);
3120 m_timer
->Start(MOVIE_DELAY
, wxTIMER_CONTINUOUS
);
3122 // get the real size of the movie
3124 memset(&outRect
, 0, sizeof(Rect
)); // suppress annoying VC6 warning
3125 m_lib
.GetMovieNaturalBoundsRect (m_movie
, &outRect
);
3126 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3128 m_bestSize
.x
= outRect
.right
- outRect
.left
;
3129 m_bestSize
.y
= outRect
.bottom
- outRect
.top
;
3131 // Handle the movie GWorld
3135 thePoint
.h
= thePoint
.v
= 0;
3136 m_lib
.MCSetMovie(m_pMC
, m_movie
,
3137 m_lib
.GetNativeWindowPort(m_ctrl
->GetHandle()),
3139 m_lib
.MCSetVisible(m_pMC
, true);
3144 m_lib
.SetMovieGWorld(m_movie
,
3145 (CGrafPtr
) m_lib
.GetNativeWindowPort(m_ctrl
->GetHWND()),
3149 // Set the movie to millisecond precision
3150 m_lib
.SetMovieTimeScale(m_movie
, 1000);
3151 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3153 NotifyMovieLoaded();
3156 //---------------------------------------------------------------------------
3157 // wxQTMediaBackend::Play
3159 // 1) Start the QT movie
3160 // 2) Start the movie loading timer
3162 // NOTE: This will still return success even when
3163 // the movie is still loading, and as mentioned in wxQTLoadTimer
3164 // I don't know of a way to force this to be sync - so if its
3165 // still loading the function will return true but the movie will
3166 // still be in the stopped state
3167 //---------------------------------------------------------------------------
3168 bool wxQTMediaBackend::Play()
3170 m_lib
.StartMovie(m_movie
);
3173 return m_lib
.GetMoviesError() == noErr
;
3176 //---------------------------------------------------------------------------
3177 // wxQTMediaBackend::Pause
3179 // 1) Stop the movie
3180 // 2) Stop the movie timer
3181 //---------------------------------------------------------------------------
3182 bool wxQTMediaBackend::Pause()
3185 m_lib
.StopMovie(m_movie
);
3187 return m_lib
.GetMoviesError() == noErr
;
3190 //---------------------------------------------------------------------------
3191 // wxQTMediaBackend::Stop
3193 // 1) Stop the movie
3194 // 2) Stop the movie timer
3195 // 3) Seek to the beginning of the movie
3196 //---------------------------------------------------------------------------
3197 bool wxQTMediaBackend::Stop()
3201 m_lib
.StopMovie(m_movie
);
3202 if (m_lib
.GetMoviesError() == noErr
)
3203 m_lib
.GoToBeginningOfMovie(m_movie
);
3205 return m_lib
.GetMoviesError() == noErr
;
3208 //---------------------------------------------------------------------------
3209 // wxQTMediaBackend::GetPlaybackRate
3211 // Get the movie playback rate from ::GetMovieRate
3212 //---------------------------------------------------------------------------
3213 double wxQTMediaBackend::GetPlaybackRate()
3215 return ( ((double)m_lib
.GetMovieRate(m_movie
)) / 0x10000);
3218 //---------------------------------------------------------------------------
3219 // wxQTMediaBackend::SetPlaybackRate
3221 // Convert dRate to Fixed and Set the movie rate through SetMovieRate
3222 //---------------------------------------------------------------------------
3223 bool wxQTMediaBackend::SetPlaybackRate(double dRate
)
3225 m_lib
.SetMovieRate(m_movie
, (Fixed
) (dRate
* 0x10000));
3227 return m_lib
.GetMoviesError() == noErr
;
3230 //---------------------------------------------------------------------------
3231 // wxQTMediaBackend::SetPosition
3233 // 1) Create a time record struct (TimeRecord) with appropriate values
3234 // 2) Pass struct to SetMovieTime
3235 //---------------------------------------------------------------------------
3236 bool wxQTMediaBackend::SetPosition(wxLongLong where
)
3238 // NB: For some reason SetMovieTime does not work
3239 // correctly with the Quicktime Windows SDK (6)
3240 // From Muskelkatermann at the wxForum
3241 // http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=2957
3242 // RN - note that I have not verified this but there
3243 // is no harm in calling SetMovieTimeValue instead
3245 TimeRecord theTimeRecord
;
3246 memset(&theTimeRecord
, 0, sizeof(TimeRecord
));
3247 theTimeRecord
.value
.lo
= where
.GetLo();
3248 theTimeRecord
.scale
= m_lib
.GetMovieTimeScale(m_movie
);
3249 theTimeRecord
.base
= m_lib
.GetMovieTimeBase(m_movie
);
3250 m_lib
.SetMovieTime(m_movie
, &theTimeRecord
);
3252 m_lib
.SetMovieTimeValue(m_movie
, where
.GetLo());
3255 return (m_lib
.GetMoviesError() == noErr
);
3258 //---------------------------------------------------------------------------
3259 // wxQTMediaBackend::GetPosition
3261 // 1) Calls GetMovieTime to get the position we are in in the movie
3262 // in milliseconds (we called
3263 //---------------------------------------------------------------------------
3264 wxLongLong
wxQTMediaBackend::GetPosition()
3266 return m_lib
.GetMovieTime(m_movie
, NULL
);
3269 //---------------------------------------------------------------------------
3270 // wxQTMediaBackend::GetVolume
3272 // Gets the volume through GetMovieVolume - which returns a 16 bit short -
3274 // +--------+--------+
3276 // +--------+--------+
3278 // (1) first 8 bits are value before decimal
3279 // (2) second 8 bits are value after decimal
3281 // Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
3282 // 1 (full gain and sound)
3283 //---------------------------------------------------------------------------
3284 double wxQTMediaBackend::GetVolume()
3286 short sVolume
= m_lib
.GetMovieVolume(m_movie
);
3287 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3289 if (sVolume
& (128 << 8)) //negative - no sound
3292 return sVolume
/ 256.0;
3295 //---------------------------------------------------------------------------
3296 // wxQTMediaBackend::SetVolume
3298 // Sets the volume through SetMovieVolume - which takes a 16 bit short -
3300 // +--------+--------+
3302 // +--------+--------+
3304 // (1) first 8 bits are value before decimal
3305 // (2) second 8 bits are value after decimal
3307 // Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
3308 // 1 (full gain and sound)
3309 //---------------------------------------------------------------------------
3310 bool wxQTMediaBackend::SetVolume(double dVolume
)
3312 m_lib
.SetMovieVolume(m_movie
, (short) (dVolume
* 256));
3313 return m_lib
.GetMoviesError() == noErr
;
3316 //---------------------------------------------------------------------------
3317 // wxQTMediaBackend::GetDuration
3319 // Calls GetMovieDuration
3320 //---------------------------------------------------------------------------
3321 wxLongLong
wxQTMediaBackend::GetDuration()
3323 return m_lib
.GetMovieDuration(m_movie
);
3326 //---------------------------------------------------------------------------
3327 // wxQTMediaBackend::GetState
3329 // Determines the current state:
3330 // if we are at the beginning, then we are stopped
3331 //---------------------------------------------------------------------------
3332 wxMediaState
wxQTMediaBackend::GetState()
3335 return wxMEDIASTATE_PLAYING
;
3336 else if ( !m_movie
|| wxQTMediaBackend::GetPosition() == 0 )
3337 return wxMEDIASTATE_STOPPED
;
3339 return wxMEDIASTATE_PAUSED
;
3342 //---------------------------------------------------------------------------
3343 // wxQTMediaBackend::Cleanup
3345 // Diposes of the movie timer, Disassociates the Movie Controller with
3346 // movie and hides it if it exists, and stops and disposes
3348 //---------------------------------------------------------------------------
3349 void wxQTMediaBackend::Cleanup()
3359 m_lib
.StopMovie(m_movie
);
3364 thePoint
.h
= thePoint
.v
= 0;
3365 m_lib
.MCSetVisible(m_pMC
, false);
3366 m_lib
.MCSetMovie(m_pMC
, NULL
, NULL
, thePoint
);
3369 m_lib
.DisposeMovie(m_movie
);
3373 //---------------------------------------------------------------------------
3374 // wxQTMediaBackend::ShowPlayerControls
3376 // Creates a movie controller for the Movie if the user wants it
3377 //---------------------------------------------------------------------------
3378 bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags
)
3382 // restore old wndproc
3383 wxSetWindowProc((HWND
)m_ctrl
->GetHWND(), wxWndProc
);
3384 m_lib
.DisposeMovieController(m_pMC
);
3387 // movie controller height
3391 if (flags
&& m_movie
)
3394 wxRect wxrect
= m_ctrl
->GetClientRect();
3396 // make room for controller
3397 if (wxrect
.width
< 320)
3400 rect
.top
= (short)wxrect
.y
;
3401 rect
.left
= (short)wxrect
.x
;
3402 rect
.right
= (short)(rect
.left
+ wxrect
.width
);
3403 rect
.bottom
= (short)(rect
.top
+ wxrect
.height
);
3407 m_pMC
= m_lib
.NewMovieController(m_movie
, &rect
, mcTopLeftMovie
|
3408 // mcScaleMovieToFit |
3411 m_lib
.MCDoAction(m_pMC
, 32, (void*)true); //mcActionSetKeysEnabled
3412 m_lib
.MCSetActionFilterWithRefCon(m_pMC
,
3413 (WXFARPROC
)wxQTMediaBackend::MCFilterProc
, (void*)this);
3414 m_bestSize
.y
+= 16; // movie controller height
3416 // By default the movie controller uses its own colour palette
3417 // for the movie which can be bad on some files, so turn it off.
3418 // Also turn off its frame/border for the movie
3419 // Also take care of a couple of the interface flags here
3421 m_lib
.MCDoAction(m_pMC
, 39/*mcActionGetFlags*/, (void*)&mcFlags
);
3424 // (1<< 0) /*mcFlagSuppressMovieFrame*/ |
3425 (1<< 3) /*mcFlagsUseWindowPalette*/
3426 | ((flags
& wxMEDIACTRLPLAYERCONTROLS_STEP
)
3427 ? 0 : (1<< 1) /*mcFlagSuppressStepButtons*/)
3428 | ((flags
& wxMEDIACTRLPLAYERCONTROLS_VOLUME
)
3429 ? 0 : (1<< 2) /*mcFlagSuppressSpeakerButton*/)
3430 // | (1<< 4) /*mcFlagDontInvalidate*/ // if we take care of repainting ourselves
3433 m_lib
.MCDoAction(m_pMC
, 38/*mcActionSetFlags*/, (void*)mcFlags
);
3435 // intercept the wndproc of our control window
3436 wxSetWindowProc((HWND
)m_ctrl
->GetHWND(), wxQTMediaBackend::QTWndProc
);
3438 // set the user data of our window
3439 wxSetWindowUserData((HWND
)m_ctrl
->GetHWND(), this);
3443 NotifyMovieSizeChanged();
3445 return m_lib
.GetMoviesError() == noErr
;
3448 //---------------------------------------------------------------------------
3449 // wxQTMediaBackend::MCFilterProc (static)
3451 // Callback for when the movie controller recieves a message
3452 //---------------------------------------------------------------------------
3453 Boolean
wxQTMediaBackend::MCFilterProc(MovieController
WXUNUSED(theController
),
3455 void * WXUNUSED(params
),
3458 wxQTMediaBackend
* pThis
= (wxQTMediaBackend
*)refCon
;
3463 // play button triggered - MC will set movie to opposite state
3464 // of current - playing ? paused : playing
3466 pThis
->m_bPlaying
= !(pThis
->m_bPlaying
);
3468 // NB: Sometimes it doesn't redraw properly -
3469 // if you click on the button but don't move the mouse
3470 // the button will not change its state until you move
3471 // mcActionDraw and Refresh/Update combo do nothing
3472 // to help this unfortunately
3476 // don't process idle events
3486 //---------------------------------------------------------------------------
3487 // wxQTMediaBackend::GetVideoSize
3489 // Returns the actual size of the QT movie
3490 //---------------------------------------------------------------------------
3491 wxSize
wxQTMediaBackend::GetVideoSize() const
3496 //---------------------------------------------------------------------------
3497 // wxQTMediaBackend::Move
3499 // Sets the bounds of either the Movie or Movie Controller
3500 //---------------------------------------------------------------------------
3501 void wxQTMediaBackend::Move(int WXUNUSED(x
), int WXUNUSED(y
), int w
, int h
)
3505 // make room for controller
3511 Rect theRect
= {0, 0, (short)h
, (short)w
};
3512 m_lib
.MCSetControllerBoundsRect(m_pMC
, &theRect
);
3516 Rect theRect
= {0, 0, (short)h
, (short)w
};
3517 m_lib
.SetMovieBox(m_movie
, &theRect
);
3520 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3524 //---------------------------------------------------------------------------
3525 // wxQTMediaBackend::OnEraseBackground
3527 // Suggestion from Greg Hazel to repaint the movie when idle
3530 // TODO: We may be repainting too much here - under what exact circumstances
3531 // do we need this? I think Move also repaints correctly for the Movie
3532 // Controller, so in that instance we don't need this either
3533 //---------------------------------------------------------------------------
3534 void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent
& evt
)
3536 wxQuickTimeLibrary
& m_pLib
= m_qtb
->m_lib
;
3540 // repaint movie controller
3541 m_pLib
.MCDoAction(m_qtb
->m_pMC
, 2 /*mcActionDraw*/,
3542 m_pLib
.GetNativeWindowPort(m_hwnd
));
3544 else if ( m_qtb
->m_movie
)
3546 // no movie controller
3547 CGrafPtr port
= (CGrafPtr
)m_pLib
.GetNativeWindowPort(m_hwnd
);
3549 m_pLib
.BeginUpdate(port
);
3550 m_pLib
.UpdateMovie(m_qtb
->m_movie
);
3551 wxASSERT(m_pLib
.GetMoviesError() == noErr
);
3552 m_pLib
.EndUpdate(port
);
3557 // let the system repaint the window
3562 //---------------------------------------------------------------------------
3564 //---------------------------------------------------------------------------
3566 //in source file that contains stuff you don't directly use
3567 #include "wx/html/forcelnk.h"
3568 FORCE_LINK_ME(basewxmediabackends
)
3570 //---------------------------------------------------------------------------
3571 // End wxMediaCtrl Compilation Guard and this file
3572 //---------------------------------------------------------------------------
3573 #endif //wxUSE_MEDIACTRL