42 { |
40 { |
43 /** |
41 /** |
44 * @short Wrapper over MMF audio client utility |
42 * @short Wrapper over MMF audio client utility |
45 */ |
43 */ |
46 class AudioPlayer : public AbstractMediaPlayer |
44 class AudioPlayer : public AbstractMediaPlayer |
47 , public MPlayerObserverType // typedef |
45 , public NativePlayerObserver |
48 #ifdef QT_PHONON_MMF_AUDIO_DRM |
|
49 , public MAudioLoadingObserver |
46 , public MAudioLoadingObserver |
50 #endif |
|
51 { |
47 { |
52 Q_OBJECT |
48 Q_OBJECT |
53 |
49 |
54 public: |
50 public: |
55 AudioPlayer(); |
51 AudioPlayer(MediaObject *parent = 0, const AbstractPlayer *player = 0); |
56 explicit AudioPlayer(const AbstractPlayer& player); |
|
57 virtual ~AudioPlayer(); |
52 virtual ~AudioPlayer(); |
|
53 |
|
54 #ifdef QT_PHONON_MMF_AUDIO_DRM |
|
55 typedef CDrmPlayerUtility NativePlayer; |
|
56 #else |
|
57 typedef CMdaAudioPlayerUtility NativePlayer; |
|
58 #endif |
|
59 |
|
60 NativePlayer *nativePlayer() const; |
58 |
61 |
59 // AbstractMediaPlayer |
62 // AbstractMediaPlayer |
60 virtual void doPlay(); |
63 virtual void doPlay(); |
61 virtual void doPause(); |
64 virtual void doPause(); |
62 virtual void doStop(); |
65 virtual void doStop(); |
63 virtual void doSeek(qint64 milliseconds); |
66 virtual void doSeek(qint64 milliseconds); |
64 virtual int setDeviceVolume(int mmfVolume); |
67 virtual int setDeviceVolume(int mmfVolume); |
65 virtual int openFile(RFile& file); |
68 virtual int openFile(RFile& file); |
|
69 virtual int openUrl(const QString& url); |
|
70 virtual int bufferStatus() const; |
66 virtual void close(); |
71 virtual void close(); |
67 |
72 |
68 // MediaObjectInterface |
73 // MediaObjectInterface |
69 virtual bool hasVideo() const; |
74 virtual bool hasVideo() const; |
70 virtual qint64 currentTime() const; |
75 virtual qint64 currentTime() const; |
71 virtual qint64 totalTime() const; |
76 virtual qint64 totalTime() const; |
72 |
77 |
|
78 // AbstractMediaPlayer |
|
79 virtual int numberOfMetaDataEntries() const; |
|
80 virtual QPair<QString, QString> metaDataEntry(int index) const; |
|
81 |
|
82 /** |
|
83 * This class owns the pointer. |
|
84 */ |
|
85 NativePlayer *player() const; |
|
86 |
|
87 private: |
|
88 void construct(); |
|
89 |
|
90 private: |
73 #ifdef QT_PHONON_MMF_AUDIO_DRM |
91 #ifdef QT_PHONON_MMF_AUDIO_DRM |
74 // MDrmAudioPlayerCallback |
92 // MDrmAudioPlayerCallback |
75 virtual void MdapcInitComplete(TInt aError, |
93 virtual void MdapcInitComplete(TInt aError, |
76 const TTimeIntervalMicroSeconds &aDuration); |
94 const TTimeIntervalMicroSeconds &aDuration); |
77 virtual void MdapcPlayComplete(TInt aError); |
95 virtual void MdapcPlayComplete(TInt aError); |
78 |
|
79 // MAudioLoadingObserver |
|
80 virtual void MaloLoadingStarted(); |
|
81 virtual void MaloLoadingComplete(); |
|
82 #else |
96 #else |
83 // MMdaAudioPlayerCallback |
97 // MMdaAudioPlayerCallback |
84 virtual void MapcInitComplete(TInt aError, |
98 virtual void MapcInitComplete(TInt aError, |
85 const TTimeIntervalMicroSeconds &aDuration); |
99 const TTimeIntervalMicroSeconds &aDuration); |
86 virtual void MapcPlayComplete(TInt aError); |
100 virtual void MapcPlayComplete(TInt aError); |
87 #endif |
101 #endif |
88 |
102 |
89 /** |
103 // MAudioLoadingObserver |
90 * This class owns the pointer. |
104 virtual void MaloLoadingStarted(); |
91 */ |
105 virtual void MaloLoadingComplete(); |
92 CPlayerType *player() const; |
|
93 |
|
94 private: |
|
95 void construct(); |
|
96 |
|
97 // AbstractMediaPlayer |
|
98 virtual int numberOfMetaDataEntries() const; |
|
99 virtual QPair<QString, QString> metaDataEntry(int index) const; |
|
100 |
106 |
101 private: |
107 private: |
102 /** |
108 /** |
103 * Using CPlayerType typedef in order to be able to easily switch between |
109 * Using CPlayerType typedef in order to be able to easily switch between |
104 * CMdaAudioPlayerUtility and CDrmPlayerUtility |
110 * CMdaAudioPlayerUtility and CDrmPlayerUtility |
105 */ |
111 */ |
106 QScopedPointer<CPlayerType> m_player; |
112 QScopedPointer<NativePlayer> m_player; |
|
113 |
|
114 qint64 m_totalTime; |
|
115 |
107 }; |
116 }; |
108 } |
117 } |
109 } |
118 } |
110 |
119 |
111 QT_END_NAMESPACE |
120 QT_END_NAMESPACE |