author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 20:15:53 +0300 | |
branch | RCL_3 |
changeset 13 | c0432d11811c |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef PHONON_DUMMY_MEDIAOBJECT_H |
|
43 |
#define PHONON_DUMMY_MEDIAOBJECT_H |
|
44 |
||
45 |
#include "backend.h" |
|
46 |
#include <phonon/mediaobjectinterface.h> |
|
47 |
#include <phonon/addoninterface.h> |
|
48 |
||
49 |
#include <QtCore/QHash> |
|
50 |
#include <QtCore/QString> |
|
51 |
#include <QtCore/QVariant> |
|
52 |
#include <QtCore/QObject> |
|
53 |
#include <QtCore/QDate> |
|
54 |
#include <QtCore/QEvent> |
|
55 |
#include <QtCore/QUrl> |
|
56 |
||
57 |
QT_BEGIN_NAMESPACE |
|
58 |
||
59 |
class QTimer; |
|
60 |
typedef QMultiMap<QString, QString> TagMap; |
|
61 |
||
62 |
namespace Phonon |
|
63 |
{ |
|
64 |
namespace Dummy |
|
65 |
{ |
|
66 |
||
67 |
class VideoWidget; |
|
68 |
class AudioPath; |
|
69 |
class VideoPath; |
|
70 |
class AudioOutput; |
|
71 |
||
72 |
class MediaObject : public QObject, public MediaObjectInterface |
|
73 |
{ |
|
74 |
friend class Stream; |
|
75 |
Q_OBJECT |
|
76 |
Q_INTERFACES(Phonon::MediaObjectInterface |
|
77 |
) |
|
78 |
||
79 |
public: |
|
80 |
||
81 |
MediaObject(Backend *backend, QObject *parent); |
|
82 |
~MediaObject(); |
|
83 |
Phonon::State state() const; |
|
84 |
||
85 |
bool hasVideo() const; |
|
86 |
bool isSeekable() const; |
|
87 |
||
88 |
qint64 currentTime() const; |
|
89 |
qint32 tickInterval() const; |
|
90 |
||
91 |
void setTickInterval(qint32 newTickInterval); |
|
92 |
||
93 |
void play(); |
|
94 |
void pause(); |
|
95 |
void stop(); |
|
96 |
void seek(qint64 time); |
|
97 |
||
98 |
QString errorString() const; |
|
99 |
Phonon::ErrorType errorType() const; |
|
100 |
||
101 |
QUrl url() const; |
|
102 |
qint64 totalTime() const; |
|
103 |
||
104 |
qint32 prefinishMark() const; |
|
105 |
void setPrefinishMark(qint32 newPrefinishMark); |
|
106 |
||
107 |
qint32 transitionTime() const; |
|
108 |
void setTransitionTime(qint32); |
|
109 |
qint64 remainingTime() const; |
|
110 |
||
111 |
void setSource(const MediaSource &source); |
|
112 |
void setNextSource(const MediaSource &source); |
|
113 |
MediaSource source() const; |
|
114 |
||
115 |
void saveState(); |
|
116 |
void resumeState(); |
|
117 |
||
118 |
public Q_SLOTS: |
|
119 |
void setState(State); |
|
120 |
||
121 |
Q_SIGNALS: |
|
122 |
void currentSourceChanged(const MediaSource &newSource); |
|
123 |
void stateChanged(Phonon::State newstate, Phonon::State oldstate); |
|
124 |
void tick(qint64 time); |
|
125 |
void metaDataChanged(QMultiMap<QString, QString>); |
|
126 |
void seekableChanged(bool); |
|
127 |
void hasVideoChanged(bool); |
|
128 |
||
129 |
void finished(); |
|
130 |
void prefinishMarkReached(qint32); |
|
131 |
void aboutToFinish(); |
|
132 |
void totalTimeChanged(qint64 length); |
|
133 |
void bufferStatus(int percentFilled); |
|
134 |
||
135 |
QMultiMap<QString, QString> metaData(); |
|
136 |
void setMetaData(QMultiMap<QString, QString> newData); |
|
137 |
||
138 |
private Q_SLOTS: |
|
139 |
void emitTick(); |
|
140 |
||
141 |
private: |
|
142 |
bool m_resumeState; |
|
143 |
State m_oldState; |
|
144 |
quint64 m_oldPos; |
|
145 |
quint64 currentPos; |
|
146 |
bool m_hasVideo; |
|
147 |
qint32 m_tickInterval; |
|
148 |
QTimer *m_tickTimer; |
|
149 |
Phonon::ErrorType m_error; |
|
150 |
QString m_errorString; |
|
151 |
qint64 m_totalTime; |
|
152 |
qint32 m_prefinishMark; |
|
153 |
qint32 m_transitionTime; |
|
154 |
MediaSource m_source; |
|
155 |
MediaSource m_nextSource; |
|
156 |
bool m_prefinishMarkReachedNotEmitted; |
|
157 |
bool m_aboutToFinishEmitted; |
|
158 |
int m_previousTickTime; |
|
159 |
||
160 |
State m_state; |
|
161 |
State m_pendingState; |
|
162 |
||
163 |
struct chunk |
|
164 |
{ |
|
165 |
char id[4]; |
|
166 |
quint32 size; |
|
167 |
}; |
|
168 |
||
169 |
struct RIFFHeader |
|
170 |
{ |
|
171 |
chunk descriptor; |
|
172 |
char type[4]; |
|
173 |
}; |
|
174 |
||
175 |
struct WAVEHeader |
|
176 |
{ |
|
177 |
chunk descriptor; |
|
178 |
quint16 audioFormat; // PCM = 1 |
|
179 |
quint16 numChannels; |
|
180 |
quint32 sampleRate; |
|
181 |
quint32 byteRate; |
|
182 |
quint16 blockAlign; |
|
183 |
quint16 bitsPerSample; |
|
184 |
quint32 xFreq1; |
|
185 |
chunk fact; |
|
186 |
quint32 xfact; |
|
187 |
chunk data; |
|
188 |
}; |
|
189 |
||
190 |
struct DATAHeader |
|
191 |
{ |
|
192 |
chunk descriptor; |
|
193 |
quint8 data[]; |
|
194 |
}; |
|
195 |
||
196 |
struct CombinedHeader |
|
197 |
{ |
|
198 |
RIFFHeader riff; |
|
199 |
WAVEHeader wave; |
|
200 |
DATAHeader data; |
|
201 |
}; |
|
202 |
||
203 |
CombinedHeader header; |
|
204 |
}; |
|
205 |
} |
|
206 |
} //namespace Phonon::Dummy |
|
207 |
||
208 |
QT_END_NAMESPACE |
|
209 |
||
210 |
#endif // PHONON_DUMMY_MEDIAOBJECT_H |