Commit b0317573 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

EffectEngine: Handle the time parameter correctly.

The calculation may lack of precision, but that should be enough for
now.
parent 186d8edc
......@@ -113,7 +113,7 @@ EffectsEngine::browseDirectory( const QString &path )
void
EffectsEngine::applyEffects( const EffectList &effects, Workflow::Frame* frame,
qint64 currentFrame )
qint64 currentFrame, double time )
{
if ( effects.size() == 0 )
return ;
......@@ -138,7 +138,7 @@ EffectsEngine::applyEffects( const EffectList &effects, Workflow::Frame* frame,
if ( *buff == NULL )
*buff = new quint8[frame->size()];
EffectInstance *effect = (*it)->effect;
effect->process( 0.0, (quint32*)input, (quint32*)*buff );
effect->process( time, (quint32*)input, (quint32*)*buff );
input = *buff;
firstBuff = !firstBuff;
}
......
......@@ -25,6 +25,8 @@
#include "Singleton.hpp"
class QTime;
#include "Effect.h"
#include "MainWorkflow.h"
......@@ -54,7 +56,7 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
void browseDirectory( const QString& path );
static void applyEffects( const EffectList &effects,
Workflow::Frame *frame, qint64 currentFrame );
Workflow::Frame *frame, qint64 currentFrame, double time );
static void saveEffects( const EffectList &effects, QXmlStreamWriter &project );
static void initEffects( const EffectList &effects, quint32 width, quint32 height );
......@@ -64,6 +66,7 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
QHash<QString, Effect*> m_effects;
QSettings *m_cache;
QTime *m_time;
signals:
void effectAdded( Effect*, const QString& name, Effect::Type );
......
......@@ -175,7 +175,9 @@ WorkflowRenderer::lockVideo( EsHandler *handler, qint64 *pts, size_t *bufferSize
}
{
QReadLocker lock( m_effectsLock );
EffectsEngine::applyEffects( m_effects, ret->video, m_mainWorkflow->getCurrentFrame() );
EffectsEngine::applyEffects( m_effects, ret->video,
m_mainWorkflow->getCurrentFrame(),
m_mainWorkflow->getCurrentFrame() * 1000.0 / handler->fps );
}
m_pts = *pts = ptsDiff + m_pts;
*buffer = ret->video->buffer();
......
......@@ -168,7 +168,8 @@ VideoClipWorkflow::unlock( VideoClipWorkflow *cw, void *buffer, int width,
Workflow::Frame *frame = cw->m_computedBuffers.last();
{
QWriteLocker lock( cw->m_effectsLock );
EffectsEngine::applyEffects( cw->m_effects, frame, cw->m_renderedFrame );
EffectsEngine::applyEffects( cw->m_effects, frame, cw->m_renderedFrame,
cw->m_renderedFrame * 1000.0 / (double)Clip::DefaultFPS );
}
{
QMutexLocker lock( cw->m_renderedFrameMutex );
......
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