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