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
);
1570 // DirectShow keeps a list of queued events, and we need
1571 // to go through them one by one, stopping at (Hopefully only one)
1572 // EC_COMPLETE message
1574 while( m_pME
->GetEvent(&evCode
, &evParam1
, &evParam2
, 0) == 0 )
1576 // Cleanup memory that GetEvent allocated
1577 HRESULT hr
= m_pME
->FreeEventParams(evCode
,
1578 evParam1
, evParam2
);
1581 // Even though this makes a messagebox this
1582 // is windows where we can do gui stuff in seperate
1584 wxFAIL_MSG(m_pBE
->GetErrorString(hr
));
1586 // If this is the end of the clip, notify handler
1587 else if (1 == evCode
) // EC_COMPLETE
1589 if ( m_pBE
->SendStopEvent() )
1593 m_pBE
->QueueFinishEvent();
1600 wxAMMediaBackend
* m_pBE
; // Backend pointer
1601 IMediaEvent
* m_pME
; // To determine when to send stop event
1605 //---------------------------------------------------------------------------
1606 // wxAMMediaBackend Constructor
1607 //---------------------------------------------------------------------------
1608 wxAMMediaBackend::wxAMMediaBackend()
1616 //---------------------------------------------------------------------------
1617 // wxAMMediaBackend Destructor
1618 //---------------------------------------------------------------------------
1619 wxAMMediaBackend::~wxAMMediaBackend()
1621 Clear(); //Free memory from Load()
1625 m_pAX
->DissociateHandle();
1634 //---------------------------------------------------------------------------
1635 // wxAMMediaBackend::Clear
1637 // Free up interfaces and memory allocated by LoadXXX
1638 //---------------------------------------------------------------------------
1639 void wxAMMediaBackend::Clear()
1648 //---------------------------------------------------------------------------
1649 // wxAMMediaBackend::CreateControl
1650 //---------------------------------------------------------------------------
1651 bool wxAMMediaBackend::CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
1656 const wxValidator
& validator
,
1657 const wxString
& name
)
1659 // First get the AMGetErrorText procedure in debug
1660 // mode for more meaningful messages
1662 if ( m_dllQuartz
.Load(_T("quartz.dll"), wxDL_VERBATIM
) )
1664 m_lpAMGetErrorText
= (LPAMGETERRORTEXT
)
1665 m_dllQuartz
.GetSymbolAorW(wxT("AMGetErrorText"));
1669 // Now determine which (if any) media player interface is
1670 // available - IMediaPlayer or IActiveMovie
1671 if ( ::CoCreateInstance(CLSID_MediaPlayer
, NULL
,
1672 CLSCTX_INPROC_SERVER
,
1673 IID_IMediaPlayer
, (void**)&m_pMP
) != 0 )
1675 if ( ::CoCreateInstance(CLSID_ActiveMovie
, NULL
,
1676 CLSCTX_INPROC_SERVER
,
1677 IID_IActiveMovie
, (void**)&m_pAM
) != 0 )
1679 m_pAM
->QueryInterface(IID_IMediaPlayer
, (void**)&m_pMP
);
1683 m_pMP
->QueryInterface(IID_IActiveMovie
, (void**)&m_pAM
);
1688 // By default wxWindow(s) is created with a border -
1689 // so we need to get rid of those
1691 // Since we don't have a child window like most other
1692 // backends, we don't need wxCLIP_CHILDREN
1694 if ( !ctrl
->wxControl::Create(parent
, id
, pos
, size
,
1695 (style
& ~wxBORDER_MASK
) | wxBORDER_NONE
,
1699 // Now create the ActiveX container along with the media player
1700 // interface and query them
1702 m_ctrl
= wxStaticCast(ctrl
, wxMediaCtrl
);
1703 m_pAX
= new wxActiveXContainer(ctrl
,
1704 m_pMP
? IID_IMediaPlayer
: IID_IActiveMovie
,
1707 // Here we set up wx-specific stuff for the default
1708 // settings wxMediaCtrl says it will stay to
1712 m_pMP
->put_DisplaySize(mpFitToSize
);
1714 // TODO: Unsure what actual effect this has
1715 m_pMP
->put_WindowlessVideo(VARIANT_TRUE
);
1718 m_pAM
->put_MovieWindowSize(amvDoubleOriginalSize
);
1721 m_pAM
->put_AutoStart(VARIANT_FALSE
);
1723 // by default enabled
1724 wxAMMediaBackend::ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_NONE
);
1726 // by default with AM only 0.5
1727 wxAMMediaBackend::SetVolume(1.0);
1729 // don't erase the background of our control window
1730 // so that resizing is a bit smoother
1731 m_ctrl
->SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
1737 //---------------------------------------------------------------------------
1738 // wxAMMediaBackend::Load (file version)
1739 //---------------------------------------------------------------------------
1740 bool wxAMMediaBackend::Load(const wxString
& fileName
)
1742 return DoLoad(fileName
);
1745 //---------------------------------------------------------------------------
1746 // wxAMMediaBackend::Load (URL Version)
1747 //---------------------------------------------------------------------------
1748 bool wxAMMediaBackend::Load(const wxURI
& location
)
1750 // Turn off loading from a proxy as user
1751 // may have set it previously
1752 INSPlay
* pPlay
= NULL
;
1753 m_pAM
->QueryInterface(IID_INSPlay
, (void**) &pPlay
);
1756 pPlay
->put_UseHTTPProxy(VARIANT_FALSE
);
1760 return DoLoad(location
.BuildURI());
1763 //---------------------------------------------------------------------------
1764 // wxAMMediaBackend::Load (URL Version with Proxy)
1765 //---------------------------------------------------------------------------
1766 bool wxAMMediaBackend::Load(const wxURI
& location
, const wxURI
& proxy
)
1768 // Set the proxy of the NETSHOW interface
1769 INSPlay
* pPlay
= NULL
;
1770 m_pAM
->QueryInterface(IID_INSPlay
, (void**) &pPlay
);
1774 pPlay
->put_UseHTTPProxy(VARIANT_TRUE
);
1775 pPlay
->put_HTTPProxyHost(wxBasicString(proxy
.GetServer()).Get());
1776 pPlay
->put_HTTPProxyPort(wxAtoi(proxy
.GetPort()));
1780 return DoLoad(location
.BuildURI());
1783 //---------------------------------------------------------------------------
1784 // wxAMMediaBackend::DoLoad
1786 // Called by all functions - this actually renders
1787 // the file and sets up the filter graph
1788 //---------------------------------------------------------------------------
1789 bool wxAMMediaBackend::DoLoad(const wxString
& location
)
1791 Clear(); //Clear up previously allocated memory
1795 // Play the movie the normal way through the embedded
1796 // WMP. Supposively Open is better in theory because
1797 // the docs say its async and put_FileName is not -
1798 // but in practice they both seem to be async anyway
1800 hr
= m_pMP
->Open( wxBasicString(location
).Get() );
1802 hr
= m_pAM
->put_FileName( wxBasicString(location
).Get() );
1810 // In AM playing will FAIL if
1811 // the user plays before the media is loaded
1812 m_pTimer
= new wxAMLoadTimer(this);
1813 m_pTimer
->Start(20);
1818 //---------------------------------------------------------------------------
1819 // wxAMMediaBackend::FinishLoad
1821 // Called by our wxAMLoadTimer when the
1822 // embedded WMP tells its the media is ready to play.
1824 // Here we get the original size of the video and
1825 // send the loaded event to our watcher :).
1826 //---------------------------------------------------------------------------
1827 void wxAMMediaBackend::FinishLoad()
1829 //Get the original video size
1830 m_pAM
->get_ImageSourceWidth((long*)&m_bestSize
.x
);
1831 m_pAM
->get_ImageSourceHeight((long*)&m_bestSize
.y
);
1834 //Start the play timer to catch stop events
1835 //Previous load timer cleans up itself
1837 m_pTimer
= new wxAMPlayTimer(this);
1839 NotifyMovieLoaded();
1842 //---------------------------------------------------------------------------
1843 // wxAMMediaBackend::ShowPlayerControls
1844 //---------------------------------------------------------------------------
1845 bool wxAMMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags
)
1847 // Note that IMediaPlayer doesn't have a statusbar by
1848 // default but IActiveMovie does - so lets try to keep
1849 // the interface consistant
1852 m_pAM
->put_Enabled(VARIANT_FALSE
);
1853 m_pAM
->put_ShowControls(VARIANT_FALSE
);
1855 m_pMP
->put_ShowStatusBar(VARIANT_FALSE
);
1859 m_pAM
->put_Enabled(VARIANT_TRUE
);
1860 m_pAM
->put_ShowControls(VARIANT_TRUE
);
1862 m_pAM
->put_ShowPositionControls(
1863 (flags
& wxMEDIACTRLPLAYERCONTROLS_STEP
) ?
1864 VARIANT_TRUE
: VARIANT_FALSE
);
1868 m_pMP
->put_ShowStatusBar(VARIANT_TRUE
);
1869 m_pMP
->put_ShowAudioControls(
1870 (flags
& wxMEDIACTRLPLAYERCONTROLS_VOLUME
) ?
1871 VARIANT_TRUE
: VARIANT_FALSE
);
1878 //---------------------------------------------------------------------------
1879 // wxAMMediaBackend::Play
1881 // Plays the stream. If it is non-seekable, it will restart it (implicit).
1883 // Note that we use SUCCEEDED here because run/pause/stop tend to be overly
1884 // picky and return warnings on pretty much every call
1885 //---------------------------------------------------------------------------
1886 bool wxAMMediaBackend::Play()
1888 // Actually try to play the movie, even though it may not be loaded yet.
1889 HRESULT hr
= m_pAM
->Run();
1892 m_pTimer
->Start(20);
1901 //---------------------------------------------------------------------------
1902 // wxAMMediaBackend::Pause
1904 // Pauses the stream.
1905 //---------------------------------------------------------------------------
1906 bool wxAMMediaBackend::Pause()
1908 HRESULT hr
= m_pAM
->Pause();
1917 //---------------------------------------------------------------------------
1918 // wxAMMediaBackend::Stop
1920 // Stops the stream.
1921 //---------------------------------------------------------------------------
1922 bool wxAMMediaBackend::Stop()
1924 HRESULT hr
= m_pAM
->Stop();
1927 // Seek to beginning
1928 wxAMMediaBackend::SetPosition(0);
1930 // Stop stop event timer
1940 //---------------------------------------------------------------------------
1941 // wxAMMediaBackend::SetPosition
1943 // 1) Translates the current position's time to directshow time,
1944 // which is in a scale of 1 second (in a double)
1945 // 2) Sets the play position of the IMediaSeeking interface -
1946 // passing NULL as the stop position means to keep the old
1948 //---------------------------------------------------------------------------
1949 bool wxAMMediaBackend::SetPosition(wxLongLong where
)
1951 HRESULT hr
= m_pAM
->put_CurrentPosition(
1952 ((LONGLONG
)where
.GetValue()) / 1000.0
1963 //---------------------------------------------------------------------------
1964 // wxAMMediaBackend::GetPosition
1966 // 1) Obtains the current play and stop positions from IMediaSeeking
1967 // 2) Returns the play position translated to our time base
1968 //---------------------------------------------------------------------------
1969 wxLongLong
wxAMMediaBackend::GetPosition()
1972 HRESULT hr
= m_pAM
->get_CurrentPosition(&outCur
);
1979 // h,m,s,milli - outdur is in 1 second (double)
1987 //---------------------------------------------------------------------------
1988 // wxAMMediaBackend::GetVolume
1990 // Gets the volume through the IBasicAudio interface -
1991 // value ranges from 0 (MAX volume) to -10000 (minimum volume).
1992 // -100 per decibel.
1993 //---------------------------------------------------------------------------
1994 double wxAMMediaBackend::GetVolume()
1997 HRESULT hr
= m_pAM
->get_Volume(&lVolume
);
2004 return pow(10.0, lVolume
/ 2000.0);
2007 //---------------------------------------------------------------------------
2008 // wxAMMediaBackend::SetVolume
2010 // Sets the volume through the IBasicAudio interface -
2011 // value ranges from 0 (MAX volume) to -10000 (minimum volume).
2012 // -100 per decibel.
2013 //---------------------------------------------------------------------------
2014 bool wxAMMediaBackend::SetVolume(double dVolume
)
2016 // pow(10.0, -80.0) to correct 0 == -INF
2017 long lVolume
= (long)(2000.0 * log10( pow( 10.0, -80.0) + dVolume
) );
2018 HRESULT hr
= m_pAM
->put_Volume( lVolume
);
2028 //---------------------------------------------------------------------------
2029 // wxAMMediaBackend::GetDuration
2031 // 1) Obtains the duration of the media from IAMMultiMediaStream
2032 // 2) Converts that value to our time base, and returns it
2034 // NB: With VBR MP3 files the default DirectShow MP3 render does not
2035 // read the Xing header correctly, resulting in skewed values for duration
2037 //---------------------------------------------------------------------------
2038 wxLongLong
wxAMMediaBackend::GetDuration()
2041 HRESULT hr
= m_pAM
->get_Duration(&outDuration
);
2048 // h,m,s,milli - outdur is in 1 second (double)
2049 outDuration
*= 1000;
2051 ll
.Assign(outDuration
);
2056 //---------------------------------------------------------------------------
2057 // wxAMMediaBackend::GetState
2059 // Returns the cached state
2060 //---------------------------------------------------------------------------
2061 wxMediaState
wxAMMediaBackend::GetState()
2063 StateConstants nState
;
2064 HRESULT hr
= m_pAM
->get_CurrentState(&nState
);
2068 return wxMEDIASTATE_STOPPED
;
2071 return (wxMediaState
)nState
;
2074 //---------------------------------------------------------------------------
2075 // wxAMMediaBackend::GetPlaybackRate
2077 // Pretty simple way of obtaining the playback rate from
2078 // the IMediaSeeking interface
2079 //---------------------------------------------------------------------------
2080 double wxAMMediaBackend::GetPlaybackRate()
2083 HRESULT hr
= m_pAM
->get_Rate(&dRate
);
2093 //---------------------------------------------------------------------------
2094 // wxAMMediaBackend::SetPlaybackRate
2096 // Sets the playback rate of the media - DirectShow is pretty good
2097 // about this, actually
2098 //---------------------------------------------------------------------------
2099 bool wxAMMediaBackend::SetPlaybackRate(double dRate
)
2101 HRESULT hr
= m_pAM
->put_Rate(dRate
);
2111 //---------------------------------------------------------------------------
2112 // wxAMMediaBackend::GetDownloadXXX
2114 // Queries for and gets the total size of the file and the current
2115 // progress in downloading that file from the IAMOpenProgress
2116 // interface from the media player interface's filter graph
2117 //---------------------------------------------------------------------------
2118 void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong
* pLoadProgress
,
2119 wxLongLong
* pLoadTotal
)
2121 LONGLONG loadTotal
= 0, loadProgress
= 0;
2123 IAMOpenProgress
* pOP
;
2125 hr
= m_pAM
->get_FilterGraph(&pFG
);
2128 hr
= pFG
->QueryInterface(IID_IAMOpenProgress
, (void**)&pOP
);
2131 hr
= pOP
->QueryProgress(&loadTotal
, &loadProgress
);
2140 *pLoadProgress
= loadProgress
;
2141 *pLoadTotal
= loadTotal
;
2145 // When not loading from a URL QueryProgress will return
2146 // E_NOINTERFACE or whatever
2153 //---------------------------------------------------------------------------
2154 // wxAMMediaBackend::GetVideoSize
2156 // Obtains the cached original video size
2157 //---------------------------------------------------------------------------
2158 wxSize
wxAMMediaBackend::GetVideoSize() const
2163 //---------------------------------------------------------------------------
2164 // wxAMMediaBackend::Move
2166 // We take care of this in our redrawing
2167 //---------------------------------------------------------------------------
2168 void wxAMMediaBackend::Move(int WXUNUSED(x
), int WXUNUSED(y
),
2169 int WXUNUSED(w
), int WXUNUSED(h
))
2173 //---------------------------------------------------------------------------
2174 // End of wxAMMediaBackend
2175 //---------------------------------------------------------------------------
2177 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2179 // wxMCIMediaBackend
2181 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2184 IMPLEMENT_DYNAMIC_CLASS(wxMCIMediaBackend
, wxMediaBackend
)
2186 //---------------------------------------------------------------------------
2187 // Usual debugging macros for MCI returns
2188 //---------------------------------------------------------------------------
2191 #define wxMCIVERIFY(arg) \
2194 if ( (nRet = (arg)) != 0) \
2197 mciGetErrorString(nRet, sz, 5000); \
2198 wxFAIL_MSG(wxString::Format(_T("MCI Error:%s"), sz)); \
2202 #define wxMCIVERIFY(arg) (arg);
2205 //---------------------------------------------------------------------------
2206 // Simulation for <digitalv.h>
2208 // Mingw and possibly other compilers don't have the digitalv.h header
2209 // that is needed to have some essential features of mci work with
2210 // windows - so we provide the declarations for the types we use here
2211 //---------------------------------------------------------------------------
2215 DWORD_PTR dwCallback
;
2216 #ifdef MCI_USE_OFFEXT
2227 DWORD_PTR dwCallback
;
2238 MCI_DGV_WINDOW_PARMS
;
2242 DWORD_PTR dwCallback
;
2252 DWORD_PTR dwCallback
;
2256 wxChar
* lpstrAlgorithm
;
2257 wxChar
* lpstrQuality
;
2259 MCI_DGV_SETAUDIO_PARMS
;
2261 //---------------------------------------------------------------------------
2262 // wxMCIMediaBackend Constructor
2264 // Here we don't need to do much except say we don't have any video :)
2265 //---------------------------------------------------------------------------
2266 wxMCIMediaBackend::wxMCIMediaBackend() : m_hNotifyWnd(NULL
), m_bVideo(false)
2270 //---------------------------------------------------------------------------
2271 // wxMCIMediaBackend Destructor
2273 // We close the mci device - note that there may not be an mci device here,
2274 // or it may fail - but we don't really care, since we're destructing
2275 //---------------------------------------------------------------------------
2276 wxMCIMediaBackend::~wxMCIMediaBackend()
2280 mciSendCommand(m_hDev
, MCI_CLOSE
, 0, 0);
2281 DestroyWindow(m_hNotifyWnd
);
2282 m_hNotifyWnd
= NULL
;
2286 //---------------------------------------------------------------------------
2287 // wxMCIMediaBackend::Create
2289 // Here we just tell wxMediaCtrl that mci does exist (which it does, on all
2290 // msw systems, at least in some form dating back to win16 days)
2291 //---------------------------------------------------------------------------
2292 bool wxMCIMediaBackend::CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
2297 const wxValidator
& validator
,
2298 const wxString
& name
)
2301 // By default wxWindow(s) is created with a border -
2302 // so we need to get rid of those, and create with
2303 // wxCLIP_CHILDREN, so that if the driver/backend
2304 // is a child window, it refereshes properly
2305 if ( !ctrl
->wxControl::Create(parent
, id
, pos
, size
,
2306 (style
& ~wxBORDER_MASK
) | wxBORDER_NONE
| wxCLIP_CHILDREN
,
2310 m_ctrl
= wxStaticCast(ctrl
, wxMediaCtrl
);
2315 //---------------------------------------------------------------------------
2316 // wxMCIMediaBackend::Load (file version)
2318 // Here we have MCI load a file and device, set the time format to our
2319 // default (milliseconds), and set the video (if any) to play in the control
2320 //---------------------------------------------------------------------------
2321 bool wxMCIMediaBackend::Load(const wxString
& fileName
)
2323 // if the user already called load close the previous MCI device
2326 mciSendCommand(m_hDev
, MCI_CLOSE
, 0, 0);
2327 DestroyWindow(m_hNotifyWnd
);
2328 m_hNotifyWnd
= NULL
;
2331 // Opens a file and has MCI select a device. Normally you'd put
2332 // MCI_OPEN_TYPE in addition to MCI_OPEN_ELEMENT - however if you
2333 // omit this it tells MCI to select the device instead. This is good
2334 // because we have no reliable way of "enumerating" the devices in MCI
2335 MCI_OPEN_PARMS openParms
;
2336 openParms
.lpstrElementName
= (wxChar
*) fileName
.c_str();
2338 if ( mciSendCommand(0, MCI_OPEN
, MCI_OPEN_ELEMENT
,
2339 (DWORD
)(LPVOID
)&openParms
) != 0)
2342 m_hDev
= openParms
.wDeviceID
;
2344 // set the time format for the device to milliseconds
2345 MCI_SET_PARMS setParms
;
2346 setParms
.dwCallback
= 0;
2347 setParms
.dwTimeFormat
= MCI_FORMAT_MILLISECONDS
;
2349 if (mciSendCommand(m_hDev
, MCI_SET
, MCI_SET_TIME_FORMAT
,
2350 (DWORD
)(LPVOID
)&setParms
) != 0)
2355 // tell the MCI device to display the video in our wxMediaCtrl
2356 MCI_DGV_WINDOW_PARMS windowParms
;
2357 windowParms
.hWnd
= (HWND
)m_ctrl
->GetHandle();
2359 m_bVideo
= (mciSendCommand(m_hDev
, MCI_WINDOW
,
2360 0x00010000L
, // MCI_DGV_WINDOW_HWND
2361 (DWORD
)(LPVOID
)&windowParms
) == 0);
2363 // Create a hidden window and register to handle MCI events
2364 // Note that wxCanvasClassName is already registered
2365 // and used by all wxWindows and normal wxControls
2366 m_hNotifyWnd
= ::CreateWindow(
2378 wxLogSysError( wxT("Could not create hidden needed for ")
2379 wxT("registering for MCI events!") );
2384 wxSetWindowProc(m_hNotifyWnd
, wxMCIMediaBackend::NotifyWndProc
);
2385 wxSetWindowUserData(m_hNotifyWnd
, this);
2387 NotifyMovieLoaded();
2392 //---------------------------------------------------------------------------
2393 // wxMCIMediaBackend::Load (URL version)
2395 // MCI doesn't support URLs directly (?)
2397 // TODO: Use wxURL/wxFileSystem and mmioInstallProc
2398 //---------------------------------------------------------------------------
2399 bool wxMCIMediaBackend::Load(const wxURI
& WXUNUSED(location
))
2404 //---------------------------------------------------------------------------
2405 // wxMCIMediaBackend::Play
2407 // Plays/Resumes the MCI device... a couple notes:
2408 // 1) Certain drivers will crash and burn if we don't pass them an
2409 // MCI_PLAY_PARMS, despite the documentation that says otherwise...
2410 // 2) There is a MCI_RESUME command, but MCI_PLAY does the same thing
2411 // and will resume from a stopped state also, so there's no need to
2412 // call both, for example
2413 //---------------------------------------------------------------------------
2414 bool wxMCIMediaBackend::Play()
2416 MCI_PLAY_PARMS playParms
;
2417 playParms
.dwCallback
= (DWORD
)m_hNotifyWnd
;
2419 bool bOK
= ( mciSendCommand(m_hDev
, MCI_PLAY
, MCI_NOTIFY
,
2420 (DWORD
)(LPVOID
)&playParms
) == 0 );
2423 m_ctrl
->Show(m_bVideo
);
2428 //---------------------------------------------------------------------------
2429 // wxMCIMediaBackend::Pause
2431 // Pauses the MCI device - nothing special
2432 //---------------------------------------------------------------------------
2433 bool wxMCIMediaBackend::Pause()
2435 return (mciSendCommand(m_hDev
, MCI_PAUSE
, MCI_WAIT
, 0) == 0);
2438 //---------------------------------------------------------------------------
2439 // wxMCIMediaBackend::Stop
2441 // Stops the MCI device & seeks to the beginning as wxMediaCtrl docs outline
2442 //---------------------------------------------------------------------------
2443 bool wxMCIMediaBackend::Stop()
2445 return (mciSendCommand(m_hDev
, MCI_STOP
, MCI_WAIT
, 0) == 0) &&
2446 (mciSendCommand(m_hDev
, MCI_SEEK
, MCI_SEEK_TO_START
, 0) == 0);
2449 //---------------------------------------------------------------------------
2450 // wxMCIMediaBackend::GetState
2452 // Here we get the state and convert it to a wxMediaState -
2453 // since we use direct comparisons with MCI_MODE_PLAY and
2454 // MCI_MODE_PAUSE, we don't care if the MCI_STATUS call
2456 //---------------------------------------------------------------------------
2457 wxMediaState
wxMCIMediaBackend::GetState()
2459 MCI_STATUS_PARMS statusParms
;
2460 statusParms
.dwItem
= MCI_STATUS_MODE
;
2462 mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2463 (DWORD
)(LPVOID
)&statusParms
);
2465 if (statusParms
.dwReturn
== MCI_MODE_PAUSE
)
2466 return wxMEDIASTATE_PAUSED
;
2467 else if (statusParms
.dwReturn
== MCI_MODE_PLAY
)
2468 return wxMEDIASTATE_PLAYING
;
2470 return wxMEDIASTATE_STOPPED
;
2473 //---------------------------------------------------------------------------
2474 // wxMCIMediaBackend::SetPosition
2476 // Here we set the position of the device in the stream.
2477 // Note that MCI actually stops the device after you seek it if the
2478 // device is playing/paused, so we need to play the file after
2479 // MCI seeks like normal APIs would
2480 //---------------------------------------------------------------------------
2481 bool wxMCIMediaBackend::SetPosition(wxLongLong where
)
2483 MCI_SEEK_PARMS seekParms
;
2484 seekParms
.dwCallback
= 0;
2486 #if wxUSE_LONGLONG_NATIVE && !wxUSE_LONGLONG_WX
2487 seekParms
.dwTo
= (DWORD
)where
.GetValue();
2488 #else // wxUSE_LONGLONG_WX
2489 // no way to return it in one piece
2490 wxASSERT( where
.GetHi() == 0 );
2491 seekParms
.dwTo
= (DWORD
)where
.GetLo();
2494 // device was playing?
2495 bool bReplay
= GetState() == wxMEDIASTATE_PLAYING
;
2497 if ( mciSendCommand(m_hDev
, MCI_SEEK
, MCI_TO
,
2498 (DWORD
)(LPVOID
)&seekParms
) != 0)
2503 // If the device was playing, resume it
2510 //---------------------------------------------------------------------------
2511 // wxMCIMediaBackend::GetPosition
2513 // Gets the position of the device in the stream using the current
2514 // time format... nothing special here...
2515 //---------------------------------------------------------------------------
2516 wxLongLong
wxMCIMediaBackend::GetPosition()
2518 MCI_STATUS_PARMS statusParms
;
2519 statusParms
.dwItem
= MCI_STATUS_POSITION
;
2521 if (mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2522 (DWORD
)(LPSTR
)&statusParms
) != 0)
2525 return statusParms
.dwReturn
;
2528 //---------------------------------------------------------------------------
2529 // wxMCIMediaBackend::GetVolume
2531 // Gets the volume of the current media via the MCI_DGV_STATUS_VOLUME
2532 // message. Value ranges from 0 (minimum) to 1000 (maximum volume).
2533 //---------------------------------------------------------------------------
2534 double wxMCIMediaBackend::GetVolume()
2536 MCI_STATUS_PARMS statusParms
;
2537 statusParms
.dwCallback
= 0;
2538 statusParms
.dwItem
= 0x4019; // MCI_DGV_STATUS_VOLUME
2540 if (mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2541 (DWORD
)(LPSTR
)&statusParms
) != 0)
2544 return ((double)statusParms
.dwReturn
) / 1000.0;
2547 //---------------------------------------------------------------------------
2548 // wxMCIMediaBackend::SetVolume
2550 // Sets the volume of the current media via the MCI_DGV_SETAUDIO_VOLUME
2551 // message. Value ranges from 0 (minimum) to 1000 (maximum volume).
2552 //---------------------------------------------------------------------------
2553 bool wxMCIMediaBackend::SetVolume(double dVolume
)
2555 MCI_DGV_SETAUDIO_PARMS audioParms
;
2556 audioParms
.dwCallback
= 0;
2557 audioParms
.dwItem
= 0x4002; // MCI_DGV_SETAUDIO_VOLUME
2558 audioParms
.dwValue
= (DWORD
) (dVolume
* 1000.0);
2559 audioParms
.dwOver
= 0;
2560 audioParms
.lpstrAlgorithm
= NULL
;
2561 audioParms
.lpstrQuality
= NULL
;
2563 if (mciSendCommand(m_hDev
, 0x0873, // MCI_SETAUDIO
2564 // MCI_DGV_SETAUDIO + (_ITEM | _VALUE)
2565 0x00800000L
| 0x01000000L
,
2566 (DWORD
)(LPSTR
)&audioParms
) != 0)
2572 //---------------------------------------------------------------------------
2573 // wxMCIMediaBackend::GetDuration
2575 // Gets the duration of the stream... nothing special
2576 //---------------------------------------------------------------------------
2577 wxLongLong
wxMCIMediaBackend::GetDuration()
2579 MCI_STATUS_PARMS statusParms
;
2580 statusParms
.dwItem
= MCI_STATUS_LENGTH
;
2582 if (mciSendCommand(m_hDev
, MCI_STATUS
, MCI_STATUS_ITEM
,
2583 (DWORD
)(LPSTR
)&statusParms
) != 0)
2586 return statusParms
.dwReturn
;
2589 //---------------------------------------------------------------------------
2590 // wxMCIMediaBackend::Move
2592 // Moves the window to a location
2593 //---------------------------------------------------------------------------
2594 void wxMCIMediaBackend::Move(int WXUNUSED(x
), int WXUNUSED(y
), int w
, int h
)
2596 if (m_hNotifyWnd
&& m_bVideo
)
2598 MCI_DGV_RECT_PARMS putParms
; // ifdefed MCI_DGV_PUT_PARMS
2599 memset(&putParms
, 0, sizeof(MCI_DGV_RECT_PARMS
));
2600 putParms
.rc
.bottom
= h
;
2601 putParms
.rc
.right
= w
;
2603 // wxStackWalker will crash and burn here on assert
2604 // and MCI doesn't like 0 and 0 for some reason (out of range)
2605 // so just don't it in that case
2608 wxMCIVERIFY( mciSendCommand(m_hDev
, MCI_PUT
,
2609 0x00040000L
, // MCI_DGV_PUT_DESTINATION
2610 (DWORD
)(LPSTR
)&putParms
) );
2615 //---------------------------------------------------------------------------
2616 // wxMCIMediaBackend::GetVideoSize
2618 // Gets the original size of the movie for sizers
2619 //---------------------------------------------------------------------------
2620 wxSize
wxMCIMediaBackend::GetVideoSize() const
2624 MCI_DGV_RECT_PARMS whereParms
; // ifdefed MCI_DGV_WHERE_PARMS
2626 wxMCIVERIFY( mciSendCommand(m_hDev
, MCI_WHERE
,
2627 0x00020000L
, // MCI_DGV_WHERE_SOURCE
2628 (DWORD
)(LPSTR
)&whereParms
) );
2630 return wxSize(whereParms
.rc
.right
, whereParms
.rc
.bottom
);
2632 return wxSize(0, 0);
2635 //---------------------------------------------------------------------------
2636 // wxMCIMediaBackend::GetPlaybackRate
2639 //---------------------------------------------------------------------------
2640 double wxMCIMediaBackend::GetPlaybackRate()
2645 //---------------------------------------------------------------------------
2646 // wxMCIMediaBackend::SetPlaybackRate
2649 //---------------------------------------------------------------------------
2650 bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate
))
2653 MCI_WAVE_SET_SAMPLESPERSEC
2654 MCI_DGV_SET_PARMS setParms
;
2655 setParms
.dwSpeed
= (DWORD
) (dRate
* 1000.0);
2657 return (mciSendCommand(m_hDev
, MCI_SET
,
2658 0x00020000L
, // MCI_DGV_SET_SPEED
2659 (DWORD
)(LPSTR
)&setParms
) == 0);
2665 //---------------------------------------------------------------------------
2666 // [static] wxMCIMediaBackend::MSWWindowProc
2668 // Here we process a message when MCI reaches the stopping point
2670 //---------------------------------------------------------------------------
2671 LRESULT CALLBACK
wxMCIMediaBackend::NotifyWndProc(HWND hWnd
, UINT nMsg
,
2675 wxMCIMediaBackend
* backend
=
2676 (wxMCIMediaBackend
*)wxGetWindowUserData(hWnd
);
2678 return backend
->OnNotifyWndProc(hWnd
, nMsg
, wParam
, lParam
);
2681 LRESULT CALLBACK
wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd
, UINT nMsg
,
2685 if (nMsg
== MM_MCINOTIFY
)
2687 wxASSERT(lParam
== (LPARAM
) m_hDev
);
2688 if (wParam
== MCI_NOTIFY_SUCCESSFUL
&& lParam
== (LPARAM
)m_hDev
)
2690 if ( SendStopEvent() )
2692 wxMCIVERIFY( mciSendCommand(m_hDev
, MCI_SEEK
, MCI_SEEK_TO_START
, 0) );
2697 return DefWindowProc(hWnd
, nMsg
, wParam
, lParam
);
2699 #endif // __WXWINCE__
2701 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2705 // TODO: Use a less kludgy way to pause/get state/set state
2706 // FIXME: Greg Hazel reports that sometimes files that cannot be played
2707 // with this backend are treated as playable anyway - not verified though.
2708 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2710 IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend
, wxMediaBackend
)
2712 // Time between timer calls - this is the Apple recommendation to the TCL
2714 #define MOVIE_DELAY 20
2716 #include "wx/timer.h"
2719 //---------------------------------------------------------------------------
2722 // QT, esp. QT for Windows is very picky about how you go about
2723 // async loading. If you were to go through a Windows message loop
2724 // or a MoviesTask or both and then check the movie load state
2725 // it would still return 1000 (loading)... even (pre)prerolling doesn't
2726 // help. However, making a load timer like this works
2727 //---------------------------------------------------------------------------
2728 class wxQTLoadTimer
: public wxTimer
2731 wxQTLoadTimer(Movie movie
, wxQTMediaBackend
* parent
, wxQuickTimeLibrary
* pLib
) :
2732 m_movie(movie
), m_parent(parent
), m_pLib(pLib
) {}
2736 m_pLib
->MoviesTask(m_movie
, 0);
2737 //kMovieLoadStatePlayable
2738 if (m_pLib
->GetMovieLoadState(m_movie
) >= 10000)
2740 m_parent
->FinishLoad();
2746 Movie m_movie
; //Our movie instance
2747 wxQTMediaBackend
* m_parent
; //Backend pointer
2748 wxQuickTimeLibrary
* m_pLib
; //Interfaces
2752 // --------------------------------------------------------------------------
2753 // wxQTPlayTimer - Handle Asyncronous Playing
2755 // 1) Checks to see if the movie is done, and if not continues
2756 // streaming the movie
2757 // 2) Sends the wxEVT_MEDIA_STOP event if we have reached the end of
2759 // --------------------------------------------------------------------------
2760 class wxQTPlayTimer
: public wxTimer
2763 wxQTPlayTimer(Movie movie
, wxQTMediaBackend
* parent
,
2764 wxQuickTimeLibrary
* pLib
) :
2765 m_movie(movie
), m_parent(parent
), m_pLib(pLib
) {}
2770 // OK, a little explaining - basically originally
2771 // we only called MoviesTask if the movie was actually
2772 // playing (not paused or stopped)... this was before
2773 // we realized MoviesTask actually handles repainting
2774 // of the current frame - so if you were to resize
2775 // or something it would previously not redraw that
2776 // portion of the movie.
2778 // So now we call MoviesTask always so that it repaints
2781 m_pLib
->MoviesTask(m_movie
, 0);
2784 // Handle the stop event - if the movie has reached
2785 // the end, notify our handler
2787 // m_bPlaying == !(Stopped | Paused)
2789 if (m_parent
->m_bPlaying
)
2791 if (m_pLib
->IsMovieDone(m_movie
))
2793 if ( m_parent
->SendStopEvent() )
2796 wxASSERT(m_pLib
->GetMoviesError() == noErr
);
2798 m_parent
->QueueFinishEvent();
2805 Movie m_movie
; // Our movie instance
2806 wxQTMediaBackend
* m_parent
; //Backend pointer
2807 wxQuickTimeLibrary
* m_pLib
; //Interfaces
2811 //---------------------------------------------------------------------------
2812 // wxQTMediaBackend::QTWndProc
2814 // Forwards events to the Movie Controller so that it can
2815 // redraw itself/process messages etc..
2816 //---------------------------------------------------------------------------
2817 LRESULT CALLBACK
wxQTMediaBackend::QTWndProc(HWND hWnd
, UINT nMsg
,
2818 WPARAM wParam
, LPARAM lParam
)
2820 wxQTMediaBackend
* pThis
= (wxQTMediaBackend
*)wxGetWindowUserData(hWnd
);
2825 msg
.wParam
= wParam
;
2826 msg
.lParam
= lParam
;
2830 EventRecord theEvent
;
2831 pThis
->m_lib
.NativeEventToMacEvent(&msg
, &theEvent
);
2832 pThis
->m_lib
.MCIsPlayerEvent(pThis
->m_pMC
, &theEvent
);
2834 return pThis
->m_ctrl
->MSWWindowProc(nMsg
, wParam
, lParam
);
2837 //---------------------------------------------------------------------------
2838 // wxQTMediaBackend Destructor
2840 // Sets m_timer to NULL signifying we havn't loaded anything yet
2841 //---------------------------------------------------------------------------
2842 wxQTMediaBackend::wxQTMediaBackend()
2843 : m_movie(NULL
), m_bPlaying(false), m_timer(NULL
), m_pMC(NULL
)
2847 //---------------------------------------------------------------------------
2848 // wxQTMediaBackend Destructor
2850 // 1) Cleans up the QuickTime movie instance
2851 // 2) Decrements the QuickTime reference counter - if this reaches
2852 // 0, QuickTime shuts down
2853 // 3) Decrements the QuickTime Windows Media Layer reference counter -
2854 // if this reaches 0, QuickTime shuts down the Windows Media Layer
2855 //---------------------------------------------------------------------------
2856 wxQTMediaBackend::~wxQTMediaBackend()
2865 m_lib
.DisposeMovieController(m_pMC
);
2869 // destroy wxQTMediaEvtHandler we pushed on it
2870 m_ctrl
->PopEventHandler(true);
2872 m_lib
.DestroyPortAssociation(
2873 (CGrafPtr
)m_lib
.GetNativeWindowPort(m_ctrl
->GetHWND()));
2875 //Note that ExitMovies() is not necessary, but
2876 //the docs are fuzzy on whether or not TerminateQTML is
2878 m_lib
.TerminateQTML();
2882 //---------------------------------------------------------------------------
2883 // wxQTMediaBackend::CreateControl
2885 // 1) Intializes QuickTime
2886 // 2) Creates the control window
2887 //---------------------------------------------------------------------------
2888 bool wxQTMediaBackend::CreateControl(wxControl
* ctrl
, wxWindow
* parent
,
2893 const wxValidator
& validator
,
2894 const wxString
& name
)
2896 if (!m_lib
.Initialize())
2899 int nError
= m_lib
.InitializeQTML(0);
2900 if (nError
!= noErr
) //-2093 no dll
2902 wxFAIL_MSG(wxString::Format(wxT("Couldn't Initialize Quicktime-%i"), nError
));
2906 m_lib
.EnterMovies();
2909 // By default wxWindow(s) is created with a border -
2910 // so we need to get rid of those
2912 // Since we don't have a child window like most other
2913 // backends, we don't need wxCLIP_CHILDREN
2915 if ( !ctrl
->wxControl::Create(parent
, id
, pos
, size
,
2916 (style
& ~wxBORDER_MASK
) | wxBORDER_NONE
,
2922 m_ctrl
= wxStaticCast(ctrl
, wxMediaCtrl
);
2924 // Create a port association for our window so we
2925 // can use it as a WindowRef
2926 m_lib
.CreatePortAssociation(m_ctrl
->GetHWND(), NULL
, 0L);
2928 // Part of a suggestion from Greg Hazel
2929 // to repaint movie when idle
2930 m_ctrl
->PushEventHandler(new wxQTMediaEvtHandler(this, m_ctrl
->GetHWND()));
2936 //---------------------------------------------------------------------------
2937 // wxQTMediaBackend::Load (file version)
2939 // 1) Get an FSSpec from the Windows path name
2940 // 2) Open the movie
2941 // 3) Obtain the movie instance from the movie resource
2942 // 4) Close the movie resource
2943 // 5) Finish loading
2944 //---------------------------------------------------------------------------
2945 bool wxQTMediaBackend::Load(const wxString
& fileName
)
2950 short movieResFile
= 0; //= 0 because of annoying VC6 warning
2953 if (m_lib
.NativePathNameToFSSpec(
2954 (char*) (const char*) fileName
.mb_str(),
2955 &sfFile
, 0) != noErr
)
2960 if (m_lib
.OpenMovieFile (&sfFile
, &movieResFile
, fsRdPerm
) != noErr
)
2963 short movieResID
= 0;
2966 OSErr err
= m_lib
.NewMovieFromFile(
2972 NULL
); //wasChanged
2974 // m_lib.GetMoviesStickyError() because it may not find the
2975 // proper codec and play black video and other strange effects,
2976 // not to mention mess up the dynamic backend loading scheme
2977 // of wxMediaCtrl - so it just does what the QuickTime player does
2978 if (err
== noErr
&& m_lib
.GetMoviesStickyError() == noErr
)
2980 m_lib
.CloseMovieFile (movieResFile
);
2989 //---------------------------------------------------------------------------
2990 // wxQTMediaBackend::PPRMProc (static)
2992 // Called when done PrePrerolling the movie.
2993 // Note that in 99% of the cases this does nothing...
2994 // Anyway we set up the loading timer here to tell us when the movie is done
2995 //---------------------------------------------------------------------------
2996 void wxQTMediaBackend::PPRMProc (Movie theMovie
,
2997 OSErr
WXUNUSED_UNLESS_DEBUG(theErr
),
3000 wxASSERT( theMovie
);
3001 wxASSERT( theRefCon
);
3002 wxASSERT( theErr
== noErr
);
3004 wxQTMediaBackend
* pBE
= (wxQTMediaBackend
*) theRefCon
;
3006 long lTime
= pBE
->m_lib
.GetMovieTime(theMovie
,NULL
);
3007 Fixed rate
= pBE
->m_lib
.GetMoviePreferredRate(theMovie
);
3008 pBE
->m_lib
.PrerollMovie(theMovie
,lTime
,rate
);
3009 pBE
->m_timer
= new wxQTLoadTimer(pBE
->m_movie
, pBE
, &pBE
->m_lib
);
3010 pBE
->m_timer
->Start(MOVIE_DELAY
);
3013 //---------------------------------------------------------------------------
3014 // wxQTMediaBackend::Load (URL Version)
3016 // 1) Build an escaped URI from location
3017 // 2) Create a handle to store the URI string
3018 // 3) Put the URI string inside the handle
3019 // 4) Make a QuickTime URL data ref from the handle with the URI in it
3020 // 5) Clean up the URI string handle
3021 // 6) Do some prerolling
3022 // 7) Finish Loading
3023 //---------------------------------------------------------------------------
3024 bool wxQTMediaBackend::Load(const wxURI
& location
)
3029 wxString theURI
= location
.BuildURI();
3031 Handle theHandle
= m_lib
.NewHandleClear(theURI
.length() + 1);
3032 wxASSERT(theHandle
);
3034 m_lib
.BlockMove(theURI
.mb_str(), *theHandle
, theURI
.length() + 1);
3036 // create the movie from the handle that refers to the URI
3037 OSErr err
= m_lib
.NewMovieFromDataRef(&m_movie
, newMovieActive
|
3039 /*|newMovieIdleImportOK*/,
3041 URLDataHandlerSubType
);
3043 m_lib
.DisposeHandle(theHandle
);
3050 timeNow
= m_lib
.GetMovieTime(m_movie
, NULL
);
3051 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3053 playRate
= m_lib
.GetMoviePreferredRate(m_movie
);
3054 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3056 // Note that the callback here is optional,
3057 // but without it PrePrerollMovie can be buggy
3058 // (see Apple ml). Also, some may wonder
3059 // why we need this at all - this is because
3060 // Apple docs say QuickTime streamed movies
3061 // require it if you don't use a Movie Controller,
3062 // which we don't by default.
3064 m_lib
.PrePrerollMovie(m_movie
, timeNow
, playRate
,
3065 (WXFARPROC
)wxQTMediaBackend::PPRMProc
,
3074 //---------------------------------------------------------------------------
3075 // wxQTMediaBackend::FinishLoad
3077 // 1) Create the movie timer
3078 // 2) Get real size of movie for GetBestSize/sizers
3079 // 3) Set the movie time scale to something usable so that seeking
3080 // etc. will work correctly
3081 // 4) Set our Movie Controller to display the movie if it exists,
3082 // otherwise set the bounds of the Movie
3083 // 5) Refresh parent window
3084 //---------------------------------------------------------------------------
3085 void wxQTMediaBackend::FinishLoad()
3087 // Create the playing/streaming timer
3088 m_timer
= new wxQTPlayTimer(m_movie
, (wxQTMediaBackend
*) this, &m_lib
);
3090 m_timer
->Start(MOVIE_DELAY
, wxTIMER_CONTINUOUS
);
3092 // get the real size of the movie
3094 memset(&outRect
, 0, sizeof(Rect
)); // for annoying VC6 warning
3095 m_lib
.GetMovieNaturalBoundsRect (m_movie
, &outRect
);
3096 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3098 m_bestSize
.x
= outRect
.right
- outRect
.left
;
3099 m_bestSize
.y
= outRect
.bottom
- outRect
.top
;
3101 // Handle the movie GWorld
3105 thePoint
.h
= thePoint
.v
= 0;
3106 m_lib
.MCSetMovie(m_pMC
, m_movie
,
3107 m_lib
.GetNativeWindowPort(m_ctrl
->GetHandle()),
3109 m_lib
.MCSetVisible(m_pMC
, true);
3114 m_lib
.SetMovieGWorld(m_movie
,
3115 (CGrafPtr
) m_lib
.GetNativeWindowPort(m_ctrl
->GetHWND()),
3119 // Set the movie to millisecond precision
3120 m_lib
.SetMovieTimeScale(m_movie
, 1000);
3121 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3123 NotifyMovieLoaded();
3126 //---------------------------------------------------------------------------
3127 // wxQTMediaBackend::Play
3129 // 1) Start the QT movie
3130 // 2) Start the movie loading timer
3132 // NOTE: This will still return success even when
3133 // the movie is still loading, and as mentioned in wxQTLoadTimer
3134 // I don't know of a way to force this to be sync - so if its
3135 // still loading the function will return true but the movie will
3136 // still be in the stopped state
3137 //---------------------------------------------------------------------------
3138 bool wxQTMediaBackend::Play()
3140 m_lib
.StartMovie(m_movie
);
3143 return m_lib
.GetMoviesError() == noErr
;
3146 //---------------------------------------------------------------------------
3147 // wxQTMediaBackend::Pause
3149 // 1) Stop the movie
3150 // 2) Stop the movie timer
3151 //---------------------------------------------------------------------------
3152 bool wxQTMediaBackend::Pause()
3155 m_lib
.StopMovie(m_movie
);
3157 return m_lib
.GetMoviesError() == noErr
;
3160 //---------------------------------------------------------------------------
3161 // wxQTMediaBackend::Stop
3163 // 1) Stop the movie
3164 // 2) Stop the movie timer
3165 // 3) Seek to the beginning of the movie
3166 //---------------------------------------------------------------------------
3167 bool wxQTMediaBackend::Stop()
3171 m_lib
.StopMovie(m_movie
);
3172 if (m_lib
.GetMoviesError() == noErr
)
3173 m_lib
.GoToBeginningOfMovie(m_movie
);
3175 return m_lib
.GetMoviesError() == noErr
;
3178 //---------------------------------------------------------------------------
3179 // wxQTMediaBackend::GetPlaybackRate
3181 // 1) Get the movie playback rate from ::GetMovieRate
3182 //---------------------------------------------------------------------------
3183 double wxQTMediaBackend::GetPlaybackRate()
3185 return ( ((double)m_lib
.GetMovieRate(m_movie
)) / 0x10000);
3188 //---------------------------------------------------------------------------
3189 // wxQTMediaBackend::SetPlaybackRate
3191 // 1) Convert dRate to Fixed and Set the movie rate through SetMovieRate
3192 //---------------------------------------------------------------------------
3193 bool wxQTMediaBackend::SetPlaybackRate(double dRate
)
3195 m_lib
.SetMovieRate(m_movie
, (Fixed
) (dRate
* 0x10000));
3197 return m_lib
.GetMoviesError() == noErr
;
3200 //---------------------------------------------------------------------------
3201 // wxQTMediaBackend::SetPosition
3203 // 1) Create a time record struct (TimeRecord) with appropriate values
3204 // 2) Pass struct to SetMovieTime
3205 //---------------------------------------------------------------------------
3206 bool wxQTMediaBackend::SetPosition(wxLongLong where
)
3208 //NB: For some reason SetMovieTime does not work
3209 //correctly with the Quicktime Windows SDK (6)
3210 //From Muskelkatermann at the wxForum
3211 //http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=2957
3212 //RN - note that I have not verified this but there
3213 //is no harm in calling SetMovieTimeValue instead
3215 TimeRecord theTimeRecord
;
3216 memset(&theTimeRecord
, 0, sizeof(TimeRecord
));
3217 theTimeRecord
.value
.lo
= where
.GetLo();
3218 theTimeRecord
.scale
= m_lib
.GetMovieTimeScale(m_movie
);
3219 theTimeRecord
.base
= m_lib
.GetMovieTimeBase(m_movie
);
3220 m_lib
.SetMovieTime(m_movie
, &theTimeRecord
);
3222 m_lib
.SetMovieTimeValue(m_movie
, where
.GetLo());
3225 return (m_lib
.GetMoviesError() == noErr
);
3228 //---------------------------------------------------------------------------
3229 // wxQTMediaBackend::GetPosition
3231 // 1) Calls GetMovieTime to get the position we are in in the movie
3232 // in milliseconds (we called
3233 //---------------------------------------------------------------------------
3234 wxLongLong
wxQTMediaBackend::GetPosition()
3236 return m_lib
.GetMovieTime(m_movie
, NULL
);
3239 //---------------------------------------------------------------------------
3240 // wxQTMediaBackend::GetVolume
3242 // Gets the volume through GetMovieVolume - which returns a 16 bit short -
3244 // +--------+--------+
3246 // +--------+--------+
3248 // (1) first 8 bits are value before decimal
3249 // (2) second 8 bits are value after decimal
3251 // Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
3252 // 1 (full gain and sound)
3253 //---------------------------------------------------------------------------
3254 double wxQTMediaBackend::GetVolume()
3256 short sVolume
= m_lib
.GetMovieVolume(m_movie
);
3257 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3259 if (sVolume
& (128 << 8)) //negative - no sound
3262 return sVolume
/ 256.0;
3265 //---------------------------------------------------------------------------
3266 // wxQTMediaBackend::SetVolume
3268 // Sets the volume through SetMovieVolume - which takes a 16 bit short -
3270 // +--------+--------+
3272 // +--------+--------+
3274 // (1) first 8 bits are value before decimal
3275 // (2) second 8 bits are value after decimal
3277 // Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
3278 // 1 (full gain and sound)
3279 //---------------------------------------------------------------------------
3280 bool wxQTMediaBackend::SetVolume(double dVolume
)
3282 m_lib
.SetMovieVolume(m_movie
, (short) (dVolume
* 256));
3283 return m_lib
.GetMoviesError() == noErr
;
3286 //---------------------------------------------------------------------------
3287 // wxQTMediaBackend::GetDuration
3289 // Calls GetMovieDuration
3290 //---------------------------------------------------------------------------
3291 wxLongLong
wxQTMediaBackend::GetDuration()
3293 return m_lib
.GetMovieDuration(m_movie
);
3296 //---------------------------------------------------------------------------
3297 // wxQTMediaBackend::GetState
3299 // Determines the current state - if we are at the beginning we
3301 //---------------------------------------------------------------------------
3302 wxMediaState
wxQTMediaBackend::GetState()
3305 return wxMEDIASTATE_PLAYING
;
3306 else if ( !m_movie
|| wxQTMediaBackend::GetPosition() == 0 )
3307 return wxMEDIASTATE_STOPPED
;
3309 return wxMEDIASTATE_PAUSED
;
3312 //---------------------------------------------------------------------------
3313 // wxQTMediaBackend::Cleanup
3315 // Diposes of the movie timer, Disassociates the Movie Controller with
3316 // movie and hides it if it exists, and stops and disposes
3318 //---------------------------------------------------------------------------
3319 void wxQTMediaBackend::Cleanup()
3329 m_lib
.StopMovie(m_movie
);
3334 thePoint
.h
= thePoint
.v
= 0;
3335 m_lib
.MCSetVisible(m_pMC
, false);
3336 m_lib
.MCSetMovie(m_pMC
, NULL
, NULL
, thePoint
);
3339 m_lib
.DisposeMovie(m_movie
);
3343 //---------------------------------------------------------------------------
3344 // wxQTMediaBackend::ShowPlayerControls
3346 // Creates a movie controller for the Movie if the user wants it
3347 //---------------------------------------------------------------------------
3348 bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags
)
3352 //restore old wndproc
3353 wxSetWindowProc((HWND
)m_ctrl
->GetHWND(), wxWndProc
);
3354 m_lib
.DisposeMovieController(m_pMC
);
3356 m_bestSize
.y
-= 16; //movie controller height
3359 if (flags
&& m_movie
)
3362 wxRect wxrect
= m_ctrl
->GetClientRect();
3364 //make room for controller
3365 if (wxrect
.width
< 320)
3368 rect
.top
= (short)wxrect
.y
;
3369 rect
.left
= (short)wxrect
.x
;
3370 rect
.right
= (short)(rect
.left
+ wxrect
.width
);
3371 rect
.bottom
= (short)(rect
.top
+ wxrect
.height
);
3375 m_pMC
= m_lib
.NewMovieController(m_movie
, &rect
, mcTopLeftMovie
|
3376 // mcScaleMovieToFit |
3379 m_lib
.MCDoAction(m_pMC
, 32, (void*)true); //mcActionSetKeysEnabled
3380 m_lib
.MCSetActionFilterWithRefCon(m_pMC
,
3381 (WXFARPROC
)wxQTMediaBackend::MCFilterProc
, (void*)this);
3382 m_bestSize
.y
+= 16; //movie controller height
3385 // By default the movie controller uses its own color
3386 // pallette for the movie which can be bad on some files -
3387 // so turn it off. Also turn off its frame/border for
3390 // Also we take care of a couple of the interface flags here
3393 m_lib
.MCDoAction(m_pMC
, 39/*mcActionGetFlags*/, (void*)&mcFlags
);
3394 mcFlags
|= ( //(1<< 0)/*mcFlagSuppressMovieFrame*/ |
3395 (1<< 3)/*mcFlagsUseWindowPalette*/
3396 | ((flags
& wxMEDIACTRLPLAYERCONTROLS_STEP
)
3397 ? 0 : (1<< 1) /*mcFlagSuppressStepButtons*/)
3398 | ((flags
& wxMEDIACTRLPLAYERCONTROLS_VOLUME
)
3399 ? 0 : (1<< 2) /*mcFlagSuppressSpeakerButton*/)
3400 // | (1<< 4) /*mcFlagDontInvalidate*/ //if we take care of repainting ourselves
3402 m_lib
.MCDoAction(m_pMC
, 38/*mcActionSetFlags*/, (void*)mcFlags
);
3404 //intercept the wndproc of our control window
3405 wxSetWindowProc((HWND
)m_ctrl
->GetHWND(),
3406 wxQTMediaBackend::QTWndProc
);
3408 //set the user data of our window
3409 wxSetWindowUserData((HWND
)m_ctrl
->GetHWND(), this);
3413 NotifyMovieSizeChanged();
3415 return m_lib
.GetMoviesError() == noErr
;
3418 //---------------------------------------------------------------------------
3419 // wxQTMediaBackend::MCFilterProc (static)
3421 // Callback for when the movie controller recieves a message
3422 //---------------------------------------------------------------------------
3424 wxQTMediaBackend::MCFilterProc(MovieController
WXUNUSED(theController
),
3426 void * WXUNUSED(params
),
3429 if (action
!= 1) // don't process idle events
3431 wxQTMediaBackend
* pThis
= (wxQTMediaBackend
*)refCon
;
3436 // play button triggered - MC will set movie to opposite state
3437 // of current - playing ? paused : playing
3438 pThis
->m_bPlaying
= !(pThis
->m_bPlaying
);
3440 // NB: Sometimes it doesn't redraw properly -
3441 // if you click on the button but don't move the mouse
3442 // the button will not change its state until you move
3443 // mcActionDraw and Refresh/Update combo do nothing
3444 // to help this unfortunately
3454 //---------------------------------------------------------------------------
3455 // wxQTMediaBackend::GetVideoSize
3457 // Returns the actual size of the QT movie
3458 //---------------------------------------------------------------------------
3459 wxSize
wxQTMediaBackend::GetVideoSize() const
3464 //---------------------------------------------------------------------------
3465 // wxQTMediaBackend::Move
3467 // Sets the bounds of either the Movie or Movie Controller
3468 //---------------------------------------------------------------------------
3469 void wxQTMediaBackend::Move(int WXUNUSED(x
), int WXUNUSED(y
), int w
, int h
)
3473 //make room for controller
3479 Rect theRect
= {0, 0, (short)h
, (short)w
};
3480 m_lib
.MCSetControllerBoundsRect(m_pMC
, &theRect
);
3484 Rect theRect
= {0, 0, (short)h
, (short)w
};
3485 m_lib
.SetMovieBox(m_movie
, &theRect
);
3488 wxASSERT(m_lib
.GetMoviesError() == noErr
);
3492 //---------------------------------------------------------------------------
3493 // wxQTMediaBackend::OnEraseBackground
3495 // Suggestion from Greg Hazel to repaint the movie when idle
3498 // TODO: We may be repainting too much here - under what exact circumstances
3499 // do we need this? I think Move also repaints correctly for the Movie
3500 // Controller, so in that instance we don't need this either
3501 //---------------------------------------------------------------------------
3502 void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent
& evt
)
3504 wxQuickTimeLibrary
& m_pLib
= m_qtb
->m_lib
;
3508 // repaint movie controller
3509 m_pLib
.MCDoAction(m_qtb
->m_pMC
, 2 /*mcActionDraw*/,
3510 m_pLib
.GetNativeWindowPort(m_hwnd
));
3512 else // no movie controller
3514 if ( m_qtb
->m_movie
)
3516 CGrafPtr port
= (CGrafPtr
)m_pLib
.GetNativeWindowPort(m_hwnd
);
3518 m_pLib
.BeginUpdate(port
);
3519 m_pLib
.UpdateMovie(m_qtb
->m_movie
);
3520 wxASSERT(m_pLib
.GetMoviesError() == noErr
);
3521 m_pLib
.EndUpdate(port
);
3525 // let the system repaint the window
3531 //---------------------------------------------------------------------------
3533 //---------------------------------------------------------------------------
3535 //in source file that contains stuff you don't directly use
3536 #include "wx/html/forcelnk.h"
3537 FORCE_LINK_ME(basewxmediabackends
)
3539 //---------------------------------------------------------------------------
3540 // End wxMediaCtrl Compilation Guard and this file
3541 //---------------------------------------------------------------------------
3542 #endif //wxUSE_MEDIACTRL