44 |
44 |
45 public: |
45 public: |
46 explicit IRPlayController(IRApplication* aApplication); |
46 explicit IRPlayController(IRApplication* aApplication); |
47 ~IRPlayController(); |
47 ~IRPlayController(); |
48 |
48 |
|
49 #ifdef HS_WIDGET_ENABLED |
|
50 // MUST be called before prepare the network for playback |
|
51 // i.e., called before IRApplication::verifyNetworkConnectivity |
|
52 void setConnectingStationName(const QString &aStationName, bool aForceConnecting = false); |
|
53 QString getConnectingStationName() const; |
|
54 |
|
55 // used when nowplaying view is the starting view, to reload preset to the player |
|
56 // because by default, the player will load the last played station preset into it |
|
57 // But when nowplaying view as starting view due to open pls with only one url, |
|
58 // should reload the preset from pls file |
|
59 void reloadNowplayingPreset(IRQPreset *aPreset, bool aIsLogoAvailable, IRQConnectedFrom aConnectedFrom); |
|
60 #endif |
49 // Play a station |
61 // Play a station |
50 void connectToChannel(IRQPreset *aPreset, IRQConnectedFrom aConnectedFrom); |
62 void connectToChannel(IRQPreset *aPreset, IRQConnectedFrom aConnectedFrom); |
51 |
63 |
|
64 void emitStationLogoUpdated(bool aIsLogoAvailable); |
|
65 bool isStationLogoAvailable() const; |
|
66 |
52 // Play control methods |
67 // Play control methods |
53 void resume(); |
68 void resume(); |
54 void stop(IRQTerminatedType aStopReason); |
69 void stop(IRQTerminatedType aStopReason); |
55 int getVolume() const; |
70 int getVolume() const; |
56 void setVolume(int aVolume); |
71 void setVolume(int aVolume); |
57 |
72 |
|
73 enum EPlayState |
|
74 { |
|
75 //initial state, never ever played station |
|
76 EIdle = 0, |
|
77 //a station has been stopped |
|
78 EStopped, |
|
79 #ifdef HS_WIDGET_ENABLED |
|
80 //connecting network |
|
81 EConnecting, |
|
82 #endif |
|
83 //stream buffering |
|
84 EBuffering, |
|
85 //playing |
|
86 EPlaying |
|
87 }; |
|
88 EPlayState state() const; |
|
89 |
58 // Check the playing status |
90 // Check the playing status |
59 bool isPlaying() const; |
91 bool isPlaying() const; |
60 |
92 |
61 // Check the stopped status |
93 // Check the stopped status |
62 bool isStopped() const; |
94 bool isStopped() const; |
87 void playingStarted(); |
119 void playingStarted(); |
88 |
120 |
89 // emitted when playing stopped |
121 // emitted when playing stopped |
90 void playingStopped(); |
122 void playingStopped(); |
91 |
123 |
92 // emitted when logo needs to update |
124 #ifdef HS_WIDGET_ENABLED |
93 void initializeLogo(); |
125 // emitted when loading(connecting) started |
|
126 void connectingStarted(const QString &aStationName); |
|
127 |
|
128 // emitted when buffering started |
|
129 void bufferingStarted(const QString &aStationName); |
|
130 |
|
131 // emitted when connecting is cancelled |
|
132 void connectingCancelled(const QString &aStationName); |
|
133 |
|
134 // emitted when buffering is cancelled |
|
135 void bufferingCancelled(const QString &aStationName); |
|
136 |
|
137 void stationLogoUpdated(bool aIsDefaultLogo); |
|
138 #endif |
94 |
139 |
95 private slots: |
140 private slots: |
96 // slots connected with IRQMediaPlayer |
141 // slots connected with IRQMediaPlayer |
97 void connectionEstablished(int aBitrate); |
142 void connectionEstablished(int aBitrate); |
98 void errorOccured(IRQError aError); |
143 void errorOccured(IRQError aError); |
102 |
147 |
103 // slots connected with own functions |
148 // slots connected with own functions |
104 void handleError(); |
149 void handleError(); |
105 |
150 |
106 private: |
151 private: |
107 void createNote(const QString &aNote = hbTrId("txt_irad_info_failed_to_connect")); |
152 #ifdef SUBTITLE_STR_BY_LOCID |
|
153 void popupNote(const QString &aNote = hbTrId("txt_irad_info_failed_to_connect")); |
|
154 #else |
|
155 void popupNote(const QString &aNote = hbTrId("Connecting failed")); |
|
156 #endif |
108 void connectSignalSlot(); |
157 void connectSignalSlot(); |
|
158 |
|
159 QString getFirstTryUrl(IRQPreset *aPreset); |
109 |
160 |
110 // Play next URL if the previous failed to connect. |
161 // Play next URL if the previous failed to connect. |
111 bool playNextUrl(); |
162 bool playNextUrl(); |
112 |
163 |
113 void doPlay(const QString& aUrl); |
164 void doPlay(const QString& aUrl); |
118 private: |
169 private: |
119 IRApplication *iApplication; |
170 IRApplication *iApplication; |
120 IRQMediaPlayer *iMediaPlayer; |
171 IRQMediaPlayer *iMediaPlayer; |
121 |
172 |
122 IRQStatisticsReporter *iStatisticsReporter; |
173 IRQStatisticsReporter *iStatisticsReporter; |
|
174 bool iGetServerResult; |
|
175 |
|
176 #ifdef HS_WIDGET_ENABLED |
|
177 QString iConnectingStationName; // used for home screen widget |
|
178 #endif |
|
179 |
|
180 IRQPreset *iNowPlayingPreset; |
|
181 IRQPreset *iNowPlayingPresetBackup; |
|
182 |
|
183 QString iLastPlayedUrl; |
|
184 QString iLastPlayedUrlBackup; |
|
185 |
123 IRQConnectedFrom iConnectedFrom; |
186 IRQConnectedFrom iConnectedFrom; |
124 bool iGetServerResult; |
187 IRQConnectedFrom iConnectedFromBackup; |
125 |
188 |
126 IRQPreset *iNowPlayingPreset; |
189 bool iStationLogoAvailable; |
127 //reserve the info in nowplay view |
190 bool iStationLogoAvailableBackup; |
128 IRQPreset *iNowPlayingPresetBackup; |
191 |
129 // reference of IRQMediaPlayer meta data |
192 // reference of IRQMediaPlayer meta data |
130 IRQMetaData *iMetaData; |
193 IRQMetaData *iMetaData; |
131 IRQSongHistoryEngine *iSongHistoryEngine; |
194 IRQSongHistoryEngine *iSongHistoryEngine; |
132 |
195 |
133 enum EPlayState |
|
134 { |
|
135 //initial state |
|
136 EIdle = 0, |
|
137 //a station has been stopped |
|
138 EStopped, |
|
139 //connecting station and buffering |
|
140 EBuffering, |
|
141 //playing |
|
142 EPlaying |
|
143 }; |
|
144 |
|
145 EPlayState iPlayState; |
196 EPlayState iPlayState; |
146 // If resuming the last played url fails, connect to all the preset. |
197 |
|
198 // If resuming the last played url fails, reset the player to init state |
|
199 // i.e., call connectToChannel() once again. |
147 bool iResuming; |
200 bool iResuming; |
148 |
201 |
149 // variants for play next URL |
202 // variants for play next URL |
150 // available bitrates in the preset |
203 // available bitrates in the preset |
151 QList<int> iAvailableBitrate; |
204 QList<int> iAvailableBitrate; |
154 int iTryingBitrate; |
207 int iTryingBitrate; |
155 |
208 |
156 // the URLs of a specific bitrate |
209 // the URLs of a specific bitrate |
157 QList<QString> *iUrlArray; |
210 QList<QString> *iUrlArray; |
158 |
211 |
159 #ifdef Q_CC_NOKIAX86 |
|
160 QString iLastPlayedChannelName; |
|
161 #endif |
|
162 |
|
163 // the bitrate from real station feedback. |
212 // the bitrate from real station feedback. |
164 int iRealBitrate; |
213 int iRealBitrate; |
165 QString iLastPlayedUrl; |
214 |
166 //reserve the info in nowplay view |
|
167 QString iLastPlayedUrlBackup; |
|
168 // To handle error async |
215 // To handle error async |
169 IRQError iLastError; |
216 IRQError iLastError; |
170 |
217 |
171 IRQTerminatedType iStopReason; |
218 IRQTerminatedType iStopReason; |
|
219 |
|
220 HbMessageBox *iErrorNote; |
172 }; |
221 }; |
173 |
222 |
174 #endif //IRPLAYCONTROLLER_H |
223 #endif //IRPLAYCONTROLLER_H |