diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index d632a32c10..ed6228ec79 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -17,13 +17,10 @@ public: virtual unsigned GetTexHandle() const = 0; // accessed by RageDisplay // movie texture/animated texture stuff - virtual void Play() {} - virtual void Pause() {} virtual void SetPosition( float fSeconds ) {} // seek virtual void DecodeSeconds( float fSeconds ) {} // decode virtual void SetPlaybackRate( float fRate ) {} virtual bool IsAMovie() const { return false; } - virtual bool IsPlaying() const { return false; } void SetLooping(bool looping) { } int GetSourceWidth() const {return m_iSourceWidth;} diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.h b/stepmania/src/arch/MovieTexture/MovieTexture.h index b8112a3596..64dbc7188b 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture.h @@ -12,11 +12,8 @@ public: virtual void Reload() = 0; - virtual void Play() = 0; - virtual void Pause() = 0; virtual void SetPosition( float fSeconds ) = 0; virtual void SetPlaybackRate( float fRate ) = 0; - virtual bool IsPlaying() const = 0; virtual void SetLooping(bool looping=true) { } bool IsAMovie() const { return true; } diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index 437d26b698..38b6bca325 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -446,7 +446,6 @@ try { CHECKPOINT; StartThread(); - Play(); } catch(...) { @@ -723,7 +722,7 @@ bool MovieTexture_FFMpeg::DecodeFrame() { ASSERT_M( m_ImageWaiting == FRAME_NONE, ssprintf("%i", m_ImageWaiting) ); - if( m_State != PLAYING ) + if( m_State == DECODER_QUIT ) return false; CHECKPOINT; @@ -848,20 +847,15 @@ void MovieTexture_FFMpeg::DecoderThread() while( m_State != DECODER_QUIT ) { - if( m_State == PAUSE_DECODER ) - { - /* We aren't feeding frames, so we aren't waiting; don't chew CPU. - * This needs to be relatively short so that we wake up quickly - * from being paused or for changes in m_Rate. */ - usleep( 10000 ); - continue; - } - if( m_ImageWaiting == FRAME_NONE ) DecodeFrame(); + /* If we still have no frame, we're at EOF and we didn't loop. */ if( m_ImageWaiting != FRAME_DECODED ) + { + usleep( 10000 ); continue; + } const float fTime = CheckFrameTime(); if( fTime == -1 ) // skip frame @@ -958,7 +952,7 @@ void MovieTexture_FFMpeg::Reload() void MovieTexture_FFMpeg::StartThread() { ASSERT( m_State == DECODER_QUIT ); - m_State = PAUSE_DECODER; + m_State = DECODER_RUNNING; m_DecoderThread.SetName( ssprintf("MovieTexture_FFMpeg(%s)", GetID().filename.c_str()) ); if( m_bThreaded ) @@ -988,16 +982,6 @@ void MovieTexture_FFMpeg::StopThread() LOG->Trace("Decoder thread shut down."); } -void MovieTexture_FFMpeg::Play() -{ - m_State = PLAYING; -} - -void MovieTexture_FFMpeg::Pause() -{ - m_State = PAUSE_DECODER; -} - void MovieTexture_FFMpeg::SetPosition( float fSeconds ) { ASSERT( m_State != DECODER_QUIT ); @@ -1018,10 +1002,6 @@ void MovieTexture_FFMpeg::SetPosition( float fSeconds ) /* This is used to decode data. */ void MovieTexture_FFMpeg::DecodeSeconds( float fSeconds ) { - /* If we're paused, then ignore time passing. */ - if( m_State != PLAYING ) - return; - m_Clock += fSeconds * m_Rate; /* If we're not threaded, we want to be sure to decode any new frames now, diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h index 3c8bbb6c9e..a36b5ed01b 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h @@ -26,12 +26,9 @@ public: virtual void Reload(); - virtual void Play(); - virtual void Pause(); virtual void SetPosition( float fSeconds ); virtual void DecodeSeconds( float fSeconds ); virtual void SetPlaybackRate( float fRate ) { m_Rate=fRate; } - virtual bool IsPlaying() const { return m_State == PLAYING; } void SetLooping(bool looping=true) { m_bLoop = looping; } unsigned GetTexHandle() const { return m_uTexHandle; } @@ -62,7 +59,7 @@ private: * * PLAYING: The decoder thread is running. */ - enum State { DECODER_QUIT, PAUSE_DECODER, PLAYING } m_State; + enum State { DECODER_QUIT, DECODER_RUNNING } m_State; unsigned m_uTexHandle; diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h index b0df764023..dfe7d53b04 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h @@ -25,12 +25,8 @@ public: unsigned GetTexHandle() const { return texHandle; } void Update(float delta) { } void Reload() { } - void Play() { playing = true; } - void Pause() { playing = false; } - void Stop() { playing = false; } void SetPosition(float seconds) { } void SetPlaybackRate(float rate) { } - bool IsPlaying() const { return playing; } void SetLooping(bool looping=true) { loop = looping; } };