sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// This program is designed the test of the MMF_ACLNT.
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file TestConverter.cpp
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "TestConverter.h"
|
sl@0
|
23 |
#include "mmfwavformat.h"
|
sl@0
|
24 |
#include <mmfformatimplementationuids.hrh>
|
sl@0
|
25 |
#include <mdaaudiosampleplayer.h>
|
sl@0
|
26 |
#include "WavDecodeUtility.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
// from "mmfauformat.h" :
|
sl@0
|
29 |
const TUint KAuFileUncompressedDataHeaderSize = 24 ; // 6 times 4 byte quantities
|
sl@0
|
30 |
|
sl@0
|
31 |
_LIT(KAclntConConfigKeyName, "configAudio");
|
sl@0
|
32 |
_LIT(KAclntConDurationKeyName, "configAudio2");
|
sl@0
|
33 |
_LIT(KAclntConPositionKeyName, "configAudio3");
|
sl@0
|
34 |
_LIT(KAclntConQueryKeyName, "configAudio4");
|
sl@0
|
35 |
_LIT(KAclntConDestBitRateKeyName, "configAudio5");
|
sl@0
|
36 |
_LIT(KAclntConDestSampleRateKeyName, "configAudio6");
|
sl@0
|
37 |
_LIT(KAclntConDestNumberChannelsKeyName, "configAudio7");
|
sl@0
|
38 |
_LIT(KAclntConDestDataTypeKeyName, "configAudio8");
|
sl@0
|
39 |
_LIT(KAclntConDestFormatKeyName, "configAudio9");
|
sl@0
|
40 |
_LIT(KAclntConSourceInfoKeyName, "configAudio10");
|
sl@0
|
41 |
|
sl@0
|
42 |
|
sl@0
|
43 |
/**
|
sl@0
|
44 |
* Constructor
|
sl@0
|
45 |
*/
|
sl@0
|
46 |
CTestMmfAclntDoConv::CTestMmfAclntDoConv(const TDesC& aTestName, const TDesC& aSectName,
|
sl@0
|
47 |
const TDesC& aKeyName,
|
sl@0
|
48 |
const TDesC& aSectName2, const TDesC& aKeyName2,
|
sl@0
|
49 |
TInt aBits,
|
sl@0
|
50 |
FormatSpec aFormat)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
// store the name of this test case
|
sl@0
|
53 |
// this is the name that is used by the script file
|
sl@0
|
54 |
// Each test step initialises it's own name
|
sl@0
|
55 |
iTestStepName = aTestName;
|
sl@0
|
56 |
iSectName = aSectName;
|
sl@0
|
57 |
iKeyName = aKeyName;
|
sl@0
|
58 |
iSectName2 = aSectName2;
|
sl@0
|
59 |
iKeyName2 = aKeyName2;
|
sl@0
|
60 |
iBits = aBits;
|
sl@0
|
61 |
iFormat = aFormat;
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
CTestMmfAclntDoConv* CTestMmfAclntDoConv::NewL(const TDesC& aTestName, const TDesC& aSectName,
|
sl@0
|
65 |
const TDesC& aKeyName, const TDesC& aSectName2,
|
sl@0
|
66 |
const TDesC& aKeyName2,
|
sl@0
|
67 |
TInt aBits,
|
sl@0
|
68 |
FormatSpec aFormat)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
CTestMmfAclntDoConv* self = new (ELeave) CTestMmfAclntDoConv(aTestName, aSectName, aKeyName, aSectName2, aKeyName2, aBits, aFormat);
|
sl@0
|
71 |
return self;
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
void CTestMmfAclntDoConv::MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
sl@0
|
75 |
{
|
sl@0
|
76 |
iError = aErrorCode;
|
sl@0
|
77 |
iObject = aObject;
|
sl@0
|
78 |
iPreviousState = aPreviousState;
|
sl@0
|
79 |
iCurrentState = aCurrentState;
|
sl@0
|
80 |
INFO_PRINTF1( _L("CTestMmfAclntDoConv : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
|
sl@0
|
81 |
INFO_PRINTF4( _L("iError %d iPreviousState %d iCurrentState %d"), iError, iPreviousState, iCurrentState);
|
sl@0
|
82 |
CActiveScheduler::Stop();
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
TVerdict CTestMmfAclntDoConv::DoTestStepL()
|
sl@0
|
86 |
{
|
sl@0
|
87 |
INFO_PRINTF1( _L("TestConverter : Do Convert"));
|
sl@0
|
88 |
|
sl@0
|
89 |
TVerdict ret = EFail;
|
sl@0
|
90 |
|
sl@0
|
91 |
TBuf<KSizeBuf> filename1;
|
sl@0
|
92 |
TPtrC filename11, filename2;
|
sl@0
|
93 |
if ((!GetStringFromConfig(iSectName, iKeyName, filename11)) ||
|
sl@0
|
94 |
(!GetStringFromConfig( iSectName2, iKeyName2, filename2)))
|
sl@0
|
95 |
return EInconclusive;
|
sl@0
|
96 |
|
sl@0
|
97 |
GetDriveName(filename1);
|
sl@0
|
98 |
filename1.Append(filename11);
|
sl@0
|
99 |
|
sl@0
|
100 |
|
sl@0
|
101 |
//delete previos output file
|
sl@0
|
102 |
RFs theFs;
|
sl@0
|
103 |
User::LeaveIfError(theFs.Connect());
|
sl@0
|
104 |
theFs.Delete(filename2);
|
sl@0
|
105 |
theFs.MkDirAll(filename2);
|
sl@0
|
106 |
|
sl@0
|
107 |
theFs.Close();
|
sl@0
|
108 |
|
sl@0
|
109 |
|
sl@0
|
110 |
TMdaUL16RawAudioCodec theCodecUnsupported;
|
sl@0
|
111 |
|
sl@0
|
112 |
TMdaPcmWavCodec theCodecWav8Bit(TMdaPcmWavCodec::E8BitPcm);
|
sl@0
|
113 |
TMdaPcmWavCodec theCodecWav16Bit(TMdaPcmWavCodec::E16BitPcm);
|
sl@0
|
114 |
|
sl@0
|
115 |
TMdaPackage* theCodec = NULL;
|
sl@0
|
116 |
switch(iBits)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
case 0: theCodec = &theCodecWav8Bit; break;
|
sl@0
|
119 |
case 1: theCodec = &theCodecWav16Bit; break;
|
sl@0
|
120 |
case -1: theCodec = &theCodecUnsupported; break;
|
sl@0
|
121 |
default: break;
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
if(theCodec == NULL)
|
sl@0
|
125 |
return EInconclusive;
|
sl@0
|
126 |
|
sl@0
|
127 |
iError = KErrTimedOut;
|
sl@0
|
128 |
|
sl@0
|
129 |
CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
130 |
CleanupStack::PushL(converter);
|
sl@0
|
131 |
|
sl@0
|
132 |
TMdaFileClipLocation theLocation(filename2);
|
sl@0
|
133 |
TMdaWavClipFormat theMdaFormat;
|
sl@0
|
134 |
TMmfAclntWavEncodeClipFormat theMmfFormat;
|
sl@0
|
135 |
TMdaClipFormat* useFormat;
|
sl@0
|
136 |
|
sl@0
|
137 |
if(iFormat == MdaFormatSpec)
|
sl@0
|
138 |
useFormat = &theMdaFormat;
|
sl@0
|
139 |
else
|
sl@0
|
140 |
useFormat = &theMmfFormat;
|
sl@0
|
141 |
|
sl@0
|
142 |
converter->OpenL(filename1,
|
sl@0
|
143 |
&theLocation, // Normally file or descriptor
|
sl@0
|
144 |
useFormat,
|
sl@0
|
145 |
theCodec);
|
sl@0
|
146 |
|
sl@0
|
147 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
148 |
CActiveScheduler::Start();
|
sl@0
|
149 |
|
sl@0
|
150 |
if(iError == KErrNone)
|
sl@0
|
151 |
ret = DoTestL(converter);
|
sl@0
|
152 |
else if(iError != KErrNone && iBits == -1)
|
sl@0
|
153 |
ret = EPass;
|
sl@0
|
154 |
|
sl@0
|
155 |
if (iError != KErrNone)
|
sl@0
|
156 |
ERR_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
|
sl@0
|
157 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
158 |
User::After(KOneSecond);
|
sl@0
|
159 |
return ret;
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
TVerdict CTestMmfAclntDoConv::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
TVerdict ret = EFail;
|
sl@0
|
165 |
|
sl@0
|
166 |
iError = KErrTimedOut;
|
sl@0
|
167 |
|
sl@0
|
168 |
// Convert 44100 -> 8000 sample rate
|
sl@0
|
169 |
const TUint KAclntDestSampleRate = 8000;
|
sl@0
|
170 |
aConverter->SetDestinationSampleRateL(KAclntDestSampleRate);
|
sl@0
|
171 |
|
sl@0
|
172 |
// Output as AU file
|
sl@0
|
173 |
aConverter->SetDestinationFormatL(TUid::Uid(KMmfUidFormatAUWrite));
|
sl@0
|
174 |
|
sl@0
|
175 |
aConverter->ConvertL();
|
sl@0
|
176 |
|
sl@0
|
177 |
INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
|
sl@0
|
178 |
CActiveScheduler::Start();
|
sl@0
|
179 |
|
sl@0
|
180 |
// XXX Improve test. e.g. check that a valid AU file is written
|
sl@0
|
181 |
if(iError == KErrNone)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
ret = EPass;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
else
|
sl@0
|
186 |
{
|
sl@0
|
187 |
INFO_PRINTF2(_L("Error returned in MoscoStateChangeEvent callback: %d"), iError);
|
sl@0
|
188 |
ret = EFail;
|
sl@0
|
189 |
}
|
sl@0
|
190 |
|
sl@0
|
191 |
if (ret == EPass)
|
sl@0
|
192 |
{
|
sl@0
|
193 |
CActiveScheduler::Start();
|
sl@0
|
194 |
|
sl@0
|
195 |
// XXX Improve test. e.g. check that a valid AU file is written
|
sl@0
|
196 |
if(iError == KErrNone)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
ret = EPass;
|
sl@0
|
199 |
}
|
sl@0
|
200 |
else
|
sl@0
|
201 |
{
|
sl@0
|
202 |
INFO_PRINTF2(_L("Error returned in MoscoStateChangeEvent callback: %d"), iError);
|
sl@0
|
203 |
ret = EFail;
|
sl@0
|
204 |
}
|
sl@0
|
205 |
}
|
sl@0
|
206 |
|
sl@0
|
207 |
return ret;
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
//------------------------------------------------------------------
|
sl@0
|
211 |
|
sl@0
|
212 |
/**
|
sl@0
|
213 |
* Constructor
|
sl@0
|
214 |
*/
|
sl@0
|
215 |
CTestMmfAclntConCloseOpen::CTestMmfAclntConCloseOpen(const TDesC& aTestName)
|
sl@0
|
216 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav, EFalse)
|
sl@0
|
217 |
{}
|
sl@0
|
218 |
|
sl@0
|
219 |
CTestMmfAclntConCloseOpen* CTestMmfAclntConCloseOpen::NewL(const TDesC& aTestName)
|
sl@0
|
220 |
{
|
sl@0
|
221 |
CTestMmfAclntConCloseOpen* self = new (ELeave) CTestMmfAclntConCloseOpen(aTestName);
|
sl@0
|
222 |
return self;
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
/**
|
sl@0
|
226 |
* Open source and destination audio. Close them and open a new source and destination.
|
sl@0
|
227 |
*/
|
sl@0
|
228 |
TVerdict CTestMmfAclntConCloseOpen::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
229 |
{
|
sl@0
|
230 |
INFO_PRINTF1( _L("TestConverter : Close/Open"));
|
sl@0
|
231 |
|
sl@0
|
232 |
TVerdict ret = EFail;
|
sl@0
|
233 |
|
sl@0
|
234 |
SetupFormatL(iTestFormat);
|
sl@0
|
235 |
|
sl@0
|
236 |
|
sl@0
|
237 |
TPtrC toFilename, fromFilename;
|
sl@0
|
238 |
if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename)) || (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
|
sl@0
|
239 |
return EInconclusive;
|
sl@0
|
240 |
|
sl@0
|
241 |
|
sl@0
|
242 |
TMdaFileClipLocation location(toFilename);
|
sl@0
|
243 |
|
sl@0
|
244 |
iError = KErrTimedOut;
|
sl@0
|
245 |
aConverter->Close();
|
sl@0
|
246 |
|
sl@0
|
247 |
iError = KErrTimedOut;
|
sl@0
|
248 |
aConverter->OpenL(fromFilename, &location, iFormat, iCodec, NULL);
|
sl@0
|
249 |
|
sl@0
|
250 |
// wait for open
|
sl@0
|
251 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
252 |
CActiveScheduler::Start();
|
sl@0
|
253 |
|
sl@0
|
254 |
if(iError == KErrNone)
|
sl@0
|
255 |
ret = EPass;
|
sl@0
|
256 |
|
sl@0
|
257 |
return ret;
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
//------------------------------------------------------------------
|
sl@0
|
261 |
|
sl@0
|
262 |
/**
|
sl@0
|
263 |
* Constructor
|
sl@0
|
264 |
*/
|
sl@0
|
265 |
CTestMmfAclntConWindow::CTestMmfAclntConWindow(const TDesC& aTestName)
|
sl@0
|
266 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav, EFalse)
|
sl@0
|
267 |
{}
|
sl@0
|
268 |
|
sl@0
|
269 |
CTestMmfAclntConWindow* CTestMmfAclntConWindow::NewL(const TDesC& aTestName)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
CTestMmfAclntConWindow* self = new (ELeave) CTestMmfAclntConWindow(aTestName);
|
sl@0
|
272 |
return self;
|
sl@0
|
273 |
}
|
sl@0
|
274 |
|
sl@0
|
275 |
/**
|
sl@0
|
276 |
* Set convert window. Enquire window. Delete window
|
sl@0
|
277 |
*/
|
sl@0
|
278 |
TVerdict CTestMmfAclntConWindow::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
INFO_PRINTF1( _L("*** Converter set window test\n"));
|
sl@0
|
281 |
|
sl@0
|
282 |
TVerdict ret = EFail;
|
sl@0
|
283 |
TInt64 temp1, temp2;
|
sl@0
|
284 |
|
sl@0
|
285 |
temp1 = aConverter->Duration().Int64()/4; // set start at first quarter of clip
|
sl@0
|
286 |
temp2 = TInt64(3) * (aConverter->Duration().Int64()/4); // set end at 3rd quarter of clip
|
sl@0
|
287 |
ASSERT(temp2 > temp1); // temp1 = start, temp2 = end
|
sl@0
|
288 |
|
sl@0
|
289 |
TInt windowDuration = (I64INT(temp2) - I64INT(temp1));
|
sl@0
|
290 |
|
sl@0
|
291 |
TTimeIntervalMicroSeconds endTime(temp2);
|
sl@0
|
292 |
TTimeIntervalMicroSeconds startTime(temp1);
|
sl@0
|
293 |
|
sl@0
|
294 |
INFO_PRINTF4(_L("StartTime = %d EndTime = %d WindowDuration = %d"),
|
sl@0
|
295 |
I64INT(startTime.Int64()), I64INT(endTime.Int64()), windowDuration);
|
sl@0
|
296 |
aConverter->SetPlayWindow(startTime,endTime);
|
sl@0
|
297 |
|
sl@0
|
298 |
|
sl@0
|
299 |
TRAP(iError,aConverter->SetDestinationNumberOfChannelsL(1));
|
sl@0
|
300 |
if (iError != KErrNone)
|
sl@0
|
301 |
return ret ;
|
sl@0
|
302 |
|
sl@0
|
303 |
iError = KErrTimedOut;
|
sl@0
|
304 |
INFO_PRINTF1( _L("CMdaAudioConvertUtility::ConvertL"));
|
sl@0
|
305 |
aConverter->ConvertL();
|
sl@0
|
306 |
|
sl@0
|
307 |
|
sl@0
|
308 |
CActiveScheduler::Start(); // initial MoscoStateChangeEvent callback
|
sl@0
|
309 |
if (iError == KErrNone)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
CActiveScheduler::Start(); // conversion starts here
|
sl@0
|
312 |
|
sl@0
|
313 |
if (iError == KErrNone)
|
sl@0
|
314 |
{
|
sl@0
|
315 |
// Check file size is as expected
|
sl@0
|
316 |
TPtrC filename;
|
sl@0
|
317 |
if (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), filename))
|
sl@0
|
318 |
{
|
sl@0
|
319 |
INFO_PRINTF1(_L("Error getting filename from ini file"));
|
sl@0
|
320 |
ret = EInconclusive;
|
sl@0
|
321 |
}
|
sl@0
|
322 |
else
|
sl@0
|
323 |
{
|
sl@0
|
324 |
ret = CheckFileSize(filename, KConverterWindowFileSize);
|
sl@0
|
325 |
}
|
sl@0
|
326 |
}
|
sl@0
|
327 |
}
|
sl@0
|
328 |
else
|
sl@0
|
329 |
{
|
sl@0
|
330 |
INFO_PRINTF2(_L("iError = %d"), iError);
|
sl@0
|
331 |
ret = EFail;
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
// Test clear window
|
sl@0
|
335 |
if (ret == EPass)
|
sl@0
|
336 |
{
|
sl@0
|
337 |
INFO_PRINTF1(_L("*** Converter clear window test\n"));
|
sl@0
|
338 |
iError = KErrTimedOut;
|
sl@0
|
339 |
aConverter->ClearPlayWindow();
|
sl@0
|
340 |
aConverter->ConvertL();
|
sl@0
|
341 |
|
sl@0
|
342 |
CActiveScheduler::Start(); // initial MoscoStateChangeEvent callback
|
sl@0
|
343 |
if (iError == KErrNone)
|
sl@0
|
344 |
{
|
sl@0
|
345 |
CActiveScheduler::Start(); // conversion starts here
|
sl@0
|
346 |
|
sl@0
|
347 |
if (iError == KErrNone)
|
sl@0
|
348 |
{
|
sl@0
|
349 |
TPtrC filename;
|
sl@0
|
350 |
if (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), filename))
|
sl@0
|
351 |
{
|
sl@0
|
352 |
INFO_PRINTF1(_L("Error getting filename from ini file"));
|
sl@0
|
353 |
ret = EInconclusive;
|
sl@0
|
354 |
}
|
sl@0
|
355 |
else
|
sl@0
|
356 |
{
|
sl@0
|
357 |
// Second convert will be appended to the first
|
sl@0
|
358 |
ret = CheckFileSize(filename, KConverterWindowPlusNormalFileSize);
|
sl@0
|
359 |
}
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
else
|
sl@0
|
363 |
{
|
sl@0
|
364 |
INFO_PRINTF2(_L("iError = %d"), iError);
|
sl@0
|
365 |
ret = EFail;
|
sl@0
|
366 |
}
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
return ret;
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
TVerdict CTestMmfAclntConWindow::CheckFileSize(const TDesC& aFilename, const TInt aExpectedSize)
|
sl@0
|
373 |
{
|
sl@0
|
374 |
TVerdict verdict = EFail;
|
sl@0
|
375 |
RFile file;
|
sl@0
|
376 |
RFs fs;
|
sl@0
|
377 |
|
sl@0
|
378 |
TInt ret = fs.Connect();
|
sl@0
|
379 |
if (ret != KErrNone)
|
sl@0
|
380 |
{
|
sl@0
|
381 |
INFO_PRINTF1(_L("Error opening file system!"));
|
sl@0
|
382 |
return EInconclusive;
|
sl@0
|
383 |
}
|
sl@0
|
384 |
|
sl@0
|
385 |
// Check file size matches expected size
|
sl@0
|
386 |
TInt err = file.Open(fs, aFilename, EFileRead);
|
sl@0
|
387 |
if (err != KErrNone)
|
sl@0
|
388 |
{
|
sl@0
|
389 |
INFO_PRINTF2(_L("Error opening converted file (%d)"), err);
|
sl@0
|
390 |
verdict = EInconclusive;
|
sl@0
|
391 |
}
|
sl@0
|
392 |
else
|
sl@0
|
393 |
{
|
sl@0
|
394 |
TInt size = 0;
|
sl@0
|
395 |
err = file.Size(size);
|
sl@0
|
396 |
if (err != KErrNone || size != aExpectedSize)
|
sl@0
|
397 |
{
|
sl@0
|
398 |
if (err != KErrNone)
|
sl@0
|
399 |
INFO_PRINTF2(_L("Error getting file size (%d)"), err);
|
sl@0
|
400 |
else
|
sl@0
|
401 |
INFO_PRINTF3(_L("Converted file size incorrect (expected %d, got %d)"), aExpectedSize, size);
|
sl@0
|
402 |
verdict = EFail;
|
sl@0
|
403 |
}
|
sl@0
|
404 |
else
|
sl@0
|
405 |
{
|
sl@0
|
406 |
INFO_PRINTF1(_L("Converted file size as expected (test passed)"));
|
sl@0
|
407 |
verdict = EPass;
|
sl@0
|
408 |
}
|
sl@0
|
409 |
file.Close();
|
sl@0
|
410 |
}
|
sl@0
|
411 |
fs.Close();
|
sl@0
|
412 |
|
sl@0
|
413 |
return verdict;
|
sl@0
|
414 |
}
|
sl@0
|
415 |
|
sl@0
|
416 |
//------------------------------------------------------------------
|
sl@0
|
417 |
|
sl@0
|
418 |
/**
|
sl@0
|
419 |
* Constructor
|
sl@0
|
420 |
*/
|
sl@0
|
421 |
CTestMmfAclntConDuration::CTestMmfAclntConDuration(const TDesC& aTestName)
|
sl@0
|
422 |
:CTestMmfAclntConConfig(aTestName,EPcm16Wav, EFalse)
|
sl@0
|
423 |
{}
|
sl@0
|
424 |
|
sl@0
|
425 |
CTestMmfAclntConDuration* CTestMmfAclntConDuration::NewL(const TDesC& aTestName)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
CTestMmfAclntConDuration* self = new (ELeave) CTestMmfAclntConDuration(aTestName);
|
sl@0
|
428 |
return self;
|
sl@0
|
429 |
}
|
sl@0
|
430 |
|
sl@0
|
431 |
void CTestMmfAclntConDuration::GetKeyName(TDes& aDes)
|
sl@0
|
432 |
{
|
sl@0
|
433 |
aDes = KAclntConDurationKeyName;
|
sl@0
|
434 |
}
|
sl@0
|
435 |
|
sl@0
|
436 |
/** Enquire duration
|
sl@0
|
437 |
*/
|
sl@0
|
438 |
TVerdict CTestMmfAclntConDuration::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
439 |
{
|
sl@0
|
440 |
INFO_PRINTF1( _L("TestConverter : Duration"));
|
sl@0
|
441 |
TVerdict ret = EFail;
|
sl@0
|
442 |
|
sl@0
|
443 |
TTimeIntervalMicroSeconds duration(KSoundFileLength); // 8 second sound file!
|
sl@0
|
444 |
//since format+codec have wrrong default values
|
sl@0
|
445 |
TRAP(iError,aConverter->SetDestinationSampleRateL(8000));
|
sl@0
|
446 |
TRAP(iError,aConverter->SetDestinationNumberOfChannelsL(1));
|
sl@0
|
447 |
//TRAP(iError,aConverter->ConvertL());
|
sl@0
|
448 |
|
sl@0
|
449 |
if(KErrNone == iError && (aConverter->Duration() == duration))
|
sl@0
|
450 |
{
|
sl@0
|
451 |
INFO_PRINTF3(_L("Duration = %f mkS Record time = %f mkS"),
|
sl@0
|
452 |
I64REAL(duration.Int64()),
|
sl@0
|
453 |
I64REAL(aConverter->RecordTimeAvailable().Int64()));
|
sl@0
|
454 |
ret = EPass;
|
sl@0
|
455 |
}
|
sl@0
|
456 |
else
|
sl@0
|
457 |
{
|
sl@0
|
458 |
TInt64 durationExpected = duration.Int64();
|
sl@0
|
459 |
|
sl@0
|
460 |
TInt64 durationReceived = aConverter->Duration().Int64();
|
sl@0
|
461 |
INFO_PRINTF3( _L("Expected duration: %f, received duration: %f"), I64REAL(durationExpected), I64REAL(durationReceived));
|
sl@0
|
462 |
|
sl@0
|
463 |
}
|
sl@0
|
464 |
return ret;
|
sl@0
|
465 |
}
|
sl@0
|
466 |
|
sl@0
|
467 |
void CTestMmfAclntConDuration::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode)
|
sl@0
|
468 |
{
|
sl@0
|
469 |
iError = aErrorCode;
|
sl@0
|
470 |
INFO_PRINTF1( _L("CTestMmfAclntDelete : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
|
sl@0
|
471 |
INFO_PRINTF2( _L("iError %d"), iError);
|
sl@0
|
472 |
CActiveScheduler::Stop();
|
sl@0
|
473 |
}
|
sl@0
|
474 |
|
sl@0
|
475 |
//------------------------------------------------------------------
|
sl@0
|
476 |
|
sl@0
|
477 |
/**
|
sl@0
|
478 |
* Constructor
|
sl@0
|
479 |
*/
|
sl@0
|
480 |
CTestMmfAclntConPosition::CTestMmfAclntConPosition(const TDesC& aTestName,const TTimeIntervalMicroSeconds aPosition)
|
sl@0
|
481 |
:CTestMmfAclntConConfig(aTestName,EPcm16Wav, EFalse)
|
sl@0
|
482 |
{
|
sl@0
|
483 |
iPosition = aPosition;
|
sl@0
|
484 |
}
|
sl@0
|
485 |
|
sl@0
|
486 |
CTestMmfAclntConPosition* CTestMmfAclntConPosition::NewL(const TDesC& aTestName,const TTimeIntervalMicroSeconds aPosition)
|
sl@0
|
487 |
{
|
sl@0
|
488 |
CTestMmfAclntConPosition* self = new (ELeave) CTestMmfAclntConPosition(aTestName, aPosition);
|
sl@0
|
489 |
return self;
|
sl@0
|
490 |
}
|
sl@0
|
491 |
|
sl@0
|
492 |
void CTestMmfAclntConPosition::GetKeyName(TDes& aDes)
|
sl@0
|
493 |
{
|
sl@0
|
494 |
aDes = KAclntConPositionKeyName;
|
sl@0
|
495 |
}
|
sl@0
|
496 |
|
sl@0
|
497 |
/**
|
sl@0
|
498 |
* Set position and enquire position. Sound is always set to minus one
|
sl@0
|
499 |
* frame, becuase DevSound has to play something. (Even if set to the end of the clip).
|
sl@0
|
500 |
*
|
sl@0
|
501 |
*/
|
sl@0
|
502 |
TVerdict CTestMmfAclntConPosition::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
503 |
{
|
sl@0
|
504 |
INFO_PRINTF1( _L("TestConverter : Position"));
|
sl@0
|
505 |
TVerdict ret = EFail;
|
sl@0
|
506 |
|
sl@0
|
507 |
// Set position: middle of clip.
|
sl@0
|
508 |
if (I64INT(iPosition.Int64()) == 0)
|
sl@0
|
509 |
iPosition = I64INT(aConverter->Duration().Int64())/2;
|
sl@0
|
510 |
// Set position: end of clip.
|
sl@0
|
511 |
if (I64INT(iPosition.Int64()) == -1)
|
sl@0
|
512 |
iPosition = aConverter->Duration();
|
sl@0
|
513 |
|
sl@0
|
514 |
// Position is beyond the end of the clips duration.
|
sl@0
|
515 |
// so check that the value is clipped.
|
sl@0
|
516 |
if(aConverter->Duration() < iPosition)
|
sl@0
|
517 |
{
|
sl@0
|
518 |
TInt64 temp = (aConverter->Duration().Int64() / KPcm16FrameInterval) - 1; // -1 for DevSound
|
sl@0
|
519 |
aConverter->SetPosition(iPosition);
|
sl@0
|
520 |
|
sl@0
|
521 |
TInt64 theReceived = aConverter->Position().Int64();
|
sl@0
|
522 |
TInt64 theExpected = temp * KPcm16FrameInterval;
|
sl@0
|
523 |
|
sl@0
|
524 |
TBool theRes = TimeComparison(I64INT(theReceived), I64INT(theExpected), KExpectedDeviation);
|
sl@0
|
525 |
|
sl@0
|
526 |
if(theRes == (TBool) ETrue)
|
sl@0
|
527 |
ret = EPass;
|
sl@0
|
528 |
INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
|
sl@0
|
529 |
}
|
sl@0
|
530 |
// Position is before the beginning of the clip
|
sl@0
|
531 |
// so check that the value is zero
|
sl@0
|
532 |
else if(iPosition < TTimeIntervalMicroSeconds(0))
|
sl@0
|
533 |
{
|
sl@0
|
534 |
TInt theExpected = 0;
|
sl@0
|
535 |
aConverter->SetPosition(iPosition);
|
sl@0
|
536 |
TInt theReceived = I64INT(aConverter->Position().Int64());
|
sl@0
|
537 |
TBool theRes = TimeComparison(theReceived, theExpected, 0);
|
sl@0
|
538 |
if(theRes)
|
sl@0
|
539 |
ret = EPass;
|
sl@0
|
540 |
INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
|
sl@0
|
541 |
}
|
sl@0
|
542 |
else
|
sl@0
|
543 |
{
|
sl@0
|
544 |
|
sl@0
|
545 |
//Original
|
sl@0
|
546 |
/*
|
sl@0
|
547 |
aConverter->SetPosition(iPosition);
|
sl@0
|
548 |
aConverter->ConvertL();
|
sl@0
|
549 |
CActiveScheduler::Start();
|
sl@0
|
550 |
|
sl@0
|
551 |
TInt64 temp = (iPosition.Int64() / KPcm16FrameInterval) - 1; // -1 for DevSound
|
sl@0
|
552 |
|
sl@0
|
553 |
TInt theReceived = I64INT(aConverter->Position().Int64());
|
sl@0
|
554 |
TInt theExpected = I64INT(temp) * KPcm16FrameInterval;
|
sl@0
|
555 |
|
sl@0
|
556 |
TBool theRes = TimeComparison(theReceived, theExpected, KExpectedDeviation);
|
sl@0
|
557 |
|
sl@0
|
558 |
if(theRes == (TBool) ETrue)
|
sl@0
|
559 |
{
|
sl@0
|
560 |
ret = EPass;
|
sl@0
|
561 |
}
|
sl@0
|
562 |
INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
|
sl@0
|
563 |
*/
|
sl@0
|
564 |
|
sl@0
|
565 |
|
sl@0
|
566 |
//Amendment
|
sl@0
|
567 |
TInt theDurationa = I64INT(aConverter->Duration().Int64());
|
sl@0
|
568 |
|
sl@0
|
569 |
aConverter->SetPosition(iPosition);
|
sl@0
|
570 |
TInt theExpected = I64INT(aConverter->Position().Int64());
|
sl@0
|
571 |
|
sl@0
|
572 |
//ConvertL requires two CActiveScheduler::Start()
|
sl@0
|
573 |
aConverter->ConvertL();
|
sl@0
|
574 |
CActiveScheduler::Start();
|
sl@0
|
575 |
CActiveScheduler::Start();
|
sl@0
|
576 |
|
sl@0
|
577 |
TPtrC toFilename, fromFilename;
|
sl@0
|
578 |
GetStringFromConfig(_L("SectionFour"), _L("configAudio"), fromFilename);
|
sl@0
|
579 |
GetStringFromConfig(_L("SectionFour"), _L("configAudio12"), toFilename);
|
sl@0
|
580 |
TMdaFileClipLocation location2(toFilename);
|
sl@0
|
581 |
aConverter->OpenL(fromFilename, &location2, iFormat, iCodec);
|
sl@0
|
582 |
CActiveScheduler::Start();
|
sl@0
|
583 |
|
sl@0
|
584 |
TInt theDurationb = I64INT(aConverter->Duration().Int64());
|
sl@0
|
585 |
TInt theReceived = theDurationa - theDurationb;
|
sl@0
|
586 |
|
sl@0
|
587 |
TBool theRes = TimeComparison(theReceived, theExpected, KDeviation);
|
sl@0
|
588 |
|
sl@0
|
589 |
|
sl@0
|
590 |
if(theRes == (TBool) ETrue)
|
sl@0
|
591 |
{
|
sl@0
|
592 |
ret = EPass;
|
sl@0
|
593 |
}
|
sl@0
|
594 |
INFO_PRINTF3( _L("Expected position : %d, Received position : %d"), theExpected, theReceived);
|
sl@0
|
595 |
|
sl@0
|
596 |
}
|
sl@0
|
597 |
|
sl@0
|
598 |
return ret;
|
sl@0
|
599 |
}
|
sl@0
|
600 |
|
sl@0
|
601 |
//------------------------------------------------------------------
|
sl@0
|
602 |
|
sl@0
|
603 |
/**
|
sl@0
|
604 |
* Constructor
|
sl@0
|
605 |
*/
|
sl@0
|
606 |
CTestMmfAclntConConfig::CTestMmfAclntConConfig(const TDesC& aTestName, const TTestFormat aFormat, const TBool aNegative)
|
sl@0
|
607 |
{
|
sl@0
|
608 |
iTestStepName = aTestName;
|
sl@0
|
609 |
iThisIsNegativeTest = aNegative;
|
sl@0
|
610 |
iTestFormat = aFormat;
|
sl@0
|
611 |
}
|
sl@0
|
612 |
|
sl@0
|
613 |
CTestMmfAclntConConfig* CTestMmfAclntConConfig::NewL(const TDesC& aTestName, const TTestFormat aFormat, const TBool aNegative)
|
sl@0
|
614 |
{
|
sl@0
|
615 |
CTestMmfAclntConConfig* self = new (ELeave) CTestMmfAclntConConfig(aTestName, aFormat, aNegative);
|
sl@0
|
616 |
return self;
|
sl@0
|
617 |
}
|
sl@0
|
618 |
|
sl@0
|
619 |
void CTestMmfAclntConConfig::MoscoStateChangeEvent(CBase* /*aObject*/,
|
sl@0
|
620 |
TInt /*aPreviousState*/,
|
sl@0
|
621 |
TInt /*aCurrentState*/,
|
sl@0
|
622 |
TInt aErrorCode)
|
sl@0
|
623 |
{
|
sl@0
|
624 |
iError = aErrorCode;
|
sl@0
|
625 |
INFO_PRINTF1( _L("CTestMmfAclntConConfig : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
|
sl@0
|
626 |
INFO_PRINTF2( _L("iError %d"), iError);
|
sl@0
|
627 |
|
sl@0
|
628 |
CActiveScheduler::Stop();
|
sl@0
|
629 |
}
|
sl@0
|
630 |
|
sl@0
|
631 |
void CTestMmfAclntConConfig::GetKeyName(TDes& aDes)
|
sl@0
|
632 |
{
|
sl@0
|
633 |
aDes = KAclntConConfigKeyName;
|
sl@0
|
634 |
}
|
sl@0
|
635 |
|
sl@0
|
636 |
TVerdict CTestMmfAclntConConfig::DoTestStepPreambleL()
|
sl@0
|
637 |
{
|
sl@0
|
638 |
TVerdict ret = EPass;
|
sl@0
|
639 |
|
sl@0
|
640 |
SetupFormatL(iTestFormat);
|
sl@0
|
641 |
|
sl@0
|
642 |
TBuf<64> keyName;
|
sl@0
|
643 |
GetKeyName(keyName);
|
sl@0
|
644 |
|
sl@0
|
645 |
// Make sure file doesn't exist (maybe from a previous test)
|
sl@0
|
646 |
TParse fullFileName;
|
sl@0
|
647 |
TPtrC filename;
|
sl@0
|
648 |
if(!GetStringFromConfig(_L("SectionFour"), keyName, filename))
|
sl@0
|
649 |
return EInconclusive;
|
sl@0
|
650 |
|
sl@0
|
651 |
// parse the filenames
|
sl@0
|
652 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
sl@0
|
653 |
{
|
sl@0
|
654 |
RFs fs;
|
sl@0
|
655 |
User::LeaveIfError(fs.Connect());
|
sl@0
|
656 |
|
sl@0
|
657 |
TInt error = fs.Delete(fullFileName.FullName());
|
sl@0
|
658 |
if(error == KErrPathNotFound)
|
sl@0
|
659 |
{
|
sl@0
|
660 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
sl@0
|
661 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
sl@0
|
662 |
}
|
sl@0
|
663 |
else if(error == KErrNotFound)
|
sl@0
|
664 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
sl@0
|
665 |
else if(error==KErrNone)
|
sl@0
|
666 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
sl@0
|
667 |
else
|
sl@0
|
668 |
ret = EInconclusive;
|
sl@0
|
669 |
fs.Close();
|
sl@0
|
670 |
}
|
sl@0
|
671 |
if((ret == EInconclusive) || (ret == EFail))
|
sl@0
|
672 |
{
|
sl@0
|
673 |
return ret;
|
sl@0
|
674 |
}
|
sl@0
|
675 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
sl@0
|
676 |
}
|
sl@0
|
677 |
|
sl@0
|
678 |
/**
|
sl@0
|
679 |
* Set config destination clip
|
sl@0
|
680 |
*/
|
sl@0
|
681 |
TVerdict CTestMmfAclntConConfig::DoTestStepL()
|
sl@0
|
682 |
{
|
sl@0
|
683 |
INFO_PRINTF1( _L("TestConverter : Config"));
|
sl@0
|
684 |
TVerdict ret = EFail;
|
sl@0
|
685 |
|
sl@0
|
686 |
TPtrC toFilename, fromFilename;
|
sl@0
|
687 |
if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
|
sl@0
|
688 |
|| (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
|
sl@0
|
689 |
return EInconclusive;
|
sl@0
|
690 |
|
sl@0
|
691 |
// Delete the old file if it exists
|
sl@0
|
692 |
RFs fs;
|
sl@0
|
693 |
TInt err = fs.Connect();
|
sl@0
|
694 |
if (err != KErrNone)
|
sl@0
|
695 |
{
|
sl@0
|
696 |
INFO_PRINTF2(_L("Error doing fs.Connect (%d)"), err);
|
sl@0
|
697 |
return EInconclusive;
|
sl@0
|
698 |
}
|
sl@0
|
699 |
|
sl@0
|
700 |
err = fs.Delete(toFilename);
|
sl@0
|
701 |
if ((err != KErrNone) && (err != KErrNotFound))
|
sl@0
|
702 |
{
|
sl@0
|
703 |
INFO_PRINTF3(_L("Error deleting 'toFilename' (%S) %d"), &toFilename, err);
|
sl@0
|
704 |
return EInconclusive;
|
sl@0
|
705 |
}
|
sl@0
|
706 |
fs.Close();
|
sl@0
|
707 |
|
sl@0
|
708 |
TMdaFileClipLocation location(toFilename);
|
sl@0
|
709 |
iError = KErrTimedOut;
|
sl@0
|
710 |
|
sl@0
|
711 |
CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
712 |
CleanupStack::PushL(converter);
|
sl@0
|
713 |
|
sl@0
|
714 |
if (iThisIsNegativeTest)
|
sl@0
|
715 |
{
|
sl@0
|
716 |
iAudioSettings.iSampleRate = KInvalidNumber;
|
sl@0
|
717 |
iAudioSettings.iChannels = KInvalidNumber;
|
sl@0
|
718 |
converter->OpenL(fromFilename, &location, iFormat, iCodec, &iAudioSettings);
|
sl@0
|
719 |
}
|
sl@0
|
720 |
else
|
sl@0
|
721 |
{
|
sl@0
|
722 |
converter->OpenL(fromFilename, &location, iFormat, iCodec);
|
sl@0
|
723 |
}
|
sl@0
|
724 |
|
sl@0
|
725 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
726 |
CActiveScheduler::Start();
|
sl@0
|
727 |
|
sl@0
|
728 |
//TRAP(iError, converter->SetDestinationNumberOfChannelsL(1));
|
sl@0
|
729 |
|
sl@0
|
730 |
if (iError == KErrNone)
|
sl@0
|
731 |
ret = DoTestL(converter);
|
sl@0
|
732 |
|
sl@0
|
733 |
if (ret == EFail)
|
sl@0
|
734 |
INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
|
sl@0
|
735 |
|
sl@0
|
736 |
if(iThisIsNegativeTest && iError == KErrNotSupported)
|
sl@0
|
737 |
{
|
sl@0
|
738 |
ret = EPass;
|
sl@0
|
739 |
}
|
sl@0
|
740 |
|
sl@0
|
741 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
742 |
User::After(KOneSecond);
|
sl@0
|
743 |
return ret;
|
sl@0
|
744 |
|
sl@0
|
745 |
}
|
sl@0
|
746 |
|
sl@0
|
747 |
TVerdict CTestMmfAclntConConfig::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
748 |
{
|
sl@0
|
749 |
TVerdict ret = EFail;
|
sl@0
|
750 |
|
sl@0
|
751 |
iError = KErrTimedOut;
|
sl@0
|
752 |
|
sl@0
|
753 |
aConverter->ConvertL();
|
sl@0
|
754 |
INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
|
sl@0
|
755 |
CActiveScheduler::Start();
|
sl@0
|
756 |
|
sl@0
|
757 |
// a negative test will fail succesfully at this point
|
sl@0
|
758 |
if (!iThisIsNegativeTest)
|
sl@0
|
759 |
ret = EPass;
|
sl@0
|
760 |
else if (iError == KErrNotSupported)
|
sl@0
|
761 |
ret = EPass;
|
sl@0
|
762 |
return ret;
|
sl@0
|
763 |
}
|
sl@0
|
764 |
|
sl@0
|
765 |
//------------------------------------------------------------------
|
sl@0
|
766 |
|
sl@0
|
767 |
/**
|
sl@0
|
768 |
* Constructor
|
sl@0
|
769 |
*/
|
sl@0
|
770 |
CTestMmfAclntConQuery::CTestMmfAclntConQuery(const TDesC& aTestName)
|
sl@0
|
771 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav, EFalse)
|
sl@0
|
772 |
{}
|
sl@0
|
773 |
|
sl@0
|
774 |
CTestMmfAclntConQuery* CTestMmfAclntConQuery::NewL(const TDesC& aTestName)
|
sl@0
|
775 |
{
|
sl@0
|
776 |
CTestMmfAclntConQuery* self = new (ELeave) CTestMmfAclntConQuery(aTestName);
|
sl@0
|
777 |
return self;
|
sl@0
|
778 |
}
|
sl@0
|
779 |
|
sl@0
|
780 |
void CTestMmfAclntConQuery::GetKeyName(TDes& aDes)
|
sl@0
|
781 |
{
|
sl@0
|
782 |
aDes = KAclntConQueryKeyName;
|
sl@0
|
783 |
}
|
sl@0
|
784 |
|
sl@0
|
785 |
TVerdict CTestMmfAclntConQuery::DoTestStepL()
|
sl@0
|
786 |
{
|
sl@0
|
787 |
INFO_PRINTF1( _L("TestConverter : ConQuery"));
|
sl@0
|
788 |
TVerdict ret = EFail;
|
sl@0
|
789 |
|
sl@0
|
790 |
TPtrC toFilename, fromFilename;
|
sl@0
|
791 |
if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
|
sl@0
|
792 |
//if ((!GetStringFromConfig(_L("SectionSeven"), _L("auFile"), fromFilename))
|
sl@0
|
793 |
//if ((!GetStringFromConfig(_L("SectionSeven"), _L("rawFile"), fromFilename))
|
sl@0
|
794 |
|| (!GetStringFromConfig(_L("SectionFour"), _L("configAudio4"), toFilename)))
|
sl@0
|
795 |
return EInconclusive;
|
sl@0
|
796 |
|
sl@0
|
797 |
TMdaFileClipLocation location(toFilename);
|
sl@0
|
798 |
iError = KErrTimedOut;
|
sl@0
|
799 |
|
sl@0
|
800 |
CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
801 |
CleanupStack::PushL(converter);
|
sl@0
|
802 |
|
sl@0
|
803 |
converter->OpenL(fromFilename, &location, iFormat, iCodec);
|
sl@0
|
804 |
|
sl@0
|
805 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
806 |
CActiveScheduler::Start();
|
sl@0
|
807 |
|
sl@0
|
808 |
if (iError == KErrNone)
|
sl@0
|
809 |
ret = DoTestL(converter);
|
sl@0
|
810 |
|
sl@0
|
811 |
if (ret == EFail)
|
sl@0
|
812 |
INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
|
sl@0
|
813 |
|
sl@0
|
814 |
|
sl@0
|
815 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
816 |
User::After(KOneSecond);
|
sl@0
|
817 |
return ret;
|
sl@0
|
818 |
|
sl@0
|
819 |
}
|
sl@0
|
820 |
|
sl@0
|
821 |
/**
|
sl@0
|
822 |
* query transformations available.
|
sl@0
|
823 |
*/
|
sl@0
|
824 |
TVerdict CTestMmfAclntConQuery::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
825 |
{
|
sl@0
|
826 |
INFO_PRINTF1( _L("TestConverter : Query Transactions"));
|
sl@0
|
827 |
RArray<TFourCC> theSupportedDataTypes;
|
sl@0
|
828 |
|
sl@0
|
829 |
TInt err ;
|
sl@0
|
830 |
TRAP(err,aConverter->GetSupportedDestinationDataTypesL(theSupportedDataTypes));
|
sl@0
|
831 |
if(err!=KErrNone)
|
sl@0
|
832 |
{
|
sl@0
|
833 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedDataTypesL left with error %d"),err);
|
sl@0
|
834 |
return EFail;
|
sl@0
|
835 |
}
|
sl@0
|
836 |
|
sl@0
|
837 |
TUint8 theBuffer8[KSizeBuf];
|
sl@0
|
838 |
|
sl@0
|
839 |
INFO_PRINTF1( _L("The supported available transformation"));
|
sl@0
|
840 |
for(TInt index = 0; index < theSupportedDataTypes.Count() ; index++)
|
sl@0
|
841 |
{
|
sl@0
|
842 |
TFourCC& four = theSupportedDataTypes[index];
|
sl@0
|
843 |
|
sl@0
|
844 |
TPtr8 ptrFour(theBuffer8, KSizeBuf);
|
sl@0
|
845 |
four.FourCC(&ptrFour);
|
sl@0
|
846 |
TBuf<KSizeBuf> theBuf;
|
sl@0
|
847 |
|
sl@0
|
848 |
theBuf.Copy(ptrFour);
|
sl@0
|
849 |
|
sl@0
|
850 |
INFO_PRINTF3( _L("%d %S"), index, &theBuf);
|
sl@0
|
851 |
|
sl@0
|
852 |
}
|
sl@0
|
853 |
|
sl@0
|
854 |
return EPass;
|
sl@0
|
855 |
}
|
sl@0
|
856 |
|
sl@0
|
857 |
//-------------------------------------------------------------------
|
sl@0
|
858 |
|
sl@0
|
859 |
// Negative tests
|
sl@0
|
860 |
|
sl@0
|
861 |
//-------------------------------------------------------------------
|
sl@0
|
862 |
|
sl@0
|
863 |
/**
|
sl@0
|
864 |
* Constructor
|
sl@0
|
865 |
*/
|
sl@0
|
866 |
CTestMmfAclntDelete::CTestMmfAclntDelete()
|
sl@0
|
867 |
{
|
sl@0
|
868 |
// store the name of this test case
|
sl@0
|
869 |
// this is the name that is used by the script file
|
sl@0
|
870 |
// Each test step initialises it's own name
|
sl@0
|
871 |
iTestStepName = _L("MM-MMF-ACLNT-I-1051-CP");
|
sl@0
|
872 |
}
|
sl@0
|
873 |
|
sl@0
|
874 |
void CTestMmfAclntDelete::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode)
|
sl@0
|
875 |
{
|
sl@0
|
876 |
iError = aErrorCode;
|
sl@0
|
877 |
INFO_PRINTF1( _L("CTestMmfAclntDelete : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
|
sl@0
|
878 |
INFO_PRINTF2( _L("iError %d"), iError);
|
sl@0
|
879 |
CActiveScheduler::Stop();
|
sl@0
|
880 |
}
|
sl@0
|
881 |
|
sl@0
|
882 |
/**
|
sl@0
|
883 |
* Conversion utility - Delete object before conversion operation has completed.
|
sl@0
|
884 |
*/
|
sl@0
|
885 |
TVerdict CTestMmfAclntDelete::DoTestStepL( void )
|
sl@0
|
886 |
{
|
sl@0
|
887 |
INFO_PRINTF1( _L("TestConverter : Delete"));
|
sl@0
|
888 |
|
sl@0
|
889 |
TPtrC sourceFileName, targetFileName;
|
sl@0
|
890 |
if((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), sourceFileName)) ||
|
sl@0
|
891 |
(!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), targetFileName)))
|
sl@0
|
892 |
return EInconclusive;
|
sl@0
|
893 |
|
sl@0
|
894 |
RFs theFs;
|
sl@0
|
895 |
theFs.Connect();
|
sl@0
|
896 |
theFs.Delete(targetFileName);
|
sl@0
|
897 |
theFs.Close();
|
sl@0
|
898 |
|
sl@0
|
899 |
|
sl@0
|
900 |
iError = KErrTimedOut;
|
sl@0
|
901 |
TMdaFileClipLocation location(targetFileName);
|
sl@0
|
902 |
TMdaWavClipFormat format;
|
sl@0
|
903 |
TMdaPcmWavCodec codec;
|
sl@0
|
904 |
|
sl@0
|
905 |
__MM_HEAP_MARK;
|
sl@0
|
906 |
|
sl@0
|
907 |
CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
908 |
CleanupStack::PushL(converter);
|
sl@0
|
909 |
converter->OpenL(sourceFileName,&location, &format, &codec);
|
sl@0
|
910 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
911 |
CActiveScheduler::Start();
|
sl@0
|
912 |
|
sl@0
|
913 |
if(iError == KErrNone)
|
sl@0
|
914 |
{
|
sl@0
|
915 |
converter->ConvertL();
|
sl@0
|
916 |
INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
|
sl@0
|
917 |
//User::After(3 * KOneSecond);
|
sl@0
|
918 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
919 |
User::After(KOneSecond);
|
sl@0
|
920 |
INFO_PRINTF1( _L("Destroy CMdaAudioConvertUtility"));
|
sl@0
|
921 |
__MM_HEAP_MARKEND;
|
sl@0
|
922 |
User::Heap().Check();
|
sl@0
|
923 |
|
sl@0
|
924 |
return EPass;
|
sl@0
|
925 |
}
|
sl@0
|
926 |
|
sl@0
|
927 |
ERR_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
|
sl@0
|
928 |
|
sl@0
|
929 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
930 |
User::After(KOneSecond);
|
sl@0
|
931 |
return EFail;
|
sl@0
|
932 |
}
|
sl@0
|
933 |
|
sl@0
|
934 |
//------------------------------------------------------------------
|
sl@0
|
935 |
|
sl@0
|
936 |
/**
|
sl@0
|
937 |
* Constructor
|
sl@0
|
938 |
*/
|
sl@0
|
939 |
CTestMmfAclntOpenWhileConvert::CTestMmfAclntOpenWhileConvert(const TDesC& aTestName)
|
sl@0
|
940 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav,EFalse)
|
sl@0
|
941 |
{
|
sl@0
|
942 |
}
|
sl@0
|
943 |
|
sl@0
|
944 |
CTestMmfAclntOpenWhileConvert* CTestMmfAclntOpenWhileConvert::NewL(const TDesC& aTestName)
|
sl@0
|
945 |
{
|
sl@0
|
946 |
CTestMmfAclntOpenWhileConvert* self = new (ELeave) CTestMmfAclntOpenWhileConvert(aTestName);
|
sl@0
|
947 |
return self;
|
sl@0
|
948 |
}
|
sl@0
|
949 |
|
sl@0
|
950 |
/**
|
sl@0
|
951 |
* Open new file while audio converter is converting. Open a new audio file.
|
sl@0
|
952 |
*/
|
sl@0
|
953 |
TVerdict CTestMmfAclntOpenWhileConvert::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
954 |
{
|
sl@0
|
955 |
INFO_PRINTF1( _L("TestConverter : Open/Convert"));
|
sl@0
|
956 |
|
sl@0
|
957 |
TPtrC auFilename, wavFilename;
|
sl@0
|
958 |
//if((!GetStringFromConfig(_L("SectionFour"), _L("auAudioFile"), auFilename)) ||
|
sl@0
|
959 |
// (!GetStringFromConfig(_L("SectionFour"), _L("wavAudioFile"), wavFilename)))
|
sl@0
|
960 |
if((!GetStringFromConfig(_L("SectionOne"), _L("PCM8"), auFilename)) ||
|
sl@0
|
961 |
(!GetStringFromConfig(_L("SectionFour"), _L("PCM16_out"), wavFilename)))
|
sl@0
|
962 |
return EInconclusive;
|
sl@0
|
963 |
|
sl@0
|
964 |
RFs theFs;
|
sl@0
|
965 |
User::LeaveIfError(theFs.Connect());
|
sl@0
|
966 |
theFs.Delete(wavFilename);
|
sl@0
|
967 |
theFs.MkDirAll(wavFilename);
|
sl@0
|
968 |
theFs.Close();
|
sl@0
|
969 |
|
sl@0
|
970 |
|
sl@0
|
971 |
iError = KErrTimedOut;
|
sl@0
|
972 |
TMdaFileClipLocation location(wavFilename);
|
sl@0
|
973 |
TMdaWavClipFormat format;
|
sl@0
|
974 |
TMdaPcmWavCodec codec(TMdaPcmWavCodec::E16BitPcm);
|
sl@0
|
975 |
|
sl@0
|
976 |
aConverter->ConvertL();
|
sl@0
|
977 |
INFO_PRINTF1( _L("Convert CMdaAudioConvertUtility"));
|
sl@0
|
978 |
User::After(KOneSecond);
|
sl@0
|
979 |
|
sl@0
|
980 |
|
sl@0
|
981 |
aConverter->OpenL(auFilename,&location, &format, &codec);
|
sl@0
|
982 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
983 |
// wait for open
|
sl@0
|
984 |
CActiveScheduler::Start();
|
sl@0
|
985 |
|
sl@0
|
986 |
if(iError == KErrInUse || iError == KErrNone)
|
sl@0
|
987 |
return EPass;
|
sl@0
|
988 |
return EFail;
|
sl@0
|
989 |
}
|
sl@0
|
990 |
|
sl@0
|
991 |
//------------------------------------------------------------------
|
sl@0
|
992 |
|
sl@0
|
993 |
CTestMmfAclntConvertDestBitRate::CTestMmfAclntConvertDestBitRate(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
994 |
: CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
995 |
{}
|
sl@0
|
996 |
|
sl@0
|
997 |
CTestMmfAclntConvertDestBitRate* CTestMmfAclntConvertDestBitRate::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
998 |
{
|
sl@0
|
999 |
CTestMmfAclntConvertDestBitRate* self = new (ELeave) CTestMmfAclntConvertDestBitRate(aTestName,aNegative);
|
sl@0
|
1000 |
return self;
|
sl@0
|
1001 |
}
|
sl@0
|
1002 |
|
sl@0
|
1003 |
void CTestMmfAclntConvertDestBitRate::GetKeyName(TDes& aDes)
|
sl@0
|
1004 |
{
|
sl@0
|
1005 |
aDes = KAclntConDestBitRateKeyName;
|
sl@0
|
1006 |
}
|
sl@0
|
1007 |
|
sl@0
|
1008 |
TVerdict CTestMmfAclntConvertDestBitRate::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
1009 |
{
|
sl@0
|
1010 |
INFO_PRINTF1( _L("TestConvertUtils : Destination Bit Rate"));
|
sl@0
|
1011 |
TVerdict ret = EPass;
|
sl@0
|
1012 |
TInt err = KErrNone;
|
sl@0
|
1013 |
RArray<TUint> rates;
|
sl@0
|
1014 |
TRAP(err,aConverter->GetSupportedConversionBitRatesL(rates));
|
sl@0
|
1015 |
// in Typhoon KErrNotSupported is expected
|
sl@0
|
1016 |
if(err==KErrNotSupported)
|
sl@0
|
1017 |
{
|
sl@0
|
1018 |
//test the other bitrate functions for code coverage (and behaviour)
|
sl@0
|
1019 |
TRAP(err,aConverter->SetDestinationBitRateL(100)); // arbitrary value since KErrNotSupported is expected anyway
|
sl@0
|
1020 |
if (err != KErrNotSupported)
|
sl@0
|
1021 |
return EFail;
|
sl@0
|
1022 |
|
sl@0
|
1023 |
TUint rate=0;
|
sl@0
|
1024 |
TRAP(err, rate=aConverter->DestinationBitRateL());
|
sl@0
|
1025 |
if (err != KErrNone)
|
sl@0
|
1026 |
return EFail;
|
sl@0
|
1027 |
|
sl@0
|
1028 |
INFO_PRINTF3(_L("CMdaAudioConvertUtility::GetSupportedConversionBitRatesL() leave with error %d bitrate of %d"),err,rate);
|
sl@0
|
1029 |
ret = EPass;
|
sl@0
|
1030 |
return ret;
|
sl@0
|
1031 |
}
|
sl@0
|
1032 |
if(err!=KErrNone)
|
sl@0
|
1033 |
{
|
sl@0
|
1034 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedConversionBitRatesL() leave with error %d"),iError);
|
sl@0
|
1035 |
ret = EFail;
|
sl@0
|
1036 |
return ret;
|
sl@0
|
1037 |
}
|
sl@0
|
1038 |
TInt numRates = rates.Count();
|
sl@0
|
1039 |
for(TInt i=0;i<numRates;i++)
|
sl@0
|
1040 |
{
|
sl@0
|
1041 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationBitRateL (%d)"),rates[i]);
|
sl@0
|
1042 |
TRAP(iError,aConverter->SetDestinationBitRateL(rates[i]));
|
sl@0
|
1043 |
if(iError != KErrNone)
|
sl@0
|
1044 |
{
|
sl@0
|
1045 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationBitRateL left with error %d"),iError);
|
sl@0
|
1046 |
ret = EFail;
|
sl@0
|
1047 |
}
|
sl@0
|
1048 |
else// no error, get rate
|
sl@0
|
1049 |
{
|
sl@0
|
1050 |
TUint rate=0;
|
sl@0
|
1051 |
TRAP(iError,rate = aConverter->DestinationBitRateL());
|
sl@0
|
1052 |
//TRAP(err, aConverter->ConvertL());
|
sl@0
|
1053 |
//CActiveScheduler::Start();
|
sl@0
|
1054 |
|
sl@0
|
1055 |
if(iError!=KErrNone)
|
sl@0
|
1056 |
{
|
sl@0
|
1057 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationBitRateL leave with error %d"),iError);
|
sl@0
|
1058 |
ret = EFail;
|
sl@0
|
1059 |
}
|
sl@0
|
1060 |
else
|
sl@0
|
1061 |
{
|
sl@0
|
1062 |
if(rate!=rates[i])
|
sl@0
|
1063 |
{
|
sl@0
|
1064 |
ret = EFail;
|
sl@0
|
1065 |
INFO_PRINTF1(_L("Rate mismatch"));
|
sl@0
|
1066 |
}
|
sl@0
|
1067 |
else
|
sl@0
|
1068 |
{
|
sl@0
|
1069 |
INFO_PRINTF1(_L("Rates match"));
|
sl@0
|
1070 |
}
|
sl@0
|
1071 |
}
|
sl@0
|
1072 |
}
|
sl@0
|
1073 |
}
|
sl@0
|
1074 |
return ret;
|
sl@0
|
1075 |
}
|
sl@0
|
1076 |
|
sl@0
|
1077 |
|
sl@0
|
1078 |
//------------------------------------------------------------------
|
sl@0
|
1079 |
|
sl@0
|
1080 |
CTestMmfAclntConvertDestDataType::CTestMmfAclntConvertDestDataType(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1081 |
: CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1082 |
{}
|
sl@0
|
1083 |
|
sl@0
|
1084 |
CTestMmfAclntConvertDestDataType* CTestMmfAclntConvertDestDataType::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1085 |
{
|
sl@0
|
1086 |
CTestMmfAclntConvertDestDataType* self = new (ELeave) CTestMmfAclntConvertDestDataType(aTestName,aNegative);
|
sl@0
|
1087 |
return self;
|
sl@0
|
1088 |
}
|
sl@0
|
1089 |
|
sl@0
|
1090 |
void CTestMmfAclntConvertDestDataType::GetKeyName(TDes& aDes)
|
sl@0
|
1091 |
{
|
sl@0
|
1092 |
aDes = KAclntConDestDataTypeKeyName;
|
sl@0
|
1093 |
}
|
sl@0
|
1094 |
|
sl@0
|
1095 |
TVerdict CTestMmfAclntConvertDestDataType::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
1096 |
{
|
sl@0
|
1097 |
INFO_PRINTF1( _L("TestConvertUtils : Destination data type"));
|
sl@0
|
1098 |
|
sl@0
|
1099 |
TVerdict ret = EFail;
|
sl@0
|
1100 |
TInt err = KErrNone;
|
sl@0
|
1101 |
RArray<TFourCC> SupportedDataTypes ;
|
sl@0
|
1102 |
TFourCC dataType;
|
sl@0
|
1103 |
|
sl@0
|
1104 |
TRAP(err,aConverter->GetSupportedDestinationDataTypesL(SupportedDataTypes));
|
sl@0
|
1105 |
if(err!=KErrNone)
|
sl@0
|
1106 |
{
|
sl@0
|
1107 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedBitRatesL leave with error %d"),err);
|
sl@0
|
1108 |
ret = EFail;
|
sl@0
|
1109 |
return ret;
|
sl@0
|
1110 |
}
|
sl@0
|
1111 |
|
sl@0
|
1112 |
TInt numRates = SupportedDataTypes.Count();
|
sl@0
|
1113 |
ret = EPass ;
|
sl@0
|
1114 |
|
sl@0
|
1115 |
for(TInt i=0;i<numRates;i++)
|
sl@0
|
1116 |
{
|
sl@0
|
1117 |
dataType = SupportedDataTypes[i] ;
|
sl@0
|
1118 |
TUint8 char1 = TUint8( dataType.FourCC() ) ;
|
sl@0
|
1119 |
TUint8 char2 = TUint8( dataType.FourCC() >> 8 ) ;
|
sl@0
|
1120 |
TUint8 char3 = TUint8( dataType.FourCC() >> 16 ) ;
|
sl@0
|
1121 |
TUint8 char4 = TUint8( dataType.FourCC() >> 24 ) ;
|
sl@0
|
1122 |
//fourCCString->Format( _L8("%1c%1c%1c%1c"), char1, char2, char3, char4 ) ;
|
sl@0
|
1123 |
INFO_PRINTF5(_L("dataType.FourCC= %1c%1c%1c%1c"), char1, char2, char3, char4);
|
sl@0
|
1124 |
TRAP(err,aConverter->SetDestinationDataTypeL(SupportedDataTypes[i]));
|
sl@0
|
1125 |
|
sl@0
|
1126 |
if(err!=KErrNone)
|
sl@0
|
1127 |
{
|
sl@0
|
1128 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationDataTypeL leave with error %d"),err);
|
sl@0
|
1129 |
return EFail;
|
sl@0
|
1130 |
}
|
sl@0
|
1131 |
|
sl@0
|
1132 |
TRAP(err,dataType = aConverter->DestinationDataTypeL());
|
sl@0
|
1133 |
|
sl@0
|
1134 |
if(err!=KErrNone)
|
sl@0
|
1135 |
{
|
sl@0
|
1136 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationDataTypeL leave with error %d"),err);
|
sl@0
|
1137 |
return EFail;
|
sl@0
|
1138 |
}
|
sl@0
|
1139 |
|
sl@0
|
1140 |
if(dataType!=SupportedDataTypes[i])
|
sl@0
|
1141 |
ret = EFail;
|
sl@0
|
1142 |
}
|
sl@0
|
1143 |
return ret;
|
sl@0
|
1144 |
}
|
sl@0
|
1145 |
|
sl@0
|
1146 |
|
sl@0
|
1147 |
//------------------------------------------------------------------
|
sl@0
|
1148 |
|
sl@0
|
1149 |
CTestMmfAclntConvertDestFormat::CTestMmfAclntConvertDestFormat(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1150 |
: CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1151 |
{}
|
sl@0
|
1152 |
|
sl@0
|
1153 |
CTestMmfAclntConvertDestFormat* CTestMmfAclntConvertDestFormat::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1154 |
{
|
sl@0
|
1155 |
CTestMmfAclntConvertDestFormat* self = new (ELeave) CTestMmfAclntConvertDestFormat(aTestName,aNegative) ;
|
sl@0
|
1156 |
return self;
|
sl@0
|
1157 |
}
|
sl@0
|
1158 |
|
sl@0
|
1159 |
void CTestMmfAclntConvertDestFormat::GetKeyName(TDes& aDes)
|
sl@0
|
1160 |
{
|
sl@0
|
1161 |
aDes = KAclntConDestFormatKeyName;
|
sl@0
|
1162 |
}
|
sl@0
|
1163 |
|
sl@0
|
1164 |
TVerdict CTestMmfAclntConvertDestFormat::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
1165 |
{
|
sl@0
|
1166 |
INFO_PRINTF1( _L("TestConvertUtils : Destination format"));
|
sl@0
|
1167 |
TVerdict ret = EFail;
|
sl@0
|
1168 |
TInt err = KErrNone;
|
sl@0
|
1169 |
TUid format1(KUidMdaWavCodec) ; //Why not?
|
sl@0
|
1170 |
TUid format2 ;
|
sl@0
|
1171 |
|
sl@0
|
1172 |
TRAP(err,format1 = aConverter->DestinationFormatL());
|
sl@0
|
1173 |
if(err!=KErrNone)
|
sl@0
|
1174 |
{
|
sl@0
|
1175 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationFormatL leave with error %d"),err);
|
sl@0
|
1176 |
return ret;
|
sl@0
|
1177 |
}
|
sl@0
|
1178 |
|
sl@0
|
1179 |
TRAP(err,aConverter->SetDestinationFormatL(format1));
|
sl@0
|
1180 |
if(err!=KErrNone)
|
sl@0
|
1181 |
{
|
sl@0
|
1182 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationFormatL leave with error %d"),err);
|
sl@0
|
1183 |
return ret;
|
sl@0
|
1184 |
}
|
sl@0
|
1185 |
|
sl@0
|
1186 |
TRAP(err,format2 = aConverter->DestinationFormatL());
|
sl@0
|
1187 |
if(err!=KErrNone)
|
sl@0
|
1188 |
{
|
sl@0
|
1189 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationFormatL leave with error %d"),err);
|
sl@0
|
1190 |
return ret;
|
sl@0
|
1191 |
}
|
sl@0
|
1192 |
|
sl@0
|
1193 |
if(format1 == format2)
|
sl@0
|
1194 |
ret = EPass;
|
sl@0
|
1195 |
return ret;
|
sl@0
|
1196 |
}
|
sl@0
|
1197 |
|
sl@0
|
1198 |
|
sl@0
|
1199 |
//------------------------------------------------------------------
|
sl@0
|
1200 |
|
sl@0
|
1201 |
CTestMmfAclntConvertDestSampleRate::CTestMmfAclntConvertDestSampleRate(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1202 |
: CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1203 |
{}
|
sl@0
|
1204 |
|
sl@0
|
1205 |
CTestMmfAclntConvertDestSampleRate* CTestMmfAclntConvertDestSampleRate::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1206 |
{
|
sl@0
|
1207 |
CTestMmfAclntConvertDestSampleRate* self = new (ELeave) CTestMmfAclntConvertDestSampleRate(aTestName,aNegative);
|
sl@0
|
1208 |
return self;
|
sl@0
|
1209 |
}
|
sl@0
|
1210 |
|
sl@0
|
1211 |
void CTestMmfAclntConvertDestSampleRate::GetKeyName(TDes& aDes)
|
sl@0
|
1212 |
{
|
sl@0
|
1213 |
aDes = KAclntConDestSampleRateKeyName;
|
sl@0
|
1214 |
}
|
sl@0
|
1215 |
|
sl@0
|
1216 |
/**
|
sl@0
|
1217 |
* Set config destination clip
|
sl@0
|
1218 |
*/
|
sl@0
|
1219 |
TVerdict CTestMmfAclntConvertDestSampleRate::DoTestStepL()
|
sl@0
|
1220 |
{
|
sl@0
|
1221 |
INFO_PRINTF1( _L("TestConverter : Config"));
|
sl@0
|
1222 |
TVerdict ret = EFail;
|
sl@0
|
1223 |
|
sl@0
|
1224 |
TPtrC toFilename, fromFilename;
|
sl@0
|
1225 |
|
sl@0
|
1226 |
// if ((!GetStringFromConfig(_L("SectionOne"), _L("Pcm16Mono44khz"), fromFilename))
|
sl@0
|
1227 |
if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
|
sl@0
|
1228 |
|| (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
|
sl@0
|
1229 |
return EInconclusive;
|
sl@0
|
1230 |
|
sl@0
|
1231 |
// Delete the old file if it exists
|
sl@0
|
1232 |
RFs fs;
|
sl@0
|
1233 |
TInt err = fs.Connect();
|
sl@0
|
1234 |
if (err != KErrNone)
|
sl@0
|
1235 |
{
|
sl@0
|
1236 |
INFO_PRINTF2(_L("Error doing fs.Connect (%d)"), err);
|
sl@0
|
1237 |
return EInconclusive;
|
sl@0
|
1238 |
}
|
sl@0
|
1239 |
|
sl@0
|
1240 |
err = fs.Delete(toFilename);
|
sl@0
|
1241 |
if ((err != KErrNone) && (err != KErrNotFound))
|
sl@0
|
1242 |
{
|
sl@0
|
1243 |
INFO_PRINTF3(_L("Error deleting 'toFilename' (%S) %d"), &toFilename, err);
|
sl@0
|
1244 |
return EInconclusive;
|
sl@0
|
1245 |
}
|
sl@0
|
1246 |
fs.Close();
|
sl@0
|
1247 |
|
sl@0
|
1248 |
TMdaFileClipLocation location(toFilename);
|
sl@0
|
1249 |
iError = KErrTimedOut;
|
sl@0
|
1250 |
|
sl@0
|
1251 |
CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
1252 |
CleanupStack::PushL(converter);
|
sl@0
|
1253 |
|
sl@0
|
1254 |
if (iThisIsNegativeTest)
|
sl@0
|
1255 |
{
|
sl@0
|
1256 |
iAudioSettings.iSampleRate = KInvalidNumber;
|
sl@0
|
1257 |
iAudioSettings.iChannels = KInvalidNumber;
|
sl@0
|
1258 |
converter->OpenL(fromFilename, &location, iFormat, iCodec, &iAudioSettings);
|
sl@0
|
1259 |
}
|
sl@0
|
1260 |
else
|
sl@0
|
1261 |
{
|
sl@0
|
1262 |
converter->OpenL(fromFilename, &location, iFormat, iCodec);
|
sl@0
|
1263 |
}
|
sl@0
|
1264 |
|
sl@0
|
1265 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
1266 |
CActiveScheduler::Start();
|
sl@0
|
1267 |
|
sl@0
|
1268 |
if (iError == KErrNone)
|
sl@0
|
1269 |
ret = DoTestL(converter);
|
sl@0
|
1270 |
|
sl@0
|
1271 |
if (ret == EFail)
|
sl@0
|
1272 |
INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
|
sl@0
|
1273 |
|
sl@0
|
1274 |
if(iThisIsNegativeTest && iError == KErrNotSupported)
|
sl@0
|
1275 |
{
|
sl@0
|
1276 |
ret = EPass;
|
sl@0
|
1277 |
}
|
sl@0
|
1278 |
|
sl@0
|
1279 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
1280 |
User::After(KOneSecond);
|
sl@0
|
1281 |
return ret;
|
sl@0
|
1282 |
|
sl@0
|
1283 |
}
|
sl@0
|
1284 |
|
sl@0
|
1285 |
void CTestMmfAclntConvertDestSampleRate::MoscoStateChangeEvent(CBase* /*aObject*/,
|
sl@0
|
1286 |
TInt aPreviousState,
|
sl@0
|
1287 |
TInt aCurrentState,
|
sl@0
|
1288 |
TInt aErrorCode)
|
sl@0
|
1289 |
{
|
sl@0
|
1290 |
iError = aErrorCode;
|
sl@0
|
1291 |
//iObject = aObject;
|
sl@0
|
1292 |
TInt PreviousState = aPreviousState;
|
sl@0
|
1293 |
TInt CurrentState = aCurrentState;
|
sl@0
|
1294 |
INFO_PRINTF1( _L("CTestMmfAclntConvertDestSampleRate : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
|
sl@0
|
1295 |
INFO_PRINTF4( _L("iError %d PreviousState %d -> CurrentState %d"),
|
sl@0
|
1296 |
iError, PreviousState, CurrentState);
|
sl@0
|
1297 |
if( CurrentState != CMdaAudioClipUtility::EPlaying)
|
sl@0
|
1298 |
//give a chace to finish conversion
|
sl@0
|
1299 |
CActiveScheduler::Stop();
|
sl@0
|
1300 |
}
|
sl@0
|
1301 |
|
sl@0
|
1302 |
|
sl@0
|
1303 |
TVerdict CTestMmfAclntConvertDestSampleRate::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
1304 |
{
|
sl@0
|
1305 |
INFO_PRINTF1( _L("TestConvertUtils : Destination Sample Rate"));
|
sl@0
|
1306 |
TVerdict ret = EFail;
|
sl@0
|
1307 |
|
sl@0
|
1308 |
TInt err = KErrNone;
|
sl@0
|
1309 |
RArray<TUint> supportedSampleRates ;
|
sl@0
|
1310 |
|
sl@0
|
1311 |
|
sl@0
|
1312 |
TRAP(err,aConverter->GetSupportedConversionSampleRatesL(supportedSampleRates));
|
sl@0
|
1313 |
if(err!=KErrNone)
|
sl@0
|
1314 |
{
|
sl@0
|
1315 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedConversionSampleRatesL() leave with error %d"),err);
|
sl@0
|
1316 |
ret = EFail;
|
sl@0
|
1317 |
return ret;
|
sl@0
|
1318 |
}
|
sl@0
|
1319 |
|
sl@0
|
1320 |
TInt numRates = supportedSampleRates.Count();
|
sl@0
|
1321 |
if( 0 != numRates)
|
sl@0
|
1322 |
{
|
sl@0
|
1323 |
ret = EPass ;
|
sl@0
|
1324 |
for(TInt i=0;i<numRates;i++)
|
sl@0
|
1325 |
{
|
sl@0
|
1326 |
// Delete the output file if it exists
|
sl@0
|
1327 |
// Necessary otherwise we will open the output file for conversion and
|
sl@0
|
1328 |
// use the sample rate of the file
|
sl@0
|
1329 |
TPtrC toFilename;
|
sl@0
|
1330 |
if (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename))
|
sl@0
|
1331 |
{
|
sl@0
|
1332 |
INFO_PRINTF1(_L("Error finding filename in INI file"));
|
sl@0
|
1333 |
return EInconclusive;
|
sl@0
|
1334 |
}
|
sl@0
|
1335 |
|
sl@0
|
1336 |
RFs fs;
|
sl@0
|
1337 |
TInt err = fs.Connect();
|
sl@0
|
1338 |
if (err != KErrNone)
|
sl@0
|
1339 |
{
|
sl@0
|
1340 |
INFO_PRINTF2(_L("Error doing fs.Connect (%d)"), err);
|
sl@0
|
1341 |
return EInconclusive;
|
sl@0
|
1342 |
}
|
sl@0
|
1343 |
|
sl@0
|
1344 |
err = fs.Delete(toFilename);
|
sl@0
|
1345 |
if ((err != KErrNone) && (err != KErrNotFound))
|
sl@0
|
1346 |
{
|
sl@0
|
1347 |
INFO_PRINTF3(_L("Error deleting 'toFilename' (%S) %d"), &toFilename, err);
|
sl@0
|
1348 |
return EInconclusive;
|
sl@0
|
1349 |
}
|
sl@0
|
1350 |
fs.Close();
|
sl@0
|
1351 |
|
sl@0
|
1352 |
// Do the conversion
|
sl@0
|
1353 |
TUint SampleRate = supportedSampleRates[i] ;
|
sl@0
|
1354 |
INFO_PRINTF2(_L("SampleRate = %d"), SampleRate);
|
sl@0
|
1355 |
TRAP(err,aConverter->SetDestinationSampleRateL(SampleRate));
|
sl@0
|
1356 |
if(err!=KErrNone)
|
sl@0
|
1357 |
{
|
sl@0
|
1358 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationSampleRateL() leave with error %d"),err);
|
sl@0
|
1359 |
ret = EFail;
|
sl@0
|
1360 |
return ret;
|
sl@0
|
1361 |
}
|
sl@0
|
1362 |
|
sl@0
|
1363 |
TRAP(err, aConverter->ConvertL());
|
sl@0
|
1364 |
CActiveScheduler::Start();
|
sl@0
|
1365 |
|
sl@0
|
1366 |
if(err!=KErrNone)
|
sl@0
|
1367 |
{
|
sl@0
|
1368 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::ConvertL leave with error %d"),err);
|
sl@0
|
1369 |
ret = EFail;
|
sl@0
|
1370 |
break ;
|
sl@0
|
1371 |
}
|
sl@0
|
1372 |
|
sl@0
|
1373 |
TRAP(err,SampleRate = aConverter->DestinationSampleRateL());
|
sl@0
|
1374 |
if(err!=KErrNone)
|
sl@0
|
1375 |
{
|
sl@0
|
1376 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationSampleRateL leave with error %d"),err);
|
sl@0
|
1377 |
ret = EFail;
|
sl@0
|
1378 |
break ;
|
sl@0
|
1379 |
}
|
sl@0
|
1380 |
|
sl@0
|
1381 |
if(SampleRate != supportedSampleRates[i])
|
sl@0
|
1382 |
{
|
sl@0
|
1383 |
INFO_PRINTF1(_L("CMdaAudioConvertUtility::DestinationSampleRateL does not match the sample rate set"));
|
sl@0
|
1384 |
ret = EFail;
|
sl@0
|
1385 |
}
|
sl@0
|
1386 |
|
sl@0
|
1387 |
}
|
sl@0
|
1388 |
}
|
sl@0
|
1389 |
else
|
sl@0
|
1390 |
{
|
sl@0
|
1391 |
INFO_PRINTF1(_L("CMdaAudioConvertUtility::GetSupportedConversionSampleRatesL() returned empy array."));
|
sl@0
|
1392 |
ret = EFail;
|
sl@0
|
1393 |
}
|
sl@0
|
1394 |
return ret;
|
sl@0
|
1395 |
}
|
sl@0
|
1396 |
|
sl@0
|
1397 |
|
sl@0
|
1398 |
//------------------------------------------------------------------
|
sl@0
|
1399 |
|
sl@0
|
1400 |
CTestMmfAclntConvertDestNumberOfChannels::CTestMmfAclntConvertDestNumberOfChannels(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1401 |
: CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1402 |
{}
|
sl@0
|
1403 |
|
sl@0
|
1404 |
CTestMmfAclntConvertDestNumberOfChannels* CTestMmfAclntConvertDestNumberOfChannels::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1405 |
{
|
sl@0
|
1406 |
CTestMmfAclntConvertDestNumberOfChannels* self = new (ELeave) CTestMmfAclntConvertDestNumberOfChannels(aTestName,aNegative);
|
sl@0
|
1407 |
return self;
|
sl@0
|
1408 |
}
|
sl@0
|
1409 |
|
sl@0
|
1410 |
void CTestMmfAclntConvertDestNumberOfChannels::GetKeyName(TDes& aDes)
|
sl@0
|
1411 |
{
|
sl@0
|
1412 |
aDes = KAclntConDestNumberChannelsKeyName;
|
sl@0
|
1413 |
}
|
sl@0
|
1414 |
|
sl@0
|
1415 |
TVerdict CTestMmfAclntConvertDestNumberOfChannels::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
1416 |
{
|
sl@0
|
1417 |
INFO_PRINTF1( _L("TestConvertUtils : Destination Number of Channels"));
|
sl@0
|
1418 |
TVerdict ret = EFail;
|
sl@0
|
1419 |
|
sl@0
|
1420 |
TInt err = KErrNone;
|
sl@0
|
1421 |
RArray<TUint> aSupportedNumberOfChannels ;
|
sl@0
|
1422 |
|
sl@0
|
1423 |
TRAP(err,aConverter->GetSupportedConversionNumberOfChannelsL(aSupportedNumberOfChannels));
|
sl@0
|
1424 |
if(err!=KErrNone)
|
sl@0
|
1425 |
{
|
sl@0
|
1426 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::GetSupportedConversionNumberOfChannelsL() leave with error %d"),err);
|
sl@0
|
1427 |
ret = EFail;
|
sl@0
|
1428 |
return ret;
|
sl@0
|
1429 |
}
|
sl@0
|
1430 |
|
sl@0
|
1431 |
TInt numRates = aSupportedNumberOfChannels.Count();
|
sl@0
|
1432 |
|
sl@0
|
1433 |
ret = EPass ;
|
sl@0
|
1434 |
|
sl@0
|
1435 |
for(TInt i=0;i<numRates;i++)
|
sl@0
|
1436 |
{
|
sl@0
|
1437 |
TUint NumberOfChannels = aSupportedNumberOfChannels[i] ;
|
sl@0
|
1438 |
INFO_PRINTF2(_L("NumberOfChannels = %d"), NumberOfChannels);
|
sl@0
|
1439 |
TRAP(err,aConverter->SetDestinationNumberOfChannelsL(aSupportedNumberOfChannels[i]));
|
sl@0
|
1440 |
|
sl@0
|
1441 |
if(err!=KErrNone)
|
sl@0
|
1442 |
{
|
sl@0
|
1443 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SetDestinationNumberOfChannelL() leave with error %d"),err);
|
sl@0
|
1444 |
return ret;
|
sl@0
|
1445 |
}
|
sl@0
|
1446 |
TRAP(err,NumberOfChannels = aConverter->DestinationNumberOfChannelsL());
|
sl@0
|
1447 |
|
sl@0
|
1448 |
if(err!=KErrNone)
|
sl@0
|
1449 |
{
|
sl@0
|
1450 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationNumberOfChannelL leave with error %d"),err);
|
sl@0
|
1451 |
return EFail;
|
sl@0
|
1452 |
}
|
sl@0
|
1453 |
|
sl@0
|
1454 |
if(NumberOfChannels != aSupportedNumberOfChannels[i])
|
sl@0
|
1455 |
ret = EFail;
|
sl@0
|
1456 |
}
|
sl@0
|
1457 |
return ret;
|
sl@0
|
1458 |
}
|
sl@0
|
1459 |
|
sl@0
|
1460 |
//------------------------------------------------------------------
|
sl@0
|
1461 |
|
sl@0
|
1462 |
CTestMmfAclntConvertSourceInfo::CTestMmfAclntConvertSourceInfo(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1463 |
: CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1464 |
{}
|
sl@0
|
1465 |
|
sl@0
|
1466 |
CTestMmfAclntConvertSourceInfo* CTestMmfAclntConvertSourceInfo::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1467 |
{
|
sl@0
|
1468 |
CTestMmfAclntConvertSourceInfo* self = new (ELeave) CTestMmfAclntConvertSourceInfo(aTestName,aNegative);
|
sl@0
|
1469 |
return self;
|
sl@0
|
1470 |
}
|
sl@0
|
1471 |
|
sl@0
|
1472 |
void CTestMmfAclntConvertSourceInfo::GetKeyName(TDes& aDes)
|
sl@0
|
1473 |
{
|
sl@0
|
1474 |
aDes = KAclntConSourceInfoKeyName;
|
sl@0
|
1475 |
}
|
sl@0
|
1476 |
|
sl@0
|
1477 |
TVerdict CTestMmfAclntConvertSourceInfo::DoTestL(CMdaAudioConvertUtility* aConverter)
|
sl@0
|
1478 |
{
|
sl@0
|
1479 |
INFO_PRINTF1( _L("TestConvertUtils : Source Info"));
|
sl@0
|
1480 |
TVerdict ret = EFail;
|
sl@0
|
1481 |
|
sl@0
|
1482 |
TInt err = KErrNone;
|
sl@0
|
1483 |
TUint NumberOfChannels = 0 ;
|
sl@0
|
1484 |
TRAP(err,NumberOfChannels = aConverter->SourceNumberOfChannelsL());
|
sl@0
|
1485 |
if(err!=KErrNone)
|
sl@0
|
1486 |
{
|
sl@0
|
1487 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceNumberOfChannelL leave with error %d"),err);
|
sl@0
|
1488 |
return EFail;
|
sl@0
|
1489 |
}
|
sl@0
|
1490 |
INFO_PRINTF2(_L("NumberOfChannels = %d"), NumberOfChannels);
|
sl@0
|
1491 |
|
sl@0
|
1492 |
TUint BitRate = 0 ;
|
sl@0
|
1493 |
TRAP(err,BitRate = aConverter->SourceBitRateL());
|
sl@0
|
1494 |
if(err!=KErrNone)
|
sl@0
|
1495 |
{
|
sl@0
|
1496 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceBitRateL leave with error %d"),err);
|
sl@0
|
1497 |
return EFail;
|
sl@0
|
1498 |
}
|
sl@0
|
1499 |
INFO_PRINTF2(_L("BitRate = %d"), BitRate);
|
sl@0
|
1500 |
|
sl@0
|
1501 |
TUint SampleRate = 0 ;
|
sl@0
|
1502 |
TRAP(err,SampleRate = aConverter->SourceSampleRateL());
|
sl@0
|
1503 |
if(err!=KErrNone)
|
sl@0
|
1504 |
{
|
sl@0
|
1505 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceSampleRateL leave with error %d"),err);
|
sl@0
|
1506 |
return EFail;
|
sl@0
|
1507 |
}
|
sl@0
|
1508 |
INFO_PRINTF2(_L("SampleRate = %d"), SampleRate);
|
sl@0
|
1509 |
|
sl@0
|
1510 |
|
sl@0
|
1511 |
TUid Format(KUidMdaWavCodec) ;
|
sl@0
|
1512 |
TRAP(err,Format = aConverter->SourceFormatL());
|
sl@0
|
1513 |
if(err!=KErrNone)
|
sl@0
|
1514 |
{
|
sl@0
|
1515 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceFormatL leave with error %d"),err);
|
sl@0
|
1516 |
return EFail;
|
sl@0
|
1517 |
}
|
sl@0
|
1518 |
INFO_PRINTF2(_L("Format = %d"), Format);
|
sl@0
|
1519 |
|
sl@0
|
1520 |
TFourCC dataType;
|
sl@0
|
1521 |
TRAP(err,dataType = aConverter->SourceDataTypeL());
|
sl@0
|
1522 |
|
sl@0
|
1523 |
if(err!=KErrNone)
|
sl@0
|
1524 |
{
|
sl@0
|
1525 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::SourceDataTypeL leave with error %d"),err);
|
sl@0
|
1526 |
return EFail;
|
sl@0
|
1527 |
}
|
sl@0
|
1528 |
TUint8 char1 = TUint8( dataType.FourCC() ) ;
|
sl@0
|
1529 |
TUint8 char2 = TUint8( dataType.FourCC() >> 8 ) ;
|
sl@0
|
1530 |
TUint8 char3 = TUint8( dataType.FourCC() >> 16 ) ;
|
sl@0
|
1531 |
TUint8 char4 = TUint8( dataType.FourCC() >> 24 ) ;
|
sl@0
|
1532 |
INFO_PRINTF5(_L("dataType.FourCC= %1c%1c%1c%1c"), char1, char2, char3, char4);
|
sl@0
|
1533 |
|
sl@0
|
1534 |
ret = EPass;
|
sl@0
|
1535 |
|
sl@0
|
1536 |
return ret ;
|
sl@0
|
1537 |
}
|
sl@0
|
1538 |
|
sl@0
|
1539 |
//------------------------------------------------------------------
|
sl@0
|
1540 |
|
sl@0
|
1541 |
CTestMmfAclntConvertLength::CTestMmfAclntConvertLength(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1542 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1543 |
{
|
sl@0
|
1544 |
}
|
sl@0
|
1545 |
|
sl@0
|
1546 |
CTestMmfAclntConvertLength* CTestMmfAclntConvertLength::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1547 |
{
|
sl@0
|
1548 |
CTestMmfAclntConvertLength* self = new (ELeave) CTestMmfAclntConvertLength(aTestName, aNegative);
|
sl@0
|
1549 |
return self;
|
sl@0
|
1550 |
}
|
sl@0
|
1551 |
|
sl@0
|
1552 |
/**
|
sl@0
|
1553 |
*Set maximum length of file in bytes and Convertord
|
sl@0
|
1554 |
*/
|
sl@0
|
1555 |
TVerdict CTestMmfAclntConvertLength::DoTestL(CMdaAudioConvertUtility* aConvertUtil)
|
sl@0
|
1556 |
{
|
sl@0
|
1557 |
INFO_PRINTF1( _L("TestConvertor : Length"));
|
sl@0
|
1558 |
|
sl@0
|
1559 |
TVerdict ret = EFail;
|
sl@0
|
1560 |
//TTimeIntervalMicroSeconds ConvertTime(aConvertUtil->Duration());
|
sl@0
|
1561 |
|
sl@0
|
1562 |
aConvertUtil->SetMaxWriteLength(800);
|
sl@0
|
1563 |
|
sl@0
|
1564 |
TRAP(iError, aConvertUtil->PlayL()) ;
|
sl@0
|
1565 |
|
sl@0
|
1566 |
if(iError != KErrNone)
|
sl@0
|
1567 |
return EFail;
|
sl@0
|
1568 |
|
sl@0
|
1569 |
CActiveScheduler::Start();
|
sl@0
|
1570 |
|
sl@0
|
1571 |
aConvertUtil->Stop() ;
|
sl@0
|
1572 |
|
sl@0
|
1573 |
//until DEF011919 is not fixed
|
sl@0
|
1574 |
//if(aConvertUtil->Duration() != ConvertTime)
|
sl@0
|
1575 |
ret = EPass;
|
sl@0
|
1576 |
|
sl@0
|
1577 |
return ret;
|
sl@0
|
1578 |
}
|
sl@0
|
1579 |
//------------------------------------------------------------------
|
sl@0
|
1580 |
|
sl@0
|
1581 |
/**
|
sl@0
|
1582 |
* Constructor
|
sl@0
|
1583 |
*/
|
sl@0
|
1584 |
CTestMmfAclntConvertRepeat::CTestMmfAclntConvertRepeat(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1585 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1586 |
{}
|
sl@0
|
1587 |
|
sl@0
|
1588 |
CTestMmfAclntConvertRepeat* CTestMmfAclntConvertRepeat::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1589 |
{
|
sl@0
|
1590 |
CTestMmfAclntConvertRepeat* self = new (ELeave) CTestMmfAclntConvertRepeat(aTestName,aNegative);
|
sl@0
|
1591 |
return self;
|
sl@0
|
1592 |
}
|
sl@0
|
1593 |
|
sl@0
|
1594 |
/**
|
sl@0
|
1595 |
* Set repeats
|
sl@0
|
1596 |
*/
|
sl@0
|
1597 |
TVerdict CTestMmfAclntConvertRepeat::DoTestL(CMdaAudioConvertUtility* aConvertUtil)
|
sl@0
|
1598 |
{
|
sl@0
|
1599 |
INFO_PRINTF1( _L("TestConvert : Repeats"));
|
sl@0
|
1600 |
|
sl@0
|
1601 |
iError = KErrTimedOut;
|
sl@0
|
1602 |
|
sl@0
|
1603 |
TTimeIntervalMicroSeconds silence(0);
|
sl@0
|
1604 |
//just to sutisfy CCover, actualy does nothing
|
sl@0
|
1605 |
aConvertUtil->SetRepeats(NUMBER_OF_REPEATS,silence);
|
sl@0
|
1606 |
|
sl@0
|
1607 |
//TInt duration = I64INT(aConvertUtil->Duration().Int64());
|
sl@0
|
1608 |
|
sl@0
|
1609 |
iError = KErrTimedOut;
|
sl@0
|
1610 |
INFO_PRINTF1( _L("Play CMdaAudioConvertUtility"));
|
sl@0
|
1611 |
//just to sutisfy CCover, actualy calls ConvertL() see
|
sl@0
|
1612 |
TRAP(iError, aConvertUtil->PlayL()) ;
|
sl@0
|
1613 |
if(iError != KErrNone)
|
sl@0
|
1614 |
return EFail;
|
sl@0
|
1615 |
|
sl@0
|
1616 |
CActiveScheduler::Start();
|
sl@0
|
1617 |
|
sl@0
|
1618 |
//TUint actualDuration = I64INT(aConvertUtil->Duration().Int64()) ;
|
sl@0
|
1619 |
|
sl@0
|
1620 |
//INFO_PRINTF2(_L("Repeats : %d"), NUMBER_OF_REPEATS);
|
sl@0
|
1621 |
//INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
|
sl@0
|
1622 |
// iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
|
sl@0
|
1623 |
|
sl@0
|
1624 |
if(iError == KErrNone)
|
sl@0
|
1625 |
return EPass;
|
sl@0
|
1626 |
|
sl@0
|
1627 |
return EFail ;
|
sl@0
|
1628 |
}
|
sl@0
|
1629 |
|
sl@0
|
1630 |
//------------------------------------------------------------------
|
sl@0
|
1631 |
|
sl@0
|
1632 |
/**
|
sl@0
|
1633 |
* Constructor
|
sl@0
|
1634 |
*/
|
sl@0
|
1635 |
CTestMmfAclntConvertCrop::CTestMmfAclntConvertCrop(const TDesC& aTestName, const TBool aCropToEnd, TBool aNegative)
|
sl@0
|
1636 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative),
|
sl@0
|
1637 |
iCropToEnd(aCropToEnd)
|
sl@0
|
1638 |
{
|
sl@0
|
1639 |
}
|
sl@0
|
1640 |
|
sl@0
|
1641 |
CTestMmfAclntConvertCrop* CTestMmfAclntConvertCrop::NewL(const TDesC& aTestName, const TBool aCropToEnd, TBool aNegative)
|
sl@0
|
1642 |
{
|
sl@0
|
1643 |
CTestMmfAclntConvertCrop* self = new (ELeave) CTestMmfAclntConvertCrop(aTestName, aCropToEnd, aNegative);
|
sl@0
|
1644 |
return self;
|
sl@0
|
1645 |
}
|
sl@0
|
1646 |
|
sl@0
|
1647 |
|
sl@0
|
1648 |
/**
|
sl@0
|
1649 |
* Set config destination clip
|
sl@0
|
1650 |
*/
|
sl@0
|
1651 |
TVerdict CTestMmfAclntConvertCrop::DoTestStepL()
|
sl@0
|
1652 |
{
|
sl@0
|
1653 |
INFO_PRINTF1( _L("TestConverter : Config"));
|
sl@0
|
1654 |
TVerdict ret = EFail;
|
sl@0
|
1655 |
|
sl@0
|
1656 |
TPtrC fromFilename;
|
sl@0
|
1657 |
if ((!GetStringFromConfig(_L("SectionOne"), _L("PCM16"), fromFilename))
|
sl@0
|
1658 |
|| (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), iToFilename))
|
sl@0
|
1659 |
|| (!GetStringFromConfig(_L("SectionFour"), _L("configAudio11"), iToFilename2)))
|
sl@0
|
1660 |
return EInconclusive;
|
sl@0
|
1661 |
|
sl@0
|
1662 |
iError = KErrTimedOut;
|
sl@0
|
1663 |
|
sl@0
|
1664 |
CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
1665 |
CleanupStack::PushL(converter);
|
sl@0
|
1666 |
TMdaFileClipLocation location(iToFilename);
|
sl@0
|
1667 |
|
sl@0
|
1668 |
if (iThisIsNegativeTest)
|
sl@0
|
1669 |
{
|
sl@0
|
1670 |
iAudioSettings.iSampleRate = KInvalidNumber;
|
sl@0
|
1671 |
iAudioSettings.iChannels = KInvalidNumber;
|
sl@0
|
1672 |
//to keep CCover happy
|
sl@0
|
1673 |
converter->OpenL(fromFilename, iToFilename2) ;
|
sl@0
|
1674 |
//&location, iFormat, iCodec, &iAudioSettings);
|
sl@0
|
1675 |
}
|
sl@0
|
1676 |
else
|
sl@0
|
1677 |
{
|
sl@0
|
1678 |
converter->OpenL(fromFilename, &location, iFormat, iCodec);
|
sl@0
|
1679 |
}
|
sl@0
|
1680 |
|
sl@0
|
1681 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
1682 |
CActiveScheduler::Start();
|
sl@0
|
1683 |
|
sl@0
|
1684 |
if (iError == KErrNone)
|
sl@0
|
1685 |
ret = DoTestL(converter);
|
sl@0
|
1686 |
|
sl@0
|
1687 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
1688 |
User::After(KOneSecond);
|
sl@0
|
1689 |
|
sl@0
|
1690 |
if (ret == EFail)
|
sl@0
|
1691 |
{
|
sl@0
|
1692 |
INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
|
sl@0
|
1693 |
return ret;
|
sl@0
|
1694 |
}
|
sl@0
|
1695 |
|
sl@0
|
1696 |
if(iThisIsNegativeTest && iError == KErrNotSupported)
|
sl@0
|
1697 |
{
|
sl@0
|
1698 |
ret = EPass;
|
sl@0
|
1699 |
}
|
sl@0
|
1700 |
|
sl@0
|
1701 |
return ret;
|
sl@0
|
1702 |
|
sl@0
|
1703 |
}
|
sl@0
|
1704 |
|
sl@0
|
1705 |
|
sl@0
|
1706 |
void CTestMmfAclntConvertCrop::MoscoStateChangeEvent(CBase* /*aObject*/,
|
sl@0
|
1707 |
TInt aPreviousState,
|
sl@0
|
1708 |
TInt aCurrentState,
|
sl@0
|
1709 |
TInt aErrorCode)
|
sl@0
|
1710 |
{
|
sl@0
|
1711 |
iError = aErrorCode;
|
sl@0
|
1712 |
//iObject = aObject;
|
sl@0
|
1713 |
TInt PreviousState = aPreviousState;
|
sl@0
|
1714 |
TInt CurrentState = aCurrentState;
|
sl@0
|
1715 |
INFO_PRINTF1( _L("CTestMmfAclntDoConv : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
|
sl@0
|
1716 |
INFO_PRINTF4( _L("iError %d PreviousState %d -> CurrentState %d"),
|
sl@0
|
1717 |
iError, PreviousState, CurrentState);
|
sl@0
|
1718 |
//if( CurrentState != CMdaAudioClipUtility::ERecording)
|
sl@0
|
1719 |
//give a chance to finish conversion
|
sl@0
|
1720 |
CActiveScheduler::Stop();
|
sl@0
|
1721 |
}
|
sl@0
|
1722 |
|
sl@0
|
1723 |
TVerdict CTestMmfAclntConvertCrop::DoTestStepPostambleL()
|
sl@0
|
1724 |
{
|
sl@0
|
1725 |
if (iThisIsNegativeTest)
|
sl@0
|
1726 |
{
|
sl@0
|
1727 |
RFs fs;
|
sl@0
|
1728 |
User::LeaveIfError(fs.Connect());
|
sl@0
|
1729 |
|
sl@0
|
1730 |
TInt error = fs.Delete(iToFilename2);
|
sl@0
|
1731 |
if(error == KErrPathNotFound)
|
sl@0
|
1732 |
return EInconclusive;
|
sl@0
|
1733 |
}
|
sl@0
|
1734 |
|
sl@0
|
1735 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
sl@0
|
1736 |
}
|
sl@0
|
1737 |
|
sl@0
|
1738 |
/**
|
sl@0
|
1739 |
* Audio croping.
|
sl@0
|
1740 |
*/
|
sl@0
|
1741 |
TVerdict CTestMmfAclntConvertCrop::DoTestL(CMdaAudioConvertUtility* aConvert)
|
sl@0
|
1742 |
{
|
sl@0
|
1743 |
if (iThisIsNegativeTest)
|
sl@0
|
1744 |
{
|
sl@0
|
1745 |
TInt err = KErrNone;
|
sl@0
|
1746 |
TRAP(err, aConvert->ConvertL());
|
sl@0
|
1747 |
CActiveScheduler::Start();
|
sl@0
|
1748 |
if( err != KErrNone || iError != KErrNone)
|
sl@0
|
1749 |
return EFail;
|
sl@0
|
1750 |
CActiveScheduler::Start();
|
sl@0
|
1751 |
if( err != KErrNone || iError != KErrNone)
|
sl@0
|
1752 |
return EFail;
|
sl@0
|
1753 |
|
sl@0
|
1754 |
TTimeIntervalMicroSeconds cropPoint( TTimeIntervalMicroSeconds(aConvert->Duration().Int64()/2) );
|
sl@0
|
1755 |
TTimeIntervalMicroSeconds cropPoint2( TTimeIntervalMicroSeconds(aConvert->Duration().Int64()*2/3) );
|
sl@0
|
1756 |
|
sl@0
|
1757 |
aConvert->SetPosition(cropPoint);
|
sl@0
|
1758 |
// 1st crop
|
sl@0
|
1759 |
TRAP(err, aConvert->CropL());
|
sl@0
|
1760 |
if(err != KErrNone)
|
sl@0
|
1761 |
return EFail;
|
sl@0
|
1762 |
|
sl@0
|
1763 |
// position beyond the end of the cropped file
|
sl@0
|
1764 |
aConvert->SetPosition(cropPoint2);
|
sl@0
|
1765 |
// 2nd crop
|
sl@0
|
1766 |
TRAP(err, aConvert->CropL());
|
sl@0
|
1767 |
if(err != KErrArgument)
|
sl@0
|
1768 |
return EFail;
|
sl@0
|
1769 |
|
sl@0
|
1770 |
return EPass;
|
sl@0
|
1771 |
}
|
sl@0
|
1772 |
else
|
sl@0
|
1773 |
{
|
sl@0
|
1774 |
TInt err = KErrNone;
|
sl@0
|
1775 |
TRAP(err, aConvert->ConvertL());
|
sl@0
|
1776 |
CActiveScheduler::Start();
|
sl@0
|
1777 |
if( err != KErrNone || iError != KErrNone)
|
sl@0
|
1778 |
return EFail;
|
sl@0
|
1779 |
CActiveScheduler::Start();
|
sl@0
|
1780 |
if( err != KErrNone || iError != KErrNone)
|
sl@0
|
1781 |
return EFail;
|
sl@0
|
1782 |
|
sl@0
|
1783 |
TTimeIntervalMicroSeconds origDuration( TTimeIntervalMicroSeconds(aConvert->Duration().Int64() ));
|
sl@0
|
1784 |
TTimeIntervalMicroSeconds cropPoint( origDuration.Int64()*2/3);
|
sl@0
|
1785 |
aConvert->SetPosition(cropPoint);
|
sl@0
|
1786 |
|
sl@0
|
1787 |
INFO_PRINTF4(_L("crop point %d, duration %d, cropToEnd %d"),
|
sl@0
|
1788 |
I64INT(cropPoint.Int64()),
|
sl@0
|
1789 |
I64INT(origDuration.Int64()),
|
sl@0
|
1790 |
iCropToEnd);
|
sl@0
|
1791 |
|
sl@0
|
1792 |
if(iCropToEnd)
|
sl@0
|
1793 |
{
|
sl@0
|
1794 |
TRAP(iError, aConvert->CropL());
|
sl@0
|
1795 |
}
|
sl@0
|
1796 |
else
|
sl@0
|
1797 |
{
|
sl@0
|
1798 |
TRAP(iError, aConvert->CropFromBeginningL());
|
sl@0
|
1799 |
}
|
sl@0
|
1800 |
if(iError != KErrNone)
|
sl@0
|
1801 |
{
|
sl@0
|
1802 |
ERR_PRINTF2(_L("Crop left with error = %d"),iError);
|
sl@0
|
1803 |
return EFail;
|
sl@0
|
1804 |
}
|
sl@0
|
1805 |
|
sl@0
|
1806 |
// Check if the cropped duration is within the deviation from the expected duration
|
sl@0
|
1807 |
// NB : there is no converter API to check the destination(sink) duration after cropping
|
sl@0
|
1808 |
// but we can check cropping by reopening the file and checking its new duration
|
sl@0
|
1809 |
|
sl@0
|
1810 |
TMdaFileClipLocation location(iToFilename);
|
sl@0
|
1811 |
aConvert->OpenL(iToFilename, &location, iFormat, iCodec);
|
sl@0
|
1812 |
CActiveScheduler::Start();
|
sl@0
|
1813 |
|
sl@0
|
1814 |
TTimeIntervalMicroSeconds newDuration( TTimeIntervalMicroSeconds(aConvert->Duration().Int64() ));
|
sl@0
|
1815 |
TTimeIntervalMicroSeconds expectedDuration;
|
sl@0
|
1816 |
|
sl@0
|
1817 |
if (iCropToEnd)
|
sl@0
|
1818 |
expectedDuration = cropPoint;
|
sl@0
|
1819 |
else
|
sl@0
|
1820 |
expectedDuration = origDuration.Int64() - cropPoint.Int64();
|
sl@0
|
1821 |
|
sl@0
|
1822 |
INFO_PRINTF3(_L("new duration %d, expected %d"),
|
sl@0
|
1823 |
I64INT(newDuration.Int64()),
|
sl@0
|
1824 |
I64INT(expectedDuration.Int64()));
|
sl@0
|
1825 |
|
sl@0
|
1826 |
// check for match within deviation
|
sl@0
|
1827 |
// We should query the duration of one 4K buffer, then use that as the jitter
|
sl@0
|
1828 |
// on whatever file we are testing.
|
sl@0
|
1829 |
TUint bitRate = 0 ;
|
sl@0
|
1830 |
TRAP(err,bitRate = aConvert->DestinationBitRateL());
|
sl@0
|
1831 |
if(err!=KErrNone)
|
sl@0
|
1832 |
{
|
sl@0
|
1833 |
INFO_PRINTF2(_L("CMdaAudioConvertUtility::DestinationBitRateL leave with error %d"),err);
|
sl@0
|
1834 |
return EFail;
|
sl@0
|
1835 |
}
|
sl@0
|
1836 |
INFO_PRINTF2(_L("Bit rate = %d"), bitRate);
|
sl@0
|
1837 |
// buffer duration = no. bytes / byte rate
|
sl@0
|
1838 |
TUint bufDuration = (4096000 / (bitRate / 8)) + 1; // get it in 1/1000 sec, and round up
|
sl@0
|
1839 |
TInt64 dev(bufDuration * 1000);
|
sl@0
|
1840 |
|
sl@0
|
1841 |
INFO_PRINTF2(_L("Buffer duration = %d"), I64INT(dev));
|
sl@0
|
1842 |
TBool durationMatch = EFalse;
|
sl@0
|
1843 |
if (newDuration == expectedDuration)
|
sl@0
|
1844 |
durationMatch = ETrue;
|
sl@0
|
1845 |
else if (newDuration < expectedDuration)
|
sl@0
|
1846 |
{
|
sl@0
|
1847 |
if (expectedDuration <= newDuration.Int64() + dev)
|
sl@0
|
1848 |
durationMatch = ETrue;
|
sl@0
|
1849 |
}
|
sl@0
|
1850 |
else if (newDuration > expectedDuration)
|
sl@0
|
1851 |
{
|
sl@0
|
1852 |
if (expectedDuration >= newDuration.Int64() - dev)
|
sl@0
|
1853 |
durationMatch = ETrue;
|
sl@0
|
1854 |
}
|
sl@0
|
1855 |
|
sl@0
|
1856 |
if (!durationMatch)
|
sl@0
|
1857 |
{
|
sl@0
|
1858 |
ERR_PRINTF1(_L("Cropped duration out of expected range"));
|
sl@0
|
1859 |
return EFail;
|
sl@0
|
1860 |
}
|
sl@0
|
1861 |
return EPass;
|
sl@0
|
1862 |
}
|
sl@0
|
1863 |
|
sl@0
|
1864 |
}
|
sl@0
|
1865 |
|
sl@0
|
1866 |
|
sl@0
|
1867 |
//------------------------------------------------------------------
|
sl@0
|
1868 |
|
sl@0
|
1869 |
/**
|
sl@0
|
1870 |
* Constructor
|
sl@0
|
1871 |
*/
|
sl@0
|
1872 |
CTestMmfAclntConvertStop::CTestMmfAclntConvertStop(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1873 |
:CTestMmfAclntConConfig(aTestName, EPcm16Wav, aNegative)
|
sl@0
|
1874 |
{
|
sl@0
|
1875 |
}
|
sl@0
|
1876 |
|
sl@0
|
1877 |
CTestMmfAclntConvertStop* CTestMmfAclntConvertStop::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
1878 |
{
|
sl@0
|
1879 |
CTestMmfAclntConvertStop* self = new (ELeave) CTestMmfAclntConvertStop(aTestName, aNegative);
|
sl@0
|
1880 |
return self;
|
sl@0
|
1881 |
}
|
sl@0
|
1882 |
|
sl@0
|
1883 |
|
sl@0
|
1884 |
void CTestMmfAclntConvertStop::MoscoStateChangeEvent(CBase* /*aObject*/,
|
sl@0
|
1885 |
TInt aPreviousState,
|
sl@0
|
1886 |
TInt aCurrentState,
|
sl@0
|
1887 |
TInt aErrorCode)
|
sl@0
|
1888 |
{
|
sl@0
|
1889 |
iError = aErrorCode;
|
sl@0
|
1890 |
//iObject = aObject;
|
sl@0
|
1891 |
TInt PreviousState = aPreviousState;
|
sl@0
|
1892 |
TInt CurrentState = aCurrentState;
|
sl@0
|
1893 |
INFO_PRINTF1( _L("CTestMmfAclntDoConv : MMdaObjectStateChangeObserver Callback for CMdaAudioConvertUtility complete"));
|
sl@0
|
1894 |
INFO_PRINTF4( _L("iError %d PreviousState %d -> CurrentState %d"),
|
sl@0
|
1895 |
iError, PreviousState, CurrentState);
|
sl@0
|
1896 |
if( CurrentState != CMdaAudioClipUtility::ERecording)
|
sl@0
|
1897 |
//give a chance to finish conversion
|
sl@0
|
1898 |
CActiveScheduler::Stop();
|
sl@0
|
1899 |
}
|
sl@0
|
1900 |
|
sl@0
|
1901 |
/**
|
sl@0
|
1902 |
* Set config destination clip
|
sl@0
|
1903 |
*/
|
sl@0
|
1904 |
TVerdict CTestMmfAclntConvertStop::DoTestStepL()
|
sl@0
|
1905 |
{
|
sl@0
|
1906 |
INFO_PRINTF1( _L("TestConverter : Config"));
|
sl@0
|
1907 |
TVerdict ret = EFail;
|
sl@0
|
1908 |
//stolen from #include <MMFMdaClient.h>
|
sl@0
|
1909 |
//static const TUid KUidMmfAudioController = {0x101F5022};
|
sl@0
|
1910 |
|
sl@0
|
1911 |
TPtrC toFilename, fromFilename;
|
sl@0
|
1912 |
if ((!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), fromFilename))
|
sl@0
|
1913 |
|| (!GetStringFromConfig(_L("SectionFour"), _L("configAudio"), toFilename)))
|
sl@0
|
1914 |
return EInconclusive;
|
sl@0
|
1915 |
|
sl@0
|
1916 |
//TMdaFileClipLocation toLocation(toFilename);
|
sl@0
|
1917 |
//TMdaFileClipLocation fromLocation(fromFilename);
|
sl@0
|
1918 |
iError = KErrTimedOut;
|
sl@0
|
1919 |
|
sl@0
|
1920 |
CMdaAudioConvertUtility* converter = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
1921 |
CleanupStack::PushL(converter);
|
sl@0
|
1922 |
|
sl@0
|
1923 |
if (iThisIsNegativeTest)
|
sl@0
|
1924 |
{
|
sl@0
|
1925 |
iAudioSettings.iSampleRate = KInvalidNumber;
|
sl@0
|
1926 |
iAudioSettings.iChannels = KInvalidNumber;
|
sl@0
|
1927 |
//to keep CCover happy
|
sl@0
|
1928 |
//converter->OpenL(&fromLocation, &toLocation,
|
sl@0
|
1929 |
// KUidMdaWavPcmCodec, KUidMdaClipFormatAu, KFourCCNULL);
|
sl@0
|
1930 |
converter->OpenL(fromFilename, toFilename) ;
|
sl@0
|
1931 |
}
|
sl@0
|
1932 |
else
|
sl@0
|
1933 |
{
|
sl@0
|
1934 |
//converter->OpenL(&fromLocation, &toLocation,
|
sl@0
|
1935 |
// KUidMmfAudioController, KUidMdaWavPcmCodec, TFourCC('A', 'L', 'A', 'W'));
|
sl@0
|
1936 |
converter->OpenL(fromFilename, toFilename) ;
|
sl@0
|
1937 |
}
|
sl@0
|
1938 |
|
sl@0
|
1939 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
1940 |
CActiveScheduler::Start();
|
sl@0
|
1941 |
|
sl@0
|
1942 |
if (iError == KErrNone)
|
sl@0
|
1943 |
ret = DoTestL(converter);
|
sl@0
|
1944 |
|
sl@0
|
1945 |
if (ret == EFail)
|
sl@0
|
1946 |
INFO_PRINTF2( _L("CMdaAudioConvertUtility failed with error %d"),iError );
|
sl@0
|
1947 |
|
sl@0
|
1948 |
if(iThisIsNegativeTest && iError == KErrNotSupported)
|
sl@0
|
1949 |
{
|
sl@0
|
1950 |
ret = EPass;
|
sl@0
|
1951 |
}
|
sl@0
|
1952 |
|
sl@0
|
1953 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
1954 |
User::After(KOneSecond);
|
sl@0
|
1955 |
return ret;
|
sl@0
|
1956 |
|
sl@0
|
1957 |
}
|
sl@0
|
1958 |
|
sl@0
|
1959 |
|
sl@0
|
1960 |
/**
|
sl@0
|
1961 |
* Conversion stoping.
|
sl@0
|
1962 |
*/
|
sl@0
|
1963 |
TVerdict CTestMmfAclntConvertStop::DoTestL(CMdaAudioConvertUtility* aConvert)
|
sl@0
|
1964 |
{
|
sl@0
|
1965 |
INFO_PRINTF1( _L("TestConvert : Stop"));
|
sl@0
|
1966 |
|
sl@0
|
1967 |
TRAP(iError, aConvert->ConvertL()) ;
|
sl@0
|
1968 |
|
sl@0
|
1969 |
if(iError != KErrNone)
|
sl@0
|
1970 |
return EFail;
|
sl@0
|
1971 |
|
sl@0
|
1972 |
CActiveScheduler::Start();
|
sl@0
|
1973 |
|
sl@0
|
1974 |
aConvert->Stop() ;
|
sl@0
|
1975 |
CActiveScheduler::Start();
|
sl@0
|
1976 |
|
sl@0
|
1977 |
return EPass ;
|
sl@0
|
1978 |
}
|
sl@0
|
1979 |
|
sl@0
|
1980 |
//------------------------------------------------------------------
|
sl@0
|
1981 |
|
sl@0
|
1982 |
/**
|
sl@0
|
1983 |
* Constructor
|
sl@0
|
1984 |
*/
|
sl@0
|
1985 |
CTestMmfAclntConvertDes::CTestMmfAclntConvertDes(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
|
sl@0
|
1986 |
{
|
sl@0
|
1987 |
// store the name of this test case
|
sl@0
|
1988 |
// this is the name that is used by the script file
|
sl@0
|
1989 |
// Each test step initialises it's own name
|
sl@0
|
1990 |
iTestStepName = aTestName;
|
sl@0
|
1991 |
iSectName = aSectName;
|
sl@0
|
1992 |
iKeyName = aKeyName;
|
sl@0
|
1993 |
iTestFormat = aFormat;
|
sl@0
|
1994 |
iCreateDes = aCreateDes;
|
sl@0
|
1995 |
iSize = 0;
|
sl@0
|
1996 |
iAudio = NULL;
|
sl@0
|
1997 |
//128K heap size
|
sl@0
|
1998 |
iHeapSize = 0x20000;
|
sl@0
|
1999 |
}
|
sl@0
|
2000 |
|
sl@0
|
2001 |
CTestMmfAclntConvertDes* CTestMmfAclntConvertDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat,const TBool aCreateDes)
|
sl@0
|
2002 |
{
|
sl@0
|
2003 |
CTestMmfAclntConvertDes* self = new (ELeave) CTestMmfAclntConvertDes(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
sl@0
|
2004 |
return self;
|
sl@0
|
2005 |
}
|
sl@0
|
2006 |
|
sl@0
|
2007 |
CTestMmfAclntConvertDes* CTestMmfAclntConvertDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
|
sl@0
|
2008 |
{
|
sl@0
|
2009 |
CTestMmfAclntConvertDes* self = CTestMmfAclntConvertDes::NewLC(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
sl@0
|
2010 |
CleanupStack::PushL(self);
|
sl@0
|
2011 |
return self;
|
sl@0
|
2012 |
}
|
sl@0
|
2013 |
|
sl@0
|
2014 |
void CTestMmfAclntConvertDes::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
sl@0
|
2015 |
{
|
sl@0
|
2016 |
iError = aErrorCode;
|
sl@0
|
2017 |
INFO_PRINTF4( _L("MMdaObjectStateChangeObserver: previous state: %d current state: %d error: %d"),aPreviousState, aCurrentState, aErrorCode);
|
sl@0
|
2018 |
CActiveScheduler::Stop();
|
sl@0
|
2019 |
}
|
sl@0
|
2020 |
|
sl@0
|
2021 |
TVerdict CTestMmfAclntConvertDes::DoTestStepPreambleL()
|
sl@0
|
2022 |
{
|
sl@0
|
2023 |
|
sl@0
|
2024 |
SetupFormatL(iTestFormat);
|
sl@0
|
2025 |
|
sl@0
|
2026 |
RFs fs;
|
sl@0
|
2027 |
RFile file;
|
sl@0
|
2028 |
|
sl@0
|
2029 |
// Connect to file server
|
sl@0
|
2030 |
User::LeaveIfError(fs.Connect());
|
sl@0
|
2031 |
|
sl@0
|
2032 |
// get the filename from the config (.ini) file
|
sl@0
|
2033 |
TBuf<KSizeBuf> filename;
|
sl@0
|
2034 |
TPtrC filename1;
|
sl@0
|
2035 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
sl@0
|
2036 |
return EInconclusive;
|
sl@0
|
2037 |
GetDriveName(filename);
|
sl@0
|
2038 |
filename.Append(filename1);
|
sl@0
|
2039 |
|
sl@0
|
2040 |
// opem the file to see if it exists and get the size
|
sl@0
|
2041 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
sl@0
|
2042 |
CleanupClosePushL(file);
|
sl@0
|
2043 |
|
sl@0
|
2044 |
User::LeaveIfError(file.Size(iSize));
|
sl@0
|
2045 |
INFO_PRINTF2(_L("size of file is %d\n"),iSize);
|
sl@0
|
2046 |
|
sl@0
|
2047 |
// read the file into a descriptor and use CWavDecodeUtility
|
sl@0
|
2048 |
// to examine the WAV file to get the data length etc.
|
sl@0
|
2049 |
HBufC8* imageData = HBufC8::NewLC(iSize);
|
sl@0
|
2050 |
TPtr8 imageDataPtr(imageData->Des());
|
sl@0
|
2051 |
User::LeaveIfError(file.Read(imageDataPtr));
|
sl@0
|
2052 |
|
sl@0
|
2053 |
CWavDecodeUtility* decodeUtility = CWavDecodeUtility::NewL(imageDataPtr);
|
sl@0
|
2054 |
CleanupStack::PushL(decodeUtility);
|
sl@0
|
2055 |
|
sl@0
|
2056 |
iDataLengthSource = decodeUtility->GetDataLength();
|
sl@0
|
2057 |
iSamples = decodeUtility->GetSamples();
|
sl@0
|
2058 |
iChannels = decodeUtility->GetChannels();
|
sl@0
|
2059 |
|
sl@0
|
2060 |
INFO_PRINTF2( _L("Sample Rate = %d"), decodeUtility->GetSampleRate());
|
sl@0
|
2061 |
|
sl@0
|
2062 |
INFO_PRINTF2( _L("Data length = %d"), iDataLengthSource);
|
sl@0
|
2063 |
INFO_PRINTF2( _L("Channels = %d"), iChannels);
|
sl@0
|
2064 |
INFO_PRINTF2( _L("Num of samples = %d"), iSamples);
|
sl@0
|
2065 |
|
sl@0
|
2066 |
CleanupStack::PopAndDestroy(3,&file); // decodeUtility, imageData, file
|
sl@0
|
2067 |
|
sl@0
|
2068 |
switch (iTestFormat)
|
sl@0
|
2069 |
{
|
sl@0
|
2070 |
case EPcm16Wav:
|
sl@0
|
2071 |
iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
|
sl@0
|
2072 |
iFrameSize = 4096;
|
sl@0
|
2073 |
iFileSizeSink = KWavFileUncompressedDataHeaderSize + iSamples * iChannels * 16 /*BitsPerSample*/ / 8;
|
sl@0
|
2074 |
break;
|
sl@0
|
2075 |
|
sl@0
|
2076 |
case EAlawWav:
|
sl@0
|
2077 |
iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
|
sl@0
|
2078 |
iFrameSize = 4096;
|
sl@0
|
2079 |
iFileSizeSink = KWavFileUncompressedDataHeaderSize + iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
|
sl@0
|
2080 |
break;
|
sl@0
|
2081 |
|
sl@0
|
2082 |
case EPcm8:
|
sl@0
|
2083 |
iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
|
sl@0
|
2084 |
iFrameSize = 4096;
|
sl@0
|
2085 |
iFileSizeSink = KWavFileUncompressedDataHeaderSize + iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
|
sl@0
|
2086 |
break;
|
sl@0
|
2087 |
|
sl@0
|
2088 |
case EImaAdpcmWav:
|
sl@0
|
2089 |
case EImasPcmWav:
|
sl@0
|
2090 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KImaAdpcmFactChunkSize;
|
sl@0
|
2091 |
iFrameSize = 4096;
|
sl@0
|
2092 |
break;
|
sl@0
|
2093 |
|
sl@0
|
2094 |
case EMulawRaw:
|
sl@0
|
2095 |
iHeaderSize = 0;
|
sl@0
|
2096 |
iFrameSize = 4096;
|
sl@0
|
2097 |
iFileSizeSink = iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
|
sl@0
|
2098 |
break;
|
sl@0
|
2099 |
|
sl@0
|
2100 |
case EPcmU8:
|
sl@0
|
2101 |
iHeaderSize = 0;
|
sl@0
|
2102 |
iFrameSize = 4096;
|
sl@0
|
2103 |
iFileSizeSink = iSamples * iChannels * 8 /*BitsPerSample*/ / 8;
|
sl@0
|
2104 |
break;
|
sl@0
|
2105 |
|
sl@0
|
2106 |
case EPcmU16:
|
sl@0
|
2107 |
iHeaderSize = 0;
|
sl@0
|
2108 |
iFrameSize = 4096;
|
sl@0
|
2109 |
iFileSizeSink = iSamples * iChannels * 16 /*BitsPerSample*/ / 8;
|
sl@0
|
2110 |
break;
|
sl@0
|
2111 |
|
sl@0
|
2112 |
case EGsmWav:
|
sl@0
|
2113 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KGSMFactChunkSize;
|
sl@0
|
2114 |
iFrameSize = 4096;
|
sl@0
|
2115 |
break;
|
sl@0
|
2116 |
|
sl@0
|
2117 |
case E16BitAu:
|
sl@0
|
2118 |
iHeaderSize = KAuFileUncompressedDataHeaderSize;
|
sl@0
|
2119 |
iFrameSize = 4096;
|
sl@0
|
2120 |
iFileSizeSink = iHeaderSize + iSamples * iChannels * 16 /*BitsPerSample*/ / 8;
|
sl@0
|
2121 |
|
sl@0
|
2122 |
default:
|
sl@0
|
2123 |
/*skip*/ ;
|
sl@0
|
2124 |
iHeaderSize = 0;
|
sl@0
|
2125 |
iFrameSize = 1;
|
sl@0
|
2126 |
break ;
|
sl@0
|
2127 |
}
|
sl@0
|
2128 |
|
sl@0
|
2129 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
sl@0
|
2130 |
}
|
sl@0
|
2131 |
|
sl@0
|
2132 |
TVerdict CTestMmfAclntConvertDes::DoTestStepPostambleL()
|
sl@0
|
2133 |
{
|
sl@0
|
2134 |
delete iAudio;
|
sl@0
|
2135 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
sl@0
|
2136 |
}
|
sl@0
|
2137 |
|
sl@0
|
2138 |
void CTestMmfAclntConvertDes::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration)
|
sl@0
|
2139 |
{
|
sl@0
|
2140 |
iError = aError;
|
sl@0
|
2141 |
iDuration = aDuration;
|
sl@0
|
2142 |
INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete"));
|
sl@0
|
2143 |
CActiveScheduler::Stop();
|
sl@0
|
2144 |
}
|
sl@0
|
2145 |
|
sl@0
|
2146 |
void CTestMmfAclntConvertDes::MapcPlayComplete(TInt aError)
|
sl@0
|
2147 |
{
|
sl@0
|
2148 |
iError = aError;
|
sl@0
|
2149 |
INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete"));
|
sl@0
|
2150 |
CActiveScheduler::Stop();
|
sl@0
|
2151 |
}
|
sl@0
|
2152 |
|
sl@0
|
2153 |
/**
|
sl@0
|
2154 |
* Open a descriptor and Convertord
|
sl@0
|
2155 |
*/
|
sl@0
|
2156 |
TVerdict CTestMmfAclntConvertDes::DoTestStepL( void )
|
sl@0
|
2157 |
{
|
sl@0
|
2158 |
INFO_PRINTF1( _L("TestConvertor : Convert Des"));
|
sl@0
|
2159 |
TVerdict ret = EPass;
|
sl@0
|
2160 |
HBufC8* audioTo = NULL;
|
sl@0
|
2161 |
TMdaDesClipLocation* toLocation = NULL;
|
sl@0
|
2162 |
|
sl@0
|
2163 |
CMdaAudioConvertUtility* ConvertUtil = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
2164 |
CleanupStack::PushL(ConvertUtil);
|
sl@0
|
2165 |
|
sl@0
|
2166 |
TBuf<KSizeBuf> filename;
|
sl@0
|
2167 |
TPtrC filename1;
|
sl@0
|
2168 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
sl@0
|
2169 |
return EInconclusive;
|
sl@0
|
2170 |
GetDriveName(filename);
|
sl@0
|
2171 |
filename.Append(filename1);
|
sl@0
|
2172 |
//output buffer 2 much than input one
|
sl@0
|
2173 |
audioTo = HBufC8::NewMaxLC(iSize*2);
|
sl@0
|
2174 |
TPtr8 toBufferDes(audioTo->Des());
|
sl@0
|
2175 |
toBufferDes.SetLength(0);
|
sl@0
|
2176 |
|
sl@0
|
2177 |
toLocation = new (ELeave) TMdaDesClipLocation(toBufferDes);
|
sl@0
|
2178 |
CleanupStack::PushL(toLocation);
|
sl@0
|
2179 |
|
sl@0
|
2180 |
ConvertUtil->OpenL(filename, toLocation,
|
sl@0
|
2181 |
iFormat, iCodec) ;
|
sl@0
|
2182 |
|
sl@0
|
2183 |
iError = KErrTimedOut;
|
sl@0
|
2184 |
|
sl@0
|
2185 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
2186 |
CActiveScheduler::Start();
|
sl@0
|
2187 |
|
sl@0
|
2188 |
if(iError == KErrNone)
|
sl@0
|
2189 |
{
|
sl@0
|
2190 |
iError = KErrTimedOut;
|
sl@0
|
2191 |
ConvertUtil->ConvertL();
|
sl@0
|
2192 |
INFO_PRINTF1( _L("Convertord CMdaAudioConvertUtility"));
|
sl@0
|
2193 |
CActiveScheduler::Start(); // open->Convertord
|
sl@0
|
2194 |
|
sl@0
|
2195 |
if (iError == KErrNone)
|
sl@0
|
2196 |
{
|
sl@0
|
2197 |
// wait to run out of space Convertording
|
sl@0
|
2198 |
CActiveScheduler::Start();
|
sl@0
|
2199 |
|
sl@0
|
2200 |
if(iError == KErrNone)
|
sl@0
|
2201 |
{
|
sl@0
|
2202 |
INFO_PRINTF3(_L("Length %d, expected = %d"), audioTo->Length(), iFileSizeSink);
|
sl@0
|
2203 |
// compare length with expected
|
sl@0
|
2204 |
if (iFileSizeSink > 0)
|
sl@0
|
2205 |
{
|
sl@0
|
2206 |
//is it a good size?
|
sl@0
|
2207 |
if((audioTo->Length()) != (static_cast<TInt> (iFileSizeSink)) )
|
sl@0
|
2208 |
{
|
sl@0
|
2209 |
ret = EFail;
|
sl@0
|
2210 |
}
|
sl@0
|
2211 |
}
|
sl@0
|
2212 |
else
|
sl@0
|
2213 |
{
|
sl@0
|
2214 |
ret = EInconclusive;
|
sl@0
|
2215 |
}
|
sl@0
|
2216 |
|
sl@0
|
2217 |
// For good measure,
|
sl@0
|
2218 |
// check the validity of the conversion by comparing duration
|
sl@0
|
2219 |
// with original file - but not for raw files
|
sl@0
|
2220 |
if (iHeaderSize > 0)
|
sl@0
|
2221 |
{
|
sl@0
|
2222 |
CMdaAudioPlayerUtility* player = NULL;
|
sl@0
|
2223 |
player = CMdaAudioPlayerUtility::NewDesPlayerL(*audioTo, *this);
|
sl@0
|
2224 |
CleanupStack::PushL(player);
|
sl@0
|
2225 |
|
sl@0
|
2226 |
// Wait for init callback
|
sl@0
|
2227 |
INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility"));
|
sl@0
|
2228 |
CActiveScheduler::Start();
|
sl@0
|
2229 |
|
sl@0
|
2230 |
player->Play();
|
sl@0
|
2231 |
// Wait for play complete callback
|
sl@0
|
2232 |
INFO_PRINTF1( _L("CMdaAudioPlayerUtility::Play()"));
|
sl@0
|
2233 |
CActiveScheduler::Start();
|
sl@0
|
2234 |
|
sl@0
|
2235 |
INFO_PRINTF3( _L("Duration = %ld, expected = %ld"), I64LOW(player->Duration().Int64()), I64LOW(ConvertUtil->Duration().Int64()));
|
sl@0
|
2236 |
|
sl@0
|
2237 |
if (iError != KErrNone)
|
sl@0
|
2238 |
{
|
sl@0
|
2239 |
ERR_PRINTF2( _L("Play failed with error : %d"),iError);
|
sl@0
|
2240 |
ret = EFail;
|
sl@0
|
2241 |
}
|
sl@0
|
2242 |
else if (ConvertUtil->Duration() != player->Duration())
|
sl@0
|
2243 |
{
|
sl@0
|
2244 |
ERR_PRINTF3( _L("Actual Duration : %ld does not match the Expected Duration : %ld"),player->Duration().Int64(), ConvertUtil->Duration().Int64());
|
sl@0
|
2245 |
ret = EFail;
|
sl@0
|
2246 |
}
|
sl@0
|
2247 |
|
sl@0
|
2248 |
CleanupStack::PopAndDestroy(player);
|
sl@0
|
2249 |
}
|
sl@0
|
2250 |
}
|
sl@0
|
2251 |
}
|
sl@0
|
2252 |
}
|
sl@0
|
2253 |
|
sl@0
|
2254 |
#if defined __WRITE_CONVERSION_TO_FILE
|
sl@0
|
2255 |
{
|
sl@0
|
2256 |
_LIT(KFileOutRaw, "\\TEST.AU");
|
sl@0
|
2257 |
RFs fs;
|
sl@0
|
2258 |
|
sl@0
|
2259 |
fs.Connect();
|
sl@0
|
2260 |
RFile file;
|
sl@0
|
2261 |
file.Replace(fs, KFileOutRaw(), EFileWrite);
|
sl@0
|
2262 |
file.Write(audioTo->Des());
|
sl@0
|
2263 |
TInt len = audioTo->Length();
|
sl@0
|
2264 |
file.Size(len);
|
sl@0
|
2265 |
file.Close();
|
sl@0
|
2266 |
fs.Close();
|
sl@0
|
2267 |
}
|
sl@0
|
2268 |
#endif
|
sl@0
|
2269 |
if (ret != EPass)
|
sl@0
|
2270 |
ERR_PRINTF2( _L("CMdaAudioConvertorderUtility failed with error %d"),iError );
|
sl@0
|
2271 |
|
sl@0
|
2272 |
CleanupStack::PopAndDestroy(toLocation);
|
sl@0
|
2273 |
CleanupStack::PopAndDestroy(audioTo);
|
sl@0
|
2274 |
CleanupStack::PopAndDestroy(ConvertUtil);
|
sl@0
|
2275 |
|
sl@0
|
2276 |
User::After(KOneSecond);
|
sl@0
|
2277 |
return ret;
|
sl@0
|
2278 |
|
sl@0
|
2279 |
}
|
sl@0
|
2280 |
//---------------------------------------------------------------------
|
sl@0
|
2281 |
/**
|
sl@0
|
2282 |
* Constructor
|
sl@0
|
2283 |
*/
|
sl@0
|
2284 |
CTestMmfAclntConvertUrl::CTestMmfAclntConvertUrl(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
2285 |
:CTestMmfAclntConConfig(aTestName, EAlawWav, aNegative)
|
sl@0
|
2286 |
{}
|
sl@0
|
2287 |
|
sl@0
|
2288 |
CTestMmfAclntConvertUrl* CTestMmfAclntConvertUrl::NewL(const TDesC& aTestName, TBool aNegative)
|
sl@0
|
2289 |
{
|
sl@0
|
2290 |
CTestMmfAclntConvertUrl* self = new (ELeave) CTestMmfAclntConvertUrl(aTestName,aNegative);
|
sl@0
|
2291 |
return self;
|
sl@0
|
2292 |
}
|
sl@0
|
2293 |
|
sl@0
|
2294 |
/**
|
sl@0
|
2295 |
* Set Urls
|
sl@0
|
2296 |
*/
|
sl@0
|
2297 |
TVerdict CTestMmfAclntConvertUrl::DoTestStepL()
|
sl@0
|
2298 |
{
|
sl@0
|
2299 |
INFO_PRINTF1( _L("TestConvert : Urls"));
|
sl@0
|
2300 |
TVerdict ret = EFail;
|
sl@0
|
2301 |
TMdaUrlClipLocation* toLocation = new (ELeave)
|
sl@0
|
2302 |
TMdaUrlClipLocation(_L("http://www.symbian.com"),KUseDefaultIap);
|
sl@0
|
2303 |
CleanupStack::PushL(toLocation);
|
sl@0
|
2304 |
|
sl@0
|
2305 |
CMdaAudioConvertUtility* ConvertUtil = CMdaAudioConvertUtility::NewL(*this);
|
sl@0
|
2306 |
CleanupStack::PushL(ConvertUtil);
|
sl@0
|
2307 |
|
sl@0
|
2308 |
TBuf<KSizeBuf> fromFileName;
|
sl@0
|
2309 |
TPtrC pFromFileName;
|
sl@0
|
2310 |
if(!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), pFromFileName))
|
sl@0
|
2311 |
return EInconclusive;
|
sl@0
|
2312 |
GetDriveName(fromFileName);
|
sl@0
|
2313 |
fromFileName.Append(pFromFileName);
|
sl@0
|
2314 |
|
sl@0
|
2315 |
TRAP(iError, ConvertUtil->OpenL(fromFileName, toLocation, iFormat, iCodec)) ;
|
sl@0
|
2316 |
if(iError == KErrNone)
|
sl@0
|
2317 |
{
|
sl@0
|
2318 |
//should not work for time being
|
sl@0
|
2319 |
iError = KErrTimedOut;
|
sl@0
|
2320 |
INFO_PRINTF1( _L("Initialise CMdaAudioConvertUtility"));
|
sl@0
|
2321 |
CActiveScheduler::Start();
|
sl@0
|
2322 |
if(iError == KErrNotSupported)
|
sl@0
|
2323 |
ret = EPass ;
|
sl@0
|
2324 |
else
|
sl@0
|
2325 |
{
|
sl@0
|
2326 |
|
sl@0
|
2327 |
TRAP(iError, ConvertUtil->ConvertL()) ;
|
sl@0
|
2328 |
if(iError != KErrNone)
|
sl@0
|
2329 |
{
|
sl@0
|
2330 |
ERR_PRINTF2(_L("Convert left with error = %d"),iError);
|
sl@0
|
2331 |
ret = EFail;
|
sl@0
|
2332 |
}
|
sl@0
|
2333 |
|
sl@0
|
2334 |
CActiveScheduler::Start();
|
sl@0
|
2335 |
if(iError == KErrNotSupported)
|
sl@0
|
2336 |
ret = EPass ;
|
sl@0
|
2337 |
}
|
sl@0
|
2338 |
//CActiveScheduler::Start();
|
sl@0
|
2339 |
}
|
sl@0
|
2340 |
else if(iError == KErrNotSupported)
|
sl@0
|
2341 |
{ //expected result
|
sl@0
|
2342 |
|
sl@0
|
2343 |
ERR_PRINTF2(_L("OpenL left with error = %d. It's OK for now!"),iError);
|
sl@0
|
2344 |
ret = EPass ;
|
sl@0
|
2345 |
}
|
sl@0
|
2346 |
|
sl@0
|
2347 |
CleanupStack::PopAndDestroy(ConvertUtil);
|
sl@0
|
2348 |
CleanupStack::PopAndDestroy(toLocation);
|
sl@0
|
2349 |
return ret;
|
sl@0
|
2350 |
}
|