[vlmc-devel] commit: TrackWorkflow: If the last clip is in errored state, consider the end of the track reached. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Mon May 31 23:07:23 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon May 31 23:03:10 2010 +0200| [2b1eb594a828fcd3c8ee707e71b774a7f5f47d72] | committer: Hugo Beauzée-Luyssen
TrackWorkflow: If the last clip is in errored state, consider the end of the track reached.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=2b1eb594a828fcd3c8ee707e71b774a7f5f47d72
---
src/Workflow/TrackWorkflow.cpp | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index cb49f5f..155ec25 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -102,12 +102,14 @@ TrackWorkflow::computeLength()
m_length = (it.key() + it.value()->getClipHelper()->length() );
}
-qint64 TrackWorkflow::getLength() const
+qint64
+TrackWorkflow::getLength() const
{
return m_length;
}
-qint64 TrackWorkflow::getClipPosition( const QUuid& uuid ) const
+qint64
+TrackWorkflow::getClipPosition( const QUuid& uuid ) const
{
QMap<qint64, ClipWorkflow*>::const_iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::const_iterator end = m_clips.end();
@@ -121,7 +123,8 @@ qint64 TrackWorkflow::getClipPosition( const QUuid& uuid ) const
return -1;
}
-Clip* TrackWorkflow::getClip( const QUuid& uuid )
+Clip*
+TrackWorkflow::getClip( const QUuid& uuid )
{
QMap<qint64, ClipWorkflow*>::const_iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::const_iterator end = m_clips.end();
@@ -185,7 +188,8 @@ TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
return NULL;
}
-void TrackWorkflow::preloadClip( ClipWorkflow* cw )
+void
+TrackWorkflow::preloadClip( ClipWorkflow* cw )
{
cw->getStateLock()->lockForRead();
@@ -198,7 +202,8 @@ void TrackWorkflow::preloadClip( ClipWorkflow* cw )
cw->getStateLock()->unlock();
}
-void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
+void
+TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
{
// qDebug() << "Stopping clip workflow";
cw->getStateLock()->lockForRead();
@@ -214,14 +219,22 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
cw->stop();
}
-bool TrackWorkflow::checkEnd( qint64 currentFrame ) const
+bool
+TrackWorkflow::checkEnd( qint64 currentFrame ) const
{
if ( m_clips.size() == 0 )
return true;
//This is the last video by chronological order :
QMap<qint64, ClipWorkflow*>::const_iterator it = m_clips.end() - 1;
+ ClipWorkflow* cw = it.value();
+ //Check if the Clip is in error state. If so, don't bother checking anything else.
+ {
+ QReadLocker lock( cw->getStateLock() );
+ if ( cw->getState() == ClipWorkflow::Error )
+ return true;
+ }
//If it ends before the current frame, we reached end.
- return ( it.value()->getClipHelper()->length() + it.key() < currentFrame );
+ return ( cw->getClipHelper()->length() + it.key() < currentFrame );
}
void
More information about the Vlmc-devel
mailing list