[vlmc-devel] commit: ClipWorkflow: Pass the precise frame when setting time. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sat Jul 31 17:36:02 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sat Jul 31 19:34:48 2010 +0200| [c18d8a3e268d5a9a8ee81affd285a9e7f4e0d232] | committer: Hugo Beauzée-Luyssen 

ClipWorkflow: Pass the precise frame when setting time.

This will enhance the effectsengine precision when it comes to starting
an effect or not.

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

 src/Workflow/ClipWorkflow.cpp      |    4 ++--
 src/Workflow/ClipWorkflow.h        |    3 ++-
 src/Workflow/TrackWorkflow.cpp     |    2 +-
 src/Workflow/VideoClipWorkflow.cpp |    6 +++---
 src/Workflow/VideoClipWorkflow.h   |    2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/Workflow/ClipWorkflow.cpp b/src/Workflow/ClipWorkflow.cpp
index 6c973c9..3a3c5ca 100644
--- a/src/Workflow/ClipWorkflow.cpp
+++ b/src/Workflow/ClipWorkflow.cpp
@@ -148,8 +148,8 @@ ClipWorkflow::stopRenderer()
 }
 
 void
-ClipWorkflow::setTime( qint64 time )
-{
+ClipWorkflow::setTime( qint64 time, qint64 ) //Ignore the frame parameter for generic clip workflow.
+{                                            //the VideoClipWorkflow reimplementation will handle it.
     m_mediaPlayer->setTime( time );
     resyncClipWorkflow();
     QWriteLocker    lock( m_stateLock );
diff --git a/src/Workflow/ClipWorkflow.h b/src/Workflow/ClipWorkflow.h
index aa6cd25..20b87e9 100644
--- a/src/Workflow/ClipWorkflow.h
+++ b/src/Workflow/ClipWorkflow.h
@@ -148,8 +148,9 @@ class   ClipWorkflow : public QObject
         /**
          *  \brief  Set the rendering position
          *  \param  time    The position in millisecond
+         *  \param  frame   The new current frame.
          */
-        virtual void            setTime( qint64 time );
+        virtual void            setTime( qint64 time, qint64 frame );
 
         /**
          *  This method must be used to change the state of the ClipWorkflow
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index 5ea14f4..3ae0f6c 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -460,7 +460,7 @@ void    TrackWorkflow::adjustClipTime( qint64 currentFrame, qint64 start, ClipWo
     qint64  nbMs = ( currentFrame - start ) / cw->clip()->getMedia()->fps() * 1000;
     qint64  beginInMs = cw->getClipHelper()->begin() / cw->clip()->getMedia()->fps() * 1000;
     qint64  startFrame = beginInMs + nbMs;
-    cw->setTime( startFrame );
+    cw->setTime( startFrame, currentFrame );
 }
 
 void
diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
index 37cb519..83abe86 100644
--- a/src/Workflow/VideoClipWorkflow.cpp
+++ b/src/Workflow/VideoClipWorkflow.cpp
@@ -233,13 +233,13 @@ VideoClipWorkflow::saveEffects( QXmlStreamWriter &project ) const
 }
 
 void
-VideoClipWorkflow::setTime( qint64 time )
+VideoClipWorkflow::setTime( qint64 time, qint64 frame )
 {
     {
         QMutexLocker    lock( m_renderedFrameMutex );
-        m_renderedFrame = time / 1000 * clip()->getMedia()->fps();
+        m_renderedFrame = frame;
     }
-    ClipWorkflow::setTime( time );
+    ClipWorkflow::setTime( time, frame );
 }
 
 VideoClipWorkflow::StackedBuffer::StackedBuffer( Workflow::Frame *frame,
diff --git a/src/Workflow/VideoClipWorkflow.h b/src/Workflow/VideoClipWorkflow.h
index 76ec5bf..0040667 100644
--- a/src/Workflow/VideoClipWorkflow.h
+++ b/src/Workflow/VideoClipWorkflow.h
@@ -53,7 +53,7 @@ class   VideoClipWorkflow : public ClipWorkflow
         void                    *getUnlockCallback() const;
         virtual void            *getOutput( ClipWorkflow::GetMode mode );
         virtual bool            appendEffect( Effect *effect, qint64 start = 0, qint64 end = -1 );
-        virtual void            setTime( qint64 time );
+        virtual void            setTime( qint64 time, qint64 frame );
         virtual void            saveEffects( QXmlStreamWriter &project ) const;
 
         static const quint32    nbBuffers = 3 * 30; //3 seconds with an average fps of 30



More information about the Vlmc-devel mailing list