Commit 81430dbe authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

WorkflowRenderer: Don't use sprintf

This was failing under wine, as sprintf isn't handling %lld correctly.
parent 4fd05c24
...@@ -80,10 +80,10 @@ WorkflowRenderer::~WorkflowRenderer() ...@@ -80,10 +80,10 @@ WorkflowRenderer::~WorkflowRenderer()
void void
WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps ) WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
{ {
char videoString[512]; QString videoString;
char inputSlave[256]; QString inputSlave;
char audioParameters[256]; QString audioParameters;
char callbacks[64]; QString callbacks;
if ( m_renderVideoFrame != NULL ) if ( m_renderVideoFrame != NULL )
delete m_renderVideoFrame; delete m_renderVideoFrame;
...@@ -93,23 +93,25 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps ) ...@@ -93,23 +93,25 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
//Clean any previous render. //Clean any previous render.
memset( m_renderVideoFrame, 0, m_width * m_height * Pixel::NbComposantes ); memset( m_renderVideoFrame, 0, m_width * m_height * Pixel::NbComposantes );
sprintf( videoString, "width=%i:height=%i:dar=%s:fps=%s:data=%lld:codec=%s:cat=2:caching=0", QTextStream( &videoString ) << "width=" << width << ":height=" << height <<
width, height, "16/9", "30/1", ":dar=" << "16/9" << ":fps=" << "30/1" << ":data=" <<
(qint64)m_videoEsHandler, "RV24" ); (qint64)m_videoEsHandler << ":codec=" << "RV24" << ":cat=2:caching=0";
sprintf( audioParameters, "data=%lld:cat=1:codec=f32l:samplerate=%u:channels=%u:caching=0",
(qint64)m_audioEsHandler, m_rate, m_nbChannels ); QTextStream( &audioParameters ) << "data=" << (qint64)m_audioEsHandler <<
strcpy( inputSlave, ":input-slave=imem://" ); ":cat=1:codec=f32l:samplerate=" << m_rate << ":channels=" << m_nbChannels <<
strcat( inputSlave, audioParameters ); ":caching=0";
inputSlave = ":input-slave=imem://" + audioParameters;
if ( m_media != NULL ) if ( m_media != NULL )
delete m_media; delete m_media;
m_media = new LibVLCpp::Media( "imem://" + QString( videoString ) ); m_media = new LibVLCpp::Media( "imem://" + videoString );
m_media->addOption( inputSlave ); m_media->addOption( inputSlave.toStdString().c_str() );
sprintf( callbacks, "imem-get=%lld", (qint64)getLockCallback() ); QTextStream( &callbacks ) << "imem-get=" << (qint64)getLockCallback();
m_media->addOption( callbacks ); m_media->addOption( callbacks.toStdString().c_str() );
sprintf( callbacks, ":imem-release=%lld", (qint64)getUnlockCallback() ); callbacks = "";
m_media->addOption( callbacks ); QTextStream( &callbacks ) << ":imem-release=" << (qint64)getUnlockCallback();
m_media->addOption( callbacks.toStdString().c_str() );
m_media->addOption( ":text-renderer dummy" ); m_media->addOption( ":text-renderer dummy" );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment