47 * DummyPlayer |
45 * DummyPlayer |
48 * - Audio, in which case the implementation is AudioPlayer |
46 * - Audio, in which case the implementation is AudioPlayer |
49 * - Video, in which case the implementation is VideoPlayer |
47 * - Video, in which case the implementation is VideoPlayer |
50 */ |
48 */ |
51 class AbstractPlayer : public QObject |
49 class AbstractPlayer : public QObject |
52 , public VolumeObserver |
|
53 { |
50 { |
54 // Required although this class has no signals or slots |
51 // Required although this class has no signals or slots |
55 // Without this, qobject_cast will fail |
52 // Without this, qobject_cast will fail |
56 Q_OBJECT |
53 Q_OBJECT |
57 |
54 |
83 // client utility OpenFileL calls |
80 // client utility OpenFileL calls |
84 //virtual void setSource(const Phonon::MediaSource &) = 0; |
81 //virtual void setSource(const Phonon::MediaSource &) = 0; |
85 virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0; |
82 virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0; |
86 virtual void setNextSource(const Phonon::MediaSource &) = 0; |
83 virtual void setNextSource(const Phonon::MediaSource &) = 0; |
87 |
84 |
88 // VolumeObserver |
|
89 virtual void volumeChanged(qreal volume); |
85 virtual void volumeChanged(qreal volume); |
90 |
86 |
91 void setVideoOutput(VideoOutput* videoOutput); |
87 void setVideoOutput(VideoOutput* videoOutput); |
92 |
88 |
93 /** |
89 /** |
94 * Records error and changes state to ErrorState |
90 * Records error and changes state to ErrorState |
95 */ |
91 */ |
96 void setError(Phonon::ErrorType error); |
92 void setError(Phonon::ErrorType error, |
|
93 const QString &errorMessage = QString()); |
97 |
94 |
98 Phonon::State state() const; |
95 Phonon::State state() const; |
|
96 |
99 Q_SIGNALS: |
97 Q_SIGNALS: |
100 void totalTimeChanged(qint64 length); |
98 void totalTimeChanged(qint64 length); |
101 void finished(); |
99 void finished(); |
102 void tick(qint64 time); |
100 void tick(qint64 time); |
103 void stateChanged(Phonon::State oldState, |
101 void stateChanged(Phonon::State oldState, |
104 Phonon::State newState); |
102 Phonon::State newState); |
105 |
103 void metaDataChanged(const QMultiMap<QString, QString>& metaData); |
106 |
104 |
107 protected: |
105 protected: |
108 /** |
106 /** |
109 * Defined private state enumeration in order to add GroundState |
107 * Defined private state enumeration in order to add GroundState |
110 */ |
108 */ |
130 |
128 |
131 virtual void videoOutputChanged(); |
129 virtual void videoOutputChanged(); |
132 |
130 |
133 PrivateState privateState() const; |
131 PrivateState privateState() const; |
134 |
132 |
135 virtual void changeState(PrivateState newState) = 0; |
133 /** |
|
134 * Changes state and emits stateChanged() |
|
135 */ |
|
136 virtual void changeState(PrivateState newState); |
136 |
137 |
137 /** |
138 /** |
138 * Modifies m_state directly. Typically you want to call changeState(), |
139 * Modifies m_state directly. Typically you want to call changeState(), |
139 * which performs the business logic. |
140 * which performs the business logic. |
140 */ |
141 */ |
150 qreal m_volume; |
151 qreal m_volume; |
151 |
152 |
152 private: |
153 private: |
153 PrivateState m_state; |
154 PrivateState m_state; |
154 Phonon::ErrorType m_error; |
155 Phonon::ErrorType m_error; |
|
156 QString m_errorString; |
155 qint32 m_tickInterval; |
157 qint32 m_tickInterval; |
156 qint32 m_transitionTime; |
158 qint32 m_transitionTime; |
157 qint32 m_prefinishMark; |
159 qint32 m_prefinishMark; |
158 |
160 |
159 }; |
161 }; |