Commit 9003b2d2 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Solving bug when rendering.

Black output where returned because ClipWorkflow where too slow for the renderer.
parent 4b5e85ed
......@@ -73,6 +73,7 @@ void WorkflowFileRenderer::run()
m_isRendering = true;
m_stopping = false;
m_mainWorkflow->setFullSpeedRender( true );
m_mainWorkflow->startRender();
m_mediaPlayer->play();
}
......
......@@ -225,6 +225,7 @@ void WorkflowRenderer::startPreview()
//FIXME:: check if this doesn't require Qt::QueuedConnection
connect( m_mediaPlayer, SIGNAL( stopped() ), this, SIGNAL( endReached() ) );
m_mainWorkflow->setFullSpeedRender( false );
m_mainWorkflow->startRender();
m_isRendering = true;
m_paused = false;
......
......@@ -87,7 +87,10 @@ void AudioClipWorkflow::initVlcOutput()
m_vlcMedia->addOption( ":sout-transcode-acodec=fl32" );
m_vlcMedia->addOption( ":sout-transcode-samplerate=48000" );
m_vlcMedia->addOption( ":sout-transcode-channels=2" );
m_vlcMedia->addOption( ":sout-smem-time-sync" );
if ( m_fullSpeedRender == false )
m_vlcMedia->addOption( ":sout-smem-time-sync" );
else
m_vlcMedia->addOption( ":no-sout-smem-time-sync" );
}
AudioClipWorkflow::AudioSample* AudioClipWorkflow::createBuffer( size_t size )
......
......@@ -277,3 +277,9 @@ void ClipWorkflow::resyncClipWorkflow()
m_previousPts = -1;
m_currentPts = -1;
}
void
ClipWorkflow::setFullSpeedRender( bool val )
{
m_fullSpeedRender = val;
}
......@@ -164,6 +164,11 @@ class ClipWorkflow : public QObject
LibVLCpp::MediaPlayer* getMediaPlayer();
/**
* \sa MainWorkflow::setFullSpeedRender();
*/
void setFullSpeedRender( bool val );
private:
void setState( State state );
void adjustBegin();
......@@ -210,6 +215,7 @@ class ClipWorkflow : public QObject
QMutex* m_availableBuffersMutex;
qint64 m_beginPausePts;
qint64 m_pauseDuration;
bool m_fullSpeedRender;
int debugType;
private slots:
......
......@@ -465,3 +465,10 @@ MainWorkflow::renderOneFrame()
nextFrame( VideoTrack );
nextFrame( AudioTrack );
}
void
MainWorkflow::setFullSpeedRender( bool val )
{
for ( unsigned int i = 0; i < MainWorkflow::NbTrackType; ++i )
m_tracks[i]->setFullSpeedRender( val );
}
......@@ -333,6 +333,15 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
*/
void renderOneFrame();
/**
* \brief Set the render speed.
*
* This will activate or deactivate vlc's pace-control
* \param val If true, ClipWorkflow will use no-pace-control
* else, pace-control.
*/
void setFullSpeedRender( bool val );
/// Pre-filled buffer used when there's nothing to render
static LightVideoFrame* blackOutput;
......
......@@ -330,3 +330,10 @@ TrackHandler::renderOneFrame()
m_tracks[i]->renderOneFrame();
}
}
void
TrackHandler::setFullSpeedRender( bool val )
{
for ( unsigned int i = 0; i < m_trackCount; ++i)
m_tracks[i]->setFullSpeedRender( val );
}
......@@ -84,6 +84,10 @@ class TrackHandler : public QObject
*/
void renderOneFrame();
/**
* \sa MainWorkflow::setFullSpeedRender();
*/
void setFullSpeedRender( bool val );
private:
void computeLength();
......
......@@ -496,3 +496,12 @@ TrackWorkflow::renderOneFrame()
QMutexLocker lock( m_renderOneFrameMutex );
m_renderOneFrame = true;
}
void
TrackWorkflow::setFullSpeedRender( bool val )
{
foreach ( ClipWorkflow* cw, m_clips.values() )
{
cw->setFullSpeedRender( val );
}
}
......@@ -81,6 +81,11 @@ class TrackWorkflow : public QObject
void forceRepositionning();
void renderOneFrame();
/**
* \sa MainWorkflow::setFullSpeedRender();
*/
void setFullSpeedRender( bool val );
private:
void computeLength();
void* renderClip( ClipWorkflow* cw, qint64 currentFrame,
......
......@@ -58,7 +58,10 @@ VideoClipWorkflow::initVlcOutput()
m_vlcMedia->setVideoLockCallback( reinterpret_cast<void*>( getLockCallback() ) );
m_vlcMedia->setVideoUnlockCallback( reinterpret_cast<void*>( getUnlockCallback() ) );
m_vlcMedia->addOption( ":sout-transcode-vcodec=RV24" );
m_vlcMedia->addOption( ":sout-smem-time-sync" );
if ( m_fullSpeedRender == false )
m_vlcMedia->addOption( ":sout-smem-time-sync" );
else
m_vlcMedia->addOption( ":no-sout-smem-time-sync" );
sprintf( buffer, ":sout-transcode-width=%i",
MainWorkflow::getInstance()->getWidth() );
......
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