X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0fa5ce0c7608e50b695db9316d37e1a961a3edc1..f0eebb39bc6bb54441e695b3c1b1e0bea6ab5c01:/src/msw/mediactrl_qt.cpp diff --git a/src/msw/mediactrl_qt.cpp b/src/msw/mediactrl_qt.cpp index 920ac7f9fd..50a29ba053 100644 --- a/src/msw/mediactrl_qt.cpp +++ b/src/msw/mediactrl_qt.cpp @@ -171,22 +171,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) return false - class WXDLLIMPEXP_MEDIA wxQuickTimeLibrary { @@ -205,168 +189,163 @@ protected: 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_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); + (inName, outFile, flags), -1) wxDL_METHOD_DEFINE( OSErr, OpenMovieFile, (const FSSpec * fileSpec, short * resRefNum, wxInt8 permission), - (fileSpec, resRefNum, permission), -1 ); + (fileSpec, resRefNum, permission), -1 ) wxDL_METHOD_DEFINE( OSErr, CloseMovieFile, - (short resRefNum), (resRefNum), -1); + (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); + 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( 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 ); + (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 ); + (m,flags,id,dataRef,dataRefType), -1 ) - wxDL_VOIDMETHOD_DEFINE( DisposeHandle, (Handle h), (h) ); - wxDL_VOIDMETHOD_DEFINE( GetMovieNaturalBoundsRect, (Movie m, Rect* r), (m,r) ); + 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 ); + (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); + (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) ); - wxDL_VOIDMETHOD_DEFINE(SetMovieTimeValue, (Movie m, long s), (m,s)); - wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), 0); - 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); - wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0); - wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), 0); - wxDL_VOIDMETHOD_DEFINE(DisposeRoutineDescriptor, (void* f), (f)); - wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), 0); - wxDL_METHOD_DEFINE(int, MCDoAction, (ComponentInstance ci, long f, void* p), (ci,f,p), 0); - wxDL_VOIDMETHOD_DEFINE(MCSetControllerBoundsRect, (ComponentInstance ci, Rect* r), (ci,r)); - wxDL_VOIDMETHOD_DEFINE(DestroyPortAssociation, (CGrafPtr g), (g)); - wxDL_VOIDMETHOD_DEFINE(NativeEventToMacEvent, (MSG* p1, EventRecord* p2), (p1,p2)); - wxDL_VOIDMETHOD_DEFINE(MCIsPlayerEvent, (ComponentInstance ci, EventRecord* p2), (ci, p2)); + (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) ) + wxDL_VOIDMETHOD_DEFINE(SetMovieTimeValue, (Movie m, long s), (m,s)) + wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), 0) + 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) + wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0) + wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), 0) + wxDL_VOIDMETHOD_DEFINE(DisposeRoutineDescriptor, (void* f), (f)) + wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), 0) + wxDL_METHOD_DEFINE(int, MCDoAction, (ComponentInstance ci, long f, void* p), (ci,f,p), 0) + wxDL_VOIDMETHOD_DEFINE(MCSetControllerBoundsRect, (ComponentInstance ci, Rect* r), (ci,r)) + wxDL_VOIDMETHOD_DEFINE(DestroyPortAssociation, (CGrafPtr g), (g)) + wxDL_VOIDMETHOD_DEFINE(NativeEventToMacEvent, (MSG* p1, EventRecord* p2), (p1,p2)) + wxDL_VOIDMETHOD_DEFINE(MCIsPlayerEvent, (ComponentInstance ci, EventRecord* p2), (ci, p2)) wxDL_METHOD_DEFINE(int, MCSetMovie, (ComponentInstance ci, Movie m, void* p1, Point w), - (ci,m,p1,w),0); + (ci,m,p1,w),0) wxDL_VOIDMETHOD_DEFINE(MCPositionController, - (ComponentInstance ci, Rect* r, void* junk, void* morejunk), (ci,r,junk,morejunk)); + (ComponentInstance ci, Rect* r, void* junk, void* morejunk), (ci,r,junk,morejunk)) wxDL_VOIDMETHOD_DEFINE(MCSetActionFilterWithRefCon, - (ComponentInstance ci, WXFARPROC cb, void* ref), (ci,cb,ref)); - wxDL_VOIDMETHOD_DEFINE(MCGetControllerInfo, (MovieController mc, long* flags), (mc,flags)); - wxDL_VOIDMETHOD_DEFINE(BeginUpdate, (CGrafPtr port), (port)); - wxDL_VOIDMETHOD_DEFINE(UpdateMovie, (Movie m), (m)); - wxDL_VOIDMETHOD_DEFINE(EndUpdate, (CGrafPtr port), (port)); - wxDL_METHOD_DEFINE( OSErr, GetMoviesStickyError, (), (), -1); + (ComponentInstance ci, WXFARPROC cb, void* ref), (ci,cb,ref)) + wxDL_VOIDMETHOD_DEFINE(MCGetControllerInfo, (MovieController mc, long* flags), (mc,flags)) + wxDL_VOIDMETHOD_DEFINE(BeginUpdate, (CGrafPtr port), (port)) + wxDL_VOIDMETHOD_DEFINE(UpdateMovie, (Movie m), (m)) + wxDL_VOIDMETHOD_DEFINE(EndUpdate, (CGrafPtr port), (port)) + wxDL_METHOD_DEFINE( OSErr, GetMoviesStickyError, (), (), -1) }; bool wxQuickTimeLibrary::Initialize() { - m_ok = false; - // Turn off the wxDynamicLibrary logging as we're prepared to handle the // errors wxLogNull nolog; - if (!m_dll.Load(wxT("qtmlClient.dll"))) - { + 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 ); - - 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