Commit 9abbeb99 authored by Vincent Carrubba's avatar Vincent Carrubba

Implementation of the transitions wrapper + adding missing include into semanticobjectmanager

parent a2ccac4a
......@@ -205,7 +205,10 @@ EffectsEngine::render( void )
if ( m_processedInBypassPatch == false )
m_patch->render();
else
{
configureTransitions();
m_bypassPatch->render();
}
}
const LightVideoFrame &
......@@ -237,26 +240,101 @@ EffectsEngine::disable( void )
// TEMPORARY TRANSITION WRAPPER
void
EffectsEngine::configureTransitions()
{
}
quint32
EffectsEngine::addTransition( quint32 startFrame, quint32 endFrame )
EffectsEngine::addTransition( quint32 srcTrackId,
quint32 dstTrackId,
quint32 startFrameId,
quint32 stopFrameId )
{
Q_UNUSED( startFrame );
Q_UNUSED( endFrame );
return 42;
QWriteLocker wl( &m_rwl );
TStart* tstart;
TStop* tstop;
m_TStartManager.createObject();
m_TStopManager.createObject();
tstart = m_TStartManager.getObject( m_TStartManager.getNBObjects() );
tstop = m_TStopManager.getObject( m_TStopManager.getNBObjects() );
tstart->m_startFrameId = startFrameId;
tstart->m_nbSteps = stopFrameId - startFrameId;
tstart->m_srcTrackId = srcTrackId;
tstart->m_dstTrackId = dstTrackId;
tstop->m_stopFrameId = stopFrameId;
tstop->m_srcTrackId = srcTrackId;
tstop->m_dstTrackId = dstTrackId;
m_TStartTimeline[startFrameId][tstart->m_id] = tstart;
m_TStopTimeline[stopFrameId][tstop->m_id] = tstop;
return tstart->m_id;
}
bool
EffectsEngine::moveTransition( quint32 transitionId, quint32 startFrame, quint32 endFrame )
EffectsEngine::moveTransition( quint32 transitionId, quint32 startFrameId, quint32 stopFrameId )
{
Q_UNUSED( transitionId );
Q_UNUSED( startFrame );
Q_UNUSED( endFrame );
QWriteLocker wl( &m_rwl );
TStart* tstart;
TStop* tstop;
tstart = m_TStartManager.getObject( transitionId );
tstop = m_TStopManager.getObject( transitionId );
if ( tstart == NULL || tstop == NULL )
return false;
if ( tstart->m_startFrameId != startFrameId )
{
m_TStartTimeline[tstart->m_startFrameId].
erase( m_TStartTimeline[tstart->m_startFrameId].find( tstart->m_id ) );
if ( m_TStartTimeline[tstart->m_startFrameId].isEmpty() == true )
m_TStartTimeline.erase( m_TStartTimeline.find( tstart->m_startFrameId ) );
m_TStartTimeline[startFrameId][transitionId] = tstart;
}
if ( tstop->m_stopFrameId != stopFrameId )
{
m_TStopTimeline[tstop->m_stopFrameId].
erase( m_TStopTimeline[tstop->m_stopFrameId].find( tstop->m_id ) );
if ( m_TStopTimeline[tstop->m_stopFrameId].isEmpty() == true )
m_TStopTimeline.erase( m_TStopTimeline.find( tstop->m_stopFrameId ) );
m_TStopTimeline[startFrameId][transitionId] = tstop;
}
tstart->m_startFrameId = startFrameId;
tstart->m_nbSteps = stopFrameId - startFrameId;
tstop->m_stopFrameId = stopFrameId;
// if we're during a transition, think to update the nbSteps in the transition Effect.
return true;
}
bool
EffectsEngine::removeTransition( quint32 transitionId )
{
Q_UNUSED( transitionId );
QWriteLocker wl( &m_rwl );
TStart* tstart;
TStop* tstop;
tstart = m_TStartManager.getObject( transitionId );
tstop = m_TStopManager.getObject( transitionId );
if ( tstart == NULL || tstop == NULL )
return false;
m_TStartTimeline[tstart->m_startFrameId].
erase( m_TStartTimeline[tstart->m_startFrameId].find( tstart->m_id ) );
if ( m_TStartTimeline[tstart->m_startFrameId].isEmpty() == true )
m_TStartTimeline.erase( m_TStartTimeline.find( tstart->m_startFrameId ) );
m_TStopTimeline[tstop->m_stopFrameId].
erase( m_TStopTimeline[tstop->m_stopFrameId].find( tstop->m_id ) );
if ( m_TStopTimeline[tstop->m_stopFrameId].isEmpty() == true )
m_TStopTimeline.erase( m_TStopTimeline.find( tstop->m_stopFrameId ) );
m_TStartManager.deleteObject( transitionId );
m_TStopManager.deleteObject( transitionId );
return true;
}
......@@ -30,10 +30,17 @@
#define EFFECTSENGINE_H_
#include "EffectNodeFactory.h"
//Temporary
#include "SemanticObjectManager.hpp"
#include <QReadWriteLock>
#include <QtGlobal>
// Temporary
class TStart;
class TStop;
class EffectNode;
class LightVideoFrame;
......@@ -128,10 +135,18 @@ class EffectsEngine
// TEMPORARY TRANSITION WRAPPER
quint32 addTransition( quint32 startFrame, quint32 endFrame );
bool moveTransition( quint32 transitionId, quint32 startFrame, quint32 endFrame );
quint32 addTransition( quint32 srcTrackId,
quint32 dstTrackId,
quint32 startFrameId,
quint32 stopFrameId );
bool moveTransition( quint32 transitionId,
quint32 startFrameId,
quint32 stopFrameId );
bool removeTransition( quint32 transitionId );
private:
void configureTransitions();
private:
......@@ -172,6 +187,65 @@ private:
*/
bool m_processedInBypassPatch;
// Temporary
SemanticObjectManager<TStart> m_TStartManager;
SemanticObjectManager<TStop> m_TStopManager;
QMap<quint32, QMap<quint32, TStart*> > m_TStartTimeline;
QMap<quint32, QMap<quint32, TStop*> > m_TStopTimeline;
};
// Temporary
struct TStart
{
void setId( quint32 id )
{
m_id = id;
};
void setName( const QString & name )
{
Q_UNUSED( name );
};
void setFather( EffectNode* father )
{
Q_UNUSED( father );
};
void setScope( bool isItInternal )
{
Q_UNUSED( isItInternal );
};
quint32 m_id;
quint32 m_startFrameId;
quint32 m_srcTrackId;
quint32 m_dstTrackId;
quint32 m_nbSteps;
};
struct TStop
{
void setId( quint32 id )
{
m_id = id;
};
void setName( const QString & name )
{
Q_UNUSED( name );
};
void setFather( EffectNode* father )
{
Q_UNUSED( father );
};
void setScope( bool isItInternal )
{
Q_UNUSED( isItInternal );
};
quint32 m_id;
quint32 m_stopFrameId;
quint32 m_srcTrackId;
quint32 m_dstTrackId;
};
#endif // EFFECTSENGINE_H_
......@@ -25,6 +25,7 @@
#ifndef SEMANTICOBJECTMANAGER_H_
#define SEMANTICOBJECTMANAGER_H_
#include <QDebug>
#include <QString>
#include <QMap>
......
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