1 | /* This file is part of the KDE project |
2 | Copyright (C) 2004-2007 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_FACTORY_P_H |
24 | #define PHONON_FACTORY_P_H |
25 | |
26 | #include "phonon_export.h" |
27 | |
28 | #include <QtCore/QObject> |
29 | #include <QtCore/QStringList> |
30 | |
31 | QT_BEGIN_HEADER |
32 | QT_BEGIN_NAMESPACE |
33 | |
34 | class QUrl; |
35 | class QIcon; |
36 | |
37 | namespace Phonon |
38 | { |
39 | class PlatformPlugin; |
40 | class MediaNodePrivate; |
41 | class AbstractMediaStream; |
42 | |
43 | /** |
44 | * \internal |
45 | * \brief Factory to access the preferred Backend. |
46 | * |
47 | * This class is used internally to get the backend's implementation. |
48 | * It keeps track of the objects that were created. When a |
49 | * request for a backend change comes, it asks all frontend objects to delete |
50 | * their backend objects and then checks whether they were all deleted. Only |
51 | * then the old backend is unloaded and the new backend is loaded. |
52 | * |
53 | * \author Matthias Kretz <kretz@kde.org> |
54 | */ |
55 | namespace Factory |
56 | { |
57 | /** |
58 | * Emits signals for Phonon::Factory. |
59 | */ |
60 | class Sender : public QObject |
61 | { |
62 | Q_OBJECT |
63 | Q_SIGNALS: |
64 | /** |
65 | * Emitted after the backend has successfully been changed. |
66 | */ |
67 | void backendChanged(); |
68 | |
69 | /** |
70 | * \copydoc BackendCapabilities::Notifier::availableAudioOutputDevicesChanged |
71 | */ |
72 | void availableAudioOutputDevicesChanged(); |
73 | |
74 | /** |
75 | * \copydoc BackendCapabilities::Notifier::availableAudioCaptureDevicesChanged |
76 | */ |
77 | void availableAudioCaptureDevicesChanged(); |
78 | }; |
79 | |
80 | /** |
81 | * Returns a pointer to the object emitting the signals. |
82 | * |
83 | * \see Sender::backendChanged() |
84 | */ |
85 | PHONON_EXPORT Sender *sender(); |
86 | |
87 | /** |
88 | * Create a new backend object for a MediaObject. |
89 | * |
90 | * \return a pointer to the MediaObject the backend provides. |
91 | */ |
92 | QObject *createMediaObject(QObject *parent = 0); |
93 | /** |
94 | * Create a new backend object for a Effect. |
95 | * |
96 | * \return a pointer to the Effect the backend provides. |
97 | */ |
98 | #ifndef QT_NO_PHONON_EFFECT |
99 | QObject *createEffect(int effectId, QObject *parent = 0); |
100 | #endif //QT_NO_PHONON_EFFECT |
101 | /** |
102 | * Create a new backend object for a VolumeFaderEffect. |
103 | * |
104 | * \return a pointer to the VolumeFaderEffect the backend provides. |
105 | */ |
106 | #ifndef QT_NO_PHONON_VOLUMEFADEREFFECT |
107 | QObject *createVolumeFaderEffect(QObject *parent = 0); |
108 | #endif //QT_NO_PHONON_VOLUMEFADEREFFECT |
109 | /** |
110 | * Create a new backend object for a AudioOutput. |
111 | * |
112 | * \return a pointer to the AudioOutput the backend provides. |
113 | */ |
114 | QObject *createAudioOutput(QObject *parent = 0); |
115 | /** |
116 | * Create a new backend object for a VideoWidget. |
117 | * |
118 | * \return a pointer to the VideoWidget the backend provides. |
119 | */ |
120 | #ifndef QT_NO_PHONON_VIDEO |
121 | QObject *createVideoWidget(QObject *parent = 0); |
122 | #endif //QT_NO_PHONON_VIDEO |
123 | |
124 | /** |
125 | * Create a new backend object for a AudioDataOutput. |
126 | * |
127 | * \return a pointer to the AudioDataOutput the backend provides. |
128 | */ |
129 | PHONON_EXPORT QObject *createAudioDataOutput(QObject *parent = 0); |
130 | |
131 | /** |
132 | * \return a pointer to the backend interface. |
133 | */ |
134 | PHONON_EXPORT QObject *backend(bool createWhenNull = true); |
135 | |
136 | /** |
137 | * Unique identifier for the Backend. Can be used in configuration files |
138 | * for example. |
139 | */ |
140 | QString identifier(); |
141 | |
142 | /** |
143 | * Get the name of the Backend. It's the name from the .desktop file. |
144 | */ |
145 | PHONON_EXPORT QString backendName(); |
146 | |
147 | /** |
148 | * Get the comment of the Backend. It's the comment from the .desktop file. |
149 | */ |
150 | QString (); |
151 | |
152 | /** |
153 | * Get the version of the Backend. It's the version from the .desktop file. |
154 | * |
155 | * The version is especially interesting if there are several versions |
156 | * available for binary incompatible versions of the backend's media |
157 | * framework. |
158 | */ |
159 | QString backendVersion(); |
160 | |
161 | /** |
162 | * Get the icon (name) of the Backend. It's the icon from the .desktop file. |
163 | */ |
164 | QString backendIcon(); |
165 | |
166 | /** |
167 | * Get the website of the Backend. It's the website from the .desktop file. |
168 | */ |
169 | QString backendWebsite(); |
170 | |
171 | /** |
172 | * registers the backend object |
173 | */ |
174 | PHONON_EXPORT QObject *registerQObject(QObject *o); |
175 | |
176 | bool isMimeTypeAvailable(const QString &mimeType); |
177 | |
178 | PHONON_EXPORT void registerFrontendObject(MediaNodePrivate *); |
179 | PHONON_EXPORT void deregisterFrontendObject(MediaNodePrivate *); |
180 | |
181 | PHONON_EXPORT void setBackend(QObject *); |
182 | //PHONON_EXPORT void createBackend(const QString &library, const QString &version = QString()); |
183 | |
184 | PHONON_EXPORT PlatformPlugin *platformPlugin(); |
185 | |
186 | //X It is probably better if we can get away with internal handling of |
187 | //X freeing the soundcard device when it's not needed anymore and |
188 | //X providing an IPC method to stop all MediaObjects -> free all |
189 | //X devices |
190 | //X /** |
191 | //X * \internal |
192 | //X * This is called when the application needs to free the soundcard |
193 | //X * device(s). |
194 | //X */ |
195 | //X void freeSoundcardDevices(); |
196 | } // namespace Factory |
197 | } // namespace Phonon |
198 | |
199 | QT_END_NAMESPACE |
200 | QT_END_HEADER |
201 | |
202 | #endif // PHONON_FACTORY_P_H |
203 | // vim: sw=4 ts=4 |
204 | |