Commit 40fcb522 authored by Vincent Carrubba's avatar Vincent Carrubba

Now UTW (ugly transition wrapper) is more complete and have debug output

parent 328188cf
...@@ -113,6 +113,14 @@ EffectsEngine::makePatch( void ) ...@@ -113,6 +113,14 @@ EffectsEngine::makePatch( void )
if ( tmp->connectStaticVideoOutputToStaticVideoInput( 1, 2, 1 ) == false ) if ( tmp->connectStaticVideoOutputToStaticVideoInput( 1, 2, 1 ) == false )
qDebug() << "The connection of the RNBInvert output" qDebug() << "The connection of the RNBInvert output"
<< "with the first input of the blit failed!"; << "with the first input of the blit failed!";
// TRANSITIONS
int i;
for ( i = 100; i < 100000; i += 100 )
qDebug() << "New transition with id #" << addTransition( 1, 2, i, i + 50);
} }
else else
qDebug() << "There's not the video mixer plugin," qDebug() << "There's not the video mixer plugin,"
...@@ -159,6 +167,14 @@ EffectsEngine::makeBypassPatch( void ) ...@@ -159,6 +167,14 @@ EffectsEngine::makeBypassPatch( void )
} }
} }
void
EffectsEngine::setCurrentFrameNumber( quint64 nb )
{
QWriteLocker wl( &m_rwl );
m_currentFrameNumber = nb;
}
void void
EffectsEngine::setVideoInput( quint32 inId, const LightVideoFrame & frame ) EffectsEngine::setVideoInput( quint32 inId, const LightVideoFrame & frame )
{ {
...@@ -180,12 +196,12 @@ EffectsEngine::render( void ) ...@@ -180,12 +196,12 @@ EffectsEngine::render( void )
{ {
QWriteLocker wl( &m_rwl ); QWriteLocker wl( &m_rwl );
if ( m_processedInBypassPatch == false ) if ( m_processedInBypassPatch == false )
m_patch->render();
else
{ {
configureTransitions(); configureTransitions();
m_bypassPatch->render(); m_patch->render();
} }
else
m_bypassPatch->render();
} }
const LightVideoFrame & const LightVideoFrame &
...@@ -220,17 +236,91 @@ EffectsEngine::disable( void ) ...@@ -220,17 +236,91 @@ EffectsEngine::disable( void )
void void
EffectsEngine::configureTransitions() 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 : DEL\n"
<< "ID : " << it.value().m_id;
break;
}
}
} }
quint32 quint32
EffectsEngine::addTransition( quint32 srcTrackId, EffectsEngine::addTransition( quint32 srcTrackId,
quint32 dstTrackId, quint32 dstTrackId,
quint32 startFrameId, quint64 startFrameId,
quint32 stopFrameId ) quint64 stopFrameId )
{ {
QWriteLocker wl( &m_rwl ); QWriteLocker wl( &m_rwl );
TStart* tstart; TStart* tstart;
TStop* tstop; TStop* tstop;
quint32 i;
m_TStartManager.createObject(); m_TStartManager.createObject();
m_TStopManager.createObject(); m_TStopManager.createObject();
...@@ -247,21 +337,36 @@ EffectsEngine::addTransition( quint32 srcTrackId, ...@@ -247,21 +337,36 @@ EffectsEngine::addTransition( quint32 srcTrackId,
tstop->m_dstTrackId = dstTrackId; tstop->m_dstTrackId = dstTrackId;
m_TStartTimeline[startFrameId][tstart->m_id] = tstart; m_TStartTimeline[startFrameId][tstart->m_id] = tstart;
m_TStopTimeline[stopFrameId][tstop->m_id] = tstop; 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; return tstart->m_id;
} }
bool bool
EffectsEngine::moveTransition( quint32 transitionId, quint32 startFrameId, quint32 stopFrameId ) EffectsEngine::moveTransition( quint32 transitionId, quint64 startFrameId, quint64 stopFrameId )
{ {
QWriteLocker wl( &m_rwl ); QWriteLocker wl( &m_rwl );
TStart* tstart; TStart* tstart;
TStop* tstop; TStop* tstop;
quint64 oldStartFrameId;
quint64 oldStopFrameId;
tstart = m_TStartManager.getObject( transitionId ); tstart = m_TStartManager.getObject( transitionId );
tstop = m_TStopManager.getObject( transitionId ); tstop = m_TStopManager.getObject( transitionId );
if ( tstart == NULL || tstop == NULL ) if ( tstart == NULL || tstop == NULL )
return false; return false;
oldStartFrameId = tstart->m_startFrameId;
oldStopFrameId = tstop->m_stopFrameId;
if ( tstart->m_startFrameId != startFrameId ) if ( tstart->m_startFrameId != startFrameId )
{ {
m_TStartTimeline[tstart->m_startFrameId]. m_TStartTimeline[tstart->m_startFrameId].
...@@ -280,13 +385,41 @@ EffectsEngine::moveTransition( quint32 transitionId, quint32 startFrameId, quint ...@@ -280,13 +385,41 @@ EffectsEngine::moveTransition( quint32 transitionId, quint32 startFrameId, quint
m_TStopTimeline[startFrameId][transitionId] = tstop; m_TStopTimeline[startFrameId][transitionId] = tstop;
} }
tstart->m_startFrameId = startFrameId; tstart->m_startFrameId = startFrameId;
tstart->m_nbSteps = stopFrameId - startFrameId; tstart->m_nbSteps = stopFrameId - startFrameId;
tstop->m_stopFrameId = stopFrameId; tstop->m_stopFrameId = stopFrameId;
// if we're during a transition, think to update the nbSteps in the transition Effect.
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; return true;
} }
...@@ -296,12 +429,16 @@ EffectsEngine::removeTransition( quint32 transitionId ) ...@@ -296,12 +429,16 @@ EffectsEngine::removeTransition( quint32 transitionId )
QWriteLocker wl( &m_rwl ); QWriteLocker wl( &m_rwl );
TStart* tstart; TStart* tstart;
TStop* tstop; TStop* tstop;
quint64 startFrameId;
quint64 stopFrameId;
tstart = m_TStartManager.getObject( transitionId ); tstart = m_TStartManager.getObject( transitionId );
tstop = m_TStopManager.getObject( transitionId ); tstop = m_TStopManager.getObject( transitionId );
if ( tstart == NULL || tstop == NULL ) if ( tstart == NULL || tstop == NULL )
return false; return false;
startFrameId = tstart->m_startFrameId;
stopFrameId = tstop->m_stopFrameId;
m_TStartTimeline[tstart->m_startFrameId]. m_TStartTimeline[tstart->m_startFrameId].
erase( m_TStartTimeline[tstart->m_startFrameId].find( tstart->m_id ) ); erase( m_TStartTimeline[tstart->m_startFrameId].find( tstart->m_id ) );
if ( m_TStartTimeline[tstart->m_startFrameId].isEmpty() == true ) if ( m_TStartTimeline[tstart->m_startFrameId].isEmpty() == true )
...@@ -313,5 +450,12 @@ EffectsEngine::removeTransition( quint32 transitionId ) ...@@ -313,5 +450,12 @@ EffectsEngine::removeTransition( quint32 transitionId )
m_TStartManager.deleteObject( transitionId ); m_TStartManager.deleteObject( transitionId );
m_TStopManager.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; return true;
} }
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <QtGlobal> #include <QtGlobal>
// Temporary // Temporary
class TEvent;
class TStart; class TStart;
class TStop; class TStop;
...@@ -131,17 +132,20 @@ class EffectsEngine ...@@ -131,17 +132,20 @@ class EffectsEngine
* else, it will give the video frame to the input with the id inId * else, it will give the video frame to the input with the id inId
* of the EffectNode called "BypassRootNode" * of the EffectNode called "BypassRootNode"
*/ */
void setVideoInput( quint32 inId, const LightVideoFrame & frame ); void setVideoInput( quint32 inId, const LightVideoFrame & frame );
void setCurrentFrameNumber( quint64 nb );
// TEMPORARY TRANSITION WRAPPER // TEMPORARY TRANSITION WRAPPER
quint32 addTransition( quint32 srcTrackId, quint32 addTransition( quint32 srcTrackId,
quint32 dstTrackId, quint32 dstTrackId,
quint32 startFrameId, quint64 startFrameId,
quint32 stopFrameId ); quint64 stopFrameId );
bool moveTransition( quint32 transitionId, bool moveTransition( quint32 transitionId,
quint32 startFrameId, quint64 startFrameId,
quint32 stopFrameId ); quint64 stopFrameId );
bool removeTransition( quint32 transitionId ); bool removeTransition( quint32 transitionId );
private: private:
...@@ -187,16 +191,35 @@ private: ...@@ -187,16 +191,35 @@ private:
*/ */
bool m_processedInBypassPatch; bool m_processedInBypassPatch;
quint64 m_currentFrameNumber;
// Temporary // Temporary
SemanticObjectManager<TStart> m_TStartManager; SemanticObjectManager<TStart> m_TStartManager;
SemanticObjectManager<TStop> m_TStopManager; SemanticObjectManager<TStop> m_TStopManager;
QMap<quint32, QMap<quint32, TStart*> > m_TStartTimeline; QMap<quint64, QMap<quint32, TStart*> > m_TStartTimeline;
QMap<quint32, QMap<quint32, TStop*> > m_TStopTimeline; QMap<quint64, QMap<quint32, TStop*> > m_TStopTimeline;
QMap<quint32, TEvent> m_TDoAtNextRender;
}; };
// Temporary // Temporary
struct TEvent
{
enum EventType
{
DEL,
ADD,
UPDATE,
PATCH,
UNPATCH
};
EventType m_type;
quint32 m_id;
quint64 m_currentStep;
quint64 m_nbSteps;
};
struct TStart struct TStart
{ {
void setId( quint32 id ) void setId( quint32 id )
...@@ -217,10 +240,10 @@ struct TStart ...@@ -217,10 +240,10 @@ struct TStart
}; };
quint32 m_id; quint32 m_id;
quint32 m_startFrameId; quint64 m_startFrameId;
quint32 m_srcTrackId; quint32 m_srcTrackId;
quint32 m_dstTrackId; quint32 m_dstTrackId;
quint32 m_nbSteps; quint64 m_nbSteps;
}; };
struct TStop struct TStop
...@@ -243,7 +266,7 @@ struct TStop ...@@ -243,7 +266,7 @@ struct TStop
}; };
quint32 m_id; quint32 m_id;
quint32 m_stopFrameId; quint64 m_stopFrameId;
quint32 m_srcTrackId; quint32 m_srcTrackId;
quint32 m_dstTrackId; quint32 m_dstTrackId;
}; };
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
*****************************************************************************/ *****************************************************************************/
#include "MixerEffectPlugin.h" #include "MixerEffectPlugin.h"
//#include "VlmcPlugin.h"
#include <QtDebug> #include <QtDebug>
MixerEffectPlugin::MixerEffectPlugin() MixerEffectPlugin::MixerEffectPlugin()
......
...@@ -141,6 +141,7 @@ MainWorkflow::getOutput( TrackType trackType ) ...@@ -141,6 +141,7 @@ MainWorkflow::getOutput( TrackType trackType )
m_currentFrame[trackType] ); m_currentFrame[trackType] );
if ( trackType == MainWorkflow::VideoTrack ) if ( trackType == MainWorkflow::VideoTrack )
{ {
m_effectEngine->setCurrentFrameNumber( getCurrentFrame() );
m_effectEngine->render(); m_effectEngine->render();
const LightVideoFrame &tmp = m_effectEngine->getVideoOutput( 1 ); const LightVideoFrame &tmp = m_effectEngine->getVideoOutput( 1 );
m_outputBuffers->video = &tmp; 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