Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This program is designed the test of the MMF_ACLNT.
19 @file TestConverter.cpp
22 #include "TestConverter.h"
23 #include "mmfwavformat.h"
24 #include <mmfformatimplementationuids.hrh>
25 #include <mdaaudiosampleplayer.h>
26 #include "WavDecodeUtility.h"
28 // from "mmfauformat.h" :
29 const TUint KAuFileUncompressedDataHeaderSize = 24 ; // 6 times 4 byte quantities
31 _LIT(KAclntConConfigKeyName, "configAudio");
32 _LIT(KAclntConDurationKeyName, "configAudio2");
33 _LIT(KAclntConPositionKeyName, "configAudio3");
34 _LIT(KAclntConQueryKeyName, "configAudio4");
35 _LIT(KAclntConDestBitRateKeyName, "configAudio5");
36 _LIT(KAclntConDestSampleRateKeyName, "configAudio6");
37 _LIT(KAclntConDestNumberChannelsKeyName, "configAudio7");
38 _LIT(KAclntConDestDataTypeKeyName, "configAudio8");
39 _LIT(KAclntConDestFormatKeyName, "configAudio9");
40 _LIT(KAclntConSourceInfoKeyName, "configAudio10");
46 CTestMmfAclntDoConv::CTestMmfAclntDoConv(const TDesC& aTestName, const TDesC& aSectName,
47 const TDesC& aKeyName,
48 const TDesC& aSectName2, const TDesC& aKeyName2,
52 // store the name of this test case
53 // this is the name that is used by the script file
54 // Each test step initialises it's own name
55 iTestStepName = aTestName;
56 iSectName = aSectName;
58 iSectName2 = aSectName2;
59 iKeyName2 = aKeyName2;
64 CTestMmfAclntDoConv* CTestMmfAclntDoConv::NewL(const TDesC& aTestName, const TDesC& aSectName,
65 const TDesC& aKeyName, const TDesC& aSectName2,
66 const TDesC& aKeyName2,
70 CTestMmfAclntDoConv* self = new (ELeave) CTestMmfAclntDoConv(aTestName, aSectName, aKeyName, aSectName2, aKeyName2, aBits, aFormat);
74 void CTestMmfAclntDoConv::MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
78 iPreviousState = aPreviousState;
79 iCurrentState = aCurrentState;
80 INFO_PRINTF1( _L("CTestMmfAclntDoConv : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
81 INFO_PRINTF4( _L("iError %d iPreviousState %d iCurrentState %d"), iError, iPreviousState, iCurrentState);
82 CActiveScheduler::Stop();
85 TVerdict CTestMmfAclntDoConv::DoTestStepL()
87 INFO_PRINTF1( _L("TestConverter : Do Convert"));
91 TBuf<KSizeBuf> filename1;
92 TPtrC filename11, filename2;
93 if ((!GetStringFromConfig(iSectName, iKeyName, filename11)) ||
94 (!GetStringFromConfig( iSectName2, iKeyName2, filename2)))
97 GetDriveName(filename1);
98 filename1.Append(filename11);
101 //delete previos output file
103 User::LeaveIfError(theFs.Connect());
104 theFs.Delete(filename2);
105 theFs.MkDirAll(filename2);
110 TMdaUL16RawAudioCodec theCodecUnsupported;
112 TMdaPcmWavCodec theCodecWav8Bit(TMdaPcmWavCodec::E8BitPcm);
113 TMdaPcmWavCodec theCodecWav16Bit(TMdaPcmWavCodec::E16BitPcm);
115 TMdaPackage* theCodec = NULL;
118 case 0: theCodec = &theCodecWav8Bit; break;
119 case 1: theCodec = &theCodecWav16Bit; break;
120 case -1: theCodec = &theCodecUnsupported; break;
125 return EInconclusive;
127 iError = KErrTimedOut;
129 CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
130 CleanupStack::PushL(converter);
132 TMdaFileClipLocation theLocation(filename2);
133 TMdaWavClipFormat theMdaFormat;
134 TMmfAclntWavEncodeClipFormat theMmfFormat;
135 TMdaClipFormat* useFormat;
137 if(iFormat == MdaFormatSpec)
138 useFormat = &theMdaFormat;
140 useFormat = &theMmfFormat;
142 converter->OpenL(filename1,
143 &theLocation, // Normally file or descriptor
147 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
148 CActiveScheduler::Start();
150 if(iError == KErrNone)
151 ret = DoTestL(converter);
152 else if(iError != KErrNone && iBits == -1)
155 if (iError != KErrNone)
156 ERR_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
157 CleanupStack::PopAndDestroy(converter);
158 User::After(KOneSecond);
162 TVerdict CTestMmfAclntDoConv::DoTestL(CMdaAudioConvertUtility* aConverter)
164 TVerdict ret = EFail;
166 iError = KErrTimedOut;
168 // Convert 44100 -> 8000 sample rate
169 const TUint KAclntDestSampleRate = 8000;
170 aConverter->SetDestinationSampleRateL(KAclntDestSampleRate);
173 aConverter->SetDestinationFormatL(TUid::Uid(KMmfUidFormatAUWrite));
175 aConverter->ConvertL();
177 INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
178 CActiveScheduler::Start();
180 // XXX Improve test. e.g. check that a valid AU file is written
181 if(iError == KErrNone)
187 INFO_PRINTF2(_L("Error returned in MoscoStateChangeEvent callback: %d"), iError);
193 CActiveScheduler::Start();
195 // XXX Improve test. e.g. check that a valid AU file is written
196 if(iError == KErrNone)
202 INFO_PRINTF2(_L("Error returned in MoscoStateChangeEvent callback: %d"), iError);
210 //------------------------------------------------------------------
215 CTestMmfAclntConCloseOpen::CTestMmfAclntConCloseOpen(const TDesC& aTestName)
216 :CTestMmfAclntConConfig(aTestName, EPcm16Wav, EFalse)
219 CTestMmfAclntConCloseOpen* CTestMmfAclntConCloseOpen::NewL(const TDesC& aTestName)
221 CTestMmfAclntConCloseOpen* self = new (ELeave) CTestMmfAclntConCloseOpen(aTestName);
226 * Open source and destination audio. Close them and open a new source and destination.
228 TVerdict CTestMmfAclntConCloseOpen::DoTestL(CMdaAudioConvertUtility* aConverter)
230 INFO_PRINTF1( _L("TestConverter : Close/Open"));
232 TVerdict ret = EFail;
234 SetupFormatL(iTestFormat);
237 TPtrC toFilename, fromFilename;
238 if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename)) || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
239 return EInconclusive;
242 TMdaFileClipLocation location(toFilename);
244 iError = KErrTimedOut;
247 iError = KErrTimedOut;
248 aConverter->OpenL(fromFilename, &location, iFormat, iCodec, NULL);
251 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
252 CActiveScheduler::Start();
254 if(iError == KErrNone)
260 //------------------------------------------------------------------
265 CTestMmfAclntConWindow::CTestMmfAclntConWindow(const TDesC& aTestName)
266 :CTestMmfAclntConConfig(aTestName, EPcm16Wav, EFalse)
269 CTestMmfAclntConWindow* CTestMmfAclntConWindow::NewL(const TDesC& aTestName)
271 CTestMmfAclntConWindow* self = new (ELeave) CTestMmfAclntConWindow(aTestName);
276 * Set convert window. Enquire window. Delete window
278 TVerdict CTestMmfAclntConWindow::DoTestL(CMdaAudioConvertUtility* aConverter)
280 INFO_PRINTF1( _L("*** Converter set window test\n"));
282 TVerdict ret = EFail;
285 temp1 = aConverter->Duration().Int64()/4; // set start at first quarter of clip
286 temp2 = TInt64(3) * (aConverter->Duration().Int64()/4); // set end at 3rd quarter of clip
287 ASSERT(temp2 > temp1); // temp1 = start, temp2 = end
289 TInt windowDuration = (I64INT(temp2) - I64INT(temp1));
291 TTimeIntervalMicroSeconds endTime(temp2);
292 TTimeIntervalMicroSeconds startTime(temp1);
294 INFO_PRINTF4(_L("StartTime = %d EndTime = %d WindowDuration = %d"),
295 I64INT(startTime.Int64()), I64INT(endTime.Int64()), windowDuration);
296 aConverter->SetPlayWindow(startTime,endTime);
299 TRAP(iError,aConverter->SetDestinationNumberOfChannelsL(1));
300 if (iError != KErrNone)
303 iError = KErrTimedOut;
304 INFO_PRINTF1( _L("CMdaAudioConvertUtility::ConvertL"));
305 aConverter->ConvertL();
308 CActiveScheduler::Start(); // initial MoscoStateChangeEvent callback
309 if (iError == KErrNone)
311 CActiveScheduler::Start(); // conversion starts here
313 if (iError == KErrNone)
315 // Check file size is as expected
317 if (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), filename))
319 INFO_PRINTF1(_L("Error getting filename from ini file"));
324 ret = CheckFileSize(filename, KConverterWindowFileSize);
330 INFO_PRINTF2(_L("iError = %d"), iError);
337 INFO_PRINTF1(_L("*** Converter clear window test\n"));
338 iError = KErrTimedOut;
339 aConverter->ClearPlayWindow();
340 aConverter->ConvertL();
342 CActiveScheduler::Start(); // initial MoscoStateChangeEvent callback
343 if (iError == KErrNone)
345 CActiveScheduler::Start(); // conversion starts here
347 if (iError == KErrNone)
350 if (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), filename))
352 INFO_PRINTF1(_L("Error getting filename from ini file"));
357 // Second convert will be appended to the first
358 ret = CheckFileSize(filename, KConverterWindowPlusNormalFileSize);
364 INFO_PRINTF2(_L("iError = %d"), iError);
372 TVerdict CTestMmfAclntConWindow::CheckFileSize(const TDesC& aFilename, const TInt aExpectedSize)
374 TVerdict verdict = EFail;
378 TInt ret = fs.Connect();
381 INFO_PRINTF1(_L("Error opening file system!"));
382 return EInconclusive;
385 // Check file size matches expected size
386 TInt err = file.Open(fs, aFilename, EFileRead);
389 INFO_PRINTF2(_L("Error opening converted file (%d)"), err);
390 verdict = EInconclusive;
395 err = file.Size(size);
396 if (err != KErrNone || size != aExpectedSize)
399 INFO_PRINTF2(_L("Error getting file size (%d)"), err);
401 INFO_PRINTF3(_L("Converted file size incorrect (expected %d, got %d)"), aExpectedSize, size);
406 INFO_PRINTF1(_L("Converted file size as expected (test passed)"));
416 //------------------------------------------------------------------
421 CTestMmfAclntConDuration::CTestMmfAclntConDuration(const TDesC& aTestName)
422 :CTestMmfAclntConConfig(aTestName,EPcm16Wav, EFalse)
425 CTestMmfAclntConDuration* CTestMmfAclntConDuration::NewL(const TDesC& aTestName)
427 CTestMmfAclntConDuration* self = new (ELeave) CTestMmfAclntConDuration(aTestName);
431 void CTestMmfAclntConDuration::GetKeyName(TDes& aDes)
433 aDes = KAclntConDurationKeyName;
438 TVerdict CTestMmfAclntConDuration::DoTestL(CMdaAudioConvertUtility* aConverter)
440 INFO_PRINTF1( _L("TestConverter : Duration"));
441 TVerdict ret = EFail;
443 TTimeIntervalMicroSeconds duration(KSoundFileLength); // 8 second sound file!
444 //since format+codec have wrrong default values
445 TRAP(iError,aConverter->SetDestinationSampleRateL(8000));
446 TRAP(iError,aConverter->SetDestinationNumberOfChannelsL(1));
447 //TRAP(iError,aConverter->ConvertL());
449 if(KErrNone == iError && (aConverter->Duration() == duration))
451 INFO_PRINTF3(_L("Duration = %f mkS Record time = %f mkS"),
452 I64REAL(duration.Int64()),
453 I64REAL(aConverter->RecordTimeAvailable().Int64()));
458 TInt64 durationExpected = duration.Int64();
460 TInt64 durationReceived = aConverter->Duration().Int64();
461 INFO_PRINTF3( _L("Expected duration: %f, received duration: %f"), I64REAL(durationExpected), I64REAL(durationReceived));
467 void CTestMmfAclntConDuration::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode)
470 INFO_PRINTF1( _L("CTestMmfAclntDelete : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
471 INFO_PRINTF2( _L("iError %d"), iError);
472 CActiveScheduler::Stop();
475 //------------------------------------------------------------------
480 CTestMmfAclntConPosition::CTestMmfAclntConPosition(const TDesC& aTestName,const TTimeIntervalMicroSeconds aPosition)
481 :CTestMmfAclntConConfig(aTestName,EPcm16Wav, EFalse)
483 iPosition = aPosition;
486 CTestMmfAclntConPosition* CTestMmfAclntConPosition::NewL(const TDesC& aTestName,const TTimeIntervalMicroSeconds aPosition)
488 CTestMmfAclntConPosition* self = new (ELeave) CTestMmfAclntConPosition(aTestName, aPosition);
492 void CTestMmfAclntConPosition::GetKeyName(TDes& aDes)
494 aDes = KAclntConPositionKeyName;
498 * Set position and enquire position. Sound is always set to minus one
499 * frame, becuase DevSound has to play something. (Even if set to the end of the clip).
502 TVerdict CTestMmfAclntConPosition::DoTestL(CMdaAudioConvertUtility* aConverter)
504 INFO_PRINTF1( _L("TestConverter : Position"));
505 TVerdict ret = EFail;
507 // Set position: middle of clip.
508 if (I64INT(iPosition.Int64()) == 0)
509 iPosition = I64INT(aConverter->Duration().Int64())/2;
510 // Set position: end of clip.
511 if (I64INT(iPosition.Int64()) == -1)
512 iPosition = aConverter->Duration();
514 // Position is beyond the end of the clips duration.
515 // so check that the value is clipped.
516 if(aConverter->Duration() < iPosition)
518 TInt64 temp = (aConverter->Duration().Int64() / KPcm16FrameInterval) - 1; // -1 for DevSound
519 aConverter->SetPosition(iPosition);
521 TInt64 theReceived = aConverter->Position().Int64();
522 TInt64 theExpected = temp * KPcm16FrameInterval;
524 TBool theRes = TimeComparison(I64INT(theReceived), I64INT(theExpected), KExpectedDeviation);
526 if(theRes == (TBool) ETrue)
528 INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
530 // Position is before the beginning of the clip
531 // so check that the value is zero
532 else if(iPosition < TTimeIntervalMicroSeconds(0))
534 TInt theExpected = 0;
535 aConverter->SetPosition(iPosition);
536 TInt theReceived = I64INT(aConverter->Position().Int64());
537 TBool theRes = TimeComparison(theReceived, theExpected, 0);
540 INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
547 aConverter->SetPosition(iPosition);
548 aConverter->ConvertL();
549 CActiveScheduler::Start();
551 TInt64 temp = (iPosition.Int64() / KPcm16FrameInterval) - 1; // -1 for DevSound
553 TInt theReceived = I64INT(aConverter->Position().Int64());
554 TInt theExpected = I64INT(temp) * KPcm16FrameInterval;
556 TBool theRes = TimeComparison(theReceived, theExpected, KExpectedDeviation);
558 if(theRes == (TBool) ETrue)
562 INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
567 TInt theDurationa = I64INT(aConverter->Duration().Int64());
569 aConverter->SetPosition(iPosition);
570 TInt theExpected = I64INT(aConverter->Position().Int64());
572 //ConvertL requires two CActiveScheduler::Start()
573 aConverter->ConvertL();
574 CActiveScheduler::Start();
575 CActiveScheduler::Start();
577 TPtrC toFilename, fromFilename;
578 GetStringFromConfig(_L("SectionFour"), _L("configAudio"), fromFilename);
579 GetStringFromConfig(_L("SectionFour"), _L("configAudio12"), toFilename);
580 TMdaFileClipLocation location2(toFilename);
581 aConverter->OpenL(fromFilename, &location2, iFormat, iCodec);
582 CActiveScheduler::Start();
584 TInt theDurationb = I64INT(aConverter->Duration().Int64());
585 TInt theReceived = theDurationa - theDurationb;
587 TBool theRes = TimeComparison(theReceived, theExpected, KDeviation);
590 if(theRes == (TBool) ETrue)
594 INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
601 //------------------------------------------------------------------
606 CTestMmfAclntConConfig::CTestMmfAclntConConfig(const TDesC& aTestName, const TTestFormat aFormat, const TBool aNegative)
608 iTestStepName = aTestName;
609 iThisIsNegativeTest = aNegative;
610 iTestFormat = aFormat;
613 CTestMmfAclntConConfig* CTestMmfAclntConConfig::NewL(const TDesC& aTestName, const TTestFormat aFormat, const TBool aNegative)
615 CTestMmfAclntConConfig* self = new (ELeave) CTestMmfAclntConConfig(aTestName, aFormat, aNegative);
619 void CTestMmfAclntConConfig::MoscoStateChangeEvent(CBase* /*aObject*/,
620 TInt /*aPreviousState*/,
621 TInt /*aCurrentState*/,
625 INFO_PRINTF1( _L("CTestMmfAclntConConfig : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
626 INFO_PRINTF2( _L("iError %d"), iError);
628 CActiveScheduler::Stop();
631 void CTestMmfAclntConConfig::GetKeyName(TDes& aDes)
633 aDes = KAclntConConfigKeyName;
636 TVerdict CTestMmfAclntConConfig::DoTestStepPreambleL()
638 TVerdict ret = EPass;
640 SetupFormatL(iTestFormat);
645 // Make sure file doesn't exist (maybe from a previous test)
648 if(!GetStringFromConfig(_L("SectionFour"), keyName, filename))
649 return EInconclusive;
651 // parse the filenames
652 if(!fullFileName.Set(filename, &KDefault, NULL))
655 User::LeaveIfError(fs.Connect());
657 TInt error = fs.Delete(fullFileName.FullName());
658 if(error == KErrPathNotFound)
660 error = fs.MkDirAll(fullFileName.DriveAndPath());
661 INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
663 else if(error == KErrNotFound)
664 INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
665 else if(error==KErrNone)
666 INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
671 if((ret == EInconclusive) || (ret == EFail))
675 return CTestMmfAclntStep::DoTestStepPreambleL();
679 * Set config destination clip
681 TVerdict CTestMmfAclntConConfig::DoTestStepL()
683 INFO_PRINTF1( _L("TestConverter : Config"));
684 TVerdict ret = EFail;
686 TPtrC toFilename, fromFilename;
687 if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
688 || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
689 return EInconclusive;
691 // Delete the old file if it exists
693 TInt err = fs.Connect();
696 INFO_PRINTF2(_L("Error doing fs.Connect (%d)"), err);
697 return EInconclusive;
700 err = fs.Delete(toFilename);
701 if ((err != KErrNone) && (err != KErrNotFound))
703 INFO_PRINTF3(_L("Error deleting 'toFilename' (%S) %d"), &toFilename, err);
704 return EInconclusive;
708 TMdaFileClipLocation location(toFilename);
709 iError = KErrTimedOut;
711 CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
712 CleanupStack::PushL(converter);
714 if (iThisIsNegativeTest)
716 iAudioSettings.iSampleRate = KInvalidNumber;
717 iAudioSettings.iChannels = KInvalidNumber;
718 converter->OpenL(fromFilename, &location, iFormat, iCodec, &iAudioSettings);
722 converter->OpenL(fromFilename, &location, iFormat, iCodec);
725 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
726 CActiveScheduler::Start();
728 //TRAP(iError, converter->SetDestinationNumberOfChannelsL(1));
730 if (iError == KErrNone)
731 ret = DoTestL(converter);
734 INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
736 if(iThisIsNegativeTest && iError == KErrNotSupported)
741 CleanupStack::PopAndDestroy(converter);
742 User::After(KOneSecond);
747 TVerdict CTestMmfAclntConConfig::DoTestL(CMdaAudioConvertUtility* aConverter)
749 TVerdict ret = EFail;
751 iError = KErrTimedOut;
753 aConverter->ConvertL();
754 INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
755 CActiveScheduler::Start();
757 // a negative test will fail succesfully at this point
758 if (!iThisIsNegativeTest)
760 else if (iError == KErrNotSupported)
765 //------------------------------------------------------------------
770 CTestMmfAclntConQuery::CTestMmfAclntConQuery(const TDesC& aTestName)
771 :CTestMmfAclntConConfig(aTestName, EPcm16Wav, EFalse)
774 CTestMmfAclntConQuery* CTestMmfAclntConQuery::NewL(const TDesC& aTestName)
776 CTestMmfAclntConQuery* self = new (ELeave) CTestMmfAclntConQuery(aTestName);
780 void CTestMmfAclntConQuery::GetKeyName(TDes& aDes)
782 aDes = KAclntConQueryKeyName;
785 TVerdict CTestMmfAclntConQuery::DoTestStepL()
787 INFO_PRINTF1( _L("TestConverter : ConQuery"));
788 TVerdict ret = EFail;
790 TPtrC toFilename, fromFilename;
791 if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
792 //if ((!GetStringFromConfig(_L("SectionSeven"), _L("auFile"), fromFilename))
793 //if ((!GetStringFromConfig(_L("SectionSeven"), _L("rawFile"), fromFilename))
794 || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio4"), toFilename)))
795 return EInconclusive;
797 TMdaFileClipLocation location(toFilename);
798 iError = KErrTimedOut;
800 CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
801 CleanupStack::PushL(converter);
803 converter->OpenL(fromFilename, &location, iFormat, iCodec);
805 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
806 CActiveScheduler::Start();
808 if (iError == KErrNone)
809 ret = DoTestL(converter);
812 INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
815 CleanupStack::PopAndDestroy(converter);
816 User::After(KOneSecond);
822 * query transformations available.
824 TVerdict CTestMmfAclntConQuery::DoTestL(CMdaAudioConvertUtility* aConverter)
826 INFO_PRINTF1( _L("TestConverter : Query Transactions"));
827 RArray<TFourCC> theSupportedDataTypes;
830 TRAP(err,aConverter->GetSupportedDestinationDataTypesL(theSupportedDataTypes));
833 INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedDataTypesL left with error %d"),err);
837 TUint8 theBuffer8[KSizeBuf];
839 INFO_PRINTF1( _L("The supported available transformation"));
840 for(TInt index = 0; index < theSupportedDataTypes.Count() ; index++)
842 TFourCC& four = theSupportedDataTypes[index];
844 TPtr8 ptrFour(theBuffer8, KSizeBuf);
845 four.FourCC(&ptrFour);
846 TBuf<KSizeBuf> theBuf;
848 theBuf.Copy(ptrFour);
850 INFO_PRINTF3( _L("%d %S"), index, &theBuf);
857 //-------------------------------------------------------------------
861 //-------------------------------------------------------------------
866 CTestMmfAclntDelete::CTestMmfAclntDelete()
868 // store the name of this test case
869 // this is the name that is used by the script file
870 // Each test step initialises it's own name
871 iTestStepName = _L("MM-MMF-ACLNT-I-1051-CP");
874 void CTestMmfAclntDelete::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode)
877 INFO_PRINTF1( _L("CTestMmfAclntDelete : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
878 INFO_PRINTF2( _L("iError %d"), iError);
879 CActiveScheduler::Stop();
883 * Conversion utility - Delete object before conversion operation has completed.
885 TVerdict CTestMmfAclntDelete::DoTestStepL( void )
887 INFO_PRINTF1( _L("TestConverter : Delete"));
889 TPtrC sourceFileName, targetFileName;
890 if((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), sourceFileName)) ||
891 (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), targetFileName)))
892 return EInconclusive;
896 theFs.Delete(targetFileName);
900 iError = KErrTimedOut;
901 TMdaFileClipLocation location(targetFileName);
902 TMdaWavClipFormat format;
903 TMdaPcmWavCodec codec;
907 CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
908 CleanupStack::PushL(converter);
909 converter->OpenL(sourceFileName,&location, &format, &codec);
910 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
911 CActiveScheduler::Start();
913 if(iError == KErrNone)
915 converter->ConvertL();
916 INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
917 //User::After(3 * KOneSecond);
918 CleanupStack::PopAndDestroy(converter);
919 User::After(KOneSecond);
920 INFO_PRINTF1( _L("Destroy CMdaAudioConvertUtility"));
922 User::Heap().Check();
927 ERR_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
929 CleanupStack::PopAndDestroy(converter);
930 User::After(KOneSecond);
934 //------------------------------------------------------------------
939 CTestMmfAclntOpenWhileConvert::CTestMmfAclntOpenWhileConvert(const TDesC& aTestName)
940 :CTestMmfAclntConConfig(aTestName, EPcm16Wav,EFalse)
944 CTestMmfAclntOpenWhileConvert* CTestMmfAclntOpenWhileConvert::NewL(const TDesC& aTestName)
946 CTestMmfAclntOpenWhileConvert* self = new (ELeave) CTestMmfAclntOpenWhileConvert(aTestName);
951 * Open new file while audio converter is converting. Open a new audio file.
953 TVerdict CTestMmfAclntOpenWhileConvert::DoTestL(CMdaAudioConvertUtility* aConverter)
955 INFO_PRINTF1( _L("TestConverter : Open/Convert"));
957 TPtrC auFilename, wavFilename;
958 //if((!GetStringFromConfig(_L("SectionFour"), _L("auAudioFile"), auFilename)) ||
959 // (!GetStringFromConfig(_L("SectionFour"), _L("wavAudioFile"), wavFilename)))
960 if((!GetStringFromConfig(_L("SectionOne"), _L("PCM8"), auFilename)) ||
961 (!GetStringFromConfig(_L("SectionFour"), _L("PCM16_out"), wavFilename)))
962 return EInconclusive;
965 User::LeaveIfError(theFs.Connect());
966 theFs.Delete(wavFilename);
967 theFs.MkDirAll(wavFilename);
971 iError = KErrTimedOut;
972 TMdaFileClipLocation location(wavFilename);
973 TMdaWavClipFormat format;
974 TMdaPcmWavCodec codec(TMdaPcmWavCodec::E16BitPcm);
976 aConverter->ConvertL();
977 INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
978 User::After(KOneSecond);
981 aConverter->OpenL(auFilename,&location, &format, &codec);
982 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
984 CActiveScheduler::Start();
986 if(iError == KErrInUse || iError == KErrNone)
991 //------------------------------------------------------------------
993 CTestMmfAclntConvertDestBitRate::CTestMmfAclntConvertDestBitRate(const TDesC& aTestName, TBool aNegative)
994 : CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
997 CTestMmfAclntConvertDestBitRate* CTestMmfAclntConvertDestBitRate::NewL(const TDesC& aTestName, TBool aNegative)
999 CTestMmfAclntConvertDestBitRate* self = new (ELeave) CTestMmfAclntConvertDestBitRate(aTestName,aNegative);
1003 void CTestMmfAclntConvertDestBitRate::GetKeyName(TDes& aDes)
1005 aDes = KAclntConDestBitRateKeyName;
1008 TVerdict CTestMmfAclntConvertDestBitRate::DoTestL(CMdaAudioConvertUtility* aConverter)
1010 INFO_PRINTF1( _L("TestConvertUtils : Destination Bit Rate"));
1011 TVerdict ret = EPass;
1012 TInt err = KErrNone;
1013 RArray<TUint> rates;
1014 TRAP(err,aConverter->GetSupportedConversionBitRatesL(rates));
1015 // in Typhoon KErrNotSupported is expected
1016 if(err==KErrNotSupported)
1018 //test the other bitrate functions for code coverage (and behaviour)
1019 TRAP(err,aConverter->SetDestinationBitRateL(100)); // arbitrary value since KErrNotSupported is expected anyway
1020 if (err != KErrNotSupported)
1024 TRAP(err, rate=aConverter->DestinationBitRateL());
1025 if (err != KErrNone)
1028 INFO_PRINTF3(_L("CMdaAudioConvertUtility::GetSupportedConversionBitRatesL() leave with error %d bitrate of %d"),err,rate);
1034 INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedConversionBitRatesL() leave with error %d"),iError);
1038 TInt numRates = rates.Count();
1039 for(TInt i=0;i<numRates;i++)
1041 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationBitRateL (%d)"),rates[i]);
1042 TRAP(iError,aConverter->SetDestinationBitRateL(rates[i]));
1043 if(iError != KErrNone)
1045 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationBitRateL left with error %d"),iError);
1048 else// no error, get rate
1051 TRAP(iError,rate = aConverter->DestinationBitRateL());
1052 //TRAP(err, aConverter->ConvertL());
1053 //CActiveScheduler::Start();
1055 if(iError!=KErrNone)
1057 INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationBitRateL leave with error %d"),iError);
1065 INFO_PRINTF1(_L("Rate mismatch"));
1069 INFO_PRINTF1(_L("Rates match"));
1078 //------------------------------------------------------------------
1080 CTestMmfAclntConvertDestDataType::CTestMmfAclntConvertDestDataType(const TDesC& aTestName, TBool aNegative)
1081 : CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1084 CTestMmfAclntConvertDestDataType* CTestMmfAclntConvertDestDataType::NewL(const TDesC& aTestName, TBool aNegative)
1086 CTestMmfAclntConvertDestDataType* self = new (ELeave) CTestMmfAclntConvertDestDataType(aTestName,aNegative);
1090 void CTestMmfAclntConvertDestDataType::GetKeyName(TDes& aDes)
1092 aDes = KAclntConDestDataTypeKeyName;
1095 TVerdict CTestMmfAclntConvertDestDataType::DoTestL(CMdaAudioConvertUtility* aConverter)
1097 INFO_PRINTF1( _L("TestConvertUtils : Destination data type"));
1099 TVerdict ret = EFail;
1100 TInt err = KErrNone;
1101 RArray<TFourCC> SupportedDataTypes ;
1104 TRAP(err,aConverter->GetSupportedDestinationDataTypesL(SupportedDataTypes));
1107 INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedBitRatesL leave with error %d"),err);
1112 TInt numRates = SupportedDataTypes.Count();
1115 for(TInt i=0;i<numRates;i++)
1117 dataType = SupportedDataTypes[i] ;
1118 TUint8 char1 = TUint8( dataType.FourCC() ) ;
1119 TUint8 char2 = TUint8( dataType.FourCC() >> 8 ) ;
1120 TUint8 char3 = TUint8( dataType.FourCC() >> 16 ) ;
1121 TUint8 char4 = TUint8( dataType.FourCC() >> 24 ) ;
1122 //fourCCString->Format( _L8("%1c%1c%1c%1c"), char1, char2, char3, char4 ) ;
1123 INFO_PRINTF5(_L("dataType.FourCC= %1c%1c%1c%1c"), char1, char2, char3, char4);
1124 TRAP(err,aConverter->SetDestinationDataTypeL(SupportedDataTypes[i]));
1128 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationDataTypeL leave with error %d"),err);
1132 TRAP(err,dataType = aConverter->DestinationDataTypeL());
1136 INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationDataTypeL leave with error %d"),err);
1140 if(dataType!=SupportedDataTypes[i])
1147 //------------------------------------------------------------------
1149 CTestMmfAclntConvertDestFormat::CTestMmfAclntConvertDestFormat(const TDesC& aTestName, TBool aNegative)
1150 : CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1153 CTestMmfAclntConvertDestFormat* CTestMmfAclntConvertDestFormat::NewL(const TDesC& aTestName, TBool aNegative)
1155 CTestMmfAclntConvertDestFormat* self = new (ELeave) CTestMmfAclntConvertDestFormat(aTestName,aNegative) ;
1159 void CTestMmfAclntConvertDestFormat::GetKeyName(TDes& aDes)
1161 aDes = KAclntConDestFormatKeyName;
1164 TVerdict CTestMmfAclntConvertDestFormat::DoTestL(CMdaAudioConvertUtility* aConverter)
1166 INFO_PRINTF1( _L("TestConvertUtils : Destination format"));
1167 TVerdict ret = EFail;
1168 TInt err = KErrNone;
1169 TUid format1(KUidMdaWavCodec) ; //Why not?
1172 TRAP(err,format1 = aConverter->DestinationFormatL());
1175 INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationFormatL leave with error %d"),err);
1179 TRAP(err,aConverter->SetDestinationFormatL(format1));
1182 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationFormatL leave with error %d"),err);
1186 TRAP(err,format2 = aConverter->DestinationFormatL());
1189 INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationFormatL leave with error %d"),err);
1193 if(format1 == format2)
1199 //------------------------------------------------------------------
1201 CTestMmfAclntConvertDestSampleRate::CTestMmfAclntConvertDestSampleRate(const TDesC& aTestName, TBool aNegative)
1202 : CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1205 CTestMmfAclntConvertDestSampleRate* CTestMmfAclntConvertDestSampleRate::NewL(const TDesC& aTestName, TBool aNegative)
1207 CTestMmfAclntConvertDestSampleRate* self = new (ELeave) CTestMmfAclntConvertDestSampleRate(aTestName,aNegative);
1211 void CTestMmfAclntConvertDestSampleRate::GetKeyName(TDes& aDes)
1213 aDes = KAclntConDestSampleRateKeyName;
1217 * Set config destination clip
1219 TVerdict CTestMmfAclntConvertDestSampleRate::DoTestStepL()
1221 INFO_PRINTF1( _L("TestConverter : Config"));
1222 TVerdict ret = EFail;
1224 TPtrC toFilename, fromFilename;
1226 // if ((!GetStringFromConfig(_L("SectionOne"), _L("Pcm16Mono44khz"), fromFilename))
1227 if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
1228 || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
1229 return EInconclusive;
1231 // Delete the old file if it exists
1233 TInt err = fs.Connect();
1234 if (err != KErrNone)
1236 INFO_PRINTF2(_L("Error doing fs.Connect (%d)"), err);
1237 return EInconclusive;
1240 err = fs.Delete(toFilename);
1241 if ((err != KErrNone) && (err != KErrNotFound))
1243 INFO_PRINTF3(_L("Error deleting 'toFilename' (%S) %d"), &toFilename, err);
1244 return EInconclusive;
1248 TMdaFileClipLocation location(toFilename);
1249 iError = KErrTimedOut;
1251 CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
1252 CleanupStack::PushL(converter);
1254 if (iThisIsNegativeTest)
1256 iAudioSettings.iSampleRate = KInvalidNumber;
1257 iAudioSettings.iChannels = KInvalidNumber;
1258 converter->OpenL(fromFilename, &location, iFormat, iCodec, &iAudioSettings);
1262 converter->OpenL(fromFilename, &location, iFormat, iCodec);
1265 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
1266 CActiveScheduler::Start();
1268 if (iError == KErrNone)
1269 ret = DoTestL(converter);
1272 INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
1274 if(iThisIsNegativeTest && iError == KErrNotSupported)
1279 CleanupStack::PopAndDestroy(converter);
1280 User::After(KOneSecond);
1285 void CTestMmfAclntConvertDestSampleRate::MoscoStateChangeEvent(CBase* /*aObject*/,
1286 TInt aPreviousState,
1290 iError = aErrorCode;
1291 //iObject = aObject;
1292 TInt PreviousState = aPreviousState;
1293 TInt CurrentState = aCurrentState;
1294 INFO_PRINTF1( _L("CTestMmfAclntConvertDestSampleRate : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
1295 INFO_PRINTF4( _L("iError %d PreviousState %d -> CurrentState %d"),
1296 iError, PreviousState, CurrentState);
1297 if( CurrentState != CMdaAudioClipUtility::EPlaying)
1298 //give a chace to finish conversion
1299 CActiveScheduler::Stop();
1303 TVerdict CTestMmfAclntConvertDestSampleRate::DoTestL(CMdaAudioConvertUtility* aConverter)
1305 INFO_PRINTF1( _L("TestConvertUtils : Destination Sample Rate"));
1306 TVerdict ret = EFail;
1308 TInt err = KErrNone;
1309 RArray<TUint> supportedSampleRates ;
1312 TRAP(err,aConverter->GetSupportedConversionSampleRatesL(supportedSampleRates));
1315 INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedConversionSampleRatesL() leave with error %d"),err);
1320 TInt numRates = supportedSampleRates.Count();
1324 for(TInt i=0;i<numRates;i++)
1326 // Delete the output file if it exists
1327 // Necessary otherwise we will open the output file for conversion and
1328 // use the sample rate of the file
1330 if (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename))
1332 INFO_PRINTF1(_L("Error finding filename in INI file"));
1333 return EInconclusive;
1337 TInt err = fs.Connect();
1338 if (err != KErrNone)
1340 INFO_PRINTF2(_L("Error doing fs.Connect (%d)"), err);
1341 return EInconclusive;
1344 err = fs.Delete(toFilename);
1345 if ((err != KErrNone) && (err != KErrNotFound))
1347 INFO_PRINTF3(_L("Error deleting 'toFilename' (%S) %d"), &toFilename, err);
1348 return EInconclusive;
1352 // Do the conversion
1353 TUint SampleRate = supportedSampleRates[i] ;
1354 INFO_PRINTF2(_L("SampleRate = %d"), SampleRate);
1355 TRAP(err,aConverter->SetDestinationSampleRateL(SampleRate));
1358 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationSampleRateL() leave with error %d"),err);
1363 TRAP(err, aConverter->ConvertL());
1364 CActiveScheduler::Start();
1368 INFO_PRINTF2(_L("CMdaAudioConvertUtility::ConvertL leave with error %d"),err);
1373 TRAP(err,SampleRate = aConverter->DestinationSampleRateL());
1376 INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationSampleRateL leave with error %d"),err);
1381 if(SampleRate != supportedSampleRates[i])
1383 INFO_PRINTF1(_L("CMdaAudioConvertUtility::DestinationSampleRateL does not match the sample rate set"));
1391 INFO_PRINTF1(_L("CMdaAudioConvertUtility::GetSupportedConversionSampleRatesL() returned empy array."));
1398 //------------------------------------------------------------------
1400 CTestMmfAclntConvertDestNumberOfChannels::CTestMmfAclntConvertDestNumberOfChannels(const TDesC& aTestName, TBool aNegative)
1401 : CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1404 CTestMmfAclntConvertDestNumberOfChannels* CTestMmfAclntConvertDestNumberOfChannels::NewL(const TDesC& aTestName, TBool aNegative)
1406 CTestMmfAclntConvertDestNumberOfChannels* self = new (ELeave) CTestMmfAclntConvertDestNumberOfChannels(aTestName,aNegative);
1410 void CTestMmfAclntConvertDestNumberOfChannels::GetKeyName(TDes& aDes)
1412 aDes = KAclntConDestNumberChannelsKeyName;
1415 TVerdict CTestMmfAclntConvertDestNumberOfChannels::DoTestL(CMdaAudioConvertUtility* aConverter)
1417 INFO_PRINTF1( _L("TestConvertUtils : Destination Number of Channels"));
1418 TVerdict ret = EFail;
1420 TInt err = KErrNone;
1421 RArray<TUint> aSupportedNumberOfChannels ;
1423 TRAP(err,aConverter->GetSupportedConversionNumberOfChannelsL(aSupportedNumberOfChannels));
1426 INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedConversionNumberOfChannelsL() leave with error %d"),err);
1431 TInt numRates = aSupportedNumberOfChannels.Count();
1435 for(TInt i=0;i<numRates;i++)
1437 TUint NumberOfChannels = aSupportedNumberOfChannels[i] ;
1438 INFO_PRINTF2(_L("NumberOfChannels = %d"), NumberOfChannels);
1439 TRAP(err,aConverter->SetDestinationNumberOfChannelsL(aSupportedNumberOfChannels[i]));
1443 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationNumberOfChannelL() leave with error %d"),err);
1446 TRAP(err,NumberOfChannels = aConverter->DestinationNumberOfChannelsL());
1450 INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationNumberOfChannelL leave with error %d"),err);
1454 if(NumberOfChannels != aSupportedNumberOfChannels[i])
1460 //------------------------------------------------------------------
1462 CTestMmfAclntConvertSourceInfo::CTestMmfAclntConvertSourceInfo(const TDesC& aTestName, TBool aNegative)
1463 : CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1466 CTestMmfAclntConvertSourceInfo* CTestMmfAclntConvertSourceInfo::NewL(const TDesC& aTestName, TBool aNegative)
1468 CTestMmfAclntConvertSourceInfo* self = new (ELeave) CTestMmfAclntConvertSourceInfo(aTestName,aNegative);
1472 void CTestMmfAclntConvertSourceInfo::GetKeyName(TDes& aDes)
1474 aDes = KAclntConSourceInfoKeyName;
1477 TVerdict CTestMmfAclntConvertSourceInfo::DoTestL(CMdaAudioConvertUtility* aConverter)
1479 INFO_PRINTF1( _L("TestConvertUtils : Source Info"));
1480 TVerdict ret = EFail;
1482 TInt err = KErrNone;
1483 TUint NumberOfChannels = 0 ;
1484 TRAP(err,NumberOfChannels = aConverter->SourceNumberOfChannelsL());
1487 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceNumberOfChannelL leave with error %d"),err);
1490 INFO_PRINTF2(_L("NumberOfChannels = %d"), NumberOfChannels);
1493 TRAP(err,BitRate = aConverter->SourceBitRateL());
1496 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceBitRateL leave with error %d"),err);
1499 INFO_PRINTF2(_L("BitRate = %d"), BitRate);
1501 TUint SampleRate = 0 ;
1502 TRAP(err,SampleRate = aConverter->SourceSampleRateL());
1505 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceSampleRateL leave with error %d"),err);
1508 INFO_PRINTF2(_L("SampleRate = %d"), SampleRate);
1511 TUid Format(KUidMdaWavCodec) ;
1512 TRAP(err,Format = aConverter->SourceFormatL());
1515 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceFormatL leave with error %d"),err);
1518 INFO_PRINTF2(_L("Format = %d"), Format);
1521 TRAP(err,dataType = aConverter->SourceDataTypeL());
1525 INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceDataTypeL leave with error %d"),err);
1528 TUint8 char1 = TUint8( dataType.FourCC() ) ;
1529 TUint8 char2 = TUint8( dataType.FourCC() >> 8 ) ;
1530 TUint8 char3 = TUint8( dataType.FourCC() >> 16 ) ;
1531 TUint8 char4 = TUint8( dataType.FourCC() >> 24 ) ;
1532 INFO_PRINTF5(_L("dataType.FourCC= %1c%1c%1c%1c"), char1, char2, char3, char4);
1539 //------------------------------------------------------------------
1541 CTestMmfAclntConvertLength::CTestMmfAclntConvertLength(const TDesC& aTestName, TBool aNegative)
1542 :CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1546 CTestMmfAclntConvertLength* CTestMmfAclntConvertLength::NewL(const TDesC& aTestName, TBool aNegative)
1548 CTestMmfAclntConvertLength* self = new (ELeave) CTestMmfAclntConvertLength(aTestName, aNegative);
1553 *Set maximum length of file in bytes and Convertord
1555 TVerdict CTestMmfAclntConvertLength::DoTestL(CMdaAudioConvertUtility* aConvertUtil)
1557 INFO_PRINTF1( _L("TestConvertor : Length"));
1559 TVerdict ret = EFail;
1560 //TTimeIntervalMicroSeconds ConvertTime(aConvertUtil->Duration());
1562 aConvertUtil->SetMaxWriteLength(800);
1564 TRAP(iError, aConvertUtil->PlayL()) ;
1566 if(iError != KErrNone)
1569 CActiveScheduler::Start();
1571 aConvertUtil->Stop() ;
1573 //until DEF011919 is not fixed
1574 //if(aConvertUtil->Duration() != ConvertTime)
1579 //------------------------------------------------------------------
1584 CTestMmfAclntConvertRepeat::CTestMmfAclntConvertRepeat(const TDesC& aTestName, TBool aNegative)
1585 :CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1588 CTestMmfAclntConvertRepeat* CTestMmfAclntConvertRepeat::NewL(const TDesC& aTestName, TBool aNegative)
1590 CTestMmfAclntConvertRepeat* self = new (ELeave) CTestMmfAclntConvertRepeat(aTestName,aNegative);
1597 TVerdict CTestMmfAclntConvertRepeat::DoTestL(CMdaAudioConvertUtility* aConvertUtil)
1599 INFO_PRINTF1( _L("TestConvert : Repeats"));
1601 iError = KErrTimedOut;
1603 TTimeIntervalMicroSeconds silence(0);
1604 //just to sutisfy CCover, actualy does nothing
1605 aConvertUtil->SetRepeats(NUMBER_OF_REPEATS,silence);
1607 //TInt duration = I64INT(aConvertUtil->Duration().Int64());
1609 iError = KErrTimedOut;
1610 INFO_PRINTF1( _L("Play CMdaAudioConvertUtility"));
1611 //just to sutisfy CCover, actualy calls ConvertL() see
1612 TRAP(iError, aConvertUtil->PlayL()) ;
1613 if(iError != KErrNone)
1616 CActiveScheduler::Start();
1618 //TUint actualDuration = I64INT(aConvertUtil->Duration().Int64()) ;
1620 //INFO_PRINTF2(_L("Repeats : %d"), NUMBER_OF_REPEATS);
1621 //INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
1622 // iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
1624 if(iError == KErrNone)
1630 //------------------------------------------------------------------
1635 CTestMmfAclntConvertCrop::CTestMmfAclntConvertCrop(const TDesC& aTestName, const TBool aCropToEnd, TBool aNegative)
1636 :CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative),
1637 iCropToEnd(aCropToEnd)
1641 CTestMmfAclntConvertCrop* CTestMmfAclntConvertCrop::NewL(const TDesC& aTestName, const TBool aCropToEnd, TBool aNegative)
1643 CTestMmfAclntConvertCrop* self = new (ELeave) CTestMmfAclntConvertCrop(aTestName, aCropToEnd, aNegative);
1649 * Set config destination clip
1651 TVerdict CTestMmfAclntConvertCrop::DoTestStepL()
1653 INFO_PRINTF1( _L("TestConverter : Config"));
1654 TVerdict ret = EFail;
1657 if ((!GetStringFromConfig(_L("SectionOne"), _L("PCM16"), fromFilename))
1658 || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), iToFilename))
1659 || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio11"), iToFilename2)))
1660 return EInconclusive;
1662 iError = KErrTimedOut;
1664 CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
1665 CleanupStack::PushL(converter);
1666 TMdaFileClipLocation location(iToFilename);
1668 if (iThisIsNegativeTest)
1670 iAudioSettings.iSampleRate = KInvalidNumber;
1671 iAudioSettings.iChannels = KInvalidNumber;
1672 //to keep CCover happy
1673 converter->OpenL(fromFilename, iToFilename2) ;
1674 //&location, iFormat, iCodec, &iAudioSettings);
1678 converter->OpenL(fromFilename, &location, iFormat, iCodec);
1681 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
1682 CActiveScheduler::Start();
1684 if (iError == KErrNone)
1685 ret = DoTestL(converter);
1687 CleanupStack::PopAndDestroy(converter);
1688 User::After(KOneSecond);
1692 INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
1696 if(iThisIsNegativeTest && iError == KErrNotSupported)
1706 void CTestMmfAclntConvertCrop::MoscoStateChangeEvent(CBase* /*aObject*/,
1707 TInt aPreviousState,
1711 iError = aErrorCode;
1712 //iObject = aObject;
1713 TInt PreviousState = aPreviousState;
1714 TInt CurrentState = aCurrentState;
1715 INFO_PRINTF1( _L("CTestMmfAclntDoConv : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
1716 INFO_PRINTF4( _L("iError %d PreviousState %d -> CurrentState %d"),
1717 iError, PreviousState, CurrentState);
1718 //if( CurrentState != CMdaAudioClipUtility::ERecording)
1719 //give a chance to finish conversion
1720 CActiveScheduler::Stop();
1723 TVerdict CTestMmfAclntConvertCrop::DoTestStepPostambleL()
1725 if (iThisIsNegativeTest)
1728 User::LeaveIfError(fs.Connect());
1730 TInt error = fs.Delete(iToFilename2);
1731 if(error == KErrPathNotFound)
1732 return EInconclusive;
1735 return CTestMmfAclntStep::DoTestStepPostambleL();
1741 TVerdict CTestMmfAclntConvertCrop::DoTestL(CMdaAudioConvertUtility* aConvert)
1743 if (iThisIsNegativeTest)
1745 TInt err = KErrNone;
1746 TRAP(err, aConvert->ConvertL());
1747 CActiveScheduler::Start();
1748 if( err != KErrNone || iError != KErrNone)
1750 CActiveScheduler::Start();
1751 if( err != KErrNone || iError != KErrNone)
1754 TTimeIntervalMicroSeconds cropPoint( TTimeIntervalMicroSeconds(aConvert->Duration().Int64()/2) );
1755 TTimeIntervalMicroSeconds cropPoint2( TTimeIntervalMicroSeconds(aConvert->Duration().Int64()*2/3) );
1757 aConvert->SetPosition(cropPoint);
1759 TRAP(err, aConvert->CropL());
1763 // position beyond the end of the cropped file
1764 aConvert->SetPosition(cropPoint2);
1766 TRAP(err, aConvert->CropL());
1767 if(err != KErrArgument)
1774 TInt err = KErrNone;
1775 TRAP(err, aConvert->ConvertL());
1776 CActiveScheduler::Start();
1777 if( err != KErrNone || iError != KErrNone)
1779 CActiveScheduler::Start();
1780 if( err != KErrNone || iError != KErrNone)
1783 TTimeIntervalMicroSeconds origDuration( TTimeIntervalMicroSeconds(aConvert->Duration().Int64() ));
1784 TTimeIntervalMicroSeconds cropPoint( origDuration.Int64()*2/3);
1785 aConvert->SetPosition(cropPoint);
1787 INFO_PRINTF4(_L("crop point %d, duration %d, cropToEnd %d"),
1788 I64INT(cropPoint.Int64()),
1789 I64INT(origDuration.Int64()),
1794 TRAP(iError, aConvert->CropL());
1798 TRAP(iError, aConvert->CropFromBeginningL());
1800 if(iError != KErrNone)
1802 ERR_PRINTF2(_L("Crop left with error = %d"),iError);
1806 // Check if the cropped duration is within the deviation from the expected duration
1807 // NB : there is no converter API to check the destination(sink) duration after cropping
1808 // but we can check cropping by reopening the file and checking its new duration
1810 TMdaFileClipLocation location(iToFilename);
1811 aConvert->OpenL(iToFilename, &location, iFormat, iCodec);
1812 CActiveScheduler::Start();
1814 TTimeIntervalMicroSeconds newDuration( TTimeIntervalMicroSeconds(aConvert->Duration().Int64() ));
1815 TTimeIntervalMicroSeconds expectedDuration;
1818 expectedDuration = cropPoint;
1820 expectedDuration = origDuration.Int64() - cropPoint.Int64();
1822 INFO_PRINTF3(_L("new duration %d, expected %d"),
1823 I64INT(newDuration.Int64()),
1824 I64INT(expectedDuration.Int64()));
1826 // check for match within deviation
1827 // We should query the duration of one 4K buffer, then use that as the jitter
1828 // on whatever file we are testing.
1830 TRAP(err,bitRate = aConvert->DestinationBitRateL());
1833 INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationBitRateL leave with error %d"),err);
1836 INFO_PRINTF2(_L("Bit rate = %d"), bitRate);
1837 // buffer duration = no. bytes / byte rate
1838 TUint bufDuration = (4096000 / (bitRate / 8)) + 1; // get it in 1/1000 sec, and round up
1839 TInt64 dev(bufDuration * 1000);
1841 INFO_PRINTF2(_L("Buffer duration = %d"), I64INT(dev));
1842 TBool durationMatch = EFalse;
1843 if (newDuration == expectedDuration)
1844 durationMatch = ETrue;
1845 else if (newDuration < expectedDuration)
1847 if (expectedDuration <= newDuration.Int64() + dev)
1848 durationMatch = ETrue;
1850 else if (newDuration > expectedDuration)
1852 if (expectedDuration >= newDuration.Int64() - dev)
1853 durationMatch = ETrue;
1858 ERR_PRINTF1(_L("Cropped duration out of expected range"));
1867 //------------------------------------------------------------------
1872 CTestMmfAclntConvertStop::CTestMmfAclntConvertStop(const TDesC& aTestName, TBool aNegative)
1873 :CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
1877 CTestMmfAclntConvertStop* CTestMmfAclntConvertStop::NewL(const TDesC& aTestName, TBool aNegative)
1879 CTestMmfAclntConvertStop* self = new (ELeave) CTestMmfAclntConvertStop(aTestName, aNegative);
1884 void CTestMmfAclntConvertStop::MoscoStateChangeEvent(CBase* /*aObject*/,
1885 TInt aPreviousState,
1889 iError = aErrorCode;
1890 //iObject = aObject;
1891 TInt PreviousState = aPreviousState;
1892 TInt CurrentState = aCurrentState;
1893 INFO_PRINTF1( _L("CTestMmfAclntDoConv : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
1894 INFO_PRINTF4( _L("iError %d PreviousState %d -> CurrentState %d"),
1895 iError, PreviousState, CurrentState);
1896 if( CurrentState != CMdaAudioClipUtility::ERecording)
1897 //give a chance to finish conversion
1898 CActiveScheduler::Stop();
1902 * Set config destination clip
1904 TVerdict CTestMmfAclntConvertStop::DoTestStepL()
1906 INFO_PRINTF1( _L("TestConverter : Config"));
1907 TVerdict ret = EFail;
1908 //stolen from #include <MMFMdaClient.h>
1909 //static const TUid KUidMmfAudioController = {0x101F5022};
1911 TPtrC toFilename, fromFilename;
1912 if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
1913 || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
1914 return EInconclusive;
1916 //TMdaFileClipLocation toLocation(toFilename);
1917 //TMdaFileClipLocation fromLocation(fromFilename);
1918 iError = KErrTimedOut;
1920 CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
1921 CleanupStack::PushL(converter);
1923 if (iThisIsNegativeTest)
1925 iAudioSettings.iSampleRate = KInvalidNumber;
1926 iAudioSettings.iChannels = KInvalidNumber;
1927 //to keep CCover happy
1928 //converter->OpenL(&fromLocation, &toLocation,
1929 // KUidMdaWavPcmCodec, KUidMdaClipFormatAu, KFourCCNULL);
1930 converter->OpenL(fromFilename, toFilename) ;
1934 //converter->OpenL(&fromLocation, &toLocation,
1935 // KUidMmfAudioController, KUidMdaWavPcmCodec, TFourCC('A', 'L', 'A', 'W'));
1936 converter->OpenL(fromFilename, toFilename) ;
1939 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
1940 CActiveScheduler::Start();
1942 if (iError == KErrNone)
1943 ret = DoTestL(converter);
1946 INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
1948 if(iThisIsNegativeTest && iError == KErrNotSupported)
1953 CleanupStack::PopAndDestroy(converter);
1954 User::After(KOneSecond);
1961 * Conversion stoping.
1963 TVerdict CTestMmfAclntConvertStop::DoTestL(CMdaAudioConvertUtility* aConvert)
1965 INFO_PRINTF1( _L("TestConvert : Stop"));
1967 TRAP(iError, aConvert->ConvertL()) ;
1969 if(iError != KErrNone)
1972 CActiveScheduler::Start();
1975 CActiveScheduler::Start();
1980 //------------------------------------------------------------------
1985 CTestMmfAclntConvertDes::CTestMmfAclntConvertDes(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
1987 // store the name of this test case
1988 // this is the name that is used by the script file
1989 // Each test step initialises it's own name
1990 iTestStepName = aTestName;
1991 iSectName = aSectName;
1992 iKeyName = aKeyName;
1993 iTestFormat = aFormat;
1994 iCreateDes = aCreateDes;
1998 iHeapSize = 0x20000;
2001 CTestMmfAclntConvertDes* CTestMmfAclntConvertDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat,const TBool aCreateDes)
2003 CTestMmfAclntConvertDes* self = new (ELeave) CTestMmfAclntConvertDes(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
2007 CTestMmfAclntConvertDes* CTestMmfAclntConvertDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
2009 CTestMmfAclntConvertDes* self = CTestMmfAclntConvertDes::NewLC(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
2010 CleanupStack::PushL(self);
2014 void CTestMmfAclntConvertDes::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
2016 iError = aErrorCode;
2017 INFO_PRINTF4( _L("MMdaObjectStateChangeObserver: previous state: %d current state: %d error: %d"),aPreviousState, aCurrentState, aErrorCode);
2018 CActiveScheduler::Stop();
2021 TVerdict CTestMmfAclntConvertDes::DoTestStepPreambleL()
2024 SetupFormatL(iTestFormat);
2029 // Connect to file server
2030 User::LeaveIfError(fs.Connect());
2032 // get the filename from the config (.ini) file
2033 TBuf<KSizeBuf> filename;
2035 if(!GetStringFromConfig(iSectName, iKeyName, filename1))
2036 return EInconclusive;
2037 GetDriveName(filename);
2038 filename.Append(filename1);
2040 // opem the file to see if it exists and get the size
2041 User::LeaveIfError(file.Open(fs,filename,EFileRead));
2042 CleanupClosePushL(file);
2044 User::LeaveIfError(file.Size(iSize));
2045 INFO_PRINTF2(_L("size of file is %d\n"),iSize);
2047 // read the file into a descriptor and use CWavDecodeUtility
2048 // to examine the WAV file to get the data length etc.
2049 HBufC8* imageData = HBufC8::NewLC(iSize);
2050 TPtr8 imageDataPtr(imageData->Des());
2051 User::LeaveIfError(file.Read(imageDataPtr));
2053 CWavDecodeUtility* decodeUtility = CWavDecodeUtility::NewL(imageDataPtr);
2054 CleanupStack::PushL(decodeUtility);
2056 iDataLengthSource = decodeUtility->GetDataLength();
2057 iSamples = decodeUtility->GetSamples();
2058 iChannels = decodeUtility->GetChannels();
2060 INFO_PRINTF2( _L("Sample Rate = %d"), decodeUtility->GetSampleRate());
2062 INFO_PRINTF2( _L("Data length = %d"), iDataLengthSource);
2063 INFO_PRINTF2( _L("Channels = %d"), iChannels);
2064 INFO_PRINTF2( _L("Num of samples = %d"), iSamples);
2066 CleanupStack::PopAndDestroy(3,&file); // decodeUtility, imageData, file
2068 switch (iTestFormat)
2071 iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
2073 iFileSizeSink = KWavFileUncompressedDataHeaderSize + iSamples * iChannels * 16 /*BitsPerSample*/ / 8;
2077 iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
2079 iFileSizeSink = KWavFileUncompressedDataHeaderSize + iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
2083 iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
2085 iFileSizeSink = KWavFileUncompressedDataHeaderSize + iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
2090 iHeaderSize = KWavFileCompressedDataHeaderSize + KImaAdpcmFactChunkSize;
2097 iFileSizeSink = iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
2103 iFileSizeSink = iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
2109 iFileSizeSink = iSamples * iChannels * 16 /*BitsPerSample*/ / 8;
2113 iHeaderSize = KWavFileCompressedDataHeaderSize + KGSMFactChunkSize;
2118 iHeaderSize = KAuFileUncompressedDataHeaderSize;
2120 iFileSizeSink = iHeaderSize + iSamples * iChannels * 16 /*BitsPerSample*/ / 8;
2129 return CTestMmfAclntStep::DoTestStepPreambleL();
2132 TVerdict CTestMmfAclntConvertDes::DoTestStepPostambleL()
2135 return CTestMmfAclntStep::DoTestStepPostambleL();
2138 void CTestMmfAclntConvertDes::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration)
2141 iDuration = aDuration;
2142 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete"));
2143 CActiveScheduler::Stop();
2146 void CTestMmfAclntConvertDes::MapcPlayComplete(TInt aError)
2149 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete"));
2150 CActiveScheduler::Stop();
2154 * Open a descriptor and Convertord
2156 TVerdict CTestMmfAclntConvertDes::DoTestStepL( void )
2158 INFO_PRINTF1( _L("TestConvertor : Convert Des"));
2159 TVerdict ret = EPass;
2160 HBufC8* audioTo = NULL;
2161 TMdaDesClipLocation* toLocation = NULL;
2163 CMdaAudioConvertUtility* ConvertUtil = CMdaAudioConvertUtility::NewL(*this);
2164 CleanupStack::PushL(ConvertUtil);
2166 TBuf<KSizeBuf> filename;
2168 if(!GetStringFromConfig(iSectName, iKeyName, filename1))
2169 return EInconclusive;
2170 GetDriveName(filename);
2171 filename.Append(filename1);
2172 //output buffer 2 much than input one
2173 audioTo = HBufC8::NewMaxLC(iSize*2);
2174 TPtr8 toBufferDes(audioTo->Des());
2175 toBufferDes.SetLength(0);
2177 toLocation = new (ELeave) TMdaDesClipLocation(toBufferDes);
2178 CleanupStack::PushL(toLocation);
2180 ConvertUtil->OpenL(filename, toLocation,
2183 iError = KErrTimedOut;
2185 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
2186 CActiveScheduler::Start();
2188 if(iError == KErrNone)
2190 iError = KErrTimedOut;
2191 ConvertUtil->ConvertL();
2192 INFO_PRINTF1( _L("Convertord CMdaAudioConvertUtility"));
2193 CActiveScheduler::Start(); // open->Convertord
2195 if (iError == KErrNone)
2197 // wait to run out of space Convertording
2198 CActiveScheduler::Start();
2200 if(iError == KErrNone)
2202 INFO_PRINTF3(_L("Length %d, expected = %d"), audioTo->Length(), iFileSizeSink);
2203 // compare length with expected
2204 if (iFileSizeSink > 0)
2206 //is it a good size?
2207 if((audioTo->Length()) != (static_cast<TInt> (iFileSizeSink)) )
2214 ret = EInconclusive;
2217 // For good measure,
2218 // check the validity of the conversion by comparing duration
2219 // with original file - but not for raw files
2220 if (iHeaderSize > 0)
2222 CMdaAudioPlayerUtility* player = NULL;
2223 player = CMdaAudioPlayerUtility::NewDesPlayerL(*audioTo, *this);
2224 CleanupStack::PushL(player);
2226 // Wait for init callback
2227 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility"));
2228 CActiveScheduler::Start();
2231 // Wait for play complete callback
2232 INFO_PRINTF1( _L("CMdaAudioPlayerUtility::Play()"));
2233 CActiveScheduler::Start();
2235 INFO_PRINTF3( _L("Duration = %ld, expected = %ld"), I64LOW(player->Duration().Int64()), I64LOW(ConvertUtil->Duration().Int64()));
2237 if (iError != KErrNone)
2239 ERR_PRINTF2( _L("Play failed with error : %d"),iError);
2242 else if (ConvertUtil->Duration() != player->Duration())
2244 ERR_PRINTF3( _L("Actual Duration : %ld does not match the Expected Duration : %ld"),player->Duration().Int64(), ConvertUtil->Duration().Int64());
2248 CleanupStack::PopAndDestroy(player);
2254 #if defined __WRITE_CONVERSION_TO_FILE
2256 _LIT(KFileOutRaw, "\\TEST.AU");
2261 file.Replace(fs, KFileOutRaw(), EFileWrite);
2262 file.Write(audioTo->Des());
2263 TInt len = audioTo->Length();
2270 ERR_PRINTF2( _L("CMdaAudioConvertorderUtility failed with error %d"),iError );
2272 CleanupStack::PopAndDestroy(toLocation);
2273 CleanupStack::PopAndDestroy(audioTo);
2274 CleanupStack::PopAndDestroy(ConvertUtil);
2276 User::After(KOneSecond);
2280 //---------------------------------------------------------------------
2284 CTestMmfAclntConvertUrl::CTestMmfAclntConvertUrl(const TDesC& aTestName, TBool aNegative)
2285 :CTestMmfAclntConConfig(aTestName, EAlawWav, aNegative)
2288 CTestMmfAclntConvertUrl* CTestMmfAclntConvertUrl::NewL(const TDesC& aTestName, TBool aNegative)
2290 CTestMmfAclntConvertUrl* self = new (ELeave) CTestMmfAclntConvertUrl(aTestName,aNegative);
2297 TVerdict CTestMmfAclntConvertUrl::DoTestStepL()
2299 INFO_PRINTF1( _L("TestConvert : Urls"));
2300 TVerdict ret = EFail;
2301 TMdaUrlClipLocation* toLocation = new (ELeave)
2302 TMdaUrlClipLocation(_L("http://www.symbian.com"),KUseDefaultIap);
2303 CleanupStack::PushL(toLocation);
2305 CMdaAudioConvertUtility* ConvertUtil = CMdaAudioConvertUtility::NewL(*this);
2306 CleanupStack::PushL(ConvertUtil);
2308 TBuf<KSizeBuf> fromFileName;
2309 TPtrC pFromFileName;
2310 if(!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), pFromFileName))
2311 return EInconclusive;
2312 GetDriveName(fromFileName);
2313 fromFileName.Append(pFromFileName);
2315 TRAP(iError, ConvertUtil->OpenL(fromFileName, toLocation, iFormat, iCodec)) ;
2316 if(iError == KErrNone)
2318 //should not work for time being
2319 iError = KErrTimedOut;
2320 INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
2321 CActiveScheduler::Start();
2322 if(iError == KErrNotSupported)
2327 TRAP(iError, ConvertUtil->ConvertL()) ;
2328 if(iError != KErrNone)
2330 ERR_PRINTF2(_L("Convert left with error = %d"),iError);
2334 CActiveScheduler::Start();
2335 if(iError == KErrNotSupported)
2338 //CActiveScheduler::Start();
2340 else if(iError == KErrNotSupported)
2343 ERR_PRINTF2(_L("OpenL left with error = %d. It's OK for now!"),iError);
2347 CleanupStack::PopAndDestroy(ConvertUtil);
2348 CleanupStack::PopAndDestroy(toLocation);