[vlmc-devel] commit: Revert "WorkflowRenderer: Don't use sprintf" (Hugo Beauzee-Luyssen )

git at videolan.org git at videolan.org
Sun Mar 14 22:31:43 CET 2010


vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Sun Mar 14 22:31:10 2010 +0100| [380cdb4d37145781c90581231a5d62a01a654ee2] | committer: Hugo Beauzee-Luyssen 

Revert "WorkflowRenderer: Don't use sprintf"

This reverts commit 81430dbe138afaa8a29e1ed642dc433f6ba72af1.
As suggested by j-b

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

 src/Renderer/WorkflowRenderer.cpp |   36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index 677064f..ba33aa4 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -80,10 +80,10 @@ WorkflowRenderer::~WorkflowRenderer()
 void
 WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
 {
-    QString     videoString;
-    QString     inputSlave;
-    QString     audioParameters;
-    QString     callbacks;
+    char        videoString[512];
+    char        inputSlave[256];
+    char        audioParameters[256];
+    char        callbacks[64];
 
     if ( m_renderVideoFrame != NULL )
         delete m_renderVideoFrame;
@@ -93,25 +93,23 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
     //Clean any previous render.
     memset( m_renderVideoFrame, 0, m_width * m_height * Pixel::NbComposantes );
 
-    QTextStream( &videoString ) << "width=" << width << ":height=" << height <<
-            ":dar=" << "16/9" << ":fps=" << "30/1" << ":data=" <<
-            (qint64)m_videoEsHandler << ":codec=" << "RV24" << ":cat=2:caching=0";
-
-    QTextStream( &audioParameters ) << "data=" << (qint64)m_audioEsHandler <<
-            ":cat=1:codec=f32l:samplerate=" << m_rate << ":channels=" << m_nbChannels <<
-            ":caching=0";
-    inputSlave = ":input-slave=imem://" + audioParameters;
+    sprintf( videoString, "width=%i:height=%i:dar=%s:fps=%s:data=%lld:codec=%s:cat=2:caching=0",
+             width, height, "16/9", "30/1",
+             (qint64)m_videoEsHandler, "RV24" );
+    sprintf( audioParameters, "data=%lld:cat=1:codec=f32l:samplerate=%u:channels=%u:caching=0",
+             (qint64)m_audioEsHandler, m_rate, m_nbChannels );
+    strcpy( inputSlave, ":input-slave=imem://" );
+    strcat( inputSlave, audioParameters );
 
     if ( m_media != NULL )
         delete m_media;
-    m_media = new LibVLCpp::Media( "imem://" + videoString );
-    m_media->addOption( inputSlave.toStdString().c_str() );
-
-    QTextStream( &callbacks ) << "imem-get=" << (qint64)getLockCallback();
-    m_media->addOption( callbacks.toStdString().c_str() );
-    callbacks = "";
-    QTextStream( &callbacks ) << ":imem-release=" << (qint64)getUnlockCallback();
-    m_media->addOption( callbacks.toStdString().c_str() );
+    m_media = new LibVLCpp::Media( "imem://" + QString( videoString ) );
+    m_media->addOption( inputSlave );
+
+    sprintf( callbacks, "imem-get=%lld", (qint64)getLockCallback() );
+    m_media->addOption( callbacks );
+    sprintf( callbacks, ":imem-release=%lld", (qint64)getUnlockCallback() );
+    m_media->addOption( callbacks );
     m_media->addOption( ":text-renderer dummy" );
 }
 



More information about the Vlmc-devel mailing list