+//---------------------------------------------------------------------------
+// wxQTMediaBackend::PPRMProc (static)
+//
+// Called when done PrePrerolling the movie.
+// Note that in 99% of the cases this does nothing...
+// Anyway we set up the loading timer here to tell us when the movie is done
+//---------------------------------------------------------------------------
+pascal void wxQTMediaBackend::PPRMProc(
+ Movie theMovie,
+ OSErr WXUNUSED_UNLESS_DEBUG(theErr),
+ void* theRefCon)
+{
+ wxASSERT( theMovie );
+ wxASSERT( theRefCon );
+ wxASSERT( theErr == noErr );
+
+ wxQTMediaBackend* pBE = (wxQTMediaBackend*) theRefCon;
+
+ long lTime = ::GetMovieTime(theMovie,NULL);
+ Fixed rate = ::GetMoviePreferredRate(theMovie);
+ ::PrerollMovie(theMovie,lTime,rate);
+ pBE->m_timer = new wxQTMediaLoadTimer(pBE);
+ pBE->m_timer->Start(MOVIE_DELAY);
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::MCFilterProc (static)
+//
+// Callback for when the movie controller recieves a message
+//---------------------------------------------------------------------------
+pascal Boolean wxQTMediaBackend::MCFilterProc(
+ MovieController WXUNUSED(theController),
+ short action,
+ void * WXUNUSED(params),
+ long refCon)
+{
+ 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
+ pThis->m_bPlaying = !(pThis->m_bPlaying);
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::WindowEventHandler [static]
+//
+// Event callback for the top level window of our control that passes
+// messages to our moviecontroller so it can receive mouse clicks etc.
+//---------------------------------------------------------------------------
+pascal OSStatus wxQTMediaBackend::WindowEventHandler(
+ EventHandlerCallRef WXUNUSED(inHandlerCallRef),
+ EventRef inEvent,
+ void *inUserData)
+{
+ wxQTMediaBackend* be = (wxQTMediaBackend*) inUserData;
+
+ // Only process keyboard messages on this window if it actually
+ // has focus, otherwise it will steal keystrokes from other windows!
+ // As well as when it is not loaded properly as it
+ // will crash in MCIsPlayerEvent
+ if((GetEventClass(inEvent) == kEventClassKeyboard &&
+ wxWindow::FindFocus() != be->m_ctrl)
+ || !be->m_ctrl->m_bLoaded)
+ return eventNotHandledErr;
+
+ // Pass the event onto the movie controller
+ EventRecord theEvent;
+ ConvertEventRefToEventRecord( inEvent, &theEvent );
+ OSStatus err;
+
+ // TODO: Apple says MCIsPlayerEvent is depreciated and
+ // MCClick, MCKey, MCIdle etc. should be used
+ // (RN: Of course that's what they say about
+ // CreateMovieControl and HIMovieView as well, LOL!)
+ err = ::MCIsPlayerEvent( be->m_mc, &theEvent );
+
+ // Pass on to other event handlers if not handled- i.e. wx
+ if (err != noErr)
+ return noErr;
+ else
+ return eventNotHandledErr;
+}
+
+#endif
+
+// in source file that contains stuff you don't directly use
+#include "wx/html/forcelnk.h"
+FORCE_LINK_ME(basewxmediabackends)