Commit 0d7a2fb0 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Adding a way of enabling full speed mode for file rendering

parent ae3a653b
......@@ -37,6 +37,7 @@ void WorkflowFileRenderer::run()
m_isRendering = true;
m_stopping = false;
m_mainWorkflow->setFullSpeedRender( true );
m_mainWorkflow->startRender();
m_mediaPlayer->play();
}
......
......@@ -150,6 +150,7 @@ void WorkflowRenderer::startPreview()
connect( m_mainWorkflow, SIGNAL( mainWorkflowEndReached() ), this, SLOT( __endReached() ) );
connect( m_mainWorkflow, SIGNAL( positionChanged( float ) ), this, SLOT( __positionChanged( float ) ) );
m_mainWorkflow->setFullSpeedRender( false );
m_mainWorkflow->startRender();
m_mediaPlayer->play();
m_isRendering = true;
......
......@@ -32,7 +32,8 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_state( ClipWorkflow::Stopped ),
m_requiredState( ClipWorkflow::None ),
m_rendering( false ),
m_initFlag( false )
m_initFlag( false ),
m_fullSpeedRender( false )
{
m_stateLock = new QReadWriteLock;
m_requiredStateLock = new QMutex;
......@@ -84,6 +85,7 @@ void ClipWorkflow::lock( ClipWorkflow* cw, void** pp_ret, int size )
Q_UNUSED( size );
cw->m_renderLock->lock();
*pp_ret = cw->m_buffer;
// qDebug() << "ClipWorkflow::lock";
}
void ClipWorkflow::unlock( ClipWorkflow* cw, void* buffer, int width, int height, int bpp, int size )
......@@ -116,6 +118,7 @@ void ClipWorkflow::unlock( ClipWorkflow* cw, void* buffer, int width, int hei
}
else
cw->m_stateLock->unlock();
// qDebug() << "ClipWorkflow::unlock";
cw->checkStateChange();
}
......@@ -131,6 +134,11 @@ void ClipWorkflow::setVmem()
m_vlcMedia->addOption( ":sout-transcode-vcodec=RV24" );
m_vlcMedia->addOption( ":sout-transcode-acodec=s16l" );
if ( m_fullSpeedRender == true )
m_vlcMedia->addOption( ":sout-sync" );
else
m_vlcMedia->addOption( ":no-sout-sync" );
sprintf( buffer, ":sout-transcode-width=%i", VIDEOWIDTH );
m_vlcMedia->addOption( buffer );
......@@ -374,3 +382,8 @@ void ClipWorkflow::unpausedMediaPlayer()
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( unpausedMediaPlayer() ) );
emit unpaused();
}
void ClipWorkflow::setFullSpeedRender( bool value )
{
m_fullSpeedRender = value;
}
......@@ -155,6 +155,8 @@ class ClipWorkflow : public QObject
LibVLCpp::MediaPlayer* getMediaPlayer();
void setFullSpeedRender( bool value );
private:
static void lock( ClipWorkflow* clipWorkflow, void** pp_ret, int size );
static void unlock( ClipWorkflow* clipWorkflow, void* buffer, int width, int height, int bpp, int size );
......@@ -195,13 +197,15 @@ class ClipWorkflow : public QObject
* While this flag is set to false, we will use the same buffer, to prevent
* having X buffers with the same picture (when media player is paused mainly)
*/
bool m_rendering;
bool m_rendering;
/**
* This flag is here to avoid multiple connection to the mediaPlayer* slots.
* It's essentially a nasty hack due to the multiples calls to lock/unlock when
* the render is started, and that cannot really be avoided...
*/
bool m_initFlag;
bool m_initFlag;
bool m_fullSpeedRender;
private slots:
void pauseAfterPlaybackStarted();
......
......@@ -501,3 +501,9 @@ void MainWorkflow::clear()
m_length = 0;
emit cleared();
}
void MainWorkflow::setFullSpeedRender( bool value )
{
for ( unsigned int i = 0; i < m_trackCount; ++i )
m_tracks[i]->setFullSpeedRender( value );
}
......@@ -111,6 +111,8 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
void clear();
void setFullSpeedRender( bool value );
private:
static MainWorkflow* m_instance;
......
......@@ -562,3 +562,15 @@ void TrackWorkflow::adjustClipTime( qint64 currentFrame, qint64 start, ClipWo
qint64 startFrame = cw->getClip()->getBegin() + nbMs;
cw->setTime( startFrame );
}
void TrackWorkflow::setFullSpeedRender( bool value )
{
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
while ( it != end )
{
it.value()->setFullSpeedRender( value );
++it;
}
}
......@@ -72,6 +72,8 @@ class TrackWorkflow : public QObject
void save( QDomDocument& doc, QDomElement& trackNode ) const;
void clear();
void setFullSpeedRender( bool value );
private:
void computeLength();
void renderClip( ClipWorkflow* cw, qint64 currentFrame,
......
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