[vlmc-devel] commit: ImageClipWorkflow: Fixing frame and time passed to the effects engine. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Thu Aug 26 23:03:06 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Aug 25 14:44:34 2010 +0200| [dc2939210079f08da095b86f3bd3f3b0668b86ac] | committer: Hugo Beauzée-Luyssen 

ImageClipWorkflow: Fixing frame and time passed to the effects engine.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=dc2939210079f08da095b86f3bd3f3b0668b86ac
---

 src/Workflow/ImageClipWorkflow.cpp |    4 +++-
 src/Workflow/MainWorkflow.cpp      |    9 ++++++---
 src/Workflow/MainWorkflow.h        |    7 ++++++-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/Workflow/ImageClipWorkflow.cpp b/src/Workflow/ImageClipWorkflow.cpp
index 78e6a81..6c20309 100644
--- a/src/Workflow/ImageClipWorkflow.cpp
+++ b/src/Workflow/ImageClipWorkflow.cpp
@@ -101,7 +101,9 @@ ImageClipWorkflow::getOutput( ClipWorkflow::GetMode )
     QMutexLocker    lock( m_renderLock );
 
     QReadLocker     lock2( m_effectsLock );
-    quint32 *buff = EffectsEngine::applyFilters( m_filters, m_buffer, 0, 0 );
+    qint64          currentFrame = MainWorkflow::getInstance()->getCurrentFrame( false );
+    quint32 *buff = EffectsEngine::applyFilters( m_filters, m_buffer, currentFrame,
+                                                currentFrame * 1000.0 / clip()->getMedia()->fps() );
     if ( buff != NULL )
     {
         m_effectFrame->setBuffer( buff );
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 603242d..e819684 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -394,10 +394,13 @@ MainWorkflow::getTrackCount( Workflow::TrackType trackType ) const
 }
 
 qint64
-MainWorkflow::getCurrentFrame() const
+MainWorkflow::getCurrentFrame( bool lock /*= false*/ ) const
 {
-    QReadLocker     lock( m_currentFrameLock );
-
+    if ( lock == true )
+    {
+        QReadLocker     lock( m_currentFrameLock );
+        return m_currentFrame[Workflow::VideoTrack];
+    }
     return m_currentFrame[Workflow::VideoTrack];
 }
 
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index 0ed1ab7..21b8a0f 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -116,9 +116,14 @@ class   MainWorkflow : public QObject, public Singleton<MainWorkflow>
 
         /**
          *  \brief              Get the currently rendered frame.
+         *  \param      lock    If true, m_currentFrameLock will be locked for read.
+         *                      If false, it won't be locked. This is usefull when calling
+         *                      getCurentFrame from underlying workflows
          *  \return             Returns the current frame.
+         *  \warning            Locks the m_currentFrameLock ReadWriteLock, unless false is
+         *                      passed.
          */
-        qint64                  getCurrentFrame() const;
+        qint64                  getCurrentFrame( bool lock = true ) const;
 
         /**
          *  \brief      Stops the rendering.



More information about the Vlmc-devel mailing list