1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
/* This file is part of the KDE project
Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDEMM_FACTORY_H
#define KDEMM_FACTORY_H
#include <kurl.h>
#include <kdemm/channel.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <dcopobject.h>
namespace KDE
{
/**
* \brief The KDE Multimedia classes
*
* In this Namespace you find a few classes to access Multimedia functions like
* playing audio files and simple video playing. Those classes are not dependent
* on any specific framework (like they were in pre KDE4 times) but rather use
* exchangeable backends to do the "dirty" work.
*
* If you want to write a new backend you also find the necessary classes in
* this namespace.
*
* \since 4.0
*/
namespace Multimedia
{
class Backend;
class Player;
class VideoPlayer;
/**
* \brief Factory to access the preferred Backend.
*
* This class is your entry point to KDE Multimedia usage. It provides the
* necessary objects for playing audio and video.
*
* For simple access to just playing an audio file see SimplePlayer.
*
* \remarks
* Extensions to the existing functionality can either be added by using the
* reserved virtual functions in Backend or by adding a new interface e.g.
* BackendV2 and creating a BackendV2 instance when the Backend instance is
* created.
*
* \author Matthias Kretz <kretz@kde.org>
* \since 4.0
*/
class KDE_EXPORT Factory : public TQObject, public DCOPObject
{
Q_OBJECT
public:
/**
* Returns a pointer to the factory.
* Use this function to get an instance of KLibLoader.
*
* @return a pointer to the loader. If no loader exists until now then
* one is created
*/
static Factory * self();
/**
* Create a new Player.
*
* You need to call it like this:
* \code
* Factory::self()->createPlayer();
* \endcode
*
* @return a pointer to the Player the backend provides
*/
Player * createPlayer();
/**
* Create a new VideoPlayer object. The Backend does not have to
* implement this functionality so you have to check that it didn't
* return 0.
*
* @return A new instance to a VideoPlayer from the Backend. Or 0 if
* the Backend does not support the VideoPlayer interface.
*/
VideoPlayer * createVideoPlayer();
/**
* Play the specified sound-file with no further control. Returns
* immediatly.
*
* @return if the file was be succesfully issued, but is not a
* garantie for succes of playing the entire file.
*/
bool playSoundEvent(const KURL & url);
/**
* Creates a new Channel object that you can use for a Player object to
* play to.
*
* \param title A user visible title for the Channel. Most of the time
* you will use the application's name.
*
* \param channeltype \ref availableChannels() returns a list of strings
* where you can choose one to be used. Most of the time you will use
* the "default" channel. But the Backend could also provide special
* purpose channels like one for notifications, one for previews and one
* for media playback.
*
* \param direction Whether it's a Channel::Input or Channel::Output
* that you're requesting.
*
* \returns Returns a Channel object or 0 if your request couldn't be
* fullfilled.
*/
Channel * createChannel( const TQString & title,
const TQString & channeltype = TQString::fromLatin1( "default" ),
Channel::Direction direction = Channel::Output );
/**
* Returns the names of the channels that can be used to play or record,
* depending on the value of \p direction.
*
* \param direction If set to Channel::Output you will get the names of
* all output channels, if set to Channel::Input you get the same for
* the input channels.
*/
TQStringList availableChannels( Channel::Direction direction = Channel::Output ) const;
/**
* Returns the mimetypes that can be played.
*/
TQStringList playableMimeTypes() const;
/**
* Checks whether a certain mimetype is playable.
*/
bool isMimeTypePlayable( const TQString & mimetype ) const;
/**
* Get the name of the Backend. It's the name from the .desktop file.
*/
TQString backendName() const;
/**
* Get the comment of the Backend. It's the comment from the .desktop file.
*/
TQString backendComment() const;
/**
* Get the version of the Backend. It's the version from the .desktop file.
*
* The version is especially interesting if there are several versions
* available for binary incompatible versions of the backend's media
* framework.
*/
TQString backendVersion() const;
/**
* Get the icon (name) of the Backend. It's the icon from the .desktop file.
*/
TQString backendIcon() const;
/**
* Get the website of the Backend. It's the website from the .desktop file.
*/
TQString backendWebsite() const;
signals:
/**
* This signal is emitted when the user changes the backend. You then
* have to free all your references to Player or Channel objects.
*/
void deleteYourObjects();
/**
* After you got a deleteYourObjects() signal the backend is changed
* internally. Then you will receive this signal, and only then should
* you reconstruct all your objects again. This time they will
* internally use the new backend.
*/
void recreateObjects();
protected:
Factory();
~Factory();
private slots:
void objectDestroyed( TQObject * );
private:
static Factory * m_self;
class Private;
Private * d;
K_DCOP
k_dcop:
/**
* \internal
* This is called via DCOP when the user changes the KDEMM Backend.
*/
void kdemmBackendChanged();
};
}} // namespaces
#endif // BACKENDFACTORY_H
// vim: sw=4 ts=4 tw=80 noet
|