Commit aea23cd3 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Revert "Next frame mode is kind of working, though it sometimes return 2 frames..."

This reverts commit 68f40c44.
parent b49ba061
......@@ -48,7 +48,6 @@ MainWorkflow::MainWorkflow( QObject* parent, int trackCount ) :
connect( m_tracks[i], SIGNAL( trackEndReached( unsigned int ) ), this, SLOT( trackEndReached(unsigned int) ) );
}
m_renderStartedLock = new QReadWriteLock;
m_lastRenderedFrame = MainWorkflow::blackOutput;
}
MainWorkflow::~MainWorkflow()
......@@ -92,13 +91,7 @@ void MainWorkflow::startRender()
unsigned char* MainWorkflow::getOutput()
{
QReadLocker lock( m_renderStartedLock );
qDebug() << "New frame asked";
if ( m_renderOnlyOneFrame == 1 && m_lastRenderedFrame != NULL )
{
qDebug() << "Returning last frame";
return m_lastRenderedFrame;
}
if ( m_renderStarted == true )
{
unsigned char* ret;
......@@ -113,16 +106,11 @@ unsigned char* MainWorkflow::getOutput()
if ( ret == NULL )
ret = MainWorkflow::blackOutput;
if ( m_renderOnlyOneFrame == 0 )
nextFrame();
m_lastRenderedFrame = ret;
nextFrame();
return ret;
}
else
{
m_lastRenderedFrame = MainWorkflow::blackOutput;
return MainWorkflow::blackOutput;
}
}
void MainWorkflow::pause()
......@@ -136,7 +124,6 @@ void MainWorkflow::pause()
void MainWorkflow::nextFrame()
{
qDebug() << "Going to next frame";
++m_currentFrame;
//FIXME: This is probably a bit much...
emit frameChanged( m_currentFrame );
......@@ -231,9 +218,3 @@ void MainWorkflow::clipMoved( QUuid clipUuid, int oldTrack, int newTra
m_tracks[newTrack].activate();
}
}
void MainWorkflow::activateOneFrameOnly()
{
m_renderOnlyOneFrame = 1;
// m_lastRenderedFrame = NULL;
}
......@@ -26,8 +26,6 @@
#include <QObject>
#include <QReadWriteLock>
#include <QAtomicInt>
#include <QAtomicPointer>
#include "tools/Toggleable.hpp"
#include "TrackWorkflow.h"
......@@ -75,13 +73,6 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
static unsigned char* blackOutput;
void nextFrame();
void previousFrame();
/**
* \brief By calling this method, you ensure that the MainWorkflow will
* only return one frame to you, until you restore the normal render mode,
* or until you call this method again.
*/
void activateOneFrameOnly();
static MainWorkflow* getInstance();
......@@ -98,14 +89,6 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
bool m_renderStarted;
QReadWriteLock* m_renderStartedLock;
/**
* \brief This will be used in case of next frame, to avoid rendering more than one frame
* at a time
*/
QAtomicPointer<unsigned char> m_lastRenderedFrame;
QAtomicInt m_renderOnlyOneFrame;
public slots:
void clipMoved( QUuid, int, int, qint64 );
......
......@@ -246,7 +246,7 @@ unsigned char* TrackWorkflow::getOutput( qint64 currentFrame )
m_forceRepositionning = false;
}
else
needRepositioning = ( currentFrame - lastFrame != 1 ) ? true : false;
needRepositioning = ( abs( currentFrame - lastFrame ) > 1 ) ? true : false;
}
while ( it != end )
{
......
......@@ -127,11 +127,7 @@ void RenderPreviewWidget::nextFrame()
QWriteLocker lock( m_framePlayedLock );
m_framePlayed = false;
}
//FIXME: MainWorkflow should be paused
m_mainWorkflow->nextFrame();
qDebug() << "Activated one frame only";
m_mainWorkflow->activateOneFrameOnly();
m_mainWorkflow->pause();
m_mediaPlayer->play();
bool framePlayed = false;
while ( framePlayed == false )
......@@ -141,7 +137,6 @@ void RenderPreviewWidget::nextFrame()
framePlayed = m_framePlayed;
}
m_mediaPlayer->pause();
m_mainWorkflow->pause();
}
void RenderPreviewWidget::previousFrame()
......
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