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

Removed useless stuff from clipworkflow

parent 3865376a
...@@ -33,15 +33,11 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) : ...@@ -33,15 +33,11 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_rendering( false ), m_rendering( false ),
m_initFlag( false ), m_initFlag( false ),
m_clip( clip ), m_clip( clip ),
m_state( ClipWorkflow::Stopped ), m_state( ClipWorkflow::Stopped )
m_fullSpeedRender( false )
{ {
m_stateLock = new QReadWriteLock; m_stateLock = new QReadWriteLock;
m_requiredStateLock = new QMutex; m_requiredStateLock = new QMutex;
m_waitCond = new QWaitCondition;
m_condMutex = new QMutex;
m_initWaitCond = new WaitCondition; m_initWaitCond = new WaitCondition;
m_renderWaitCond = new WaitCondition;
m_pausingStateWaitCond = new WaitCondition; m_pausingStateWaitCond = new WaitCondition;
m_renderLock = new QMutex; m_renderLock = new QMutex;
} }
...@@ -51,9 +47,6 @@ ClipWorkflow::~ClipWorkflow() ...@@ -51,9 +47,6 @@ ClipWorkflow::~ClipWorkflow()
delete m_renderLock; delete m_renderLock;
delete m_pausingStateWaitCond; delete m_pausingStateWaitCond;
delete m_initWaitCond; delete m_initWaitCond;
delete m_condMutex;
delete m_waitCond;
delete m_renderWaitCond;
delete m_requiredStateLock; delete m_requiredStateLock;
delete m_stateLock; delete m_stateLock;
} }
...@@ -173,7 +166,6 @@ void ClipWorkflow::startRender( bool startInPausedMode ) ...@@ -173,7 +166,6 @@ void ClipWorkflow::startRender( bool startInPausedMode )
void ClipWorkflow::clipEndReached() void ClipWorkflow::clipEndReached()
{ {
setState( EndReached ); setState( EndReached );
emit renderComplete( this );
} }
Clip* ClipWorkflow::getClip() Clip* ClipWorkflow::getClip()
...@@ -250,11 +242,6 @@ void ClipWorkflow::queryStateChange( State newState ) ...@@ -250,11 +242,6 @@ void ClipWorkflow::queryStateChange( State newState )
m_requiredState = newState; m_requiredState = newState;
} }
void ClipWorkflow::wake()
{
m_waitCond->wakeAll();
}
QReadWriteLock* ClipWorkflow::getStateLock() QReadWriteLock* ClipWorkflow::getStateLock()
{ {
return m_stateLock; return m_stateLock;
...@@ -267,11 +254,6 @@ void ClipWorkflow::pause() ...@@ -267,11 +254,6 @@ void ClipWorkflow::pause()
m_mediaPlayer->pause(); m_mediaPlayer->pause();
QMutexLocker lock( m_requiredStateLock ); QMutexLocker lock( m_requiredStateLock );
m_requiredState = ClipWorkflow::None; m_requiredState = ClipWorkflow::None;
{
QMutexLocker sync( m_condMutex );
wake();
}
} }
void ClipWorkflow::unpause() void ClipWorkflow::unpause()
...@@ -281,12 +263,6 @@ void ClipWorkflow::unpause() ...@@ -281,12 +263,6 @@ void ClipWorkflow::unpause()
m_mediaPlayer->pause(); m_mediaPlayer->pause();
} }
void ClipWorkflow::waitForCompleteRender( bool dontCheckRenderStarted /*= false*/ )
{
if ( isRendering() == true || dontCheckRenderStarted == true )
m_renderWaitCond->waitLocked();
}
void ClipWorkflow::waitForCompleteInit() void ClipWorkflow::waitForCompleteInit()
{ {
if ( isReady() == false ) if ( isReady() == false )
...@@ -296,11 +272,6 @@ void ClipWorkflow::waitForCompleteInit() ...@@ -296,11 +272,6 @@ void ClipWorkflow::waitForCompleteInit()
} }
} }
QMutex* ClipWorkflow::getSleepMutex()
{
return m_condMutex;
}
LibVLCpp::MediaPlayer* ClipWorkflow::getMediaPlayer() LibVLCpp::MediaPlayer* ClipWorkflow::getMediaPlayer()
{ {
return m_mediaPlayer; return m_mediaPlayer;
...@@ -319,38 +290,15 @@ void ClipWorkflow::unpausedMediaPlayer() ...@@ -319,38 +290,15 @@ void ClipWorkflow::unpausedMediaPlayer()
emit unpaused(); emit unpaused();
} }
void ClipWorkflow::setFullSpeedRender( bool value )
{
m_fullSpeedRender = value;
}
WaitCondition* ClipWorkflow::getRenderCondWait()
{
return m_renderWaitCond;
}
void ClipWorkflow::commonUnlock() void ClipWorkflow::commonUnlock()
{ {
m_stateLock->lockForWrite(); m_stateLock->lockForWrite();
if ( m_state == Rendering ) if ( m_state == Rendering )
{ {
QMutexLocker lock( m_condMutex );
m_state = Sleeping; m_state = Sleeping;
m_stateLock->unlock(); m_stateLock->unlock();
{
QMutexLocker lock2( m_renderWaitCond->getMutex() );
m_renderWaitCond->wake();
}
emit renderComplete( this );
// qDebug() << "Emmiting render completed";
// qDebug() << "Entering cond wait";
m_waitCond->wait( m_condMutex );
// qDebug() << "Leaving condwait";
m_stateLock->lockForWrite(); m_stateLock->lockForWrite();
if ( m_state == Sleeping ) if ( m_state == Sleeping )
m_state = Rendering; m_state = Rendering;
...@@ -358,7 +306,6 @@ void ClipWorkflow::commonUnlock() ...@@ -358,7 +306,6 @@ void ClipWorkflow::commonUnlock()
} }
else else
m_stateLock->unlock(); m_stateLock->unlock();
// qDebug() << '[' << (void*)this << "] ClipWorkflow::unlock";
checkStateChange(); checkStateChange();
} }
......
...@@ -138,11 +138,6 @@ class ClipWorkflow : public QObject ...@@ -138,11 +138,6 @@ class ClipWorkflow : public QObject
*/ */
void queryStateChange( State newState ); void queryStateChange( State newState );
/**
* This method will wake the renderer thread for one iteration.
*/
void wake();
/** /**
* This returns the QReadWriteLock that protects the ClipWorkflow's state. * This returns the QReadWriteLock that protects the ClipWorkflow's state.
* It should be use to lock the value when checking states from outside this * It should be use to lock the value when checking states from outside this
...@@ -154,21 +149,11 @@ class ClipWorkflow : public QObject ...@@ -154,21 +149,11 @@ class ClipWorkflow : public QObject
void waitForCompleteInit(); void waitForCompleteInit();
/**
* \brief Return the wait condition associated to the render.
* It's used when waiting for a render to terminate.
*/
WaitCondition* getRenderCondWait();
void waitForCompleteRender( bool dontCheckRenderStarted = false );
QMutex* getSleepMutex();
virtual void* getLockCallback() = 0; virtual void* getLockCallback() = 0;
virtual void* getUnlockCallback() = 0; virtual void* getUnlockCallback() = 0;
LibVLCpp::MediaPlayer* getMediaPlayer(); LibVLCpp::MediaPlayer* getMediaPlayer();
void setFullSpeedRender( bool value );
private: private:
void setState( State state ); void setState( State state );
void checkSynchronisation( State newState ); void checkSynchronisation( State newState );
...@@ -203,11 +188,7 @@ class ClipWorkflow : public QObject ...@@ -203,11 +188,7 @@ class ClipWorkflow : public QObject
Clip* m_clip; Clip* m_clip;
QMutex* m_renderLock; QMutex* m_renderLock;
QReadWriteLock* m_stateLock; QReadWriteLock* m_stateLock;
QMutex* m_condMutex;
State m_state; State m_state;
WaitCondition* m_renderWaitCond;
QWaitCondition* m_waitCond;
bool m_fullSpeedRender;
qint64 m_previousPts; qint64 m_previousPts;
qint64 m_currentPts; qint64 m_currentPts;
/** /**
...@@ -238,7 +219,6 @@ class ClipWorkflow : public QObject ...@@ -238,7 +219,6 @@ class ClipWorkflow : public QObject
void clipEndReached(); void clipEndReached();
signals: signals:
void renderComplete( ClipWorkflow* );
void paused(); void paused();
void unpaused(); void unpaused();
}; };
......
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