| 1 | /*  This file is part of the KDE project.
 | 
|---|
| 2 | 
 | 
|---|
| 3 |     Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
|---|
| 4 | 
 | 
|---|
| 5 |     This library is free software: you can redistribute it and/or modify
 | 
|---|
| 6 |     it under the terms of the GNU Lesser General Public License as published by
 | 
|---|
| 7 |     the Free Software Foundation, either version 2.1 or 3 of the License.
 | 
|---|
| 8 | 
 | 
|---|
| 9 |     This library is distributed in the hope that it will be useful,
 | 
|---|
| 10 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 11 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 12 |     GNU Lesser General Public License for more details.
 | 
|---|
| 13 | 
 | 
|---|
| 14 |     You should have received a copy of the GNU Lesser General Public License
 | 
|---|
| 15 |     along with this library.  If not, see <http://www.gnu.org/licenses/>.
 | 
|---|
| 16 | */
 | 
|---|
| 17 | 
 | 
|---|
| 18 | #ifndef Phonon_GSTREAMER_BACKEND_H
 | 
|---|
| 19 | #define Phonon_GSTREAMER_BACKEND_H
 | 
|---|
| 20 | 
 | 
|---|
| 21 | #include "common.h"
 | 
|---|
| 22 | #include "devicemanager.h"
 | 
|---|
| 23 | #include "medianode.h"
 | 
|---|
| 24 | 
 | 
|---|
| 25 | #include <phonon/objectdescription.h>
 | 
|---|
| 26 | #include <phonon/backendinterface.h>
 | 
|---|
| 27 | 
 | 
|---|
| 28 | #include <QtCore/QList>
 | 
|---|
| 29 | #include <QtCore/QPointer>
 | 
|---|
| 30 | #include <QtCore/QStringList>
 | 
|---|
| 31 | #include <QtCore/QTimer>
 | 
|---|
| 32 | 
 | 
|---|
| 33 | #include <gst/gst.h>
 | 
|---|
| 34 | 
 | 
|---|
| 35 | QT_BEGIN_NAMESPACE
 | 
|---|
| 36 | 
 | 
|---|
| 37 | namespace Phonon
 | 
|---|
| 38 | {
 | 
|---|
| 39 | namespace Gstreamer
 | 
|---|
| 40 | {
 | 
|---|
| 41 | class AudioOutput;
 | 
|---|
| 42 | class MediaNode;
 | 
|---|
| 43 | class MediaObject;
 | 
|---|
| 44 | class EffectManager;
 | 
|---|
| 45 | 
 | 
|---|
| 46 | class Backend : public QObject, public BackendInterface
 | 
|---|
| 47 | {
 | 
|---|
| 48 |     Q_OBJECT
 | 
|---|
| 49 |     Q_INTERFACES(Phonon::BackendInterface)
 | 
|---|
| 50 | 
 | 
|---|
| 51 | public:
 | 
|---|
| 52 | 
 | 
|---|
| 53 |     enum DebugLevel {NoDebug, Warning, Info, Debug};
 | 
|---|
| 54 |     Backend(QObject *parent = 0, const QVariantList & = QVariantList());
 | 
|---|
| 55 |     virtual ~Backend();
 | 
|---|
| 56 | 
 | 
|---|
| 57 |     DeviceManager* deviceManager() const;
 | 
|---|
| 58 |     EffectManager* effectManager() const;
 | 
|---|
| 59 | 
 | 
|---|
| 60 |     QObject *createObject(BackendInterface::Class, QObject *parent, const QList<QVariant> &args);
 | 
|---|
| 61 | 
 | 
|---|
| 62 |     bool isValid() const;
 | 
|---|
| 63 |     bool supportsVideo() const;
 | 
|---|
| 64 |     QStringList availableMimeTypes() const;
 | 
|---|
| 65 | 
 | 
|---|
| 66 |     QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const;
 | 
|---|
| 67 |     QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const;
 | 
|---|
| 68 | 
 | 
|---|
| 69 |     bool startConnectionChange(QSet<QObject *>);
 | 
|---|
| 70 |     bool connectNodes(QObject *, QObject *);
 | 
|---|
| 71 |     bool disconnectNodes(QObject *, QObject *);
 | 
|---|
| 72 |     bool endConnectionChange(QSet<QObject *>);
 | 
|---|
| 73 | 
 | 
|---|
| 74 |     DebugLevel debugLevel() const;
 | 
|---|
| 75 | 
 | 
|---|
| 76 |     void addBusWatcher(MediaObject* node);
 | 
|---|
| 77 |     void removeBusWatcher(MediaObject* node);
 | 
|---|
| 78 |     void logMessage(const QString &message, int priority = 2, QObject *obj=0) const;
 | 
|---|
| 79 |     bool checkDependencies() const;
 | 
|---|
| 80 | 
 | 
|---|
| 81 | Q_SIGNALS:
 | 
|---|
| 82 |     void objectDescriptionChanged(ObjectDescriptionType);
 | 
|---|
| 83 | 
 | 
|---|
| 84 | private Q_SLOTS:
 | 
|---|
| 85 |     void handleBusMessage(Message);
 | 
|---|
| 86 | 
 | 
|---|
| 87 | private:
 | 
|---|
| 88 |     static gboolean busCall(GstBus *bus, GstMessage *msg, gpointer data);
 | 
|---|
| 89 | 
 | 
|---|
| 90 |     DeviceManager *m_deviceManager;
 | 
|---|
| 91 |     EffectManager *m_effectManager;
 | 
|---|
| 92 |     DebugLevel m_debugLevel;
 | 
|---|
| 93 |     bool m_isValid;
 | 
|---|
| 94 | };
 | 
|---|
| 95 | }
 | 
|---|
| 96 | } // namespace Phonon::Gstreamer
 | 
|---|
| 97 | 
 | 
|---|
| 98 | QT_END_NAMESPACE
 | 
|---|
| 99 | 
 | 
|---|
| 100 | #endif // Phonon_GSTREAMER_BACKEND_H
 | 
|---|