Add support for 0% and negative background rates. This isn't supported by many codecs though...
This commit is contained in:
@@ -964,13 +964,19 @@ void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop
|
||||
// FIXME: Very dangerous. How could we handle this better?
|
||||
Sprite* pSprite = (Sprite*)m_pActors[0];
|
||||
|
||||
pSprite->GetTexture()->SetPlaybackRate(fRate);
|
||||
|
||||
//
|
||||
// The order of these actions is important.
|
||||
// At this point, the movie is probably paused (by LosingFocus()).
|
||||
// Play the movie, then set the playback rate (which can
|
||||
// potentially pause the movie again).
|
||||
//
|
||||
if( bRewindMovie )
|
||||
pSprite->GetTexture()->SetPosition( 0 );
|
||||
pSprite->GetTexture()->SetLooping(bLoop);
|
||||
|
||||
// if movie texture, pause and play movie so we don't waste CPU cycles decoding frames that won't be shown
|
||||
pSprite->GetTexture()->Play();
|
||||
pSprite->GetTexture()->SetPlaybackRate(fRate);
|
||||
|
||||
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||
m_pActors[i]->Command( m_sOnCommand );
|
||||
|
||||
@@ -414,13 +414,10 @@ void Background::Update( float fDeltaTime )
|
||||
|
||||
m_pCurrentBGA = m_BGAnimations[ change.m_sBGName ];
|
||||
|
||||
if( pOld != m_pCurrentBGA )
|
||||
{
|
||||
if( pOld )
|
||||
pOld->LosingFocus();
|
||||
if( m_pCurrentBGA )
|
||||
m_pCurrentBGA->GainingFocus( change.m_fRate, change.m_bRewindMovie, change.m_bLoop );
|
||||
}
|
||||
if( pOld )
|
||||
pOld->LosingFocus();
|
||||
if( m_pCurrentBGA )
|
||||
m_pCurrentBGA->GainingFocus( change.m_fRate, change.m_bRewindMovie, change.m_bLoop );
|
||||
|
||||
m_fSecsLeftInFade = m_pFadingBGA!=NULL ? FADE_SECONDS : 0;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ Menu g_EditSongInfo
|
||||
Menu g_BGChange
|
||||
(
|
||||
"Background Change",
|
||||
MenuRow( "Rate (applies to new adds)", true, 5, "50%","60%","70%","80%","90%","100%","110%","120%","130%","140%","150%","160%","170%","180%","190%","200%" ),
|
||||
MenuRow( "Rate (applies to new adds)", true, 15, "-100%","-80%","-60%","-40%","-20%","0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","120%","140%","160%","180%","200%" ),
|
||||
MenuRow( "Fade Last (applies to new adds)", true, 0, "NO","YES" ),
|
||||
MenuRow( "Rewind Movie (applies to new adds)", true, 0, "NO","YES" ),
|
||||
MenuRow( "Loop (applies to new adds)", true, 1, "NO","YES" ),
|
||||
|
||||
@@ -33,13 +33,13 @@ struct MenuRow
|
||||
defaultChoice = 0;
|
||||
}
|
||||
|
||||
MenuRow( const char * n, bool e, int d=0, const char * c0=NULL, const char * c1=NULL, const char * c2=NULL, const char * c3=NULL, const char * c4=NULL, const char * c5=NULL, const char * c6=NULL, const char * c7=NULL, const char * c8=NULL, const char * c9=NULL, const char * c10=NULL, const char * c11=NULL, const char * c12=NULL, const char * c13=NULL, const char * c14=NULL, const char * c15=NULL, const char * c16=NULL, const char * c17=NULL, const char * c18=NULL, const char * c19=NULL )
|
||||
MenuRow( const char * n, bool e, int d=0, const char * c0=NULL, const char * c1=NULL, const char * c2=NULL, const char * c3=NULL, const char * c4=NULL, const char * c5=NULL, const char * c6=NULL, const char * c7=NULL, const char * c8=NULL, const char * c9=NULL, const char * c10=NULL, const char * c11=NULL, const char * c12=NULL, const char * c13=NULL, const char * c14=NULL, const char * c15=NULL, const char * c16=NULL, const char * c17=NULL, const char * c18=NULL, const char * c19=NULL, const char * c20=NULL, const char * c21=NULL, const char * c22=NULL, const char * c23=NULL, const char * c24=NULL )
|
||||
{
|
||||
name = n;
|
||||
enabled = e;
|
||||
defaultChoice = d;
|
||||
#define PUSH( c ) if(c!=NULL) choices.push_back(c);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);PUSH(c20);PUSH(c21);PUSH(c22);PUSH(c23);PUSH(c24);
|
||||
#undef PUSH
|
||||
// printf( "choices.size = %u", choices.size() );
|
||||
}
|
||||
|
||||
@@ -453,13 +453,25 @@ void MovieTexture_DShow::SetPosition( float fSeconds )
|
||||
|
||||
void MovieTexture_DShow::SetPlaybackRate( float fRate )
|
||||
{
|
||||
if( fRate == 0 )
|
||||
{
|
||||
this->Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
SkipUpdates();
|
||||
|
||||
CComPtr<IMediaPosition> pMP;
|
||||
m_pGB.QueryInterface(&pMP);
|
||||
pMP->put_Rate(fRate);
|
||||
m_pGB.QueryInterface(&pMP);
|
||||
HRESULT hr = pMP->put_Rate(fRate); // fails on many codecs
|
||||
|
||||
StopSkippingUpdates();
|
||||
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
this->Pause();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool MovieTexture_DShow::IsPlaying() const
|
||||
|
||||
Reference in New Issue
Block a user