118 if (func == ERecord) |
118 if (func == ERecord) |
119 { |
119 { |
120 if (iRecordState == ERecorderNotReady) |
120 if (iRecordState == ERecorderNotReady) |
121 { |
121 { |
122 iFileFormat = format; |
122 iFileFormat = format; |
123 iAPIBeingUsed = DetermineAPIToUse(uri, EPlay); |
123 iAPIBeingUsed = DetermineAPIToUse(uri, ERecord); |
124 err = XA_RESULT_INTERNAL_ERROR; |
124 err = XA_RESULT_INTERNAL_ERROR; |
125 if (iAPIBeingUsed == EAudioRecorderUtility) |
125 if (iAPIBeingUsed == EAudioRecorderUtility) |
126 { |
126 { |
127 /* Initialize URI as needed by MMF utilities */ |
127 /* Initialize URI as needed by MMF utilities */ |
128 err = InitializeURIForMMFUtil(uri); |
128 err = InitializeURIForMMFUtil(uri); |
129 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
129 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
130 /* Initalize Recorder related objects */ |
130 /* Initalize Recorder related objects */ |
131 TRAP(err, InitAudioRecorderUtilityL()); |
131 TRAP(err, InitAudioRecorderUtilityL()); |
132 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
132 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
133 |
133 |
134 TRAP(err, iAudioRecorder->OpenFileL(iFileName)); |
134 TRAP(err, iAudioRecorder->OpenFileL(iUriPtr)); |
135 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
135 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
136 /* Wait until we receive moscostatechanged callback */ |
136 /* Wait until we receive moscostatechanged callback */ |
137 if(!iActiveSchedulerWait->IsStarted()) |
137 if(!iActiveSchedulerWait->IsStarted()) |
138 { |
138 { |
139 iActiveSchedulerWait->Start(); |
139 iActiveSchedulerWait->Start(); |
181 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
181 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
182 /* Initalize Player related objects */ |
182 /* Initalize Player related objects */ |
183 TRAP(err, InitVideoPlayerUtilityL()); |
183 TRAP(err, InitVideoPlayerUtilityL()); |
184 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
184 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
185 |
185 |
186 /* Open file */ |
186 if(iUriType == ELocal) |
187 TAG_TIME_PROFILING_BEGIN; |
187 { |
188 TRAP(err, iVideoPlayer->OpenFileL(iUriPtr)); |
188 /* Open file */ |
189 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
189 TAG_TIME_PROFILING_BEGIN; |
190 TAG_TIME_PROFILING_END; |
190 TRAP(err, iVideoPlayer->OpenFileL(iUriPtr)); |
191 PRINT_TO_CONSOLE_TIME_DIFF; |
191 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
192 |
192 TAG_TIME_PROFILING_END; |
|
193 PRINT_TO_CONSOLE_TIME_DIFF; |
|
194 } |
|
195 else |
|
196 { |
|
197 /* Open URL */ |
|
198 TAG_TIME_PROFILING_BEGIN; |
|
199 TRAP(err, iVideoPlayer->OpenUrlL(iUriPtr)); |
|
200 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
|
201 TAG_TIME_PROFILING_END; |
|
202 PRINT_TO_CONSOLE_TIME_DIFF; |
|
203 } |
193 /* Wait until we receive MvpuoOpenComplete */ |
204 /* Wait until we receive MvpuoOpenComplete */ |
194 PRINT_TO_CONSOLE_HOME_TIME; |
205 PRINT_TO_CONSOLE_HOME_TIME; |
195 if (!iActiveSchedulerWait->IsStarted()) |
206 if (!iActiveSchedulerWait->IsStarted()) |
196 { |
207 { |
197 iActiveSchedulerWait->Start(); |
208 iActiveSchedulerWait->Start(); |
240 for(unsigned int i=0; i < extLen; i++) |
255 for(unsigned int i=0; i < extLen; i++) |
241 { |
256 { |
242 ext[i] = tolower(ext[i]); |
257 ext[i] = tolower(ext[i]); |
243 } |
258 } |
244 |
259 |
|
260 colpos = strcspn(uri,":"); |
|
261 |
|
262 strncpy(urischeme, uri, colpos+1); |
|
263 /*Null terminate the string*/ |
|
264 urischeme[colpos+1] = '\0'; |
|
265 urischemeLen = sizeof(urischeme); |
|
266 for(unsigned int i=0; i < urischemeLen; i++) |
|
267 { |
|
268 urischeme[i] = tolower(urischeme[i]); |
|
269 } |
|
270 |
|
271 |
|
272 |
245 if (aFunc == ERecord) |
273 if (aFunc == ERecord) |
246 { |
274 { |
247 return EAudioRecorderUtility; |
275 return EAudioRecorderUtility; |
248 } |
276 } |
249 else |
277 else |
250 { |
278 { |
251 if (!strcasecmp(ext, ".mp3") || |
279 if(!strcasecmp(urischeme, "file:")) |
252 !strcasecmp(ext, ".amr") || |
280 { |
253 !strcasecmp(ext, ".aac") || |
281 if (!strcasecmp(ext, ".mp3") || |
254 !strcasecmp(ext, ".mid") || |
282 !strcasecmp(ext, ".amr") || |
255 !strcasecmp(ext, ".wav") || |
283 !strcasecmp(ext, ".aac") || |
256 !strcasecmp(ext, ".awb")) |
284 !strcasecmp(ext, ".mid") || |
257 { |
285 !strcasecmp(ext, ".wav") || |
258 return EAudioPlayerUtility; |
286 !strcasecmp(ext, ".awb")) |
259 } |
287 { |
260 else |
288 return EAudioPlayerUtility; |
|
289 } |
|
290 else |
|
291 { |
|
292 return EVideoPlayerUtility; |
|
293 } |
|
294 } |
|
295 else |
261 { |
296 { |
262 return EVideoPlayerUtility; |
297 return EVideoPlayerUtility; |
263 } |
298 } |
264 } |
299 } |
265 } |
300 } |
461 if (iErrorCode == KErrNone) |
496 if (iErrorCode == KErrNone) |
462 { |
497 { |
463 if (iPreviousRecordState == CMdaAudioClipUtility::ENotReady) |
498 if (iPreviousRecordState == CMdaAudioClipUtility::ENotReady) |
464 { |
499 { |
465 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 2")); |
500 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 2")); |
466 TRAP(err,iaudioInputRecord = CAudioInput::NewL( *iAudioRecorder )); |
501 TRAP(err,iAudioInputRecord = CAudioInput::NewL( *iAudioRecorder )); |
467 RArray<CAudioInput::TAudioInputPreference> inputArray; |
502 if(err == KErrNone) |
468 inputArray.Append( CAudioInput::EDefaultMic ); |
503 { |
469 // Set Audio Input |
504 RArray<CAudioInput::TAudioInputPreference> inputArray; |
470 iaudioInputRecord->SetAudioInputL( inputArray.Array( ) ); |
505 inputArray.Append( CAudioInput::EDefaultMic ); |
471 inputArray.Close(); |
506 // Set Audio Input |
|
507 TRAP(err, iAudioInputRecord->SetAudioInputL( inputArray.Array( ) )); |
|
508 inputArray.Close(); |
|
509 } |
472 TMMFMessageDestination destination(KUidMetaDataWriteCustomCommand); |
510 TMMFMessageDestination destination(KUidMetaDataWriteCustomCommand); |
473 TMMFMessageDestinationPckg pckg = TMMFMessageDestinationPckg(destination); |
511 TMMFMessageDestinationPckg pckg = TMMFMessageDestinationPckg(destination); |
474 TInt ret = iAudioRecorder->RecordControllerCustomCommandSync(pckg, 0, KNullDesC8, KNullDesC8); |
512 TInt ret = iAudioRecorder->RecordControllerCustomCommandSync(pckg, 0, KNullDesC8, KNullDesC8); |
475 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 3 [%d]"),ret); |
513 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 3 [%d]"),ret); |
476 if (ret != KErrNone && iFileFormat == XA_CONTAINERTYPE_MP4) |
514 if (ret != KErrNone && iFileFormat == XA_CONTAINERTYPE_MP4) |
598 delete iPlayItfPositionUpdateTimer; |
643 delete iPlayItfPositionUpdateTimer; |
599 iPlayItfPositionUpdateTimer = NULL; |
644 iPlayItfPositionUpdateTimer = NULL; |
600 delete iBaseVideoPlayer; |
645 delete iBaseVideoPlayer; |
601 iBaseVideoPlayer = NULL; |
646 iBaseVideoPlayer = NULL; |
602 iVideoPlayer = NULL; |
647 iVideoPlayer = NULL; |
603 delete iaudioInputRecord; |
|
604 iaudioInputRecord = NULL; |
|
605 delete iBaseAudioPlayer; |
648 delete iBaseAudioPlayer; |
606 iBaseAudioPlayer = NULL; |
649 iBaseAudioPlayer = NULL; |
607 iAudioPlayer = NULL; |
650 iAudioPlayer = NULL; |
608 delete iBaseAudioRecorder; |
651 delete iBaseAudioRecorder; |
609 iBaseAudioRecorder = NULL; |
652 iBaseAudioRecorder = NULL; |
789 TInt CMMFBackendEngine::SetDestinationSampleRate(XAmilliHertz* samplerate) |
832 TInt CMMFBackendEngine::SetDestinationSampleRate(XAmilliHertz* samplerate) |
790 { |
833 { |
791 TInt err(KErrNone); |
834 TInt err(KErrNone); |
792 if(iRecordState == CMMFBackendEngine::ERecorderOpen) |
835 if(iRecordState == CMMFBackendEngine::ERecorderOpen) |
793 { |
836 { |
794 TRAP(err, iAudioRecorder->SetDestinationSampleRateL(*samplerate)); |
837 TRAP(err, iAudioRecorder->SetDestinationSampleRateL(*samplerate/1000)); |
795 if(err != KErrNone) |
838 if(err != KErrNone) |
796 { |
839 { |
797 return XA_RESULT_PARAMETER_INVALID; |
840 return XA_RESULT_PARAMETER_INVALID; |
798 } |
841 } |
799 } |
842 } |
1440 if (err != KErrNone) |
1483 if (err != KErrNone) |
1441 return err; |
1484 return err; |
1442 |
1485 |
1443 iUriPtr.Set(iUri->Des()); |
1486 iUriPtr.Set(iUri->Des()); |
1444 iUriPtr.Copy(uriParam); /* Copy data*/ |
1487 iUriPtr.Copy(uriParam); /* Copy data*/ |
1445 iUriPtr.LowerCase(); |
1488 //iUriPtr.LowerCase(); |
1446 |
1489 |
1447 /* For file scheme convert from file:///c:/folder/file.ext |
1490 /* For file scheme convert from file:///c:/folder/file.ext |
1448 * format to c:\\folder\\file.ext using TUriParser. */ |
1491 * format to c:\\folder\\file.ext using TUriParser. */ |
1449 _LIT(KFileScheme,"file:///"); |
1492 _LIT(KFileScheme,"file:///"); |
1450 if (iUriPtr.Find(KFileScheme) >= 0) |
1493 if (iUriPtr.Find(KFileScheme) >= 0) |
1451 { |
1494 { |
|
1495 iUriType = ELocal; |
1452 TPtr tmp(const_cast<TUint16 *>(iUriPtr.Ptr()) + KFileScheme().Length(), |
1496 TPtr tmp(const_cast<TUint16 *>(iUriPtr.Ptr()) + KFileScheme().Length(), |
1453 iUriPtr.Length(), |
1497 iUriPtr.Length(), |
1454 iUriPtr.Length()); |
1498 iUriPtr.Length()); |
1455 /* Convert from c:/folder/file.ext format to |
1499 /* Convert from c:/folder/file.ext format to |
1456 * c:\\folder\\file.ext using TUriParser. |
1500 * c:\\folder\\file.ext using TUriParser. |