Commit 1189fb7c authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Things are starting to become functionnal again

parent bb59b5e4
...@@ -78,6 +78,7 @@ void ClipWorkflow::initialize() ...@@ -78,6 +78,7 @@ void ClipWorkflow::initialize()
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( loadingComplete() ), Qt::DirectConnection ); connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( loadingComplete() ), Qt::DirectConnection );
connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( clipEndReached() ), Qt::DirectConnection ); connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( clipEndReached() ), Qt::DirectConnection );
qDebug() << "Starting clipworkflow playback";
m_mediaPlayer->play(); m_mediaPlayer->play();
} }
...@@ -85,8 +86,10 @@ void ClipWorkflow::loadingComplete() ...@@ -85,8 +86,10 @@ void ClipWorkflow::loadingComplete()
{ {
adjustBegin(); adjustBegin();
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( loadingComplete() ) ); disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( loadingComplete() ) );
qDebug() << "Setting state to Rendering";
QMutexLocker lock( m_initWaitCond->getMutex() ); QMutexLocker lock( m_initWaitCond->getMutex() );
setState( Rendering ); setState( Rendering );
qDebug() << "Waking init wait cond";
m_initWaitCond->wake(); m_initWaitCond->wake();
} }
......
...@@ -115,7 +115,9 @@ void TrackHandler::getOutput( qint64 currentFrame ) ...@@ -115,7 +115,9 @@ void TrackHandler::getOutput( qint64 currentFrame )
{ {
StackedBuffer<AudioClipWorkflow::AudioSample*>* stackedBuffer = StackedBuffer<AudioClipWorkflow::AudioSample*>* stackedBuffer =
reinterpret_cast<StackedBuffer<AudioClipWorkflow::AudioSample*>*> (m_tracks[i]->getOutput( currentFrame ) ); reinterpret_cast<StackedBuffer<AudioClipWorkflow::AudioSample*>*> (m_tracks[i]->getOutput( currentFrame ) );
m_tmpAudioBuffer = stackedBuffer->get(); if ( stackedBuffer != NULL )
m_tmpAudioBuffer = stackedBuffer->get();
//else if will remain NULL
} }
} }
} }
......
...@@ -219,8 +219,17 @@ void TrackWorkflow::stop() ...@@ -219,8 +219,17 @@ void TrackWorkflow::stop()
m_lastFrame = 0; m_lastFrame = 0;
} }
void TrackWorkflow::releasePreviousRender()
{
if ( m_audioStackedBuffer != NULL )
m_audioStackedBuffer->release();
if ( m_videoStackedBuffer != NULL )
m_videoStackedBuffer->release();
}
void* TrackWorkflow::getOutput( qint64 currentFrame ) void* TrackWorkflow::getOutput( qint64 currentFrame )
{ {
releasePreviousRender();
QReadLocker lock( m_clipsLock ); QReadLocker lock( m_clipsLock );
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin(); QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
......
...@@ -83,6 +83,7 @@ class TrackWorkflow : public QObject ...@@ -83,6 +83,7 @@ class TrackWorkflow : public QObject
bool checkEnd( qint64 currentFrame ) const; bool checkEnd( qint64 currentFrame ) const;
void adjustClipTime( qint64 currentFrame, qint64 start, ClipWorkflow* cw ); void adjustClipTime( qint64 currentFrame, qint64 start, ClipWorkflow* cw );
void disconnectClipWorkflow( ClipWorkflow* cw ); void disconnectClipWorkflow( ClipWorkflow* cw );
void releasePreviousRender();
private: private:
......
...@@ -86,9 +86,10 @@ void* VideoClipWorkflow::getUnlockCallback() ...@@ -86,9 +86,10 @@ void* VideoClipWorkflow::getUnlockCallback()
void* VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode ) void* VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
{ {
QMutexLocker lock( m_renderLock );
preGetOutput(); preGetOutput();
//Don't lock before preGetOutput() : it can eventually waits for the clipworkflow to render a frame
//which requires the renderLock to be unheld.
QMutexLocker lock( m_renderLock );
qWarning() << "poping buffer"; qWarning() << "poping buffer";
if ( isEndReached() == true ) if ( isEndReached() == 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