Commit 27b832c3 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Merge branch 'chouquette_debug_pause'

Conflicts:
	src/Workflow/ClipWorkflow.cpp
	src/Workflow/MainWorkflow.cpp
	src/Workflow/TrackWorkflow.cpp
	src/renderer/WorkflowRenderer.cpp
parents c277adec 3084c18a
......@@ -110,10 +110,11 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
{
cw->m_state = Sleeping;
cw->m_stateLock->unlock();
//Signal that render has been completed.
cw->m_renderWaitCond->wake();
// qDebug() << "Entering condwait";
cw->m_waitCond->wait();
cw->m_waitCond->wait( cw->m_condMutex );
// qDebug() << "Leaved condwait";
cw->m_stateLock->lockForWrite();
cw->m_state = Rendering;
......@@ -125,7 +126,6 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
}
else if ( cw->m_state == Paused )
{
// qDebug() << "Forcing pause by pausing thread";
cw->m_stateLock->unlock();
cw->m_waitCond->wait();
}
......@@ -287,13 +287,14 @@ void ClipWorkflow::setState( State state )
void ClipWorkflow::queryStateChange( State newState )
{
// qDebug() << "Querying state change to" << newState;
QMutexLocker lock( m_requiredStateLock );
m_requiredState = newState;
}
void ClipWorkflow::wake()
{
m_waitCond->wake();
m_waitCond->wakeAll();
}
QReadWriteLock* ClipWorkflow::getStateLock()
......
......@@ -122,6 +122,8 @@ unsigned char* MainWorkflow::getOutput()
void MainWorkflow::pause()
{
QMutexLocker lock( m_renderMutex );
for ( unsigned int i = 0; i < m_trackCount; ++i )
{
if ( m_tracks[i].activated() == true )
......
......@@ -202,15 +202,11 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
}
else if ( cw->getState() == ClipWorkflow::Rendering )
{
qDebug() << "Stopping while rendering";
cw->getStateLock()->unlock();
qDebug() << "Waiting complete render";
cw->waitForCompleteRender();
qDebug() << "Waited ok.";
cw->queryStateChange( ClipWorkflow::Stopping );
cw->wake();
cw->stop();
qDebug() << "Stopped clip workflow";
}
else if ( cw->getState() == ClipWorkflow::Initializing )
{
......@@ -265,14 +261,8 @@ unsigned char* TrackWorkflow::getOutput( qint64 currentFrame )
bool needRepositioning;
bool oneFrameOnlyFlag = false;
// qDebug() << "Checking flag...";
if ( m_oneFrameOnly == 1 )
{
// qDebug() << "...Flag is activated";
oneFrameOnlyFlag = true;
}
// else
// qDebug() << "...Flag is OFF";
if ( checkEnd( currentFrame ) == true )
{
emit trackEndReached( m_trackId );
......@@ -341,14 +331,15 @@ void TrackWorkflow::pauseClipWorkflow( ClipWorkflow* cw )
cw->getState() == ClipWorkflow::Ready ||
cw->getState() == ClipWorkflow::EndReached )
{
cw->getStateLock()->unlock();
cw->queryStateChange( ClipWorkflow::Pausing );
cw->getStateLock()->unlock();
cw->wake();
}
else if ( cw->getState() == ClipWorkflow::Rendering )
{
cw->getStateLock()->unlock();
cw->waitForCompleteRender();
QMutexLocker lock( cw->getSleepMutex() );
cw->queryStateChange( ClipWorkflow::Pausing );
cw->wake();
}
......@@ -359,7 +350,6 @@ void TrackWorkflow::pauseClipWorkflow( ClipWorkflow* cw )
}
else
{
qDebug() << "Unexpected ClipWorkflow::State when pausing:" << cw->getState();
cw->getStateLock()->unlock();
}
cw->waitForPausingState();
......@@ -393,7 +383,7 @@ void TrackWorkflow::pause()
{
//This should never be used.
//TODO: remove this in a few revision (wrote on July 16 2009 )
Q_ASSERT( false );
qDebug() << "Asking to pause in an already paused state";
}
}
m_paused = !m_paused;
......
......@@ -83,9 +83,11 @@ void* WorkflowRenderer::lock( void* datas )
{
WorkflowRenderer* self = reinterpret_cast<WorkflowRenderer*>( datas );
//If we're not playing, then where in a paused media player.
if ( self->m_mediaPlayer->isPlaying() == false )
return self->m_lastFrame;
if ( self->m_oneFrameOnly < 2 )
{
// qDebug() << "\nQuerying new picture";
void* ret = self->m_mainWorkflow->getOutput();
self->m_lastFrame = static_cast<unsigned char*>( ret );
return ret;
......@@ -151,6 +153,12 @@ void WorkflowRenderer::previousFrame()
}
void WorkflowRenderer::pauseMainWorkflow()
{
m_mainWorkflow->pause();
m_paused = true;
}
void WorkflowRenderer::togglePlayPause( bool forcePause )
{
//If force pause is true, we just ensure that this render is paused... no need to start it.
......
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