Commit fd574379 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

When mainworkflow is paused but a track is moved, it's started in paused mode.

However, at the moment, the first frame isn't displayed... we need to move the position slider to get one...
parent 5fbf6e74
...@@ -143,6 +143,7 @@ void ClipWorkflow::initialize() ...@@ -143,6 +143,7 @@ void ClipWorkflow::initialize()
m_mediaPlayer->play(); m_mediaPlayer->play();
} }
//FIXME: this step is probably useless, due to modification in the TrackWorkflow
void ClipWorkflow::setPositionAfterPlayback() void ClipWorkflow::setPositionAfterPlayback()
{ {
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPositionAfterPlayback() ) ); disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPositionAfterPlayback() ) );
...@@ -190,13 +191,20 @@ ClipWorkflow::State ClipWorkflow::getState() const ...@@ -190,13 +191,20 @@ ClipWorkflow::State ClipWorkflow::getState() const
return m_state; return m_state;
} }
void ClipWorkflow::startRender() void ClipWorkflow::startRender( bool startInPausedMode )
{ {
if ( isReady() == false ) if ( isReady() == false )
m_initWaitCond->wait(); m_initWaitCond->wait();
m_mediaPlayer->play(); if ( startInPausedMode == false )
setState( Rendering ); {
m_mediaPlayer->play();
setState( Rendering );
}
else
{
setState( Paused );
}
} }
void ClipWorkflow::clipEndReached() void ClipWorkflow::clipEndReached()
......
...@@ -107,7 +107,7 @@ class ClipWorkflow : public QObject ...@@ -107,7 +107,7 @@ class ClipWorkflow : public QObject
* on the media player. * on the media player.
* If the media player isn't ready, this method waits. * If the media player isn't ready, this method waits.
*/ */
void startRender(); void startRender( bool startInPausedMode );
/** /**
\brief Returns the Clip this workflow instance is based \brief Returns the Clip this workflow instance is based
......
...@@ -116,9 +116,10 @@ void TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame, ...@@ -116,9 +116,10 @@ void TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
} }
else if ( cw->getState() == ClipWorkflow::Stopped ) else if ( cw->getState() == ClipWorkflow::Stopped )
{ {
qDebug() << "Rendering a stopped clip. m_paused ==" << m_paused;
cw->getStateLock()->unlock(); cw->getStateLock()->unlock();
cw->initialize( ); cw->initialize();
cw->startRender(); cw->startRender( m_paused );
if ( start != currentFrame ) //Clip was not started as its real begining if ( start != currentFrame ) //Clip was not started as its real begining
{ {
float pos = ( (float)( currentFrame - start ) / (float)(cw->getClip()->getLength()) ); float pos = ( (float)( currentFrame - start ) / (float)(cw->getClip()->getLength()) );
...@@ -128,10 +129,11 @@ void TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame, ...@@ -128,10 +129,11 @@ void TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
else if ( cw->getState() == ClipWorkflow::Ready || else if ( cw->getState() == ClipWorkflow::Ready ||
cw->getState() == ClipWorkflow::Initializing ) cw->getState() == ClipWorkflow::Initializing )
{ {
qDebug() << "Rendering a ready clip";
//If the state is Initializing, then the workflow will wait. //If the state is Initializing, then the workflow will wait.
//Otherwise, it will start directly. //Otherwise, it will start directly.
cw->getStateLock()->unlock(); cw->getStateLock()->unlock();
cw->startRender(); cw->startRender( false );
if ( needRepositioning == true ) if ( needRepositioning == true )
{ {
...@@ -270,8 +272,7 @@ bool TrackWorkflow::getOutput( qint64 currentFrame ) ...@@ -270,8 +272,7 @@ bool TrackWorkflow::getOutput( qint64 currentFrame )
needRepositioning = ( abs( currentFrame - lastFrame ) > 1 ) ? true : false; needRepositioning = ( abs( currentFrame - lastFrame ) > 1 ) ? true : false;
} }
m_nbClipToRender = 0; m_nbClipToRender = 0;
//If we ask for an output, then the track should'nt be paused anymore.
m_paused = false;
while ( it != end ) while ( it != end )
{ {
qint64 start = it.key(); qint64 start = it.key();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment