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: const TInt KTestScreenCount = 2; sl@0: // DevVideoPlay base class sl@0: sl@0: const TUid KUidMDFVideoDecoderHwDeviceAdapter = { 0x102737ED }; sl@0: sl@0: CTestDevVideoPlayStep::CTestDevVideoPlayStep(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: // store the name of this test case sl@0: // this is the name that is used by the script file sl@0: // Each test step initialises it's own name sl@0: iTestStepName = aTestName; sl@0: iTestType = aTestType; // included in case needed in future sl@0: } sl@0: sl@0: CTestDevVideoPlayStep::~CTestDevVideoPlayStep() sl@0: { sl@0: delete iDevVideoPlay; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayStep::DoTestStepL() sl@0: { sl@0: // construct DevVideoPlay object sl@0: __UHEAP_MARK; sl@0: TRAPD(err, iDevVideoPlay = CMMFDevVideoPlay::NewL(*this)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMMFDevVideoPlay class!")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TVerdict ret = EFail; sl@0: sl@0: // call the test step sl@0: ret = DoTestL(*iDevVideoPlay); sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: Destroying")); sl@0: delete iDevVideoPlay; sl@0: iDevVideoPlay = NULL; sl@0: __MM_HEAP_MARKEND; sl@0: if(iError != KErrNone) sl@0: ERR_PRINTF2( _L("CMMFDevVideoPlay failed with error %d"), iError ); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: // MMMFDevVideoPlayObserver sl@0: void CTestDevVideoPlayStep::MdvpoNewBuffers() sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoNewBuffers()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoReturnPicture(TVideoPicture* /*aPicture*/) sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoReturnPicture()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoSupplementalInformation(const TDesC8& /*aData*/, sl@0: const TTimeIntervalMicroSeconds& /*aTimestamp*/, sl@0: const TPictureId& /*aPictureId*/) sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoSupplementalInformation()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoPictureLoss() sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoPictureLoss()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoPictureLoss(const TArray& /*aPictures*/) sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoPictureLoss(TArray)")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/) sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoSliceLoss()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoReferencePictureSelection(const TDesC8& /*aSelectionData*/) sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoReferencePictureSelection()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoTimedSnapshotComplete(TInt /*aError*/, sl@0: TPictureData* /*aPictureData*/, sl@0: const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, sl@0: const TPictureId& /*aPictureId*/) sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoTimedSnapshotComplete()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoNewPictures() sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoNewPictures()")); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoFatalError(TInt aError) sl@0: { sl@0: iError = aError; sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayStep::MdvpoFatalError(): Error = %d"), aError); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoInitComplete(TInt aError) sl@0: { sl@0: iError = aError; sl@0: INFO_PRINTF2(_L("CTestDevVideoPlayStep::MdvpoInitComplete(): Error = %d"), aError); sl@0: } sl@0: sl@0: void CTestDevVideoPlayStep::MdvpoStreamEnd() sl@0: { sl@0: INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoStreamEnd()")); sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayCommonFormat::CTestDevVideoPlayCommonFormat(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayCommonFormat* CTestDevVideoPlayCommonFormat::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayCommonFormat* self = new(ELeave) CTestDevVideoPlayCommonFormat(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayCommonFormat::DoTestL(CMMFDevVideoPlay& /*aDevVideoPlay*/) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TBool expErr = ETrue; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: Find common format")); 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: // make a fake list of formats sl@0: RArray vFormats1; sl@0: RArray vFormats2; sl@0: sl@0: TUncompressedVideoFormat commonFormat; sl@0: TUncompressedVideoFormat otherFormat; sl@0: sl@0: // push arrays to cleanup stack sl@0: CleanupClosePushL(vFormats1); sl@0: CleanupClosePushL(vFormats2); sl@0: sl@0: // setup vFormats1 sl@0: User::LeaveIfError(vFormats1.Append(KTestVidFormat1)); sl@0: User::LeaveIfError(vFormats1.Append(KTestVidFormat2)); sl@0: sl@0: // setup vFormats2 sl@0: User::LeaveIfError(vFormats2.Append(KTestVidFormat2)); sl@0: User::LeaveIfError(vFormats2.Append(KTestVidFormat3)); sl@0: sl@0: TArray t1 = vFormats1.Array(); sl@0: TArray t2 = vFormats2.Array(); sl@0: TBool formatFound = EFalse; sl@0: sl@0: // attempt to find a common format sl@0: formatFound = CMMFDevVideoPlay::FindCommonFormat(t1, t2, commonFormat); sl@0: sl@0: // now attempt to find a common format that doesn't exist sl@0: vFormats1.Reset(); sl@0: User::LeaveIfError(vFormats1.Append(KTestVidFormat1)); sl@0: User::LeaveIfError(vFormats1.Append(KTestVidFormat1)); sl@0: TBool otherFormatFound = ETrue; sl@0: sl@0: // perform search for non-existent common format sl@0: t1 = vFormats1.Array(); // need to get Array class again sl@0: otherFormatFound = CMMFDevVideoPlay::FindCommonFormat(t1, t2, otherFormat); sl@0: sl@0: // close the arrays sl@0: CleanupStack::PopAndDestroy(2, &vFormats1); sl@0: sl@0: // check format sl@0: if ( (!formatFound) || !(commonFormat == KTestVidFormat2) ) sl@0: { sl@0: ret = EFail; sl@0: ERR_PRINTF1(_L("Error: No common format found...")); sl@0: } sl@0: else if (otherFormatFound ) sl@0: { sl@0: ret = EFail; sl@0: ERR_PRINTF1(_L("Error: Found a common format when there wasn't one!")); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF3(_L("FindCommonFormat(), %d = %d"), formatFound, expErr); sl@0: } sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayFindDecoders::CTestDevVideoPlayFindDecoders(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayFindDecoders* CTestDevVideoPlayFindDecoders::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayFindDecoders* self = new(ELeave) CTestDevVideoPlayFindDecoders(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayFindDecoders::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EFail; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: FindDecoders")); sl@0: sl@0: RArray foundDecoders; sl@0: CleanupClosePushL(foundDecoders); sl@0: RArray expectedDecoders; sl@0: CleanupClosePushL(expectedDecoders); sl@0: RArray unExpectedDecoders; sl@0: CleanupClosePushL(unExpectedDecoders); sl@0: sl@0: TInt error = KErrNone; sl@0: TUint32 requestedPostProcType = 0; sl@0: sl@0: // Unsupported mime type sl@0: if (!error) sl@0: { sl@0: requestedPostProcType = 0; sl@0: _LIT8(KMimeType1, "VIDEO/mpeg21"); sl@0: foundDecoders.Reset(); sl@0: expectedDecoders.Reset(); sl@0: unExpectedDecoders.Reset(); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType1(), requestedPostProcType, foundDecoders, EFalse)); sl@0: sl@0: if (!error) sl@0: error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders); sl@0: } sl@0: sl@0: // Unsupported post proc type sl@0: if (!error) sl@0: { sl@0: requestedPostProcType = EPpOutputCrop|EPpInputCrop; sl@0: foundDecoders.Reset(); sl@0: _LIT8(KMimeType2, "videO/duMMy"); sl@0: expectedDecoders.Reset(); sl@0: unExpectedDecoders.Reset(); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType2(), requestedPostProcType, foundDecoders, EFalse)); sl@0: if (error == KErrNotFound)//we actually expect KErrNotFound here sl@0: error = KErrNone; sl@0: else sl@0: error = KErrGeneral; sl@0: sl@0: if (!error) sl@0: error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders); sl@0: } sl@0: sl@0: // Unsupported mime type (by exact match) sl@0: if (!error) sl@0: { sl@0: _LIT8(KMimeType3, "video/H263-2000; profile=45;level=40"); sl@0: requestedPostProcType = 0; sl@0: foundDecoders.Reset(); sl@0: expectedDecoders.Reset(); sl@0: unExpectedDecoders.Reset(); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType3(), requestedPostProcType, foundDecoders, ETrue)); sl@0: if (error == KErrNotFound)//we actually expect KErrNotFound here sl@0: error = KErrNone; sl@0: else sl@0: error = KErrGeneral; sl@0: sl@0: if (!error) sl@0: error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders); sl@0: } sl@0: sl@0: // Supported mime type (by unexact match) sl@0: if (!error) sl@0: { sl@0: _LIT8(KMimeType4, "video/H263-2000; profile=1234;level=20"); sl@0: requestedPostProcType = 0; sl@0: foundDecoders.Reset(); sl@0: expectedDecoders.Reset(); sl@0: unExpectedDecoders.Reset(); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4)); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType4(), requestedPostProcType, foundDecoders, EFalse)); sl@0: sl@0: if (!error) sl@0: error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders); sl@0: } sl@0: sl@0: // Supported mime type and post proc type (by exact match) sl@0: if (!error) sl@0: { sl@0: _LIT8(KMimeType5, "video/zippyvideo"); sl@0: requestedPostProcType = EPpMirror|EPpInputCrop; sl@0: foundDecoders.Reset(); sl@0: expectedDecoders.Reset(); sl@0: unExpectedDecoders.Reset(); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType5(), requestedPostProcType, foundDecoders, ETrue)); sl@0: sl@0: if (!error) sl@0: error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders); sl@0: } sl@0: sl@0: //Added to check that the mimetype comparison is not case sensitive sl@0: if (!error) sl@0: { sl@0: _LIT8(KMimeType6, "VIDEO/ZIPPYvideo"); sl@0: requestedPostProcType = EPpMirror|EPpInputCrop; sl@0: foundDecoders.Reset(); sl@0: expectedDecoders.Reset(); sl@0: unExpectedDecoders.Reset(); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4)); sl@0: User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5)); sl@0: sl@0: INFO_PRINTF1(_L("To check that the mime type comparison is not case sensitive")); sl@0: TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType6(), requestedPostProcType, foundDecoders, ETrue)); sl@0: INFO_PRINTF2(_L("error = %d"),error); sl@0: if (!error) sl@0: error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders); sl@0: sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(3); //foundDecoders, expectedDecoders, unExpectedDecoders sl@0: sl@0: if (!error) sl@0: ret = EPass; sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TInt CTestDevVideoPlayFindDecoders::CheckDecoders(const RArray& aFoundDecoders, sl@0: const RArray& aExpectedDecoders, sl@0: const RArray& aUnExpectedDecoders) sl@0: { sl@0: TInt ret = KErrGeneral; sl@0: sl@0: TBool foundUnExpected = EFalse; sl@0: TInt numberToBeFoundInExpectedDecoders = aExpectedDecoders.Count(); sl@0: sl@0: for (TInt i=0; i foundPostProx; sl@0: CleanupClosePushL(foundPostProx); sl@0: RArray expectedPostProx; sl@0: CleanupClosePushL(expectedPostProx); sl@0: RArray unExpectedPostProx; sl@0: CleanupClosePushL(unExpectedPostProx); sl@0: sl@0: TInt error = KErrNone; sl@0: TUint32 requestedPostProcType = 0; sl@0: sl@0: // First ask for post processor isn't supported sl@0: if (!error) sl@0: { sl@0: requestedPostProcType = EPpInputCrop|EPpMirror|EPpScale|EPpOutputPad|EPpNoiseFilter; sl@0: foundPostProx.Reset(); sl@0: expectedPostProx.Reset(); sl@0: unExpectedPostProx.Reset(); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx)); sl@0: if (error == KErrNotFound)//we actually expect KErrNotFound here sl@0: error = KErrNone; sl@0: else sl@0: error = KErrGeneral; sl@0: sl@0: if (!error) sl@0: error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx); sl@0: } sl@0: sl@0: // Next ask for all post processors sl@0: if (!error) sl@0: { sl@0: requestedPostProcType = 0; sl@0: foundPostProx.Reset(); sl@0: expectedPostProx.Reset(); sl@0: unExpectedPostProx.Reset(); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx)); sl@0: if (!error) sl@0: error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx); sl@0: } sl@0: sl@0: // Next ask for a specific subset of post processors sl@0: if (!error) sl@0: { sl@0: requestedPostProcType = EPpMirror; sl@0: foundPostProx.Reset(); sl@0: expectedPostProx.Reset(); sl@0: unExpectedPostProx.Reset(); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx)); sl@0: if (!error) sl@0: error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx); sl@0: } sl@0: sl@0: // Next ask for another specific subset of post processors sl@0: if (!error) sl@0: { sl@0: requestedPostProcType = EPpMirror|EPpInputCrop; sl@0: foundPostProx.Reset(); sl@0: expectedPostProx.Reset(); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4)); sl@0: User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5)); sl@0: sl@0: TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx)); sl@0: if (!error) sl@0: error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(3);//foundPostProx, expectedPostProx, unExpectedPostProx sl@0: sl@0: if (!error) sl@0: ret = EPass; sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: TInt CTestDevVideoPlayFindPostProc::CheckPostProx(const RArray& aFoundPostProx, sl@0: const RArray& aExpectedPostProx, sl@0: const RArray& aUnExpectedPostProx) sl@0: { sl@0: TInt ret = KErrGeneral; sl@0: sl@0: TBool foundUnExpected = EFalse; sl@0: TInt numberToBeFoundInExpectedPostProx = aExpectedPostProx.Count(); sl@0: sl@0: for (TInt i=0; i foundDecoders; sl@0: CleanupClosePushL(foundDecoders); sl@0: RArray expectedDecoders; sl@0: CleanupClosePushL(expectedDecoders); sl@0: sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1)); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2)); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3)); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4)); sl@0: User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5)); sl@0: sl@0: TRAPD(err, aDevVideoPlay.GetDecoderListL(foundDecoders)); sl@0: sl@0: if (!err) sl@0: { sl@0: // Make sure that the video hardware device adapter is NOT in the array sl@0: TBool foundAdapter = EFalse; sl@0: for (TInt j = 0; j < foundDecoders.Count(); j++) sl@0: { sl@0: if (foundDecoders[j] == KUidMDFVideoDecoderHwDeviceAdapter) sl@0: { sl@0: foundAdapter = ETrue; sl@0: break; sl@0: } sl@0: } sl@0: sl@0: // Make sure that all the UIDs of the test plugins are in the array.. sl@0: TInt numberToBeFound = expectedDecoders.Count(); sl@0: for (TInt i=0; i foundPostProx; sl@0: CleanupClosePushL(foundPostProx); sl@0: RArray expectedPostProx; sl@0: CleanupClosePushL(expectedPostProx); sl@0: sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4)); sl@0: User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5)); sl@0: sl@0: TRAPD(err, aDevVideoPlay.GetPostProcessorListL(foundPostProx)); sl@0: sl@0: if (!err) sl@0: { sl@0: // Make sure that all the UIDs of the test plugins are in the array.. sl@0: TInt numberToBeFound = expectedPostProx.Count(); sl@0: for (TInt i=0; iUid() != KUidDevVideoTestDecodeHwDevice) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Decoder UID is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Manufacturer check sl@0: if (!(aInfo->Manufacturer() == KTestDecoderInfoManufacturer)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Manufacturer is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Identifier check sl@0: if (!(aInfo->Identifier() == KTestDecoderInfoIdentifier)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Identifier is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Version check sl@0: TVersion decVer = aInfo->Version(); sl@0: if ( (decVer.iMajor != KTestDecoderInfoVersionMaj) || sl@0: (decVer.iMinor != KTestDecoderInfoVersionMin) || sl@0: (decVer.iBuild != KTestDecoderInfoVersionBuild) ) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Version is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Accelerated check sl@0: if (!aInfo->Accelerated()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Accelerated = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // Direct display check sl@0: if (!aInfo->SupportsDirectDisplay()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supports Direct Display = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Max picture size sl@0: TSize maxSize = aInfo->MaxPictureSize(); sl@0: if (maxSize.iWidth != KTestDecoderInfoMaxSizeX || maxSize.iHeight != KTestDecoderInfoMaxSizeY) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Max Picture Size is wrong!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Max Bitrate sl@0: if (aInfo->MaxBitrate() != KMaxTUint) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Max Bitrate is wrong!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Supports picture loss sl@0: if (!aInfo->SupportsPictureLoss()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supports Picture Loss = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Supports slice loss sl@0: if (aInfo->SupportsSliceLoss()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supports Slice Loss = ETrue!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Coding standard info sl@0: if (!(aInfo->CodingStandardSpecificInfo() == KTestDecoderInfoCSInfo)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Coding standard specific info is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Implementation info sl@0: if (!(aInfo->ImplementationSpecificInfo() == KTestDecoderInfoISInfo)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Implementation specific info is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: if (!aInfo->SupportsContentProtected())//Check if flag is set indicating Content Protection is supported. sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed To get flag indicating support of Content Protection!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // get some test compressed video formats sl@0: CCompressedVideoFormat* testFormat = NULL; sl@0: TInt err = KErrNone; sl@0: sl@0: // get formats supported sl@0: const RPointerArray& vidFormats = aInfo->SupportedFormats(); sl@0: sl@0: // get supported max picture rates sl@0: TPictureRateAndSize testRate; sl@0: const RArray& maxRates = aInfo->MaxPictureRates(); sl@0: sl@0: // test formats supported sl@0: for (TUint i = 0; i < KTestDecoderInfoCount; i++) sl@0: { sl@0: TPtrC8 mimeType = KTestDecoderInfoMimeArray[i]; sl@0: TRAP(err, testFormat = GetTestCVFormatL(mimeType)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Failed to construct CCompressedVideoFormat: %d!"), i); sl@0: ret = EFalse; sl@0: if(testFormat != NULL) sl@0: { sl@0: delete testFormat; sl@0: testFormat=NULL; sl@0: } sl@0: break; sl@0: } sl@0: sl@0: if (!(*testFormat == *(vidFormats[i])) || !(aInfo->SupportsFormat(*testFormat))) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Video Format %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: delete testFormat; sl@0: testFormat = NULL; sl@0: sl@0: // Test supported max picture rates sl@0: GetTestEncoderInfoRate(i, testRate); sl@0: if (!(testRate.iPictureSize == maxRates[i].iPictureSize) || sl@0: !(testRate.iPictureRate == maxRates[i].iPictureRate) ) sl@0: { sl@0: ERR_PRINTF2(_L("Error - picture rate %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: } sl@0: //Screen information check sl@0: #ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT sl@0: RArray supportedScreens; sl@0: TRAP(err, aInfo->GetSupportedScreensL(supportedScreens)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("GetSupportedScreensL leaves with %d"), err); sl@0: ret = EFalse; sl@0: } sl@0: if(supportedScreens.Count() != KTestScreenCount) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Unexpected screen count")); sl@0: ret = EFalse; sl@0: } sl@0: err = supportedScreens.Find(KDecoderDefaultScreenNumber); sl@0: if(err == KErrNotFound) sl@0: { sl@0: ERR_PRINTF1(_L("Error - No support for primary screen")); sl@0: ret = EFalse; sl@0: } sl@0: err = supportedScreens.Find(KDecoderSecondaryScreenNumber); sl@0: if(err == KErrNotFound) sl@0: { sl@0: ERR_PRINTF1(_L("Error - No support for secondary screen")); sl@0: ret = EFalse; sl@0: } sl@0: supportedScreens.Close(); sl@0: #endif sl@0: // finally check a format which isn't supposed to be supported sl@0: TRAP(err, testFormat = GetTestCVFormatL(_L8("Frederick Bloggs and his amazing coloured dog"))); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed to construct final CCompressedVideoFormat!")); sl@0: ret = EFalse; sl@0: } sl@0: else sl@0: { sl@0: if (aInfo->SupportsFormat(*testFormat)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed negative SupportsFormat() check!")); sl@0: ret = EFalse; sl@0: } sl@0: } sl@0: sl@0: if(testFormat != NULL) sl@0: { sl@0: delete testFormat; sl@0: testFormat=NULL; sl@0: } sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetDecoderInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetDecoderInfo")); 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: CVideoDecoderInfo *decInfo = NULL; sl@0: TBool valid = EFalse; sl@0: sl@0: // get decoder information from test decoder plugin sl@0: sl@0: TRAP(err, sl@0: decInfo = aDevVideoPlay.VideoDecoderInfoLC(KUidDevVideoTestDecodeHwDevice); sl@0: valid = ValidDecoderInfo(decInfo); sl@0: CleanupStack::PopAndDestroy(decInfo); ); sl@0: if (err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("VideoDecoderInfoLC() gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: // check the Video Decoder sl@0: else if (!valid) sl@0: { sl@0: ERR_PRINTF1(_L("CVideoDecoderInfo class is corrupt!")); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CVideoDecoderInfo passed check successfully")); sl@0: INFO_PRINTF3(_L("VideoDecoderInfoLC(), %d = %d"), err, expErr); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayGetPostProcInfo::CTestDevVideoPlayGetPostProcInfo(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetPostProcInfo* CTestDevVideoPlayGetPostProcInfo::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetPostProcInfo* self = new(ELeave) CTestDevVideoPlayGetPostProcInfo(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TBool CTestDevVideoPlayGetPostProcInfo::ValidPostProcInfo(CPostProcessorInfo* aInfo) sl@0: { sl@0: // do null pointer check sl@0: if (!aInfo) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Post Processor Info is NULL!")); sl@0: return EFalse; sl@0: } sl@0: sl@0: // check the post processor against test data sl@0: // need to check every call so as to keep code coverage sl@0: // and prevent a situation where if the first test fails sl@0: // then subsequent tests will not be called sl@0: TBool ret = ETrue; sl@0: sl@0: // UID check sl@0: if (aInfo->Uid() != KUidDevVideoTestPostProcHwDevice) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Post Processor UID is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Manufacturer check sl@0: if (!(aInfo->Manufacturer() == KTestPostProcInfoManufacturer)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Manufacturer is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Identifier check sl@0: if (!(aInfo->Identifier() == KTestPostProcInfoIdentifier)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Identifier is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Version check sl@0: TVersion posVer = aInfo->Version(); sl@0: if ( (posVer.iMajor != KTestPostProcInfoVersionMaj) || sl@0: (posVer.iMinor != KTestPostProcInfoVersionMin) || sl@0: (posVer.iBuild != KTestPostProcInfoVersionBuild) ) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Version is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Accelerated check sl@0: if (!aInfo->Accelerated()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Accelerated = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // Direct display check sl@0: if (!aInfo->SupportsDirectDisplay()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supports Direct Display = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // YUVToRGB Capabilities sl@0: if (!CompareYuvRgbCaps(aInfo->YuvToRgbCapabilities(), KTestPostProcInfoYuvToRgbCaps)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - YUV To RGB capabilities is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Supported rotations sl@0: if (aInfo->SupportedRotations() != KTestPostProcInfoRotations) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supported Rotations is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Supports arbitrary scaling check sl@0: if (!aInfo->AntiAliasedScaling()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Anti-Aliased Scaling = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // Supports anti-aliased scaling check sl@0: if (!aInfo->SupportsArbitraryScaling()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supports Arbitrary Scaling = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // Implementation info sl@0: if (!(aInfo->ImplementationSpecificInfo() == KTestPostProcInfoISInfo)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Implementation specific info is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // get some test compressed video formats sl@0: TUncompressedVideoFormat testFormat; sl@0: TUint32 testComb = 0; sl@0: TScaleFactor testFactor = {0, 0}; sl@0: sl@0: // get supported formats sl@0: const RArray& vidFormats = aInfo->SupportedFormats(); sl@0: sl@0: // get supported combinations sl@0: const RArray& suppCombs = aInfo->SupportedCombinations(); sl@0: sl@0: // get supported scale factors sl@0: const RArray& scaleFactors = aInfo->SupportedScaleFactors(); sl@0: sl@0: // test formats, combinations, and scale factors supported sl@0: for (TUint i = 0; i < KTestPostProcInfoCount; i++) sl@0: { sl@0: testFormat = KTestPostProcInfoFormatArray[i]; sl@0: if (!(testFormat == (vidFormats[i])) || !(aInfo->SupportsFormat(testFormat))) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Video Format %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: testComb = KTestPostProcInfoCombsArray[i]; sl@0: if (!(testComb == (suppCombs[i])) || !(aInfo->SupportsCombination(testComb))) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Combination %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: testFactor = KTestPostProcInfoScaleFactorsArray[i]; sl@0: if (!CompareScaleFactors(testFactor, scaleFactors[i])) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Scale factor %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: } sl@0: sl@0: //Screen information check sl@0: #ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT sl@0: RArray supportedScreens; sl@0: TRAPD(err, aInfo->GetSupportedScreensL(supportedScreens)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("GetSupportedScreensL leaves with %d"), err); sl@0: ret = EFalse; sl@0: } sl@0: if(supportedScreens.Count() != KTestScreenCount) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Unexpected screen count")); sl@0: ret = EFalse; sl@0: } sl@0: err = supportedScreens.Find(KPostProcDefaultScreenNumber); sl@0: if(err == KErrNotFound) sl@0: { sl@0: ERR_PRINTF1(_L("Error - No support for primary screen")); sl@0: ret = EFalse; sl@0: } sl@0: err = supportedScreens.Find(KPostProcSecondaryScreenNumber); sl@0: if(err == KErrNotFound) sl@0: { sl@0: ERR_PRINTF1(_L("Error - No support for secondary screen")); sl@0: ret = EFalse; sl@0: } sl@0: supportedScreens.Close(); sl@0: #endif sl@0: // check a format that isn't supposed to be supported sl@0: testFormat = KTestPostProcInfoNegativeFormat; sl@0: testFormat.iYuvFormat = KTestYuvFormat1; sl@0: if (aInfo->SupportsFormat(testFormat)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed negative SupportsFormat() check!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // finally check a combination that isn't supposed to be supported sl@0: testComb = KTestPostProcInfoNegativeComb; sl@0: if (aInfo->SupportsCombination(testComb)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed negative SupportsCombination() check!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: if (!aInfo->SupportsContentProtected())//Check if flah is set indicating Content Protection is supported. sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed To get flag indicating support of Content Protection!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetPostProcInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetPostProcInfo")); 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: CPostProcessorInfo *procInfo = NULL; sl@0: TBool valid = EFalse; sl@0: sl@0: // get decoder information from test decoder plugin sl@0: TRAP(err, sl@0: procInfo = aDevVideoPlay.PostProcessorInfoLC(KUidDevVideoTestPostProcHwDevice); sl@0: procInfo->SetSupportsContentProtected(ETrue); sl@0: valid = ValidPostProcInfo(procInfo); sl@0: CleanupStack::PopAndDestroy(procInfo); ); sl@0: sl@0: if (err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("PostProcessorInfoLC() gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: // check the Video Post Processor sl@0: else if (!valid) sl@0: { sl@0: ERR_PRINTF1(_L("CPostProcessorInfo class is corrupt!")); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CPostProcessorInfo passed check successfully")); sl@0: INFO_PRINTF3(_L("PostProcessorInfoLC(), %d = %d"), err, expErr); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlaySelectDecoder::CTestDevVideoPlaySelectDecoder(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlaySelectDecoder* CTestDevVideoPlaySelectDecoder::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlaySelectDecoder* self = new(ELeave) CTestDevVideoPlaySelectDecoder(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlaySelectDecoder::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: SelectDecoder")); 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: iError = KErrNone; sl@0: sl@0: // this will leave if an error occurs sl@0: TRAP( iError, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice) ); sl@0: sl@0: if (iError != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("SelectDecoderL() gave error %d (expected %d)"),iError, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SelectDecoderL(), %d = %d"), iError, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlaySelectPostProc::CTestDevVideoPlaySelectPostProc(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlaySelectPostProc* CTestDevVideoPlaySelectPostProc::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlaySelectPostProc* self = new(ELeave) CTestDevVideoPlaySelectPostProc(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlaySelectPostProc::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: SelectPostProc")); 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: iError = KErrNone; sl@0: sl@0: // this will leave if an error occurs sl@0: TRAP( iError, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice) ); sl@0: sl@0: if (iError != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("SelectPostProcessorL() gave error %d (expected %d)"),iError, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SelectPostProcessorL(), %d = %d"), iError, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayGetHeaderInfo::CTestDevVideoPlayGetHeaderInfo(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetHeaderInfo* CTestDevVideoPlayGetHeaderInfo::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetHeaderInfo* self = new(ELeave) CTestDevVideoPlayGetHeaderInfo(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TBool CTestDevVideoPlayGetHeaderInfo::ValidPictureHeader(const TVideoPictureHeader* aPictureHeader) sl@0: { sl@0: TBool ret = EFalse; sl@0: sl@0: if (!aPictureHeader) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Picture Header is NULL!")); sl@0: return EFalse; sl@0: } sl@0: sl@0: TTimeIntervalMicroSeconds testTime(KTestInputBufferTimestamp); sl@0: sl@0: // check the picture header sl@0: if (aPictureHeader->iOptions != KTestPictureHeaderOptions) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Options are incorrect!")); sl@0: } sl@0: sl@0: else if (!(aPictureHeader->iPresentationTimestamp == testTime)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Timestamp is incorrect!")); sl@0: } sl@0: else if (!(*(aPictureHeader->iOptional) == KTestInputBufferData())) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Optional data is corrupt!")); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Picture Header is valid")); sl@0: ret = ETrue; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetHeaderInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetHeaderInfo")); 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: // THwDeviceId hwDecoder = 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: // construct a test video input buffer with a valid timestamp sl@0: TPtrC8 testInputBufferDataLitCPtr(KTestInputBufferData); sl@0: HBufC8* testInputBufferData = testInputBufferDataLitCPtr.AllocLC(); sl@0: sl@0: TVideoInputBuffer testBuffer; sl@0: testBuffer.iOptions = KTestInputBufferOptions; sl@0: testBuffer.iPresentationTimestamp = KTestInputBufferTimestamp; sl@0: testBuffer.iData.Set(testInputBufferData->Des()); sl@0: sl@0: TVideoPictureHeader* picHeader = NULL; sl@0: // get header information from test data unit sl@0: TRAP(err, picHeader = aDevVideoPlay.GetHeaderInformationL(KTestDataUnitType, KTestDataUnitEncap, &testBuffer) ); sl@0: sl@0: if (err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("GetHeaderInformationL() gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else if (!ValidPictureHeader(picHeader)) sl@0: { sl@0: ERR_PRINTF1(_L("Picture header corrupt!")); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Header information retrieved successfully")); sl@0: INFO_PRINTF3(_L("GetHeaderInformationL(), %d = %d"), err, expErr); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(testInputBufferData); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayReturnHeader::CTestDevVideoPlayReturnHeader(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayReturnHeader* CTestDevVideoPlayReturnHeader::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayReturnHeader* self = new(ELeave) CTestDevVideoPlayReturnHeader(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayReturnHeader::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: ReturnHeader")); 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: // THwDeviceId hwDecoder = 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: TVideoPictureHeader picHeader; sl@0: picHeader.iOptions = KTestPictureHeaderOptions; sl@0: TTimeIntervalMicroSeconds testTime(KTestPictureHeaderTimestamp); sl@0: picHeader.iPresentationTimestamp = testTime; sl@0: sl@0: // return picture header [can use a local TVideoPictureHeader because we sl@0: // are testing a fake plugin - normally this would be a header supplied by sl@0: // the video plugin]. sl@0: aDevVideoPlay.ReturnHeader(&picHeader); sl@0: sl@0: // if plugin didn't PANIC then test has passed sl@0: INFO_PRINTF1(_L("Header information returned successfully")); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayConfigureDecoder::CTestDevVideoPlayConfigureDecoder(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayConfigureDecoder* CTestDevVideoPlayConfigureDecoder::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayConfigureDecoder* self = new(ELeave) CTestDevVideoPlayConfigureDecoder(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayConfigureDecoder::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: sl@0: expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: ConfigureDecoderL")); 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: 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: //construct a test picture header sl@0: TVideoPictureHeader pictureHeader; sl@0: pictureHeader.iOptions = KTestPictureHeaderOptions; sl@0: pictureHeader.iPresentationTimestamp = KTestInputBufferTimestamp; sl@0: sl@0: TPtrC8 testInputBufferDataLitCPtr(KTestInputBufferData); sl@0: pictureHeader.iOptional = &testInputBufferDataLitCPtr; sl@0: sl@0: // get header information from test data unit sl@0: TRAP(err, aDevVideoPlay.ConfigureDecoderL(pictureHeader)); sl@0: sl@0: if (err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("ConfigureDecoderL() gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: if (err == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("Header information successfully configured in Decoder")); sl@0: } sl@0: INFO_PRINTF3(_L("ConfigureDecoderL(), error %d = expected %d"), err, expErr); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlaySetInputFormatUC::CTestDevVideoPlaySetInputFormatUC(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlaySetInputFormatUC* CTestDevVideoPlaySetInputFormatUC::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlaySetInputFormatUC* self = new(ELeave) CTestDevVideoPlaySetInputFormatUC(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlaySetInputFormatUC::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: SetInputFormatUC")); 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: 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: // this will leave if an error occurs in either plugin sl@0: TRAP(err, aDevVideoPlay.SetInputFormatL(hwPostProc, KTestVidFormat2) ); sl@0: sl@0: if ( err != expErr ) sl@0: { sl@0: ERR_PRINTF3(_L("SetInputFormatL() on Post-Processor gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetInputFormat(), %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlaySetInputFormat::CTestDevVideoPlaySetInputFormat(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlaySetInputFormat* CTestDevVideoPlaySetInputFormat::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlaySetInputFormat* self = new(ELeave) CTestDevVideoPlaySetInputFormat(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlaySetInputFormat::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: SetInputFormat")); 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: 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: // get a temporary compressed video class sl@0: CCompressedVideoFormat *tempCFormat = NULL; sl@0: TRAP(err, tempCFormat = GetTestCVFormatL(KTestMimeType1)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error - couldn't initialize compressed video class")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // this will leave if an error occurs sl@0: TRAP(err, aDevVideoPlay.SetInputFormatL(hwDecoder, *tempCFormat, KTestUnitType1, KTestEncapType1, ETrue) ); sl@0: sl@0: // delete compressed video class sl@0: delete tempCFormat; sl@0: tempCFormat = NULL; sl@0: sl@0: if ( err != expErr ) sl@0: { sl@0: ERR_PRINTF3(_L("SetInputFormatL() on Decoder gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetInputFormat(), %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayGetOutputFormatList::CTestDevVideoPlayGetOutputFormatList(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetOutputFormatList* CTestDevVideoPlayGetOutputFormatList::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetOutputFormatList* self = new(ELeave) CTestDevVideoPlayGetOutputFormatList(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetOutputFormatList::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetOutputFormatList")); 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: TInt err2 = 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: 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: 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: RArray decodeList; sl@0: RArray postProcList; sl@0: sl@0: // Get output format list for decoder sl@0: TRAP(err, aDevVideoPlay.GetOutputFormatListL(hwDecoder, decodeList)); sl@0: sl@0: // Get output format list for post-processor sl@0: TRAP(err2, aDevVideoPlay.GetOutputFormatListL(hwPostProc, postProcList)); sl@0: sl@0: if ((err != expErr) || (err2 != expErr)) sl@0: { sl@0: ERR_PRINTF3(_L("GetOutputFormatListL() on Decoder gave error %d (expected %d)"),err, expErr); sl@0: ERR_PRINTF3(_L("GetOutputFormatListL() on Post-Processor gave error %d (expected %d)"),err2, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: TBool decPass = EFalse; sl@0: TBool posPass = EFalse; sl@0: sl@0: // expecting KTestVidFormat1,2,3 - check sl@0: TInt count = decodeList.Count(); sl@0: if (count == 3) sl@0: { sl@0: if ((decodeList[0] == KTestVidFormat1) && sl@0: (decodeList[1] == KTestVidFormat2) && sl@0: (decodeList[2] == KTestVidFormat3) ) sl@0: { sl@0: INFO_PRINTF1(_L("Decoder output list checks ok")); sl@0: decPass = ETrue; sl@0: } sl@0: } sl@0: sl@0: // expecting KTestVidFormat3,2,1 - check sl@0: count = postProcList.Count(); sl@0: if (count == 3) sl@0: { sl@0: if ((postProcList[0] == KTestVidFormat3) && sl@0: (postProcList[1] == KTestVidFormat2) && sl@0: (postProcList[2] == KTestVidFormat1) ) sl@0: { sl@0: INFO_PRINTF1(_L("Post-Processor output list checks ok")); sl@0: posPass = ETrue; sl@0: } sl@0: } sl@0: sl@0: if (!decPass) sl@0: { sl@0: ERR_PRINTF1(_L("Decoder output list corrupt!")); sl@0: ret = EFail; sl@0: } sl@0: sl@0: if (!posPass) sl@0: { sl@0: ERR_PRINTF1(_L("Post-Processor output list corrupt!")); sl@0: ret = EFail; sl@0: } sl@0: sl@0: INFO_PRINTF4(_L("GetOutputFormatListL(), %d, %d = %d"), err, err2, expErr); sl@0: } sl@0: sl@0: // close the arrays sl@0: decodeList.Reset(); sl@0: decodeList.Close(); sl@0: sl@0: postProcList.Reset(); sl@0: postProcList.Close(); sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlaySetOutputFormat::CTestDevVideoPlaySetOutputFormat(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlaySetOutputFormat* CTestDevVideoPlaySetOutputFormat::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlaySetOutputFormat* self = new(ELeave) CTestDevVideoPlaySetOutputFormat(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlaySetOutputFormat::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: SetOutputFormat")); 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: TInt err2 = 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: 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: 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: // set output format on decoder sl@0: TRAP(err, aDevVideoPlay.SetOutputFormatL(hwDecoder, KTestVidFormat1) ) sl@0: sl@0: // set output format on post-processor sl@0: TRAP(err2, aDevVideoPlay.SetOutputFormatL(hwPostProc, KTestVidFormat2) ) sl@0: sl@0: sl@0: if ((err != expErr) || (err2 != expErr)) sl@0: { sl@0: ERR_PRINTF3(_L("SetOutputFormatL() on Decoder gave error %d (expected %d)"),err, expErr); sl@0: ERR_PRINTF3(_L("SetOutputFormatL() on Post-Processor gave error %d (expected %d)"),err2, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF4(_L("SetOutputFormat(), %d, %d= %d"), err, err2, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlaySetPostProcTypes::CTestDevVideoPlaySetPostProcTypes(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlaySetPostProcTypes* CTestDevVideoPlaySetPostProcTypes::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlaySetPostProcTypes* self = new(ELeave) CTestDevVideoPlaySetPostProcTypes(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlaySetPostProcTypes::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: SetPostProcTypes")); 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: TInt err2 = 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: 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: 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: // set post-process types on decoder sl@0: TRAP(err, aDevVideoPlay.SetPostProcessTypesL(hwDecoder, KTestProcessType1) ) sl@0: sl@0: // set post-process types on post-processor sl@0: TRAP(err2, aDevVideoPlay.SetPostProcessTypesL(hwPostProc, KTestProcessType2) ) sl@0: sl@0: sl@0: if ((err != expErr) || (err2 != expErr)) sl@0: { sl@0: ERR_PRINTF3(_L("SetPostProcessTypesL() on Decoder gave error %d (expected %d)"),err, expErr); sl@0: ERR_PRINTF3(_L("SetPostProcessTypesL() on Post-Processor gave error %d (expected %d)"),err2, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF4(_L("SetPostProcessTypes(), %d, %d= %d"), err, err2, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestDevVideoPlayGetDecoderPostProcInfo::CTestDevVideoPlayGetDecoderPostProcInfo(const TDesC& aTestName, TTestType aTestType) sl@0: :CTestDevVideoPlayStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestDevVideoPlayGetDecoderPostProcInfo* CTestDevVideoPlayGetDecoderPostProcInfo::NewL(const TDesC& aTestName, TTestType aTestType) sl@0: { sl@0: CTestDevVideoPlayGetDecoderPostProcInfo* self = new(ELeave) CTestDevVideoPlayGetDecoderPostProcInfo(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TBool CTestDevVideoPlayGetDecoderPostProcInfo::ValidPostProcInfo(CPostProcessorInfo* aInfo) sl@0: { sl@0: // do null pointer check sl@0: if (!aInfo) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Post Processor Info is NULL!")); sl@0: return EFalse; sl@0: } sl@0: sl@0: // check the post processor against test data sl@0: // need to check every call so as to keep code coverage sl@0: // and prevent a situation where if the first test fails sl@0: // then subsequent tests will not be called sl@0: TBool ret = ETrue; sl@0: sl@0: // UID check sl@0: if (aInfo->Uid() != KUidDevVideoTestDecodeHwDevice) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Decoder UID is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Manufacturer check sl@0: if (!(aInfo->Manufacturer() == KTestPostProcInfoManufacturer)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Manufacturer is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Identifier check sl@0: if (!(aInfo->Identifier() == KTestPostProcInfoIdentifier)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Identifier is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Version check sl@0: TVersion posVer = aInfo->Version(); sl@0: if ( (posVer.iMajor != KTestPostProcInfoVersionMaj) || sl@0: (posVer.iMinor != KTestPostProcInfoVersionMin) || sl@0: (posVer.iBuild != KTestPostProcInfoVersionBuild) ) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Version is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: // Accelerated check sl@0: if (!aInfo->Accelerated()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Accelerated = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // Direct display check sl@0: if (!aInfo->SupportsDirectDisplay()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supports Direct Display = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // YUVToRGB Capabilities sl@0: if (!CompareYuvRgbCaps(aInfo->YuvToRgbCapabilities(), KTestPostProcInfoYuvToRgbCaps)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - YUV To RGB capabilities is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: //Content Protection sl@0: if (!aInfo->SupportsContentProtected())//Check if flag is set indicating Content Protection is supported. sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed To get flag indicating support of Content Protection!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Supported rotations sl@0: if (aInfo->SupportedRotations() != KTestPostProcInfoRotations) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supported Rotations is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // Supports arbitrary scaling check sl@0: if (!aInfo->AntiAliasedScaling()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Anti-Aliased Scaling = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // Supports anti-aliased scaling check sl@0: if (!aInfo->SupportsArbitraryScaling()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Supports Arbitrary Scaling = EFalse!")); sl@0: ret = EFalse; sl@0: } sl@0: // Implementation info sl@0: if (!(aInfo->ImplementationSpecificInfo() == KTestDecoderInfoISInfo)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Implementation specific info is incorrect!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // get some test compressed video formats sl@0: TUncompressedVideoFormat testFormat; sl@0: TUint32 testComb = 0; sl@0: TScaleFactor testFactor = {0, 0}; sl@0: sl@0: // get supported formats sl@0: const RArray& vidFormats = aInfo->SupportedFormats(); sl@0: sl@0: // get supported combinations sl@0: const RArray& suppCombs = aInfo->SupportedCombinations(); sl@0: sl@0: // get supported scale factors sl@0: const RArray& scaleFactors = aInfo->SupportedScaleFactors(); sl@0: sl@0: // test formats, combinations, and scale factors supported sl@0: for (TUint i = 0; i < KTestPostProcInfoCount; i++) sl@0: { sl@0: testFormat = KTestPostProcInfoFormatArray[i]; sl@0: if (!(testFormat == (vidFormats[i])) || !(aInfo->SupportsFormat(testFormat))) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Video Format %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: testComb = KTestPostProcInfoCombsArray[i]; sl@0: if (!(testComb == (suppCombs[i])) || !(aInfo->SupportsCombination(testComb))) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Combination %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: testFactor = KTestPostProcInfoScaleFactorsArray[i]; sl@0: if (!CompareScaleFactors(testFactor, scaleFactors[i])) sl@0: { sl@0: ERR_PRINTF2(_L("Error - Scale factor %d is corrupt!"), i); sl@0: ret = EFalse; sl@0: } sl@0: } sl@0: sl@0: // check a format that isn't supposed to be supported sl@0: testFormat = KTestPostProcInfoNegativeFormat; sl@0: testFormat.iYuvFormat = KTestYuvFormat1; sl@0: if (aInfo->SupportsFormat(testFormat)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed negative SupportsFormat() check!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: // finally check a combination that isn't supposed to be supported sl@0: testComb = KTestPostProcInfoNegativeComb; sl@0: if (aInfo->SupportsCombination(testComb)) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed negative SupportsCombination() check!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: if (!aInfo->SupportsContentProtected()) sl@0: { sl@0: ERR_PRINTF1(_L("Error - Failed to Set Content Protected Support!")); sl@0: ret = EFalse; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestDevVideoPlayGetDecoderPostProcInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMMFDevVideoPlay: GetPostProcInfo")); 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: CPostProcessorInfo *procInfo = NULL; sl@0: TBool valid = EFalse; sl@0: sl@0: // get decoder information from test decoder plugin sl@0: TRAP(err, sl@0: procInfo = aDevVideoPlay.PostProcessorInfoLC(KUidDevVideoTestDecodeHwDevice); sl@0: procInfo->SetSupportsContentProtected(ETrue); sl@0: valid = ValidPostProcInfo(procInfo); sl@0: CleanupStack::PopAndDestroy(procInfo); ); sl@0: sl@0: if (err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("PostProcessorInfoLC() gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: // check the Video Decoder sl@0: else if (!valid) sl@0: { sl@0: ERR_PRINTF1(_L("CPostProcessorInfo class is corrupt!")); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CPostProcessorInfo passed check successfully")); sl@0: INFO_PRINTF3(_L("PostProcessorInfoLC(), %d = %d"), err, expErr); sl@0: } sl@0: sl@0: return ret; sl@0: }