Update contrib.
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".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
15 // TestDevVideoPlay.cpp
19 #include "TestDevVideoPlay.h"
20 #include "TestDevVideoPlayTestData.h"
21 #include "TestDevVideoPlugins/decoder.h"
22 #include "TestDevVideoPlugins/postproc.h"
25 void CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(TInt aError)
27 INFO_PRINTF2(_L("CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(): Error = %d"), aError);
32 CTestDevVideoPlayGetNewPictureInfo::CTestDevVideoPlayGetNewPictureInfo(const TDesC& aTestName, TTestType aTestType)
33 :CTestDevVideoPlayStep(aTestName, aTestType)
37 CTestDevVideoPlayGetNewPictureInfo* CTestDevVideoPlayGetNewPictureInfo::NewL(const TDesC& aTestName, TTestType aTestType)
39 CTestDevVideoPlayGetNewPictureInfo* self = new(ELeave) CTestDevVideoPlayGetNewPictureInfo(aTestName, aTestType);
43 TVerdict CTestDevVideoPlayGetNewPictureInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
47 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetNewPictureInfo"));
50 if (iTestType != ETestValid)
52 ERR_PRINTF1(_L("Error - invalid test step type"));
58 // THwDeviceId hwDecoder = 0;
59 // THwDeviceId hwPostProc = 0;
62 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
63 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
66 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
70 // select post-processor
71 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
72 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
75 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
79 //Tell plugin to start creating pictures.
80 TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse));
81 if (iError != KErrNone)
83 ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen"));
87 // initialize CDevVideoPlay and wait for response
88 // iError is set by the MdvpoInitComplete callback
89 aDevVideoPlay.Initialize();
91 if (iError != KErrNone)
93 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
97 aDevVideoPlay.Start();
99 TUint numPictures = 0;
100 TTimeIntervalMicroSeconds earliestTimeStamp(0);
101 TTimeIntervalMicroSeconds latestTimeStamp(0);
104 aDevVideoPlay.GetNewPictureInfo(numPictures, earliestTimeStamp, latestTimeStamp);
106 if ((numPictures == 1)
107 && (earliestTimeStamp == TTimeIntervalMicroSeconds(0))
108 && (latestTimeStamp == TTimeIntervalMicroSeconds(0)))
115 //------------------------------------------------------------------
117 void CTestDevVideoPlayNextPicture::MdvpoInitComplete(TInt aError)
119 INFO_PRINTF2(_L("CTestDevVideoPlayNextPicture::MdvpoInitComplete(): Error = %d"), aError);
124 CTestDevVideoPlayNextPicture::CTestDevVideoPlayNextPicture(const TDesC& aTestName, TTestType aTestType)
125 :CTestDevVideoPlayStep(aTestName, aTestType)
129 CTestDevVideoPlayNextPicture* CTestDevVideoPlayNextPicture::NewL(const TDesC& aTestName, TTestType aTestType)
131 CTestDevVideoPlayNextPicture* self = new(ELeave) CTestDevVideoPlayNextPicture(aTestName, aTestType);
135 TVerdict CTestDevVideoPlayNextPicture::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
137 TVerdict ret = EPass;
139 INFO_PRINTF1(_L("CMMFDevVideoPlay: NextPicture"));
142 if (iTestType != ETestValid)
144 ERR_PRINTF1(_L("Error - invalid test step type"));
145 return EInconclusive;
150 // THwDeviceId hwDecoder = 0;
151 // THwDeviceId hwPostProc = 0;
154 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
155 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));// EABI warning removal
158 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
159 return EInconclusive;
162 // select post-processor
163 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
164 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
167 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
168 return EInconclusive;
171 //Tell plugin to start creating pictures.
172 TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse));
173 if (iError != KErrNone)
175 ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen"));
176 return EInconclusive;
179 // initialize CDevVideoPlay and wait for response
180 // iError is set by the MdvpoInitComplete callback
181 aDevVideoPlay.Initialize();
183 if (iError != KErrNone)
185 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
186 return EInconclusive;
189 iDevVideoPlay = &aDevVideoPlay;
190 aDevVideoPlay.Start();//Tell plugin to start creating pictures.
191 // We should now get a series of NewPicture() callbacks.
193 if (iError == KErrNone)
199 ERR_PRINTF2(_L("Error - picture processing failed with error %d"), iError);
205 void CTestDevVideoPlayNextPicture::MdvpoNewPictures()
207 TRAP(iError, DoNewPicturesL());
210 void CTestDevVideoPlayNextPicture::CheckNewPictureInfoL(TUint aNumPictures, const TTimeIntervalMicroSeconds& aFirst, const TTimeIntervalMicroSeconds& aLast)
212 TUint numPictures = 0;
213 TTimeIntervalMicroSeconds first(0);
214 TTimeIntervalMicroSeconds last(0);
215 iDevVideoPlay->GetNewPictureInfo(numPictures, first, last);
217 if ((numPictures!=aNumPictures) || (first!=aFirst) || (last!=aLast))
219 User::Leave(KErrGeneral);
223 void CTestDevVideoPlayNextPicture::DoNewPicturesL()
225 User::LeaveIfError(iError);//Don't go any further if we have an error
226 switch (iCurrentPictureNumber)
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);
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);
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);
257 iCurrentPictureNumber++;
258 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(3), TTimeIntervalMicroSeconds(3));
259 TVideoPicture* picture = iDevVideoPlay->NextPictureL();
260 iDevVideoPlay->ReturnPicture(picture);
265 iCurrentPictureNumber++;
266 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(4), TTimeIntervalMicroSeconds(4));
267 TVideoPicture* picture = iDevVideoPlay->NextPictureL();
268 iDevVideoPlay->ReturnPicture(picture);
273 iCurrentPictureNumber++;
274 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(5), TTimeIntervalMicroSeconds(5));
275 TVideoPicture* picture = iDevVideoPlay->NextPictureL();
276 iDevVideoPlay->ReturnPicture(picture);
281 iCurrentPictureNumber++;
282 CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(6));
287 iCurrentPictureNumber++;
288 CheckNewPictureInfoL(2, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(7));
293 iCurrentPictureNumber++;
294 CheckNewPictureInfoL(3, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(8));
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));
316 User::Leave(KErrGeneral);
323 //------------------------------------------------------------------
325 void CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(TInt aError)
327 INFO_PRINTF2(_L("CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(): Error = %d"), aError);
332 CTestDevVideoPlayGetSnapshot::CTestDevVideoPlayGetSnapshot(const TDesC& aTestName, TTestType aTestType)
333 :CTestDevVideoPlayStep(aTestName, aTestType)
337 CTestDevVideoPlayGetSnapshot* CTestDevVideoPlayGetSnapshot::NewL(const TDesC& aTestName, TTestType aTestType)
339 CTestDevVideoPlayGetSnapshot* self = new(ELeave) CTestDevVideoPlayGetSnapshot(aTestName, aTestType);
343 TVerdict CTestDevVideoPlayGetSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
345 TVerdict ret = EFail;
347 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSnapshot"));
350 if (iTestType != ETestValid)
352 ERR_PRINTF1(_L("Error - invalid test step type"));
353 return EInconclusive;
358 // THwDeviceId hwDecoder = 0;
359 // THwDeviceId hwPostProc = 0;
362 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
363 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
366 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
367 return EInconclusive;
370 // select post-processor
371 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
372 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
375 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
376 return EInconclusive;
379 // initialize CDevVideoPlay and wait for response
380 // iError is set by the MdvpoInitComplete callback
381 aDevVideoPlay.Initialize();
383 if (iError != KErrNone)
385 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
386 return EInconclusive;
389 TBool result = EFalse;
390 TPictureData pictureData;
392 TUncompressedVideoFormat format;
393 format.iDataFormat = EYuvRawData;
394 format.iYuvFormat = KTestYuvFormat1;
396 TRAP(err, result = aDevVideoPlay.GetSnapshotL(pictureData, format));
402 if ((pictureData.iDataFormat == EYuvRawData) &&
403 (pictureData.iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) &&
404 (pictureData.iRawData == NULL))
413 //------------------------------------------------------------------
415 void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(TInt aError)
417 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(): Error = %d"), aError);
422 void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(TInt aError,
423 TPictureData* aPictureData,
424 const TTimeIntervalMicroSeconds& aPresentationTimestamp,
425 const TPictureId& /*aPictureId*/)
427 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(): Error = %d"), aError);
430 iTimestamp = aPresentationTimestamp;
431 iPictureData = aPictureData;
434 CTestDevVideoPlayGetTimedSnapshotTimestamp::CTestDevVideoPlayGetTimedSnapshotTimestamp(const TDesC& aTestName, TTestType aTestType)
435 :CTestDevVideoPlayStep(aTestName, aTestType)
439 CTestDevVideoPlayGetTimedSnapshotTimestamp* CTestDevVideoPlayGetTimedSnapshotTimestamp::NewL(const TDesC& aTestName, TTestType aTestType)
441 CTestDevVideoPlayGetTimedSnapshotTimestamp* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotTimestamp(aTestName, aTestType);
445 TVerdict CTestDevVideoPlayGetTimedSnapshotTimestamp::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
447 TVerdict ret = EFail;
448 TInt expErr = KErrNone;
450 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotTimestamp"));
453 if (iTestType != ETestValid)
455 ERR_PRINTF1(_L("Error - invalid test step type"));
456 return EInconclusive;
461 // THwDeviceId hwDecoder = 0;
462 // THwDeviceId hwPostProc = 0;
465 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
466 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
469 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
470 return EInconclusive;
473 // select post-processor
474 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
475 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
478 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
479 return EInconclusive;
482 // initialize CDevVideoPlay and wait for response
483 // iError is set by the MdvpoInitComplete callback
484 aDevVideoPlay.Initialize();
486 if (iError != KErrNone)
488 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
489 return EInconclusive;
492 TPictureData pictureData;
494 TUncompressedVideoFormat format;
495 format.iDataFormat = EYuvRawData;
496 format.iYuvFormat = KTestYuvFormat1;
497 TTimeIntervalMicroSeconds snapTime(KTestSnapshotTimestamp);
499 // get a timed snapshot from the post processor
500 TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapTime));
502 // check picture and timestamp from callback
503 if ((err == KErrNone) && (iError == KErrNone))
505 if ((iPictureData) && (iTimestamp == TTimeIntervalMicroSeconds(KTestSnapshotTimestamp)))
507 if ((iPictureData->iDataFormat == EYuvRawData) &&
508 (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) &&
509 (iPictureData->iRawData == NULL))
515 ERR_PRINTF1(_L("Error - PictureData is corrupt!"));
521 ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr);
526 //------------------------------------------------------------------
528 void CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(TInt aError)
530 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(): Error = %d"), aError);
535 void CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(TInt aError,
536 TPictureData* aPictureData,
537 const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/,
538 const TPictureId& aPictureId)
540 INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(): Error = %d"), aError);
543 iPictureId = aPictureId;
544 iPictureData = aPictureData;
547 CTestDevVideoPlayGetTimedSnapshotID::CTestDevVideoPlayGetTimedSnapshotID(const TDesC& aTestName, TTestType aTestType)
548 :CTestDevVideoPlayStep(aTestName, aTestType)
552 CTestDevVideoPlayGetTimedSnapshotID* CTestDevVideoPlayGetTimedSnapshotID::NewL(const TDesC& aTestName, TTestType aTestType)
554 CTestDevVideoPlayGetTimedSnapshotID* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotID(aTestName, aTestType);
558 TVerdict CTestDevVideoPlayGetTimedSnapshotID::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
560 TVerdict ret = EPass;
561 TInt expErr = KErrNone;
563 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotID"));
566 if (iTestType != ETestValid)
568 ERR_PRINTF1(_L("Error - invalid test step type"));
569 return EInconclusive;
574 // THwDeviceId hwDecoder = 0;
575 // THwDeviceId hwPostProc = 0;
578 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
579 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
582 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
583 return EInconclusive;
586 // select post-processor
587 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
588 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
591 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
592 return EInconclusive;
595 // initialize CDevVideoPlay and wait for response
596 // iError is set by the MdvpoInitComplete callback
597 aDevVideoPlay.Initialize();
599 if (iError != KErrNone)
601 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
602 return EInconclusive;
605 TPictureData pictureData;
607 TUncompressedVideoFormat format;
608 format.iDataFormat = EYuvRawData;
609 format.iYuvFormat = KTestYuvFormat1;
610 TPictureId snapId = KTestSnapshotId;
612 // get a timed snapshot from the post processor
613 TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId));
615 // check picture and timestamp from callback
616 if ((err == KErrNone) && (iError == KErrNone))
618 if ( (iPictureData) && (iPictureId.iIdType == KTestSnapshotId.iIdType) &&
619 (iPictureId.iId == KTestSnapshotId.iId) )
621 if ((iPictureData->iDataFormat == EYuvRawData) &&
622 (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) &&
623 (iPictureData->iRawData == NULL))
629 ERR_PRINTF1(_L("Error - PictureData is corrupt!"));
635 ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr);
640 //------------------------------------------------------------------
642 void CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(TInt aError)
644 INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(): Error = %d"), aError);
649 void CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(TInt aError,
650 TPictureData* /*aPictureData*/,
651 const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/,
652 const TPictureId& /*aPictureId*/)
654 INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(): Error = %d"), aError);
659 CTestDevVideoPlayCancelTimedSnapshot::CTestDevVideoPlayCancelTimedSnapshot(const TDesC& aTestName, TTestType aTestType)
660 :CTestDevVideoPlayStep(aTestName, aTestType)
664 CTestDevVideoPlayCancelTimedSnapshot* CTestDevVideoPlayCancelTimedSnapshot::NewL(const TDesC& aTestName, TTestType aTestType)
666 CTestDevVideoPlayCancelTimedSnapshot* self = new(ELeave) CTestDevVideoPlayCancelTimedSnapshot(aTestName, aTestType);
670 TVerdict CTestDevVideoPlayCancelTimedSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
672 TVerdict ret = EFail;
673 TInt expErr = KErrNone;
675 INFO_PRINTF1(_L("CMMFDevVideoPlay: CancelTimedSnapshot"));
678 if (iTestType != ETestValid)
680 ERR_PRINTF1(_L("Error - invalid test step type"));
681 return EInconclusive;
686 // THwDeviceId hwDecoder = 0;
687 // THwDeviceId hwPostProc = 0;
690 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
691 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
694 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
695 return EInconclusive;
698 // select post-processor
699 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
700 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
703 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
704 return EInconclusive;
707 // initialize CDevVideoPlay and wait for response
708 // iError is set by the MdvpoInitComplete callback
709 aDevVideoPlay.Initialize();
711 if (iError != KErrNone)
713 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
714 return EInconclusive;
718 TPictureData pictureData;
720 TUncompressedVideoFormat format;
721 format.iDataFormat = EYuvRawData;
722 format.iYuvFormat = KTestYuvFormat1;
723 TPictureId snapId = KTestSnapshotId;
725 // get a timed snapshot from the post processor
726 TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId));
728 // cancel the snapshot
729 aDevVideoPlay.CancelTimedSnapshot();
731 // check picture has been cancelled
734 if (iError == KErrAbort)
736 INFO_PRINTF1(_L("Timed snapshot cancelled successfully"));
741 ERR_PRINTF3(_L("MdvpoTimedSnapshotComplete() gave error %d (expected %d)"),iError, KErrAbort);
746 ERR_PRINTF3(_L("CancelTimedSnapshotL() gave error %d (expected %d)"),err, expErr);
751 //------------------------------------------------------------------
753 void CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(TInt aError)
755 INFO_PRINTF2(_L("CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(): Error = %d"), aError);
760 CTestDevVideoPlayGetSupportedSnapshotFormats::CTestDevVideoPlayGetSupportedSnapshotFormats(const TDesC& aTestName, TTestType aTestType)
761 :CTestDevVideoPlayStep(aTestName, aTestType)
765 CTestDevVideoPlayGetSupportedSnapshotFormats* CTestDevVideoPlayGetSupportedSnapshotFormats::NewL(const TDesC& aTestName, TTestType aTestType)
767 CTestDevVideoPlayGetSupportedSnapshotFormats* self = new(ELeave) CTestDevVideoPlayGetSupportedSnapshotFormats(aTestName, aTestType);
771 TVerdict CTestDevVideoPlayGetSupportedSnapshotFormats::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
773 TVerdict ret = EFail;
774 TInt expErr = KErrNone;
776 INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSupportedSnapshotFormats"));
779 if (iTestType != ETestValid)
781 ERR_PRINTF1(_L("Error - invalid test step type"));
782 return EInconclusive;
787 // THwDeviceId hwDecoder = 0;
788 // THwDeviceId hwPostProc = 0;
791 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
792 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
795 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
796 return EInconclusive;
799 // select post-processor
800 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
801 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
804 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
805 return EInconclusive;
808 // initialize CDevVideoPlay and wait for response
809 // iError is set by the MdvpoInitComplete callback
810 aDevVideoPlay.Initialize();
812 if (iError != KErrNone)
814 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
815 return EInconclusive;
818 RArray<TUncompressedVideoFormat> vidFormats;
820 // get a list of supported formats from the plugin
821 TRAP(err, aDevVideoPlay.GetSupportedSnapshotFormatsL(vidFormats) )
823 // check picture and timestamp from callback
826 if ( vidFormats.Count() == 3)
828 if ((vidFormats[0] == KTestVidFormat1) &&
829 (vidFormats[1] == KTestVidFormat2) &&
830 (vidFormats[2] == KTestVidFormat3) )
832 INFO_PRINTF1(_L("Snapshot format list checks ok"));
837 ERR_PRINTF1(_L("Error - Snapshot format list is corrupt!"));
843 ERR_PRINTF3(_L("GetSupportedSnapshotFormatsL() gave error %d (expected %d)"),err, expErr);
852 //------------------------------------------------------------------
854 CTestDevVideoPlayClock::CTestDevVideoPlayClock(const TDesC& aTestName)
856 iTestStepName = aTestName;
859 void CTestDevVideoPlayClock::ConstructL()
863 CTestDevVideoPlayClock::~CTestDevVideoPlayClock()
867 CTestDevVideoPlayClock* CTestDevVideoPlayClock::NewL(const TDesC& aTestName)
869 CTestDevVideoPlayClock* self = new(ELeave) CTestDevVideoPlayClock(aTestName);
870 CleanupStack::PushL(self);
872 CleanupStack::Pop(self);
876 TInt CTestDevVideoPlayClock::StartThread(TAny* aAny)
878 CTestDevVideoPlayClock* me = static_cast<CTestDevVideoPlayClock*>(aAny);
884 void CTestDevVideoPlayClock::RunThread()
886 TTimeIntervalMicroSeconds currentTime(0);
888 while(!iShutdownSubthread)
890 currentTime = iClockSource->Time();
891 TUint timeUint = I64LOW(currentTime.Int64());
895 void CTestDevVideoPlayClock::MmcspuoTick(const TTimeIntervalMicroSeconds& aTime)
897 iPeriodicUtilityIteration++;
899 TUint currentTime = I64LOW(aTime.Int64());
900 TUint predictedTime = iPeriodicUtilityIteration * KTestClock2Seconds;
902 if (!TimeComparison(currentTime, predictedTime, KTestClockBigDeviationMS))
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();
911 INFO_PRINTF3(_L("Periodic Utility time comparison passed: Got %u; Expected %u"), currentTime, predictedTime);
914 if (iPeriodicUtilityIteration >= 5)
916 iPeriodicUtility->Stop();
917 CActiveScheduler::Stop();
921 TVerdict CTestDevVideoPlayClock::DoTestStepL()
923 TVerdict ret = EPass;
924 TTimeIntervalMicroSeconds testTime(0);
927 iClockSource = CSystemClockSource::NewL();
929 // Construct a new thread to constantly probe the clock - to test that it'll work from multiple threads
932 TInt error = thread.Create(_L("ClockSourceTestThread"),
933 &CTestDevVideoPlayClock::StartThread,
936 static_cast<TAny*>(this),
941 ERR_PRINTF1(_L("Error - Couldn't create periodic utility object"));
943 return EInconclusive;
948 if (stat!=KRequestPending)
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;
956 thread.SetPriority(EPriorityLess);
958 // wait for system to calm down
959 User::After(KTestClock2Seconds);
962 iClockSource->Reset();
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());
971 if (!TimeComparison(timeUint, KTestClock2Seconds, KTestClockDeviationMS))
973 ERR_PRINTF3(_L("Error - time comparison failed: Got %u; Expected %u"), timeUint, KTestClock2Seconds);
978 INFO_PRINTF3(_L("Time comparison passed: Got %u; Expected %u"), timeUint, KTestClock2Seconds);
981 // reset the clock back to 2 seconds
982 //testTime = KTestClock2Seconds;
983 //iClockSource->Reset(testTime);
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());
993 if (!TimeComparison(timeUint, KTestClock4Seconds, KTestClockDeviationMS))
995 ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock4Seconds);
1000 INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock4Seconds);
1003 // reset clock to 18 seconds
1004 testTime = KTestClock18Seconds;
1005 iClockSource->Reset(testTime);
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());
1012 if (!TimeComparison(timeUint, KTestClock20Seconds, KTestClockDeviationMS))
1014 ERR_PRINTF3(_L("Error - Reset() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock20Seconds);
1019 INFO_PRINTF3(_L("Reset() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock20Seconds);
1022 // suspend for 2 seconds then resume for 2 seconds
1023 iClockSource->Suspend();
1024 User::After(KTestClock2Seconds);
1025 iClockSource->Resume();
1026 User::After(KTestClock2Seconds);
1028 testTime = iClockSource->Time();
1029 timeUint = I64LOW(testTime.Int64());
1031 if (!TimeComparison(timeUint, KTestClock22Seconds, KTestClockDeviationMS))
1033 ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock22Seconds);
1038 INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock22Seconds);
1041 // Now test the periodic utility
1042 TRAPD(perError, iPeriodicUtility = CMMFClockSourcePeriodicUtility::NewL(*iClockSource, *this));
1045 ERR_PRINTF1(_L("Error - Couldn't create periodic utility object"));
1046 ret = EInconclusive;
1050 iPeriodicUtilityTestVerdict = EPass;
1051 TTimeIntervalMicroSeconds32 period = KTestClock2Seconds;
1052 iClockSource->Reset();
1053 iPeriodicUtility->Start(period);
1054 CActiveScheduler::Start();
1055 ret = iPeriodicUtilityTestVerdict;
1057 delete iPeriodicUtility;
1058 iPeriodicUtility = NULL;
1060 // Clean up the thread
1061 iShutdownSubthread = ETrue;
1062 User::WaitForRequest(stat);
1065 delete iClockSource;
1070 //------------------------------------------------------------------
1072 void CTestDevVideoPlayCommit::MdvpoInitComplete(TInt aError)
1074 INFO_PRINTF2(_L("CTestDevVideoPlayCommit::MdvpoInitComplete(): Error = %d"), aError);
1079 CTestDevVideoPlayCommit::CTestDevVideoPlayCommit(const TDesC& aTestName, TTestType aTestType)
1080 :CTestDevVideoPlayStep(aTestName, aTestType)
1084 CTestDevVideoPlayCommit* CTestDevVideoPlayCommit::NewL(const TDesC& aTestName, TTestType aTestType)
1086 CTestDevVideoPlayCommit* self = new(ELeave) CTestDevVideoPlayCommit(aTestName, aTestType);
1090 TVerdict CTestDevVideoPlayCommit::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1092 TVerdict ret = EPass;
1093 TInt expErr = KErrNone;
1094 TBool selDec = ETrue;
1095 TBool selPost = ETrue;
1097 INFO_PRINTF1(_L("CMMFDevVideoPlay: Commit"));
1105 case ETestDecoderOnly:
1108 case ETestPostProcOnly:
1112 ERR_PRINTF1(_L("Error - invalid test step type"));
1113 return EInconclusive;
1116 TInt err = KErrNone;
1118 // THwDeviceId hwDecoder = 0;
1119 // THwDeviceId hwPostProc = 0;
1124 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1125 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1126 if (err != KErrNone)
1128 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1129 return EInconclusive;
1133 // select post-processor
1136 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1137 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1138 if (err != KErrNone)
1140 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1141 return EInconclusive;
1145 // initialize CDevVideoPlay and wait for response
1146 // iError is set by the MdvpoInitComplete callback
1147 aDevVideoPlay.Initialize();
1149 if (iError != KErrNone)
1151 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1152 return EInconclusive;
1155 // call CommitL on DevVideoPlay
1156 TRAP(iError, aDevVideoPlay.CommitL());
1158 if (iError != expErr)
1160 ERR_PRINTF3(_L("Commit left with error %d; Expected %d!"), iError, expErr);
1164 INFO_PRINTF1(_L("CommitL() called successfully"));
1169 //------------------------------------------------------------------
1171 void CTestDevVideoPlayRevert::MdvpoInitComplete(TInt aError)
1173 INFO_PRINTF2(_L("CTestDevVideoPlayRevert::MdvpoInitComplete(): Error = %d"), aError);
1178 CTestDevVideoPlayRevert::CTestDevVideoPlayRevert(const TDesC& aTestName, TTestType aTestType)
1179 :CTestDevVideoPlayStep(aTestName, aTestType)
1183 CTestDevVideoPlayRevert* CTestDevVideoPlayRevert::NewL(const TDesC& aTestName, TTestType aTestType)
1185 CTestDevVideoPlayRevert* self = new(ELeave) CTestDevVideoPlayRevert(aTestName, aTestType);
1189 TVerdict CTestDevVideoPlayRevert::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1191 TVerdict ret = EPass;
1192 // TInt expErr = KErrNone;
1193 TBool selDec = ETrue;
1194 TBool selPost = ETrue;
1196 INFO_PRINTF1(_L("CMMFDevVideoPlay: Revert"));
1202 // expErr = KErrNone;
1204 case ETestDecoderOnly:
1207 case ETestPostProcOnly:
1211 ERR_PRINTF1(_L("Error - invalid test step type"));
1212 return EInconclusive;
1215 TInt err = KErrNone;
1217 // THwDeviceId hwDecoder = 0;
1218 // THwDeviceId hwPostProc = 0;
1223 // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1224 TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1225 if (err != KErrNone)
1227 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1228 return EInconclusive;
1232 // select post-processor
1235 // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1236 TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1237 if (err != KErrNone)
1239 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1240 return EInconclusive;
1244 // initialize CDevVideoPlay and wait for response
1245 // iError is set by the MdvpoInitComplete callback
1246 aDevVideoPlay.Initialize();
1248 if (iError != KErrNone)
1250 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1251 return EInconclusive;
1254 // call Revert on DevVideoPlay
1255 aDevVideoPlay.Revert();
1257 // if no PANIC then test has passed...
1259 INFO_PRINTF1(_L("Revert() called successfully"));
1265 //------------------------------------------------------------------
1267 CTestDevVideoPlayCustomInterface::CTestDevVideoPlayCustomInterface(const TDesC& aTestName, TTestType aTestType)
1268 :CTestDevVideoPlayStep(aTestName, aTestType)
1272 CTestDevVideoPlayCustomInterface* CTestDevVideoPlayCustomInterface::NewL(const TDesC& aTestName, TTestType aTestType)
1274 CTestDevVideoPlayCustomInterface* self = new(ELeave) CTestDevVideoPlayCustomInterface(aTestName, aTestType);
1278 TVerdict CTestDevVideoPlayCustomInterface::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1280 INFO_PRINTF1(_L("CMMFDevVideoPlay: CustomInterface"));
1282 THwDeviceId hwDecoder = 0;
1283 THwDeviceId hwPostProc = 0;
1284 TInt err = KErrNone;
1286 TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1287 if (err != KErrNone)
1289 ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1290 return EInconclusive;
1293 TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1294 if (err != KErrNone)
1296 ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1297 return EInconclusive;
1300 // First try test uninitialized
1304 TAny* ciThree = NULL;
1305 TAny* ciFour = NULL;
1307 ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne);
1308 ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo);
1309 ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo);
1310 ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne);
1312 if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL)
1314 ERR_PRINTF1(_L("Test Failed - wrong interfaces returned"));
1318 // Next, re-perform test initialized.
1320 // initialize CDevVideoPlay and wait for response
1321 // iError is set by the MdvpoInitComplete callback
1322 aDevVideoPlay.Initialize();
1324 if (iError != KErrNone)
1326 ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1327 return EInconclusive;
1335 ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne);
1336 ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo);
1337 ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo);
1338 ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne);
1340 if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL)
1342 ERR_PRINTF1(_L("Test Failed - wrong interfaces returned"));
1353 //------------------------------------------------------------------
1355 CTestDevVideoPlayXXX::CTestDevVideoPlayXXX(const TDesC& aTestName, TTestType aTestType)
1356 :CTestDevVideoPlayStep(aTestName, aTestType)
1360 CTestDevVideoPlayXXX* CTestDevVideoPlayXXX::NewL(const TDesC& aTestName, TTestType aTestType)
1362 CTestDevVideoPlayXXX* self = new(ELeave) CTestDevVideoPlayXXX(aTestName, aTestType);
1366 TVerdict CTestDevVideoPlayXXX::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1368 TVerdict ret = EPass;
1369 TInt expErr = KErrNone;
1371 INFO_PRINTF1(_L("CMMFDevVideoPlay: XXX"));
1374 if (iTestType != ETestValid)
1376 ERR_PRINTF1(_L("Error - invalid test step type"));
1377 return EInconclusive;
1382 TInt err = KErrNone;
1383 // TRAP(err, aDevVideoPlay.API_FUNCTION_HERE() )
1387 ERR_PRINTF3(_L("XXX() gave error %d (expected %d)"),iError, expErr);
1391 INFO_PRINTF3(_L("XXX(), %d = %d"), iError, expErr);