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

Solved bugs when moving clips between tracks

parent fa3301d4
......@@ -210,13 +210,17 @@ Clip* ClipWorkflow::getClip()
void ClipWorkflow::stop()
{
Q_ASSERT( m_mediaPlayer != NULL );
m_mediaPlayer->stop();
disconnect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( clipEndReached() ) );
m_mediaPlayer = NULL;
setState( Stopped );
QMutexLocker lock( m_requiredStateLock );
m_requiredState = ClipWorkflow::None;
if ( m_mediaPlayer )
{
m_mediaPlayer->stop();
disconnect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( clipEndReached() ) );
m_mediaPlayer = NULL;
setState( Stopped );
QMutexLocker lock( m_requiredStateLock );
m_requiredState = ClipWorkflow::None;
}
else
qDebug() << "ClipWorkflow has already been stopped";
}
void ClipWorkflow::setPosition( float pos )
......
......@@ -64,7 +64,6 @@ void MainWorkflow::addClip( Clip* clip, unsigned int trackId, qint64 start )
Q_ASSERT_X( trackId < m_trackCount, "MainWorkflow::addClip",
"The specified trackId isn't valid, for it's higher than the number of tracks");
// qDebug() << "MainWorkflow: Adding clip" << clip->getUuid() << "to track" << trackId;
//if the track is deactivated, we need to reactivate it :
if ( m_tracks[trackId].deactivated() == true )
m_tracks[trackId].activate();
......@@ -102,9 +101,7 @@ unsigned char* MainWorkflow::getOutput()
if ( m_tracks[i].activated() == false )
continue ;
if ( ( ret = m_tracks[i]->getOutput( m_currentFrame ) ) != NULL )
{
break ;
}
}
if ( ret == NULL )
ret = MainWorkflow::blackOutput;
......@@ -198,20 +195,17 @@ void MainWorkflow::clipMoved( QUuid clipUuid, int oldTrack, int newTra
{
Q_ASSERT( newTrack < m_trackCount && oldTrack < m_trackCount && oldTrack >= 0 && newTrack >= 0 );
//If the frame was stopped, reactivating it, since it can have something to render after
//the clip displacement
if ( m_tracks[newTrack].activated() == false )
m_tracks[newTrack].activate();
if ( oldTrack == newTrack )
{
//And now, just move the clip.
m_tracks[newTrack]->moveClip( clipUuid, startingFrame );
m_tracks[newTrack].activate();
}
else
{
if ( m_tracks[oldTrack].activated() == false )
m_tracks[oldTrack].activate();
Clip* clip = m_tracks[oldTrack]->removeClip( clipUuid );
m_tracks[newTrack]->addClip( clip, startingFrame );
m_tracks[oldTrack].activate();
m_tracks[newTrack].activate();
}
}
......@@ -190,7 +190,7 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
}
else
{
// qDebug() << "Unexpected ClipWorkflow::State when stopping :" << cw->getState();
qDebug() << "Unexpected ClipWorkflow::State when stopping :" << cw->getState();
cw->getStateLock()->unlock();
}
}
......@@ -261,7 +261,9 @@ unsigned char* TrackWorkflow::getOutput( qint64 currentFrame )
}
//Is it supposed to be stopped ?
else
{
stopClipWorkflow( cw );
}
++it;
}
......@@ -304,8 +306,11 @@ Clip* TrackWorkflow::removeClip( const QUuid& id )
if ( it.value()->getClip()->getUuid() == id )
{
ClipWorkflow* cw = it.value();
Clip* clip = cw->getClip();
m_clips.erase( it );
return cw->getClip();
stopClipWorkflow( cw );
delete cw;
return clip;
}
++it;
}
......
......@@ -46,7 +46,7 @@ class Toggleable
}
T operator->()
{
Q_ASSERT_X( m_activated == true, "Toggleable<T>::operator->", "Pointer is deactivated" );
// Q_ASSERT_X( m_activated == true, "Toggleable<T>::operator->", "Pointer is deactivated" );
return m_ptr;
}
bool activated() const
......
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