Warning, /libraries/phonon/phonon/phononnamespace.h.in is written in an unsupported language. File is not indexed.

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2005-2008 Matthias Kretz <kretz@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 */
0022 
0023 #ifndef PHONONNAMESPACE_H
0024 #define PHONONNAMESPACE_H
0025 
0026 #include "phonon_export.h"
0027 #include "phonon_version.h"
0028 
0029 /**
0030  * Helper macro that can be used like
0031  * \code
0032  * #if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 4, 0))
0033  * \endcode
0034  */
0035 #define PHONON_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
0036 
0037 /**
0038  * PHONON_VERSION_STR is "major.minor.patch". E.g. "4.2.1"
0039  * @deprecated Use PHONON_VERSION_STRING
0040  */
0041 #define PHONON_VERSION_STR PHONON_VERSION_STRING
0042 
0043 /**
0044  * Definitions to disable capture - should end up in the backends and
0045  * platform plugins, too
0046  */
0047 
0048 #cmakedefine PHONON_NO_CAPTURE
0049 
0050 #ifdef PHONON_NO_CAPTURE
0051 #define PHONON_NO_VIDEOCAPTURE
0052 #define PHONON_NO_AUDIOCAPTURE
0053 #endif
0054 
0055 
0056 class QString;
0057 
0058 /**
0059  * \brief The %KDE Multimedia classes
0060  *
0061  * In this Namespace you find the classes to access Multimedia functions for
0062  * audio and video playback. Those classes are not dependent
0063  * on any specific framework (like they were in pre KDE4 times) but rather use
0064  * exchangeable backends to do the work.
0065  *
0066  * If you want to write a new backend take a look at \ref phonon_backend_development_page.
0067  *
0068  * \author Matthias Kretz <kretz@kde.org>
0069  */
0070 namespace Phonon
0071 {
0072     PHONON_EXPORT const char *phononVersion();
0073 
0074     /**
0075      * Enum to identify the media discs supported by MediaObject.
0076      *
0077      * \see MediaSource(Phonon::DiscType, const QString &deviceName)
0078      */
0079     enum DiscType {
0080         NoDisc = -1, /** < No disc was selected. Only used as default value in
0081                           \class MediaSource */
0082         Cd = 0,      /** < Audio CD */
0083         Dvd = 1,     /** < Video DVD (no arbitrary data DVDs) */
0084         Vcd = 2,     /** < Video CD */
0085         BluRay = 3   /** < BluRay video disc \since 4.7.0 */
0086     };
0087 
0088     /**
0089      * Provided as keys for MediaObject::metaData for convenience, in addition to the strings defined in
0090      * the Ogg Vorbis specification.
0091      */
0092     enum MetaData {
0093         /**
0094          * The artist generally considered responsible for the work. In popular
0095          * music this is usually the performing band or singer. For classical
0096          * music it would be the composer. For an audio book it would be the
0097          * author of the original text.
0098          */
0099         ArtistMetaData,
0100         /**
0101          * The collection name to which this track belongs.
0102          */
0103         AlbumMetaData,
0104         /**
0105          * Track/Work name
0106          */
0107         TitleMetaData,
0108         /**
0109          * Date the track was recorded
0110          */
0111         DateMetaData,
0112         /**
0113          * A short text indication of music genre
0114          */
0115         GenreMetaData,
0116         /**
0117          * The track number of this piece if part of a specific larger
0118          * collection or album
0119          */
0120         TracknumberMetaData,
0121         /**
0122          * A short text description of the contents
0123          */
0124         DescriptionMetaData,
0125         MusicBrainzDiscIdMetaData
0126     };
0127 
0128     /**
0129      * The state the media producing object is in at the moment.
0130      *
0131      * \see MediaObject
0132      */
0133     enum State {
0134         /**
0135          * After construction it might take a while before the Player is
0136          * ready to play(). Normally this doesn't happen for local
0137          * files, but can happen for remote files where the asynchronous
0138          * mimetype detection and prebuffering can take a while.
0139          */
0140         LoadingState,
0141         /**
0142          * The Player has a valid media file loaded and is ready for
0143          * playing.
0144          */
0145         StoppedState,
0146         /**
0147          * The Player is playing a media file.
0148          */
0149         PlayingState,
0150         /**
0151          * The Player is waiting for data to be able to continue
0152          * playing.
0153          */
0154         BufferingState,
0155         /**
0156          * The Player is currently paused.
0157          */
0158         PausedState,
0159         /**
0160          * An unrecoverable error occurred. The Object is unusable in this state.
0161          */
0162         ErrorState
0163     };
0164 
0165     /**
0166      * Set's the category your program should be listed in in the mixer.
0167      *
0168      * A Jukebox will set this to Music, a VoIP program to Communication, a
0169      * DVD player to video, and so on.
0170      *
0171      * \note These categories can also become useful for an application that
0172      * controls the volumes automatically, like turning down the music when a call
0173      * comes in, or turning down the notifications when the media player knows
0174      * it's playing classical music.
0175      *
0176      * \see AudioOutput::setCategory
0177      */
0178     enum Category {
0179         /**
0180          * Will make use of the default device.
0181          */
0182         NoCategory = -1,
0183         /**
0184          * If the sounds produced are notifications (bing, beep and such) you
0185          * should use this category.
0186          */
0187         NotificationCategory = 0,
0188         /**
0189          * If your application is a music player (like a jukebox or media player
0190          * playing an audio file).
0191          */
0192         MusicCategory = 1,
0193         /**
0194          * If the sound is the audio channel of a video.
0195          */
0196         VideoCategory = 2,
0197         /**
0198          * If your applications produces sounds from communication with somebody
0199          * else (VoIP, voice chat).
0200          */
0201         CommunicationCategory = 3,
0202         /**
0203          * Sound produced by a computer game should go into this category.
0204          */
0205         GameCategory = 4,
0206         /**
0207          * Sounds produced for accessibility (e.g. Text-To-Speech)
0208          */
0209         AccessibilityCategory = 5,
0210         /**
0211          * \internal
0212          * Holds the largest value of categories.
0213          */
0214         LastCategory = AccessibilityCategory
0215     };
0216 
0217     /**
0218      * What capture category does an application adhere to. Mainly
0219      * used to decide upon what capture device will be used, depending
0220      * on the global configuration (user preference).
0221      *
0222      * \see MediaObject::setVideoCaptureDevice
0223      * \see MediaObject::setAudioCaptureDevice
0224      * \see AvCapture
0225      */
0226     enum CaptureCategory {
0227         /**
0228          * Will make use of the default device
0229          */
0230         NoCaptureCategory = NoCategory,
0231 
0232         /**
0233          * For applications that use video or audio capture for communication,
0234          * video conference style. (VoIP, voice chat)
0235          */
0236         CommunicationCaptureCategory = CommunicationCategory,
0237 
0238         /**
0239          * Recording applications, that actually save the data somewhere
0240          */
0241         RecordingCaptureCategory,
0242 
0243         /**
0244          * Voice control. Maybe used for accessibility purposes too
0245          */
0246         ControlCaptureCategory = AccessibilityCategory
0247     };
0248 
0249     namespace Capture {
0250         /**
0251          * Describes the type of a capture device, audio or video
0252          */
0253         enum DeviceType {
0254             AudioType,
0255             VideoType
0256         };
0257     }
0258 
0259     /**
0260      * Tells your program how to recover from an error.
0261      *
0262      * \see MediaObject::errorType()
0263      */
0264     enum ErrorType {
0265         /**
0266          * No error. MediaObject::errorType() returns this if
0267          * MediaObject::state() != Phonon::ErrorState.
0268          */
0269         NoError = 0,
0270         /**
0271          * Playback should work, and trying with another URL should work.
0272          */
0273         NormalError = 1,
0274         /**
0275          * Something important does not work. Your program cannot continue
0276          * playback or capture or whatever it was trying to do
0277          * without help from the user.
0278          */
0279         FatalError = 2
0280     };
0281 
0282     /**
0283      * Returns a (translated) string to show to the user identifying the given
0284      * Category.
0285      */
0286     PHONON_EXPORT QString categoryToString(Category c);
0287 
0288     /**
0289      * Returns a (translated) string to show to the user identifying the given
0290      * CaptureCategory.
0291      */
0292     PHONON_EXPORT QString categoryToString(CaptureCategory c);
0293 
0294     // TODO: naming
0295     /*enum MediaStreamType {
0296         Audio = 1,
0297         Video = 2,
0298         StillImage = 4,
0299         Subtitle = 8,
0300         AllMedia = 0xFFFFFFFF
0301     };
0302     Q_DECLARE_FLAGS(MediaStreamTypes, MediaStreamType)*/
0303 
0304     PHONON_EXPORT QDebug operator <<(QDebug dbg, const Phonon::DiscType &);
0305     PHONON_EXPORT QDebug operator <<(QDebug dbg, const Phonon::MetaData &);
0306     PHONON_EXPORT QDebug operator <<(QDebug dbg, const Phonon::State &);
0307     PHONON_EXPORT QDebug operator <<(QDebug dbg, const Phonon::Category &);
0308     PHONON_EXPORT QDebug operator <<(QDebug dbg, const Phonon::CaptureCategory &);
0309     PHONON_EXPORT QDebug operator <<(QDebug dbg, const Phonon::Capture::DeviceType &);
0310     PHONON_EXPORT QDebug operator <<(QDebug dbg, const Phonon::ErrorType &);
0311 
0312 //Q_DECLARE_OPERATORS_FOR_FLAGS(MediaStreamTypes)
0313 } // namespace Phonon
0314 
0315 #include <QMetaType>
0316 
0317 Q_DECLARE_METATYPE(Phonon::State)
0318 Q_DECLARE_METATYPE(Phonon::ErrorType)
0319 Q_DECLARE_METATYPE(Phonon::Category)
0320 Q_DECLARE_METATYPE(Phonon::CaptureCategory)
0321 
0322 
0323 
0324 // vim: sw=4 ts=4 tw=80
0325 #endif // PHONONNAMESPACE_H