| 1 |
/* This file is part of the KDE project |
| 2 |
Copyright (C) 2005-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 PHONONNAMESPACE_H |
| 24 |
#define PHONONNAMESPACE_H |
| 25 |
|
| 26 |
#include "phonon_export.h" |
| 27 |
|
| 28 |
/** |
| 29 |
* Helper macro that can be used like |
| 30 |
* \code |
| 31 |
* #if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 4, 0)) |
| 32 |
* \endcode |
| 33 |
*/ |
| 34 |
#define PHONON_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) |
| 35 |
|
| 36 |
/** |
| 37 |
* PHONON_VERSION is (major << 16) + (minor << 8) + patch. |
| 38 |
*/ |
| 39 |
#define PHONON_VERSION PHONON_VERSION_CHECK(@PHONON_LIB_MAJOR_VERSION@, @PHONON_LIB_MINOR_VERSION@, @PHONON_LIB_PATCH_VERSION@) |
| 40 |
|
| 41 |
/** |
| 42 |
* PHONON_VERSION_STR is "major.minor.patch". E.g. "4.2.1" |
| 43 |
*/ |
| 44 |
#define PHONON_VERSION_STR "@PHONON_LIB_MAJOR_VERSION@.@PHONON_LIB_MINOR_VERSION@.@PHONON_LIB_PATCH_VERSION@" |
| 45 |
|
| 46 |
QT_BEGIN_HEADER |
| 47 |
QT_BEGIN_NAMESPACE |
| 48 |
|
| 49 |
class QString; |
| 50 |
|
| 51 |
/** |
| 52 |
* \brief The %KDE Multimedia classes |
| 53 |
* |
| 54 |
* In this Namespace you find the classes to access Multimedia functions for |
| 55 |
* audio and video playback. Those classes are not dependent |
| 56 |
* on any specific framework (like they were in pre KDE4 times) but rather use |
| 57 |
* exchangeable backends to do the work. |
| 58 |
* |
| 59 |
* If you want to write a new backend take a look at \ref phonon_backend_development_page. |
| 60 |
* |
| 61 |
* \author Matthias Kretz <kretz@kde.org> |
| 62 |
*/ |
| 63 |
namespace Phonon |
| 64 |
{ |
| 65 |
PHONON_EXPORT const char *phononVersion(); |
| 66 |
|
| 67 |
/** |
| 68 |
* Enum to identify the media discs supported by MediaObject. |
| 69 |
* |
| 70 |
* \see MediaSource(Phonon::DiscType, const QString &deviceName) |
| 71 |
*/ |
| 72 |
enum DiscType { |
| 73 |
/** |
| 74 |
* No disc was selected. This is only useful as a return value from |
| 75 |
* MediaSource::distType(); |
| 76 |
*/ |
| 77 |
NoDisc = -1, |
| 78 |
/** |
| 79 |
* Identifies Audio CDs. |
| 80 |
*/ |
| 81 |
Cd = 0, |
| 82 |
/** |
| 83 |
* Identifies DVDs (not arbitrary data DVDs, only movie DVDs). |
| 84 |
*/ |
| 85 |
Dvd = 1, |
| 86 |
/** |
| 87 |
* Identifies Video CDs. |
| 88 |
*/ |
| 89 |
Vcd = 2 |
| 90 |
}; |
| 91 |
|
| 92 |
/** |
| 93 |
* Provided as keys for MediaObject::metaData for convenience, in addition to the strings defined in |
| 94 |
* the Ogg Vorbis specification. |
| 95 |
*/ |
| 96 |
enum MetaData { |
| 97 |
/** |
| 98 |
* The artist generally considered responsible for the work. In popular |
| 99 |
* music this is usually the performing band or singer. For classical |
| 100 |
* music it would be the composer. For an audio book it would be the |
| 101 |
* author of the original text. |
| 102 |
*/ |
| 103 |
ArtistMetaData, |
| 104 |
/** |
| 105 |
* The collection name to which this track belongs. |
| 106 |
*/ |
| 107 |
AlbumMetaData, |
| 108 |
/** |
| 109 |
* Track/Work name |
| 110 |
*/ |
| 111 |
TitleMetaData, |
| 112 |
/** |
| 113 |
* Date the track was recorded |
| 114 |
*/ |
| 115 |
DateMetaData, |
| 116 |
/** |
| 117 |
* A short text indication of music genre |
| 118 |
*/ |
| 119 |
GenreMetaData, |
| 120 |
/** |
| 121 |
* The track number of this piece if part of a specific larger |
| 122 |
* collection or album |
| 123 |
*/ |
| 124 |
TracknumberMetaData, |
| 125 |
/** |
| 126 |
* A short text description of the contents |
| 127 |
*/ |
| 128 |
DescriptionMetaData, |
| 129 |
MusicBrainzDiscIdMetaData |
| 130 |
}; |
| 131 |
|
| 132 |
/** |
| 133 |
* The state the media producing object is in at the moment. |
| 134 |
* |
| 135 |
* \see MediaObject |
| 136 |
*/ |
| 137 |
enum State |
| 138 |
{ |
| 139 |
/** |
| 140 |
* After construction it might take a while before the Player is |
| 141 |
* ready to play(). Normally this doesn't happen for local |
| 142 |
* files, but can happen for remote files where the asynchronous |
| 143 |
* mimetype detection and prebuffering can take a while. |
| 144 |
*/ |
| 145 |
LoadingState, |
| 146 |
/** |
| 147 |
* The Player has a valid media file loaded and is ready for |
| 148 |
* playing. |
| 149 |
*/ |
| 150 |
StoppedState, |
| 151 |
/** |
| 152 |
* The Player is playing a media file. |
| 153 |
*/ |
| 154 |
PlayingState, |
| 155 |
/** |
| 156 |
* The Player is waiting for data to be able to continue |
| 157 |
* playing. |
| 158 |
*/ |
| 159 |
BufferingState, |
| 160 |
/** |
| 161 |
* The Player is currently paused. |
| 162 |
*/ |
| 163 |
PausedState, |
| 164 |
/** |
| 165 |
* An unrecoverable error occurred. The Object is unusable in this state. |
| 166 |
*/ |
| 167 |
ErrorState |
| 168 |
}; |
| 169 |
|
| 170 |
/** |
| 171 |
* Set's the category your program should be listed in in the mixer. |
| 172 |
* |
| 173 |
* A Jukebox will set this to Music, a VoIP program to Communication, a |
| 174 |
* DVD player to video, and so on. |
| 175 |
* |
| 176 |
* \note These categories can also become useful for an application that |
| 177 |
* controls the volumes automatically, like turning down the music when a call |
| 178 |
* comes in, or turning down the notifications when the media player knows |
| 179 |
* it's playing classical music. |
| 180 |
* |
| 181 |
* \see AudioOutput::setCategory |
| 182 |
*/ |
| 183 |
enum Category |
| 184 |
{ |
| 185 |
/** |
| 186 |
* Will make use of the default device. |
| 187 |
*/ |
| 188 |
NoCategory = -1, |
| 189 |
/** |
| 190 |
* If the sounds produced are notifications (bing, beep and such) you |
| 191 |
* should use this category. |
| 192 |
*/ |
| 193 |
NotificationCategory = 0, |
| 194 |
/** |
| 195 |
* If your application is a music player (like a jukebox or media player |
| 196 |
* playing an audio file). |
| 197 |
*/ |
| 198 |
MusicCategory = 1, |
| 199 |
/** |
| 200 |
* If the sound is the audio channel of a video. |
| 201 |
*/ |
| 202 |
VideoCategory = 2, |
| 203 |
/** |
| 204 |
* If your applications produces sounds from communication with somebody |
| 205 |
* else (VoIP, voice chat). |
| 206 |
*/ |
| 207 |
CommunicationCategory = 3, |
| 208 |
/** |
| 209 |
* Sound produced by a computer game should go into this category. |
| 210 |
*/ |
| 211 |
GameCategory = 4, |
| 212 |
/** |
| 213 |
* Sounds produced for accessibility (e.g. Text-To-Speech) |
| 214 |
*/ |
| 215 |
AccessibilityCategory = 5, |
| 216 |
/** |
| 217 |
* \internal |
| 218 |
* Holds the largest value of categories. |
| 219 |
*/ |
| 220 |
LastCategory = AccessibilityCategory |
| 221 |
}; |
| 222 |
|
| 223 |
/** |
| 224 |
* Tells your program how to recover from an error. |
| 225 |
* |
| 226 |
* \see MediaObject::errorType() |
| 227 |
*/ |
| 228 |
enum ErrorType { |
| 229 |
/** |
| 230 |
* No error. MediaObject::errorType() returns this if |
| 231 |
* MediaObject::state() != Phonon::ErrorState. |
| 232 |
*/ |
| 233 |
NoError = 0, |
| 234 |
/** |
| 235 |
* Playback should work, and trying with another URL should work. |
| 236 |
*/ |
| 237 |
NormalError = 1, |
| 238 |
/** |
| 239 |
* Something important does not work. Your program cannot continue |
| 240 |
* playback or capture or whatever it was trying to do |
| 241 |
* without help from the user. |
| 242 |
*/ |
| 243 |
FatalError = 2 |
| 244 |
}; |
| 245 |
|
| 246 |
/** |
| 247 |
* Returns a (translated) string to show to the user identifying the given |
| 248 |
* Category. |
| 249 |
*/ |
| 250 |
PHONON_EXPORT QString categoryToString(Category c); |
| 251 |
|
| 252 |
// TODO: naming |
| 253 |
/*enum MediaStreamType { |
| 254 |
Audio = 1, |
| 255 |
Video = 2, |
| 256 |
StillImage = 4, |
| 257 |
Subtitle = 8, |
| 258 |
AllMedia = 0xFFFFFFFF |
| 259 |
}; |
| 260 |
Q_DECLARE_FLAGS(MediaStreamTypes, MediaStreamType)*/ |
| 261 |
} // namespace Phonon |
| 262 |
//Q_DECLARE_OPERATORS_FOR_FLAGS(Phonon::MediaStreamTypes) |
| 263 |
|
| 264 |
QT_END_NAMESPACE |
| 265 |
|
| 266 |
//X class kdbgstream; |
| 267 |
//X #include <kdebug.h> |
| 268 |
//X /** |
| 269 |
//X * Implements needed operator to use Phonon::State with kDebug |
| 270 |
//X */ |
| 271 |
//X inline PHONON_EXPORT kdbgstream &operator<<(kdbgstream & stream, const Phonon::State state) |
| 272 |
//X { |
| 273 |
//X switch(state) |
| 274 |
//X { |
| 275 |
//X case Phonon::ErrorState: |
| 276 |
//X stream << "ErrorState"; |
| 277 |
//X break; |
| 278 |
//X case Phonon::LoadingState: |
| 279 |
//X stream << "LoadingState"; |
| 280 |
//X break; |
| 281 |
//X case Phonon::StoppedState: |
| 282 |
//X stream << "StoppedState"; |
| 283 |
//X break; |
| 284 |
//X case Phonon::PlayingState: |
| 285 |
//X stream << "PlayingState"; |
| 286 |
//X break; |
| 287 |
//X case Phonon::BufferingState: |
| 288 |
//X stream << "BufferingState"; |
| 289 |
//X break; |
| 290 |
//X case Phonon::PausedState: |
| 291 |
//X stream << "PausedState"; |
| 292 |
//X break; |
| 293 |
//X } |
| 294 |
//X return stream; |
| 295 |
//X } |
| 296 |
|
| 297 |
#include <QtCore/QMetaType> |
| 298 |
|
| 299 |
Q_DECLARE_METATYPE(Phonon::State) |
| 300 |
Q_DECLARE_METATYPE(Phonon::ErrorType) |
| 301 |
Q_DECLARE_METATYPE(Phonon::Category) |
| 302 |
|
| 303 |
QT_END_HEADER |
| 304 |
|
| 305 |
// vim: sw=4 ts=4 tw=80 |
| 306 |
#endif // PHONONNAMESPACE_H |