|
1 |
|
2 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 // All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Nokia Corporation - initial contribution. |
|
11 // |
|
12 // Contributors: |
|
13 // |
|
14 // Description: |
|
15 // TestDevVideoPlay.cpp |
|
16 // |
|
17 // |
|
18 |
|
19 #include "TestDevVideoPlay.h" |
|
20 #include "TestDevVideoPlayTestData.h" |
|
21 #include "TestDevVideoPlugins/decoder.h" |
|
22 #include "TestDevVideoPlugins/postproc.h" |
|
23 #include <e32math.h> |
|
24 |
|
25 void CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(TInt aError) |
|
26 { |
|
27 INFO_PRINTF2(_L("CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(): Error = %d"), aError); |
|
28 |
|
29 iError = aError; |
|
30 } |
|
31 |
|
32 CTestDevVideoPlayGetNewPictureInfo::CTestDevVideoPlayGetNewPictureInfo(const TDesC& aTestName, TTestType aTestType) |
|
33 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
34 { |
|
35 } |
|
36 |
|
37 CTestDevVideoPlayGetNewPictureInfo* CTestDevVideoPlayGetNewPictureInfo::NewL(const TDesC& aTestName, TTestType aTestType) |
|
38 { |
|
39 CTestDevVideoPlayGetNewPictureInfo* self = new(ELeave) CTestDevVideoPlayGetNewPictureInfo(aTestName, aTestType); |
|
40 return self; |
|
41 } |
|
42 |
|
43 TVerdict CTestDevVideoPlayGetNewPictureInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
44 { |
|
45 TVerdict ret = EFail; |
|
46 |
|
47 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetNewPictureInfo")); |
|
48 |
|
49 // expected results |
|
50 if (iTestType != ETestValid) |
|
51 { |
|
52 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
53 return EInconclusive; |
|
54 } |
|
55 |
|
56 TInt err = KErrNone; |
|
57 |
|
58 // THwDeviceId hwDecoder = 0; |
|
59 // THwDeviceId hwPostProc = 0; |
|
60 |
|
61 // select decoder |
|
62 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
63 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal |
|
64 if (err != KErrNone) |
|
65 { |
|
66 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
67 return EInconclusive; |
|
68 } |
|
69 |
|
70 // select post-processor |
|
71 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
72 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
73 if (err != KErrNone) |
|
74 { |
|
75 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
76 return EInconclusive; |
|
77 } |
|
78 |
|
79 //Tell plugin to start creating pictures. |
|
80 TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse)); |
|
81 if (iError != KErrNone) |
|
82 { |
|
83 ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen")); |
|
84 return EInconclusive; |
|
85 } |
|
86 |
|
87 // initialize CDevVideoPlay and wait for response |
|
88 // iError is set by the MdvpoInitComplete callback |
|
89 aDevVideoPlay.Initialize(); |
|
90 |
|
91 if (iError != KErrNone) |
|
92 { |
|
93 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
94 return EInconclusive; |
|
95 } |
|
96 |
|
97 aDevVideoPlay.Start(); |
|
98 |
|
99 TUint numPictures = 0; |
|
100 TTimeIntervalMicroSeconds earliestTimeStamp(0); |
|
101 TTimeIntervalMicroSeconds latestTimeStamp(0); |
|
102 |
|
103 |
|
104 aDevVideoPlay.GetNewPictureInfo(numPictures, earliestTimeStamp, latestTimeStamp); |
|
105 |
|
106 if ((numPictures == 1) |
|
107 && (earliestTimeStamp == TTimeIntervalMicroSeconds(0)) |
|
108 && (latestTimeStamp == TTimeIntervalMicroSeconds(0))) |
|
109 { |
|
110 ret = EPass; |
|
111 } |
|
112 |
|
113 return ret; |
|
114 } |
|
115 //------------------------------------------------------------------ |
|
116 |
|
117 void CTestDevVideoPlayNextPicture::MdvpoInitComplete(TInt aError) |
|
118 { |
|
119 INFO_PRINTF2(_L("CTestDevVideoPlayNextPicture::MdvpoInitComplete(): Error = %d"), aError); |
|
120 |
|
121 iError = aError; |
|
122 } |
|
123 |
|
124 CTestDevVideoPlayNextPicture::CTestDevVideoPlayNextPicture(const TDesC& aTestName, TTestType aTestType) |
|
125 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
126 { |
|
127 } |
|
128 |
|
129 CTestDevVideoPlayNextPicture* CTestDevVideoPlayNextPicture::NewL(const TDesC& aTestName, TTestType aTestType) |
|
130 { |
|
131 CTestDevVideoPlayNextPicture* self = new(ELeave) CTestDevVideoPlayNextPicture(aTestName, aTestType); |
|
132 return self; |
|
133 } |
|
134 |
|
135 TVerdict CTestDevVideoPlayNextPicture::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
136 { |
|
137 TVerdict ret = EPass; |
|
138 |
|
139 INFO_PRINTF1(_L("CMMFDevVideoPlay: NextPicture")); |
|
140 |
|
141 // expected results |
|
142 if (iTestType != ETestValid) |
|
143 { |
|
144 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
145 return EInconclusive; |
|
146 } |
|
147 |
|
148 TInt err = KErrNone; |
|
149 |
|
150 // THwDeviceId hwDecoder = 0; |
|
151 // THwDeviceId hwPostProc = 0; |
|
152 |
|
153 // select decoder |
|
154 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
155 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));// EABI warning removal |
|
156 if (err != KErrNone) |
|
157 { |
|
158 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
159 return EInconclusive; |
|
160 } |
|
161 |
|
162 // select post-processor |
|
163 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
164 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
165 if (err != KErrNone) |
|
166 { |
|
167 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
168 return EInconclusive; |
|
169 } |
|
170 |
|
171 //Tell plugin to start creating pictures. |
|
172 TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse)); |
|
173 if (iError != KErrNone) |
|
174 { |
|
175 ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen")); |
|
176 return EInconclusive; |
|
177 } |
|
178 |
|
179 // initialize CDevVideoPlay and wait for response |
|
180 // iError is set by the MdvpoInitComplete callback |
|
181 aDevVideoPlay.Initialize(); |
|
182 |
|
183 if (iError != KErrNone) |
|
184 { |
|
185 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
186 return EInconclusive; |
|
187 } |
|
188 |
|
189 iDevVideoPlay = &aDevVideoPlay; |
|
190 aDevVideoPlay.Start();//Tell plugin to start creating pictures. |
|
191 // We should now get a series of NewPicture() callbacks. |
|
192 |
|
193 if (iError == KErrNone) |
|
194 { |
|
195 ret = EPass; |
|
196 } |
|
197 else |
|
198 { |
|
199 ERR_PRINTF2(_L("Error - picture processing failed with error %d"), iError); |
|
200 } |
|
201 |
|
202 return ret; |
|
203 } |
|
204 |
|
205 void CTestDevVideoPlayNextPicture::MdvpoNewPictures() |
|
206 { |
|
207 TRAP(iError, DoNewPicturesL()); |
|
208 } |
|
209 |
|
210 void CTestDevVideoPlayNextPicture::CheckNewPictureInfoL(TUint aNumPictures, const TTimeIntervalMicroSeconds& aFirst, const TTimeIntervalMicroSeconds& aLast) |
|
211 { |
|
212 TUint numPictures = 0; |
|
213 TTimeIntervalMicroSeconds first(0); |
|
214 TTimeIntervalMicroSeconds last(0); |
|
215 iDevVideoPlay->GetNewPictureInfo(numPictures, first, last); |
|
216 |
|
217 if ((numPictures!=aNumPictures) || (first!=aFirst) || (last!=aLast)) |
|
218 { |
|
219 User::Leave(KErrGeneral); |
|
220 } |
|
221 } |
|
222 |
|
223 void CTestDevVideoPlayNextPicture::DoNewPicturesL() |
|
224 { |
|
225 User::LeaveIfError(iError);//Don't go any further if we have an error |
|
226 switch (iCurrentPictureNumber) |
|
227 { |
|
228 case 0: |
|
229 { |
|
230 iCurrentPictureNumber++; |
|
231 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); |
|
232 TVideoPicture* picture = iDevVideoPlay->NextPictureL(); |
|
233 CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); |
|
234 iDevVideoPlay->ReturnPicture(picture); |
|
235 break; |
|
236 } |
|
237 case 1: |
|
238 { |
|
239 iCurrentPictureNumber++; |
|
240 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(1), TTimeIntervalMicroSeconds(1)); |
|
241 TVideoPicture* picture = iDevVideoPlay->NextPictureL(); |
|
242 CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); |
|
243 iDevVideoPlay->ReturnPicture(picture); |
|
244 break; |
|
245 } |
|
246 case 2: |
|
247 { |
|
248 iCurrentPictureNumber++; |
|
249 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(2), TTimeIntervalMicroSeconds(2)); |
|
250 TVideoPicture* picture = iDevVideoPlay->NextPictureL(); |
|
251 CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); |
|
252 iDevVideoPlay->ReturnPicture(picture); |
|
253 break; |
|
254 } |
|
255 case 3: |
|
256 { |
|
257 iCurrentPictureNumber++; |
|
258 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(3), TTimeIntervalMicroSeconds(3)); |
|
259 TVideoPicture* picture = iDevVideoPlay->NextPictureL(); |
|
260 iDevVideoPlay->ReturnPicture(picture); |
|
261 break; |
|
262 } |
|
263 case 4: |
|
264 { |
|
265 iCurrentPictureNumber++; |
|
266 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(4), TTimeIntervalMicroSeconds(4)); |
|
267 TVideoPicture* picture = iDevVideoPlay->NextPictureL(); |
|
268 iDevVideoPlay->ReturnPicture(picture); |
|
269 break; |
|
270 } |
|
271 case 5: |
|
272 { |
|
273 iCurrentPictureNumber++; |
|
274 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(5), TTimeIntervalMicroSeconds(5)); |
|
275 TVideoPicture* picture = iDevVideoPlay->NextPictureL(); |
|
276 iDevVideoPlay->ReturnPicture(picture); |
|
277 break; |
|
278 } |
|
279 case 6: |
|
280 { |
|
281 iCurrentPictureNumber++; |
|
282 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(6)); |
|
283 break; |
|
284 } |
|
285 case 7: |
|
286 { |
|
287 iCurrentPictureNumber++; |
|
288 CheckNewPictureInfoL(2, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(7)); |
|
289 break; |
|
290 } |
|
291 case 8: |
|
292 { |
|
293 iCurrentPictureNumber++; |
|
294 CheckNewPictureInfoL(3, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(8)); |
|
295 break; |
|
296 } |
|
297 case 9: |
|
298 { |
|
299 iCurrentPictureNumber++; |
|
300 CheckNewPictureInfoL(4, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(9)); |
|
301 TVideoPicture* picture = iDevVideoPlay->NextPictureL(); |
|
302 iDevVideoPlay->ReturnPicture(picture); |
|
303 CheckNewPictureInfoL(3, TTimeIntervalMicroSeconds(7), TTimeIntervalMicroSeconds(9)); |
|
304 picture = iDevVideoPlay->NextPictureL(); |
|
305 iDevVideoPlay->ReturnPicture(picture); |
|
306 CheckNewPictureInfoL(2, TTimeIntervalMicroSeconds(8), TTimeIntervalMicroSeconds(9)); |
|
307 picture = iDevVideoPlay->NextPictureL(); |
|
308 iDevVideoPlay->ReturnPicture(picture); |
|
309 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(9), TTimeIntervalMicroSeconds(9)); |
|
310 picture = iDevVideoPlay->NextPictureL(); |
|
311 iDevVideoPlay->ReturnPicture(picture); |
|
312 CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); |
|
313 break; |
|
314 } |
|
315 default: |
|
316 User::Leave(KErrGeneral); |
|
317 break; |
|
318 }; |
|
319 } |
|
320 |
|
321 |
|
322 |
|
323 //------------------------------------------------------------------ |
|
324 |
|
325 void CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(TInt aError) |
|
326 { |
|
327 INFO_PRINTF2(_L("CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(): Error = %d"), aError); |
|
328 |
|
329 iError = aError; |
|
330 } |
|
331 |
|
332 CTestDevVideoPlayGetSnapshot::CTestDevVideoPlayGetSnapshot(const TDesC& aTestName, TTestType aTestType) |
|
333 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
334 { |
|
335 } |
|
336 |
|
337 CTestDevVideoPlayGetSnapshot* CTestDevVideoPlayGetSnapshot::NewL(const TDesC& aTestName, TTestType aTestType) |
|
338 { |
|
339 CTestDevVideoPlayGetSnapshot* self = new(ELeave) CTestDevVideoPlayGetSnapshot(aTestName, aTestType); |
|
340 return self; |
|
341 } |
|
342 |
|
343 TVerdict CTestDevVideoPlayGetSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
344 { |
|
345 TVerdict ret = EFail; |
|
346 |
|
347 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSnapshot")); |
|
348 |
|
349 // expected results |
|
350 if (iTestType != ETestValid) |
|
351 { |
|
352 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
353 return EInconclusive; |
|
354 } |
|
355 |
|
356 TInt err = KErrNone; |
|
357 |
|
358 // THwDeviceId hwDecoder = 0; |
|
359 // THwDeviceId hwPostProc = 0; |
|
360 |
|
361 // select decoder |
|
362 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
363 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal |
|
364 if (err != KErrNone) |
|
365 { |
|
366 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
367 return EInconclusive; |
|
368 } |
|
369 |
|
370 // select post-processor |
|
371 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
372 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
373 if (err != KErrNone) |
|
374 { |
|
375 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
376 return EInconclusive; |
|
377 } |
|
378 |
|
379 // initialize CDevVideoPlay and wait for response |
|
380 // iError is set by the MdvpoInitComplete callback |
|
381 aDevVideoPlay.Initialize(); |
|
382 |
|
383 if (iError != KErrNone) |
|
384 { |
|
385 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
386 return EInconclusive; |
|
387 } |
|
388 |
|
389 TBool result = EFalse; |
|
390 TPictureData pictureData; |
|
391 |
|
392 TUncompressedVideoFormat format; |
|
393 format.iDataFormat = EYuvRawData; |
|
394 format.iYuvFormat = KTestYuvFormat1; |
|
395 |
|
396 TRAP(err, result = aDevVideoPlay.GetSnapshotL(pictureData, format)); |
|
397 |
|
398 if (err == KErrNone) |
|
399 { |
|
400 if (result) |
|
401 { |
|
402 if ((pictureData.iDataFormat == EYuvRawData) && |
|
403 (pictureData.iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) && |
|
404 (pictureData.iRawData == NULL)) |
|
405 { |
|
406 ret = EPass; |
|
407 } |
|
408 } |
|
409 } |
|
410 |
|
411 return ret; |
|
412 } |
|
413 //------------------------------------------------------------------ |
|
414 |
|
415 void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(TInt aError) |
|
416 { |
|
417 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(): Error = %d"), aError); |
|
418 |
|
419 iError = aError; |
|
420 } |
|
421 |
|
422 void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(TInt aError, |
|
423 TPictureData* aPictureData, |
|
424 const TTimeIntervalMicroSeconds& aPresentationTimestamp, |
|
425 const TPictureId& /*aPictureId*/) |
|
426 { |
|
427 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(): Error = %d"), aError); |
|
428 |
|
429 iError = aError; |
|
430 iTimestamp = aPresentationTimestamp; |
|
431 iPictureData = aPictureData; |
|
432 } |
|
433 |
|
434 CTestDevVideoPlayGetTimedSnapshotTimestamp::CTestDevVideoPlayGetTimedSnapshotTimestamp(const TDesC& aTestName, TTestType aTestType) |
|
435 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
436 { |
|
437 } |
|
438 |
|
439 CTestDevVideoPlayGetTimedSnapshotTimestamp* CTestDevVideoPlayGetTimedSnapshotTimestamp::NewL(const TDesC& aTestName, TTestType aTestType) |
|
440 { |
|
441 CTestDevVideoPlayGetTimedSnapshotTimestamp* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotTimestamp(aTestName, aTestType); |
|
442 return self; |
|
443 } |
|
444 |
|
445 TVerdict CTestDevVideoPlayGetTimedSnapshotTimestamp::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
446 { |
|
447 TVerdict ret = EFail; |
|
448 TInt expErr = KErrNone; |
|
449 |
|
450 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotTimestamp")); |
|
451 |
|
452 // expected results |
|
453 if (iTestType != ETestValid) |
|
454 { |
|
455 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
456 return EInconclusive; |
|
457 } |
|
458 |
|
459 TInt err = KErrNone; |
|
460 |
|
461 // THwDeviceId hwDecoder = 0; |
|
462 // THwDeviceId hwPostProc = 0; |
|
463 |
|
464 // select decoder |
|
465 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
466 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal |
|
467 if (err != KErrNone) |
|
468 { |
|
469 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
470 return EInconclusive; |
|
471 } |
|
472 |
|
473 // select post-processor |
|
474 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
475 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
476 if (err != KErrNone) |
|
477 { |
|
478 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
479 return EInconclusive; |
|
480 } |
|
481 |
|
482 // initialize CDevVideoPlay and wait for response |
|
483 // iError is set by the MdvpoInitComplete callback |
|
484 aDevVideoPlay.Initialize(); |
|
485 |
|
486 if (iError != KErrNone) |
|
487 { |
|
488 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
489 return EInconclusive; |
|
490 } |
|
491 |
|
492 TPictureData pictureData; |
|
493 |
|
494 TUncompressedVideoFormat format; |
|
495 format.iDataFormat = EYuvRawData; |
|
496 format.iYuvFormat = KTestYuvFormat1; |
|
497 TTimeIntervalMicroSeconds snapTime(KTestSnapshotTimestamp); |
|
498 |
|
499 // get a timed snapshot from the post processor |
|
500 TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapTime)); |
|
501 |
|
502 // check picture and timestamp from callback |
|
503 if ((err == KErrNone) && (iError == KErrNone)) |
|
504 { |
|
505 if ((iPictureData) && (iTimestamp == TTimeIntervalMicroSeconds(KTestSnapshotTimestamp))) |
|
506 { |
|
507 if ((iPictureData->iDataFormat == EYuvRawData) && |
|
508 (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) && |
|
509 (iPictureData->iRawData == NULL)) |
|
510 { |
|
511 ret = EPass; |
|
512 } |
|
513 else |
|
514 { |
|
515 ERR_PRINTF1(_L("Error - PictureData is corrupt!")); |
|
516 } |
|
517 } |
|
518 } |
|
519 else |
|
520 { |
|
521 ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr); |
|
522 } |
|
523 |
|
524 return ret; |
|
525 } |
|
526 //------------------------------------------------------------------ |
|
527 |
|
528 void CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(TInt aError) |
|
529 { |
|
530 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(): Error = %d"), aError); |
|
531 |
|
532 iError = aError; |
|
533 } |
|
534 |
|
535 void CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(TInt aError, |
|
536 TPictureData* aPictureData, |
|
537 const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, |
|
538 const TPictureId& aPictureId) |
|
539 { |
|
540 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(): Error = %d"), aError); |
|
541 |
|
542 iError = aError; |
|
543 iPictureId = aPictureId; |
|
544 iPictureData = aPictureData; |
|
545 } |
|
546 |
|
547 CTestDevVideoPlayGetTimedSnapshotID::CTestDevVideoPlayGetTimedSnapshotID(const TDesC& aTestName, TTestType aTestType) |
|
548 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
549 { |
|
550 } |
|
551 |
|
552 CTestDevVideoPlayGetTimedSnapshotID* CTestDevVideoPlayGetTimedSnapshotID::NewL(const TDesC& aTestName, TTestType aTestType) |
|
553 { |
|
554 CTestDevVideoPlayGetTimedSnapshotID* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotID(aTestName, aTestType); |
|
555 return self; |
|
556 } |
|
557 |
|
558 TVerdict CTestDevVideoPlayGetTimedSnapshotID::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
559 { |
|
560 TVerdict ret = EPass; |
|
561 TInt expErr = KErrNone; |
|
562 |
|
563 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotID")); |
|
564 |
|
565 // expected results |
|
566 if (iTestType != ETestValid) |
|
567 { |
|
568 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
569 return EInconclusive; |
|
570 } |
|
571 |
|
572 TInt err = KErrNone; |
|
573 |
|
574 // THwDeviceId hwDecoder = 0; |
|
575 // THwDeviceId hwPostProc = 0; |
|
576 |
|
577 // select decoder |
|
578 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
579 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal |
|
580 if (err != KErrNone) |
|
581 { |
|
582 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
583 return EInconclusive; |
|
584 } |
|
585 |
|
586 // select post-processor |
|
587 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
588 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
589 if (err != KErrNone) |
|
590 { |
|
591 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
592 return EInconclusive; |
|
593 } |
|
594 |
|
595 // initialize CDevVideoPlay and wait for response |
|
596 // iError is set by the MdvpoInitComplete callback |
|
597 aDevVideoPlay.Initialize(); |
|
598 |
|
599 if (iError != KErrNone) |
|
600 { |
|
601 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
602 return EInconclusive; |
|
603 } |
|
604 |
|
605 TPictureData pictureData; |
|
606 |
|
607 TUncompressedVideoFormat format; |
|
608 format.iDataFormat = EYuvRawData; |
|
609 format.iYuvFormat = KTestYuvFormat1; |
|
610 TPictureId snapId = KTestSnapshotId; |
|
611 |
|
612 // get a timed snapshot from the post processor |
|
613 TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId)); |
|
614 |
|
615 // check picture and timestamp from callback |
|
616 if ((err == KErrNone) && (iError == KErrNone)) |
|
617 { |
|
618 if ( (iPictureData) && (iPictureId.iIdType == KTestSnapshotId.iIdType) && |
|
619 (iPictureId.iId == KTestSnapshotId.iId) ) |
|
620 { |
|
621 if ((iPictureData->iDataFormat == EYuvRawData) && |
|
622 (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) && |
|
623 (iPictureData->iRawData == NULL)) |
|
624 { |
|
625 ret = EPass; |
|
626 } |
|
627 else |
|
628 { |
|
629 ERR_PRINTF1(_L("Error - PictureData is corrupt!")); |
|
630 } |
|
631 } |
|
632 } |
|
633 else |
|
634 { |
|
635 ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr); |
|
636 } |
|
637 |
|
638 return ret; |
|
639 } |
|
640 //------------------------------------------------------------------ |
|
641 |
|
642 void CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(TInt aError) |
|
643 { |
|
644 INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(): Error = %d"), aError); |
|
645 |
|
646 iError = aError; |
|
647 } |
|
648 |
|
649 void CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(TInt aError, |
|
650 TPictureData* /*aPictureData*/, |
|
651 const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, |
|
652 const TPictureId& /*aPictureId*/) |
|
653 { |
|
654 INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(): Error = %d"), aError); |
|
655 |
|
656 iError = aError; |
|
657 } |
|
658 |
|
659 CTestDevVideoPlayCancelTimedSnapshot::CTestDevVideoPlayCancelTimedSnapshot(const TDesC& aTestName, TTestType aTestType) |
|
660 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
661 { |
|
662 } |
|
663 |
|
664 CTestDevVideoPlayCancelTimedSnapshot* CTestDevVideoPlayCancelTimedSnapshot::NewL(const TDesC& aTestName, TTestType aTestType) |
|
665 { |
|
666 CTestDevVideoPlayCancelTimedSnapshot* self = new(ELeave) CTestDevVideoPlayCancelTimedSnapshot(aTestName, aTestType); |
|
667 return self; |
|
668 } |
|
669 |
|
670 TVerdict CTestDevVideoPlayCancelTimedSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
671 { |
|
672 TVerdict ret = EFail; |
|
673 TInt expErr = KErrNone; |
|
674 |
|
675 INFO_PRINTF1(_L("CMMFDevVideoPlay: CancelTimedSnapshot")); |
|
676 |
|
677 // expected results |
|
678 if (iTestType != ETestValid) |
|
679 { |
|
680 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
681 return EInconclusive; |
|
682 } |
|
683 |
|
684 TInt err = KErrNone; |
|
685 |
|
686 // THwDeviceId hwDecoder = 0; |
|
687 // THwDeviceId hwPostProc = 0; |
|
688 |
|
689 // select decoder |
|
690 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
691 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
692 if (err != KErrNone) |
|
693 { |
|
694 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
695 return EInconclusive; |
|
696 } |
|
697 |
|
698 // select post-processor |
|
699 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
700 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
701 if (err != KErrNone) |
|
702 { |
|
703 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
704 return EInconclusive; |
|
705 } |
|
706 |
|
707 // initialize CDevVideoPlay and wait for response |
|
708 // iError is set by the MdvpoInitComplete callback |
|
709 aDevVideoPlay.Initialize(); |
|
710 |
|
711 if (iError != KErrNone) |
|
712 { |
|
713 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
714 return EInconclusive; |
|
715 } |
|
716 |
|
717 |
|
718 TPictureData pictureData; |
|
719 |
|
720 TUncompressedVideoFormat format; |
|
721 format.iDataFormat = EYuvRawData; |
|
722 format.iYuvFormat = KTestYuvFormat1; |
|
723 TPictureId snapId = KTestSnapshotId; |
|
724 |
|
725 // get a timed snapshot from the post processor |
|
726 TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId)); |
|
727 |
|
728 // cancel the snapshot |
|
729 aDevVideoPlay.CancelTimedSnapshot(); |
|
730 |
|
731 // check picture has been cancelled |
|
732 if (err == KErrNone) |
|
733 { |
|
734 if (iError == KErrAbort) |
|
735 { |
|
736 INFO_PRINTF1(_L("Timed snapshot cancelled successfully")); |
|
737 ret = EPass; |
|
738 } |
|
739 else |
|
740 { |
|
741 ERR_PRINTF3(_L("MdvpoTimedSnapshotComplete() gave error %d (expected %d)"),iError, KErrAbort); |
|
742 } |
|
743 } |
|
744 else |
|
745 { |
|
746 ERR_PRINTF3(_L("CancelTimedSnapshotL() gave error %d (expected %d)"),err, expErr); |
|
747 } |
|
748 |
|
749 return ret; |
|
750 } |
|
751 //------------------------------------------------------------------ |
|
752 |
|
753 void CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(TInt aError) |
|
754 { |
|
755 INFO_PRINTF2(_L("CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(): Error = %d"), aError); |
|
756 |
|
757 iError = aError; |
|
758 } |
|
759 |
|
760 CTestDevVideoPlayGetSupportedSnapshotFormats::CTestDevVideoPlayGetSupportedSnapshotFormats(const TDesC& aTestName, TTestType aTestType) |
|
761 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
762 { |
|
763 } |
|
764 |
|
765 CTestDevVideoPlayGetSupportedSnapshotFormats* CTestDevVideoPlayGetSupportedSnapshotFormats::NewL(const TDesC& aTestName, TTestType aTestType) |
|
766 { |
|
767 CTestDevVideoPlayGetSupportedSnapshotFormats* self = new(ELeave) CTestDevVideoPlayGetSupportedSnapshotFormats(aTestName, aTestType); |
|
768 return self; |
|
769 } |
|
770 |
|
771 TVerdict CTestDevVideoPlayGetSupportedSnapshotFormats::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
772 { |
|
773 TVerdict ret = EFail; |
|
774 TInt expErr = KErrNone; |
|
775 |
|
776 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSupportedSnapshotFormats")); |
|
777 |
|
778 // expected results |
|
779 if (iTestType != ETestValid) |
|
780 { |
|
781 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
782 return EInconclusive; |
|
783 } |
|
784 |
|
785 TInt err = KErrNone; |
|
786 |
|
787 // THwDeviceId hwDecoder = 0; |
|
788 // THwDeviceId hwPostProc = 0; |
|
789 |
|
790 // select decoder |
|
791 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
792 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal |
|
793 if (err != KErrNone) |
|
794 { |
|
795 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
796 return EInconclusive; |
|
797 } |
|
798 |
|
799 // select post-processor |
|
800 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
801 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
802 if (err != KErrNone) |
|
803 { |
|
804 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
805 return EInconclusive; |
|
806 } |
|
807 |
|
808 // initialize CDevVideoPlay and wait for response |
|
809 // iError is set by the MdvpoInitComplete callback |
|
810 aDevVideoPlay.Initialize(); |
|
811 |
|
812 if (iError != KErrNone) |
|
813 { |
|
814 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
815 return EInconclusive; |
|
816 } |
|
817 |
|
818 RArray<TUncompressedVideoFormat> vidFormats; |
|
819 |
|
820 // get a list of supported formats from the plugin |
|
821 TRAP(err, aDevVideoPlay.GetSupportedSnapshotFormatsL(vidFormats) ) |
|
822 |
|
823 // check picture and timestamp from callback |
|
824 if (err == KErrNone) |
|
825 { |
|
826 if ( vidFormats.Count() == 3) |
|
827 { |
|
828 if ((vidFormats[0] == KTestVidFormat1) && |
|
829 (vidFormats[1] == KTestVidFormat2) && |
|
830 (vidFormats[2] == KTestVidFormat3) ) |
|
831 { |
|
832 INFO_PRINTF1(_L("Snapshot format list checks ok")); |
|
833 ret = EPass; |
|
834 } |
|
835 else |
|
836 { |
|
837 ERR_PRINTF1(_L("Error - Snapshot format list is corrupt!")); |
|
838 } |
|
839 } |
|
840 } |
|
841 else |
|
842 { |
|
843 ERR_PRINTF3(_L("GetSupportedSnapshotFormatsL() gave error %d (expected %d)"),err, expErr); |
|
844 } |
|
845 |
|
846 vidFormats.Reset(); |
|
847 vidFormats.Close(); |
|
848 |
|
849 return ret; |
|
850 } |
|
851 |
|
852 //------------------------------------------------------------------ |
|
853 |
|
854 CTestDevVideoPlayClock::CTestDevVideoPlayClock(const TDesC& aTestName) |
|
855 { |
|
856 iTestStepName = aTestName; |
|
857 } |
|
858 |
|
859 void CTestDevVideoPlayClock::ConstructL() |
|
860 { |
|
861 } |
|
862 |
|
863 CTestDevVideoPlayClock::~CTestDevVideoPlayClock() |
|
864 { |
|
865 } |
|
866 |
|
867 CTestDevVideoPlayClock* CTestDevVideoPlayClock::NewL(const TDesC& aTestName) |
|
868 { |
|
869 CTestDevVideoPlayClock* self = new(ELeave) CTestDevVideoPlayClock(aTestName); |
|
870 CleanupStack::PushL(self); |
|
871 self->ConstructL(); |
|
872 CleanupStack::Pop(self); |
|
873 return self; |
|
874 } |
|
875 |
|
876 TInt CTestDevVideoPlayClock::StartThread(TAny* aAny) |
|
877 { |
|
878 CTestDevVideoPlayClock* me = static_cast<CTestDevVideoPlayClock*>(aAny); |
|
879 me->RunThread(); |
|
880 |
|
881 return KErrNone; |
|
882 } |
|
883 |
|
884 void CTestDevVideoPlayClock::RunThread() |
|
885 { |
|
886 TTimeIntervalMicroSeconds currentTime(0); |
|
887 |
|
888 while(!iShutdownSubthread) |
|
889 { |
|
890 currentTime = iClockSource->Time(); |
|
891 TUint timeUint = I64LOW(currentTime.Int64()); |
|
892 } |
|
893 } |
|
894 |
|
895 void CTestDevVideoPlayClock::MmcspuoTick(const TTimeIntervalMicroSeconds& aTime) |
|
896 { |
|
897 iPeriodicUtilityIteration++; |
|
898 |
|
899 TUint currentTime = I64LOW(aTime.Int64()); |
|
900 TUint predictedTime = iPeriodicUtilityIteration * KTestClock2Seconds; |
|
901 |
|
902 if (!TimeComparison(currentTime, predictedTime, KTestClockBigDeviationMS)) |
|
903 { |
|
904 ERR_PRINTF3(_L("Error - Periodic Utility time comparison failed: Got %u; Expected %u"), currentTime, predictedTime); |
|
905 iPeriodicUtilityTestVerdict = EFail; |
|
906 iPeriodicUtility->Stop(); |
|
907 CActiveScheduler::Stop(); |
|
908 } |
|
909 else |
|
910 { |
|
911 INFO_PRINTF3(_L("Periodic Utility time comparison passed: Got %u; Expected %u"), currentTime, predictedTime); |
|
912 } |
|
913 |
|
914 if (iPeriodicUtilityIteration >= 5) |
|
915 { |
|
916 iPeriodicUtility->Stop(); |
|
917 CActiveScheduler::Stop(); |
|
918 } |
|
919 } |
|
920 |
|
921 TVerdict CTestDevVideoPlayClock::DoTestStepL() |
|
922 { |
|
923 TVerdict ret = EPass; |
|
924 TTimeIntervalMicroSeconds testTime(0); |
|
925 TUint timeUint = 0; |
|
926 |
|
927 iClockSource = CSystemClockSource::NewL(); |
|
928 |
|
929 // Construct a new thread to constantly probe the clock - to test that it'll work from multiple threads |
|
930 RThread thread; |
|
931 |
|
932 TInt error = thread.Create(_L("ClockSourceTestThread"), |
|
933 &CTestDevVideoPlayClock::StartThread, |
|
934 KDefaultStackSize, |
|
935 &User::Heap(), |
|
936 static_cast<TAny*>(this), |
|
937 EOwnerThread); |
|
938 |
|
939 if (error) |
|
940 { |
|
941 ERR_PRINTF1(_L("Error - Couldn't create periodic utility object")); |
|
942 delete iClockSource; |
|
943 return EInconclusive; |
|
944 } |
|
945 |
|
946 TRequestStatus stat; |
|
947 thread.Logon(stat); |
|
948 if (stat!=KRequestPending) |
|
949 { |
|
950 delete iClockSource; |
|
951 ERR_PRINTF2(_L("Error - Couldn't logon to the thread err=%d"), stat.Int()); |
|
952 thread.LogonCancel(stat); |
|
953 User::WaitForRequest(stat); |
|
954 return EInconclusive; |
|
955 } |
|
956 thread.SetPriority(EPriorityLess); |
|
957 |
|
958 // wait for system to calm down |
|
959 User::After(KTestClock2Seconds); |
|
960 |
|
961 // reset the clock |
|
962 iClockSource->Reset(); |
|
963 |
|
964 thread.Resume(); |
|
965 |
|
966 // wait for 2 seconds and then check the time == 2 seconds |
|
967 User::After(KTestClock2Seconds); |
|
968 testTime = iClockSource->Time(); |
|
969 timeUint = I64LOW(testTime.Int64()); |
|
970 |
|
971 if (!TimeComparison(timeUint, KTestClock2Seconds, KTestClockDeviationMS)) |
|
972 { |
|
973 ERR_PRINTF3(_L("Error - time comparison failed: Got %u; Expected %u"), timeUint, KTestClock2Seconds); |
|
974 ret = EFail; |
|
975 } |
|
976 else |
|
977 { |
|
978 INFO_PRINTF3(_L("Time comparison passed: Got %u; Expected %u"), timeUint, KTestClock2Seconds); |
|
979 } |
|
980 |
|
981 // reset the clock back to 2 seconds |
|
982 //testTime = KTestClock2Seconds; |
|
983 //iClockSource->Reset(testTime); |
|
984 |
|
985 // suspend timer for 2 seconds then resume for 2 seconds |
|
986 iClockSource->Suspend(); |
|
987 User::After(KTestClock2Seconds); |
|
988 iClockSource->Resume(); |
|
989 User::After(KTestClock2Seconds); |
|
990 testTime = iClockSource->Time(); |
|
991 timeUint = I64LOW(testTime.Int64()); |
|
992 |
|
993 if (!TimeComparison(timeUint, KTestClock4Seconds, KTestClockDeviationMS)) |
|
994 { |
|
995 ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock4Seconds); |
|
996 ret = EFail; |
|
997 } |
|
998 else |
|
999 { |
|
1000 INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock4Seconds); |
|
1001 } |
|
1002 |
|
1003 // reset clock to 18 seconds |
|
1004 testTime = KTestClock18Seconds; |
|
1005 iClockSource->Reset(testTime); |
|
1006 |
|
1007 // wait for 2 seconds and then check the time == 20 seconds |
|
1008 User::After(KTestClock2Seconds); |
|
1009 testTime = iClockSource->Time(); |
|
1010 timeUint = I64LOW(testTime.Int64()); |
|
1011 |
|
1012 if (!TimeComparison(timeUint, KTestClock20Seconds, KTestClockDeviationMS)) |
|
1013 { |
|
1014 ERR_PRINTF3(_L("Error - Reset() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock20Seconds); |
|
1015 ret = EFail; |
|
1016 } |
|
1017 else |
|
1018 { |
|
1019 INFO_PRINTF3(_L("Reset() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock20Seconds); |
|
1020 } |
|
1021 |
|
1022 // suspend for 2 seconds then resume for 2 seconds |
|
1023 iClockSource->Suspend(); |
|
1024 User::After(KTestClock2Seconds); |
|
1025 iClockSource->Resume(); |
|
1026 User::After(KTestClock2Seconds); |
|
1027 |
|
1028 testTime = iClockSource->Time(); |
|
1029 timeUint = I64LOW(testTime.Int64()); |
|
1030 |
|
1031 if (!TimeComparison(timeUint, KTestClock22Seconds, KTestClockDeviationMS)) |
|
1032 { |
|
1033 ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock22Seconds); |
|
1034 ret = EFail; |
|
1035 } |
|
1036 else |
|
1037 { |
|
1038 INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock22Seconds); |
|
1039 } |
|
1040 |
|
1041 // Now test the periodic utility |
|
1042 TRAPD(perError, iPeriodicUtility = CMMFClockSourcePeriodicUtility::NewL(*iClockSource, *this)); |
|
1043 if (perError) |
|
1044 { |
|
1045 ERR_PRINTF1(_L("Error - Couldn't create periodic utility object")); |
|
1046 ret = EInconclusive; |
|
1047 } |
|
1048 else |
|
1049 { |
|
1050 iPeriodicUtilityTestVerdict = EPass; |
|
1051 TTimeIntervalMicroSeconds32 period = KTestClock2Seconds; |
|
1052 iClockSource->Reset(); |
|
1053 iPeriodicUtility->Start(period); |
|
1054 CActiveScheduler::Start(); |
|
1055 ret = iPeriodicUtilityTestVerdict; |
|
1056 } |
|
1057 delete iPeriodicUtility; |
|
1058 iPeriodicUtility = NULL; |
|
1059 |
|
1060 // Clean up the thread |
|
1061 iShutdownSubthread = ETrue; |
|
1062 User::WaitForRequest(stat); |
|
1063 thread.Close(); |
|
1064 |
|
1065 delete iClockSource; |
|
1066 |
|
1067 return ret; |
|
1068 } |
|
1069 |
|
1070 //------------------------------------------------------------------ |
|
1071 |
|
1072 void CTestDevVideoPlayCommit::MdvpoInitComplete(TInt aError) |
|
1073 { |
|
1074 INFO_PRINTF2(_L("CTestDevVideoPlayCommit::MdvpoInitComplete(): Error = %d"), aError); |
|
1075 |
|
1076 iError = aError; |
|
1077 } |
|
1078 |
|
1079 CTestDevVideoPlayCommit::CTestDevVideoPlayCommit(const TDesC& aTestName, TTestType aTestType) |
|
1080 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
1081 { |
|
1082 } |
|
1083 |
|
1084 CTestDevVideoPlayCommit* CTestDevVideoPlayCommit::NewL(const TDesC& aTestName, TTestType aTestType) |
|
1085 { |
|
1086 CTestDevVideoPlayCommit* self = new(ELeave) CTestDevVideoPlayCommit(aTestName, aTestType); |
|
1087 return self; |
|
1088 } |
|
1089 |
|
1090 TVerdict CTestDevVideoPlayCommit::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
1091 { |
|
1092 TVerdict ret = EPass; |
|
1093 TInt expErr = KErrNone; |
|
1094 TBool selDec = ETrue; |
|
1095 TBool selPost = ETrue; |
|
1096 |
|
1097 INFO_PRINTF1(_L("CMMFDevVideoPlay: Commit")); |
|
1098 |
|
1099 // expected results |
|
1100 switch(iTestType) |
|
1101 { |
|
1102 case ETestValid: |
|
1103 expErr = KErrNone; |
|
1104 break; |
|
1105 case ETestDecoderOnly: |
|
1106 selPost = EFalse; |
|
1107 break; |
|
1108 case ETestPostProcOnly: |
|
1109 selDec = EFalse; |
|
1110 break; |
|
1111 default: |
|
1112 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1113 return EInconclusive; |
|
1114 } |
|
1115 |
|
1116 TInt err = KErrNone; |
|
1117 |
|
1118 // THwDeviceId hwDecoder = 0; |
|
1119 // THwDeviceId hwPostProc = 0; |
|
1120 |
|
1121 // select decoder |
|
1122 if (selDec) |
|
1123 { |
|
1124 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
1125 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal |
|
1126 if (err != KErrNone) |
|
1127 { |
|
1128 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
1129 return EInconclusive; |
|
1130 } |
|
1131 } |
|
1132 |
|
1133 // select post-processor |
|
1134 if (selPost) |
|
1135 { |
|
1136 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
1137 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
1138 if (err != KErrNone) |
|
1139 { |
|
1140 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
1141 return EInconclusive; |
|
1142 } |
|
1143 } |
|
1144 |
|
1145 // initialize CDevVideoPlay and wait for response |
|
1146 // iError is set by the MdvpoInitComplete callback |
|
1147 aDevVideoPlay.Initialize(); |
|
1148 |
|
1149 if (iError != KErrNone) |
|
1150 { |
|
1151 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
1152 return EInconclusive; |
|
1153 } |
|
1154 |
|
1155 // call CommitL on DevVideoPlay |
|
1156 TRAP(iError, aDevVideoPlay.CommitL()); |
|
1157 |
|
1158 if (iError != expErr) |
|
1159 { |
|
1160 ERR_PRINTF3(_L("Commit left with error %d; Expected %d!"), iError, expErr); |
|
1161 ret = EFail; |
|
1162 } |
|
1163 else |
|
1164 INFO_PRINTF1(_L("CommitL() called successfully")); |
|
1165 |
|
1166 return ret; |
|
1167 } |
|
1168 |
|
1169 //------------------------------------------------------------------ |
|
1170 |
|
1171 void CTestDevVideoPlayRevert::MdvpoInitComplete(TInt aError) |
|
1172 { |
|
1173 INFO_PRINTF2(_L("CTestDevVideoPlayRevert::MdvpoInitComplete(): Error = %d"), aError); |
|
1174 |
|
1175 iError = aError; |
|
1176 } |
|
1177 |
|
1178 CTestDevVideoPlayRevert::CTestDevVideoPlayRevert(const TDesC& aTestName, TTestType aTestType) |
|
1179 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
1180 { |
|
1181 } |
|
1182 |
|
1183 CTestDevVideoPlayRevert* CTestDevVideoPlayRevert::NewL(const TDesC& aTestName, TTestType aTestType) |
|
1184 { |
|
1185 CTestDevVideoPlayRevert* self = new(ELeave) CTestDevVideoPlayRevert(aTestName, aTestType); |
|
1186 return self; |
|
1187 } |
|
1188 |
|
1189 TVerdict CTestDevVideoPlayRevert::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
1190 { |
|
1191 TVerdict ret = EPass; |
|
1192 // TInt expErr = KErrNone; |
|
1193 TBool selDec = ETrue; |
|
1194 TBool selPost = ETrue; |
|
1195 |
|
1196 INFO_PRINTF1(_L("CMMFDevVideoPlay: Revert")); |
|
1197 |
|
1198 // expected results |
|
1199 switch(iTestType) |
|
1200 { |
|
1201 case ETestValid: |
|
1202 // expErr = KErrNone; |
|
1203 break; |
|
1204 case ETestDecoderOnly: |
|
1205 selPost = EFalse; |
|
1206 break; |
|
1207 case ETestPostProcOnly: |
|
1208 selDec = EFalse; |
|
1209 break; |
|
1210 default: |
|
1211 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1212 return EInconclusive; |
|
1213 } |
|
1214 |
|
1215 TInt err = KErrNone; |
|
1216 |
|
1217 // THwDeviceId hwDecoder = 0; |
|
1218 // THwDeviceId hwPostProc = 0; |
|
1219 |
|
1220 // select decoder |
|
1221 if (selDec) |
|
1222 { |
|
1223 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
1224 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal |
|
1225 if (err != KErrNone) |
|
1226 { |
|
1227 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
1228 return EInconclusive; |
|
1229 } |
|
1230 } |
|
1231 |
|
1232 // select post-processor |
|
1233 if (selPost) |
|
1234 { |
|
1235 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
1236 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal |
|
1237 if (err != KErrNone) |
|
1238 { |
|
1239 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
1240 return EInconclusive; |
|
1241 } |
|
1242 } |
|
1243 |
|
1244 // initialize CDevVideoPlay and wait for response |
|
1245 // iError is set by the MdvpoInitComplete callback |
|
1246 aDevVideoPlay.Initialize(); |
|
1247 |
|
1248 if (iError != KErrNone) |
|
1249 { |
|
1250 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
1251 return EInconclusive; |
|
1252 } |
|
1253 |
|
1254 // call Revert on DevVideoPlay |
|
1255 aDevVideoPlay.Revert(); |
|
1256 |
|
1257 // if no PANIC then test has passed... |
|
1258 |
|
1259 INFO_PRINTF1(_L("Revert() called successfully")); |
|
1260 |
|
1261 return ret; |
|
1262 } |
|
1263 |
|
1264 |
|
1265 //------------------------------------------------------------------ |
|
1266 |
|
1267 CTestDevVideoPlayCustomInterface::CTestDevVideoPlayCustomInterface(const TDesC& aTestName, TTestType aTestType) |
|
1268 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
1269 { |
|
1270 } |
|
1271 |
|
1272 CTestDevVideoPlayCustomInterface* CTestDevVideoPlayCustomInterface::NewL(const TDesC& aTestName, TTestType aTestType) |
|
1273 { |
|
1274 CTestDevVideoPlayCustomInterface* self = new(ELeave) CTestDevVideoPlayCustomInterface(aTestName, aTestType); |
|
1275 return self; |
|
1276 } |
|
1277 |
|
1278 TVerdict CTestDevVideoPlayCustomInterface::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
1279 { |
|
1280 INFO_PRINTF1(_L("CMMFDevVideoPlay: CustomInterface")); |
|
1281 |
|
1282 THwDeviceId hwDecoder = 0; |
|
1283 THwDeviceId hwPostProc = 0; |
|
1284 TInt err = KErrNone; |
|
1285 |
|
1286 TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); |
|
1287 if (err != KErrNone) |
|
1288 { |
|
1289 ERR_PRINTF1(_L("Error - couldn't initialize decoder")); |
|
1290 return EInconclusive; |
|
1291 } |
|
1292 |
|
1293 TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); |
|
1294 if (err != KErrNone) |
|
1295 { |
|
1296 ERR_PRINTF1(_L("Error - couldn't initialize post processor")); |
|
1297 return EInconclusive; |
|
1298 } |
|
1299 |
|
1300 // First try test uninitialized |
|
1301 |
|
1302 TAny* ciOne = NULL; |
|
1303 TAny* ciTwo = NULL; |
|
1304 TAny* ciThree = NULL; |
|
1305 TAny* ciFour = NULL; |
|
1306 |
|
1307 ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne); |
|
1308 ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo); |
|
1309 ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo); |
|
1310 ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne); |
|
1311 |
|
1312 if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL) |
|
1313 { |
|
1314 ERR_PRINTF1(_L("Test Failed - wrong interfaces returned")); |
|
1315 return EFail; |
|
1316 } |
|
1317 |
|
1318 // Next, re-perform test initialized. |
|
1319 |
|
1320 // initialize CDevVideoPlay and wait for response |
|
1321 // iError is set by the MdvpoInitComplete callback |
|
1322 aDevVideoPlay.Initialize(); |
|
1323 |
|
1324 if (iError != KErrNone) |
|
1325 { |
|
1326 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); |
|
1327 return EInconclusive; |
|
1328 } |
|
1329 |
|
1330 ciOne = NULL; |
|
1331 ciTwo = NULL; |
|
1332 ciThree = NULL; |
|
1333 ciFour = NULL; |
|
1334 |
|
1335 ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne); |
|
1336 ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo); |
|
1337 ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo); |
|
1338 ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne); |
|
1339 |
|
1340 if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL) |
|
1341 { |
|
1342 ERR_PRINTF1(_L("Test Failed - wrong interfaces returned")); |
|
1343 return EFail; |
|
1344 } |
|
1345 |
|
1346 |
|
1347 return EPass; |
|
1348 } |
|
1349 |
|
1350 |
|
1351 |
|
1352 /* |
|
1353 //------------------------------------------------------------------ |
|
1354 |
|
1355 CTestDevVideoPlayXXX::CTestDevVideoPlayXXX(const TDesC& aTestName, TTestType aTestType) |
|
1356 :CTestDevVideoPlayStep(aTestName, aTestType) |
|
1357 { |
|
1358 } |
|
1359 |
|
1360 CTestDevVideoPlayXXX* CTestDevVideoPlayXXX::NewL(const TDesC& aTestName, TTestType aTestType) |
|
1361 { |
|
1362 CTestDevVideoPlayXXX* self = new(ELeave) CTestDevVideoPlayXXX(aTestName, aTestType); |
|
1363 return self; |
|
1364 } |
|
1365 |
|
1366 TVerdict CTestDevVideoPlayXXX::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) |
|
1367 { |
|
1368 TVerdict ret = EPass; |
|
1369 TInt expErr = KErrNone; |
|
1370 |
|
1371 INFO_PRINTF1(_L("CMMFDevVideoPlay: XXX")); |
|
1372 |
|
1373 // expected results |
|
1374 if (iTestType != ETestValid) |
|
1375 { |
|
1376 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1377 return EInconclusive; |
|
1378 } |
|
1379 |
|
1380 // XXXX |
|
1381 |
|
1382 TInt err = KErrNone; |
|
1383 // TRAP(err, aDevVideoPlay.API_FUNCTION_HERE() ) |
|
1384 |
|
1385 if (err != expErr) |
|
1386 { |
|
1387 ERR_PRINTF3(_L("XXX() gave error %d (expected %d)"),iError, expErr); |
|
1388 ret = EFail; |
|
1389 } |
|
1390 else |
|
1391 INFO_PRINTF3(_L("XXX(), %d = %d"), iError, expErr); |
|
1392 |
|
1393 return ret; |
|
1394 } |
|
1395 |
|
1396 */ |
|
1397 |