Commit 4943285a authored by Geoffroy Lacarriere's avatar Geoffroy Lacarriere

Merge branch 'master' of git@github.com:VLMC/vlmc into geoff_project_saving

parents 8be363f6 bca0bccc
......@@ -93,6 +93,7 @@ void MediaPlayer::callbacks( const libvlc_event_t* ev
self->emit paused();
break;
case libvlc_MediaPlayerStopped:
// qDebug() << "Media player stopped";
self->emit stopped();
break;
case libvlc_MediaPlayerEndReached:
......
......@@ -157,3 +157,11 @@ void Clip::setEnd( float end )
Q_ASSERT( end <= 1.0f );
m_end = end;
}
Clip* Clip::split( float newEnd )
{
Clip* newClip = new Clip( this, newEnd, m_end );
m_end = newEnd;
computeLength();
return newClip;
}
......@@ -99,6 +99,14 @@ class Clip : public QObject
const QString& getNotes() const;
void setNotes( const QString& notes );
/**
* \brief Split this clip in two parts.
* \param newEnd The new end for this Clip. This will be the beginning of the
* newly created Clip.
* \returns The remaining part as a new Clip.
*/
Clip* split( float newEnd );
private:
void computeLength();
......
......@@ -131,6 +131,8 @@ void WorkflowRenderer::stopPreview()
void WorkflowRenderer::startPreview()
{
if ( m_mainWorkflow->getLength() <= 0 )
return ;
m_mediaPlayer->setMedia( m_media );
//Workflow part
......
......@@ -73,6 +73,7 @@ void ClipWorkflow::checkStateChange()
if ( m_requiredState != ClipWorkflow::None )
{
m_state = m_requiredState;
// qDebug() << "Applying required state change:" << m_state;
m_requiredState = ClipWorkflow::None;
checkSynchronisation( m_state );
}
......@@ -99,7 +100,9 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
cw->m_renderWaitCond->wake();
cw->emit renderComplete( cw );
// qDebug() << "Entering cond wait";
cw->m_waitCond->wait( cw->m_condMutex );
// qDebug() << "Leaving condwait";
cw->m_stateLock->lockForWrite();
if ( cw->m_state == Sleeping )
cw->m_state = Rendering;
......@@ -271,6 +274,7 @@ void ClipWorkflow::setState( State state )
{
{
QWriteLocker lock( m_stateLock );
// qDebug() << "Setting state to" << state;
m_state = state;
}
checkSynchronisation( state );
......
......@@ -76,13 +76,17 @@ 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");
//if the track is deactivated, we need to reactivate it :
m_tracks[trackId]->addClip( clip, start );
//if the track is deactivated, we need to reactivate it.
if ( m_tracks[trackId].deactivated() == true )
activateTrack( trackId );
m_tracks[trackId]->addClip( clip, start );
//Now check if this clip addition has changed something about the workflow's length
if ( m_tracks[trackId]->getLength() > m_length )
m_length = m_tracks[trackId]->getLength();
//Inform the GUI
emit clipAdded( clip, trackId, start );
}
......
......@@ -221,7 +221,10 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
cw->getState() == ClipWorkflow::EndReached )
{
cw->getStateLock()->unlock();
cw->queryStateChange( ClipWorkflow::Stopping );
{
QMutexLocker lock( cw->getSleepMutex() );
cw->queryStateChange( ClipWorkflow::Stopping );
}
cw->wake();
cw->stop();
}
......
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