X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1ec2381a21248f183028ff2ea1ad5855966d641..c12822fec7f87e7734cabbfcf23b99685fc371ce:/src/msw/mediactrl.cpp?ds=sidebyside diff --git a/src/msw/mediactrl.cpp b/src/msw/mediactrl.cpp index bfad1da456..193d300664 100644 --- a/src/msw/mediactrl.cpp +++ b/src/msw/mediactrl.cpp @@ -27,59 +27,56 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif -//--------------------------------------------------------------------------- -// MediaCtrl include -//--------------------------------------------------------------------------- +#if wxUSE_MEDIACTRL + #include "wx/mediactrl.h" -//--------------------------------------------------------------------------- -// Compilation guard -//--------------------------------------------------------------------------- -#if wxUSE_MEDIACTRL +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/dcclient.h" + #include "wx/timer.h" + #include "wx/math.h" // log10 & pow +#endif -//--------------------------------------------------------------------------- -// WX Includes -//--------------------------------------------------------------------------- -#include "wx/log.h" //wxLogDebug -#include "wx/math.h" //log10 & pow -#include "wx/msw/private.h" //user info and wndproc setting/getting -#include "wx/dcclient.h" -#include "wx/timer.h" +#include "wx/msw/private.h" // user info and wndproc setting/getting #include "wx/dynlib.h" //--------------------------------------------------------------------------- // Externals (somewhere in src/msw/app.cpp and src/msw/window.cpp) //--------------------------------------------------------------------------- extern "C" WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(void); -#ifdef __WXWINCE__ -extern WXDLLIMPEXP_CORE wxChar *wxCanvasClassName; -#else extern WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName; -#endif LRESULT WXDLLIMPEXP_CORE APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +//--------------------------------------------------------------------------- +// Killed MSVC warnings +//--------------------------------------------------------------------------- +//disable "cast truncates constant value" for VARIANT_BOOL values +//passed as parameters in VC5 and up +#ifdef _MSC_VER +#pragma warning (disable:4310) +#endif + //=========================================================================== -// BACKEND DECLARATIONS +// BACKEND DECLARATIONS //=========================================================================== //--------------------------------------------------------------------------- -// -// wxAMMediaBackend -// +// wxAMMediaBackend //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- -// wxActiveXContainer - includes all the COM-specific stuff we need +// wxActiveXContainer - includes all the COM-specific stuff we need //--------------------------------------------------------------------------- #include "wx/msw/ole/activex.h" //--------------------------------------------------------------------------- -// IIDS - used by CoCreateInstance and IUnknown::QueryInterface +// IIDS - used by CoCreateInstance and IUnknown::QueryInterface // // [idl name] [idl decription] // amcompat.idl Microsoft Active Movie Control (Ver 2.0) @@ -87,22 +84,25 @@ LRESULT WXDLLIMPEXP_CORE APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, // msdxm.idl Windows Media Player (Ver 1.0) // quartz.idl // -// First, when I say I "from XXX.idl", I mean I go into the COM Browser -// ($Microsoft Visual Studio$/Common/Tools/OLEVIEW.EXE), open -// "type libraries", open a specific type library (for quartz for example its -// "ActiveMovie control type library (V1.0)"), save it as an .idl, compile the -// idl using the midl compiler that comes with visual studio -// ($Microsoft Visual Studio$/VC98/bin/midl.exe on VC6) with the /h argument -// to make it generate stubs (a .h & .c file), then clean up the generated -// interfaces I want with the STDMETHOD wrappers and then put them into -// mediactrl.cpp. +// First, when I say I "from XXX.idl", I mean I go into the COM Browser +// ($Microsoft Visual Studio$/Common/Tools/OLEVIEW.EXE), open +// "type libraries", open a specific type library (for quartz for example its +// "ActiveMovie control type library (V1.0)"), save it as an .idl, compile the +// idl using the midl compiler that comes with visual studio +// ($Microsoft Visual Studio$/VC98/bin/midl.exe on VC6) with the /h argument +// to make it generate stubs (a .h & .c file), then clean up the generated +// interfaces I want with the STDMETHOD wrappers and then put them into +// mediactrl.cpp. +// +// According to the MSDN docs, IMediaPlayer requires Windows 98 SE +// or greater. NetShow is available on Windows 3.1 and I'm guessing +// IActiveMovie is too. IMediaPlayer is essentially the Windows Media +// Player 6.4 SDK. // -// According to the MSDN docs, IMediaPlayer requires Windows 98 SE -// or greater. NetShow is available on Windows 3.1 and I'm guessing -// IActiveMovie is too. IMediaPlayer is essentially the Windows Media -// Player 6.4 SDK. +// IWMP is from PlayerOCX.idl on PocketPC 2000, which uses CLSID_MediaPlayer +// as well as the main windows line. // -// Some of these are not used but are kept here for future reference anyway +// Some of these are not used but are kept here for future reference anyway //--------------------------------------------------------------------------- const IID IID_IActiveMovie = {0x05589FA2,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}}; const IID IID_IActiveMovie2 = {0xB6CD6554,0xE9CB,0x11D0,{0x82,0x1F,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}}; @@ -115,6 +115,8 @@ const IID IID_INSPlay1 = {0x265EC141,0xAE62,0x11D1,{0x85,0x00,0x00, const IID IID_IMediaPlayer = {0x22D6F311,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}}; const IID IID_IMediaPlayer2 = {0x20D4F5E0,0x5475,0x11D2,{0x97,0x74,0x00,0x00,0xF8,0x08,0x55,0xE6}}; +const IID IID_IWMP = {0x136B66EC,0xF30D,0x46A8,{0x88,0xDD,0xF2,0xD0,0x55,0x16,0x3E,0x49}}; + const CLSID CLSID_ActiveMovie = {0x05589FA1,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}}; const CLSID CLSID_MediaPlayer = {0x22D6F312,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}}; const CLSID CLSID_NSPlay = {0x2179C5D3,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}}; @@ -154,7 +156,7 @@ struct IMediaEvent : public IDispatch }; //--------------------------------------------------------------------------- -// ACTIVEMOVIE COM INTERFACES (dumped from amcompat.idl from MSVC COM Browser) +// ACTIVEMOVIE COM INTERFACES (dumped from amcompat.idl from MSVC COM Browser) //--------------------------------------------------------------------------- enum ReadyStateConstants @@ -737,6 +739,564 @@ struct INSPlay1 : public INSPlay STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE; }; +//--------------------------------------------------------------------------- +// IWMP (PocketPC 2000) COM INTERFACES (dumped from PlayerOCX.idl) +//--------------------------------------------------------------------------- + +struct IWMP : public IDispatch +{ +public: + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoSize( + /* [in] */ VARIANT_BOOL vbool) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoSize( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_BorderStyle( + /* [in] */ long style) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_BorderStyle( + /* [retval][out] */ long __RPC_FAR *pstyle) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Enabled( + /* [in] */ VARIANT_BOOL vbool) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Enabled( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_FileName( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_FileName( + /* [in] */ BSTR newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Volume( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Volume( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Mute( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Mute( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoStart( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoStart( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayCount( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PlayCount( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowStatusBar( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowStatusBar( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowAudioControls( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowAudioControls( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowCaptioning( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowCaptioning( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowControls( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowControls( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowDisplay( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowDisplay( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowGotoBar( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowGotoBar( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowPositionControls( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowPositionControls( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowTracker( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowTracker( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Startup( void ) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Shutdown( void ) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bandwidth( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BaseURL( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_BaseURL( + /* [in] */ BSTR pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingCount( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingProgress( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingTime( + /* [retval][out] */ double __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeek( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeekToMarkers( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelDescription( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelName( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelURL( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClientID( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ConnectionSpeed( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactAddress( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactEmail( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactPhone( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentMarker( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentMarker( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentPosition( + /* [retval][out] */ double __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentPosition( + /* [in] */ double newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DefaultFrame( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DefaultFrame( + /* [in] */ BSTR newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration( + /* [retval][out] */ double __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EntryCount( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCode( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorDescription( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasError( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasMultipleItems( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceHeight( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceWidth( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InvokeURLs( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_InvokeURLs( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsBroadcast( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsDurationValid( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_LostPackets( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MarkerCount( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OpenState( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayState( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PreviewMode( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PreviewMode( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReadyState( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceivedPackets( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceptionQuality( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_RecoveredPackets( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIFileName( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIFileName( + /* [in] */ BSTR newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMILang( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMILang( + /* [in] */ BSTR newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIStyle( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIStyle( + /* [in] */ BSTR newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionEnd( + /* [retval][out] */ double __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionEnd( + /* [in] */ double newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionStart( + /* [retval][out] */ double __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionStart( + /* [in] */ double newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendErrorEvents( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendErrorEvents( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendKeyboardEvents( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendKeyboardEvents( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseClickEvents( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseClickEvents( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseMoveEvents( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseMoveEvents( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendOpenStateChangeEvents( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendOpenStateChangeEvents( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendPlayStateChangeEvents( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendPlayStateChangeEvents( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendWarningEvents( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendWarningEvents( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceLink( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AboutBox( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Cancel( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecDescription( + /* [in] */ long nCodec, + /* [retval][out] */ BSTR __RPC_FAR *pDescription) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecInstalled( + /* [in] */ BSTR __RPC_FAR *pstrCodec, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pIsInstalled) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCurrentEntry( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerName( + /* [in] */ long nMarker, + /* [retval][out] */ BSTR __RPC_FAR *pMarkerName) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerTime( + /* [in] */ long nMarker, + /* [retval][out] */ double __RPC_FAR *pMarkerTime) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaInfoString( + /* [in] */ long MPMediaInfoType, + /* [retval][out] */ BSTR __RPC_FAR *pstrMediaInfo) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Next( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Open( + BSTR pstrClip) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Play( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Previous( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Rate( + /* [retval][out] */ double __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Rate( + /* [in] */ double newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplaySize( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplaySize( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceProtocol( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCorrection( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FinalConstruct( void) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowChangeDisplaySize( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowChangeDisplaySize( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowScan( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowScan( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AnimationAtStart( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AnimationAtStart( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStream( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AudioStream( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoRewind( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoRewind( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Balance( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Balance( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanPreview( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanScan( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CaptioningID( + /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClickToPlay( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ClickToPlay( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CodecCount( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CreationDate( + /* [retval][out] */ DATE __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CursorType( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CursorType( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayBackColor( + /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayBackColor( + /* [in] */ VB_OLE_COLOR newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayForeColor( + /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayForeColor( + /* [in] */ VB_OLE_COLOR newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayMode( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayMode( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableContextMenu( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableContextMenu( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableFullScreenControls( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableFullScreenControls( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnablePositionControls( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnablePositionControls( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableTracker( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableTracker( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Language( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamCount( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TransparentAtStart( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_TransparentAtStart( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorder3D( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorder3D( + /* [in] */ VARIANT_BOOL newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderColor( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderColor( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderWidth( + /* [retval][out] */ long __RPC_FAR *pVal) = 0; + + virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderWidth( + /* [in] */ long newVal) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastForward( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastReverse( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecURL( + /* [retval][out] */ BSTR __RPC_FAR *pstrCodecURL) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameter( + /* [in] */ long nParam, + BSTR szParameterName, + /* [retval][out] */ BSTR __RPC_FAR *pstrParameterValue) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameterName( + /* [in] */ long nParam, + long nIndex, + /* [retval][out] */ BSTR __RPC_FAR *pstrParameterName) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMoreInfoURL( + /* [retval][out] */ BSTR __RPC_FAR *pstrMoreInfoURL) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamGroup( + /* [retval][out] */ BSTR __RPC_FAR *pstrStreamGroup) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamName( + /* [retval][out] */ BSTR __RPC_FAR *pstrStreamName) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamSelected( + /* [in] */ long nStream, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsSelected) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsSoundCardEnabled( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsEnabled) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetCurrentEntry( + long nValue) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ShowDialog( + long nValue) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE StreamSelect( + long nSelect) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnWindowMessage( + UINT msg, + WPARAM wParam, + LPARAM lParam, + LRESULT __RPC_FAR *plResult) = 0; +}; + //--------------------------------------------------------------------------- // MISC COM INTERFACES //--------------------------------------------------------------------------- @@ -900,9 +1460,23 @@ public: return total; } + // WinCE helpers + wxActiveXContainer* m_pAX; + +#ifdef __WXWINCE__ + IWMP* m_pWMP; + + IWMP* GetMP() { return m_pWMP; } + IWMP* GetAM() { return m_pWMP; } +#else IActiveMovie* m_pAM; IMediaPlayer* m_pMP; + + IMediaPlayer* GetMP() { return m_pMP; } + IActiveMovie* GetAM() { return m_pAM; } +#endif + wxTimer* m_pTimer; wxSize m_bestSize; @@ -916,9 +1490,7 @@ public: }; //--------------------------------------------------------------------------- -// // wxMCIMediaBackend -// //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- @@ -930,9 +1502,8 @@ public: class WXDLLIMPEXP_MEDIA wxMCIMediaBackend : public wxMediaBackendCommonBase { public: - wxMCIMediaBackend(); - ~wxMCIMediaBackend(); + virtual ~wxMCIMediaBackend(); virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, wxWindowID id, @@ -983,7 +1554,6 @@ public: #endif //--------------------------------------------------------------------------- -// // wxQTMediaBackend // // We don't include Quicktime headers here and define all the types @@ -997,8 +1567,8 @@ public: //--------------------------------------------------------------------------- // QT Includes //--------------------------------------------------------------------------- -//#include //Windoze QT include -//#include //Standard QT stuff +//#include // Windoze QT include +//#include // Standard QT stuff #include "wx/dynlib.h" //--------------------------------------------------------------------------- @@ -1079,7 +1649,8 @@ struct EventRecord wxUint16 modifiers; }; -enum { +enum +{ mcTopLeftMovie = 1, mcScaleMovieToFit = 2, mcWithBadge = 4, @@ -1090,22 +1661,6 @@ enum { //--------------------------------------------------------------------------- // QT Library //--------------------------------------------------------------------------- -#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) { wxLog::EnableLogging(bWasLoggingEnabled); return false; } - class WXDLLIMPEXP_MEDIA wxQuickTimeLibrary { @@ -1189,7 +1744,6 @@ public: wxDL_VOIDMETHOD_DEFINE(DisposeMovieController, (ComponentInstance ci), (ci)); wxDL_METHOD_DEFINE(int, MCSetVisible, (ComponentInstance m, int b), (m, b), 0); - wxDL_VOIDMETHOD_DEFINE(PrePrerollMovie, (Movie m, long t, Fixed r, WXFARPROC p1, void* p2), (m,t,r,p1,p2) ); wxDL_VOIDMETHOD_DEFINE(PrerollMovie, (Movie m, long t, Fixed r), (m,t,r) ); wxDL_METHOD_DEFINE(Fixed, GetMoviePreferredRate, (Movie m), (m), 0); @@ -1217,84 +1771,78 @@ public: bool wxQuickTimeLibrary::Initialize() { - m_ok = false; - - // Turn off the wxDynamicLibrary logging - bool bWasLoggingEnabled = wxLog::EnableLogging(false); + // Turn off the wxDynamicLibrary logging as we're prepared to handle the + // errors + wxLogNull nolog; - if (!m_dll.Load(wxT("qtmlClient.dll"))) - { - wxLog::EnableLogging(bWasLoggingEnabled); + m_ok = m_dll.Load(wxT("qtmlClient.dll")); + if ( !m_ok ) return false; - } - - wxDL_METHOD_LOAD( m_dll, StartMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, StopMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, IsMovieDone, m_ok ); - wxDL_METHOD_LOAD( m_dll, GoToBeginningOfMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMoviesError, m_ok ); - wxDL_METHOD_LOAD( m_dll, EnterMovies, m_ok ); - wxDL_METHOD_LOAD( m_dll, ExitMovies, m_ok ); - wxDL_METHOD_LOAD( m_dll, InitializeQTML, m_ok ); - wxDL_METHOD_LOAD( m_dll, TerminateQTML, m_ok ); - wxDL_METHOD_LOAD( m_dll, NativePathNameToFSSpec, m_ok ); - wxDL_METHOD_LOAD( m_dll, OpenMovieFile, m_ok ); - wxDL_METHOD_LOAD( m_dll, CloseMovieFile, m_ok ); - wxDL_METHOD_LOAD( m_dll, NewMovieFromFile, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieRate, m_ok ); - wxDL_METHOD_LOAD( m_dll, SetMovieRate, m_ok ); - wxDL_METHOD_LOAD( m_dll, MoviesTask, m_ok ); - wxDL_METHOD_LOAD( m_dll, BlockMove, m_ok ); - wxDL_METHOD_LOAD( m_dll, NewHandleClear, m_ok ); - wxDL_METHOD_LOAD( m_dll, NewMovieFromDataRef, m_ok ); - wxDL_METHOD_LOAD( m_dll, DisposeHandle, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieNaturalBoundsRect, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieIndTrackType, m_ok ); - wxDL_METHOD_LOAD( m_dll, CreatePortAssociation, m_ok ); - wxDL_METHOD_LOAD( m_dll, DestroyPortAssociation, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetNativeWindowPort, m_ok ); - wxDL_METHOD_LOAD( m_dll, SetMovieGWorld, m_ok ); - wxDL_METHOD_LOAD( m_dll, DisposeMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, SetMovieBox, m_ok ); - wxDL_METHOD_LOAD( m_dll, SetMovieTimeScale, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieDuration, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieTimeBase, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieTimeScale, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieTime, m_ok ); - wxDL_METHOD_LOAD( m_dll, SetMovieTime, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieVolume, m_ok ); - wxDL_METHOD_LOAD( m_dll, SetMovieVolume, m_ok ); - wxDL_METHOD_LOAD( m_dll, SetMovieTimeValue, m_ok ); - wxDL_METHOD_LOAD( m_dll, NewMovieController, m_ok ); - wxDL_METHOD_LOAD( m_dll, DisposeMovieController, m_ok ); - wxDL_METHOD_LOAD( m_dll, MCSetVisible, m_ok ); - wxDL_METHOD_LOAD( m_dll, PrePrerollMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, PrerollMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMoviePreferredRate, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMovieLoadState, m_ok ); - wxDL_METHOD_LOAD( m_dll, MCDoAction, m_ok ); - wxDL_METHOD_LOAD( m_dll, MCSetControllerBoundsRect, m_ok ); - wxDL_METHOD_LOAD( m_dll, NativeEventToMacEvent, m_ok ); - wxDL_METHOD_LOAD( m_dll, MCIsPlayerEvent, m_ok ); - wxDL_METHOD_LOAD( m_dll, MCSetMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, MCSetActionFilterWithRefCon, m_ok ); - wxDL_METHOD_LOAD( m_dll, MCGetControllerInfo, m_ok ); - wxDL_METHOD_LOAD( m_dll, BeginUpdate, m_ok ); - wxDL_METHOD_LOAD( m_dll, UpdateMovie, m_ok ); - wxDL_METHOD_LOAD( m_dll, EndUpdate, m_ok ); - wxDL_METHOD_LOAD( m_dll, GetMoviesStickyError, m_ok ); - - wxLog::EnableLogging(bWasLoggingEnabled); - m_ok = true; - return true; + wxDL_METHOD_LOAD( m_dll, StartMovie ); + wxDL_METHOD_LOAD( m_dll, StopMovie ); + wxDL_METHOD_LOAD( m_dll, IsMovieDone ); + wxDL_METHOD_LOAD( m_dll, GoToBeginningOfMovie ); + wxDL_METHOD_LOAD( m_dll, GetMoviesError ); + wxDL_METHOD_LOAD( m_dll, EnterMovies ); + wxDL_METHOD_LOAD( m_dll, ExitMovies ); + wxDL_METHOD_LOAD( m_dll, InitializeQTML ); + wxDL_METHOD_LOAD( m_dll, TerminateQTML ); + wxDL_METHOD_LOAD( m_dll, NativePathNameToFSSpec ); + wxDL_METHOD_LOAD( m_dll, OpenMovieFile ); + wxDL_METHOD_LOAD( m_dll, CloseMovieFile ); + wxDL_METHOD_LOAD( m_dll, NewMovieFromFile ); + wxDL_METHOD_LOAD( m_dll, GetMovieRate ); + wxDL_METHOD_LOAD( m_dll, SetMovieRate ); + wxDL_METHOD_LOAD( m_dll, MoviesTask ); + wxDL_METHOD_LOAD( m_dll, BlockMove ); + wxDL_METHOD_LOAD( m_dll, NewHandleClear ); + wxDL_METHOD_LOAD( m_dll, NewMovieFromDataRef ); + wxDL_METHOD_LOAD( m_dll, DisposeHandle ); + wxDL_METHOD_LOAD( m_dll, GetMovieNaturalBoundsRect ); + wxDL_METHOD_LOAD( m_dll, GetMovieIndTrackType ); + wxDL_METHOD_LOAD( m_dll, CreatePortAssociation ); + wxDL_METHOD_LOAD( m_dll, DestroyPortAssociation ); + wxDL_METHOD_LOAD( m_dll, GetNativeWindowPort ); + wxDL_METHOD_LOAD( m_dll, SetMovieGWorld ); + wxDL_METHOD_LOAD( m_dll, DisposeMovie ); + wxDL_METHOD_LOAD( m_dll, SetMovieBox ); + wxDL_METHOD_LOAD( m_dll, SetMovieTimeScale ); + wxDL_METHOD_LOAD( m_dll, GetMovieDuration ); + wxDL_METHOD_LOAD( m_dll, GetMovieTimeBase ); + wxDL_METHOD_LOAD( m_dll, GetMovieTimeScale ); + wxDL_METHOD_LOAD( m_dll, GetMovieTime ); + wxDL_METHOD_LOAD( m_dll, SetMovieTime ); + wxDL_METHOD_LOAD( m_dll, GetMovieVolume ); + wxDL_METHOD_LOAD( m_dll, SetMovieVolume ); + wxDL_METHOD_LOAD( m_dll, SetMovieTimeValue ); + wxDL_METHOD_LOAD( m_dll, NewMovieController ); + wxDL_METHOD_LOAD( m_dll, DisposeMovieController ); + wxDL_METHOD_LOAD( m_dll, MCSetVisible ); + wxDL_METHOD_LOAD( m_dll, PrePrerollMovie ); + wxDL_METHOD_LOAD( m_dll, PrerollMovie ); + wxDL_METHOD_LOAD( m_dll, GetMoviePreferredRate ); + wxDL_METHOD_LOAD( m_dll, GetMovieLoadState ); + wxDL_METHOD_LOAD( m_dll, MCDoAction ); + wxDL_METHOD_LOAD( m_dll, MCSetControllerBoundsRect ); + wxDL_METHOD_LOAD( m_dll, NativeEventToMacEvent ); + wxDL_METHOD_LOAD( m_dll, MCIsPlayerEvent ); + wxDL_METHOD_LOAD( m_dll, MCSetMovie ); + wxDL_METHOD_LOAD( m_dll, MCSetActionFilterWithRefCon ); + wxDL_METHOD_LOAD( m_dll, MCGetControllerInfo ); + wxDL_METHOD_LOAD( m_dll, BeginUpdate ); + wxDL_METHOD_LOAD( m_dll, UpdateMovie ); + wxDL_METHOD_LOAD( m_dll, EndUpdate ); + wxDL_METHOD_LOAD( m_dll, GetMoviesStickyError ); + + return m_ok; } class WXDLLIMPEXP_MEDIA wxQTMediaBackend : public wxMediaBackendCommonBase { public: wxQTMediaBackend(); - ~wxQTMediaBackend(); + virtual ~wxQTMediaBackend(); virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, wxWindowID id, @@ -1336,7 +1884,7 @@ public: static void PPRMProc (Movie theMovie, OSErr theErr, void* theRefCon); // TODO: Last param actually long - does this work on 64bit machines? - static Boolean MCFilterProc (MovieController theController, + static Boolean MCFilterProc(MovieController theController, short action, void *params, LONG_PTR refCon); static LRESULT CALLBACK QTWndProc(HWND, UINT, WPARAM, LPARAM); @@ -1352,6 +1900,7 @@ public: ComponentInstance m_pMC; // Movie Controller friend class wxQTMediaEvtHandler; + DECLARE_DYNAMIC_CLASS(wxQTMediaBackend) }; @@ -1405,14 +1954,14 @@ wxString wxAMMediaBackend::GetErrorString(HRESULT hrdsv) { return wxString::Format(wxT("DirectShow error \"%s\" \n") wxT("(numeric %X)\n") - wxT("occured"), + wxT("occurred"), szError, (int)hrdsv); } else { return wxString::Format(wxT("Unknown error \n") wxT("(numeric %X)\n") - wxT("occured"), + wxT("occurred"), (int)hrdsv); } } @@ -1421,7 +1970,6 @@ wxString wxAMMediaBackend::GetErrorString(HRESULT hrdsv) #define wxVERIFY(x) wxASSERT((x)) #define wxAMLOG(x) wxLogDebug(GetErrorString(x)) #else -#define wxAMVERIFY(x) (x) #define wxVERIFY(x) (x) #define wxAMLOG(x) #define wxAMFAIL(x) @@ -1448,10 +1996,16 @@ public: void Notify() { - if (m_parent->m_pMP) + if (m_parent->GetMP()) { MPReadyStateConstants nState; - m_parent->m_pMP->get_ReadyState(&nState); + +#ifdef __WXWINCE__ //Cast to long needed for IWMP (??) + m_parent->GetMP()->get_ReadyState((long*)&nState); +#else + m_parent->GetMP()->get_ReadyState(&nState); +#endif + if (nState != mpReadyStateLoading) { Stop(); @@ -1463,7 +2017,7 @@ public: { IActiveMovie2* pAM2 = NULL; ReadyStateConstants nState; - if (m_parent->m_pAM->QueryInterface(IID_IActiveMovie2, (void**)&pAM2) == 0 + if (m_parent->GetAM()->QueryInterface(IID_IActiveMovie2, (void**)&pAM2) == 0 && pAM2->get_ReadyState(&nState) == 0) { pAM2->Release(); @@ -1487,7 +2041,7 @@ public: } protected: - wxAMMediaBackend* m_parent; //Backend pointer + wxAMMediaBackend* m_parent; // Backend pointer }; //--------------------------------------------------------------------------- @@ -1505,11 +2059,10 @@ public: void Notify() { - // NB: Stop events could get triggered by the interface - // if ShowPlayerControls is enabled, - // so we need this hack here to make an attempt - // at it not getting sent - but its far from ideal - - // they can still get sent in some cases + // NB: Stop events could get triggered by the interface + // if ShowPlayerControls is enabled, so the "GetPosition == GetDuration" + // hack is needed here to make an attempt at it not getting sent + // - but its far from ideal - they can still get sent in some cases if (m_parent->GetState() == wxMEDIASTATE_STOPPED && m_parent->GetPosition() == m_parent->GetDuration()) { @@ -1548,14 +2101,14 @@ public: { HRESULT hr; IUnknown* pGB; - hr = m_pBE->m_pAM->get_FilterGraph(&pGB); + hr = m_pBE->GetAM()->get_FilterGraph(&pGB); wxASSERT(SUCCEEDED(hr)); hr = pGB->QueryInterface(IID_IMediaEvent, (void**)&m_pME); wxASSERT(SUCCEEDED(hr)); pGB->Release(); } - ~wxAMPlayTimer() + virtual ~wxAMPlayTimer() { SAFE_RELEASE(m_pME); } @@ -1563,24 +2116,19 @@ public: void Notify() { LONG evCode; - LONG_PTR evParam1, - evParam2; + LONG_PTR evParam1, evParam2; - // // DirectShow keeps a list of queued events, and we need - // to go through them one by one, stopping at (Hopefully only one) + // to go through them one by one, stopping at (hopefully only one) // EC_COMPLETE message - // - while( m_pME->GetEvent(&evCode, &evParam1, &evParam2, 0) == 0 ) + while ( m_pME->GetEvent(&evCode, &evParam1, &evParam2, 0) == 0 ) { // Cleanup memory that GetEvent allocated - HRESULT hr = m_pME->FreeEventParams(evCode, - evParam1, evParam2); + HRESULT hr = m_pME->FreeEventParams(evCode, evParam1, evParam2); if (hr != 0) { - // Even though this makes a messagebox this - // is windows where we can do gui stuff in seperate - // threads :) + // Even though this makes a messagebox, this is Windows, + // where we can do GUI stuff in separate threads :) wxFAIL_MSG(m_pBE->GetErrorString(hr)); } // If this is the end of the clip, notify handler @@ -1589,7 +2137,6 @@ public: if ( m_pBE->SendStopEvent() ) { Stop(); - m_pBE->QueueFinishEvent(); } } @@ -1607,8 +2154,12 @@ protected: //--------------------------------------------------------------------------- wxAMMediaBackend::wxAMMediaBackend() :m_pAX(NULL), +#ifdef __WXWINCE__ + m_pWMP(NULL), +#else m_pAM(NULL), m_pMP(NULL), +#endif m_pTimer(NULL) { } @@ -1618,20 +2169,20 @@ wxAMMediaBackend::wxAMMediaBackend() //--------------------------------------------------------------------------- wxAMMediaBackend::~wxAMMediaBackend() { - Clear(); //Free memory from Load() + // Free memory from Load() + Clear(); if (m_pAX) { - { - wxLogNull noLog; - m_pAX->DissociateHandle(); - } - + m_pAX->DissociateHandle(); delete m_pAX; + +#ifndef __WXWINCE__ m_pAM->Release(); +#endif - if (m_pMP) - m_pMP->Release(); + if (GetMP()) + GetMP()->Release(); } } @@ -1660,8 +2211,8 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, const wxValidator& validator, const wxString& name) { - // First get the AMGetErrorText procedure in debug - // mode for more meaningful messages + // First get the AMGetErrorText procedure in + // debug mode for more meaningful messages #ifdef __WXDEBUG__ if ( m_dllQuartz.Load(_T("quartz.dll"), wxDL_VERBATIM) ) { @@ -1670,59 +2221,90 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, } #endif - // Now determine which (if any) media player interface is - // available - IMediaPlayer or IActiveMovie - if ( ::CoCreateInstance(CLSID_MediaPlayer, NULL, - CLSCTX_INPROC_SERVER, - IID_IMediaPlayer, (void**)&m_pMP) != 0 ) - { - if ( ::CoCreateInstance(CLSID_ActiveMovie, NULL, - CLSCTX_INPROC_SERVER, - IID_IActiveMovie, (void**)&m_pAM) != 0 ) - return false; - m_pAM->QueryInterface(IID_IMediaPlayer, (void**)&m_pMP); - } - else - { - m_pMP->QueryInterface(IID_IActiveMovie, (void**)&m_pAM); - } +#ifdef __WXWINCE__ + CLSID clsid; + + // Try progids first - *.WMP is PocketPC and Mediaplayer.1 is CE.NET + // later versions support straight creation from CLSID + if (CLSIDFromProgID(L"WPCEOCX.WMP", &clsid) != S_OK && + CLSIDFromProgID(L"MediaPlayer.MediaPlayer.1", &clsid) != S_OK) + { + clsid = CLSID_MediaPlayer; + } + + // While the CLSID is the same as CLSID_MediaPlayer + // CE only supports the IWMP interface + if ( ::CoCreateInstance(clsid, NULL, + CLSCTX_INPROC_SERVER, + IID_IWMP, (void**)&m_pWMP) != 0 ) + { + return false; + } + +#else + // determine which (if any) media player interface + // is available - IMediaPlayer or IActiveMovie + if ( ::CoCreateInstance(CLSID_MediaPlayer, NULL, + CLSCTX_INPROC_SERVER, + IID_IMediaPlayer, (void**)&m_pMP) != 0 ) + { + if ( ::CoCreateInstance(CLSID_ActiveMovie, NULL, + CLSCTX_INPROC_SERVER, + IID_IActiveMovie, (void**)&m_pAM) != 0 ) + { + return false; + } + + m_pAM->QueryInterface(IID_IMediaPlayer, (void**)&m_pMP); + } + else + { + m_pMP->QueryInterface(IID_IActiveMovie, (void**)&m_pAM); + } +#endif - // // Create window // By default wxWindow(s) is created with a border - // so we need to get rid of those // // Since we don't have a child window like most other // backends, we don't need wxCLIP_CHILDREN - // if ( !ctrl->wxControl::Create(parent, id, pos, size, (style & ~wxBORDER_MASK) | wxBORDER_NONE, validator, name) ) + { return false; + } - // Now create the ActiveX container along with the media player + // Create the ActiveX container along with the media player // interface and query them - // m_ctrl = wxStaticCast(ctrl, wxMediaCtrl); m_pAX = new wxActiveXContainer(ctrl, - m_pMP ? IID_IMediaPlayer : IID_IActiveMovie, - m_pAM); +#ifdef __WXWINCE__ + IID_IWMP, m_pWMP +#else + m_pMP ? IID_IMediaPlayer : IID_IActiveMovie, m_pAM +#endif + ); - // Here we set up wx-specific stuff for the default - // settings wxMediaCtrl says it will stay to - // - if (m_pMP) + // Set up wx-specific stuff for the default + // settings wxMediaCtrl says it will conform to (???) + if (GetMP()) { - m_pMP->put_DisplaySize(mpFitToSize); + GetMP()->put_DisplaySize(mpFitToSize); +#ifndef __WXWINCE__ // Not in CE's IWMP // TODO: Unsure what actual effect this has - m_pMP->put_WindowlessVideo(VARIANT_TRUE); + GetMP()->put_WindowlessVideo(VARIANT_TRUE); +#endif } +#ifndef __WXWINCE__ // Not in CE's IWMP else - m_pAM->put_MovieWindowSize(amvDoubleOriginalSize); + GetAM()->put_MovieWindowSize(amvDoubleOriginalSize); +#endif // by default true - m_pAM->put_AutoStart(VARIANT_FALSE); + GetAM()->put_AutoStart(VARIANT_FALSE); // by default enabled wxAMMediaBackend::ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_NONE); @@ -1751,10 +2333,9 @@ bool wxAMMediaBackend::Load(const wxString& fileName) //--------------------------------------------------------------------------- bool wxAMMediaBackend::Load(const wxURI& location) { - // Turn off loading from a proxy as user - // may have set it previously + // Turn off loading from a proxy, as user may have set it previously INSPlay* pPlay = NULL; - m_pAM->QueryInterface(IID_INSPlay, (void**) &pPlay); + GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay); if (pPlay) { pPlay->put_UseHTTPProxy(VARIANT_FALSE); @@ -1771,7 +2352,7 @@ bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy) { // Set the proxy of the NETSHOW interface INSPlay* pPlay = NULL; - m_pAM->QueryInterface(IID_INSPlay, (void**) &pPlay); + GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay); if (pPlay) { @@ -1792,18 +2373,19 @@ bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy) //--------------------------------------------------------------------------- bool wxAMMediaBackend::DoLoad(const wxString& location) { - Clear(); //Clear up previously allocated memory + //Clear up previously allocated memory + Clear(); HRESULT hr; - // Play the movie the normal way through the embedded - // WMP. Supposively Open is better in theory because + // Play the movie the normal way through the embedded WMP. + // Supposedly, Open is better in theory because // the docs say its async and put_FileName is not - - // but in practice they both seem to be async anyway - if (m_pMP) - hr = m_pMP->Open( wxBasicString(location).Get() ); + // but in practice they both appear to be async anyway + if (GetMP()) + hr = GetMP()->Open( wxBasicString(location).Get() ); else - hr = m_pAM->put_FileName( wxBasicString(location).Get() ); + hr = GetAM()->put_FileName( wxBasicString(location).Get() ); if (FAILED(hr)) { @@ -1830,14 +2412,12 @@ bool wxAMMediaBackend::DoLoad(const wxString& location) //--------------------------------------------------------------------------- void wxAMMediaBackend::FinishLoad() { - //Get the original video size - m_pAM->get_ImageSourceWidth((long*)&m_bestSize.x); - m_pAM->get_ImageSourceHeight((long*)&m_bestSize.y); + // Get the original video size + GetAM()->get_ImageSourceWidth((long*)&m_bestSize.x); + GetAM()->get_ImageSourceHeight((long*)&m_bestSize.y); - // - //Start the play timer to catch stop events - //Previous load timer cleans up itself - // + // Start the play timer to catch stop events + // Previous load timer cleans up itself m_pTimer = new wxAMPlayTimer(this); NotifyMovieLoaded(); @@ -1853,24 +2433,24 @@ bool wxAMMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) // the interface consistant if (!flags) { - m_pAM->put_Enabled(VARIANT_FALSE); - m_pAM->put_ShowControls(VARIANT_FALSE); - if (m_pMP) - m_pMP->put_ShowStatusBar(VARIANT_FALSE); + GetAM()->put_Enabled(VARIANT_FALSE); + GetAM()->put_ShowControls(VARIANT_FALSE); + if (GetMP()) + GetMP()->put_ShowStatusBar(VARIANT_FALSE); } else { - m_pAM->put_Enabled(VARIANT_TRUE); - m_pAM->put_ShowControls(VARIANT_TRUE); + GetAM()->put_Enabled(VARIANT_TRUE); + GetAM()->put_ShowControls(VARIANT_TRUE); - m_pAM->put_ShowPositionControls( + GetAM()->put_ShowPositionControls( (flags & wxMEDIACTRLPLAYERCONTROLS_STEP) ? VARIANT_TRUE : VARIANT_FALSE); - if (m_pMP) + if (GetMP()) { - m_pMP->put_ShowStatusBar(VARIANT_TRUE); - m_pMP->put_ShowAudioControls( + GetMP()->put_ShowStatusBar(VARIANT_TRUE); + GetMP()->put_ShowAudioControls( (flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME) ? VARIANT_TRUE : VARIANT_FALSE); } @@ -1890,7 +2470,11 @@ bool wxAMMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) bool wxAMMediaBackend::Play() { // Actually try to play the movie, even though it may not be loaded yet. - HRESULT hr = m_pAM->Run(); +#ifdef __WXWINCE__ + HRESULT hr = m_pWMP->Play(); +#else + HRESULT hr = GetAM()->Run(); +#endif if (SUCCEEDED(hr)) { m_pTimer->Start(20); @@ -1909,7 +2493,7 @@ bool wxAMMediaBackend::Play() //--------------------------------------------------------------------------- bool wxAMMediaBackend::Pause() { - HRESULT hr = m_pAM->Pause(); + HRESULT hr = GetAM()->Pause(); if (SUCCEEDED(hr)) return true; @@ -1925,7 +2509,7 @@ bool wxAMMediaBackend::Pause() //--------------------------------------------------------------------------- bool wxAMMediaBackend::Stop() { - HRESULT hr = m_pAM->Stop(); + HRESULT hr = GetAM()->Stop(); if (SUCCEEDED(hr)) { // Seek to beginning @@ -1952,9 +2536,8 @@ bool wxAMMediaBackend::Stop() //--------------------------------------------------------------------------- bool wxAMMediaBackend::SetPosition(wxLongLong where) { - HRESULT hr = m_pAM->put_CurrentPosition( - ((LONGLONG)where.GetValue()) / 1000.0 - ); + HRESULT hr = GetAM()->put_CurrentPosition( + ((LONGLONG)where.GetValue()) / 1000.0 ); if (FAILED(hr)) { wxAMLOG(hr); @@ -1973,7 +2556,7 @@ bool wxAMMediaBackend::SetPosition(wxLongLong where) wxLongLong wxAMMediaBackend::GetPosition() { double outCur; - HRESULT hr = m_pAM->get_CurrentPosition(&outCur); + HRESULT hr = GetAM()->get_CurrentPosition(&outCur); if (FAILED(hr)) { wxAMLOG(hr); @@ -1998,7 +2581,7 @@ wxLongLong wxAMMediaBackend::GetPosition() double wxAMMediaBackend::GetVolume() { long lVolume; - HRESULT hr = m_pAM->get_Volume(&lVolume); + HRESULT hr = GetAM()->get_Volume(&lVolume); if (FAILED(hr)) { wxAMLOG(hr); @@ -2019,7 +2602,7 @@ bool wxAMMediaBackend::SetVolume(double dVolume) { // pow(10.0, -80.0) to correct 0 == -INF long lVolume = (long)(2000.0 * log10( pow( 10.0, -80.0) + dVolume ) ); - HRESULT hr = m_pAM->put_Volume( lVolume ); + HRESULT hr = GetAM()->put_Volume( lVolume ); if (FAILED(hr)) { wxAMLOG(hr); @@ -2042,7 +2625,7 @@ bool wxAMMediaBackend::SetVolume(double dVolume) wxLongLong wxAMMediaBackend::GetDuration() { double outDuration; - HRESULT hr = m_pAM->get_Duration(&outDuration); + HRESULT hr = GetAM()->get_Duration(&outDuration); if (FAILED(hr)) { wxAMLOG(hr); @@ -2065,7 +2648,11 @@ wxLongLong wxAMMediaBackend::GetDuration() wxMediaState wxAMMediaBackend::GetState() { StateConstants nState; - HRESULT hr = m_pAM->get_CurrentState(&nState); +#ifdef __WXWINCE__ + HRESULT hr = m_pWMP->get_PlayState((long*)&nState); +#else + HRESULT hr = GetAM()->get_CurrentState(&nState); +#endif if (FAILED(hr)) { wxAMLOG(hr); @@ -2084,7 +2671,7 @@ wxMediaState wxAMMediaBackend::GetState() double wxAMMediaBackend::GetPlaybackRate() { double dRate; - HRESULT hr = m_pAM->get_Rate(&dRate); + HRESULT hr = GetAM()->get_Rate(&dRate); if (FAILED(hr)) { wxAMLOG(hr); @@ -2102,7 +2689,7 @@ double wxAMMediaBackend::GetPlaybackRate() //--------------------------------------------------------------------------- bool wxAMMediaBackend::SetPlaybackRate(double dRate) { - HRESULT hr = m_pAM->put_Rate(dRate); + HRESULT hr = GetAM()->put_Rate(dRate); if (FAILED(hr)) { wxAMLOG(hr); @@ -2122,11 +2709,12 @@ bool wxAMMediaBackend::SetPlaybackRate(double dRate) void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong* pLoadProgress, wxLongLong* pLoadTotal) { +#ifndef __WXWINCE__ LONGLONG loadTotal = 0, loadProgress = 0; IUnknown* pFG; IAMOpenProgress* pOP; HRESULT hr; - hr = m_pAM->get_FilterGraph(&pFG); + hr = GetAM()->get_FilterGraph(&pFG); if (SUCCEEDED(hr)) { hr = pFG->QueryInterface(IID_IAMOpenProgress, (void**)&pOP); @@ -2145,6 +2733,7 @@ void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong* pLoadProgress, *pLoadTotal = loadTotal; } else +#endif { // When not loading from a URL QueryProgress will return // E_NOINTERFACE or whatever @@ -2178,11 +2767,9 @@ void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), // End of wxAMMediaBackend //--------------------------------------------------------------------------- -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// +//--------------------------------------------------------------------------- // wxMCIMediaBackend -// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +//--------------------------------------------------------------------------- #ifndef __WXWINCE__ IMPLEMENT_DYNAMIC_CLASS(wxMCIMediaBackend, wxMediaBackend) @@ -2274,7 +2861,7 @@ wxMCIMediaBackend::wxMCIMediaBackend() : m_hNotifyWnd(NULL), m_bVideo(false) //--------------------------------------------------------------------------- // wxMCIMediaBackend Destructor // -// We close the mci device - note that there may not be an mci device here, +// We close the MCI device - note that there may not be an MCI device here, // or it may fail - but we don't really care, since we're destructing //--------------------------------------------------------------------------- wxMCIMediaBackend::~wxMCIMediaBackend() @@ -2290,7 +2877,7 @@ wxMCIMediaBackend::~wxMCIMediaBackend() //--------------------------------------------------------------------------- // wxMCIMediaBackend::Create // -// Here we just tell wxMediaCtrl that mci does exist (which it does, on all +// Here we just tell wxMediaCtrl that MCI does exist (which it does, on all // msw systems, at least in some form dating back to win16 days) //--------------------------------------------------------------------------- bool wxMCIMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, @@ -2337,11 +2924,13 @@ bool wxMCIMediaBackend::Load(const wxString& fileName) // omit this it tells MCI to select the device instead. This is good // because we have no reliable way of "enumerating" the devices in MCI MCI_OPEN_PARMS openParms; - openParms.lpstrElementName = (wxChar*) fileName.c_str(); + openParms.lpstrElementName = fileName.wx_str(); - if ( mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT, + if (mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD)(LPVOID)&openParms) != 0) + { return false; + } m_hDev = openParms.wDeviceID; @@ -2353,8 +2942,8 @@ bool wxMCIMediaBackend::Load(const wxString& fileName) if (mciSendCommand(m_hDev, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID)&setParms) != 0) { - } return false; + } // tell the MCI device to display the video in our wxMediaCtrl MCI_DGV_WINDOW_PARMS windowParms; @@ -2398,7 +2987,7 @@ bool wxMCIMediaBackend::Load(const wxString& fileName) // // MCI doesn't support URLs directly (?) // -// TODO: Use wxURL/wxFileSystem and mmioInstallProc +// TODO: Use wxURL/wxFileSystem and mmioInstallProc //--------------------------------------------------------------------------- bool wxMCIMediaBackend::Load(const wxURI& WXUNUSED(location)) { @@ -2420,8 +3009,8 @@ bool wxMCIMediaBackend::Play() MCI_PLAY_PARMS playParms; playParms.dwCallback = (DWORD)m_hNotifyWnd; - bool bOK = ( mciSendCommand(m_hDev, MCI_PLAY, MCI_NOTIFY, - (DWORD)(LPVOID)&playParms) == 0 ); + bool bOK = (mciSendCommand(m_hDev, MCI_PLAY, MCI_NOTIFY, + (DWORD)(LPVOID)&playParms) == 0); if (bOK) m_ctrl->Show(m_bVideo); @@ -2524,7 +3113,9 @@ wxLongLong wxMCIMediaBackend::GetPosition() if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, (DWORD)(LPSTR)&statusParms) != 0) + { return 0; + } return statusParms.dwReturn; } @@ -2543,7 +3134,9 @@ double wxMCIMediaBackend::GetVolume() if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, (DWORD)(LPSTR)&statusParms) != 0) + { return 0; + } return ((double)statusParms.dwReturn) / 1000.0; } @@ -2568,7 +3161,9 @@ bool wxMCIMediaBackend::SetVolume(double dVolume) // MCI_DGV_SETAUDIO + (_ITEM | _VALUE) 0x00800000L | 0x01000000L, (DWORD)(LPSTR)&audioParms) != 0) + { return false; + } return true; } @@ -2585,7 +3180,9 @@ wxLongLong wxMCIMediaBackend::GetDuration() if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM, (DWORD)(LPSTR)&statusParms) != 0) + { return 0; + } return statusParms.dwReturn; } @@ -2633,6 +3230,7 @@ wxSize wxMCIMediaBackend::GetVideoSize() const return wxSize(whereParms.rc.right, whereParms.rc.bottom); } + return wxSize(0, 0); } @@ -2702,14 +3300,13 @@ LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg, } #endif // __WXWINCE__ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// +//--------------------------------------------------------------------------- // wxQTMediaBackend // // TODO: Use a less kludgy way to pause/get state/set state // FIXME: Greg Hazel reports that sometimes files that cannot be played // with this backend are treated as playable anyway - not verified though. -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +//--------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend) @@ -2717,11 +3314,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend) // team I believe #define MOVIE_DELAY 20 -#include "wx/timer.h" - - //--------------------------------------------------------------------------- -// wxQTLoadTimer +// wxQTLoadTimer // // QT, esp. QT for Windows is very picky about how you go about // async loading. If you were to go through a Windows message loop @@ -2738,7 +3332,7 @@ public: void Notify() { m_pLib->MoviesTask(m_movie, 0); - //kMovieLoadStatePlayable + // kMovieLoadStatePlayable if (m_pLib->GetMovieLoadState(m_movie) >= 10000) { m_parent->FinishLoad(); @@ -2754,7 +3348,7 @@ protected: // -------------------------------------------------------------------------- -// wxQTPlayTimer - Handle Asyncronous Playing +// wxQTPlayTimer - Handle Asyncronous Playing // // 1) Checks to see if the movie is done, and if not continues // streaming the movie @@ -2915,7 +3509,6 @@ bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, // // Since we don't have a child window like most other // backends, we don't need wxCLIP_CHILDREN - // if ( !ctrl->wxControl::Create(parent, id, pos, size, (style & ~wxBORDER_MASK) | wxBORDER_NONE, validator, name) ) @@ -2951,43 +3544,48 @@ bool wxQTMediaBackend::Load(const wxString& fileName) if (m_movie) Cleanup(); + bool result = true; + OSErr err = noErr; short movieResFile = 0; //= 0 because of annoying VC6 warning FSSpec sfFile; - if (m_lib.NativePathNameToFSSpec( + err = m_lib.NativePathNameToFSSpec( (char*) (const char*) fileName.mb_str(), - &sfFile, 0) != noErr) + &sfFile, 0); + result = (err == noErr); + + if (result) { - return false; + err = m_lib.OpenMovieFile(&sfFile, &movieResFile, fsRdPerm); + result = (err == noErr); } - if (m_lib.OpenMovieFile (&sfFile, &movieResFile, fsRdPerm) != noErr) - return false; - - short movieResID = 0; - Str255 movieName; + if (result) + { + short movieResID = 0; + Str255 movieName; - OSErr err = m_lib.NewMovieFromFile( + err = m_lib.NewMovieFromFile( &m_movie, movieResFile, &movieResID, movieName, newMovieActive, - NULL ); //wasChanged - - // m_lib.GetMoviesStickyError() because it may not find the - // proper codec and play black video and other strange effects, - // not to mention mess up the dynamic backend loading scheme - // of wxMediaCtrl - so it just does what the QuickTime player does - if (err == noErr && m_lib.GetMoviesStickyError() == noErr) - { - m_lib.CloseMovieFile (movieResFile); - - FinishLoad(); - return true; + NULL ); // wasChanged + result = (err == noErr && m_lib.GetMoviesStickyError() == noErr); + + // check m_lib.GetMoviesStickyError() because it may not find the + // proper codec and play black video and other strange effects, + // not to mention mess up the dynamic backend loading scheme + // of wxMediaCtrl - so it just does what the QuickTime player does + if (result) + { + m_lib.CloseMovieFile(movieResFile); + FinishLoad(); + } } - else - return false; + + return result; } //--------------------------------------------------------------------------- @@ -3009,7 +3607,7 @@ void wxQTMediaBackend::PPRMProc (Movie theMovie, long lTime = pBE->m_lib.GetMovieTime(theMovie,NULL); Fixed rate = pBE->m_lib.GetMoviePreferredRate(theMovie); - pBE->m_lib.PrerollMovie(theMovie,lTime,rate); + pBE->m_lib.PrerollMovie(theMovie, lTime, rate); pBE->m_timer = new wxQTLoadTimer(pBE->m_movie, pBE, &pBE->m_lib); pBE->m_timer->Start(MOVIE_DELAY); } @@ -3040,7 +3638,7 @@ bool wxQTMediaBackend::Load(const wxURI& location) // create the movie from the handle that refers to the URI OSErr err = m_lib.NewMovieFromDataRef(&m_movie, newMovieActive | newMovieAsyncOK - /*|newMovieIdleImportOK*/, + /* | newMovieIdleImportOK */, NULL, theHandle, URLDataHandlerSubType); @@ -3057,24 +3655,24 @@ bool wxQTMediaBackend::Load(const wxURI& location) playRate = m_lib.GetMoviePreferredRate(m_movie); wxASSERT(m_lib.GetMoviesError() == noErr); - // Note that the callback here is optional, - // but without it PrePrerollMovie can be buggy - // (see Apple ml). Also, some may wonder - // why we need this at all - this is because - // Apple docs say QuickTime streamed movies - // require it if you don't use a Movie Controller, - // which we don't by default. + // Note that the callback here is optional, + // but without it PrePrerollMovie can be buggy + // (see Apple ml). Also, some may wonder + // why we need this at all - this is because + // Apple docs say QuickTime streamed movies + // require it if you don't use a Movie Controller, + // which we don't by default. // m_lib.PrePrerollMovie(m_movie, timeNow, playRate, (WXFARPROC)wxQTMediaBackend::PPRMProc, (void*)this); + return true; } else return false; } - //--------------------------------------------------------------------------- // wxQTMediaBackend::FinishLoad // @@ -3091,11 +3689,12 @@ void wxQTMediaBackend::FinishLoad() // Create the playing/streaming timer m_timer = new wxQTPlayTimer(m_movie, (wxQTMediaBackend*) this, &m_lib); wxASSERT(m_timer); + m_timer->Start(MOVIE_DELAY, wxTIMER_CONTINUOUS); // get the real size of the movie Rect outRect; - memset(&outRect, 0, sizeof(Rect)); // for annoying VC6 warning + memset(&outRect, 0, sizeof(Rect)); // suppress annoying VC6 warning m_lib.GetMovieNaturalBoundsRect (m_movie, &outRect); wxASSERT(m_lib.GetMoviesError() == noErr); @@ -3182,7 +3781,7 @@ bool wxQTMediaBackend::Stop() //--------------------------------------------------------------------------- // wxQTMediaBackend::GetPlaybackRate // -// 1) Get the movie playback rate from ::GetMovieRate +// Get the movie playback rate from ::GetMovieRate //--------------------------------------------------------------------------- double wxQTMediaBackend::GetPlaybackRate() { @@ -3192,7 +3791,7 @@ double wxQTMediaBackend::GetPlaybackRate() //--------------------------------------------------------------------------- // wxQTMediaBackend::SetPlaybackRate // -// 1) Convert dRate to Fixed and Set the movie rate through SetMovieRate +// Convert dRate to Fixed and Set the movie rate through SetMovieRate //--------------------------------------------------------------------------- bool wxQTMediaBackend::SetPlaybackRate(double dRate) { @@ -3209,12 +3808,12 @@ bool wxQTMediaBackend::SetPlaybackRate(double dRate) //--------------------------------------------------------------------------- bool wxQTMediaBackend::SetPosition(wxLongLong where) { - //NB: For some reason SetMovieTime does not work - //correctly with the Quicktime Windows SDK (6) - //From Muskelkatermann at the wxForum - //http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=2957 - //RN - note that I have not verified this but there - //is no harm in calling SetMovieTimeValue instead + // NB: For some reason SetMovieTime does not work + // correctly with the Quicktime Windows SDK (6) + // From Muskelkatermann at the wxForum + // http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=2957 + // RN - note that I have not verified this but there + // is no harm in calling SetMovieTimeValue instead #if 0 TimeRecord theTimeRecord; memset(&theTimeRecord, 0, sizeof(TimeRecord)); @@ -3300,8 +3899,8 @@ wxLongLong wxQTMediaBackend::GetDuration() //--------------------------------------------------------------------------- // wxQTMediaBackend::GetState // -// Determines the current state - if we are at the beginning we -// are stopped +// Determines the current state: +// if we are at the beginning, then we are stopped //--------------------------------------------------------------------------- wxMediaState wxQTMediaBackend::GetState() { @@ -3353,11 +3952,13 @@ bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) { if (m_pMC) { - //restore old wndproc + // restore old wndproc wxSetWindowProc((HWND)m_ctrl->GetHWND(), wxWndProc); m_lib.DisposeMovieController(m_pMC); m_pMC = NULL; - m_bestSize.y -= 16; //movie controller height + + // movie controller height + m_bestSize.y -= 16; } if (flags && m_movie) @@ -3365,7 +3966,7 @@ bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) Rect rect; wxRect wxrect = m_ctrl->GetClientRect(); - //make room for controller + // make room for controller if (wxrect.width < 320) wxrect.width = 320; @@ -3380,36 +3981,34 @@ bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) // mcScaleMovieToFit | // mcWithBadge | mcWithFrame); - m_lib.MCDoAction(m_pMC, 32, (void*)true); //mcActionSetKeysEnabled + m_lib.MCDoAction(m_pMC, 32, (void*)true); // mcActionSetKeysEnabled m_lib.MCSetActionFilterWithRefCon(m_pMC, (WXFARPROC)wxQTMediaBackend::MCFilterProc, (void*)this); - m_bestSize.y += 16; //movie controller height - - // - // By default the movie controller uses its own color - // pallette for the movie which can be bad on some files - - // so turn it off. Also turn off its frame/border for - // the movie - // - // Also we take care of a couple of the interface flags here - // + m_bestSize.y += 16; // movie controller height + + // By default the movie controller uses its own colour palette + // for the movie which can be bad on some files, so turn it off. + // Also turn off its frame / border for the movie + // Also take care of a couple of the interface flags here long mcFlags = 0; m_lib.MCDoAction(m_pMC, 39/*mcActionGetFlags*/, (void*)&mcFlags); - mcFlags |= ( //(1<< 0)/*mcFlagSuppressMovieFrame*/ | - (1<< 3)/*mcFlagsUseWindowPalette*/ - | ((flags & wxMEDIACTRLPLAYERCONTROLS_STEP) + + mcFlags |= + // (1<< 0) /*mcFlagSuppressMovieFrame*/ | + (1<< 3) /*mcFlagsUseWindowPalette*/ + | ((flags & wxMEDIACTRLPLAYERCONTROLS_STEP) ? 0 : (1<< 1) /*mcFlagSuppressStepButtons*/) - | ((flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME) + | ((flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME) ? 0 : (1<< 2) /*mcFlagSuppressSpeakerButton*/) - // | (1<< 4) /*mcFlagDontInvalidate*/ //if we take care of repainting ourselves - ); +// | (1<< 4) /*mcFlagDontInvalidate*/ // if we take care of repainting ourselves + ; + m_lib.MCDoAction(m_pMC, 38/*mcActionSetFlags*/, (void*)mcFlags); - //intercept the wndproc of our control window - wxSetWindowProc((HWND)m_ctrl->GetHWND(), - wxQTMediaBackend::QTWndProc); + // intercept the wndproc of our control window + wxSetWindowProc((HWND)m_ctrl->GetHWND(), wxQTMediaBackend::QTWndProc); - //set the user data of our window + // set the user data of our window wxSetWindowUserData((HWND)m_ctrl->GetHWND(), this); } } @@ -3424,34 +4023,40 @@ bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) // // Callback for when the movie controller recieves a message //--------------------------------------------------------------------------- -Boolean -wxQTMediaBackend::MCFilterProc(MovieController WXUNUSED(theController), +Boolean wxQTMediaBackend::MCFilterProc(MovieController WXUNUSED(theController), short action, void * WXUNUSED(params), LONG_PTR refCon) { - if (action != 1) // don't process idle events - { - wxQTMediaBackend* pThis = (wxQTMediaBackend*)refCon; +// NB: potential optimisation +// if (action == 1) +// return 0; - switch (action) - { - case 8: - // play button triggered - MC will set movie to opposite state - // of current - playing ? paused : playing + wxQTMediaBackend* pThis = (wxQTMediaBackend*)refCon; + + switch (action) + { + case 1: + // don't process idle events + break; + + case 8: + // play button triggered - MC will set movie to opposite state + // of current - playing ? paused : playing + if (pThis) pThis->m_bPlaying = !(pThis->m_bPlaying); - // NB: Sometimes it doesn't redraw properly - - // if you click on the button but don't move the mouse - // the button will not change its state until you move - // mcActionDraw and Refresh/Update combo do nothing - // to help this unfortunately - break; + // NB: Sometimes it doesn't redraw properly - + // if you click on the button but don't move the mouse + // the button will not change its state until you move + // mcActionDraw and Refresh/Update combo do nothing + // to help this unfortunately + break; - default: - break; - } + default: + break; } + return 0; } @@ -3474,7 +4079,7 @@ void wxQTMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h) { if (m_movie) { - //make room for controller + // make room for controller if (m_pMC) { if (w < 320) @@ -3499,8 +4104,8 @@ void wxQTMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h) // Suggestion from Greg Hazel to repaint the movie when idle // (on pause also) // -// TODO: We may be repainting too much here - under what exact circumstances -// do we need this? I think Move also repaints correctly for the Movie +// TODO: We may be repainting too much here - under what exact circumstances +// do we need this? I think Move also repaints correctly for the Movie // Controller, so in that instance we don't need this either //--------------------------------------------------------------------------- void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt) @@ -3513,22 +4118,21 @@ void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt) m_pLib.MCDoAction(m_qtb->m_pMC, 2 /*mcActionDraw*/, m_pLib.GetNativeWindowPort(m_hwnd)); } - else // no movie controller + else if ( m_qtb->m_movie ) { - if ( m_qtb->m_movie ) - { - CGrafPtr port = (CGrafPtr)m_pLib.GetNativeWindowPort(m_hwnd); + // no movie controller + CGrafPtr port = (CGrafPtr)m_pLib.GetNativeWindowPort(m_hwnd); - m_pLib.BeginUpdate(port); - m_pLib.UpdateMovie(m_qtb->m_movie); - wxASSERT(m_pLib.GetMoviesError() == noErr); - m_pLib.EndUpdate(port); - } - else // no movie - { - // let the system repaint the window - evt.Skip(); - } + m_pLib.BeginUpdate(port); + m_pLib.UpdateMovie(m_qtb->m_movie); + wxASSERT(m_pLib.GetMoviesError() == noErr); + m_pLib.EndUpdate(port); + } + else + { + // no movie + // let the system repaint the window + evt.Skip(); } } @@ -3540,7 +4144,4 @@ void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt) #include "wx/html/forcelnk.h" FORCE_LINK_ME(basewxmediabackends) -//--------------------------------------------------------------------------- -// End wxMediaCtrl Compilation Guard and this file -//--------------------------------------------------------------------------- #endif //wxUSE_MEDIACTRL