[vlmc-devel] WorkflowRenderer: Fixes #392. Check if aspect ratio has changed.

Rohit Yadav git at videolan.org
Tue Aug 2 03:17:05 CEST 2011


vlmc | branch: master | Rohit Yadav <rohityadav89 at gmail.com> | Tue Aug  2 07:03:36 2011 +0530| [f1fe87cc2e68d3d8954516aeb26112c3d1f0592f] | committer: Rohit Yadav

WorkflowRenderer: Fixes #392. Check if aspect ratio has changed.
Loads new value and setups renderer.

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

 src/Renderer/WorkflowRenderer.cpp |   20 ++++++++++++++------
 src/Renderer/WorkflowRenderer.h   |    5 ++++-
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index 2e278af..e216b67 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -46,6 +46,7 @@ WorkflowRenderer::WorkflowRenderer() :
             m_media( NULL ),
             m_stopping( false ),
             m_outputFps( 0.0f ),
+            m_aspectRatio( "" ),
             m_silencedAudioBuffer( NULL ),
             m_esHandler( NULL ),
             m_oldLength( 0 ),
@@ -96,13 +97,11 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
     char        audioParameters[256];
     char        buffer[64];
 
-    const QString   aspectRatio = VLMC_PROJECT_GET_STRING("video/AspectRatio");
-
     m_esHandler->fps = fps;
     //Clean any previous render.
 
     sprintf( videoString, "width=%i:height=%i:dar=%s:fps=%f/1:cookie=0:codec=%s:cat=2:caching=0",
-             width, height, aspectRatio.toAscii().constData(), fps, "RV32" );
+             width, height, m_aspectRatio.toAscii().constData(), fps, "RV32" );
     sprintf( audioParameters, "cookie=1:cat=1:codec=f32l:samplerate=%u:channels=%u:caching=0",
                 m_rate, m_nbChannels );
     strcpy( inputSlave, ":input-slave=imem://" );
@@ -234,12 +233,14 @@ WorkflowRenderer::startPreview()
 {
     if ( m_mainWorkflow->getLengthFrame() <= 0 )
         return ;
-    if ( paramsHasChanged( m_width, m_height, m_outputFps ) == true )
+    if ( paramsHasChanged( m_width, m_height, m_outputFps, m_aspectRatio ) == true )
     {
         m_width = width();
         m_height = height();
         m_outputFps = outputFps();
+        m_aspectRatio = aspectRatio();
         setupRenderer( m_width, m_height, m_outputFps );
+        qDebug() << "yo setup renderer";
     }
     initFilters();
 
@@ -410,15 +411,22 @@ WorkflowRenderer::outputFps() const
     return VLMC_PROJECT_GET_DOUBLE( "video/VLMCOutputFPS" );
 }
 
+const QString
+WorkflowRenderer::aspectRatio() const
+{
+    return VLMC_PROJECT_GET_STRING("video/AspectRatio");
+}
+
 bool
-WorkflowRenderer::paramsHasChanged( quint32 width, quint32 height, double fps )
+WorkflowRenderer::paramsHasChanged( quint32 width, quint32 height, double fps, QString aspect )
 {
     quint32             newWidth = this->width();
     quint32             newHeight = this->height();
     float               newOutputFps = outputFps();
+    const QString       newAspectRatio = aspectRatio();
 
     return ( newWidth != width || newHeight != height ||
-         newOutputFps != fps );
+         newOutputFps != fps || newAspectRatio != aspect );
 }
 
 void
diff --git a/src/Renderer/WorkflowRenderer.h b/src/Renderer/WorkflowRenderer.h
index a09c10d..c1875f7 100644
--- a/src/Renderer/WorkflowRenderer.h
+++ b/src/Renderer/WorkflowRenderer.h
@@ -255,6 +255,8 @@ class   WorkflowRenderer : public GenericRenderer
          */
         virtual float       outputFps() const;
 
+        const QString       aspectRatio() const;
+
         /**
          *  \brief          Configure the production chain.
          */
@@ -264,13 +266,14 @@ class   WorkflowRenderer : public GenericRenderer
          *  \return         true if some render parameters has changed.
          */
         bool                paramsHasChanged( quint32 width, quint32 height,
-                                                  double fps );
+                                                  double fps, QString aspect );
 
     protected:
         MainWorkflow*       m_mainWorkflow;
         LibVLCpp::Media*    m_media;
         bool                m_stopping;
         float               m_outputFps;
+        QString             m_aspectRatio;
         /**
          *  \brief          This isn't exactly the current PTS.
          *                  It's the number of frame rendered since the render has started.



More information about the Vlmc-devel mailing list