Commit f3e597ee authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Workflow: Rework error notifications

ClipWorkflow won't stop itself but will signal TrackWorkflow instead.
parent 709389e3
......@@ -59,9 +59,6 @@ class ClipHelper : public Workflow::Helper
private slots:
void clipDestroyed();
signals:
void error();
};
#endif // CLIPHELPER_H
......@@ -39,7 +39,6 @@ ClipWorkflow::ClipWorkflow( ClipHelper* ch ) :
m_clipHelper( ch ),
m_state( ClipWorkflow::Stopped )
{
connect( this, SIGNAL( error() ), ch, SIGNAL( error() ) );
m_stateLock = new QReadWriteLock;
m_initWaitCond = new QWaitCondition;
m_renderLock = new QMutex;
......@@ -139,7 +138,8 @@ ClipWorkflow::stopRenderer()
MemoryPool<LibVLCpp::MediaPlayer>::getInstance()->release( m_mediaPlayer );
m_mediaPlayer = NULL;
delete m_vlcMedia;
m_state = Stopped;
if ( m_state != Error )
m_state = Stopped;
flushComputedBuffers();
m_initWaitCond->wakeAll();
......@@ -286,9 +286,8 @@ ClipWorkflow::isResyncRequired()
void
ClipWorkflow::errorEncountered()
{
stopRenderer();
m_state = Error;
emit error();
emit error( this );
}
bool
......
......@@ -274,7 +274,7 @@ class ClipWorkflow : public EffectUser
void errorEncountered();
signals:
void error();
void error( ClipWorkflow* );
};
#endif // CLIPWORKFLOW_H
......@@ -102,6 +102,9 @@ TrackWorkflow::addClip( ClipWorkflow* cw, qint64 start )
this, SLOT( __effectMoved( EffectHelper*, qint64) ) );
connect( cw, SIGNAL( effectRemoved( QUuid ) ),
this, SLOT( __effectRemoved( QUuid ) ) );
// For errors, we don't want this to be called directly from a VLC thread, so we queue it.
connect( cw, SIGNAL( error( ClipWorkflow* ) ),
this, SLOT( clipWorkflowFailure( ClipWorkflow* ) ), Qt::QueuedConnection );
connect( cw->getClipHelper(), SIGNAL( destroyed( QUuid ) ),
this, SLOT( clipDestroyed( QUuid ) ) );
emit clipAdded( this, cw->getClipHelper(), start );
......@@ -205,7 +208,8 @@ TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
else if ( state == ClipWorkflow::EndReached ||
state == ClipWorkflow::Error )
{
//The stopClipWorkflow() method will take care of that.
//The stopClipWorkflow() method will take care of EndReached state.
// When a ClipWorkflow is in error state, we don't want to do anything
}
else
{
......@@ -406,6 +410,11 @@ TrackWorkflow::clipDestroyed( const QUuid& id )
}
}
void TrackWorkflow::clipWorkflowFailure(ClipWorkflow *cw)
{
cw->stop();
}
Clip*
TrackWorkflow::removeClip( const QUuid& id )
{
......
......@@ -137,6 +137,7 @@ class TrackWorkflow : public EffectUser
void __effectRemoved( const QUuid& );
void __effectMoved( EffectHelper*, qint64 );
void clipDestroyed( const QUuid &uuid );
void clipWorkflowFailure( ClipWorkflow* cw );
signals:
void lengthChanged( qint64 newLength );
......
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