[vlmc-devel] ConsoleRenderer: Update the implementation of frameChanged

Yikai Lu git at videolan.org
Wed May 31 09:01:38 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Wed May 31 15:50:22 2017 +0900| [86976d1c8455025388e7325c8dcce470fd5e0b48] | committer: Yikai Lu

ConsoleRenderer: Update the implementation of frameChanged

> https://code.videolan.org/videolan/vlmc/commit/86976d1c8455025388e7325c8dcce470fd5e0b48
---

 src/Renderer/ConsoleRenderer.cpp | 8 ++++----
 src/Renderer/ConsoleRenderer.h   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Renderer/ConsoleRenderer.cpp b/src/Renderer/ConsoleRenderer.cpp
index f6b88099..ebbbf72c 100644
--- a/src/Renderer/ConsoleRenderer.cpp
+++ b/src/Renderer/ConsoleRenderer.cpp
@@ -43,12 +43,12 @@ ConsoleRenderer::ConsoleRenderer(QObject *parent) :
 }
 
 void
-ConsoleRenderer::frameChanged( qint64 frame ) const
+ConsoleRenderer::frameChanged( qint64 frame, qint64 length ) const
 {
-    static int      percent = 0;
-    int             newPercent;
+    static qint64   percent = 0;
+    qint64          newPercent;
 
-    newPercent = frame * 100 / Core::instance()->workflow()->getLengthFrame();
+    newPercent = ( frame + 1 ) * 100 / length; // The frame is 0-indexed
     if ( newPercent != percent )
     {
         percent = newPercent;
diff --git a/src/Renderer/ConsoleRenderer.h b/src/Renderer/ConsoleRenderer.h
index 5a03008e..25bb14f3 100644
--- a/src/Renderer/ConsoleRenderer.h
+++ b/src/Renderer/ConsoleRenderer.h
@@ -35,7 +35,7 @@ public:
     void        startRender();
 
 private:
-    void        frameChanged( qint64 frame ) const;
+    void        frameChanged( qint64 frame, qint64 length ) const;
 
 private:
     QString                 m_outputFileName;



More information about the Vlmc-devel mailing list