author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 3 | 41300fa6a67c |
child 13 | c0432d11811c |
permissions | -rw-r--r-- |
0 | 1 |
/* This file is part of the KDE project. |
2 |
||
3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
||
5 |
This library is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Lesser General Public License as published by |
|
7 |
the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
||
9 |
This library is distributed in the hope that it will be useful, |
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
GNU Lesser General Public License for more details. |
|
13 |
||
14 |
You should have received a copy of the GNU Lesser General Public License |
|
15 |
along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
||
17 |
*/ |
|
18 |
||
19 |
#ifndef PHONON_MMF_ABSTRACTMEDIAPLAYER_H |
|
20 |
#define PHONON_MMF_ABSTRACTMEDIAPLAYER_H |
|
21 |
||
22 |
#include <QTimer> |
|
23 |
#include <QScopedPointer> |
|
24 |
#include <e32std.h> |
|
25 |
#include "abstractplayer.h" |
|
26 |
||
27 |
class RFile; |
|
28 |
||
29 |
QT_BEGIN_NAMESPACE |
|
30 |
||
31 |
namespace Phonon |
|
32 |
{ |
|
33 |
namespace MMF |
|
34 |
{ |
|
35 |
class AudioOutput; |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
36 |
class MediaObject; |
0 | 37 |
|
38 |
/** |
|
39 |
* Interface via which MMF client APIs for both audio and video can be |
|
40 |
* accessed. |
|
41 |
*/ |
|
42 |
class AbstractMediaPlayer : public AbstractPlayer |
|
43 |
{ |
|
44 |
Q_OBJECT |
|
45 |
||
46 |
protected: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
47 |
AbstractMediaPlayer(MediaObject *parent, const AbstractPlayer *player); |
0 | 48 |
|
49 |
public: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
50 |
virtual void open(const Phonon::MediaSource&, RFile&); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
51 |
|
0 | 52 |
// MediaObjectInterface |
53 |
virtual void play(); |
|
54 |
virtual void pause(); |
|
55 |
virtual void stop(); |
|
56 |
virtual void seek(qint64 milliseconds); |
|
57 |
virtual bool isSeekable() const; |
|
58 |
virtual void volumeChanged(qreal volume); |
|
59 |
||
60 |
protected: |
|
61 |
// AbstractPlayer |
|
62 |
virtual void doSetTickInterval(qint32 interval); |
|
63 |
||
64 |
virtual void doPlay() = 0; |
|
65 |
virtual void doPause() = 0; |
|
66 |
virtual void doStop() = 0; |
|
67 |
virtual void doSeek(qint64 pos) = 0; |
|
68 |
virtual int setDeviceVolume(int mmfVolume) = 0; |
|
69 |
virtual int openFile(RFile& file) = 0; |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
70 |
virtual int openUrl(const QString& url) = 0; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
71 |
virtual int bufferStatus() const = 0; |
0 | 72 |
virtual void close() = 0; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
virtual void changeState(PrivateState newState); |
0 | 74 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
void updateMetaData(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
virtual int numberOfMetaDataEntries() const = 0; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
virtual QPair<QString, QString> metaDataEntry(int index) const = 0; |
0 | 78 |
|
79 |
protected: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
80 |
void bufferingStarted(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
81 |
void bufferingComplete(); |
0 | 82 |
void maxVolumeChanged(int maxVolume); |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
83 |
void playbackComplete(int error); |
0 | 84 |
|
85 |
static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); |
|
86 |
||
87 |
private: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
88 |
void startPositionTimer(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
89 |
void stopPositionTimer(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
90 |
void startBufferStatusTimer(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
91 |
void stopBufferStatusTimer(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
92 |
void stopTimers(); |
0 | 93 |
void doVolumeChanged(); |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
94 |
void emitMarksIfReached(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
95 |
void resetMarksIfRewound(); |
0 | 96 |
|
97 |
private Q_SLOTS: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
98 |
void positionTick(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
99 |
void bufferStatusTick(); |
0 | 100 |
|
101 |
private: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
102 |
MediaObject *const m_parent; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
103 |
|
0 | 104 |
/** |
105 |
* This flag is set to true if play is called when the object is |
|
106 |
* in a Loading state. Once loading is complete, playback will |
|
107 |
* be started. |
|
108 |
*/ |
|
109 |
bool m_playPending; |
|
110 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
111 |
QScopedPointer<QTimer> m_positionTimer; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
112 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
113 |
QScopedPointer<QTimer> m_bufferStatusTimer; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
114 |
PrivateState m_stateBeforeBuffering; |
0 | 115 |
|
116 |
int m_mmfMaxVolume; |
|
117 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
118 |
bool m_prefinishMarkSent; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
119 |
bool m_aboutToFinishSent; |
0 | 120 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
121 |
QMultiMap<QString, QString> m_metaData; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
|
0 | 123 |
}; |
124 |
} |
|
125 |
} |
|
126 |
||
127 |
QT_END_NAMESPACE |
|
128 |
||
129 |
#endif |
|
130 |