equal
deleted
inserted
replaced
101 } |
101 } |
102 |
102 |
103 |
103 |
104 EXPORT_C void CMMAAudioPlayer::PrefetchDataL(const TDesC8& aData) |
104 EXPORT_C void CMMAAudioPlayer::PrefetchDataL(const TDesC8& aData) |
105 { |
105 { |
106 LOG1( EJavaMMAPI, EInfo, "MMA::CMMAAudioPlayer::PrefetchDataL aData size %d", |
106 LOG1(EJavaMMAPI, EInfo, "MMA::CMMAAudioPlayer::PrefetchDataL aData size %d", |
107 aData.Size()); |
107 aData.Size()); |
108 |
108 |
109 // player priority settings |
109 // player priority settings |
110 TMMFPrioritySettings prioritySettings; |
110 TMMFPrioritySettings prioritySettings; |
111 prioritySettings.iPriority = KPlayerPriority; |
111 prioritySettings.iPriority = KPlayerPriority; |
112 prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; |
112 prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; |
125 User::LeaveIfError(iController.Prime()); |
125 User::LeaveIfError(iController.Prime()); |
126 } |
126 } |
127 |
127 |
128 EXPORT_C void CMMAAudioPlayer::PrefetchFileL() |
128 EXPORT_C void CMMAAudioPlayer::PrefetchFileL() |
129 { |
129 { |
130 LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioPlayer::Prefetching from file"); |
130 LOG(EJavaMMAPI, EInfo, "MMA::CMMAAudioPlayer::Prefetching from file"); |
131 |
131 |
132 // player priority settings |
132 // player priority settings |
133 TMMFPrioritySettings prioritySettings; |
133 TMMFPrioritySettings prioritySettings; |
134 prioritySettings.iPriority = KPlayerPriority; |
134 prioritySettings.iPriority = KPlayerPriority; |
135 prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; |
135 prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; |
147 User::LeaveIfError(iController.Prime()); |
147 User::LeaveIfError(iController.Prime()); |
148 } |
148 } |
149 |
149 |
150 EXPORT_C void CMMAAudioPlayer::PlayCompleteL(TInt aError) |
150 EXPORT_C void CMMAAudioPlayer::PlayCompleteL(TInt aError) |
151 { |
151 { |
152 LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::PlayCompleteL +"); |
152 LOG(EJavaMMAPI, EInfo, "CMMAAudioPlayer::PlayCompleteL +"); |
153 TInt64 time; |
153 TInt64 time; |
154 GetDuration(&time); |
154 GetDuration(&time); |
155 iMediaTime = time; |
155 iMediaTime = time; |
156 iStartedEventTime = 0; |
156 iStartedEventTime = 0; |
157 |
157 |
183 { |
183 { |
184 // error has occured, setting correct number of |
184 // error has occured, setting correct number of |
185 // repeats for next start |
185 // repeats for next start |
186 SetLoopCount(iRepeatNumberOfTimes); |
186 SetLoopCount(iRepeatNumberOfTimes); |
187 } |
187 } |
188 LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::PlayCompleteL -"); |
188 LOG(EJavaMMAPI, EInfo, "CMMAAudioPlayer::PlayCompleteL -"); |
189 } |
189 } |
190 |
190 |
191 void CMMAAudioPlayer::RealizeL() |
191 void CMMAAudioPlayer::RealizeL() |
192 { |
192 { |
193 LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::RealizeL"); |
193 LOG(EJavaMMAPI, EInfo, "CMMAAudioPlayer::RealizeL"); |
194 // DataSource must have at least 1 stream or |
194 // DataSource must have at least 1 stream or |
195 // we must have file to play |
195 // we must have file to play |
196 if ((iSourceStreams.Count() == 0) && !iFileName) |
196 if ((iSourceStreams.Count() == 0) && !iFileName) |
197 { |
197 { |
198 User::Leave(KErrNotEnoughStreams); |
198 User::Leave(KErrNotEnoughStreams); |
201 } |
201 } |
202 |
202 |
203 |
203 |
204 void CMMAAudioPlayer::PrefetchL() |
204 void CMMAAudioPlayer::PrefetchL() |
205 { |
205 { |
206 LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::PrefetchL"); |
206 LOG(EJavaMMAPI, EInfo, "CMMAAudioPlayer::PrefetchL"); |
207 __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant()); |
207 __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant()); |
208 |
208 |
209 if (iFileName) |
209 if (iFileName) |
210 { |
210 { |
211 // prefetching the file |
211 // prefetching the file |
232 // CMMASourceStreamReader finished read operation |
232 // CMMASourceStreamReader finished read operation |
233 // This is called when ReadL is completed in Prefetch() |
233 // This is called when ReadL is completed in Prefetch() |
234 // |
234 // |
235 void CMMAAudioPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData) |
235 void CMMAAudioPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData) |
236 { |
236 { |
237 LOG1( EJavaMMAPI, EInfo, "CMMAAudioPlayer::ReadCompletedL: status = %d", aStatus); |
237 LOG1(EJavaMMAPI, EInfo, "CMMAAudioPlayer::ReadCompletedL: status = %d", aStatus); |
238 if (aStatus < KErrNone) |
238 if (aStatus < KErrNone) |
239 { |
239 { |
240 PostActionCompleted(aStatus); |
240 PostActionCompleted(aStatus); |
241 } |
241 } |
242 else |
242 else |
251 } |
251 } |
252 |
252 |
253 |
253 |
254 void CMMAAudioPlayer::HandleEvent(const TMMFEvent& aEvent) |
254 void CMMAAudioPlayer::HandleEvent(const TMMFEvent& aEvent) |
255 { |
255 { |
256 LOG( EJavaMMAPI, EInfo, "MID::CMMAAudioPlayer::HandleEvent"); |
256 LOG(EJavaMMAPI, EInfo, "MID::CMMAAudioPlayer::HandleEvent"); |
257 TInt err = aEvent.iErrorCode; |
257 TInt err = aEvent.iErrorCode; |
258 if (iState == EStarted) |
258 if (iState == EStarted) |
259 { |
259 { |
260 // normal situation; will loop in PlayCompleteL if looping is set |
260 // normal situation; will loop in PlayCompleteL if looping is set |
261 if ((err == KErrEof || err == KErrUnderflow || err == KErrNone) |
261 if ((err == KErrEof || err == KErrUnderflow || err == KErrNone) |
276 if (iState == EStarted) |
276 if (iState == EStarted) |
277 { |
277 { |
278 TInt64 time; |
278 TInt64 time; |
279 GetMediaTime(&time); |
279 GetMediaTime(&time); |
280 iStartedEventTime = time; |
280 iStartedEventTime = time; |
281 LOG( EJavaMMAPI, EInfo, "MID::CMMAAudioPlayer::Going to ChangeState( EPrefetched );"); |
281 LOG(EJavaMMAPI, EInfo, "MID::CMMAAudioPlayer::Going to ChangeState( EPrefetched );"); |
282 |
282 |
283 PostLongEvent(CMMAPlayerEvent::EStopped, time); |
283 PostLongEvent(CMMAPlayerEvent::EStopped, time); |
284 ChangeState(EPrefetched); |
284 ChangeState(EPrefetched); |
285 } |
285 } |
286 } |
286 } |
296 PlayCompleteL(KErrNone); |
296 PlayCompleteL(KErrNone); |
297 } |
297 } |
298 |
298 |
299 EXPORT_C void CMMAAudioPlayer::ErrorPlaybackComplete(TInt aError) |
299 EXPORT_C void CMMAAudioPlayer::ErrorPlaybackComplete(TInt aError) |
300 { |
300 { |
301 ELOG1( EJavaMMAPI, "MID::CMMAAudioPlayer::ErrorPlaybackComplete: aError = %d", aError); |
301 ELOG1(EJavaMMAPI, "MID::CMMAAudioPlayer::ErrorPlaybackComplete: aError = %d", aError); |
302 TBuf<KErrorMessageSize> errorMessage; |
302 TBuf<KErrorMessageSize> errorMessage; |
303 errorMessage.Format(KErrDefaultError, aError); |
303 errorMessage.Format(KErrDefaultError, aError); |
304 PostStringEvent(CMMAPlayerEvent::EError, errorMessage); |
304 PostStringEvent(CMMAPlayerEvent::EError, errorMessage); |
305 |
305 |
306 // Preparing controller for next try |
306 // Preparing controller for next try |