Commit 451be079 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Fixed bug when using slider without anything loaded

Removed debug
parent cc5637d4
......@@ -25,7 +25,7 @@
#include "MainWorkflow.h"
MainWorkflow::MainWorkflow()
MainWorkflow::MainWorkflow() : m_renderStarted( false )
{
m_tracks = new TrackWorkflow*[NB_TRACKS];
for (unsigned int i = 0; i < NB_TRACKS; ++i)
......@@ -43,6 +43,7 @@ void MainWorkflow::addClip( Clip* clip, unsigned int trackId, qint64 start )
void MainWorkflow::startRender()
{
m_renderStarted = true;
m_currentFrame = 0;
emit frameChanged( 0 );
m_length = m_tracks[0]->getLength();
......@@ -60,8 +61,9 @@ unsigned char* MainWorkflow::getOutput()
void MainWorkflow::setPosition( float pos )
{
if ( m_renderStarted == false )
return ;
qint64 frame = (float)m_length * pos;
qDebug() << "Setting current frame to " << frame << '(' << m_length << '*' << pos << ')';
m_tracks[0]->setPosition( pos );
m_currentFrame = frame;
emit frameChanged( frame );
......
......@@ -43,17 +43,20 @@ class MainWorkflow : public QObject
unsigned char* getOutput();
/**
\brief Set the workflow position
\param pos: The position in vlc position
* \brief Set the workflow position
* \param pos: The position in vlc position
*/
void setPosition( float pos );
/**
\return Returns the global length of the workflow
in frames.
* \return Returns the global length of the workflow
* in frames.
*/
qint64 getLength() const;
/**
* This boolean describe is a render has been started
*/
bool m_renderStarted;
private:
TrackWorkflow** m_tracks;
......
......@@ -151,8 +151,10 @@ void TrackWorkflow::setPosition( float pos )
qint64 frame = (float)m_length * pos;
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
const QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
QMap<qint64, ClipWorkflow*>::iterator next = m_clips.end();
QMap<qint64, ClipWorkflow*>::iterator next = end;
if ( m_mediaPlayer->isPlaying() == false )
return ;
QWriteLocker lock( m_currentLock );
if ( frame > m_length )
{
......
......@@ -85,7 +85,7 @@ class TrackWorkflow : public QObject
QWaitCondition* m_waitCondition;
LibVLCpp::MediaPlayer* m_mediaPlayer;
/**
\brief The track length in frames.
* \brief The track length in frames.
*/
qint64 m_length;
......
......@@ -96,7 +96,6 @@ void RenderPreviewWidget::togglePlayPause( bool /*forcePause*/ )
startPreview( NULL );
else
{
qDebug() << m_mediaPlayer->isPlaying();
if ( m_mediaPlayer->isPlaying() == false )
m_mediaPlayer->play();
else
......
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