Commit 8ee8758c authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Revert "Removed debug" so that debug can continue ! Hurray

This reverts commit df19117a.
parent df19117a
......@@ -79,7 +79,7 @@ void MediaPlayer::callbacks( const libvlc_event_t* ev
self->emit playing();
break;
case libvlc_MediaPlayerPaused:
// qDebug() << "Media player paused";
qDebug() << "Media player paused";
self->emit paused();
break;
case libvlc_MediaPlayerStopped:
......
......@@ -73,11 +73,13 @@ void ClipWorkflow::checkStateChange()
QWriteLocker lock2( m_stateLock );
if ( m_requiredState != ClipWorkflow::None )
{
// qDebug() << "Changed state from" << m_state << "to state" << m_requiredState;
qDebug() << "Changed state from" << m_state << "to state" << m_requiredState;
m_state = m_requiredState;
m_requiredState = ClipWorkflow::None;
checkSynchronisation( m_state );
}
else
qDebug() << "No state required";
}
void ClipWorkflow::lock( ClipWorkflow* cw, void** pp_ret )
......@@ -91,7 +93,7 @@ void ClipWorkflow::lock( ClipWorkflow* cw, void** pp_ret )
// else
// {
*pp_ret = cw->m_buffer;
// qDebug() << "Clip workflow locking <<<<<<<<<<<<<<<<<<<<<<<<<<";
qDebug() << "Clip workflow locking <<<<<<<<<<<<<<<<<<<<<<<<<<";
// }
}
......@@ -112,14 +114,15 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
{
QMutexLocker lock( cw->m_condMutex );
qDebug() << "Setting state to Sleeping";
cw->m_state = Sleeping;
cw->m_stateLock->unlock();
//Signal that render has been completed.
cw->m_renderWaitCond->wake();
// qDebug() << "Entering condwait";
qDebug() << "Entering condwait";
cw->m_waitCond->wait( cw->m_condMutex );
// qDebug() << "Leaved condwait";
qDebug() << "Leaved condwait";
cw->m_stateLock->lockForWrite();
cw->m_state = Rendering;
// {
......@@ -130,6 +133,7 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
}
else if ( cw->m_state == Paused )
{
qDebug() << "Forcing pause inside of unlock";
cw->m_stateLock->unlock();
cw->m_waitCond->wait( cw->m_condMutex );
}
......@@ -279,6 +283,7 @@ void ClipWorkflow::checkSynchronisation( State newState )
m_initWaitCond->wake();
break ;
case Pausing:
qDebug() << "Waking m_pausingStateWaitCond";
m_pausingStateWaitCond->wake();
break ;
default:
......@@ -297,7 +302,7 @@ void ClipWorkflow::setState( State state )
void ClipWorkflow::queryStateChange( State newState )
{
// qDebug() << "Querying state change to" << newState;
qDebug() << "Querying state change to" << newState;
QMutexLocker lock( m_requiredStateLock );
m_requiredState = newState;
}
......@@ -305,6 +310,7 @@ void ClipWorkflow::queryStateChange( State newState )
void ClipWorkflow::wake()
{
m_waitCond->wakeAll();
qDebug() << "Awaked thread";
}
QReadWriteLock* ClipWorkflow::getStateLock()
......@@ -324,6 +330,7 @@ void ClipWorkflow::pause()
setState( Paused );
m_mediaPlayer->pause();
QMutexLocker lock( m_requiredStateLock );
qDebug() << "ClipWorkflow::pause(); Reseting required state";
m_requiredState = ClipWorkflow::None;
}
......
......@@ -126,11 +126,13 @@ void MainWorkflow::pause()
{
QMutexLocker lock( m_renderMutex );
qDebug() << "Pausing.......................";
for ( unsigned int i = 0; i < m_trackCount; ++i )
{
if ( m_tracks[i].activated() == true )
m_tracks[i]->pause();
}
qDebug() << "Pausing completed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n";
}
void MainWorkflow::nextFrame()
......
......@@ -128,6 +128,7 @@ unsigned char* TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentF
// qDebug() << "Querying state back to pause after render";
cw->queryStateChange( ClipWorkflow::Paused );
}
qDebug() << ">>> Awaking ClipWorkflow thread for render";
cw->wake();
}
else if ( cw->getState() == ClipWorkflow::Stopped )
......@@ -200,11 +201,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 )
{
......@@ -259,6 +264,7 @@ unsigned char* TrackWorkflow::getOutput( qint64 currentFrame )
bool needRepositioning;
bool oneFrameOnlyFlag = false;
qDebug() << "Asking for track output";
// qDebug() << "Checking flag...";
if ( m_oneFrameOnly == 1 )
{
......@@ -335,30 +341,42 @@ void TrackWorkflow::pauseClipWorkflow( ClipWorkflow* cw )
cw->getState() == ClipWorkflow::Ready ||
cw->getState() == ClipWorkflow::EndReached )
{
qDebug() << "Pausing a sleeping, ready or EndReached ClipWorkflow, state =" << cw->getState();
cw->queryStateChange( ClipWorkflow::Pausing );
qDebug() << "Unlocked state mutex";
cw->getStateLock()->unlock();
cw->wake();
}
else if ( cw->getState() == ClipWorkflow::Rendering )
{
qDebug() << "Pausing a rendering clip workflow";
cw->getStateLock()->unlock();
qDebug() << "Waiting for render complete";
cw->waitForCompleteRender();
qDebug() << "Waiting complete";
qDebug() << "Waiting for sleep mutex";
QMutexLocker lock( cw->getSleepMutex() );
qDebug() << "Got sleep mutex";
cw->queryStateChange( ClipWorkflow::Pausing );
cw->wake();
}
else if ( cw->getState() == ClipWorkflow::Initializing )
{
qDebug() << "Pausing a Initializing ClipWorkflow";
cw->getStateLock()->unlock();
//TODO: since a Initializing clipworkflow will pause itself at the end, shouldn't we do nothing ?
cw->waitForCompleteInit();
}
else
{
qDebug() << "Unexpected ClipWorkflow::State when pausing:" << cw->getState();
cw->getStateLock()->unlock();
}
qDebug() << "Waiting for pausing state";
cw->waitForPausingState();
qDebug() << "Waiting ok. Pausing now... ";
cw->pause();
qDebug() << "Clip paused.";
}
void TrackWorkflow::pause()
......@@ -369,6 +387,7 @@ void TrackWorkflow::pause()
QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
//FIXME: it's probably bad to iterate over every clip workflows.
qDebug() << "Started track pause loop";
for ( ; it != end; ++it )
{
ClipWorkflow* cw = it.value();
......@@ -388,9 +407,10 @@ 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";
qDebug() << "Asking to pause in an already paused state";
}
}
qDebug() << "End of loop";
m_paused = !m_paused;
}
......
......@@ -90,8 +90,10 @@ void* WorkflowRenderer::lock( void* datas )
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 );
qDebug() << "Got picture";
return ret;
}
else
......@@ -123,6 +125,7 @@ void WorkflowRenderer::checkActions()
switch ( act )
{
case Pause:
qDebug() << "Pausing WorkflowRenderer mediaPlayer";
m_mediaPlayer->pause();
//This will also pause the MainWorkflow via a signal/slot
break ;
......@@ -181,6 +184,7 @@ void WorkflowRenderer::previousFrame()
void WorkflowRenderer::pauseMainWorkflow()
{
qDebug() << "In pause callback";
m_mainWorkflow->pause();
m_paused = true;
}
......
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