[vlmc-devel] commit: Copy the rendered buffer before using it for the preview. ( Hugo Beauzee-Luyssen )

git at videolan.org git at videolan.org
Sun Mar 21 22:23:02 CET 2010


vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Sun Mar 21 22:22:03 2010 +0100| [c8c6518a3524b7477974b50b62f02ff8909bd116] | committer: Hugo Beauzee-Luyssen 

Copy the rendered buffer before using it for the preview.

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

 src/Renderer/WorkflowFileRenderer.cpp |    6 +++++-
 src/Renderer/WorkflowFileRenderer.h   |    1 +
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/Renderer/WorkflowFileRenderer.cpp b/src/Renderer/WorkflowFileRenderer.cpp
index 2daa624..d758d23 100644
--- a/src/Renderer/WorkflowFileRenderer.cpp
+++ b/src/Renderer/WorkflowFileRenderer.cpp
@@ -32,6 +32,7 @@
 #ifdef WITH_GUI
 WorkflowFileRenderer::WorkflowFileRenderer() :
         WorkflowRenderer(),
+        m_renderVideoFrame( NULL ),
         m_image( NULL )
 {
 }
@@ -107,7 +108,10 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag
     if ( self->m_time.isValid() == false ||
         self->m_time.elapsed() >= 1000 )
     {
-        self->emit imageUpdated( (uchar*)*buffer );
+        if ( self->m_renderVideoFrame == NULL )
+            self->m_renderVideoFrame = new quint8[*bufferSize];
+        memcpy( self->m_renderVideoFrame, (uchar*)(*buffer), *bufferSize );
+        self->emit imageUpdated( self->m_renderVideoFrame );
         self->m_time.restart();
     }
 #endif
diff --git a/src/Renderer/WorkflowFileRenderer.h b/src/Renderer/WorkflowFileRenderer.h
index 5c2baa6..0577ff4 100644
--- a/src/Renderer/WorkflowFileRenderer.h
+++ b/src/Renderer/WorkflowFileRenderer.h
@@ -51,6 +51,7 @@ public:
     virtual float               getFps() const;
 
 private:
+    quint8                      *m_renderVideoFrame;
 #ifdef WITH_GUI
     QImage*                     m_image;
     QTime                       m_time;



More information about the Vlmc-devel mailing list