+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+void wxQTMediaBackend::FinishLoad()
+{
+ m_timer = new _wxQTTimer(m_movie, (wxQTMediaBackend*) this);
+ wxASSERT(m_timer);
+
+ //get the real size of the movie
+ Rect outRect;
+ ::GetMovieNaturalBoundsRect (m_movie, &outRect);
+ wxASSERT(::GetMoviesError() == noErr);
+
+ m_bestSize.x = outRect.right - outRect.left;
+ m_bestSize.y = outRect.bottom - outRect.top;
+
+ //reparent movie/*AudioMediaCharacteristic*/
+ if(GetMovieIndTrackType(m_movie, 1,
+ VisualMediaCharacteristic,
+ movieTrackCharacteristic |
+ movieTrackEnabledOnly) != NULL)
+ {
+ CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L);
+
+ SetMovieGWorld(m_movie,
+ (CGrafPtr) GetNativeWindowPort(m_ctrl->GetHWND()),
+ nil);
+ }
+
+ //we want millisecond precision
+ ::SetMovieTimeScale(m_movie, 1000);
+ wxASSERT(::GetMoviesError() == noErr);
+
+ //
+ //Here, if the parent of the control has a sizer - we
+ //tell it to recalculate the size of this control since
+ //the user opened a seperate media file
+ //
+ m_ctrl->InvalidateBestSize();
+ m_ctrl->GetParent()->Layout();
+ m_ctrl->GetParent()->Refresh();
+ m_ctrl->GetParent()->Update();
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+bool wxQTMediaBackend::Play()
+{
+ ::StartMovie(m_movie);
+ m_timer->SetPaused(false);
+ m_timer->Start(MOVIE_DELAY, wxTIMER_CONTINUOUS);
+ return ::GetMoviesError() == noErr;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+bool wxQTMediaBackend::Pause()
+{
+ ::StopMovie(m_movie);
+ m_timer->SetPaused(true);
+ m_timer->Stop();
+ return ::GetMoviesError() == noErr;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+bool wxQTMediaBackend::Stop()
+{
+ m_timer->SetPaused(false);
+ m_timer->Stop();
+
+ ::StopMovie(m_movie);
+ if(::GetMoviesError() != noErr)
+ return false;
+
+ ::GoToBeginningOfMovie(m_movie);
+ return ::GetMoviesError() == noErr;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+double wxQTMediaBackend::GetPlaybackRate()
+{
+ return ( ((double)::GetMovieRate(m_movie)) / 0x10000);
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+bool wxQTMediaBackend::SetPlaybackRate(double dRate)
+{
+ ::SetMovieRate(m_movie, (Fixed) (dRate * 0x10000));
+ return ::GetMoviesError() == noErr;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+bool wxQTMediaBackend::SetPosition(wxLongLong where)
+{
+ TimeRecord theTimeRecord;
+ memset(&theTimeRecord, 0, sizeof(TimeRecord));
+ theTimeRecord.value.lo = where.GetValue();
+ theTimeRecord.scale = ::GetMovieTimeScale(m_movie);
+ theTimeRecord.base = ::GetMovieTimeBase(m_movie);
+ ::SetMovieTime(m_movie, &theTimeRecord);
+
+ if (::GetMoviesError() != noErr)
+ return false;
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::GetPosition
+//
+// 1) Calls GetMovieTime to get the position we are in in the movie
+// in milliseconds (we called
+//---------------------------------------------------------------------------
+wxLongLong wxQTMediaBackend::GetPosition()
+{
+ return ::GetMovieTime(m_movie, NULL);
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+wxLongLong wxQTMediaBackend::GetDuration()
+{
+ return ::GetMovieDuration(m_movie);
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+wxMediaState wxQTMediaBackend::GetState()
+{
+ if ( !m_timer || (m_timer->IsRunning() == false &&
+ m_timer->GetPaused() == false) )
+ return wxMEDIASTATE_STOPPED;
+
+ if( m_timer->IsRunning() == true )
+ return wxMEDIASTATE_PLAYING;
+ else
+ return wxMEDIASTATE_PAUSED;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+void wxQTMediaBackend::Cleanup()
+{
+ delete m_timer;
+ m_timer = NULL;
+
+ StopMovie(m_movie);
+ DisposeMovie(m_movie);
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+wxSize wxQTMediaBackend::GetVideoSize() const
+{
+ return m_bestSize;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::Move
+//
+// TODO
+//---------------------------------------------------------------------------
+void wxQTMediaBackend::Move(int x, int y, int w, int h)
+{
+ if(m_timer)
+ {
+ Rect theRect = {0, 0, h, w};
+
+ ::SetMovieBox(m_movie, &theRect);
+ wxASSERT(::GetMoviesError() == noErr);
+ }
+}
+
+//---------------------------------------------------------------------------
+// End QT Compilation Guard
+//---------------------------------------------------------------------------
+#endif //wxUSE_QUICKTIME
+
+//in source file that contains stuff you don't directly use
+#include <wx/html/forcelnk.h>
+FORCE_LINK_ME(basewxmediabackends);
+
+//---------------------------------------------------------------------------
+// End wxMediaCtrl Compilation Guard and this file
+//---------------------------------------------------------------------------