author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 08 Apr 2010 14:19:33 +0300 | |
branch | RCL_3 |
changeset 8 | 3f74d0d4af4c |
parent 4 | 3b1da2848fc7 |
child 37 | 758a864f9613 |
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_AUDIOPLAYER_H |
|
20 |
#define PHONON_MMF_AUDIOPLAYER_H |
|
21 |
||
22 |
#include "abstractmediaplayer.h" |
|
23 |
||
24 |
class CDrmPlayerUtility; |
|
25 |
class TTimeIntervalMicroSeconds; |
|
26 |
||
27 |
#ifdef QT_PHONON_MMF_AUDIO_DRM |
|
28 |
#include <drmaudiosampleplayer.h> |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
29 |
typedef MDrmAudioPlayerCallback NativePlayerObserver; |
0 | 30 |
#else |
31 |
#include <mdaaudiosampleplayer.h> |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
32 |
typedef MMdaAudioPlayerCallback NativePlayerObserver; |
0 | 33 |
#endif |
34 |
||
35 |
QT_BEGIN_NAMESPACE |
|
36 |
||
37 |
namespace Phonon |
|
38 |
{ |
|
39 |
namespace MMF |
|
40 |
{ |
|
41 |
/** |
|
42 |
* @short Wrapper over MMF audio client utility |
|
43 |
*/ |
|
44 |
class AudioPlayer : public AbstractMediaPlayer |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
45 |
, public NativePlayerObserver |
0 | 46 |
, public MAudioLoadingObserver |
47 |
{ |
|
48 |
Q_OBJECT |
|
49 |
||
50 |
public: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
51 |
AudioPlayer(MediaObject *parent = 0, const AbstractPlayer *player = 0); |
0 | 52 |
virtual ~AudioPlayer(); |
53 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
54 |
#ifdef QT_PHONON_MMF_AUDIO_DRM |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
55 |
typedef CDrmPlayerUtility NativePlayer; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
56 |
#else |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
57 |
typedef CMdaAudioPlayerUtility NativePlayer; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
58 |
#endif |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
59 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
60 |
NativePlayer *nativePlayer() const; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
61 |
|
0 | 62 |
// AbstractMediaPlayer |
63 |
virtual void doPlay(); |
|
64 |
virtual void doPause(); |
|
65 |
virtual void doStop(); |
|
66 |
virtual void doSeek(qint64 milliseconds); |
|
67 |
virtual int setDeviceVolume(int mmfVolume); |
|
68 |
virtual int openFile(RFile& file); |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
69 |
virtual int openUrl(const QString& url); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
70 |
virtual int bufferStatus() const; |
0 | 71 |
virtual void close(); |
72 |
||
73 |
// MediaObjectInterface |
|
74 |
virtual bool hasVideo() const; |
|
75 |
virtual qint64 currentTime() const; |
|
76 |
virtual qint64 totalTime() const; |
|
77 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
78 |
// AbstractMediaPlayer |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
79 |
virtual int numberOfMetaDataEntries() const; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
80 |
virtual QPair<QString, QString> metaDataEntry(int index) const; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
81 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
82 |
/** |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
83 |
* This class owns the pointer. |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
84 |
*/ |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
85 |
NativePlayer *player() const; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
86 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
87 |
private: |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
88 |
void construct(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
89 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
90 |
private: |
0 | 91 |
#ifdef QT_PHONON_MMF_AUDIO_DRM |
92 |
// MDrmAudioPlayerCallback |
|
93 |
virtual void MdapcInitComplete(TInt aError, |
|
94 |
const TTimeIntervalMicroSeconds &aDuration); |
|
95 |
virtual void MdapcPlayComplete(TInt aError); |
|
96 |
#else |
|
97 |
// MMdaAudioPlayerCallback |
|
98 |
virtual void MapcInitComplete(TInt aError, |
|
99 |
const TTimeIntervalMicroSeconds &aDuration); |
|
100 |
virtual void MapcPlayComplete(TInt aError); |
|
101 |
#endif |
|
102 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
103 |
// MAudioLoadingObserver |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
104 |
virtual void MaloLoadingStarted(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
105 |
virtual void MaloLoadingComplete(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
|
0 | 107 |
private: |
108 |
/** |
|
109 |
* Using CPlayerType typedef in order to be able to easily switch between |
|
110 |
* CMdaAudioPlayerUtility and CDrmPlayerUtility |
|
111 |
*/ |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
112 |
QScopedPointer<NativePlayer> m_player; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
113 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
114 |
qint64 m_totalTime; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
115 |
|
0 | 116 |
}; |
117 |
} |
|
118 |
} |
|
119 |
||
120 |
QT_END_NAMESPACE |
|
121 |
||
122 |
#endif |