58 virtual void volumeChanged(qreal volume); |
58 virtual void volumeChanged(qreal volume); |
59 |
59 |
60 protected: |
60 protected: |
61 // AbstractPlayer |
61 // AbstractPlayer |
62 virtual void doSetTickInterval(qint32 interval); |
62 virtual void doSetTickInterval(qint32 interval); |
|
63 virtual Phonon::State phononState(PrivateState state) const; |
|
64 virtual void changeState(PrivateState newState); |
63 |
65 |
64 virtual void doPlay() = 0; |
66 virtual void doPlay() = 0; |
65 virtual void doPause() = 0; |
67 virtual void doPause() = 0; |
66 virtual void doStop() = 0; |
68 virtual void doStop() = 0; |
67 virtual void doSeek(qint64 pos) = 0; |
69 virtual void doSeek(qint64 pos) = 0; |
68 virtual int setDeviceVolume(int mmfVolume) = 0; |
70 virtual int setDeviceVolume(int mmfVolume) = 0; |
69 virtual int openFile(RFile& file) = 0; |
71 virtual int openFile(RFile& file) = 0; |
70 virtual int openUrl(const QString& url) = 0; |
72 virtual int openUrl(const QString& url) = 0; |
71 virtual int bufferStatus() const = 0; |
73 virtual int bufferStatus() const = 0; |
72 virtual void close() = 0; |
74 virtual void close() = 0; |
73 virtual void changeState(PrivateState newState); |
|
74 |
75 |
75 void updateMetaData(); |
76 void updateMetaData(); |
76 virtual int numberOfMetaDataEntries() const = 0; |
77 virtual int numberOfMetaDataEntries() const = 0; |
77 virtual QPair<QString, QString> metaDataEntry(int index) const = 0; |
78 virtual QPair<QString, QString> metaDataEntry(int index) const = 0; |
78 |
79 |
79 protected: |
80 protected: |
80 void bufferingStarted(); |
81 void bufferingStarted(); |
81 void bufferingComplete(); |
82 void bufferingComplete(); |
82 void maxVolumeChanged(int maxVolume); |
83 void maxVolumeChanged(int maxVolume); |
|
84 void loadingComplete(int error); |
83 void playbackComplete(int error); |
85 void playbackComplete(int error); |
84 |
86 |
85 static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); |
87 static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); |
86 |
88 |
87 private: |
89 private: |
89 void stopPositionTimer(); |
91 void stopPositionTimer(); |
90 void startBufferStatusTimer(); |
92 void startBufferStatusTimer(); |
91 void stopBufferStatusTimer(); |
93 void stopBufferStatusTimer(); |
92 void stopTimers(); |
94 void stopTimers(); |
93 void doVolumeChanged(); |
95 void doVolumeChanged(); |
94 void emitMarksIfReached(); |
96 void emitMarksIfReached(qint64 position); |
95 void resetMarksIfRewound(); |
97 void resetMarksIfRewound(); |
|
98 void startPlayback(); |
|
99 |
|
100 enum Pending { |
|
101 NothingPending, |
|
102 PausePending, |
|
103 PlayPending |
|
104 }; |
|
105 |
|
106 void setPending(Pending pending); |
96 |
107 |
97 private Q_SLOTS: |
108 private Q_SLOTS: |
98 void positionTick(); |
109 void positionTick(); |
99 void bufferStatusTick(); |
110 void bufferStatusTick(); |
100 |
111 |
101 private: |
112 private: |
102 MediaObject *const m_parent; |
113 MediaObject *const m_parent; |
103 |
114 |
104 /** |
115 Pending m_pending; |
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 |
116 |
111 QScopedPointer<QTimer> m_positionTimer; |
117 QScopedPointer<QTimer> m_positionTimer; |
112 |
118 |
113 QScopedPointer<QTimer> m_bufferStatusTimer; |
119 QScopedPointer<QTimer> m_bufferStatusTimer; |
114 PrivateState m_stateBeforeBuffering; |
120 PrivateState m_stateBeforeBuffering; |