[vlmc-devel] commit: MainWorkflow: Factorize effect loading code. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Fri Sep 17 00:38:53 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Sep 16 23:52:06 2010 +0200| [7fe1fcac52e50f1d507c3921f3fbaf6175af7a88] | committer: Hugo Beauzée-Luyssen
MainWorkflow: Factorize effect loading code.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=7fe1fcac52e50f1d507c3921f3fbaf6175af7a88
---
src/EffectsEngine/EffectUser.cpp | 10 +++++++---
src/EffectsEngine/EffectUser.h | 2 +-
src/Workflow/MainWorkflow.cpp | 22 +---------------------
3 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/src/EffectsEngine/EffectUser.cpp b/src/EffectsEngine/EffectUser.cpp
index f13ba34..8d0d1eb 100644
--- a/src/EffectsEngine/EffectUser.cpp
+++ b/src/EffectsEngine/EffectUser.cpp
@@ -184,10 +184,14 @@ EffectUser::loadEffects( const QDomElement &parent )
{
Effect *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
if ( e != NULL )
- addEffect( e, effect.attribute( "start" ).toLongLong(),
- effect.attribute( "end" ).toLongLong() );
+ {
+ EffectHelper *helper = addEffect( e, effect.attribute( "start" ).toLongLong(),
+ effect.attribute( "end" ).toLongLong() );
+ if ( helper == NULL )
+ qCritical() << "Can't load effect" << effect.attribute( "name" );
+ }
else
- qCritical() << "Renderer: Can't load effect" << effect.attribute( "name" );
+ qCritical() << "Can't load effect" << effect.attribute( "name" );
}
effect = effect.nextSiblingElement();
}
diff --git a/src/EffectsEngine/EffectUser.h b/src/EffectsEngine/EffectUser.h
index 8b6c54c..4b078ea 100644
--- a/src/EffectsEngine/EffectUser.h
+++ b/src/EffectsEngine/EffectUser.h
@@ -59,6 +59,7 @@ class EffectUser : public QObject
void cleanEffects();
virtual qint64 length() const = 0;
virtual Type effectType() const = 0;
+ void loadEffects( const QDomElement &project );
protected:
EffectUser();
@@ -69,7 +70,6 @@ class EffectUser : public QObject
//Filters:
quint32 *applyFilters( const Workflow::Frame *frame,
qint64 currentFrame, double time );
- void loadEffects( const QDomElement &project );
void saveFilters( QXmlStreamWriter &project ) const;
//Mixers methods:
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 602a68f..5188feb 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -295,27 +295,7 @@ MainWorkflow::loadProject( const QDomElement &root )
end.toLongLong(), chUuid );
track( type, trackId )->addClip( ch, startFrame.toLongLong() );
- QDomElement effects = clip.firstChildElement( "effects" );
- if ( effects.isNull() == false )
- {
- QDomElement effect = effects.firstChildElement( "effect" );
- while ( effect.isNull() == false )
- {
- if ( effect.hasAttribute( "name" ) == true &&
- effect.hasAttribute( "start" ) == true &&
- effect.hasAttribute( "end" ) == true )
- {
- Effect *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
- qint64 start = effect.attribute( "start" ).toLongLong();
- qint64 end = effect.attribute( "end" ).toLongLong();
- if ( e != NULL )
- ch->clipWorkflow()->addEffect( e, start, end );
- else
- qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
- }
- effect = effect.nextSiblingElement();
- }
- }
+ ch->clipWorkflow()->loadEffects( clip );
}
clip = clip.nextSiblingElement();
}
More information about the Vlmc-devel
mailing list