1 | /* This file is part of the KDE project |
2 | Copyright (C) 2006-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 MEDIAOBJECT_P_H |
24 | #define MEDIAOBJECT_P_H |
25 | |
26 | #include <QString> |
27 | #include <QQueue> |
28 | |
29 | #include "medianode_p.h" |
30 | #include "medianodedestructionhandler_p.h" |
31 | #include "mediaobject.h" |
32 | #include "mediasource.h" |
33 | #include "phonondefs_p.h" |
34 | |
35 | namespace Phonon |
36 | { |
37 | class FrontendInterfacePrivate; |
38 | class StatesValidator; |
39 | |
40 | class MediaObjectPrivate : public MediaNodePrivate, private MediaNodeDestructionHandler |
41 | { |
42 | friend class KioFallbackImpl; |
43 | friend class AbstractMediaStream; |
44 | friend class AbstractMediaStreamPrivate; |
45 | P_DECLARE_PUBLIC(MediaObject) |
46 | public: |
47 | QObject *qObject() override { return q_func(); } |
48 | |
49 | QList<FrontendInterfacePrivate *> interfaceList; |
50 | protected: |
51 | bool aboutToDeleteBackendObject() override; |
52 | void createBackendObject() override; |
53 | void phononObjectDestroyed(MediaNodePrivate *) override; |
54 | PHONON_EXPORT void setupBackendObject(); |
55 | |
56 | void _k_resumePlay(); |
57 | void _k_resumePause(); |
58 | void _k_metaDataChanged(const QMultiMap<QString, QString> &); |
59 | void _k_aboutToFinish(); |
60 | void _k_currentSourceChanged(const MediaSource &); |
61 | PHONON_EXPORT void _k_stateChanged(Phonon::State, Phonon::State); |
62 | #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM |
63 | void streamError(Phonon::ErrorType, const QString &); |
64 | #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM |
65 | |
66 | MediaObjectPrivate() |
67 | : currentTime(0), |
68 | tickInterval(0), |
69 | metaData(), |
70 | errorString(), |
71 | prefinishMark(0), |
72 | transitionTime(0), // gapless playback |
73 | #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM |
74 | abstractStream(nullptr), |
75 | #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM |
76 | state(Phonon::LoadingState), |
77 | playingQueuedSource(false) |
78 | #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM |
79 | , errorType(Phonon::NormalError), |
80 | errorOverride(false), |
81 | ignoreLoadingToBufferingStateChange(false), |
82 | ignoreErrorToLoadingStateChange(false), |
83 | validateStates(!(qgetenv(varName: "PHONON_ASSERT_STATES" ).isEmpty())), |
84 | validator(nullptr) |
85 | #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM |
86 | { |
87 | } |
88 | |
89 | ~MediaObjectPrivate() override |
90 | { |
91 | } |
92 | |
93 | qint64 currentTime; |
94 | qint32 tickInterval; |
95 | QMultiMap<QString, QString> metaData; |
96 | QString errorString; |
97 | qint32 prefinishMark; |
98 | qint32 transitionTime; |
99 | #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM |
100 | AbstractMediaStream *abstractStream; |
101 | #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM |
102 | State state |
103 | #ifdef QT_NO_PHONON_ABSTRACTMEDIASTREAM |
104 | ; |
105 | #else |
106 | : 8; |
107 | bool playingQueuedSource; |
108 | ErrorType errorType : 4; |
109 | bool errorOverride : 1; |
110 | bool ignoreLoadingToBufferingStateChange : 1; |
111 | bool ignoreErrorToLoadingStateChange : 1; |
112 | #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM |
113 | MediaSource mediaSource; |
114 | QQueue<MediaSource> sourceQueue; |
115 | bool validateStates; |
116 | StatesValidator *validator; |
117 | }; |
118 | } |
119 | |
120 | #endif // MEDIAOBJECT_P_H |
121 | // vim: sw=4 ts=4 tw=80 |
122 | |