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

Revert "Merge branch 'chouquette_debug_pause'"

This reverts commit 27b832c3, reversing
changes made to c277adec.
parent 27b832c3
......@@ -173,7 +173,7 @@ void MediaPlayer::takeSnapshot( const char* outputFil
CheckVlcppException( m_ex );
}
bool MediaPlayer::isPlaying()
bool MediaPlayer::isPlaying()
{
int res = libvlc_media_player_is_playing( m_internalPtr, m_ex );
CheckVlcppException( m_ex );
......
......@@ -110,12 +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_condMutex );
// qDebug() << "Leaved condwait";
// qDebug() << "Entering condwait";
cw->m_waitCond->wait();
// qDebug() << "Leaved condwait";
cw->m_stateLock->lockForWrite();
cw->m_state = Rendering;
// {
......@@ -126,6 +125,7 @@ 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,14 +287,13 @@ 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->wakeAll();
m_waitCond->wake();
}
QReadWriteLock* ClipWorkflow::getStateLock()
......
......@@ -122,8 +122,6 @@ 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,11 +202,15 @@ 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 )
{
......@@ -261,8 +265,14 @@ 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 );
......@@ -331,15 +341,14 @@ void TrackWorkflow::pauseClipWorkflow( ClipWorkflow* cw )
cw->getState() == ClipWorkflow::Ready ||
cw->getState() == ClipWorkflow::EndReached )
{
cw->queryStateChange( ClipWorkflow::Pausing );
cw->getStateLock()->unlock();
cw->queryStateChange( ClipWorkflow::Pausing );
cw->wake();
}
else if ( cw->getState() == ClipWorkflow::Rendering )
{
cw->getStateLock()->unlock();
cw->waitForCompleteRender();
QMutexLocker lock( cw->getSleepMutex() );
cw->queryStateChange( ClipWorkflow::Pausing );
cw->wake();
}
......@@ -350,6 +359,7 @@ void TrackWorkflow::pauseClipWorkflow( ClipWorkflow* cw )
}
else
{
qDebug() << "Unexpected ClipWorkflow::State when pausing:" << cw->getState();
cw->getStateLock()->unlock();
}
cw->waitForPausingState();
......@@ -383,7 +393,7 @@ void TrackWorkflow::pause()
{
//This should never be used.
//TODO: remove this in a few revision (wrote on July 16 2009 )
qDebug() << "Asking to pause in an already paused state";
Q_ASSERT( false );
}
}
m_paused = !m_paused;
......
......@@ -83,11 +83,9 @@ 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;
......@@ -153,12 +151,6 @@ 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