[vlmc-devel] commit: File rendering: Fixed synchronisation bug. (Hugo Beauzee-Luyssen )
git at videolan.org
git at videolan.org
Sat Mar 13 16:53:37 CET 2010
vlmc | branch: 0.0.1-bugfix | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Sat Mar 13 16:40:44 2010 +0100| [07f3c5465e5b1b687a18f69781996b66f135f1d9] | committer: Hugo Beauzee-Luyssen
File rendering: Fixed synchronisation bug.
The buffer are now preload a bit before rendering.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=07f3c5465e5b1b687a18f69781996b66f135f1d9
---
src/Renderer/WorkflowFileRenderer.cpp | 10 ++++++----
src/Workflow/TrackHandler.cpp | 3 +++
src/Workflow/TrackWorkflow.cpp | 17 +++++++++++++++++
src/Workflow/TrackWorkflow.h | 2 ++
4 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/src/Renderer/WorkflowFileRenderer.cpp b/src/Renderer/WorkflowFileRenderer.cpp
index a87bc4a..e78b0f3 100644
--- a/src/Renderer/WorkflowFileRenderer.cpp
+++ b/src/Renderer/WorkflowFileRenderer.cpp
@@ -90,6 +90,8 @@ void WorkflowFileRenderer::run()
m_mainWorkflow->setFullSpeedRender( true );
m_mainWorkflow->startRender( width, height );
+ //Waiting for renderers to preload some frames:
+ sleep( 1 );
m_mediaPlayer->play();
}
@@ -133,25 +135,25 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag
return ret;
}
-void
+void
WorkflowFileRenderer::unlock( void *datas, size_t size, void* buff )
{
WorkflowRenderer::unlock( datas, size, buff );
}
-void
+void
WorkflowFileRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameChangedReason )
{
m_dialog->setProgressBarValue( frame * 100 / m_mainWorkflow->getLengthFrame() );
}
-void*
+void*
WorkflowFileRenderer::getLockCallback()
{
return (void*)&WorkflowFileRenderer::lock;
}
-void*
+void*
WorkflowFileRenderer::getUnlockCallback()
{
return (void*)&WorkflowFileRenderer::unlock;
diff --git a/src/Workflow/TrackHandler.cpp b/src/Workflow/TrackHandler.cpp
index 796e152..e02b06a 100644
--- a/src/Workflow/TrackHandler.cpp
+++ b/src/Workflow/TrackHandler.cpp
@@ -86,7 +86,10 @@ TrackHandler::startRender()
else
{
for ( unsigned int i = 0; i < m_trackCount; ++i )
+ {
activateTrack( i );
+ m_tracks[i]->preload();
+ }
}
}
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index 512747e..9d8783d 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -517,3 +517,20 @@ TrackWorkflow::unmuteClip( const QUuid &uuid )
qWarning() << "Failed to unmute clip" << uuid << "it probably doesn't exist "
"in this track";
}
+
+void
+TrackWorkflow::preload()
+{
+ QReadLocker lock( m_clipsLock );
+
+ QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
+ QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
+ while ( it != end )
+ {
+ qint64 start = it.key();
+ ClipWorkflow* cw = it.value();
+ if ( start < TrackWorkflow::nbFrameBeforePreload )
+ preloadClip( cw );
+ ++it;
+ }
+}
diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
index 84ed451..e7477bb 100644
--- a/src/Workflow/TrackWorkflow.h
+++ b/src/Workflow/TrackWorkflow.h
@@ -92,6 +92,8 @@ class TrackWorkflow : public QObject
void muteClip( const QUuid& uuid );
void unmuteClip( const QUuid& uuid );
+ void preload();
+
private:
void computeLength();
void* renderClip( ClipWorkflow* cw, qint64 currentFrame,
More information about the Vlmc-devel
mailing list