EffectsEngine.h 2.54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*****************************************************************************
 * EffectsEngine.h: Manage the effects plugins.
 *****************************************************************************
 * Copyright (C) 2008-2010 VideoLAN
 *
 * Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef EFFECTSENGINE_H
#define EFFECTSENGINE_H

#include "Singleton.hpp"

28
#include "Effect.h"
29
#include "MainWorkflow.h"
30

31
#include <QObject>
32
#include <QHash>
33

34 35
class   QSettings;

36
class   EffectsEngine : public QObject, public Singleton<EffectsEngine>
37
{
38 39
    Q_OBJECT

40
    public:
41 42
        struct      EffectHelper
        {
43
            EffectHelper( EffectInstance* effect, qint64 start = 0, qint64 end = -1,
44
                          const QString& uuid = QString() );
45 46 47 48
            EffectInstance*     effect;
            qint64              start;
            qint64              end;
            QUuid               uuid;
49
        };
50
        typedef QList<EffectHelper*>    EffectList;
51

52
        Effect*     effect( const QString& name );
53
        bool        loadEffect( const QString& fileName );
54
        void        browseDirectory( const QString& path );
55

56
        static void applyEffects( const EffectList &effects,
57
                                  Workflow::Frame *frame, qint64 currentFrame );
58
        static void saveEffects( const EffectList &effects, QXmlStreamWriter &project );
59
        static void initEffects( const EffectList &effects, quint32 width, quint32 height );
60

61 62 63 64
    private:
        EffectsEngine();
        ~EffectsEngine();

65
        QHash<QString, Effect*> m_effects;
66
        QSettings               *m_cache;
67

68
    signals:
69
        void        effectAdded( Effect*, const QString& name, Effect::Type );
70 71 72 73
    friend class    Singleton<EffectsEngine>;
};

#endif // EFFECTSENGINE_H