0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
#include "TestPlayer.h"
|
|
17 |
|
|
18 |
#include <e32math.h>
|
|
19 |
|
|
20 |
/**
|
|
21 |
* Constructor
|
|
22 |
*/
|
|
23 |
CTestVclntVideoFile::CTestVclntVideoFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
24 |
:iPlay (aPlay)
|
|
25 |
{
|
|
26 |
// store the name of this test case
|
|
27 |
// this is the name that is used by the script file
|
|
28 |
// Each test step initialises it's own name
|
|
29 |
iTestStepName = aTestName;
|
|
30 |
iSectName = aSectName;
|
|
31 |
iKeyName = aKeyName;
|
|
32 |
|
|
33 |
// expand heap, so we can load 80k video
|
|
34 |
iHeapSize = 150000;
|
|
35 |
}
|
|
36 |
|
|
37 |
CTestVclntVideoFile* CTestVclntVideoFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
38 |
{
|
|
39 |
CTestVclntVideoFile* self = new (ELeave) CTestVclntVideoFile(aTestName,aSectName,aKeyName,aPlay);
|
|
40 |
return self;
|
|
41 |
}
|
|
42 |
|
|
43 |
CTestVclntVideoFile* CTestVclntVideoFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
44 |
{
|
|
45 |
CTestVclntVideoFile* self = CTestVclntVideoFile::NewLC(aTestName,aSectName,aKeyName,aPlay);
|
|
46 |
CleanupStack::PushL(self);
|
|
47 |
return self;
|
|
48 |
}
|
|
49 |
|
|
50 |
void CTestVclntVideoFile::MvpuoOpenComplete(TInt aError)
|
|
51 |
{
|
|
52 |
iError = aError;
|
|
53 |
INFO_PRINTF1(_L("Open Complete callback"));
|
|
54 |
CActiveScheduler::Stop();
|
|
55 |
}
|
|
56 |
|
|
57 |
void CTestVclntVideoFile::MvpuoPrepareComplete(TInt aError)
|
|
58 |
{
|
|
59 |
iError = aError;
|
|
60 |
INFO_PRINTF1(_L("Open Complete callback"));
|
|
61 |
CActiveScheduler::Stop();
|
|
62 |
}
|
|
63 |
|
|
64 |
void CTestVclntVideoFile::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt aError)
|
|
65 |
{
|
|
66 |
iError = aError;
|
|
67 |
INFO_PRINTF1(_L("Frame Ready callback"));
|
|
68 |
}
|
|
69 |
|
|
70 |
void CTestVclntVideoFile::MvpuoPlayComplete(TInt aError)
|
|
71 |
{
|
|
72 |
iError = aError;
|
|
73 |
INFO_PRINTF1(_L("Play Complete callback"));
|
|
74 |
CActiveScheduler::Stop();
|
|
75 |
}
|
|
76 |
|
|
77 |
void CTestVclntVideoFile::MvpuoEvent(const TMMFEvent& /*aEvent*/)
|
|
78 |
{
|
|
79 |
}
|
|
80 |
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Load and initialise an audio file.
|
|
84 |
*/
|
|
85 |
TVerdict CTestVclntVideoFile::DoTestStepL()
|
|
86 |
{
|
|
87 |
TVerdict ret = EFail;
|
|
88 |
iError = KErrTimedOut;
|
|
89 |
|
|
90 |
INFO_PRINTF1(_L("Test : Video Player - File"));
|
|
91 |
|
|
92 |
TPtrC filename;
|
|
93 |
if(!GetStringFromConfig(iSectName,iKeyName,filename))
|
|
94 |
return EInconclusive;
|
|
95 |
|
|
96 |
InitWservL();
|
|
97 |
|
|
98 |
TRect rect, clipRect;
|
|
99 |
CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
|
|
100 |
EMdaPriorityPreferenceTimeAndQuality,
|
|
101 |
iWs, *iScreen, *iWindow, rect, clipRect);
|
|
102 |
CleanupStack::PushL(player);
|
|
103 |
TRAP(iError,player->OpenFileL(filename));
|
|
104 |
|
|
105 |
if(iError == KErrNone)
|
|
106 |
{
|
|
107 |
// Wait for initialisation callback
|
|
108 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file"));
|
|
109 |
CActiveScheduler::Start();
|
|
110 |
}
|
|
111 |
|
|
112 |
#ifndef JETSTREAM_TESTS
|
|
113 |
if(iError == KErrNotSupported)
|
|
114 |
ret = EPass;
|
|
115 |
#endif
|
|
116 |
|
|
117 |
// Check for errors.
|
|
118 |
if (iError == KErrNone && player != NULL)
|
|
119 |
{
|
|
120 |
player->Prepare();
|
|
121 |
CActiveScheduler::Start();
|
|
122 |
}
|
|
123 |
|
|
124 |
// Check for errors.
|
|
125 |
if (iError == KErrNone && player != NULL)
|
|
126 |
ret = DoTestL(player);
|
|
127 |
|
|
128 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying"));
|
|
129 |
CleanupStack::PopAndDestroy(player);
|
|
130 |
if(iError != KErrNone)
|
|
131 |
ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
|
|
132 |
return ret;
|
|
133 |
}
|
|
134 |
|
|
135 |
TVerdict CTestVclntVideoFile::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
136 |
{
|
|
137 |
TVerdict ret = EFail;
|
|
138 |
|
|
139 |
// #ifdef JETSTREAM_TESTS
|
|
140 |
if(iPlay)
|
|
141 |
{
|
|
142 |
iError = KErrTimedOut;
|
|
143 |
aPlayer->Play();
|
|
144 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing file"));
|
|
145 |
// Wait for init callback
|
|
146 |
CActiveScheduler::Start();
|
|
147 |
if(iError == KErrNone)
|
|
148 |
ret = EPass;
|
|
149 |
}
|
|
150 |
else
|
|
151 |
ret = EPass;
|
|
152 |
// #else
|
|
153 |
// aPlayer->Stop();
|
|
154 |
// #endif
|
|
155 |
|
|
156 |
return ret;
|
|
157 |
}
|
|
158 |
|
|
159 |
//------------------------------------------------------------------
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Constructor
|
|
163 |
*/
|
|
164 |
CTestVclntVideoDes::CTestVclntVideoDes(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TBool aPlay)
|
|
165 |
:iPlay (aPlay)
|
|
166 |
|
|
167 |
{
|
|
168 |
// store the name of this test case
|
|
169 |
// this is the name that is used by the script file
|
|
170 |
// Each test step initialises it's own name
|
|
171 |
iTestStepName = aTestName;
|
|
172 |
iSectName = aSectName;
|
|
173 |
iKeyName = aKeyName;
|
|
174 |
|
|
175 |
// *** Jim : expand heap, so we can load 80k video
|
|
176 |
iHeapSize = 150000;
|
|
177 |
}
|
|
178 |
|
|
179 |
CTestVclntVideoDes* CTestVclntVideoDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
180 |
{
|
|
181 |
CTestVclntVideoDes* self = new (ELeave) CTestVclntVideoDes(aTestName,aSectName,aKeyName,aPlay);
|
|
182 |
return self;
|
|
183 |
}
|
|
184 |
|
|
185 |
CTestVclntVideoDes* CTestVclntVideoDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
186 |
{
|
|
187 |
CTestVclntVideoDes* self = CTestVclntVideoDes::NewLC(aTestName,aSectName,aKeyName,aPlay);
|
|
188 |
CleanupStack::PushL(self);
|
|
189 |
return self;
|
|
190 |
}
|
|
191 |
|
|
192 |
void CTestVclntVideoDes::MvpuoOpenComplete(TInt aError)
|
|
193 |
{
|
|
194 |
iError = aError;
|
|
195 |
CActiveScheduler::Stop();
|
|
196 |
}
|
|
197 |
|
|
198 |
void CTestVclntVideoDes::MvpuoPrepareComplete(TInt aError)
|
|
199 |
{
|
|
200 |
iError = aError;
|
|
201 |
CActiveScheduler::Stop();
|
|
202 |
}
|
|
203 |
|
|
204 |
void CTestVclntVideoDes::MvpuoFrameReady(CFbsBitmap& /*aFrame*/,TInt aError)
|
|
205 |
{
|
|
206 |
iError = aError;
|
|
207 |
// Will this function require a Active Scheduler Stop?
|
|
208 |
}
|
|
209 |
|
|
210 |
void CTestVclntVideoDes::MvpuoPlayComplete(TInt aError)
|
|
211 |
{
|
|
212 |
iError = aError;
|
|
213 |
CActiveScheduler::Stop();
|
|
214 |
}
|
|
215 |
|
|
216 |
void CTestVclntVideoDes::MvpuoEvent(const TMMFEvent& /*aEvent*/)
|
|
217 |
{
|
|
218 |
}
|
|
219 |
|
|
220 |
|
|
221 |
TVerdict CTestVclntVideoDes::DoTestStepPreambleL()
|
|
222 |
{
|
|
223 |
TPtrC filename;
|
|
224 |
if(!GetStringFromConfig(iSectName, iKeyName, filename))
|
|
225 |
return EInconclusive;
|
|
226 |
|
|
227 |
RFs fs;
|
|
228 |
RFile file;
|
|
229 |
TInt size = 0;
|
|
230 |
|
|
231 |
// connect to file system and open file
|
|
232 |
User::LeaveIfError(fs.Connect());
|
|
233 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
234 |
CleanupClosePushL(file);
|
|
235 |
|
|
236 |
// Set HBuf size
|
|
237 |
User::LeaveIfError(file.Size(size));
|
|
238 |
INFO_PRINTF2(_L("size of file = %d\n"),size);//Statement Changed under DEF105143
|
|
239 |
|
|
240 |
iVideo = HBufC8::NewMaxL(size);
|
|
241 |
|
|
242 |
// read data into Hbuf
|
|
243 |
TPtr8 bufferDes(iVideo->Des());
|
|
244 |
User::LeaveIfError(file.Read(bufferDes));
|
|
245 |
|
|
246 |
CleanupStack::PopAndDestroy(); //file
|
|
247 |
return CTestMmfVclntStep::DoTestStepPreambleL();
|
|
248 |
}
|
|
249 |
|
|
250 |
TVerdict CTestVclntVideoDes::DoTestStepPostambleL()
|
|
251 |
{
|
|
252 |
delete iVideo;
|
|
253 |
iVideo = NULL;
|
|
254 |
return CTestMmfVclntStep::DoTestStepPostambleL();
|
|
255 |
}
|
|
256 |
|
|
257 |
/**
|
|
258 |
* Load and initialise an audio descriptor.
|
|
259 |
*/
|
|
260 |
TVerdict CTestVclntVideoDes::DoTestStepL()
|
|
261 |
{
|
|
262 |
TVerdict ret = EFail;
|
|
263 |
|
|
264 |
INFO_PRINTF1(_L("Test : Video Player - Descriptor"));
|
|
265 |
|
|
266 |
iError = KErrTimedOut;
|
|
267 |
|
|
268 |
InitWservL();
|
|
269 |
|
|
270 |
TRect rect, clipRect;
|
|
271 |
CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
|
|
272 |
EMdaPriorityPreferenceTimeAndQuality,
|
|
273 |
iWs, *iScreen, *iWindow, rect, clipRect);
|
|
274 |
CleanupStack::PushL(player);
|
|
275 |
|
|
276 |
|
|
277 |
TRAP(iError, player->OpenDesL(iVideo->Des()));
|
|
278 |
|
|
279 |
if(iError == KErrNone)
|
|
280 |
{
|
|
281 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Opening descriptor"));
|
|
282 |
// Wait for init callback
|
|
283 |
CActiveScheduler::Start();
|
|
284 |
}
|
|
285 |
|
|
286 |
#ifndef JETSTREAM_TESTS
|
|
287 |
if(iError == KErrNotSupported)
|
|
288 |
ret = EPass;
|
|
289 |
#endif
|
|
290 |
|
|
291 |
if (iError == KErrNone && player != NULL)
|
|
292 |
{
|
|
293 |
player->Prepare();
|
|
294 |
CActiveScheduler::Start();
|
|
295 |
}
|
|
296 |
|
|
297 |
|
|
298 |
if ((iError == KErrNone) && (player != NULL))
|
|
299 |
ret = DoTestL(player);
|
|
300 |
|
|
301 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying"));
|
|
302 |
CleanupStack::PopAndDestroy(player);
|
|
303 |
if(iError != KErrNone)
|
|
304 |
ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
|
|
305 |
return ret;
|
|
306 |
}
|
|
307 |
|
|
308 |
TVerdict CTestVclntVideoDes::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
309 |
{
|
|
310 |
TVerdict ret = EFail;
|
|
311 |
// #ifdef JETSTREAM_TESTS
|
|
312 |
|
|
313 |
if(iPlay)
|
|
314 |
{
|
|
315 |
iError = KErrTimedOut;
|
|
316 |
aPlayer->Play();
|
|
317 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing descriptor"));
|
|
318 |
// Wait for init callback
|
|
319 |
CActiveScheduler::Start();
|
|
320 |
if(iError == KErrNone)
|
|
321 |
ret = EPass;
|
|
322 |
}
|
|
323 |
else
|
|
324 |
ret = EPass;
|
|
325 |
//#else
|
|
326 |
// aPlayer->Stop();
|
|
327 |
//#endif
|
|
328 |
return ret;
|
|
329 |
}
|
|
330 |
|
|
331 |
|
|
332 |
//------------------------------------------------------------------
|
|
333 |
|
|
334 |
/**
|
|
335 |
* Constructor
|
|
336 |
*/
|
|
337 |
CTestVclntVideoUrl::CTestVclntVideoUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
338 |
:iPlay (aPlay)
|
|
339 |
{
|
|
340 |
// store the name of this test case
|
|
341 |
// this is the name that is used by the script file
|
|
342 |
// Each test step initialises it's own name
|
|
343 |
iTestStepName = aTestName;
|
|
344 |
iSectName = aSectName;
|
|
345 |
iKeyName = aKeyName;
|
|
346 |
}
|
|
347 |
|
|
348 |
CTestVclntVideoUrl* CTestVclntVideoUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
349 |
{
|
|
350 |
CTestVclntVideoUrl* self = CTestVclntVideoUrl::NewLC(aTestName,aSectName,aKeyName,aPlay);
|
|
351 |
CleanupStack::Pop();
|
|
352 |
return self;
|
|
353 |
}
|
|
354 |
|
|
355 |
CTestVclntVideoUrl* CTestVclntVideoUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
|
|
356 |
{
|
|
357 |
CTestVclntVideoUrl* self = new (ELeave) CTestVclntVideoUrl(aTestName,aSectName,aKeyName,aPlay);
|
|
358 |
CleanupStack::PushL(self);
|
|
359 |
return self;
|
|
360 |
}
|
|
361 |
|
|
362 |
void CTestVclntVideoUrl::MvpuoOpenComplete(TInt aError)
|
|
363 |
{
|
|
364 |
iError = aError;
|
|
365 |
INFO_PRINTF1(_L("Open complete callback"));
|
|
366 |
CActiveScheduler::Stop();
|
|
367 |
}
|
|
368 |
|
|
369 |
void CTestVclntVideoUrl::MvpuoPrepareComplete(TInt aError)
|
|
370 |
{
|
|
371 |
iError = aError;
|
|
372 |
INFO_PRINTF1(_L("Open complete callback"));
|
|
373 |
CActiveScheduler::Stop();
|
|
374 |
}
|
|
375 |
|
|
376 |
void CTestVclntVideoUrl::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt aError)
|
|
377 |
{
|
|
378 |
iError = aError;
|
|
379 |
// ???
|
|
380 |
INFO_PRINTF1(_L("Frame Ready callback"));
|
|
381 |
}
|
|
382 |
|
|
383 |
void CTestVclntVideoUrl::MvpuoPlayComplete(TInt aError)
|
|
384 |
{
|
|
385 |
iError = aError;
|
|
386 |
INFO_PRINTF1(_L("Play complete callback"));
|
|
387 |
CActiveScheduler::Stop();
|
|
388 |
}
|
|
389 |
|
|
390 |
void CTestVclntVideoUrl::MvpuoEvent(const TMMFEvent& /*aEvent*/)
|
|
391 |
{
|
|
392 |
}
|
|
393 |
|
|
394 |
|
|
395 |
/**
|
|
396 |
* Open audio from a URL and play.
|
|
397 |
*/
|
|
398 |
TVerdict CTestVclntVideoUrl::DoTestStepL()
|
|
399 |
{
|
|
400 |
TVerdict ret = EFail;
|
|
401 |
|
|
402 |
INFO_PRINTF1(_L("Test : Video Player - URL"));
|
|
403 |
|
|
404 |
iError = KErrTimedOut;
|
|
405 |
|
|
406 |
TPtrC urlname;
|
|
407 |
if(!GetStringFromConfig(iSectName,iKeyName,urlname))
|
|
408 |
return EInconclusive;
|
|
409 |
|
|
410 |
InitWservL();
|
|
411 |
|
|
412 |
TRect rect, clipRect;
|
|
413 |
CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
|
|
414 |
EMdaPriorityPreferenceTimeAndQuality,
|
|
415 |
iWs, *iScreen, *iWindow, rect, clipRect);
|
|
416 |
// wait for init to complete
|
|
417 |
CleanupStack::PushL(player);
|
|
418 |
player->OpenUrlL(urlname);
|
|
419 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Opening URL"));
|
|
420 |
CActiveScheduler::Start();
|
|
421 |
|
|
422 |
#ifndef JETSTREAM_TESTS
|
|
423 |
if(iError == KErrNotSupported)
|
|
424 |
ret = EPass;
|
|
425 |
#endif
|
|
426 |
|
|
427 |
if (iError == KErrNone)
|
|
428 |
{
|
|
429 |
player->Prepare();
|
|
430 |
CActiveScheduler::Start();
|
|
431 |
}
|
|
432 |
|
|
433 |
if (iError == KErrNone)
|
|
434 |
ret = DoTestL(player);
|
|
435 |
|
|
436 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying"));
|
|
437 |
CleanupStack::PopAndDestroy(player);
|
|
438 |
if(iError != KErrNone)
|
|
439 |
ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
|
|
440 |
return ret;
|
|
441 |
}
|
|
442 |
|
|
443 |
TVerdict CTestVclntVideoUrl::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
444 |
{
|
|
445 |
TVerdict ret = EFail;
|
|
446 |
|
|
447 |
//#ifdef JETSTREAM_TESTS
|
|
448 |
|
|
449 |
iError = KErrTimedOut;
|
|
450 |
|
|
451 |
aPlayer->Play();
|
|
452 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing URL"));
|
|
453 |
// Wait for play to complete
|
|
454 |
CActiveScheduler::Start();
|
|
455 |
|
|
456 |
if(iError == KErrNone)
|
|
457 |
ret = EPass;
|
|
458 |
//#else
|
|
459 |
// aPlayer->Stop();
|
|
460 |
//#endif
|
|
461 |
|
|
462 |
return ret;
|
|
463 |
}
|
|
464 |
|
|
465 |
|
|
466 |
//------------------------------------------------------------------
|
|
467 |
|
|
468 |
|
|
469 |
CTestVclntEnqFrameRate::CTestVclntEnqFrameRate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aFrameRate)
|
|
470 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
471 |
{
|
|
472 |
iFrameRate = aFrameRate;
|
|
473 |
}
|
|
474 |
|
|
475 |
CTestVclntEnqFrameRate* CTestVclntEnqFrameRate::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aFrameRate)
|
|
476 |
{
|
|
477 |
CTestVclntEnqFrameRate* self = new (ELeave) CTestVclntEnqFrameRate(aTestName,aSectName,aKeyName,aFrameRate);
|
|
478 |
return self;
|
|
479 |
}
|
|
480 |
|
|
481 |
TVerdict CTestVclntEnqFrameRate::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
482 |
{
|
|
483 |
INFO_PRINTF1(_L("Test : Video Player - Enquire Frame Rate"));
|
|
484 |
|
|
485 |
TVerdict ret = EFail;
|
|
486 |
|
|
487 |
TInt32 theFrameRate;
|
|
488 |
Math::Int(theFrameRate, aPlayer->VideoFrameRateL());
|
|
489 |
INFO_PRINTF2(_L("(Frame rate : %d)"), theFrameRate);
|
|
490 |
|
|
491 |
// if we get here, we pass. The player does not have a SetVideoFrameRate()
|
|
492 |
ret = EPass;
|
|
493 |
|
|
494 |
return ret;
|
|
495 |
}
|
|
496 |
|
|
497 |
|
|
498 |
//------------------------------------------------------------------
|
|
499 |
|
|
500 |
CTestVclntPosition::CTestVclntPosition(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aPosition)
|
|
501 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
502 |
{
|
|
503 |
iPosition = aPosition;
|
|
504 |
}
|
|
505 |
|
|
506 |
CTestVclntPosition* CTestVclntPosition::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aPosition)
|
|
507 |
{
|
|
508 |
CTestVclntPosition* self = new (ELeave) CTestVclntPosition(aTestName,aSectName,aKeyName,aPosition);
|
|
509 |
return self;
|
|
510 |
}
|
|
511 |
|
|
512 |
TVerdict CTestVclntPosition::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
513 |
{
|
|
514 |
// NB test video controller is stubbing certain functions. May have to rewrite this
|
|
515 |
// for Jet Stream
|
|
516 |
|
|
517 |
TVerdict ret = EFail;
|
|
518 |
|
|
519 |
INFO_PRINTF1(_L("Test : Video Player - Position"));
|
|
520 |
|
|
521 |
TBool validPosition = EFalse;
|
|
522 |
|
|
523 |
INFO_PRINTF3(_L("Set Position %d Duration = %d"),
|
|
524 |
I64INT(iPosition.Int64()), I64INT(aPlayer->DurationL().Int64()));
|
|
525 |
|
|
526 |
// Set position: middle of clip.
|
|
527 |
if (I64INT(iPosition.Int64()) == 0)
|
|
528 |
iPosition = I64INT(aPlayer->DurationL().Int64()) / 2;
|
|
529 |
// Set position: end of clip.
|
|
530 |
if (I64INT(iPosition.Int64()) == -1)
|
|
531 |
iPosition = aPlayer->DurationL();
|
|
532 |
|
|
533 |
// Position is beyond the end of the clips duration
|
|
534 |
// so check that the value is clipped.
|
|
535 |
if(aPlayer->DurationL() < iPosition)
|
|
536 |
{
|
|
537 |
INFO_PRINTF2(_L("Longer than duration : Setting position to %d"), I64INT(iPosition.Int64()));
|
|
538 |
aPlayer->SetPositionL(iPosition);
|
|
539 |
INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"),
|
|
540 |
I64INT(aPlayer->PositionL().Int64()), I64INT(aPlayer->DurationL().Int64()));
|
|
541 |
if(aPlayer->PositionL() == aPlayer->DurationL())
|
|
542 |
validPosition = ETrue;
|
|
543 |
}
|
|
544 |
// Position is negative
|
|
545 |
// so check that the value is clipped.
|
|
546 |
else if (I64INT(iPosition.Int64()) < 0)
|
|
547 |
{
|
|
548 |
INFO_PRINTF2(_L("Negative value : Setting position to %d"), I64INT(iPosition.Int64()));
|
|
549 |
aPlayer->SetPositionL(iPosition);
|
|
550 |
INFO_PRINTF2(_L("Set : position = %d (if clipped : 0)"), I64INT(aPlayer->PositionL().Int64()));
|
|
551 |
if (I64INT(aPlayer->PositionL().Int64()) == 0)
|
|
552 |
validPosition = ETrue;
|
|
553 |
}
|
|
554 |
else
|
|
555 |
{
|
|
556 |
INFO_PRINTF2(_L("Normal : Setting position to %d"), I64INT(iPosition.Int64()));
|
|
557 |
aPlayer->SetPositionL(iPosition);
|
|
558 |
INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"),
|
|
559 |
I64INT(aPlayer->PositionL().Int64()), I64INT(iPosition.Int64()));
|
|
560 |
if(aPlayer->PositionL() == iPosition)
|
|
561 |
validPosition = ETrue;
|
|
562 |
}
|
|
563 |
|
|
564 |
// Position was set to a valid value.
|
|
565 |
if(validPosition)
|
|
566 |
{
|
|
567 |
aPlayer->Play();
|
|
568 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
|
|
569 |
// wait for play to complete
|
|
570 |
CActiveScheduler::Start();
|
|
571 |
|
|
572 |
INFO_PRINTF2(_L("Error : %d"), iError);
|
|
573 |
if (iError == KErrNone)
|
|
574 |
ret = EPass;
|
|
575 |
}
|
|
576 |
else
|
|
577 |
{
|
|
578 |
// We've got an invalid position, attempt to play anyway...
|
|
579 |
// the test controller should handle it
|
|
580 |
aPlayer->Play();
|
|
581 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing from invalid position"));
|
|
582 |
// wait for play to complete
|
|
583 |
CActiveScheduler::Start();
|
|
584 |
|
|
585 |
INFO_PRINTF2(_L("Error : %d"), iError);
|
|
586 |
if (iError == KErrNone)
|
|
587 |
ret = EPass;
|
|
588 |
|
|
589 |
}
|
|
590 |
|
|
591 |
return ret;
|
|
592 |
}
|
|
593 |
|
|
594 |
|
|
595 |
//------------------------------------------------------------------
|
|
596 |
|
|
597 |
CTestVclntPriority::CTestVclntPriority(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aPriority)
|
|
598 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
599 |
{
|
|
600 |
iPriority = aPriority;
|
|
601 |
}
|
|
602 |
|
|
603 |
CTestVclntPriority* CTestVclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aPriority)
|
|
604 |
{
|
|
605 |
CTestVclntPriority* self = new (ELeave) CTestVclntPriority(aTestName,aSectName,aKeyName,aPriority);
|
|
606 |
return self;
|
|
607 |
}
|
|
608 |
|
|
609 |
TVerdict CTestVclntPriority::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
610 |
{
|
|
611 |
TVerdict ret = EFail;
|
|
612 |
|
|
613 |
INFO_PRINTF1(_L("Test : Video Player - Priority"));
|
|
614 |
|
|
615 |
aPlayer->SetPriorityL(iPriority, EMdaPriorityPreferenceNone);
|
|
616 |
TInt thePriority;
|
|
617 |
TMdaPriorityPreference thePref;
|
|
618 |
aPlayer->PriorityL(thePriority, thePref);
|
|
619 |
INFO_PRINTF3(_L("Priority = %d (expecting %d)"), thePriority, iPriority);
|
|
620 |
INFO_PRINTF3(_L("Pref = %d (expecting %d)"), thePref, EMdaPriorityPreferenceNone);
|
|
621 |
if( (thePriority == iPriority) && (thePref == EMdaPriorityPreferenceNone) )
|
|
622 |
return EPass;
|
|
623 |
return ret;
|
|
624 |
}
|
|
625 |
|
|
626 |
|
|
627 |
//------------------------------------------------------------------
|
|
628 |
|
|
629 |
CTestVclntDuration::CTestVclntDuration(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aDuration)
|
|
630 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
631 |
{
|
|
632 |
iDuration = aDuration;
|
|
633 |
}
|
|
634 |
|
|
635 |
CTestVclntDuration* CTestVclntDuration::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aDuration)
|
|
636 |
{
|
|
637 |
CTestVclntDuration* self = new (ELeave) CTestVclntDuration(aTestName,aSectName,aKeyName,aDuration);
|
|
638 |
return self;
|
|
639 |
}
|
|
640 |
|
|
641 |
TVerdict CTestVclntDuration::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
642 |
{
|
|
643 |
TVerdict ret = EFail;
|
|
644 |
|
|
645 |
INFO_PRINTF1(_L("Test : Video Player - Duration"));
|
|
646 |
|
|
647 |
if (I64INT(iDuration.Int64()) == 0)
|
|
648 |
{
|
|
649 |
TInt duration = I64INT(aPlayer->DurationL().Int64());
|
|
650 |
aPlayer->Play();
|
|
651 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
|
|
652 |
TTime start;
|
|
653 |
start.HomeTime();
|
|
654 |
CActiveScheduler::Start();
|
|
655 |
TTime stop;
|
|
656 |
stop.HomeTime();
|
|
657 |
|
|
658 |
TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
|
|
659 |
|
|
660 |
INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
|
|
661 |
iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
|
|
662 |
if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation)))
|
|
663 |
ret = EPass;
|
|
664 |
}
|
|
665 |
else
|
|
666 |
{
|
|
667 |
if(aPlayer->DurationL() == iDuration)
|
|
668 |
ret = EPass;
|
|
669 |
}
|
|
670 |
return ret;
|
|
671 |
}
|
|
672 |
|
|
673 |
//------------------------------------------------------------------
|
|
674 |
|
|
675 |
CTestVclntVolume::CTestVclntVolume(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aVolume)
|
|
676 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
677 |
{
|
|
678 |
iVolume = aVolume;
|
|
679 |
}
|
|
680 |
|
|
681 |
CTestVclntVolume* CTestVclntVolume::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aVolume)
|
|
682 |
{
|
|
683 |
CTestVclntVolume* self = new (ELeave) CTestVclntVolume(aTestName,aSectName,aKeyName,aVolume);
|
|
684 |
return self;
|
|
685 |
}
|
|
686 |
|
|
687 |
TVerdict CTestVclntVolume::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
688 |
{
|
|
689 |
TVerdict ret = EFail;
|
|
690 |
|
|
691 |
// NB : test video controller does not adjust invalid volumes
|
|
692 |
// comment the checks back in for JS
|
|
693 |
|
|
694 |
INFO_PRINTF1(_L("Test : Video Player - Volume"));
|
|
695 |
|
|
696 |
INFO_PRINTF1(_L("Warning : test video controller does not adjust invalid volumes"));
|
|
697 |
|
|
698 |
// Check maxvolume function
|
|
699 |
if(iVolume == -1)
|
|
700 |
{
|
|
701 |
iVolume = aPlayer->MaxVolume();
|
|
702 |
INFO_PRINTF3(_L("Volume = %d MaxVolume = %d"), iVolume, KMaxVolume);
|
|
703 |
//if(iVolume == KMaxVolume)
|
|
704 |
ret = EPass;
|
|
705 |
}
|
|
706 |
// Volume is truncated to maxvolume
|
|
707 |
else if(iVolume > aPlayer->MaxVolume())
|
|
708 |
{
|
|
709 |
aPlayer->SetVolumeL(iVolume);
|
|
710 |
INFO_PRINTF3(_L("Volume = %d MaxVolume = %d"), aPlayer->Volume(), aPlayer->MaxVolume());
|
|
711 |
//if(aPlayer->Volume() == aPlayer->MaxVolume())
|
|
712 |
ret = EPass;
|
|
713 |
}
|
|
714 |
// Volume is truncated to 0
|
|
715 |
else if(iVolume < 0)
|
|
716 |
{
|
|
717 |
aPlayer->SetVolumeL(iVolume);
|
|
718 |
INFO_PRINTF2(_L("Volume = %d (expecting 0)"), aPlayer->Volume());
|
|
719 |
//if(aPlayer->Volume() == 0)
|
|
720 |
ret = EPass;
|
|
721 |
}
|
|
722 |
// Set volume and check
|
|
723 |
else
|
|
724 |
{
|
|
725 |
aPlayer->SetVolumeL(iVolume);
|
|
726 |
INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), iVolume);
|
|
727 |
if(aPlayer->Volume() == iVolume)
|
|
728 |
ret = EPass;
|
|
729 |
}
|
|
730 |
|
|
731 |
return ret;
|
|
732 |
}
|
|
733 |
|
|
734 |
//------------------------------------------------------------------
|
|
735 |
|
|
736 |
CTestVclntCloseOpen::CTestVclntCloseOpen(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
737 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
738 |
{}
|
|
739 |
|
|
740 |
CTestVclntCloseOpen* CTestVclntCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
741 |
{
|
|
742 |
CTestVclntCloseOpen* self = new (ELeave) CTestVclntCloseOpen(aTestName,aSectName,aKeyName);
|
|
743 |
return self;
|
|
744 |
}
|
|
745 |
|
|
746 |
TVerdict CTestVclntCloseOpen::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
747 |
{
|
|
748 |
TVerdict ret = EFail;
|
|
749 |
|
|
750 |
INFO_PRINTF1(_L("Test : Video Player - Close/Open"));
|
|
751 |
|
|
752 |
//#ifdef JETSTREAM_TESTS
|
|
753 |
|
|
754 |
TPtrC filename;
|
|
755 |
if(!GetStringFromConfig(iSectName,iKeyName,filename))
|
|
756 |
return EInconclusive;
|
|
757 |
|
|
758 |
aPlayer->Close();
|
|
759 |
User::After(KOneSecond);
|
|
760 |
|
|
761 |
TRAP(iError,aPlayer->OpenFileL(filename));
|
|
762 |
if(iError == KErrNone)
|
|
763 |
{
|
|
764 |
// Wait for initialisation callback
|
|
765 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file"));
|
|
766 |
ret = EPass;
|
|
767 |
}
|
|
768 |
|
|
769 |
//#else
|
|
770 |
// aPlayer->Stop();
|
|
771 |
//#endif
|
|
772 |
|
|
773 |
return ret;
|
|
774 |
}
|
|
775 |
|
|
776 |
//------------------------------------------------------------------
|
|
777 |
|
|
778 |
CTestVclntPause::CTestVclntPause(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
779 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
780 |
{}
|
|
781 |
|
|
782 |
CTestVclntPause* CTestVclntPause::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
783 |
{
|
|
784 |
CTestVclntPause* self = new (ELeave) CTestVclntPause(aTestName,aSectName,aKeyName);
|
|
785 |
return self;
|
|
786 |
}
|
|
787 |
|
|
788 |
TVerdict CTestVclntPause::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
789 |
{
|
|
790 |
TVerdict ret = EFail;
|
|
791 |
|
|
792 |
INFO_PRINTF1(_L("Test : Video Player - Pause"));
|
|
793 |
|
|
794 |
// Tests pause functionality
|
|
795 |
// NB : not implemented in test controller
|
|
796 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
|
|
797 |
aPlayer->Play();
|
|
798 |
CActiveScheduler::Start();
|
|
799 |
aPlayer->PauseL();
|
|
800 |
|
|
801 |
#ifdef JETSTREAM_TESTS
|
|
802 |
TInt duration = I64INT(aPlayer->DurationL().Int64());
|
|
803 |
|
|
804 |
iError = KErrTimedOut;
|
|
805 |
aPlayer->Play();
|
|
806 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
|
|
807 |
TTime start;
|
|
808 |
start.HomeTime();
|
|
809 |
CActiveScheduler::Start();
|
|
810 |
TTime stop;
|
|
811 |
stop.HomeTime();
|
|
812 |
|
|
813 |
TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
|
|
814 |
|
|
815 |
INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
|
|
816 |
iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
|
|
817 |
if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation)))
|
|
818 |
ret = EPass;
|
|
819 |
#else
|
|
820 |
INFO_PRINTF1(_L("Warning : PauseL() functionality not supported in test controller"));
|
|
821 |
aPlayer->Stop();
|
|
822 |
ret = EPass;
|
|
823 |
#endif
|
|
824 |
|
|
825 |
return ret;
|
|
826 |
}
|
|
827 |
|
|
828 |
//------------------------------------------------------------------
|
|
829 |
|
|
830 |
CTestVclntBalance::CTestVclntBalance(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aBalance)
|
|
831 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
832 |
{
|
|
833 |
iBalance = aBalance;
|
|
834 |
}
|
|
835 |
|
|
836 |
CTestVclntBalance* CTestVclntBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aBalance)
|
|
837 |
{
|
|
838 |
CTestVclntBalance* self = new (ELeave) CTestVclntBalance(aTestName,aSectName,aKeyName,aBalance);
|
|
839 |
return self;
|
|
840 |
}
|
|
841 |
|
|
842 |
TVerdict CTestVclntBalance::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
843 |
{
|
|
844 |
INFO_PRINTF1(_L("Test : Video Player - Balance"));
|
|
845 |
|
|
846 |
#ifdef JETSTREAM_TESTS
|
|
847 |
if (iBalance < KMinBalance)
|
|
848 |
{
|
|
849 |
aPlayer->SetBalanceL(iBalance);
|
|
850 |
INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMinBalance);
|
|
851 |
if(aPlayer->Balance() == KMinBalance)
|
|
852 |
return EPass;
|
|
853 |
}
|
|
854 |
else if (iBalance > KMaxBalance)
|
|
855 |
{
|
|
856 |
aPlayer->SetBalanceL(iBalance);
|
|
857 |
INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMaxBalance);
|
|
858 |
if(aPlayer->Balance() == KMaxBalance)
|
|
859 |
return EPass;
|
|
860 |
}
|
|
861 |
else
|
|
862 |
{
|
|
863 |
aPlayer->SetBalanceL(iBalance);
|
|
864 |
INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), iBalance);
|
|
865 |
if(aPlayer->Balance() == iBalance)
|
|
866 |
return EPass;
|
|
867 |
}
|
|
868 |
#else
|
|
869 |
// the test video controller returns 1 for all calls of Balance()
|
|
870 |
// call SetBalanceL() to show it doesn't leave
|
|
871 |
aPlayer->SetBalanceL(iBalance);
|
|
872 |
INFO_PRINTF1(_L("Test controller should return 1 for all calls of Balance()"));
|
|
873 |
INFO_PRINTF2(_L("Balance = %d (expecting 1)"), aPlayer->Balance());
|
|
874 |
if(aPlayer->Balance() == 1)
|
|
875 |
return EPass;
|
|
876 |
#endif
|
|
877 |
|
|
878 |
return EFail;
|
|
879 |
}
|
|
880 |
|
|
881 |
|
|
882 |
//------------------------------------------------------------------
|
|
883 |
|
|
884 |
CTestVclntPlayWindow::CTestVclntPlayWindow(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
|
|
885 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
886 |
{
|
|
887 |
iStart = aStart;
|
|
888 |
iEnd = aEnd;
|
|
889 |
}
|
|
890 |
|
|
891 |
CTestVclntPlayWindow* CTestVclntPlayWindow::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
|
|
892 |
{
|
|
893 |
CTestVclntPlayWindow* self = new (ELeave) CTestVclntPlayWindow(aTestName,aSectName,aKeyName,aStart,aEnd);
|
|
894 |
return self;
|
|
895 |
}
|
|
896 |
|
|
897 |
TVerdict CTestVclntPlayWindow::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
898 |
{
|
|
899 |
TVerdict ret = EFail;
|
|
900 |
|
|
901 |
INFO_PRINTF1(_L("Test : Video Player - Window"));
|
|
902 |
|
|
903 |
// InitWservL();
|
|
904 |
|
|
905 |
TRect rect, clipRect;
|
|
906 |
TRAPD(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect));
|
|
907 |
if(err)
|
|
908 |
{
|
|
909 |
ERR_PRINTF2(_L("SetDisplayWindowL() failed, error %d"), err);
|
|
910 |
ret = EFail;
|
|
911 |
}
|
|
912 |
else
|
|
913 |
{
|
|
914 |
ret = EPass;
|
|
915 |
}
|
|
916 |
|
|
917 |
// removed an attempt at opening a window server manually - it seemed to work, but a RWsSession
|
|
918 |
// couldn't Connect(), connectL() claimed no asynchronous operation...
|
|
919 |
|
|
920 |
// we have no window server, so the test can't run -
|
|
921 |
// so call it with dummy parameters and add explanatory note to the test
|
|
922 |
|
|
923 |
// NB ws.Connect() will panic on the target, hence don't run it
|
|
924 |
/*
|
|
925 |
#if defined (__WINS__)
|
|
926 |
TBool testInvalid = EFalse;
|
|
927 |
RWsSession ws;
|
|
928 |
if(ws.Connect() != KErrNone)
|
|
929 |
testInvalid = ETrue;
|
|
930 |
|
|
931 |
// we can't call it at all - SetDisplayWindowL() will cause an access violation if ws is null
|
|
932 |
if(testInvalid)
|
|
933 |
{
|
|
934 |
INFO_PRINTF1(_L("Warning : SetDisplayWindowL() cannot be tested, no window server available"));
|
|
935 |
ret = EPass;
|
|
936 |
}
|
|
937 |
else
|
|
938 |
{
|
2
|
939 |
// XXX - arguments to be correctly set
|
0
|
940 |
CWsScreenDevice sd;
|
|
941 |
RBlankWindow window;
|
|
942 |
TRect rect, clipRect;
|
|
943 |
|
|
944 |
TRAPD(err, aPlayer->SetDisplayWindowL(ws, sd, window, rect, clipRect));
|
|
945 |
if(err)
|
|
946 |
{
|
|
947 |
ERR_PRINTF2(_L("SetDisplayWindowL() failed, error %d"), err);
|
|
948 |
ret = EFail;
|
|
949 |
}
|
|
950 |
else
|
|
951 |
ret = EPass;
|
|
952 |
|
|
953 |
}
|
|
954 |
#else
|
|
955 |
INFO_PRINTF1(_L("Warning : SetDisplayWindowL() cannot be tested on target"));
|
|
956 |
ret = EPass;
|
|
957 |
#endif
|
|
958 |
*/
|
|
959 |
aPlayer->Stop();
|
|
960 |
return ret;
|
|
961 |
}
|
|
962 |
|
|
963 |
|
|
964 |
//------------------------------------------------------------------
|
|
965 |
|
|
966 |
CTestVclntMeta::CTestVclntMeta(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
967 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
968 |
{}
|
|
969 |
|
|
970 |
CTestVclntMeta* CTestVclntMeta::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
971 |
{
|
|
972 |
CTestVclntMeta* self = new (ELeave) CTestVclntMeta(aTestName,aSectName,aKeyName);
|
|
973 |
return self;
|
|
974 |
}
|
|
975 |
|
|
976 |
TVerdict CTestVclntMeta::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
977 |
{
|
|
978 |
INFO_PRINTF1(_L("Test : Video Player - Metadata"));
|
|
979 |
|
|
980 |
TInt numOfMeta = -1;
|
|
981 |
TRAPD(err, numOfMeta = aPlayer->NumberOfMetaDataEntriesL() );
|
|
982 |
INFO_PRINTF3(_L("Error : %d Entries = %d"), err, numOfMeta);
|
|
983 |
if (err != KErrNone || numOfMeta != 0)
|
|
984 |
return EFail;
|
|
985 |
// call that goes to the dummy controller
|
|
986 |
// NB we expect zero metadata entries
|
|
987 |
CMMFMetaDataEntry* theEntry=NULL;
|
|
988 |
TRAP(err, theEntry = aPlayer->MetaDataEntryL(1));
|
|
989 |
INFO_PRINTF2(_L("Error : %d"), err);
|
|
990 |
if (err != KErrNone)
|
|
991 |
return EFail;
|
|
992 |
else
|
|
993 |
{
|
|
994 |
delete theEntry;
|
|
995 |
return EPass;
|
|
996 |
}
|
|
997 |
}
|
|
998 |
|
|
999 |
|
|
1000 |
//------------------------------------------------------------------
|
|
1001 |
|
|
1002 |
CTestVclntFrameSize::CTestVclntFrameSize(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aFrameSize)
|
|
1003 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
1004 |
{
|
|
1005 |
iFrameSize = aFrameSize;
|
|
1006 |
}
|
|
1007 |
|
|
1008 |
CTestVclntFrameSize* CTestVclntFrameSize::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aFrameSize)
|
|
1009 |
{
|
|
1010 |
CTestVclntFrameSize* self = new (ELeave) CTestVclntFrameSize(aTestName,aSectName,aKeyName,aFrameSize);
|
|
1011 |
return self;
|
|
1012 |
}
|
|
1013 |
|
|
1014 |
TVerdict CTestVclntFrameSize::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
1015 |
{
|
|
1016 |
TVerdict ret = EFail;
|
|
1017 |
|
|
1018 |
INFO_PRINTF1(_L("Test : Video Player - Frame Size"));
|
|
1019 |
|
|
1020 |
TSize frameSize;
|
|
1021 |
TRAPD(err, aPlayer->VideoFrameSizeL(frameSize) );
|
|
1022 |
|
|
1023 |
INFO_PRINTF4(_L("Error : %d, Frame size : (%d, %d)"), err, frameSize.iWidth, frameSize.iHeight);
|
|
1024 |
if (err == KErrNone &&
|
|
1025 |
frameSize.iWidth >= 0 && frameSize.iHeight >= 0 )
|
|
1026 |
return EPass;
|
|
1027 |
|
|
1028 |
return ret;
|
|
1029 |
}
|
|
1030 |
|
|
1031 |
//------------------------------------------------------------------
|
|
1032 |
|
|
1033 |
CTestVclntMimeType::CTestVclntMimeType(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1034 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
1035 |
{
|
|
1036 |
}
|
|
1037 |
|
|
1038 |
CTestVclntMimeType* CTestVclntMimeType::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1039 |
{
|
|
1040 |
CTestVclntMimeType* self = new (ELeave) CTestVclntMimeType(aTestName,aSectName,aKeyName);
|
|
1041 |
return self;
|
|
1042 |
}
|
|
1043 |
|
|
1044 |
TVerdict CTestVclntMimeType::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
1045 |
{
|
|
1046 |
INFO_PRINTF1(_L("Test : Video Player - MimeType"));
|
|
1047 |
|
|
1048 |
// NB we cannot check whether the mime type returned is valid, or even exists.
|
|
1049 |
TPtrC8 mimeType = aPlayer->VideoFormatMimeType();
|
|
1050 |
|
|
1051 |
// take it to a 16-bit string
|
|
1052 |
TBuf<64> mimeType16;
|
|
1053 |
mimeType16.Copy(mimeType);
|
|
1054 |
INFO_PRINTF2(_L("Mime type : \'%S\'"), &mimeType16);
|
|
1055 |
return EPass;
|
|
1056 |
}
|
|
1057 |
|
|
1058 |
//------------------------------------------------------------------
|
|
1059 |
|
|
1060 |
CTestVclntRebuffering::CTestVclntRebuffering(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1061 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
1062 |
{
|
|
1063 |
}
|
|
1064 |
|
|
1065 |
CTestVclntRebuffering* CTestVclntRebuffering::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1066 |
{
|
|
1067 |
CTestVclntRebuffering* self = new (ELeave) CTestVclntRebuffering(aTestName,aSectName,aKeyName);
|
|
1068 |
return self;
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
TVerdict CTestVclntRebuffering::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
1072 |
{
|
|
1073 |
INFO_PRINTF1(_L("Test : Video Player - Rebuffering"));
|
|
1074 |
|
|
1075 |
aPlayer->RegisterForVideoLoadingNotification(*this);
|
|
1076 |
|
|
1077 |
INFO_PRINTF1(_L("Rebuffering request completed"));
|
|
1078 |
return EPass;
|
|
1079 |
}
|
|
1080 |
|
|
1081 |
// from MRebufferCallback
|
|
1082 |
void CTestVclntRebuffering::MvloLoadingStarted()
|
|
1083 |
{
|
|
1084 |
INFO_PRINTF1(_L("CTestVclntRebuffering::MvloLoadingStarted"));
|
|
1085 |
}
|
|
1086 |
|
|
1087 |
void CTestVclntRebuffering::MvloLoadingComplete()
|
|
1088 |
{
|
|
1089 |
INFO_PRINTF1(_L("CTestVclntRebuffering::MvloLoadingComplete"));
|
|
1090 |
}
|
|
1091 |
|
|
1092 |
//------------------------------------------------------------------
|
|
1093 |
|
|
1094 |
CTestVclntRepeat::CTestVclntRepeat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aRepeat)
|
|
1095 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
1096 |
{
|
|
1097 |
iRepeat = aRepeat;
|
|
1098 |
}
|
|
1099 |
|
|
1100 |
CTestVclntRepeat* CTestVclntRepeat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aRepeat)
|
|
1101 |
{
|
|
1102 |
CTestVclntRepeat* self = new (ELeave) CTestVclntRepeat(aTestName,aSectName,aKeyName,aRepeat);
|
|
1103 |
return self;
|
|
1104 |
}
|
|
1105 |
|
|
1106 |
TVerdict CTestVclntRepeat::DoTestL(CVideoPlayerUtility* aPlayer)
|
|
1107 |
{
|
|
1108 |
TVerdict ret = EFail;
|
|
1109 |
|
|
1110 |
INFO_PRINTF1(_L("Test : Video Player - Repeats"));
|
|
1111 |
|
|
1112 |
TInt duration = I64INT(aPlayer->DurationL().Int64());
|
|
1113 |
|
|
1114 |
// SetRepeats() doesn't exist in the video controller, so set iRepeat to 1
|
|
1115 |
iRepeat = 1;
|
|
1116 |
INFO_PRINTF1(_L("Warning : SetRepeats() does not exist in player API. Repeat count set to 1"));
|
|
1117 |
|
|
1118 |
aPlayer->Play();
|
|
1119 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
|
|
1120 |
TTime start;
|
|
1121 |
start.HomeTime();
|
|
1122 |
CActiveScheduler::Start();
|
|
1123 |
TTime stop;
|
|
1124 |
stop.HomeTime();
|
|
1125 |
|
|
1126 |
TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
|
|
1127 |
|
|
1128 |
INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
|
|
1129 |
iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
|
|
1130 |
if((iError == KErrNone) && (TimeComparison(actualDuration, duration * (iRepeat + 1),
|
|
1131 |
KExpectedDeviation * iRepeat)))
|
|
1132 |
ret = EPass;
|
|
1133 |
|
|
1134 |
return ret;
|
|
1135 |
}
|
|
1136 |
|
|
1137 |
//------------------------------------------------------------------
|
|
1138 |
|
|
1139 |
CTestVclntDelete::CTestVclntDelete(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1140 |
: CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
|
|
1141 |
{}
|
|
1142 |
|
|
1143 |
CTestVclntDelete* CTestVclntDelete::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1144 |
{
|
|
1145 |
CTestVclntDelete* self = new (ELeave) CTestVclntDelete(aTestName,aSectName,aKeyName);
|
|
1146 |
return self;
|
|
1147 |
}
|
|
1148 |
|
|
1149 |
TVerdict CTestVclntDelete::DoTestL(CVideoPlayerUtility* /* aPlayer */)
|
|
1150 |
{
|
|
1151 |
// this is never called
|
|
1152 |
return EFail;
|
|
1153 |
}
|
|
1154 |
|
|
1155 |
TVerdict CTestVclntDelete::DoTestStepL()
|
|
1156 |
{
|
|
1157 |
TVerdict ret = EFail;
|
|
1158 |
|
|
1159 |
INFO_PRINTF1(_L("Test : Video Player - Delete"));
|
|
1160 |
|
|
1161 |
TPtrC filename;
|
|
1162 |
if(!GetStringFromConfig(iSectName,iKeyName,filename))
|
|
1163 |
return EInconclusive;
|
|
1164 |
|
|
1165 |
InitWservL();
|
|
1166 |
|
|
1167 |
TRect rect, clipRect;
|
|
1168 |
CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
|
|
1169 |
EMdaPriorityPreferenceTimeAndQuality,
|
|
1170 |
iWs, *iScreen, *iWindow, rect, clipRect);
|
|
1171 |
CleanupStack::PushL(player);
|
|
1172 |
|
|
1173 |
iError = KErrTimedOut;
|
|
1174 |
INFO_PRINTF2(_L("Attempting to open file %S"), &filename);
|
|
1175 |
TRAP(iError,player->OpenFileL(filename));
|
|
1176 |
|
|
1177 |
if(iError == KErrNone)
|
|
1178 |
{
|
|
1179 |
// Wait for initialisation callback
|
|
1180 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file"));
|
|
1181 |
CActiveScheduler::Start();
|
|
1182 |
}
|
|
1183 |
|
|
1184 |
if (iError == KErrNone)
|
|
1185 |
{
|
|
1186 |
player->Prepare();
|
|
1187 |
CActiveScheduler::Start();
|
|
1188 |
}
|
|
1189 |
|
|
1190 |
if(iError == KErrNone)
|
|
1191 |
{
|
|
1192 |
player->Play();
|
|
1193 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
|
|
1194 |
INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying before play complete"));
|
|
1195 |
CleanupStack::Pop(player); // destroy player before play has completed
|
|
1196 |
|
|
1197 |
User::Heap().Check();
|
|
1198 |
return EPass;
|
|
1199 |
}
|
|
1200 |
|
|
1201 |
CleanupStack::Pop(player);
|
|
1202 |
ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
|
|
1203 |
return ret;
|
|
1204 |
}
|
|
1205 |
|