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

Removed useless stuff from clipworkflow

parent 3865376a
......@@ -48,12 +48,12 @@ class AudioClipWorkflow : public ClipWorkflow
Pool<AudioSample*> m_computedBuffers;
QReadWriteLock* m_availableBuffersLock;
Pool<AudioSample*> m_availableBuffers;
void initVlcOutput();
static void lock( AudioClipWorkflow* clipWorkflow, uint8_t** pcm_buffer , unsigned int size );
static void unlock( AudioClipWorkflow* clipWorkflow, uint8_t* pcm_buffer,
unsigned int channels, unsigned int rate,
unsigned int nb_samples, unsigned int bits_per_sample,
unsigned int size, qint64 pts );
void initVlcOutput();
static void lock( AudioClipWorkflow* clipWorkflow, uint8_t** pcm_buffer , unsigned int size );
static void unlock( AudioClipWorkflow* clipWorkflow, uint8_t* pcm_buffer,
unsigned int channels, unsigned int rate,
unsigned int nb_samples, unsigned int bits_per_sample,
unsigned int size, qint64 pts );
//FIXME: this is totally random powered ! Please adjust with a value that does make sense...
static const uint32_t nbBuffers = 128;
......
......@@ -33,15 +33,11 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_rendering( false ),
m_initFlag( false ),
m_clip( clip ),
m_state( ClipWorkflow::Stopped ),
m_fullSpeedRender( false )
m_state( ClipWorkflow::Stopped )
{
m_stateLock = new QReadWriteLock;
m_requiredStateLock = new QMutex;
m_waitCond = new QWaitCondition;
m_condMutex = new QMutex;
m_initWaitCond = new WaitCondition;
m_renderWaitCond = new WaitCondition;
m_pausingStateWaitCond = new WaitCondition;
m_renderLock = new QMutex;
}
......@@ -51,9 +47,6 @@ ClipWorkflow::~ClipWorkflow()
delete m_renderLock;
delete m_pausingStateWaitCond;
delete m_initWaitCond;
delete m_condMutex;
delete m_waitCond;
delete m_renderWaitCond;
delete m_requiredStateLock;
delete m_stateLock;
}
......@@ -173,7 +166,6 @@ void ClipWorkflow::startRender( bool startInPausedMode )
void ClipWorkflow::clipEndReached()
{
setState( EndReached );
emit renderComplete( this );
}
Clip* ClipWorkflow::getClip()
......@@ -250,11 +242,6 @@ void ClipWorkflow::queryStateChange( State newState )
m_requiredState = newState;
}
void ClipWorkflow::wake()
{
m_waitCond->wakeAll();
}
QReadWriteLock* ClipWorkflow::getStateLock()
{
return m_stateLock;
......@@ -267,11 +254,6 @@ void ClipWorkflow::pause()
m_mediaPlayer->pause();
QMutexLocker lock( m_requiredStateLock );
m_requiredState = ClipWorkflow::None;
{
QMutexLocker sync( m_condMutex );
wake();
}
}
void ClipWorkflow::unpause()
......@@ -281,12 +263,6 @@ void ClipWorkflow::unpause()
m_mediaPlayer->pause();
}
void ClipWorkflow::waitForCompleteRender( bool dontCheckRenderStarted /*= false*/ )
{
if ( isRendering() == true || dontCheckRenderStarted == true )
m_renderWaitCond->waitLocked();
}
void ClipWorkflow::waitForCompleteInit()
{
if ( isReady() == false )
......@@ -296,11 +272,6 @@ void ClipWorkflow::waitForCompleteInit()
}
}
QMutex* ClipWorkflow::getSleepMutex()
{
return m_condMutex;
}
LibVLCpp::MediaPlayer* ClipWorkflow::getMediaPlayer()
{
return m_mediaPlayer;
......@@ -319,38 +290,15 @@ void ClipWorkflow::unpausedMediaPlayer()
emit unpaused();
}
void ClipWorkflow::setFullSpeedRender( bool value )
{
m_fullSpeedRender = value;
}
WaitCondition* ClipWorkflow::getRenderCondWait()
{
return m_renderWaitCond;
}
void ClipWorkflow::commonUnlock()
{
m_stateLock->lockForWrite();
if ( m_state == Rendering )
{
QMutexLocker lock( m_condMutex );
m_state = Sleeping;
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();
if ( m_state == Sleeping )
m_state = Rendering;
......@@ -358,7 +306,6 @@ void ClipWorkflow::commonUnlock()
}
else
m_stateLock->unlock();
// qDebug() << '[' << (void*)this << "] ClipWorkflow::unlock";
checkStateChange();
}
......
......@@ -138,11 +138,6 @@ class ClipWorkflow : public QObject
*/
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.
* It should be use to lock the value when checking states from outside this
......@@ -154,21 +149,11 @@ class ClipWorkflow : public QObject
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* getUnlockCallback() = 0;
LibVLCpp::MediaPlayer* getMediaPlayer();
void setFullSpeedRender( bool value );
private:
void setState( State state );
void checkSynchronisation( State newState );
......@@ -203,11 +188,7 @@ class ClipWorkflow : public QObject
Clip* m_clip;
QMutex* m_renderLock;
QReadWriteLock* m_stateLock;
QMutex* m_condMutex;
State m_state;
WaitCondition* m_renderWaitCond;
QWaitCondition* m_waitCond;
bool m_fullSpeedRender;
qint64 m_previousPts;
qint64 m_currentPts;
/**
......@@ -238,7 +219,6 @@ class ClipWorkflow : public QObject
void clipEndReached();
signals:
void renderComplete( ClipWorkflow* );
void paused();
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