+ return ::GetMoviesError() == noErr;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::GetDataSizeFromStart
+//
+// Calls either GetMovieDataSize or GetMovieDataSize64 with a value
+// of 0 for the starting value
+//---------------------------------------------------------------------------
+wxLongLong wxQTMediaBackend::GetDataSizeFromStart(TimeValue end)
+{
+#if 0 // old pre-qt4 way
+ return ::GetMovieDataSize(m_movie, 0, end)
+#else // qt4 way
+ wide llDataSize;
+ ::GetMovieDataSize64(m_movie, 0, end, &llDataSize);
+ return wxLongLong(llDataSize.hi, llDataSize.lo);
+#endif
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::GetDownloadProgress
+//---------------------------------------------------------------------------
+wxLongLong wxQTMediaBackend::GetDownloadProgress()
+{
+#if 0 // hackish and slow
+ Handle hMovie = NewHandle(0);
+ PutMovieIntoHandle(m_movie, hMovie);
+ long lSize = GetHandleSize(hMovie);
+ DisposeHandle(hMovie);
+
+ return lSize;
+#else
+ TimeValue tv;
+ if (::GetMaxLoadedTimeInMovie(m_movie, &tv) != noErr)
+ {
+ wxLogDebug(wxT("GetMaxLoadedTimeInMovie failed"));
+ return 0;
+ }
+
+ return wxQTMediaBackend::GetDataSizeFromStart(tv);
+#endif
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::GetDownloadTotal
+//---------------------------------------------------------------------------
+wxLongLong wxQTMediaBackend::GetDownloadTotal()
+{
+ return wxQTMediaBackend::GetDataSizeFromStart( ::GetMovieDuration(m_movie) );
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::OnEraseBackground
+//
+// Suggestion from Greg Hazel to repaint the movie when idle
+// (on pause also)
+//---------------------------------------------------------------------------
+#if !wxUSE_CREATEMOVIECONTROL
+void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt)
+{
+ // Work around Nasty OSX drawing bug:
+ // http://lists.apple.com/archives/QuickTime-API/2002/Feb/msg00311.html
+ WindowRef wrTLW = (WindowRef) m_qtb->m_ctrl->MacGetTopLevelWindowRef();
+
+ RgnHandle region = MCGetControllerBoundsRgn(m_qtb->m_mc);
+ MCInvalidate(m_qtb->m_mc, wrTLW, region);
+ MCIdle(m_qtb->m_mc);
+}
+#endif
+
+//---------------------------------------------------------------------------
+// wxQTMediaWindowEventHandler
+//
+// Event callback for the top level window of our control that passes
+// messages to our moviecontroller so it can receive mouse clicks etc.
+//---------------------------------------------------------------------------
+#if !wxUSE_CREATEMOVIECONTROL
+static pascal OSStatus wxQTMediaWindowEventHandler(
+ EventHandlerCallRef inHandlerCallRef,
+ EventRef inEvent,
+ void *inUserData)
+{
+ // for the overly paranoid....
+#if 0
+ UInt32 eventClass = GetEventClass( eventRef );
+ UInt32 eventKind = GetEventKind( inEvent );
+
+ if (eventKind != kEventMouseDown &&
+ eventKind != kEventMouseUp &&
+ eventKind != kEventMouseDragged &&
+ eventKind != kEventRawKeyDown &&
+ eventKind != kEventRawKeyRepeat &&
+ eventKind != kEventRawKeyUp &&
+ eventKind != kEventWindowUpdate &&
+ eventKind != kEventWindowActivated &&
+ eventKind != kEventWindowDeactivated)
+ return eventNotHandledErr;
+#endif
+
+ EventRecord theEvent;
+ ConvertEventRefToEventRecord( inEvent, &theEvent );
+ OSStatus err;
+
+ err = ::MCIsPlayerEvent( (MovieController) inUserData, &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)