| 1 | /* This file is part of the KDE project |
| 2 | Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) version 3, or any |
| 8 | later version accepted by the membership of KDE e.V. (or its |
| 9 | successor approved by the membership of KDE e.V.), Nokia Corporation |
| 10 | (or its successors, if any) and the KDE Free Qt Foundation, which shall |
| 11 | act as a proxy defined in Section 6 of version 3 of the license. |
| 12 | |
| 13 | This library is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | Lesser General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU Lesser General Public |
| 19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | */ |
| 22 | |
| 23 | #ifndef PHONON_PLATFORMPLUGIN_H |
| 24 | #define PHONON_PLATFORMPLUGIN_H |
| 25 | |
| 26 | #include <QObject> |
| 27 | #include <QStringList> |
| 28 | #include <QPair> |
| 29 | #include "phonon_export.h" |
| 30 | #include "objectdescription.h" |
| 31 | |
| 32 | |
| 33 | #ifndef QT_NO_PHONON_PLATFORMPLUGIN |
| 34 | |
| 35 | class QUrl; |
| 36 | class QObject; |
| 37 | class QIcon; |
| 38 | |
| 39 | namespace Phonon |
| 40 | { |
| 41 | class AbstractMediaStream; |
| 42 | |
| 43 | class PlatformPlugin |
| 44 | { |
| 45 | public: |
| 46 | virtual ~PlatformPlugin() {} |
| 47 | |
| 48 | /** |
| 49 | * Creates a AbstractMediaStream object that provides the data for the given \p url. On KDE |
| 50 | * this uses KIO. |
| 51 | */ |
| 52 | virtual AbstractMediaStream *createMediaStream(const QUrl &url, QObject *parent) = 0; |
| 53 | |
| 54 | /** |
| 55 | * Returns the icon for the given icon name. |
| 56 | */ |
| 57 | virtual QIcon icon(const QString &name) const = 0; |
| 58 | |
| 59 | /** |
| 60 | * Shows a notification popup |
| 61 | */ |
| 62 | virtual void notification(const char *notificationName, const QString &text, |
| 63 | const QStringList &actions = QStringList(), QObject *receiver = nullptr, |
| 64 | const char *actionSlot = nullptr) const = 0; |
| 65 | |
| 66 | /** |
| 67 | * Returns the name of the application. For most Qt application this is |
| 68 | * QCoreApplication::applicationName(), but for KDE this is overridden by KAboutData. |
| 69 | */ |
| 70 | virtual QString applicationName() const = 0; |
| 71 | |
| 72 | /** |
| 73 | * Creates a backend object. This way the platform can decide the backend preference. |
| 74 | */ |
| 75 | virtual QObject *createBackend() = 0; |
| 76 | |
| 77 | /** |
| 78 | * Using the library loader of the platform, loads a given backend. |
| 79 | */ |
| 80 | virtual QObject *createBackend(const QString &library, const QString &version) = 0; |
| 81 | |
| 82 | /** |
| 83 | * Tries to check whether the default backend supports a given MIME type without loading the |
| 84 | * actual backend library. On KDE this reads the MIME type list from the .desktop file of |
| 85 | * the backend. |
| 86 | */ |
| 87 | virtual bool isMimeTypeAvailable(const QString &mimeType) const = 0; |
| 88 | |
| 89 | /** |
| 90 | * Saves the volume for the given output. |
| 91 | */ |
| 92 | virtual void saveVolume(const QString &outputName, qreal volume) = 0; |
| 93 | |
| 94 | /** |
| 95 | * Loads the volume for the given output. |
| 96 | */ |
| 97 | virtual qreal loadVolume(const QString &outputName) const = 0; |
| 98 | |
| 99 | virtual QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const = 0; |
| 100 | virtual QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const = 0; |
| 101 | |
| 102 | /** |
| 103 | * Returns a list of (driver, handle) pairs for the given AudioOutputDevice description. |
| 104 | * Implementation is optional. |
| 105 | */ |
| 106 | virtual DeviceAccessList deviceAccessListFor(const AudioOutputDevice &) const { return DeviceAccessList(); } |
| 107 | |
| 108 | #ifndef PHONON_NO_AUDIOCAPTURE |
| 109 | /** |
| 110 | * Returns a list of (driver, handle) pairs for the given AudioCaptureDevice description. |
| 111 | * Implementation is optional. |
| 112 | */ |
| 113 | virtual DeviceAccessList deviceAccessListFor(const AudioCaptureDevice &) const { return DeviceAccessList(); } |
| 114 | #endif // PHONON_NO_AUDIOCAPTURE |
| 115 | |
| 116 | #ifndef PHONON_NO_VIDEOCAPTURE |
| 117 | /** |
| 118 | * Returns a list of (driver, handle) pairs for the given VideoCaptureDevice description. |
| 119 | * Implementation is optional. |
| 120 | */ |
| 121 | virtual DeviceAccessList deviceAccessListFor(const VideoCaptureDevice &) const { return DeviceAccessList(); } |
| 122 | #endif // PHONON_NO_VIDEOCAPTURE |
| 123 | }; |
| 124 | } // namespace Phonon |
| 125 | |
| 126 | Q_DECLARE_INTERFACE(Phonon::PlatformPlugin, "3PlatformPlugin.phonon.kde.org" ) |
| 127 | |
| 128 | #endif //QT_NO_PHONON_PLATFORMPLUGIN |
| 129 | |
| 130 | |
| 131 | #endif // PHONON_PLATFORMPLUGIN_H |
| 132 | |