sl@0: sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // TestDevVideoPlay.cpp sl@0: // sl@0: // sl@0: sl@0: #include "TestDevVideoPlay.h" sl@0: #include "TestDevVideoPlayTestData.h" sl@0: #include "TestDevVideoPlugins/decoder.h" sl@0: #include "TestDevVideoPlugins/postproc.h" sl@0: #include sl@0: sl@0: void CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: CTestDevVideoPlayGetNewPictureInfo::CTestDevVideoPlayGetNewPictureInfo(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetNewPictureInfo* CTestDevVideoPlayGetNewPictureInfo::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetNewPictureInfo* self = new(ELeave) CTestDevVideoPlayGetNewPictureInfo(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetNewPictureInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EFail; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetNewPictureInfo")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // select post-processor sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //Tell plugin to start creating pictures. sl@0: TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse)); sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: aDevVideoPlay.Start(); sl@0: sl@0: TUint numPictures = 0; sl@0: TTimeIntervalMicroSeconds earliestTimeStamp(0); sl@0: TTimeIntervalMicroSeconds latestTimeStamp(0); sl@0: sl@0: sl@0: aDevVideoPlay.GetNewPictureInfo(numPictures, earliestTimeStamp, latestTimeStamp); sl@0: sl@0: if ((numPictures == 1) sl@0: && (earliestTimeStamp == TTimeIntervalMicroSeconds(0)) sl@0: && (latestTimeStamp == TTimeIntervalMicroSeconds(0))) sl@0: { sl@0: ret = EPass; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayNextPicture::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayNextPicture::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: CTestDevVideoPlayNextPicture::CTestDevVideoPlayNextPicture(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayNextPicture* CTestDevVideoPlayNextPicture::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayNextPicture* self = new(ELeave) CTestDevVideoPlayNextPicture(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayNextPicture::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: NextPicture")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));// EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // select post-processor sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //Tell plugin to start creating pictures. sl@0: TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse)); sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: iDevVideoPlay = &aDevVideoPlay; sl@0: aDevVideoPlay.Start();//Tell plugin to start creating pictures. sl@0: // We should now get a series of NewPicture() callbacks. sl@0: sl@0: if (iError == KErrNone) sl@0: { sl@0: ret = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("Error - picture processing failed with error %d"), iError); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: void CTestDevVideoPlayNextPicture::MdvpoNewPictures() sl@0: { sl@0: TRAP(iError, DoNewPicturesL()); sl@0: } sl@0: sl@0: void CTestDevVideoPlayNextPicture::CheckNewPictureInfoL(TUint aNumPictures, const TTimeIntervalMicroSeconds& aFirst, const TTimeIntervalMicroSeconds& aLast) sl@0: { sl@0: TUint numPictures = 0; sl@0: TTimeIntervalMicroSeconds first(0); sl@0: TTimeIntervalMicroSeconds last(0); sl@0: iDevVideoPlay->GetNewPictureInfo(numPictures, first, last); sl@0: sl@0: if ((numPictures!=aNumPictures) || (first!=aFirst) || (last!=aLast)) sl@0: { sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: } sl@0: sl@0: void CTestDevVideoPlayNextPicture::DoNewPicturesL() sl@0: { sl@0: User::LeaveIfError(iError);//Don't go any further if we have an error sl@0: switch (iCurrentPictureNumber) sl@0: { sl@0: case 0: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); sl@0: TVideoPicture* picture = iDevVideoPlay->NextPictureL(); sl@0: CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: break; sl@0: } sl@0: case 1: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(1), TTimeIntervalMicroSeconds(1)); sl@0: TVideoPicture* picture = iDevVideoPlay->NextPictureL(); sl@0: CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: break; sl@0: } sl@0: case 2: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(2), TTimeIntervalMicroSeconds(2)); sl@0: TVideoPicture* picture = iDevVideoPlay->NextPictureL(); sl@0: CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: break; sl@0: } sl@0: case 3: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(3), TTimeIntervalMicroSeconds(3)); sl@0: TVideoPicture* picture = iDevVideoPlay->NextPictureL(); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: break; sl@0: } sl@0: case 4: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(4), TTimeIntervalMicroSeconds(4)); sl@0: TVideoPicture* picture = iDevVideoPlay->NextPictureL(); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: break; sl@0: } sl@0: case 5: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(5), TTimeIntervalMicroSeconds(5)); sl@0: TVideoPicture* picture = iDevVideoPlay->NextPictureL(); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: break; sl@0: } sl@0: case 6: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(6)); sl@0: break; sl@0: } sl@0: case 7: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(2, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(7)); sl@0: break; sl@0: } sl@0: case 8: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(3, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(8)); sl@0: break; sl@0: } sl@0: case 9: sl@0: { sl@0: iCurrentPictureNumber++; sl@0: CheckNewPictureInfoL(4, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(9)); sl@0: TVideoPicture* picture = iDevVideoPlay->NextPictureL(); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: CheckNewPictureInfoL(3, TTimeIntervalMicroSeconds(7), TTimeIntervalMicroSeconds(9)); sl@0: picture = iDevVideoPlay->NextPictureL(); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: CheckNewPictureInfoL(2, TTimeIntervalMicroSeconds(8), TTimeIntervalMicroSeconds(9)); sl@0: picture = iDevVideoPlay->NextPictureL(); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(9), TTimeIntervalMicroSeconds(9)); sl@0: picture = iDevVideoPlay->NextPictureL(); sl@0: iDevVideoPlay->ReturnPicture(picture); sl@0: CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0)); sl@0: break; sl@0: } sl@0: default: sl@0: User::Leave(KErrGeneral); sl@0: break; sl@0: }; sl@0: } sl@0: sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: CTestDevVideoPlayGetSnapshot::CTestDevVideoPlayGetSnapshot(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetSnapshot* CTestDevVideoPlayGetSnapshot::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetSnapshot* self = new(ELeave) CTestDevVideoPlayGetSnapshot(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EFail; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSnapshot")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // select post-processor sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TBool result = EFalse; sl@0: TPictureData pictureData; sl@0: sl@0: TUncompressedVideoFormat format; sl@0: format.iDataFormat = EYuvRawData; sl@0: format.iYuvFormat = KTestYuvFormat1; sl@0: sl@0: TRAP(err, result = aDevVideoPlay.GetSnapshotL(pictureData, format)); sl@0: sl@0: if (err == KErrNone) sl@0: { sl@0: if (result) sl@0: { sl@0: if ((pictureData.iDataFormat == EYuvRawData) && sl@0: (pictureData.iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) && sl@0: (pictureData.iRawData == NULL)) sl@0: { sl@0: ret = EPass; sl@0: } sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(TInt aError, sl@0: TPictureData* aPictureData, sl@0: const TTimeIntervalMicroSeconds& aPresentationTimestamp, sl@0: const TPictureId& /*aPictureId*/) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: iTimestamp = aPresentationTimestamp; sl@0: iPictureData = aPictureData; sl@0: } sl@0: sl@0: CTestDevVideoPlayGetTimedSnapshotTimestamp::CTestDevVideoPlayGetTimedSnapshotTimestamp(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetTimedSnapshotTimestamp* CTestDevVideoPlayGetTimedSnapshotTimestamp::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetTimedSnapshotTimestamp* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotTimestamp(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetTimedSnapshotTimestamp::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EFail; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotTimestamp")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // select post-processor sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TPictureData pictureData; sl@0: sl@0: TUncompressedVideoFormat format; sl@0: format.iDataFormat = EYuvRawData; sl@0: format.iYuvFormat = KTestYuvFormat1; sl@0: TTimeIntervalMicroSeconds snapTime(KTestSnapshotTimestamp); sl@0: sl@0: // get a timed snapshot from the post processor sl@0: TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapTime)); sl@0: sl@0: // check picture and timestamp from callback sl@0: if ((err == KErrNone) && (iError == KErrNone)) sl@0: { sl@0: if ((iPictureData) && (iTimestamp == TTimeIntervalMicroSeconds(KTestSnapshotTimestamp))) sl@0: { sl@0: if ((iPictureData->iDataFormat == EYuvRawData) && sl@0: (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) && sl@0: (iPictureData->iRawData == NULL)) sl@0: { sl@0: ret = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("Error - PictureData is corrupt!")); sl@0: } sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: void CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(TInt aError, sl@0: TPictureData* aPictureData, sl@0: const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, sl@0: const TPictureId& aPictureId) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: iPictureId = aPictureId; sl@0: iPictureData = aPictureData; sl@0: } sl@0: sl@0: CTestDevVideoPlayGetTimedSnapshotID::CTestDevVideoPlayGetTimedSnapshotID(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetTimedSnapshotID* CTestDevVideoPlayGetTimedSnapshotID::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetTimedSnapshotID* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotID(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetTimedSnapshotID::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotID")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // select post-processor sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TPictureData pictureData; sl@0: sl@0: TUncompressedVideoFormat format; sl@0: format.iDataFormat = EYuvRawData; sl@0: format.iYuvFormat = KTestYuvFormat1; sl@0: TPictureId snapId = KTestSnapshotId; sl@0: sl@0: // get a timed snapshot from the post processor sl@0: TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId)); sl@0: sl@0: // check picture and timestamp from callback sl@0: if ((err == KErrNone) && (iError == KErrNone)) sl@0: { sl@0: if ( (iPictureData) && (iPictureId.iIdType == KTestSnapshotId.iIdType) && sl@0: (iPictureId.iId == KTestSnapshotId.iId) ) sl@0: { sl@0: if ((iPictureData->iDataFormat == EYuvRawData) && sl@0: (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) && sl@0: (iPictureData->iRawData == NULL)) sl@0: { sl@0: ret = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("Error - PictureData is corrupt!")); sl@0: } sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: void CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(TInt aError, sl@0: TPictureData* /*aPictureData*/, sl@0: const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, sl@0: const TPictureId& /*aPictureId*/) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: CTestDevVideoPlayCancelTimedSnapshot::CTestDevVideoPlayCancelTimedSnapshot(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayCancelTimedSnapshot* CTestDevVideoPlayCancelTimedSnapshot::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayCancelTimedSnapshot* self = new(ELeave) CTestDevVideoPlayCancelTimedSnapshot(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayCancelTimedSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EFail; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: CancelTimedSnapshot")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // select post-processor sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: sl@0: TPictureData pictureData; sl@0: sl@0: TUncompressedVideoFormat format; sl@0: format.iDataFormat = EYuvRawData; sl@0: format.iYuvFormat = KTestYuvFormat1; sl@0: TPictureId snapId = KTestSnapshotId; sl@0: sl@0: // get a timed snapshot from the post processor sl@0: TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId)); sl@0: sl@0: // cancel the snapshot sl@0: aDevVideoPlay.CancelTimedSnapshot(); sl@0: sl@0: // check picture has been cancelled sl@0: if (err == KErrNone) sl@0: { sl@0: if (iError == KErrAbort) sl@0: { sl@0: INFO_PRINTF1(_L("Timed snapshot cancelled successfully")); sl@0: ret = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("MdvpoTimedSnapshotComplete() gave error %d (expected %d)"),iError, KErrAbort); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("CancelTimedSnapshotL() gave error %d (expected %d)"),err, expErr); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: CTestDevVideoPlayGetSupportedSnapshotFormats::CTestDevVideoPlayGetSupportedSnapshotFormats(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetSupportedSnapshotFormats* CTestDevVideoPlayGetSupportedSnapshotFormats::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetSupportedSnapshotFormats* self = new(ELeave) CTestDevVideoPlayGetSupportedSnapshotFormats(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetSupportedSnapshotFormats::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EFail; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSupportedSnapshotFormats")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // select post-processor sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: RArray vidFormats; sl@0: sl@0: // get a list of supported formats from the plugin sl@0: TRAP(err, aDevVideoPlay.GetSupportedSnapshotFormatsL(vidFormats) ) sl@0: sl@0: // check picture and timestamp from callback sl@0: if (err == KErrNone) sl@0: { sl@0: if ( vidFormats.Count() == 3) sl@0: { sl@0: if ((vidFormats[0] == KTestVidFormat1) && sl@0: (vidFormats[1] == KTestVidFormat2) && sl@0: (vidFormats[2] == KTestVidFormat3) ) sl@0: { sl@0: INFO_PRINTF1(_L("Snapshot format list checks ok")); sl@0: ret = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("Error - Snapshot format list is corrupt!")); sl@0: } sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("GetSupportedSnapshotFormatsL() gave error %d (expected %d)"),err, expErr); sl@0: } sl@0: sl@0: vidFormats.Reset(); sl@0: vidFormats.Close(); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayClock::CTestDevVideoPlayClock(const TDesC& aTestName) sl@0: { sl@0: iTestStepName = aTestName; sl@0: } sl@0: sl@0: void CTestDevVideoPlayClock::ConstructL() sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayClock::~CTestDevVideoPlayClock() sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayClock* CTestDevVideoPlayClock::NewL(const TDesC& aTestName) sl@0: { sl@0: CTestDevVideoPlayClock* self = new(ELeave) CTestDevVideoPlayClock(aTestName); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: TInt CTestDevVideoPlayClock::StartThread(TAny* aAny) sl@0: { sl@0: CTestDevVideoPlayClock* me = static_cast(aAny); sl@0: me->RunThread(); sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: void CTestDevVideoPlayClock::RunThread() sl@0: { sl@0: TTimeIntervalMicroSeconds currentTime(0); sl@0: sl@0: while(!iShutdownSubthread) sl@0: { sl@0: currentTime = iClockSource->Time(); sl@0: TUint timeUint = I64LOW(currentTime.Int64()); sl@0: } sl@0: } sl@0: sl@0: void CTestDevVideoPlayClock::MmcspuoTick(const TTimeIntervalMicroSeconds& aTime) sl@0: { sl@0: iPeriodicUtilityIteration++; sl@0: sl@0: TUint currentTime = I64LOW(aTime.Int64()); sl@0: TUint predictedTime = iPeriodicUtilityIteration * KTestClock2Seconds; sl@0: sl@0: if (!TimeComparison(currentTime, predictedTime, KTestClockBigDeviationMS)) sl@0: { sl@0: ERR_PRINTF3(_L("Error - Periodic Utility time comparison failed: Got %u; Expected %u"), currentTime, predictedTime); sl@0: iPeriodicUtilityTestVerdict = EFail; sl@0: iPeriodicUtility->Stop(); sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF3(_L("Periodic Utility time comparison passed: Got %u; Expected %u"), currentTime, predictedTime); sl@0: } sl@0: sl@0: if (iPeriodicUtilityIteration >= 5) sl@0: { sl@0: iPeriodicUtility->Stop(); sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayClock::DoTestStepL() sl@0: { sl@0: TVerdict ret = EPass; sl@0: TTimeIntervalMicroSeconds testTime(0); sl@0: TUint timeUint = 0; sl@0: sl@0: iClockSource = CSystemClockSource::NewL(); sl@0: sl@0: // Construct a new thread to constantly probe the clock - to test that it'll work from multiple threads sl@0: RThread thread; sl@0: sl@0: TInt error = thread.Create(_L("ClockSourceTestThread"), sl@0: &CTestDevVideoPlayClock::StartThread, sl@0: KDefaultStackSize, sl@0: &User::Heap(), sl@0: static_cast(this), sl@0: EOwnerThread); sl@0: sl@0: if (error) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Couldn't create periodic utility object")); sl@0: delete iClockSource; sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRequestStatus stat; sl@0: thread.Logon(stat); sl@0: if (stat!=KRequestPending) sl@0: { sl@0: delete iClockSource; sl@0: ERR_PRINTF2(_L("Error - Couldn't logon to the thread err=%d"), stat.Int()); sl@0: thread.LogonCancel(stat); sl@0: User::WaitForRequest(stat); sl@0: return EInconclusive; sl@0: } sl@0: thread.SetPriority(EPriorityLess); sl@0: sl@0: // wait for system to calm down sl@0: User::After(KTestClock2Seconds); sl@0: sl@0: // reset the clock sl@0: iClockSource->Reset(); sl@0: sl@0: thread.Resume(); sl@0: sl@0: // wait for 2 seconds and then check the time == 2 seconds sl@0: User::After(KTestClock2Seconds); sl@0: testTime = iClockSource->Time(); sl@0: timeUint = I64LOW(testTime.Int64()); sl@0: sl@0: if (!TimeComparison(timeUint, KTestClock2Seconds, KTestClockDeviationMS)) sl@0: { sl@0: ERR_PRINTF3(_L("Error - time comparison failed: Got %u; Expected %u"), timeUint, KTestClock2Seconds); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF3(_L("Time comparison passed: Got %u; Expected %u"), timeUint, KTestClock2Seconds); sl@0: } sl@0: sl@0: // reset the clock back to 2 seconds sl@0: //testTime = KTestClock2Seconds; sl@0: //iClockSource->Reset(testTime); sl@0: sl@0: // suspend timer for 2 seconds then resume for 2 seconds sl@0: iClockSource->Suspend(); sl@0: User::After(KTestClock2Seconds); sl@0: iClockSource->Resume(); sl@0: User::After(KTestClock2Seconds); sl@0: testTime = iClockSource->Time(); sl@0: timeUint = I64LOW(testTime.Int64()); sl@0: sl@0: if (!TimeComparison(timeUint, KTestClock4Seconds, KTestClockDeviationMS)) sl@0: { sl@0: ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock4Seconds); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock4Seconds); sl@0: } sl@0: sl@0: // reset clock to 18 seconds sl@0: testTime = KTestClock18Seconds; sl@0: iClockSource->Reset(testTime); sl@0: sl@0: // wait for 2 seconds and then check the time == 20 seconds sl@0: User::After(KTestClock2Seconds); sl@0: testTime = iClockSource->Time(); sl@0: timeUint = I64LOW(testTime.Int64()); sl@0: sl@0: if (!TimeComparison(timeUint, KTestClock20Seconds, KTestClockDeviationMS)) sl@0: { sl@0: ERR_PRINTF3(_L("Error - Reset() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock20Seconds); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF3(_L("Reset() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock20Seconds); sl@0: } sl@0: sl@0: // suspend for 2 seconds then resume for 2 seconds sl@0: iClockSource->Suspend(); sl@0: User::After(KTestClock2Seconds); sl@0: iClockSource->Resume(); sl@0: User::After(KTestClock2Seconds); sl@0: sl@0: testTime = iClockSource->Time(); sl@0: timeUint = I64LOW(testTime.Int64()); sl@0: sl@0: if (!TimeComparison(timeUint, KTestClock22Seconds, KTestClockDeviationMS)) sl@0: { sl@0: ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock22Seconds); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock22Seconds); sl@0: } sl@0: sl@0: // Now test the periodic utility sl@0: TRAPD(perError, iPeriodicUtility = CMMFClockSourcePeriodicUtility::NewL(*iClockSource, *this)); sl@0: if (perError) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Couldn't create periodic utility object")); sl@0: ret = EInconclusive; sl@0: } sl@0: else sl@0: { sl@0: iPeriodicUtilityTestVerdict = EPass; sl@0: TTimeIntervalMicroSeconds32 period = KTestClock2Seconds; sl@0: iClockSource->Reset(); sl@0: iPeriodicUtility->Start(period); sl@0: CActiveScheduler::Start(); sl@0: ret = iPeriodicUtilityTestVerdict; sl@0: } sl@0: delete iPeriodicUtility; sl@0: iPeriodicUtility = NULL; sl@0: sl@0: // Clean up the thread sl@0: iShutdownSubthread = ETrue; sl@0: User::WaitForRequest(stat); sl@0: thread.Close(); sl@0: sl@0: delete iClockSource; sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayCommit::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayCommit::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: CTestDevVideoPlayCommit::CTestDevVideoPlayCommit(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayCommit* CTestDevVideoPlayCommit::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayCommit* self = new(ELeave) CTestDevVideoPlayCommit(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayCommit::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TBool selDec = ETrue; sl@0: TBool selPost = ETrue; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: Commit")); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestDecoderOnly: sl@0: selPost = EFalse; sl@0: break; sl@0: case ETestPostProcOnly: sl@0: selDec = EFalse; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: if (selDec) sl@0: { sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: } sl@0: sl@0: // select post-processor sl@0: if (selPost) sl@0: { sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // call CommitL on DevVideoPlay sl@0: TRAP(iError, aDevVideoPlay.CommitL()); sl@0: sl@0: if (iError != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("Commit left with error %d; Expected %d!"), iError, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF1(_L("CommitL() called successfully")); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: void CTestDevVideoPlayRevert::MdvpoInitComplete(TInt aError) sl@0: { sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayRevert::MdvpoInitComplete(): Error = %d"), aError); sl@0: sl@0: iError = aError; sl@0: } sl@0: sl@0: CTestDevVideoPlayRevert::CTestDevVideoPlayRevert(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayRevert* CTestDevVideoPlayRevert::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayRevert* self = new(ELeave) CTestDevVideoPlayRevert(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayRevert::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: // TInt expErr = KErrNone; sl@0: TBool selDec = ETrue; sl@0: TBool selPost = ETrue; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: Revert")); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: // expErr = KErrNone; sl@0: break; sl@0: case ETestDecoderOnly: sl@0: selPost = EFalse; sl@0: break; sl@0: case ETestPostProcOnly: sl@0: selDec = EFalse; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt err = KErrNone; sl@0: sl@0: // THwDeviceId hwDecoder = 0; sl@0: // THwDeviceId hwPostProc = 0; sl@0: sl@0: // select decoder sl@0: if (selDec) sl@0: { sl@0: // TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: } sl@0: sl@0: // select post-processor sl@0: if (selPost) sl@0: { sl@0: // TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: } sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // call Revert on DevVideoPlay sl@0: aDevVideoPlay.Revert(); sl@0: sl@0: // if no PANIC then test has passed... sl@0: sl@0: INFO_PRINTF1(_L("Revert() called successfully")); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayCustomInterface::CTestDevVideoPlayCustomInterface(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayCustomInterface* CTestDevVideoPlayCustomInterface::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayCustomInterface* self = new(ELeave) CTestDevVideoPlayCustomInterface(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayCustomInterface::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: CustomInterface")); sl@0: sl@0: THwDeviceId hwDecoder = 0; sl@0: THwDeviceId hwPostProc = 0; sl@0: TInt err = KErrNone; sl@0: sl@0: TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize decoder")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize post processor")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // First try test uninitialized sl@0: sl@0: TAny* ciOne = NULL; sl@0: TAny* ciTwo = NULL; sl@0: TAny* ciThree = NULL; sl@0: TAny* ciFour = NULL; sl@0: sl@0: ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne); sl@0: ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo); sl@0: ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo); sl@0: ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne); sl@0: sl@0: if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL) sl@0: { sl@0: ERR_PRINTF1(_L("Test Failed - wrong interfaces returned")); sl@0: return EFail; sl@0: } sl@0: sl@0: // Next, re-perform test initialized. sl@0: sl@0: // initialize CDevVideoPlay and wait for response sl@0: // iError is set by the MdvpoInitComplete callback sl@0: aDevVideoPlay.Initialize(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: ciOne = NULL; sl@0: ciTwo = NULL; sl@0: ciThree = NULL; sl@0: ciFour = NULL; sl@0: sl@0: ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne); sl@0: ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo); sl@0: ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo); sl@0: ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne); sl@0: sl@0: if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL) sl@0: { sl@0: ERR_PRINTF1(_L("Test Failed - wrong interfaces returned")); sl@0: return EFail; sl@0: } sl@0: sl@0: sl@0: return EPass; sl@0: } sl@0: sl@0: sl@0: sl@0: /* sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayXXX::CTestDevVideoPlayXXX(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayXXX* CTestDevVideoPlayXXX::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayXXX* self = new(ELeave) CTestDevVideoPlayXXX(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayXXX::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: XXX")); sl@0: sl@0: // expected results sl@0: if (iTestType != ETestValid) sl@0: { sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // XXXX sl@0: sl@0: TInt err = KErrNone; sl@0: // TRAP(err, aDevVideoPlay.API_FUNCTION_HERE() ) sl@0: sl@0: if (err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("XXX() gave error %d (expected %d)"),iError, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("XXX(), %d = %d"), iError, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: */ sl@0: