Commit e8d12e8d authored by Vincent Carrubba's avatar Vincent Carrubba Committed by Hugo Beauzee-Luyssen

Ugly temporary transition wrapper removed

Signed-off-by: default avatarHugo Beauzee-Luyssen <beauze.h@gmail.com>
parent 57bee67a
......@@ -114,13 +114,6 @@ EffectsEngine::makePatch( void )
qDebug() << "The connection of the RNBInvert output"
<< "with the first input of the blit failed!";
// TRANSITIONS
// int i;
// for ( i = 100; i < 100000; i += 100 )
// addTransition( 1, 2, i, i + 50);
}
else
qDebug() << "There's not the video mixer plugin,"
......@@ -167,14 +160,6 @@ EffectsEngine::makeBypassPatch( void )
}
}
void
EffectsEngine::setCurrentFrameNumber( quint64 nb )
{
QWriteLocker wl( &m_rwl );
m_currentFrameNumber = nb;
}
void
EffectsEngine::setVideoInput( quint32 inId, const LightVideoFrame & frame )
{
......@@ -196,10 +181,7 @@ EffectsEngine::render( void )
{
QWriteLocker wl( &m_rwl );
if ( m_processedInBypassPatch == false )
{
// configureTransitions();
m_patch->render();
}
else
m_bypassPatch->render();
}
......@@ -229,233 +211,3 @@ EffectsEngine::disable( void )
QWriteLocker wl( &m_rwl );
m_enabled = false;
}
// TEMPORARY TRANSITION WRAPPER
void
EffectsEngine::configureTransitions()
{
QMap<quint32, TEvent>::iterator it = m_TDoAtNextRender.begin();
QMap<quint32, TEvent>::iterator end = m_TDoAtNextRender.end();
qDebug() << m_currentFrameNumber;
if ( m_TStartTimeline.find( m_currentFrameNumber ) != m_TStartTimeline.end() )
{
QMap<quint32, TStart*>::iterator itStart = (m_TStartTimeline[m_currentFrameNumber]).begin();
QMap<quint32, TStart*>::iterator endStart = (m_TStartTimeline[m_currentFrameNumber]).end();
for ( ; itStart != endStart; ++itStart )
qDebug() << "TSTART :\n"
<< "ID : " << itStart.value()->m_id << "\n"
<< "START FRAME ID : " << itStart.value()->m_startFrameId << "\n"
<< "SRC TRACK ID : " << itStart.value()->m_srcTrackId << "\n"
<< "DST TRACK ID : " << itStart.value()->m_dstTrackId << "\n"
<< "NB STEPS : " << itStart.value()->m_nbSteps;
}
else
qDebug() << "!TSTART";
if ( m_TStopTimeline.find( m_currentFrameNumber ) != m_TStopTimeline.end() )
{
QMap<quint32, TStop*>::iterator itStop = (m_TStopTimeline[m_currentFrameNumber]).begin();
QMap<quint32, TStop*>::iterator endStop = (m_TStopTimeline[m_currentFrameNumber]).end();
for ( ; itStop != endStop; ++itStop )
qDebug() << "TSTOP :\n"
<< "ID : " << itStop.value()->m_id << "\n"
<< "STOP FRAME ID : " << itStop.value()->m_stopFrameId << "\n"
<< "SRC TRACK ID : " << itStop.value()->m_srcTrackId << "\n"
<< "DST TRACK ID : " << itStop.value()->m_dstTrackId;
}
else
qDebug() << "!TSTOP";
for ( ; it != end; ++it )
switch ( it.value().m_type )
{
qDebug() << "TEVENT :\n";
case TEvent::DEL:
{
qDebug() << "TYPE : DEL\n"
<< "ID : " << it.value().m_id;
break;
}
case TEvent::ADD:
{
qDebug() << "TYPE : ADD\n"
<< "ID : " << it.value().m_id << "\n"
<< "CURRENT STEP : " << it.value().m_currentStep << "\n"
<< "NB STEPS : " << it.value().m_nbSteps;
break;
}
case TEvent::UPDATE:
{
qDebug() << "TYPE : UPDATE\n"
<< "ID : " << it.value().m_id << "\n"
<< "CURRENT STEP : " << it.value().m_currentStep << "\n"
<< "NB STEPS : " << it.value().m_nbSteps;
break;
}
case TEvent::PATCH:
{
qDebug() << "TYPE : PATCH\n"
<< "ID : " << it.value().m_id << "\n"
<< "CURRENT STEP : " << it.value().m_currentStep << "\n"
<< "NB STEPS : " << it.value().m_nbSteps;
break;
}
case TEvent::UNPATCH:
{
qDebug() << "TYPE : UNPATCH\n"
<< "ID : " << it.value().m_id;
break;
}
}
}
quint32
EffectsEngine::addTransition( quint32 srcTrackId,
quint32 dstTrackId,
quint64 startFrameId,
quint64 stopFrameId )
{
QWriteLocker wl( &m_rwl );
TStart* tstart;
TStop* tstop;
quint32 i;
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;
if ( ( m_currentFrameNumber <= stopFrameId ) &&
( m_currentFrameNumber >= startFrameId ) )
{
m_TDoAtNextRender[tstart->m_id].m_type = TEvent::ADD;
m_TDoAtNextRender[tstart->m_id].m_id = tstart->m_id;
m_TDoAtNextRender[tstart->m_id].m_currentStep = m_currentFrameNumber - startFrameId;
m_TDoAtNextRender[tstart->m_id].m_currentStep = stopFrameId - startFrameId;
}
return tstart->m_id;
}
bool
EffectsEngine::moveTransition( quint32 transitionId, quint64 startFrameId, quint64 stopFrameId )
{
QWriteLocker wl( &m_rwl );
TStart* tstart;
TStop* tstop;
quint64 oldStartFrameId;
quint64 oldStopFrameId;
tstart = m_TStartManager.getObject( transitionId );
tstop = m_TStopManager.getObject( transitionId );
if ( tstart == NULL || tstop == NULL )
return false;
oldStartFrameId = tstart->m_startFrameId;
oldStopFrameId = tstop->m_stopFrameId;
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 ( ( m_currentFrameNumber <= oldStopFrameId ) &&
( m_currentFrameNumber >= oldStartFrameId ) )
{
if ( ( m_currentFrameNumber <= stopFrameId ) &&
( m_currentFrameNumber >= startFrameId ) )
{
// si la transition etait pendant la frame courante et le reste,
// alors il faut mettre a jour les parametres de la transition
m_TDoAtNextRender[transitionId].m_type = TEvent::UPDATE;
m_TDoAtNextRender[transitionId].m_id = tstart->m_id;
m_TDoAtNextRender[transitionId].m_currentStep = m_currentFrameNumber - startFrameId;
m_TDoAtNextRender[transitionId].m_nbSteps = stopFrameId - startFrameId;
}
else
{
// si le deplacement place la transition hors de la frame courrante,
// alors qu'elle y etait precedement, il faut deconnecter l'effet
m_TDoAtNextRender[transitionId].m_type = TEvent::UNPATCH;
m_TDoAtNextRender[transitionId].m_id = tstart->m_id;
}
}
else
{
// si le deplacement place la transition pendant la frame courrante,
// alors il faut connecter l'effet et le configurer
m_TDoAtNextRender[transitionId].m_type = TEvent::PATCH;
m_TDoAtNextRender[transitionId].m_id = tstart->m_id;
m_TDoAtNextRender[transitionId].m_currentStep = m_currentFrameNumber - startFrameId;
m_TDoAtNextRender[transitionId].m_nbSteps = stopFrameId - startFrameId;
}
return true;
}
bool
EffectsEngine::removeTransition( quint32 transitionId )
{
QWriteLocker wl( &m_rwl );
TStart* tstart;
TStop* tstop;
quint64 startFrameId;
quint64 stopFrameId;
tstart = m_TStartManager.getObject( transitionId );
tstop = m_TStopManager.getObject( transitionId );
if ( tstart == NULL || tstop == NULL )
return false;
startFrameId = tstart->m_startFrameId;
stopFrameId = tstop->m_stopFrameId;
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 );
if ( ( m_currentFrameNumber <= stopFrameId ) &&
( m_currentFrameNumber >= startFrameId ) )
{
m_TDoAtNextRender[transitionId].m_type = TEvent::DEL;
m_TDoAtNextRender[transitionId].m_id = transitionId;
}
return true;
}
......@@ -134,24 +134,6 @@ class EffectsEngine
*/
void setVideoInput( quint32 inId, const LightVideoFrame & frame );
void setCurrentFrameNumber( quint64 nb );
// TEMPORARY TRANSITION WRAPPER
quint32 addTransition( quint32 srcTrackId,
quint32 dstTrackId,
quint64 startFrameId,
quint64 stopFrameId );
bool moveTransition( quint32 transitionId,
quint64 startFrameId,
quint64 stopFrameId );
bool removeTransition( quint32 transitionId );
private:
void configureTransitions();
private:
/**
......@@ -191,84 +173,6 @@ private:
*/
bool m_processedInBypassPatch;
quint64 m_currentFrameNumber;
// Temporary
SemanticObjectManager<TStart> m_TStartManager;
SemanticObjectManager<TStop> m_TStopManager;
QMap<quint64, QMap<quint32, TStart*> > m_TStartTimeline;
QMap<quint64, QMap<quint32, TStop*> > m_TStopTimeline;
QMap<quint32, TEvent> m_TDoAtNextRender;
};
// Temporary
struct TEvent
{
enum EventType
{
DEL,
ADD,
UPDATE,
PATCH,
UNPATCH
};
EventType m_type;
quint32 m_id;
quint64 m_currentStep;
quint64 m_nbSteps;
};
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;
quint64 m_startFrameId;
quint32 m_srcTrackId;
quint32 m_dstTrackId;
quint64 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;
quint64 m_stopFrameId;
quint32 m_srcTrackId;
quint32 m_dstTrackId;
};
#endif // EFFECTSENGINE_H_
......@@ -139,7 +139,6 @@ MainWorkflow::getOutput( TrackType trackType, bool paused )
m_currentFrame[trackType], paused );
if ( trackType == MainWorkflow::VideoTrack )
{
m_effectEngine->setCurrentFrameNumber( m_currentFrame[VideoTrack] );
m_effectEngine->render();
const LightVideoFrame &tmp = m_effectEngine->getVideoOutput( 1 );
m_outputBuffers->video = &tmp;
......
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