File indexing completed on 2024-12-01 04:21:25

0001 /*
0002     Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com>
0003     Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com>
0004     Copyright (C) 2009 Fathi Boudra <fabo@kde.org>
0005     Copyright (C) 2009-2011 vlc-phonon AUTHORS <kde-multimedia@kde.org>
0006     Copyright (C) 2011 Harald Sitter <sitter@kde.org>
0007 
0008     This library is free software; you can redistribute it and/or
0009     modify it under the terms of the GNU Lesser General Public
0010     License as published by the Free Software Foundation; either
0011     version 2.1 of the License, or (at your option) any later version.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 */
0021 
0022 #ifndef Phonon_VLC_EFFECTMANAGER_H
0023 #define Phonon_VLC_EFFECTMANAGER_H
0024 
0025 #include <QtCore/QObject>
0026 
0027 namespace Phonon {
0028 namespace VLC {
0029 
0030 class Backend;
0031 class EffectManager;
0032 
0033 /// Holds information about an effect
0034 class EffectInfo
0035 {
0036 public:
0037 
0038     enum Type {AudioEffect, VideoEffect};
0039 
0040     EffectInfo(const QString &name,
0041                const QString &description,
0042                const QString &author,
0043                int filter,
0044                Type type);
0045 
0046     QString name() const {
0047         return m_name;
0048     }
0049 
0050     QString description() const {
0051         return m_description;
0052     }
0053 
0054     QString author() const {
0055         return m_author;
0056     }
0057 
0058     int filter() const {
0059         return m_filter;
0060     }
0061 
0062     Type type() const {
0063         return m_type;
0064     }
0065 
0066 private:
0067     QString m_name;
0068     QString m_description;
0069     QString m_author;
0070     int m_filter;
0071     Type m_type;
0072 };
0073 
0074 /** \brief Manages a list of effects.
0075  *
0076  * \see EffectInfo
0077  */
0078 class EffectManager : public QObject
0079 {
0080     Q_OBJECT
0081 public:
0082     /**
0083      * Creates a new effect manager. It creates the lists of effects.
0084      *
0085      * \param backend A parent backend object for the effect manager
0086      *
0087      * \warning Currently it doesn't add any effects, everything is disabled.
0088      * \see EffectInfo
0089      */
0090     explicit EffectManager(QObject *parent = nullptr);
0091 
0092     /// Deletes all the effects from the lists and destroys the effect manager.
0093     ~EffectManager();
0094 
0095     /// Returns a list of available audio effects
0096     const QList<EffectInfo> audioEffects() const;
0097 
0098     /// Returns a list of available video effects
0099     const QList<EffectInfo> videoEffects() const;
0100 
0101     /// Returns a list of available effects
0102     const QList<EffectInfo> effects() const;
0103 
0104     QObject *createEffect(int id, QObject *parent);
0105 
0106 private:
0107     /// Generates the aggegated list of effects from both video and audio
0108     void updateEffects();
0109 
0110     QList<EffectInfo> m_effectList;
0111     QList<EffectInfo> m_audioEffectList;
0112     QList<EffectInfo> m_videoEffectList;
0113     bool m_equalizerEnabled;
0114 };
0115 
0116 } // namespace VLC
0117 } // namespace Phonon
0118 
0119 #endif // Phonon_VLC_EFFECTMANAGER_H