1 /* This file is part of the KDE project
2 Copyright (C) 2004-2007 Matthias Kretz <kretz@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
20 #ifndef PHONON_FACTORY_P_H
21 #define PHONON_FACTORY_P_H
23 #include <phonon/phonon_export.h>
25 #include <QtCore/QObject>
26 #include <QtCore/QStringList>
37 class MediaNodePrivate
;
38 class AbstractMediaStream
;
42 * \brief Factory to access the preferred Backend.
44 * This class is used internally to get the backend's implementation.
45 * It keeps track of the objects that were created. When a
46 * request for a backend change comes, it asks all frontend objects to delete
47 * their backend objects and then checks whether they were all deleted. Only
48 * then the old backend is unloaded and the new backend is loaded.
50 * \author Matthias Kretz <kretz@kde.org>
55 * Emits signals for Phonon::Factory.
57 class Sender
: public QObject
62 * Emitted after the backend has successfully been changed.
64 void backendChanged();
67 * \copydoc BackendCapabilities::Notifier::availableAudioOutputDevicesChanged
69 void availableAudioOutputDevicesChanged();
73 * Returns a pointer to the object emitting the signals.
75 * \see Sender::backendChanged()
77 PHONON_EXPORT Sender
*sender();
80 * Create a new backend object for a MediaObject.
82 * \return a pointer to the MediaObject the backend provides.
84 QObject
*createMediaObject(QObject
*parent
= 0);
86 * Create a new backend object for a Effect.
88 * \return a pointer to the Effect the backend provides.
90 QObject
*createEffect(int effectId
, QObject
*parent
= 0);
92 * Create a new backend object for a VolumeFaderEffect.
94 * \return a pointer to the VolumeFaderEffect the backend provides.
96 QObject
*createVolumeFaderEffect(QObject
*parent
= 0);
98 * Create a new backend object for a AudioOutput.
100 * \return a pointer to the AudioOutput the backend provides.
102 QObject
*createAudioOutput(QObject
*parent
= 0);
104 * Create a new backend object for a AudioDataOutput.
106 * \return a pointer to the AudioDataOutput the backend provides.
108 PHONON_EXPORT QObject
*createAudioDataOutput(QObject
*parent
= 0);
110 * Create a new backend object for a Visualization.
112 * \return a pointer to the Visualization the backend provides.
114 PHONON_EXPORT QObject
*createVisualization(QObject
*parent
= 0);
116 * Create a new backend object for a VideoDataOutput.
118 * \return a pointer to the VideoDataOutput the backend provides.
120 PHONON_EXPORT QObject
*createVideoDataOutput(QObject
*parent
= 0);
122 * Create a new backend object for a VideoWidget.
124 * \return a pointer to the VideoWidget the backend provides.
126 QObject
*createVideoWidget(QObject
*parent
= 0);
129 * \return a pointer to the backend interface.
131 PHONON_EXPORT QObject
*backend(bool createWhenNull
= true);
134 * Unique identifier for the Backend. Can be used in configuration files
137 QString
identifier();
140 * Get the name of the Backend. It's the name from the .desktop file.
142 PHONON_EXPORT QString
backendName();
145 * Get the comment of the Backend. It's the comment from the .desktop file.
147 QString
backendComment();
150 * Get the version of the Backend. It's the version from the .desktop file.
152 * The version is especially interesting if there are several versions
153 * available for binary incompatible versions of the backend's media
156 QString
backendVersion();
159 * Get the icon (name) of the Backend. It's the icon from the .desktop file.
161 QString
backendIcon();
164 * Get the website of the Backend. It's the website from the .desktop file.
166 QString
backendWebsite();
169 * registers the backend object
171 PHONON_EXPORT QObject
*registerQObject(QObject
*o
);
173 bool isMimeTypeAvailable(const QString
&mimeType
);
175 PHONON_EXPORT
void registerFrontendObject(MediaNodePrivate
*);
176 PHONON_EXPORT
void deregisterFrontendObject(MediaNodePrivate
*);
178 PHONON_EXPORT
void setBackend(QObject
*);
179 //PHONON_EXPORT void createBackend(const QString &library, const QString &version = QString());
181 PHONON_EXPORT PlatformPlugin
*platformPlugin();
183 //X It is probably better if we can get away with internal handling of
184 //X freeing the soundcard device when it's not needed anymore and
185 //X providing an IPC method to stop all MediaObjects -> free all
189 //X * This is called when the application needs to free the soundcard
192 //X void freeSoundcardDevices();
193 } // namespace Factory
194 } // namespace Phonon
199 #endif // PHONON_FACTORY_P_H