X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a2a444e3a5c917fe72fb8251c99cedd28868ad12..7529250b88f61580d60a3241a8a7fe339928e9a5:/src/msw/mediactrl.cpp diff --git a/src/msw/mediactrl.cpp b/src/msw/mediactrl.cpp index bae06e5ec5..79a9191143 100644 --- a/src/msw/mediactrl.cpp +++ b/src/msw/mediactrl.cpp @@ -58,11 +58,6 @@ extern WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName; // //--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -// Compilation guard for DirectShow -//--------------------------------------------------------------------------- -#if wxUSE_DIRECTSHOW - //--------------------------------------------------------------------------- // COM includes //--------------------------------------------------------------------------- @@ -106,16 +101,16 @@ MIDL_INTERFACE("56A868B9-0AD4-11CE-B03A-0020AF0BA770") IAMCollection : public IDispatch { public: - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ long __RPC_FAR *plCount) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE Item( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Item( /* [in] */ long lItem, /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) = 0; - + }; MIDL_INTERFACE("56A868B1-0AD4-11CE-B03A-0020AF0BA770") @@ -123,420 +118,420 @@ IMediaControl : public IDispatch { public: virtual /* [id] */ HRESULT STDMETHODCALLTYPE Run( void) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetState( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetState( /* [in] */ long msTimeout, /* [out] */ long __RPC_FAR *pfs) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE RenderFile( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE RenderFile( /* [in] */ BSTR strFilename) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddSourceFilter( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddSourceFilter( /* [in] */ BSTR strFilename, /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_FilterCollection( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_FilterCollection( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_RegFilterCollection( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_RegFilterCollection( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE StopWhenReady( void) = 0; - + }; MIDL_INTERFACE("56A868B6-0AD4-11CE-B03A-0020AF0BA770") IMediaEvent : public IDispatch { public: - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEventHandle( + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEventHandle( /* [out] */ LONG_PTR __RPC_FAR *hEvent) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEvent( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEvent( /* [out] */ long __RPC_FAR *lEventCode, /* [out] */ LONG_PTR __RPC_FAR *lParam1, /* [out] */ LONG_PTR __RPC_FAR *lParam2, /* [in] */ long msTimeout) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE WaitForCompletion( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE WaitForCompletion( /* [in] */ long msTimeout, /* [out] */ long __RPC_FAR *pEvCode) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE CancelDefaultHandling( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CancelDefaultHandling( /* [in] */ long lEvCode) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE RestoreDefaultHandling( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE RestoreDefaultHandling( /* [in] */ long lEvCode) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE FreeEventParams( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FreeEventParams( /* [in] */ long lEvCode, /* [in] */ LONG_PTR lParam1, /* [in] */ LONG_PTR lParam2) = 0; - + }; MIDL_INTERFACE("56A868C0-0AD4-11CE-B03A-0020AF0BA770") IMediaEventEx : public IMediaEvent { public: - virtual HRESULT __stdcall SetNotifyWindow( + virtual HRESULT __stdcall SetNotifyWindow( /* [in] */ LONG_PTR hwnd, /* [in] */ long lMsg, /* [in] */ LONG_PTR lInstanceData) = 0; - - virtual HRESULT __stdcall SetNotifyFlags( + + virtual HRESULT __stdcall SetNotifyFlags( /* [in] */ long lNoNotifyFlags) = 0; - - virtual HRESULT __stdcall GetNotifyFlags( + + virtual HRESULT __stdcall GetNotifyFlags( /* [out] */ long __RPC_FAR *lplNoNotifyFlags) = 0; - + }; - + MIDL_INTERFACE("56A868B2-0AD4-11CE-B03A-0020AF0BA770") IMediaPosition : public IDispatch { public: - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Duration( + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Duration( /* [retval][out] */ double __RPC_FAR *plength) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_CurrentPosition( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_CurrentPosition( /* [in] */ double pllTime) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_CurrentPosition( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_CurrentPosition( /* [retval][out] */ double __RPC_FAR *pllTime) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_StopTime( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_StopTime( /* [retval][out] */ double __RPC_FAR *pllTime) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_StopTime( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_StopTime( /* [in] */ double pllTime) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_PrerollTime( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_PrerollTime( /* [retval][out] */ double __RPC_FAR *pllTime) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_PrerollTime( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_PrerollTime( /* [in] */ double pllTime) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Rate( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Rate( /* [in] */ double pdRate) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Rate( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Rate( /* [retval][out] */ double __RPC_FAR *pdRate) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanSeekForward( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanSeekForward( /* [retval][out] */ long __RPC_FAR *pCanSeekForward) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanSeekBackward( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanSeekBackward( /* [retval][out] */ long __RPC_FAR *pCanSeekBackward) = 0; - + }; MIDL_INTERFACE("56A868B3-0AD4-11CE-B03A-0020AF0BA770") IBasicAudio : public IDispatch { public: - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Volume( + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Volume( /* [in] */ long plVolume) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Volume( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Volume( /* [retval][out] */ long __RPC_FAR *plVolume) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Balance( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Balance( /* [in] */ long plBalance) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Balance( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Balance( /* [retval][out] */ long __RPC_FAR *plBalance) = 0; - + }; - + MIDL_INTERFACE("56A868B4-0AD4-11CE-B03A-0020AF0BA770") IVideoWindow : public IDispatch { public: - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Caption( + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Caption( /* [in] */ BSTR strCaption) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Caption( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Caption( /* [retval][out] */ BSTR __RPC_FAR *strCaption) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_WindowStyle( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_WindowStyle( /* [in] */ long WindowStyle) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_WindowStyle( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_WindowStyle( /* [retval][out] */ long __RPC_FAR *WindowStyle) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_WindowStyleEx( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_WindowStyleEx( /* [in] */ long WindowStyleEx) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_WindowStyleEx( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_WindowStyleEx( /* [retval][out] */ long __RPC_FAR *WindowStyleEx) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_AutoShow( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_AutoShow( /* [in] */ long AutoShow) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_AutoShow( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_AutoShow( /* [retval][out] */ long __RPC_FAR *AutoShow) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_WindowState( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_WindowState( /* [in] */ long WindowState) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_WindowState( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_WindowState( /* [retval][out] */ long __RPC_FAR *WindowState) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_BackgroundPalette( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_BackgroundPalette( /* [in] */ long pBackgroundPalette) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BackgroundPalette( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BackgroundPalette( /* [retval][out] */ long __RPC_FAR *pBackgroundPalette) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Visible( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Visible( /* [in] */ long pVisible) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Visible( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Visible( /* [retval][out] */ long __RPC_FAR *pVisible) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Left( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Left( /* [in] */ long pLeft) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Left( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Left( /* [retval][out] */ long __RPC_FAR *pLeft) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Width( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Width( /* [in] */ long pWidth) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Width( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Width( /* [retval][out] */ long __RPC_FAR *pWidth) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Top( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Top( /* [in] */ long pTop) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Top( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Top( /* [retval][out] */ long __RPC_FAR *pTop) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Height( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Height( /* [in] */ long pHeight) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Height( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Height( /* [retval][out] */ long __RPC_FAR *pHeight) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Owner( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Owner( /* [in] */ LONG_PTR Owner) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Owner( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Owner( /* [retval][out] */ LONG_PTR __RPC_FAR *Owner) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_MessageDrain( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_MessageDrain( /* [in] */ LONG_PTR Drain) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_MessageDrain( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_MessageDrain( /* [retval][out] */ LONG_PTR __RPC_FAR *Drain) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BorderColor( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BorderColor( /* [retval][out] */ long __RPC_FAR *Color) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_BorderColor( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_BorderColor( /* [in] */ long Color) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_FullScreenMode( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_FullScreenMode( /* [retval][out] */ long __RPC_FAR *FullScreenMode) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_FullScreenMode( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_FullScreenMode( /* [in] */ long FullScreenMode) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetWindowForeground( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetWindowForeground( /* [in] */ long Focus) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE NotifyOwnerMessage( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE NotifyOwnerMessage( /* [in] */ LONG_PTR hwnd, /* [in] */ long uMsg, /* [in] */ LONG_PTR wParam, /* [in] */ LONG_PTR lParam) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetWindowPosition( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetWindowPosition( /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetWindowPosition( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetWindowPosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetMinIdealImageSize( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetMinIdealImageSize( /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetMaxIdealImageSize( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetMaxIdealImageSize( /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetRestorePosition( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetRestorePosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE HideCursor( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE HideCursor( /* [in] */ long HideCursor) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsCursorHidden( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsCursorHidden( /* [out] */ long __RPC_FAR *CursorHidden) = 0; - + }; MIDL_INTERFACE("56A868B5-0AD4-11CE-B03A-0020AF0BA770") IBasicVideo : public IDispatch { public: - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_AvgTimePerFrame( + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_AvgTimePerFrame( /* [retval][out] */ double __RPC_FAR *pAvgTimePerFrame) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BitRate( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BitRate( /* [retval][out] */ long __RPC_FAR *pBitRate) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BitErrorRate( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_BitErrorRate( /* [retval][out] */ long __RPC_FAR *pBitErrorRate) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VideoWidth( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VideoWidth( /* [retval][out] */ long __RPC_FAR *pVideoWidth) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VideoHeight( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VideoHeight( /* [retval][out] */ long __RPC_FAR *pVideoHeight) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceLeft( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceLeft( /* [in] */ long pSourceLeft) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceLeft( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceLeft( /* [retval][out] */ long __RPC_FAR *pSourceLeft) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceWidth( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceWidth( /* [in] */ long pSourceWidth) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceWidth( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceWidth( /* [retval][out] */ long __RPC_FAR *pSourceWidth) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceTop( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceTop( /* [in] */ long pSourceTop) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceTop( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceTop( /* [retval][out] */ long __RPC_FAR *pSourceTop) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceHeight( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_SourceHeight( /* [in] */ long pSourceHeight) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceHeight( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SourceHeight( /* [retval][out] */ long __RPC_FAR *pSourceHeight) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationLeft( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationLeft( /* [in] */ long pDestinationLeft) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationLeft( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationLeft( /* [retval][out] */ long __RPC_FAR *pDestinationLeft) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationWidth( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationWidth( /* [in] */ long pDestinationWidth) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationWidth( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationWidth( /* [retval][out] */ long __RPC_FAR *pDestinationWidth) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationTop( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationTop( /* [in] */ long pDestinationTop) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationTop( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationTop( /* [retval][out] */ long __RPC_FAR *pDestinationTop) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationHeight( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DestinationHeight( /* [in] */ long pDestinationHeight) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationHeight( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DestinationHeight( /* [retval][out] */ long __RPC_FAR *pDestinationHeight) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetSourcePosition( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetSourcePosition( /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetSourcePosition( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetSourcePosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetDefaultSourcePosition( void) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetDestinationPosition( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetDestinationPosition( /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetDestinationPosition( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetDestinationPosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetDefaultDestinationPosition( void) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetVideoSize( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetVideoSize( /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetVideoPaletteEntries( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetVideoPaletteEntries( /* [in] */ long StartIndex, /* [in] */ long Entries, /* [out] */ long __RPC_FAR *pRetrieved, /* [out] */ long __RPC_FAR *pPalette) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetCurrentImage( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetCurrentImage( /* [out][in] */ long __RPC_FAR *pBufferSize, /* [out] */ long __RPC_FAR *pDIBImage) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsUsingDefaultSource( void) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsUsingDefaultDestination( void) = 0; - + }; - + MIDL_INTERFACE("329BB360-F6EA-11D1-9038-00A0C9697298") IBasicVideo2 : public IBasicVideo { public: - virtual HRESULT __stdcall GetPreferredAspectRatio( + virtual HRESULT __stdcall GetPreferredAspectRatio( /* [out] */ long __RPC_FAR *plAspectX, /* [out] */ long __RPC_FAR *plAspectY) = 0; - + }; - + MIDL_INTERFACE("56A868B8-0AD4-11CE-B03A-0020AF0BA770") IDeferredCommand : public IUnknown { public: virtual HRESULT __stdcall Cancel( void) = 0; - - virtual HRESULT __stdcall Confidence( + + virtual HRESULT __stdcall Confidence( /* [out] */ long __RPC_FAR *pConfidence) = 0; - - virtual HRESULT __stdcall Postpone( + + virtual HRESULT __stdcall Postpone( /* [in] */ double newtime) = 0; - - virtual HRESULT __stdcall GetHResult( + + virtual HRESULT __stdcall GetHResult( /* [out] */ HRESULT __RPC_FAR *phrResult) = 0; - + }; MIDL_INTERFACE("56A868B7-0AD4-11CE-B03A-0020AF0BA770") IQueueCommand : public IUnknown { public: - virtual HRESULT __stdcall InvokeAtStreamTime( + virtual HRESULT __stdcall InvokeAtStreamTime( /* [out] */ IDeferredCommand __RPC_FAR *__RPC_FAR *pCmd, /* [in] */ double time, /* [in] */ GUID __RPC_FAR *iid, @@ -546,8 +541,8 @@ public: /* [in] */ VARIANT __RPC_FAR *pDispParams, /* [out][in] */ VARIANT __RPC_FAR *pvarResult, /* [out] */ short __RPC_FAR *puArgErr) = 0; - - virtual HRESULT __stdcall InvokeAtPresentationTime( + + virtual HRESULT __stdcall InvokeAtPresentationTime( /* [out] */ IDeferredCommand __RPC_FAR *__RPC_FAR *pCmd, /* [in] */ double time, /* [in] */ GUID __RPC_FAR *iid, @@ -557,106 +552,106 @@ public: /* [in] */ VARIANT __RPC_FAR *pDispParams, /* [out][in] */ VARIANT __RPC_FAR *pvarResult, /* [out] */ short __RPC_FAR *puArgErr) = 0; - + }; - + MIDL_INTERFACE("56A868BA-0AD4-11CE-B03A-0020AF0BA770") IFilterInfo : public IDispatch { public: - virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindPin( + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindPin( /* [in] */ BSTR strPinID, /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( /* [retval][out] */ BSTR __RPC_FAR *strName) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VendorInfo( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VendorInfo( /* [retval][out] */ BSTR __RPC_FAR *strVendorInfo) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Filter( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Filter( /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Pins( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Pins( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_IsFileSource( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_IsFileSource( /* [retval][out] */ long __RPC_FAR *pbIsSource) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Filename( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Filename( /* [retval][out] */ BSTR __RPC_FAR *pstrFilename) = 0; - - virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Filename( + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Filename( /* [in] */ BSTR pstrFilename) = 0; - + }; - + MIDL_INTERFACE("56A868BB-0AD4-11CE-B03A-0020AF0BA770") IRegFilterInfo : public IDispatch { public: - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( /* [retval][out] */ BSTR __RPC_FAR *strName) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE Filter( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Filter( /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - + }; - + MIDL_INTERFACE("56A868BC-0AD4-11CE-B03A-0020AF0BA770") IMediaTypeInfo : public IDispatch { public: - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( /* [retval][out] */ BSTR __RPC_FAR *strType) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Subtype( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Subtype( /* [retval][out] */ BSTR __RPC_FAR *strType) = 0; - + }; - + MIDL_INTERFACE("56A868BD-0AD4-11CE-B03A-0020AF0BA770") IPinInfo : public IDispatch { public: - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Pin( + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Pin( /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_ConnectedTo( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_ConnectedTo( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_ConnectionMediaType( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_ConnectionMediaType( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_FilterInfo( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_FilterInfo( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( /* [retval][out] */ BSTR __RPC_FAR *ppUnk) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Direction( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Direction( /* [retval][out] */ long __RPC_FAR *ppDirection) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_PinID( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_PinID( /* [retval][out] */ BSTR __RPC_FAR *strPinID) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_MediaTypes( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_MediaTypes( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE Connect( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Connect( /* [in] */ IUnknown __RPC_FAR *pPin) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE ConnectDirect( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ConnectDirect( /* [in] */ IUnknown __RPC_FAR *pPin) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE ConnectWithType( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ConnectWithType( /* [in] */ IUnknown __RPC_FAR *pPin, /* [in] */ IDispatch __RPC_FAR *pMediaType) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Disconnect( void) = 0; - + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Render( void) = 0; - + }; MIDL_INTERFACE("BC9BCF80-DCD2-11D2-ABF6-00A0C905F375") @@ -664,11 +659,11 @@ IAMStats : public IDispatch { public: virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( /* [retval][out] */ long __RPC_FAR *plCount) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetValueByIndex( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetValueByIndex( /* [in] */ long lIndex, /* [out] */ BSTR __RPC_FAR *szName, /* [out] */ long __RPC_FAR *lCount, @@ -677,8 +672,8 @@ public: /* [out] */ double __RPC_FAR *dStdDev, /* [out] */ double __RPC_FAR *dMin, /* [out] */ double __RPC_FAR *dMax) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetValueByName( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetValueByName( /* [in] */ BSTR szName, /* [out] */ long __RPC_FAR *lIndex, /* [out] */ long __RPC_FAR *lCount, @@ -687,16 +682,16 @@ public: /* [out] */ double __RPC_FAR *dStdDev, /* [out] */ double __RPC_FAR *dMin, /* [out] */ double __RPC_FAR *dMax) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetIndex( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetIndex( /* [in] */ BSTR szName, /* [in] */ long lCreate, /* [out] */ long __RPC_FAR *plIndex) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddValue( + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddValue( /* [in] */ long lIndex, /* [in] */ double dValue) = 0; - + }; //------------------------------------------------------------------ @@ -736,6 +731,9 @@ public: virtual double GetPlaybackRate(); virtual bool SetPlaybackRate(double); + virtual double GetVolume(); + virtual bool SetVolume(double); + void Cleanup(); bool m_bVideo; @@ -758,11 +756,9 @@ public: HWND m_hNotifyWnd; wxSize m_bestSize; - DECLARE_DYNAMIC_CLASS(wxAMMediaBackend); + DECLARE_DYNAMIC_CLASS(wxAMMediaBackend) }; -#endif //wxUSE_DIRECTSHOW - //--------------------------------------------------------------------------- // // wxMCIMediaBackend @@ -808,6 +804,9 @@ public: virtual double GetPlaybackRate(); virtual bool SetPlaybackRate(double dRate); + virtual double GetVolume(); + virtual bool SetVolume(double); + static LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); @@ -829,15 +828,214 @@ public: //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- -// QT Compilation Guard +// QT Includes //--------------------------------------------------------------------------- -#if wxUSE_QUICKTIME +//#include //Windoze QT include +//#include //Standard QT stuff +#include "wx/dynlib.h" + +//--------------------------------------------------------------------------- +// QT Types +//--------------------------------------------------------------------------- +typedef struct MovieRecord* Movie; +typedef wxInt16 OSErr; +typedef wxInt32 OSStatus; +#define noErr 0 +#define fsRdPerm 1 +typedef unsigned char Str255[256]; +#define StringPtr unsigned char* +#define newMovieActive 1 +#define Ptr char* +#define Handle Ptr* +#define Fixed long +#define OSType unsigned long +#define CGrafPtr struct GrafPort * +#define TimeScale long +#define TimeBase struct TimeBaseRecord * + +#ifndef URLDataHandlerSubType +#if defined(__WATCOMC__) || defined(__MINGW32__) +// use magic numbers for compilers which complain about multicharacter integers +const OSType URLDataHandlerSubType = 1970433056; +const OSType VisualMediaCharacteristic = 1702454643; +#else +const OSType URLDataHandlerSubType = 'url '; +const OSType VisualMediaCharacteristic = 'eyes'; +#endif +#endif + +struct FSSpec { + short vRefNum; + long parID; + Str255 name; /*Str63 on mac, Str255 on msw */ +}; + +struct Rect { + short top; + short left; + short bottom; + short right; +}; + +struct wide { + wxInt32 hi; + wxUint32 lo; +}; + +struct TimeRecord { + wide value; /* units */ + TimeScale scale; /* units per second */ + TimeBase base; +}; //--------------------------------------------------------------------------- -// QT Includes +// QT Library //--------------------------------------------------------------------------- -#include //Windoze QT include -#include //Standard QT stuff +#define wxDL_METHOD_DEFINE( rettype, name, args, shortargs, defret ) \ + typedef rettype (* name ## Type) args ; \ + name ## Type pfn_ ## name; \ + rettype name args \ + { if (m_ok) return pfn_ ## name shortargs ; return defret; } + +#define wxDL_VOIDMETHOD_DEFINE( name, args, shortargs ) \ + typedef void (* name ## Type) args ; \ + name ## Type pfn_ ## name; \ + void name args \ + { if (m_ok) pfn_ ## name shortargs ; } + +#define wxDL_METHOD_LOAD( lib, name, success ) \ + pfn_ ## name = (name ## Type) lib.GetSymbol( wxT(#name), &success ); \ + if (!success) return false; + +//Class that utilizes Robert Roeblings Dynamic Library Macros +class WXDLLIMPEXP_MEDIA wxQuickTimeLibrary +{ +public: + ~wxQuickTimeLibrary() + { + if(m_dll.IsLoaded()) + m_dll.Unload(); + } + + bool Initialize(); + bool IsOk() const {return m_ok;} + +protected: + wxDynamicLibrary m_dll; + bool m_ok; + +public: + wxDL_VOIDMETHOD_DEFINE( StartMovie, (Movie m), (m) ); + wxDL_VOIDMETHOD_DEFINE( StopMovie, (Movie m), (m) ); + wxDL_METHOD_DEFINE( bool, IsMovieDone, (Movie m), (m), false); + wxDL_VOIDMETHOD_DEFINE( GoToBeginningOfMovie, (Movie m), (m) ); + wxDL_METHOD_DEFINE( OSErr, GetMoviesError, (), (), -1); + wxDL_METHOD_DEFINE( OSErr, EnterMovies, (), (), -1); + wxDL_VOIDMETHOD_DEFINE( ExitMovies, (), () ); + wxDL_METHOD_DEFINE( OSErr, InitializeQTML, (long flags), (flags), -1); + wxDL_VOIDMETHOD_DEFINE( TerminateQTML, (), () ); + + wxDL_METHOD_DEFINE( OSErr, NativePathNameToFSSpec, + (char* inName, FSSpec* outFile, long flags), + (inName, outFile, flags), -1); + + wxDL_METHOD_DEFINE( OSErr, OpenMovieFile, + (const FSSpec * fileSpec, short * resRefNum, wxInt8 permission), + (fileSpec, resRefNum, permission), -1 ); + + wxDL_METHOD_DEFINE( OSErr, CloseMovieFile, + (short resRefNum), (resRefNum), -1); + + wxDL_METHOD_DEFINE( OSErr, NewMovieFromFile, + (Movie * theMovie, short resRefNum, short * resId, + StringPtr resName, short newMovieFlags, + bool * dataRefWasChanged), + (theMovie, resRefNum, resId, resName, newMovieFlags, + dataRefWasChanged), -1); + + wxDL_VOIDMETHOD_DEFINE( SetMovieRate, (Movie m, Fixed rate), (m, rate) ); + wxDL_METHOD_DEFINE( Fixed, GetMovieRate, (Movie m), (m), 0); + wxDL_VOIDMETHOD_DEFINE( MoviesTask, (Movie m, long maxms), (m, maxms) ); + wxDL_VOIDMETHOD_DEFINE( BlockMove, + (const char* p1, const char* p2, long s), (p1,p2,s) ); + wxDL_METHOD_DEFINE( Handle, NewHandleClear, (long s), (s), NULL ); + + wxDL_METHOD_DEFINE( OSErr, NewMovieFromDataRef, + (Movie * m, short flags, short * id, + Handle dataRef, OSType dataRefType), + (m,flags,id,dataRef,dataRefType), -1 ); + + wxDL_VOIDMETHOD_DEFINE( DisposeHandle, (Handle h), (h) ); + wxDL_VOIDMETHOD_DEFINE( GetMovieNaturalBoundsRect, (Movie m, Rect* r), (m,r) ); + wxDL_METHOD_DEFINE( void*, GetMovieIndTrackType, + (Movie m, long index, OSType type, long flags), + (m,index,type,flags), NULL ); + wxDL_VOIDMETHOD_DEFINE( CreatePortAssociation, + (void* hWnd, void* junk, long morejunk), (hWnd, junk, morejunk) ); + wxDL_METHOD_DEFINE(void*, GetNativeWindowPort, (void* hWnd), (hWnd), NULL); + wxDL_VOIDMETHOD_DEFINE(SetMovieGWorld, (Movie m, CGrafPtr port, void* whatever), + (m, port, whatever) ); + wxDL_VOIDMETHOD_DEFINE(DisposeMovie, (Movie m), (m) ); + wxDL_VOIDMETHOD_DEFINE(SetMovieBox, (Movie m, Rect* r), (m,r)); + wxDL_VOIDMETHOD_DEFINE(SetMovieTimeScale, (Movie m, long s), (m,s)); + wxDL_METHOD_DEFINE(long, GetMovieDuration, (Movie m), (m), 0); + wxDL_METHOD_DEFINE(TimeBase, GetMovieTimeBase, (Movie m), (m), 0); + wxDL_METHOD_DEFINE(TimeScale, GetMovieTimeScale, (Movie m), (m), 0); + wxDL_METHOD_DEFINE(long, GetMovieTime, (Movie m, void* cruft), (m,cruft), 0); + wxDL_VOIDMETHOD_DEFINE(SetMovieTime, (Movie m, TimeRecord* tr), (m,tr) ); + wxDL_METHOD_DEFINE(short, GetMovieVolume, (Movie m), (m), 0); + wxDL_VOIDMETHOD_DEFINE(SetMovieVolume, (Movie m, short sVolume), (m,sVolume) ); +}; + +bool wxQuickTimeLibrary::Initialize() +{ + m_ok = false; + + if(!m_dll.Load(wxT("qtmlClient.dll"))) + return false; + + bool bOk; + + wxDL_METHOD_LOAD( m_dll, StartMovie, bOk ); + wxDL_METHOD_LOAD( m_dll, StopMovie, bOk ); + wxDL_METHOD_LOAD( m_dll, IsMovieDone, bOk ); + wxDL_METHOD_LOAD( m_dll, GoToBeginningOfMovie, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMoviesError, bOk ); + wxDL_METHOD_LOAD( m_dll, EnterMovies, bOk ); + wxDL_METHOD_LOAD( m_dll, ExitMovies, bOk ); + wxDL_METHOD_LOAD( m_dll, InitializeQTML, bOk ); + wxDL_METHOD_LOAD( m_dll, TerminateQTML, bOk ); + wxDL_METHOD_LOAD( m_dll, NativePathNameToFSSpec, bOk ); + wxDL_METHOD_LOAD( m_dll, OpenMovieFile, bOk ); + wxDL_METHOD_LOAD( m_dll, CloseMovieFile, bOk ); + wxDL_METHOD_LOAD( m_dll, NewMovieFromFile, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieRate, bOk ); + wxDL_METHOD_LOAD( m_dll, SetMovieRate, bOk ); + wxDL_METHOD_LOAD( m_dll, MoviesTask, bOk ); + wxDL_METHOD_LOAD( m_dll, BlockMove, bOk ); + wxDL_METHOD_LOAD( m_dll, NewHandleClear, bOk ); + wxDL_METHOD_LOAD( m_dll, NewMovieFromDataRef, bOk ); + wxDL_METHOD_LOAD( m_dll, DisposeHandle, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieNaturalBoundsRect, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieIndTrackType, bOk ); + wxDL_METHOD_LOAD( m_dll, CreatePortAssociation, bOk ); + wxDL_METHOD_LOAD( m_dll, GetNativeWindowPort, bOk ); + wxDL_METHOD_LOAD( m_dll, SetMovieGWorld, bOk ); + wxDL_METHOD_LOAD( m_dll, DisposeMovie, bOk ); + wxDL_METHOD_LOAD( m_dll, SetMovieBox, bOk ); + wxDL_METHOD_LOAD( m_dll, SetMovieTimeScale, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieDuration, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieTimeBase, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieTimeScale, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieTime, bOk ); + wxDL_METHOD_LOAD( m_dll, SetMovieTime, bOk ); + wxDL_METHOD_LOAD( m_dll, GetMovieVolume, bOk ); + wxDL_METHOD_LOAD( m_dll, SetMovieVolume, bOk ); + + m_ok = true; + + return true; +} class WXDLLIMPEXP_MEDIA wxQTMediaBackend : public wxMediaBackend { @@ -873,22 +1071,23 @@ public: virtual double GetPlaybackRate(); virtual bool SetPlaybackRate(double dRate); + virtual double GetVolume(); + virtual bool SetVolume(double); + void Cleanup(); void FinishLoad(); wxSize m_bestSize; //Original movie size - struct MovieRecord* m_movie; //QT Movie handle/instance + Movie m_movie; //QT Movie handle/instance wxControl* m_ctrl; //Parent control bool m_bVideo; //Whether or not we have video class _wxQTTimer* m_timer; //Timer for streaming the movie + wxQuickTimeLibrary m_lib; - DECLARE_DYNAMIC_CLASS(wxQTMediaBackend); + + DECLARE_DYNAMIC_CLASS(wxQTMediaBackend) }; -//--------------------------------------------------------------------------- -// End QT Compilation Guard -//--------------------------------------------------------------------------- -#endif //wxUSE_QUICKTIME //=========================================================================== // IMPLEMENTATION @@ -900,11 +1099,6 @@ public: // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//--------------------------------------------------------------------------- -// Only use if user wants it - -//--------------------------------------------------------------------------- -#if wxUSE_DIRECTSHOW - IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend); // Numerical value for when the graph reaches the stop position @@ -1096,11 +1290,9 @@ bool wxAMMediaBackend::Load(const wxString& fileName) return false; } - ::SetWindowLongPtr(m_hNotifyWnd, GWLP_WNDPROC, - (LONG_PTR)wxAMMediaBackend::NotifyWndProc); + wxSetWindowProc(m_hNotifyWnd, wxAMMediaBackend::NotifyWndProc); + wxSetWindowUserData(m_hNotifyWnd, (void*)this); - ::SetWindowLong(m_hNotifyWnd, GWL_USERDATA, - (LONG) this); wxAMVERIFY( m_pME->SetNotifyWindow((LONG_PTR)m_hNotifyWnd, WM_GRAPHNOTIFY, 0) ); @@ -1114,6 +1306,7 @@ bool wxAMMediaBackend::Load(const wxString& fileName) m_ctrl->GetParent()->Layout(); m_ctrl->GetParent()->Refresh(); m_ctrl->GetParent()->Update(); + m_ctrl->SetSize(m_ctrl->GetSize()); return true; } @@ -1179,7 +1372,7 @@ bool wxAMMediaBackend::SetPosition(wxLongLong where) { return SUCCEEDED( m_pMS->put_CurrentPosition( ((LONGLONG)where.GetValue()) / 1000 - ) + ) ); } @@ -1195,7 +1388,38 @@ wxLongLong wxAMMediaBackend::GetPosition() wxAMVERIFY( m_pMS->get_CurrentPosition(&outCur) ); //h,m,s,milli - outdur is in 1 second (double) - return (outCur*1000); + outCur *= 1000; + wxLongLong ll; + ll.Assign(outCur); + + return ll; +} + +//--------------------------------------------------------------------------- +// wxAMMediaBackend::SetVolume +// +// Sets the volume through the IBasicAudio interface - +// value ranges from 0 (MAX volume) to -10000 (minimum volume). +// -100 per decibel. +//--------------------------------------------------------------------------- +bool wxAMMediaBackend::SetVolume(double dVolume) +{ + return SUCCEEDED(m_pBA->put_Volume( (long) ((dVolume-1.0) * 10000.0) )); +} + +//--------------------------------------------------------------------------- +// wxAMMediaBackend::GetVolume +// +// Gets the volume through the IBasicAudio interface - +// value ranges from 0 (MAX volume) to -10000 (minimum volume). +// -100 per decibel. +//--------------------------------------------------------------------------- +double wxAMMediaBackend::GetVolume() +{ + long lVolume; + if ( SUCCEEDED(m_pBA->get_Volume(&lVolume)) ) + return (((double)(lVolume + 10000)) / 10000.0); + return 0.0; } //--------------------------------------------------------------------------- @@ -1210,7 +1434,11 @@ wxLongLong wxAMMediaBackend::GetDuration() wxAMVERIFY( m_pMS->get_Duration(&outDuration) ); //h,m,s,milli - outdur is in 1 second (double) - return (outDuration*1000); + outDuration *= 1000; + wxLongLong ll; + ll.Assign(outDuration); + + return ll; } //--------------------------------------------------------------------------- @@ -1224,12 +1452,15 @@ wxLongLong wxAMMediaBackend::GetDuration() //--------------------------------------------------------------------------- wxMediaState wxAMMediaBackend::GetState() { - HRESULT hr; long theState; //OAFilterState - hr = m_pMC->GetState(INFINITE, &theState); + HRESULT hr = m_pMC->GetState(INFINITE, &theState); wxASSERT( SUCCEEDED(hr) ); +#ifndef __WXDEBUG__ + wxUnusedVar(hr); +#endif + //MSW state is the same as ours //State_Stopped = 0, //State_Paused = State_Stopped + 1, @@ -1343,7 +1574,7 @@ void wxAMMediaBackend::Cleanup() if(m_pVW) { m_pVW->put_Visible(0); //OSFALSE == 0 - m_pVW->put_Owner(NULL); + m_pVW->put_Owner(0); } // Release and zero DirectShow interfaces @@ -1386,7 +1617,6 @@ void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h) //--------------------------------------------------------------------------- // End of wxAMMediaBackend //--------------------------------------------------------------------------- -#endif //wxUSE_DIRECTSHOW //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // @@ -1455,6 +1685,15 @@ typedef struct { DWORD dwSpeed; } MCI_DGV_SET_PARMS; +typedef struct { + DWORD_PTR dwCallback; + DWORD dwItem; + DWORD dwValue; + DWORD dwOver; + wxChar* lpstrAlgorithm; + wxChar* lpstrQuality; +} MCI_DGV_SETAUDIO_PARMS; + //--------------------------------------------------------------------------- // wxMCIMediaBackend Constructor // @@ -1591,14 +1830,11 @@ bool wxMCIMediaBackend::Load(const wxString& fileName) return false; } - ::SetWindowLong(m_hNotifyWnd, GWL_WNDPROC, - (LONG)wxMCIMediaBackend::NotifyWndProc); + wxSetWindowProc(m_hNotifyWnd, wxMCIMediaBackend::NotifyWndProc); ::SetWindowLong(m_hNotifyWnd, GWL_USERDATA, (LONG) this); - m_ctrl->Show(false); - // //Here, if the parent of the control has a sizer - we //tell it to recalculate the size of this control since @@ -1608,6 +1844,7 @@ bool wxMCIMediaBackend::Load(const wxString& fileName) m_ctrl->GetParent()->Layout(); m_ctrl->GetParent()->Refresh(); m_ctrl->GetParent()->Update(); + m_ctrl->SetSize(m_ctrl->GetSize()); return true; } @@ -1745,6 +1982,48 @@ wxLongLong wxMCIMediaBackend::GetPosition() return statusParms.dwReturn; } +//--------------------------------------------------------------------------- +// wxMCIMediaBackend::GetVolume +// +// Gets the volume of the current media via the MCI_DGV_STATUS_VOLUME +// message. Value ranges from 0 (minimum) to 1000 (maximum volume). +//--------------------------------------------------------------------------- +double wxMCIMediaBackend::GetVolume() +{ + MCI_STATUS_PARMS statusParms; + statusParms.dwCallback = 0; + statusParms.dwItem = 0x4019; //MCI_DGV_STATUS_VOLUME + + if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, + (DWORD)(LPSTR)&statusParms) != 0) + return 0; + + return ((double)statusParms.dwReturn) / 1000.0; +} + +//--------------------------------------------------------------------------- +// wxMCIMediaBackend::SetVolume +// +// Sets the volume of the current media via the MCI_DGV_SETAUDIO_VOLUME +// message. Value ranges from 0 (minimum) to 1000 (maximum volume). +//--------------------------------------------------------------------------- +bool wxMCIMediaBackend::SetVolume(double dVolume) +{ + MCI_DGV_SETAUDIO_PARMS audioParms; + audioParms.dwCallback = 0; + audioParms.dwItem = 0x4002; //MCI_DGV_SETAUDIO_VOLUME + audioParms.dwValue = (DWORD) (dVolume * 1000.0); + audioParms.dwOver = 0; + audioParms.lpstrAlgorithm = NULL; + audioParms.lpstrQuality = NULL; + + if (mciSendCommand(m_hDev, 0x0873, //MCI_SETAUDIO + 0x00800000L | 0x01000000L, //MCI_DGV_SETAUDIO+(_ITEM | _VALUE) + (DWORD)(LPSTR)&audioParms) != 0) + return false; + return true; +} + //--------------------------------------------------------------------------- // wxMCIMediaBackend::GetDuration // @@ -1773,14 +2052,19 @@ void wxMCIMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), if (m_hNotifyWnd && m_bVideo) { MCI_DGV_RECT_PARMS putParms; //ifdefed MCI_DGV_PUT_PARMS - putParms.rc.top = 0; - putParms.rc.bottom = 0; - putParms.rc.right = w; + memset(&putParms, 0, sizeof(MCI_DGV_RECT_PARMS)); putParms.rc.bottom = h; + putParms.rc.right = w; - wxMCIVERIFY( mciSendCommand(m_hDev, MCI_PUT, + //wxStackWalker will crash and burn here on assert + //and mci doesn't like 0 and 0 for some reason (out of range ) + //so just don't it in that case + if(w || h) + { + wxMCIVERIFY( mciSendCommand(m_hDev, MCI_PUT, 0x00040000L, //MCI_DGV_PUT_DESTINATION (DWORD)(LPSTR)&putParms) ); + } } } @@ -1844,7 +2128,11 @@ LRESULT CALLBACK wxMCIMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg, LPARAM lParam) { wxMCIMediaBackend* backend = (wxMCIMediaBackend*) +#ifdef _WIN32 ::GetWindowLong(hWnd, GWL_USERDATA); +#else + ::GetWindowLongPtr(hWnd, GWLP_USERDATA); +#endif wxASSERT(backend); return backend->OnNotifyWndProc(hWnd, nMsg, wParam, lParam); @@ -1884,8 +2172,6 @@ LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg, // TODO: Dynamically load from qtml.dll //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -#if wxUSE_QUICKTIME - IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend); //Time between timer calls @@ -1899,8 +2185,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend); class _wxQTTimer : public wxTimer { public: - _wxQTTimer(Movie movie, wxQTMediaBackend* parent) : - m_movie(movie), m_bPaused(false), m_parent(parent) + _wxQTTimer(Movie movie, wxQTMediaBackend* parent, wxQuickTimeLibrary* pLib) : + m_movie(movie), m_bPaused(false), m_parent(parent), m_pLib(pLib) { } @@ -1923,8 +2209,8 @@ public: { if (!m_bPaused) { - if(!IsMovieDone(m_movie)) - MoviesTask(m_movie, MOVIE_DELAY); + if(!m_pLib->IsMovieDone(m_movie)) + m_pLib->MoviesTask(m_movie, MOVIE_DELAY); else { wxMediaEvent theEvent(wxEVT_MEDIA_STOP, @@ -1935,7 +2221,7 @@ public: { Stop(); m_parent->Stop(); - wxASSERT(::GetMoviesError() == noErr); + wxASSERT(m_pLib->GetMoviesError() == noErr); //send the event to our child wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED, @@ -1950,6 +2236,7 @@ protected: Movie m_movie; //Our movie instance bool m_bPaused; //Whether we are paused or not wxQTMediaBackend* m_parent; //Backend pointer + wxQuickTimeLibrary* m_pLib; //Interfaces }; //--------------------------------------------------------------------------- @@ -1975,10 +2262,13 @@ wxQTMediaBackend::~wxQTMediaBackend() if(m_timer) Cleanup(); - //Note that ExitMovies() is not neccessary, but - //the docs are fuzzy on whether or not TerminateQTML is - ExitMovies(); - TerminateQTML(); + if(m_lib.IsOk()) + { + //Note that ExitMovies() is not neccessary, but + //the docs are fuzzy on whether or not TerminateQTML is + m_lib.ExitMovies(); + m_lib.TerminateQTML(); + } } //--------------------------------------------------------------------------- @@ -1995,13 +2285,16 @@ bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, const wxValidator& validator, const wxString& name) { - int nError; - if ((nError = InitializeQTML(0)) != noErr) //-2093 no dll + if(!m_lib.Initialize()) + return false; + + int nError = m_lib.InitializeQTML(0); + if (nError != noErr) //-2093 no dll { wxFAIL_MSG(wxString::Format(wxT("Couldn't Initialize Quicktime-%i"), nError)); return false; } - EnterMovies(); + m_lib.EnterMovies(); // // Create window @@ -2033,36 +2326,36 @@ bool wxQTMediaBackend::Load(const wxString& fileName) if(m_timer) Cleanup(); - OSErr err = noErr; short movieResFile; FSSpec sfFile; - if (NativePathNameToFSSpec ((char*) (const char*) fileName.mb_str(), + if (m_lib.NativePathNameToFSSpec ((char*) (const char*) fileName.mb_str(), &sfFile, 0) != noErr) return false; - if (OpenMovieFile (&sfFile, &movieResFile, fsRdPerm) != noErr) + if (m_lib.OpenMovieFile (&sfFile, &movieResFile, fsRdPerm) != noErr) return false; short movieResID = 0; Str255 movieName; - err = NewMovieFromFile ( - &m_movie, - movieResFile, - &movieResID, - movieName, - newMovieActive, - NULL); //wasChanged + OSErr err = m_lib.NewMovieFromFile ( + &m_movie, + movieResFile, + &movieResID, + movieName, + newMovieActive, + NULL + ); //wasChanged - CloseMovieFile (movieResFile); + m_lib.CloseMovieFile (movieResFile); if (err != noErr) return false; FinishLoad(); - return ::GetMoviesError() == noErr; + return m_lib.GetMoviesError() == noErr; } //--------------------------------------------------------------------------- @@ -2077,36 +2370,36 @@ bool wxQTMediaBackend::Load(const wxURI& location) wxString theURI = location.BuildURI(); - OSErr err = noErr; - - Handle theHandle = NewHandleClear(theURI.length() + 1); + Handle theHandle = m_lib.NewHandleClear(theURI.length() + 1); wxASSERT(theHandle); - BlockMove(theURI.mb_str(), *theHandle, theURI.length() + 1); + m_lib.BlockMove(theURI.mb_str(), *theHandle, theURI.length() + 1); //create the movie from the handle that refers to the URI - err = NewMovieFromDataRef(&m_movie, newMovieActive, + OSErr err = m_lib.NewMovieFromDataRef(&m_movie, newMovieActive, NULL, theHandle, URLDataHandlerSubType); - DisposeHandle(theHandle); + m_lib.DisposeHandle(theHandle); if (err != noErr) return false; //preroll movie for streaming //TODO:Async this? - TimeValue timeNow; + /* + TimeValue timeNow; Fixed playRate; timeNow = GetMovieTime(m_movie, NULL); playRate = GetMoviePreferredRate(m_movie); PrePrerollMovie(m_movie, timeNow, playRate, NULL, NULL); PrerollMovie(m_movie, timeNow, playRate); - SetMovieRate(m_movie, playRate); + m_lib.SetMovieRate(m_movie, playRate); +*/ FinishLoad(); - return ::GetMoviesError() == noErr; + return m_lib.GetMoviesError() == noErr; } //--------------------------------------------------------------------------- @@ -2116,33 +2409,34 @@ bool wxQTMediaBackend::Load(const wxURI& location) //--------------------------------------------------------------------------- void wxQTMediaBackend::FinishLoad() { - m_timer = new _wxQTTimer(m_movie, (wxQTMediaBackend*) this); + m_timer = new _wxQTTimer(m_movie, (wxQTMediaBackend*) this, &m_lib); wxASSERT(m_timer); //get the real size of the movie Rect outRect; - ::GetMovieNaturalBoundsRect (m_movie, &outRect); - wxASSERT(::GetMoviesError() == noErr); + m_lib.GetMovieNaturalBoundsRect (m_movie, &outRect); + wxASSERT(m_lib.GetMoviesError() == noErr); m_bestSize.x = outRect.right - outRect.left; m_bestSize.y = outRect.bottom - outRect.top; //reparent movie/*AudioMediaCharacteristic*/ - if(GetMovieIndTrackType(m_movie, 1, + if(m_lib.GetMovieIndTrackType(m_movie, 1, VisualMediaCharacteristic, - movieTrackCharacteristic | - movieTrackEnabledOnly) != NULL) + (1 << 1) //movieTrackCharacteristic + | (1 << 2) //movieTrackEnabledOnly + ) != NULL) { - CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L); + m_lib.CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L); - SetMovieGWorld(m_movie, - (CGrafPtr) GetNativeWindowPort(m_ctrl->GetHWND()), - nil); + m_lib.SetMovieGWorld(m_movie, + (CGrafPtr) m_lib.GetNativeWindowPort(m_ctrl->GetHWND()), + NULL); } //we want millisecond precision - ::SetMovieTimeScale(m_movie, 1000); - wxASSERT(::GetMoviesError() == noErr); + m_lib.SetMovieTimeScale(m_movie, 1000); + wxASSERT(m_lib.GetMoviesError() == noErr); // //Here, if the parent of the control has a sizer - we @@ -2162,10 +2456,10 @@ void wxQTMediaBackend::FinishLoad() //--------------------------------------------------------------------------- bool wxQTMediaBackend::Play() { - ::StartMovie(m_movie); + m_lib.StartMovie(m_movie); m_timer->SetPaused(false); m_timer->Start(MOVIE_DELAY, wxTIMER_CONTINUOUS); - return ::GetMoviesError() == noErr; + return m_lib.GetMoviesError() == noErr; } //--------------------------------------------------------------------------- @@ -2175,10 +2469,10 @@ bool wxQTMediaBackend::Play() //--------------------------------------------------------------------------- bool wxQTMediaBackend::Pause() { - ::StopMovie(m_movie); + m_lib.StopMovie(m_movie); m_timer->SetPaused(true); m_timer->Stop(); - return ::GetMoviesError() == noErr; + return m_lib.GetMoviesError() == noErr; } //--------------------------------------------------------------------------- @@ -2191,12 +2485,12 @@ bool wxQTMediaBackend::Stop() m_timer->SetPaused(false); m_timer->Stop(); - ::StopMovie(m_movie); - if(::GetMoviesError() != noErr) + m_lib.StopMovie(m_movie); + if(m_lib.GetMoviesError() != noErr) return false; - ::GoToBeginningOfMovie(m_movie); - return ::GetMoviesError() == noErr; + m_lib.GoToBeginningOfMovie(m_movie); + return m_lib.GetMoviesError() == noErr; } //--------------------------------------------------------------------------- @@ -2206,7 +2500,7 @@ bool wxQTMediaBackend::Stop() //--------------------------------------------------------------------------- double wxQTMediaBackend::GetPlaybackRate() { - return ( ((double)::GetMovieRate(m_movie)) / 0x10000); + return ( ((double)m_lib.GetMovieRate(m_movie)) / 0x10000); } //--------------------------------------------------------------------------- @@ -2216,8 +2510,8 @@ double wxQTMediaBackend::GetPlaybackRate() //--------------------------------------------------------------------------- bool wxQTMediaBackend::SetPlaybackRate(double dRate) { - ::SetMovieRate(m_movie, (Fixed) (dRate * 0x10000)); - return ::GetMoviesError() == noErr; + m_lib.SetMovieRate(m_movie, (Fixed) (dRate * 0x10000)); + return m_lib.GetMoviesError() == noErr; } //--------------------------------------------------------------------------- @@ -2229,12 +2523,12 @@ bool wxQTMediaBackend::SetPosition(wxLongLong where) { TimeRecord theTimeRecord; memset(&theTimeRecord, 0, sizeof(TimeRecord)); - theTimeRecord.value.lo = where.GetValue(); - theTimeRecord.scale = ::GetMovieTimeScale(m_movie); - theTimeRecord.base = ::GetMovieTimeBase(m_movie); - ::SetMovieTime(m_movie, &theTimeRecord); + theTimeRecord.value.lo = where.GetLo(); + theTimeRecord.scale = m_lib.GetMovieTimeScale(m_movie); + theTimeRecord.base = m_lib.GetMovieTimeBase(m_movie); + m_lib.SetMovieTime(m_movie, &theTimeRecord); - if (::GetMoviesError() != noErr) + if (m_lib.GetMoviesError() != noErr) return false; return true; @@ -2248,7 +2542,54 @@ bool wxQTMediaBackend::SetPosition(wxLongLong where) //--------------------------------------------------------------------------- wxLongLong wxQTMediaBackend::GetPosition() { - return ::GetMovieTime(m_movie, NULL); + return m_lib.GetMovieTime(m_movie, NULL); +} + +//--------------------------------------------------------------------------- +// wxQTMediaBackend::GetVolume +// +// Gets the volume through GetMovieVolume - which returns a 16 bit short - +// +// +--------+--------+ +// + (1) + (2) + +// +--------+--------+ +// +// (1) first 8 bits are value before decimal +// (2) second 8 bits are value after decimal +// +// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to +// 1 (full gain and sound) +//--------------------------------------------------------------------------- +double wxQTMediaBackend::GetVolume() +{ + short sVolume = m_lib.GetMovieVolume(m_movie); + + if(sVolume & (128 << 8)) //negative - no sound + return 0.0; + + return (sVolume & (127 << 8)) ? 1.0 : ((double)(sVolume & 255)) / 255.0; +} + +//--------------------------------------------------------------------------- +// wxQTMediaBackend::SetVolume +// +// Sets the volume through SetMovieVolume - which takes a 16 bit short - +// +// +--------+--------+ +// + (1) + (2) + +// +--------+--------+ +// +// (1) first 8 bits are value before decimal +// (2) second 8 bits are value after decimal +// +// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to +// 1 (full gain and sound) +//--------------------------------------------------------------------------- +bool wxQTMediaBackend::SetVolume(double dVolume) +{ + short sVolume = (short) (dVolume >= .9999 ? 1 << 8 : (dVolume * 255) ); + m_lib.SetMovieVolume(m_movie, sVolume); + return true; } //--------------------------------------------------------------------------- @@ -2258,7 +2599,7 @@ wxLongLong wxQTMediaBackend::GetPosition() //--------------------------------------------------------------------------- wxLongLong wxQTMediaBackend::GetDuration() { - return ::GetMovieDuration(m_movie); + return m_lib.GetMovieDuration(m_movie); } //--------------------------------------------------------------------------- @@ -2288,8 +2629,8 @@ void wxQTMediaBackend::Cleanup() delete m_timer; m_timer = NULL; - StopMovie(m_movie); - DisposeMovie(m_movie); + m_lib.StopMovie(m_movie); + m_lib.DisposeMovie(m_movie); } //--------------------------------------------------------------------------- @@ -2307,21 +2648,20 @@ wxSize wxQTMediaBackend::GetVideoSize() const // // TODO //--------------------------------------------------------------------------- -void wxQTMediaBackend::Move(int x, int y, int w, int h) +void wxQTMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h) { if(m_timer) { - Rect theRect = {0, 0, h, w}; + Rect theRect = {0, 0, (short)h, (short)w}; - ::SetMovieBox(m_movie, &theRect); - wxASSERT(::GetMoviesError() == noErr); + m_lib.SetMovieBox(m_movie, &theRect); + wxASSERT(m_lib.GetMoviesError() == noErr); } } //--------------------------------------------------------------------------- -// End QT Compilation Guard +// End QT Backend //--------------------------------------------------------------------------- -#endif //wxUSE_QUICKTIME //in source file that contains stuff you don't directly use #include