[vlmc-devel] commit: MainWorkflow: Reworking blackoutput. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Tue Aug 24 22:57:00 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Aug 24 22:56:36 2010 +0200| [63effb0703b8d5e984f4b2b84233a19d4139d2ea] | committer: Hugo Beauzée-Luyssen 

MainWorkflow: Reworking blackoutput.

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

 src/Workflow/MainWorkflow.cpp  |   20 ++++++++++++--------
 src/Workflow/MainWorkflow.h    |    6 ++++--
 src/Workflow/TrackWorkflow.cpp |    2 +-
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 414ba29..4afc6c5 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -37,8 +37,6 @@
 #include <QDomElement>
 #include <QMutex>
 
-Workflow::Frame     *MainWorkflow::blackOutput = NULL;
-
 MainWorkflow::MainWorkflow( int trackCount ) :
         m_lengthFrame( 0 ),
         m_renderStarted( false ),
@@ -69,7 +67,7 @@ MainWorkflow::~MainWorkflow()
     for ( unsigned int i = 0; i < Workflow::NbTrackType; ++i )
         delete m_tracks[i];
     delete[] m_tracks;
-    delete MainWorkflow::blackOutput;
+    delete m_blackOutput;
 }
 
 void
@@ -115,10 +113,10 @@ MainWorkflow::startRender( quint32 width, quint32 height, double fps )
     m_renderStarted = true;
     m_width = width;
     m_height = height;
-    if ( blackOutput != NULL )
-        delete blackOutput;
-    blackOutput = new Workflow::Frame( m_width, m_height );
-    memset( blackOutput->buffer(), 0, blackOutput->size() );
+    if ( m_blackOutput != NULL )
+        delete m_blackOutput;
+    m_blackOutput = new Workflow::Frame( m_width, m_height );
+    memset( m_blackOutput->buffer(), 0, m_blackOutput->size() );
     for ( unsigned int i = 0; i < Workflow::NbTrackType; ++i )
         m_tracks[i]->startRender( width, height, fps );
     computeLength();
@@ -138,7 +136,7 @@ MainWorkflow::getOutput( Workflow::TrackType trackType, bool paused )
         if ( trackType == Workflow::VideoTrack )
         {
             if ( ret == NULL )
-                return MainWorkflow::blackOutput;
+                return m_blackOutput;
         }
         return ret;
     }
@@ -480,3 +478,9 @@ MainWorkflow::contains( const QUuid &uuid ) const
             return true;
     return false;
 }
+
+const Workflow::Frame*
+MainWorkflow::blackOutput() const
+{
+    return m_blackOutput;
+}
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index bd90fe2..6c4de47 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -318,8 +318,7 @@ class   MainWorkflow : public QObject, public Singleton<MainWorkflow>
          */
         void                    stopFrameComputing();
 
-        /// Pre-filled buffer used when there's nothing to render
-        static Workflow::Frame*         blackOutput;
+        const Workflow::Frame   *blackOutput() const;
 
     private:
         MainWorkflow( int trackCount = 64 );
@@ -345,6 +344,9 @@ class   MainWorkflow : public QObject, public Singleton<MainWorkflow>
                                          Workflow::TrackType trackType );
 
     private:
+        /// Pre-filled buffer used when there's nothing to render
+        Workflow::Frame         *m_blackOutput;
+
         /// Lock for the m_currentFrame atribute.
         QReadWriteLock*                 m_currentFrameLock;
         /**
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index cdfc78f..fce4c01 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -335,7 +335,7 @@ TrackWorkflow::getOutput( qint64 currentFrame, qint64 subFrame, bool paused )
             //FIXME: We don't handle mixer3 yet.
             mixer->effect->process( currentFrame * 1000.0 / m_fps,
                                     frames[0]->buffer(),
-                                    frames[1] != NULL ? frames[1]->buffer() : MainWorkflow::blackOutput->buffer(),
+                                    frames[1] != NULL ? frames[1]->buffer() : MainWorkflow::getInstance()->blackOutput()->buffer(),
                                     NULL, m_mixerBuffer->buffer() );
             m_mixerBuffer->ptsDiff = frames[0]->ptsDiff;
             m_lastFrame = subFrame;



More information about the Vlmc-devel mailing list