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