os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevVideo/src/TestDevVideoPlayOne.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevVideo/src/TestDevVideoPlayOne.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2133 @@
     1.4 +
     1.5 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of "Eclipse Public License v1.0"
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +// TestDevVideoPlay.cpp
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include "TestDevVideoPlay.h"
    1.23 +#include "TestDevVideoPlayTestData.h"
    1.24 +#include "TestDevVideoPlugins/decoder.h"
    1.25 +#include "TestDevVideoPlugins/postproc.h"
    1.26 +#include <e32math.h>
    1.27 +
    1.28 +const TInt KTestScreenCount = 2;
    1.29 +// DevVideoPlay base class
    1.30 +
    1.31 +const TUid KUidMDFVideoDecoderHwDeviceAdapter = { 0x102737ED };
    1.32 +
    1.33 +CTestDevVideoPlayStep::CTestDevVideoPlayStep(const TDesC& aTestName, TTestType aTestType)
    1.34 +	{
    1.35 +	// store the name of this test case
    1.36 +	// this is the name that is used by the script file
    1.37 +	// Each test step initialises it's own name
    1.38 +	iTestStepName = aTestName;		
    1.39 +	iTestType = aTestType;		// included in case needed in future
    1.40 +	}
    1.41 +	
    1.42 +CTestDevVideoPlayStep::~CTestDevVideoPlayStep() 
    1.43 +	{
    1.44 +	delete iDevVideoPlay;
    1.45 +	}
    1.46 +
    1.47 +TVerdict CTestDevVideoPlayStep::DoTestStepL()
    1.48 +	{
    1.49 +	// construct DevVideoPlay object
    1.50 +	__UHEAP_MARK;
    1.51 +	TRAPD(err, iDevVideoPlay = CMMFDevVideoPlay::NewL(*this));
    1.52 +	if (err != KErrNone)
    1.53 +		{
    1.54 +		ERR_PRINTF1(_L("Could not create a CMMFDevVideoPlay class!"));
    1.55 +		return EInconclusive;
    1.56 +		}
    1.57 +	
    1.58 +	TVerdict ret = EFail;
    1.59 +
    1.60 +	// call the test step
    1.61 +	ret = DoTestL(*iDevVideoPlay);
    1.62 +		
    1.63 +	INFO_PRINTF1(_L("CMMFDevVideoPlay: Destroying"));
    1.64 +	delete iDevVideoPlay;
    1.65 +	iDevVideoPlay = NULL;
    1.66 +	__MM_HEAP_MARKEND;
    1.67 +	if(iError != KErrNone)
    1.68 +		ERR_PRINTF2( _L("CMMFDevVideoPlay failed with error %d"), iError );
    1.69 +	
    1.70 +	return ret;
    1.71 +	}
    1.72 +
    1.73 +
    1.74 +// MMMFDevVideoPlayObserver
    1.75 +void CTestDevVideoPlayStep::MdvpoNewBuffers()
    1.76 +	{
    1.77 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoNewBuffers()"));
    1.78 +	}
    1.79 +
    1.80 +void CTestDevVideoPlayStep::MdvpoReturnPicture(TVideoPicture* /*aPicture*/)
    1.81 +	{
    1.82 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoReturnPicture()"));
    1.83 +	}
    1.84 +
    1.85 +void CTestDevVideoPlayStep::MdvpoSupplementalInformation(const TDesC8& /*aData*/, 
    1.86 +								  const TTimeIntervalMicroSeconds& /*aTimestamp*/, 
    1.87 +								  const TPictureId& /*aPictureId*/)
    1.88 +	{
    1.89 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoSupplementalInformation()"));
    1.90 +	}
    1.91 +
    1.92 +void CTestDevVideoPlayStep::MdvpoPictureLoss()
    1.93 +	{
    1.94 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoPictureLoss()"));
    1.95 +	}
    1.96 +
    1.97 +void CTestDevVideoPlayStep::MdvpoPictureLoss(const TArray<TPictureId>& /*aPictures*/)
    1.98 +	{
    1.99 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoPictureLoss(TArray)"));
   1.100 +	}
   1.101 +
   1.102 +void CTestDevVideoPlayStep::MdvpoSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/)
   1.103 +	{
   1.104 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoSliceLoss()"));
   1.105 +	}
   1.106 +
   1.107 +void CTestDevVideoPlayStep::MdvpoReferencePictureSelection(const TDesC8& /*aSelectionData*/)
   1.108 +	{
   1.109 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoReferencePictureSelection()"));
   1.110 +	}
   1.111 +
   1.112 +void CTestDevVideoPlayStep::MdvpoTimedSnapshotComplete(TInt /*aError*/, 
   1.113 +								TPictureData* /*aPictureData*/, 
   1.114 +								const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, 
   1.115 +								const TPictureId& /*aPictureId*/)
   1.116 +	{
   1.117 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoTimedSnapshotComplete()"));
   1.118 +	}
   1.119 +
   1.120 +void CTestDevVideoPlayStep::MdvpoNewPictures()
   1.121 +	{
   1.122 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoNewPictures()"));
   1.123 +	}
   1.124 +
   1.125 +void CTestDevVideoPlayStep::MdvpoFatalError(TInt aError)
   1.126 +	{
   1.127 +	iError = aError;
   1.128 +	INFO_PRINTF2(_L("CTestDevVideoPlayStep::MdvpoFatalError():  Error = %d"), aError);
   1.129 +	}
   1.130 +
   1.131 +void CTestDevVideoPlayStep::MdvpoInitComplete(TInt aError)
   1.132 +	{
   1.133 +	iError = aError;
   1.134 +	INFO_PRINTF2(_L("CTestDevVideoPlayStep::MdvpoInitComplete():  Error = %d"), aError);
   1.135 +	}
   1.136 +
   1.137 +void CTestDevVideoPlayStep::MdvpoStreamEnd()
   1.138 +	{
   1.139 +	INFO_PRINTF1(_L("CTestDevVideoPlayStep::MdvpoStreamEnd()"));
   1.140 +	}
   1.141 +
   1.142 +//------------------------------------------------------------------
   1.143 +
   1.144 +CTestDevVideoPlayCommonFormat::CTestDevVideoPlayCommonFormat(const TDesC& aTestName, TTestType aTestType)
   1.145 +	:CTestDevVideoPlayStep(aTestName, aTestType)
   1.146 +	{
   1.147 +	}
   1.148 +
   1.149 +CTestDevVideoPlayCommonFormat* CTestDevVideoPlayCommonFormat::NewL(const TDesC& aTestName, TTestType aTestType)
   1.150 +	{
   1.151 +	CTestDevVideoPlayCommonFormat* self = new(ELeave) CTestDevVideoPlayCommonFormat(aTestName, aTestType);
   1.152 +	return self;
   1.153 +	}
   1.154 +
   1.155 +TVerdict CTestDevVideoPlayCommonFormat::DoTestL(CMMFDevVideoPlay& /*aDevVideoPlay*/)
   1.156 +	{
   1.157 +	TVerdict ret = EPass;
   1.158 +	TBool expErr = ETrue;
   1.159 +	
   1.160 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  Find common format"));
   1.161 +	
   1.162 +	// expected results
   1.163 +	if (iTestType != ETestValid)
   1.164 +		{
   1.165 +		ERR_PRINTF1(_L("Error - invalid test step type"));
   1.166 +		return EInconclusive;
   1.167 +		}
   1.168 +	
   1.169 +	// make a fake list of formats
   1.170 +	RArray<TUncompressedVideoFormat> vFormats1;
   1.171 +	RArray<TUncompressedVideoFormat> vFormats2;
   1.172 +
   1.173 +	TUncompressedVideoFormat commonFormat;
   1.174 +	TUncompressedVideoFormat otherFormat;
   1.175 +
   1.176 +	// push arrays to cleanup stack
   1.177 +	CleanupClosePushL(vFormats1);
   1.178 +	CleanupClosePushL(vFormats2);
   1.179 +
   1.180 +	// setup vFormats1 
   1.181 +	User::LeaveIfError(vFormats1.Append(KTestVidFormat1));
   1.182 +	User::LeaveIfError(vFormats1.Append(KTestVidFormat2));
   1.183 +
   1.184 +	// setup vFormats2
   1.185 +	User::LeaveIfError(vFormats2.Append(KTestVidFormat2));
   1.186 +	User::LeaveIfError(vFormats2.Append(KTestVidFormat3));
   1.187 +
   1.188 +	TArray<TUncompressedVideoFormat> t1 = vFormats1.Array();
   1.189 +	TArray<TUncompressedVideoFormat> t2 = vFormats2.Array();
   1.190 +	TBool formatFound = EFalse;
   1.191 +		
   1.192 +	// attempt to find a common format
   1.193 +	formatFound = CMMFDevVideoPlay::FindCommonFormat(t1, t2, commonFormat);
   1.194 +
   1.195 +	// now attempt to find a common format that doesn't exist
   1.196 +	vFormats1.Reset();
   1.197 +	User::LeaveIfError(vFormats1.Append(KTestVidFormat1));
   1.198 +	User::LeaveIfError(vFormats1.Append(KTestVidFormat1));
   1.199 +	TBool otherFormatFound = ETrue;
   1.200 +
   1.201 +	// perform search for non-existent common format
   1.202 +	t1 = vFormats1.Array();	// need to get Array class again
   1.203 +	otherFormatFound = CMMFDevVideoPlay::FindCommonFormat(t1, t2, otherFormat);
   1.204 +
   1.205 +	// close the arrays
   1.206 +	CleanupStack::PopAndDestroy(2, &vFormats1);
   1.207 +
   1.208 +	// check format
   1.209 +	if ( (!formatFound) || !(commonFormat == KTestVidFormat2) )
   1.210 +		{
   1.211 +		ret = EFail;
   1.212 +		ERR_PRINTF1(_L("Error:  No common format found..."));
   1.213 +		}
   1.214 +	else if (otherFormatFound )
   1.215 +		{
   1.216 +		ret = EFail;
   1.217 +		ERR_PRINTF1(_L("Error:  Found a common format when there wasn't one!"));
   1.218 +		}
   1.219 +	else
   1.220 +		{
   1.221 +		INFO_PRINTF3(_L("FindCommonFormat(), %d = %d"), formatFound, expErr);
   1.222 +		}
   1.223 +	return ret;
   1.224 +	}
   1.225 +
   1.226 +
   1.227 +//------------------------------------------------------------------
   1.228 +
   1.229 +
   1.230 +
   1.231 +//------------------------------------------------------------------
   1.232 +
   1.233 +CTestDevVideoPlayFindDecoders::CTestDevVideoPlayFindDecoders(const TDesC& aTestName, TTestType aTestType)
   1.234 +	:CTestDevVideoPlayStep(aTestName, aTestType)
   1.235 +	{
   1.236 +	}
   1.237 +
   1.238 +CTestDevVideoPlayFindDecoders* CTestDevVideoPlayFindDecoders::NewL(const TDesC& aTestName, TTestType aTestType)
   1.239 +	{
   1.240 +	CTestDevVideoPlayFindDecoders* self = new(ELeave) CTestDevVideoPlayFindDecoders(aTestName, aTestType);
   1.241 +	return self;
   1.242 +	}
   1.243 +
   1.244 +TVerdict CTestDevVideoPlayFindDecoders::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
   1.245 +	{
   1.246 +	TVerdict ret = EFail;
   1.247 +
   1.248 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  FindDecoders"));
   1.249 +
   1.250 +	RArray<TUid> foundDecoders;
   1.251 +	CleanupClosePushL(foundDecoders);
   1.252 +	RArray<TUid> expectedDecoders;
   1.253 +	CleanupClosePushL(expectedDecoders);
   1.254 +	RArray<TUid> unExpectedDecoders;
   1.255 +	CleanupClosePushL(unExpectedDecoders);
   1.256 +
   1.257 +	TInt error = KErrNone;
   1.258 +	TUint32 requestedPostProcType = 0;
   1.259 +	
   1.260 +	// Unsupported mime type
   1.261 +	if (!error)
   1.262 +		{
   1.263 +		requestedPostProcType = 0;
   1.264 +		_LIT8(KMimeType1, "VIDEO/mpeg21");
   1.265 +		foundDecoders.Reset();
   1.266 +		expectedDecoders.Reset();
   1.267 +		unExpectedDecoders.Reset();
   1.268 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1));
   1.269 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2));
   1.270 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3));
   1.271 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5));
   1.272 +
   1.273 +		TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType1(), requestedPostProcType, foundDecoders, EFalse));
   1.274 +
   1.275 +		if (!error)
   1.276 +			error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders);
   1.277 +		}
   1.278 +
   1.279 +	// Unsupported post proc type
   1.280 +	if (!error)
   1.281 +		{
   1.282 +		requestedPostProcType = EPpOutputCrop|EPpInputCrop;
   1.283 +		foundDecoders.Reset();
   1.284 +		_LIT8(KMimeType2, "videO/duMMy");
   1.285 +		expectedDecoders.Reset();
   1.286 +		unExpectedDecoders.Reset();
   1.287 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1));
   1.288 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2));
   1.289 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3));
   1.290 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4));
   1.291 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5));
   1.292 +
   1.293 +		TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType2(), requestedPostProcType, foundDecoders, EFalse));
   1.294 +		if (error == KErrNotFound)//we actually expect KErrNotFound here
   1.295 +			error = KErrNone;
   1.296 +		else
   1.297 +			error = KErrGeneral;
   1.298 +
   1.299 +		if (!error)
   1.300 +			error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders);
   1.301 +		}
   1.302 +
   1.303 +	// Unsupported mime type (by exact match)
   1.304 +	if (!error)
   1.305 +		{
   1.306 +		_LIT8(KMimeType3, "video/H263-2000; profile=45;level=40");
   1.307 +		requestedPostProcType = 0;
   1.308 +		foundDecoders.Reset();
   1.309 +		expectedDecoders.Reset();
   1.310 +		unExpectedDecoders.Reset();
   1.311 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1));
   1.312 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2));
   1.313 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3));
   1.314 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4));
   1.315 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5));
   1.316 +
   1.317 +		TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType3(), requestedPostProcType, foundDecoders, ETrue));
   1.318 +		if (error == KErrNotFound)//we actually expect KErrNotFound here
   1.319 +			error = KErrNone;
   1.320 +		else
   1.321 +			error = KErrGeneral;
   1.322 +
   1.323 +		if (!error)
   1.324 +			error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders);
   1.325 +		}
   1.326 +	
   1.327 +	// Supported mime type (by unexact match)
   1.328 +	if (!error)
   1.329 +		{
   1.330 +		_LIT8(KMimeType4, "video/H263-2000; profile=1234;level=20");
   1.331 +		requestedPostProcType = 0;
   1.332 +		foundDecoders.Reset();
   1.333 +		expectedDecoders.Reset();
   1.334 +		unExpectedDecoders.Reset();
   1.335 +		User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1));
   1.336 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2));
   1.337 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3));
   1.338 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4));
   1.339 +		User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5));
   1.340 +
   1.341 +		TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType4(), requestedPostProcType, foundDecoders, EFalse));
   1.342 +
   1.343 +		if (!error)
   1.344 +			error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders);
   1.345 +		}
   1.346 +	
   1.347 +	// Supported mime type and post proc type (by exact match)
   1.348 +	if (!error)
   1.349 +		{
   1.350 +		_LIT8(KMimeType5, "video/zippyvideo");
   1.351 +		requestedPostProcType = EPpMirror|EPpInputCrop;
   1.352 +		foundDecoders.Reset();
   1.353 +		expectedDecoders.Reset();
   1.354 +		unExpectedDecoders.Reset();
   1.355 +		User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1));
   1.356 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2));
   1.357 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3));
   1.358 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4));
   1.359 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5));
   1.360 +
   1.361 +		TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType5(), requestedPostProcType, foundDecoders, ETrue));
   1.362 +
   1.363 +		if (!error)
   1.364 +			error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders);
   1.365 +		}
   1.366 +	
   1.367 +	//Added to check that the mimetype comparison is not case sensitive
   1.368 +	if (!error)
   1.369 +		{
   1.370 +		_LIT8(KMimeType6, "VIDEO/ZIPPYvideo");
   1.371 +		requestedPostProcType = EPpMirror|EPpInputCrop;
   1.372 +		foundDecoders.Reset();
   1.373 +		expectedDecoders.Reset();
   1.374 +		unExpectedDecoders.Reset();
   1.375 +		User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1));
   1.376 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2));
   1.377 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3));
   1.378 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4));
   1.379 +		User::LeaveIfError(unExpectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5));
   1.380 +
   1.381 +		INFO_PRINTF1(_L("To check that the mime type comparison is not case sensitive"));
   1.382 +		TRAP(error, aDevVideoPlay.FindDecodersL(KMimeType6(), requestedPostProcType, foundDecoders, ETrue));
   1.383 +		INFO_PRINTF2(_L("error = %d"),error);
   1.384 +		if (!error)
   1.385 +			error = CheckDecoders(foundDecoders, expectedDecoders, unExpectedDecoders);
   1.386 +	
   1.387 +		}
   1.388 +
   1.389 +	CleanupStack::PopAndDestroy(3); //foundDecoders, expectedDecoders, unExpectedDecoders
   1.390 +
   1.391 +	if (!error)
   1.392 +		ret = EPass;
   1.393 +		
   1.394 +	return ret;
   1.395 +	}
   1.396 +
   1.397 +TInt CTestDevVideoPlayFindDecoders::CheckDecoders(const RArray<TUid>& aFoundDecoders, 
   1.398 +												  const RArray<TUid>& aExpectedDecoders, 
   1.399 +												  const RArray<TUid>& aUnExpectedDecoders)
   1.400 +	{
   1.401 +	TInt ret = KErrGeneral;
   1.402 +
   1.403 +	TBool foundUnExpected = EFalse;
   1.404 +	TInt numberToBeFoundInExpectedDecoders = aExpectedDecoders.Count();
   1.405 +
   1.406 +	for (TInt i=0; i<aFoundDecoders.Count(); i++)
   1.407 +		{
   1.408 +		TUid uidToLookFor = aFoundDecoders[i];
   1.409 +		for (TInt j=0; j<aExpectedDecoders.Count(); j++)
   1.410 +			{
   1.411 +			if (aExpectedDecoders[j] == uidToLookFor)
   1.412 +				{
   1.413 +				numberToBeFoundInExpectedDecoders--;
   1.414 +				break;//j
   1.415 +				}
   1.416 +			}
   1.417 +		for (TInt k=0; k<aUnExpectedDecoders.Count(); k++)
   1.418 +			{
   1.419 +			if (aUnExpectedDecoders[k] == uidToLookFor)
   1.420 +				{
   1.421 +				foundUnExpected = ETrue;
   1.422 +				break;//k
   1.423 +				}
   1.424 +			}
   1.425 +		}
   1.426 +
   1.427 +	if ((!foundUnExpected) && (numberToBeFoundInExpectedDecoders==0))
   1.428 +		ret = KErrNone;
   1.429 +
   1.430 +	return ret;
   1.431 +	}
   1.432 +
   1.433 +
   1.434 +
   1.435 +//------------------------------------------------------------------
   1.436 +
   1.437 +CTestDevVideoPlayFindPostProc::CTestDevVideoPlayFindPostProc(const TDesC& aTestName, TTestType aTestType)
   1.438 +	:CTestDevVideoPlayStep(aTestName, aTestType)
   1.439 +	{
   1.440 +	}
   1.441 +
   1.442 +CTestDevVideoPlayFindPostProc* CTestDevVideoPlayFindPostProc::NewL(const TDesC& aTestName, TTestType aTestType)
   1.443 +	{
   1.444 +	CTestDevVideoPlayFindPostProc* self = new(ELeave) CTestDevVideoPlayFindPostProc(aTestName, aTestType);
   1.445 +	return self;
   1.446 +	}
   1.447 +
   1.448 +TVerdict CTestDevVideoPlayFindPostProc::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
   1.449 +	{
   1.450 +	TVerdict ret = EFail;
   1.451 +
   1.452 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  FindPostProc"));
   1.453 +
   1.454 +	RArray<TUid> foundPostProx;
   1.455 +	CleanupClosePushL(foundPostProx);
   1.456 +	RArray<TUid> expectedPostProx;
   1.457 +	CleanupClosePushL(expectedPostProx);
   1.458 +	RArray<TUid> unExpectedPostProx;
   1.459 +	CleanupClosePushL(unExpectedPostProx);
   1.460 +
   1.461 +	TInt error = KErrNone;
   1.462 +	TUint32 requestedPostProcType = 0;	
   1.463 +
   1.464 +	// First ask for post processor isn't supported
   1.465 +	if (!error)
   1.466 +		{
   1.467 +		requestedPostProcType = EPpInputCrop|EPpMirror|EPpScale|EPpOutputPad|EPpNoiseFilter;
   1.468 +		foundPostProx.Reset();
   1.469 +		expectedPostProx.Reset();
   1.470 +		unExpectedPostProx.Reset();
   1.471 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1));
   1.472 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2));
   1.473 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3));
   1.474 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4));
   1.475 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5));
   1.476 +		
   1.477 +		TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx));
   1.478 +		if (error == KErrNotFound)//we actually expect KErrNotFound here
   1.479 +			error = KErrNone;
   1.480 +		else
   1.481 +			error = KErrGeneral;
   1.482 +
   1.483 +		if (!error)
   1.484 +			error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx);
   1.485 +		}
   1.486 +
   1.487 +	// Next ask for all post processors
   1.488 +	if (!error)
   1.489 +		{
   1.490 +		requestedPostProcType = 0;
   1.491 +		foundPostProx.Reset();
   1.492 +		expectedPostProx.Reset();
   1.493 +		unExpectedPostProx.Reset();
   1.494 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1));
   1.495 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2));
   1.496 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3));
   1.497 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4));
   1.498 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5));
   1.499 +
   1.500 +		TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx));
   1.501 +		if (!error)
   1.502 +			error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx);
   1.503 +		}
   1.504 +
   1.505 +	// Next ask for a specific subset of post processors
   1.506 +	if (!error)
   1.507 +		{
   1.508 +		requestedPostProcType = EPpMirror;
   1.509 +		foundPostProx.Reset();
   1.510 +		expectedPostProx.Reset();
   1.511 +		unExpectedPostProx.Reset();
   1.512 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1));
   1.513 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2));
   1.514 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3));
   1.515 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4));
   1.516 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5));
   1.517 +
   1.518 +		TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx));
   1.519 +		if (!error)
   1.520 +			error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx);
   1.521 +		}
   1.522 +	
   1.523 +	// Next ask for another specific subset of post processors
   1.524 +	if (!error)
   1.525 +		{
   1.526 +		requestedPostProcType = EPpMirror|EPpInputCrop;
   1.527 +		foundPostProx.Reset();
   1.528 +		expectedPostProx.Reset();
   1.529 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1));
   1.530 +		User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2));
   1.531 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3));
   1.532 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4));
   1.533 +		User::LeaveIfError(unExpectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5));
   1.534 +
   1.535 +		TRAP(error, aDevVideoPlay.FindPostProcessorsL(requestedPostProcType, foundPostProx));
   1.536 +		if (!error)
   1.537 +			error = CheckPostProx(foundPostProx, expectedPostProx, unExpectedPostProx);
   1.538 +		}
   1.539 +
   1.540 +	CleanupStack::PopAndDestroy(3);//foundPostProx, expectedPostProx, unExpectedPostProx
   1.541 +	
   1.542 +	if (!error)
   1.543 +		ret = EPass;
   1.544 +		
   1.545 +	return ret;
   1.546 +	}
   1.547 +
   1.548 +
   1.549 +TInt CTestDevVideoPlayFindPostProc::CheckPostProx(const RArray<TUid>& aFoundPostProx, 
   1.550 +												  const RArray<TUid>& aExpectedPostProx, 
   1.551 +												  const RArray<TUid>& aUnExpectedPostProx)
   1.552 +	{
   1.553 +	TInt ret = KErrGeneral;
   1.554 +
   1.555 +	TBool foundUnExpected = EFalse;
   1.556 +	TInt numberToBeFoundInExpectedPostProx = aExpectedPostProx.Count();
   1.557 +
   1.558 +	for (TInt i=0; i<aFoundPostProx.Count(); i++)
   1.559 +		{
   1.560 +		TUid uidToLookFor = aFoundPostProx[i];
   1.561 +		for (TInt j=0; j<aExpectedPostProx.Count(); j++)
   1.562 +			{
   1.563 +			if (aExpectedPostProx[j] == uidToLookFor)
   1.564 +				{
   1.565 +				numberToBeFoundInExpectedPostProx--;
   1.566 +				break;//j
   1.567 +				}
   1.568 +			}
   1.569 +		for (TInt k=0; k<aUnExpectedPostProx.Count(); k++)
   1.570 +			{
   1.571 +			if (aUnExpectedPostProx[k] == uidToLookFor)
   1.572 +				{
   1.573 +				foundUnExpected = ETrue;
   1.574 +				break;//k
   1.575 +				}
   1.576 +			}
   1.577 +		}
   1.578 +
   1.579 +	if ((!foundUnExpected) && (numberToBeFoundInExpectedPostProx==0))
   1.580 +		ret = KErrNone;
   1.581 +
   1.582 +	return ret;
   1.583 +	}
   1.584 +
   1.585 +
   1.586 +
   1.587 +//------------------------------------------------------------------
   1.588 +
   1.589 +CTestDevVideoPlayListDecoders::CTestDevVideoPlayListDecoders(const TDesC& aTestName, TTestType aTestType)
   1.590 +	:CTestDevVideoPlayStep(aTestName, aTestType)
   1.591 +	{
   1.592 +	}
   1.593 +
   1.594 +CTestDevVideoPlayListDecoders* CTestDevVideoPlayListDecoders::NewL(const TDesC& aTestName, TTestType aTestType)
   1.595 +	{
   1.596 +	CTestDevVideoPlayListDecoders* self = new(ELeave) CTestDevVideoPlayListDecoders(aTestName, aTestType);
   1.597 +	return self;
   1.598 +	}
   1.599 +
   1.600 +TVerdict CTestDevVideoPlayListDecoders::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
   1.601 +	{
   1.602 +	TVerdict ret = EFail;
   1.603 +	
   1.604 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  ListDecoders"));
   1.605 +		
   1.606 +	RArray<TUid> foundDecoders;
   1.607 +	CleanupClosePushL(foundDecoders);
   1.608 +	RArray<TUid> expectedDecoders;
   1.609 +	CleanupClosePushL(expectedDecoders);
   1.610 +
   1.611 +	User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice1));
   1.612 +	User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice2));
   1.613 +	User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice3));
   1.614 +	User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice4));
   1.615 +	User::LeaveIfError(expectedDecoders.Append(KUidDevVideoTestDecodeHwDevice5));
   1.616 +
   1.617 +	TRAPD(err, aDevVideoPlay.GetDecoderListL(foundDecoders));
   1.618 +
   1.619 +	if (!err)
   1.620 +		{		
   1.621 +		// Make sure that the video hardware device adapter is NOT in the array
   1.622 +		TBool foundAdapter = EFalse;
   1.623 +		for (TInt j = 0; j < foundDecoders.Count(); j++)
   1.624 +			{
   1.625 +			if (foundDecoders[j] == KUidMDFVideoDecoderHwDeviceAdapter)
   1.626 +				{
   1.627 +				foundAdapter = ETrue;
   1.628 +				break;
   1.629 +				}
   1.630 +			}
   1.631 +
   1.632 +		// Make sure that all the UIDs of the test plugins are in the array..
   1.633 +		TInt numberToBeFound = expectedDecoders.Count();
   1.634 +		for (TInt i=0; i<expectedDecoders.Count(); i++)
   1.635 +			{
   1.636 +			TUid uidToFind = expectedDecoders[i];
   1.637 +			for (TInt j=0; j<foundDecoders.Count(); j++)
   1.638 +				{
   1.639 +				if (foundDecoders[j] == uidToFind)
   1.640 +					{
   1.641 +					numberToBeFound--;
   1.642 +					break;//j
   1.643 +					}
   1.644 +				}
   1.645 +			}
   1.646 +		if ((numberToBeFound == 0) && (!foundAdapter))
   1.647 +			{
   1.648 +			ret = EPass;
   1.649 +			}
   1.650 +		}
   1.651 +
   1.652 +	CleanupStack::PopAndDestroy(2);
   1.653 +	
   1.654 +	return ret;
   1.655 +	}
   1.656 +
   1.657 +
   1.658 +
   1.659 +
   1.660 +//------------------------------------------------------------------
   1.661 +
   1.662 +CTestDevVideoPlayListPostProc::CTestDevVideoPlayListPostProc(const TDesC& aTestName, TTestType aTestType)
   1.663 +	:CTestDevVideoPlayStep(aTestName, aTestType)
   1.664 +	{
   1.665 +	}
   1.666 +
   1.667 +CTestDevVideoPlayListPostProc* CTestDevVideoPlayListPostProc::NewL(const TDesC& aTestName, TTestType aTestType)
   1.668 +	{
   1.669 +	CTestDevVideoPlayListPostProc* self = new(ELeave) CTestDevVideoPlayListPostProc(aTestName, aTestType);
   1.670 +	return self;
   1.671 +	}
   1.672 +
   1.673 +TVerdict CTestDevVideoPlayListPostProc::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
   1.674 +	{
   1.675 +	TVerdict ret = EFail;
   1.676 +	
   1.677 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  ListPostProc"));
   1.678 +		
   1.679 +	RArray<TUid> foundPostProx;
   1.680 +	CleanupClosePushL(foundPostProx);
   1.681 +	RArray<TUid> expectedPostProx;
   1.682 +	CleanupClosePushL(expectedPostProx);
   1.683 +
   1.684 +	User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice1));
   1.685 +	User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice2));
   1.686 +	User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice3));
   1.687 +	User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice4));
   1.688 +	User::LeaveIfError(expectedPostProx.Append(KUidDevVideoTestPostProcHwDevice5));
   1.689 +
   1.690 +	TRAPD(err, aDevVideoPlay.GetPostProcessorListL(foundPostProx));
   1.691 +
   1.692 +	if (!err)
   1.693 +		{
   1.694 +		// Make sure that all the UIDs of the test plugins are in the array..
   1.695 +		TInt numberToBeFound = expectedPostProx.Count();
   1.696 +		for (TInt i=0; i<expectedPostProx.Count(); i++)
   1.697 +			{
   1.698 +			TUid uidToFind = expectedPostProx[i];
   1.699 +			for (TInt j=0; j<foundPostProx.Count(); j++)
   1.700 +				{
   1.701 +				if (foundPostProx[j] == uidToFind)
   1.702 +					{
   1.703 +					numberToBeFound--;
   1.704 +					break;//j
   1.705 +					}
   1.706 +				}
   1.707 +			}
   1.708 +		if (numberToBeFound == 0)
   1.709 +			ret = EPass;
   1.710 +		}
   1.711 +
   1.712 +	CleanupStack::PopAndDestroy(2);
   1.713 +
   1.714 +	return ret;
   1.715 +	}
   1.716 +
   1.717 +
   1.718 +
   1.719 +
   1.720 +//------------------------------------------------------------------
   1.721 +
   1.722 +CTestDevVideoPlayGetDecoderInfo::CTestDevVideoPlayGetDecoderInfo(const TDesC& aTestName, TTestType aTestType)
   1.723 +	:CTestDevVideoPlayStep(aTestName, aTestType)
   1.724 +	{
   1.725 +	}
   1.726 +
   1.727 +CTestDevVideoPlayGetDecoderInfo* CTestDevVideoPlayGetDecoderInfo::NewL(const TDesC& aTestName, TTestType aTestType)
   1.728 +	{
   1.729 +	CTestDevVideoPlayGetDecoderInfo* self = new(ELeave) CTestDevVideoPlayGetDecoderInfo(aTestName, aTestType);
   1.730 +	return self;
   1.731 +	}
   1.732 +
   1.733 +TBool CTestDevVideoPlayGetDecoderInfo::ValidDecoderInfo(CVideoDecoderInfo* aInfo)
   1.734 +	{
   1.735 +	// do null pointer check
   1.736 +	if (!aInfo) 
   1.737 +		{
   1.738 +		ERR_PRINTF1(_L("Error - Decoder Info is NULL!"));
   1.739 +		return EFalse;
   1.740 +		}
   1.741 +	
   1.742 +	// check the decoder against test data
   1.743 +	// need to check every call so as to keep code coverage
   1.744 +	// and prevent a situation where if the first test fails
   1.745 +	// then subsequent tests will not be called
   1.746 +	TBool ret = ETrue;
   1.747 +
   1.748 +	// UID check
   1.749 +	if (aInfo->Uid() != KUidDevVideoTestDecodeHwDevice)
   1.750 +		{
   1.751 +		ERR_PRINTF1(_L("Error - Decoder UID is incorrect!"));
   1.752 +		ret = EFalse;
   1.753 +		}
   1.754 +	// Manufacturer check
   1.755 +	if (!(aInfo->Manufacturer() == KTestDecoderInfoManufacturer))
   1.756 +		{
   1.757 +		ERR_PRINTF1(_L("Error - Manufacturer is incorrect!"));
   1.758 +		ret = EFalse;
   1.759 +		}
   1.760 +	// Identifier check
   1.761 +	if (!(aInfo->Identifier() == KTestDecoderInfoIdentifier))
   1.762 +		{
   1.763 +		ERR_PRINTF1(_L("Error - Identifier is incorrect!"));
   1.764 +		ret = EFalse;
   1.765 +		}
   1.766 +	// Version check
   1.767 +	TVersion decVer = aInfo->Version();
   1.768 +	if ( (decVer.iMajor != KTestDecoderInfoVersionMaj) ||
   1.769 +		 (decVer.iMinor != KTestDecoderInfoVersionMin) ||
   1.770 +		 (decVer.iBuild != KTestDecoderInfoVersionBuild) )
   1.771 +		{
   1.772 +		ERR_PRINTF1(_L("Error - Version is incorrect!"));
   1.773 +		ret = EFalse;
   1.774 +		}
   1.775 +	// Accelerated check
   1.776 +	if (!aInfo->Accelerated())
   1.777 +		{
   1.778 +		ERR_PRINTF1(_L("Error - Accelerated = EFalse!"));
   1.779 +		ret = EFalse;
   1.780 +		}
   1.781 +	// Direct display check
   1.782 +	if (!aInfo->SupportsDirectDisplay())
   1.783 +		{
   1.784 +		ERR_PRINTF1(_L("Error - Supports Direct Display = EFalse!"));
   1.785 +		ret = EFalse;
   1.786 +		}
   1.787 +
   1.788 +	// Max picture size
   1.789 +	TSize maxSize = aInfo->MaxPictureSize();
   1.790 +	if (maxSize.iWidth != KTestDecoderInfoMaxSizeX || maxSize.iHeight != KTestDecoderInfoMaxSizeY)
   1.791 +		{
   1.792 +		ERR_PRINTF1(_L("Error - Max Picture Size is wrong!"));
   1.793 +		ret = EFalse;
   1.794 +		}
   1.795 +
   1.796 +	// Max Bitrate
   1.797 +	if (aInfo->MaxBitrate() != KMaxTUint)
   1.798 +		{
   1.799 +		ERR_PRINTF1(_L("Error - Max Bitrate is wrong!"));
   1.800 +		ret = EFalse;
   1.801 +		}
   1.802 +	
   1.803 +	// Supports picture loss
   1.804 +	if (!aInfo->SupportsPictureLoss())
   1.805 +		{
   1.806 +		ERR_PRINTF1(_L("Error - Supports Picture Loss = EFalse!"));
   1.807 +		ret = EFalse;
   1.808 +		}
   1.809 +
   1.810 +	// Supports slice loss
   1.811 +	if (aInfo->SupportsSliceLoss())
   1.812 +		{
   1.813 +		ERR_PRINTF1(_L("Error - Supports Slice Loss = ETrue!"));
   1.814 +		ret = EFalse;
   1.815 +		}
   1.816 +
   1.817 +	// Coding standard info
   1.818 +	if (!(aInfo->CodingStandardSpecificInfo() == KTestDecoderInfoCSInfo))
   1.819 +		{
   1.820 +		ERR_PRINTF1(_L("Error - Coding standard specific info is incorrect!"));
   1.821 +		ret = EFalse;
   1.822 +		}
   1.823 +	// Implementation info
   1.824 +	if (!(aInfo->ImplementationSpecificInfo() == KTestDecoderInfoISInfo))
   1.825 +		{
   1.826 +		ERR_PRINTF1(_L("Error - Implementation specific info is incorrect!"));
   1.827 +		ret = EFalse;
   1.828 +		}
   1.829 +
   1.830 +	if (!aInfo->SupportsContentProtected())//Check if flag is set indicating Content Protection is supported.
   1.831 +		{
   1.832 +		ERR_PRINTF1(_L("Error - Failed To get flag indicating support of Content Protection!"));
   1.833 +		ret = EFalse;
   1.834 +		}
   1.835 +
   1.836 +	// get some test compressed video formats
   1.837 +	CCompressedVideoFormat* testFormat = NULL;
   1.838 +	TInt err = KErrNone;
   1.839 +
   1.840 +	// get formats supported
   1.841 +	const RPointerArray<CCompressedVideoFormat>& vidFormats = aInfo->SupportedFormats();
   1.842 +
   1.843 +	// get supported max picture rates
   1.844 +	TPictureRateAndSize testRate;
   1.845 +	const RArray<TPictureRateAndSize>& maxRates = aInfo->MaxPictureRates();
   1.846 +
   1.847 +	// test formats supported
   1.848 +	for (TUint i = 0; i < KTestDecoderInfoCount; i++)
   1.849 +		{
   1.850 +		TPtrC8 mimeType = KTestDecoderInfoMimeArray[i];
   1.851 +		TRAP(err, testFormat = GetTestCVFormatL(mimeType));
   1.852 +		if (err != KErrNone)
   1.853 +			{
   1.854 +			ERR_PRINTF2(_L("Error - Failed to construct CCompressedVideoFormat: %d!"), i);
   1.855 +			ret = EFalse;
   1.856 +			if(testFormat != NULL)
   1.857 +				{
   1.858 +				delete testFormat;
   1.859 +				testFormat=NULL;
   1.860 +				}
   1.861 +			break;
   1.862 +			}
   1.863 +
   1.864 +		if (!(*testFormat == *(vidFormats[i])) || !(aInfo->SupportsFormat(*testFormat)))
   1.865 +			{
   1.866 +			ERR_PRINTF2(_L("Error - Video Format %d is corrupt!"), i);
   1.867 +			ret = EFalse;
   1.868 +			}
   1.869 +
   1.870 +		delete testFormat; 
   1.871 +		testFormat = NULL;
   1.872 +
   1.873 +		// Test supported max picture rates
   1.874 +		GetTestEncoderInfoRate(i, testRate);
   1.875 +		if (!(testRate.iPictureSize == maxRates[i].iPictureSize) || 
   1.876 +			!(testRate.iPictureRate == maxRates[i].iPictureRate) )
   1.877 +			{
   1.878 +			ERR_PRINTF2(_L("Error - picture rate %d is corrupt!"), i);
   1.879 +			ret = EFalse;
   1.880 +			}
   1.881 +		}
   1.882 +	//Screen information check
   1.883 +#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
   1.884 +	RArray<TInt> supportedScreens;
   1.885 +	TRAP(err, aInfo->GetSupportedScreensL(supportedScreens));
   1.886 +	if(err != KErrNone)
   1.887 +		{
   1.888 +		ERR_PRINTF2(_L("GetSupportedScreensL leaves with %d"), err);
   1.889 +		ret = EFalse;
   1.890 +		}
   1.891 +	if(supportedScreens.Count() != KTestScreenCount)
   1.892 +		{
   1.893 +		ERR_PRINTF1(_L("Error - Unexpected screen count"));
   1.894 +		ret = EFalse;
   1.895 +		}
   1.896 +	err = supportedScreens.Find(KDecoderDefaultScreenNumber);
   1.897 +	if(err == KErrNotFound)
   1.898 +		{
   1.899 +		ERR_PRINTF1(_L("Error - No support for primary screen"));
   1.900 +		ret = EFalse;
   1.901 +		}
   1.902 +	err = supportedScreens.Find(KDecoderSecondaryScreenNumber);
   1.903 +	if(err == KErrNotFound)
   1.904 +		{
   1.905 +		ERR_PRINTF1(_L("Error - No support for secondary screen"));
   1.906 +		ret = EFalse;
   1.907 +		}
   1.908 +	supportedScreens.Close();
   1.909 +#endif
   1.910 +	// finally check a format which isn't supposed to be supported
   1.911 +	TRAP(err, testFormat = GetTestCVFormatL(_L8("Frederick Bloggs and his amazing coloured dog")));
   1.912 +	if (err != KErrNone)
   1.913 +		{
   1.914 +		ERR_PRINTF1(_L("Error - Failed to construct final CCompressedVideoFormat!"));
   1.915 +		ret = EFalse;
   1.916 +		}
   1.917 +	else 
   1.918 +		{
   1.919 +		if (aInfo->SupportsFormat(*testFormat))
   1.920 +			{
   1.921 +			ERR_PRINTF1(_L("Error - Failed negative SupportsFormat() check!"));
   1.922 +			ret = EFalse;
   1.923 +			}
   1.924 +		}
   1.925 +
   1.926 +	if(testFormat != NULL)
   1.927 +		{
   1.928 +		delete testFormat;
   1.929 +		testFormat=NULL;
   1.930 +		}
   1.931 +	return ret;
   1.932 +	}
   1.933 +
   1.934 +TVerdict CTestDevVideoPlayGetDecoderInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
   1.935 +	{
   1.936 +	TVerdict ret = EPass;
   1.937 +	TInt expErr = KErrNone;
   1.938 +	
   1.939 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  GetDecoderInfo"));
   1.940 +
   1.941 +	// expected results		
   1.942 +	if (iTestType != ETestValid)
   1.943 +		{
   1.944 +		ERR_PRINTF1(_L("Error - invalid test step type"));
   1.945 +		return EInconclusive;
   1.946 +		}
   1.947 +	
   1.948 +	TInt err = KErrNone;
   1.949 +	CVideoDecoderInfo *decInfo = NULL;
   1.950 +	TBool valid = EFalse;
   1.951 +	
   1.952 +	// get decoder information from test decoder plugin
   1.953 +	
   1.954 +	TRAP(err, 
   1.955 +		decInfo = aDevVideoPlay.VideoDecoderInfoLC(KUidDevVideoTestDecodeHwDevice); 
   1.956 +		valid = ValidDecoderInfo(decInfo);
   1.957 +		CleanupStack::PopAndDestroy(decInfo); );
   1.958 +	if (err != expErr)
   1.959 +		{
   1.960 +		ERR_PRINTF3(_L("VideoDecoderInfoLC() gave error %d (expected %d)"),err, expErr);
   1.961 +		ret = EFail;
   1.962 +		}
   1.963 +	// check the Video Decoder
   1.964 +	else if (!valid)
   1.965 +		{
   1.966 +		ERR_PRINTF1(_L("CVideoDecoderInfo class is corrupt!"));
   1.967 +		ret = EFail;
   1.968 +		}
   1.969 +	else
   1.970 +		{
   1.971 +		INFO_PRINTF1(_L("CVideoDecoderInfo passed check successfully"));
   1.972 +		INFO_PRINTF3(_L("VideoDecoderInfoLC(), %d = %d"), err, expErr);
   1.973 +		}
   1.974 +		
   1.975 +	return ret;
   1.976 +	}
   1.977 +
   1.978 +
   1.979 +
   1.980 +
   1.981 +//------------------------------------------------------------------
   1.982 +
   1.983 +CTestDevVideoPlayGetPostProcInfo::CTestDevVideoPlayGetPostProcInfo(const TDesC& aTestName, TTestType aTestType)
   1.984 +	:CTestDevVideoPlayStep(aTestName, aTestType)
   1.985 +	{
   1.986 +	}
   1.987 +
   1.988 +CTestDevVideoPlayGetPostProcInfo* CTestDevVideoPlayGetPostProcInfo::NewL(const TDesC& aTestName, TTestType aTestType)
   1.989 +	{
   1.990 +	CTestDevVideoPlayGetPostProcInfo* self = new(ELeave) CTestDevVideoPlayGetPostProcInfo(aTestName, aTestType);
   1.991 +	return self;
   1.992 +	}
   1.993 +
   1.994 +TBool CTestDevVideoPlayGetPostProcInfo::ValidPostProcInfo(CPostProcessorInfo* aInfo)
   1.995 +	{
   1.996 +	// do null pointer check
   1.997 +	if (!aInfo) 
   1.998 +		{
   1.999 +		ERR_PRINTF1(_L("Error - Post Processor Info is NULL!"));
  1.1000 +		return EFalse;
  1.1001 +		}
  1.1002 +	
  1.1003 +	// check the post processor against test data
  1.1004 +	// need to check every call so as to keep code coverage
  1.1005 +	// and prevent a situation where if the first test fails
  1.1006 +	// then subsequent tests will not be called
  1.1007 +	TBool ret = ETrue;
  1.1008 +
  1.1009 +	// UID check
  1.1010 +	if (aInfo->Uid() != KUidDevVideoTestPostProcHwDevice)
  1.1011 +		{
  1.1012 +		ERR_PRINTF1(_L("Error - Post Processor UID is incorrect!"));
  1.1013 +		ret = EFalse;
  1.1014 +		}
  1.1015 +	// Manufacturer check
  1.1016 +	if (!(aInfo->Manufacturer() == KTestPostProcInfoManufacturer))
  1.1017 +		{
  1.1018 +		ERR_PRINTF1(_L("Error - Manufacturer is incorrect!"));
  1.1019 +		ret = EFalse;
  1.1020 +		}
  1.1021 +	// Identifier check
  1.1022 +	if (!(aInfo->Identifier() == KTestPostProcInfoIdentifier))
  1.1023 +		{
  1.1024 +		ERR_PRINTF1(_L("Error - Identifier is incorrect!"));
  1.1025 +		ret = EFalse;
  1.1026 +		}
  1.1027 +	// Version check
  1.1028 +	TVersion posVer = aInfo->Version();
  1.1029 +	if ( (posVer.iMajor != KTestPostProcInfoVersionMaj) ||
  1.1030 +		 (posVer.iMinor != KTestPostProcInfoVersionMin) ||
  1.1031 +		 (posVer.iBuild != KTestPostProcInfoVersionBuild) )
  1.1032 +		{
  1.1033 +		ERR_PRINTF1(_L("Error - Version is incorrect!"));
  1.1034 +		ret = EFalse;
  1.1035 +		}
  1.1036 +	// Accelerated check
  1.1037 +	if (!aInfo->Accelerated())
  1.1038 +		{
  1.1039 +		ERR_PRINTF1(_L("Error - Accelerated = EFalse!"));
  1.1040 +		ret = EFalse;
  1.1041 +		}
  1.1042 +	// Direct display check
  1.1043 +	if (!aInfo->SupportsDirectDisplay())
  1.1044 +		{
  1.1045 +		ERR_PRINTF1(_L("Error - Supports Direct Display = EFalse!"));
  1.1046 +		ret = EFalse;
  1.1047 +		}
  1.1048 +	// YUVToRGB Capabilities
  1.1049 +	if (!CompareYuvRgbCaps(aInfo->YuvToRgbCapabilities(), KTestPostProcInfoYuvToRgbCaps))
  1.1050 +		{
  1.1051 +		ERR_PRINTF1(_L("Error - YUV To RGB capabilities is incorrect!"));
  1.1052 +		ret = EFalse;
  1.1053 +		}
  1.1054 +
  1.1055 +	// Supported rotations
  1.1056 +	if (aInfo->SupportedRotations() != KTestPostProcInfoRotations)
  1.1057 +		{
  1.1058 +		ERR_PRINTF1(_L("Error - Supported Rotations is incorrect!"));
  1.1059 +		ret = EFalse;
  1.1060 +		}
  1.1061 +
  1.1062 +	// Supports arbitrary scaling check
  1.1063 +	if (!aInfo->AntiAliasedScaling())
  1.1064 +		{
  1.1065 +		ERR_PRINTF1(_L("Error - Anti-Aliased Scaling = EFalse!"));
  1.1066 +		ret = EFalse;
  1.1067 +		}
  1.1068 +	// Supports anti-aliased scaling check
  1.1069 +	if (!aInfo->SupportsArbitraryScaling())
  1.1070 +		{
  1.1071 +		ERR_PRINTF1(_L("Error - Supports Arbitrary Scaling = EFalse!"));
  1.1072 +		ret = EFalse;
  1.1073 +		}
  1.1074 +	// Implementation info
  1.1075 +	if (!(aInfo->ImplementationSpecificInfo() == KTestPostProcInfoISInfo))
  1.1076 +		{
  1.1077 +		ERR_PRINTF1(_L("Error - Implementation specific info is incorrect!"));
  1.1078 +		ret = EFalse;
  1.1079 +		}
  1.1080 +
  1.1081 +	// get some test compressed video formats
  1.1082 +	TUncompressedVideoFormat testFormat;
  1.1083 +	TUint32 testComb = 0;
  1.1084 +	TScaleFactor testFactor = {0, 0};
  1.1085 +
  1.1086 +	// get supported formats
  1.1087 +	const RArray<TUncompressedVideoFormat>& vidFormats = aInfo->SupportedFormats();
  1.1088 +	
  1.1089 +	// get supported combinations
  1.1090 +	const RArray<TUint32>& suppCombs = aInfo->SupportedCombinations();
  1.1091 +
  1.1092 +	// get supported scale factors
  1.1093 +	const RArray<TScaleFactor>& scaleFactors = aInfo->SupportedScaleFactors();
  1.1094 +
  1.1095 +	// test formats, combinations, and scale factors supported
  1.1096 +	for (TUint i = 0; i < KTestPostProcInfoCount; i++)
  1.1097 +		{
  1.1098 +		testFormat = KTestPostProcInfoFormatArray[i];
  1.1099 +		if (!(testFormat == (vidFormats[i])) || !(aInfo->SupportsFormat(testFormat)))
  1.1100 +			{
  1.1101 +			ERR_PRINTF2(_L("Error - Video Format %d is corrupt!"), i);
  1.1102 +			ret = EFalse;
  1.1103 +			}
  1.1104 +
  1.1105 +		testComb = KTestPostProcInfoCombsArray[i];
  1.1106 +		if (!(testComb == (suppCombs[i])) || !(aInfo->SupportsCombination(testComb)))
  1.1107 +			{
  1.1108 +			ERR_PRINTF2(_L("Error - Combination %d is corrupt!"), i);
  1.1109 +			ret = EFalse;
  1.1110 +			}
  1.1111 +
  1.1112 +		testFactor = KTestPostProcInfoScaleFactorsArray[i];
  1.1113 +		if (!CompareScaleFactors(testFactor, scaleFactors[i]))
  1.1114 +			{
  1.1115 +			ERR_PRINTF2(_L("Error - Scale factor %d is corrupt!"), i);
  1.1116 +			ret = EFalse;
  1.1117 +			}
  1.1118 +		}
  1.1119 +
  1.1120 +	//Screen information check
  1.1121 +#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
  1.1122 +	RArray<TInt> supportedScreens;
  1.1123 +	TRAPD(err, aInfo->GetSupportedScreensL(supportedScreens));
  1.1124 +	if(err != KErrNone)
  1.1125 +		{
  1.1126 +		ERR_PRINTF2(_L("GetSupportedScreensL leaves with %d"), err);
  1.1127 +		ret = EFalse;
  1.1128 +		}
  1.1129 +	if(supportedScreens.Count() != KTestScreenCount)
  1.1130 +		{
  1.1131 +		ERR_PRINTF1(_L("Error - Unexpected screen count"));
  1.1132 +		ret = EFalse;
  1.1133 +		}
  1.1134 +	err = supportedScreens.Find(KPostProcDefaultScreenNumber);
  1.1135 +	if(err == KErrNotFound)
  1.1136 +		{
  1.1137 +		ERR_PRINTF1(_L("Error - No support for primary screen"));
  1.1138 +		ret = EFalse;
  1.1139 +		}
  1.1140 +	err = supportedScreens.Find(KPostProcSecondaryScreenNumber);
  1.1141 +	if(err == KErrNotFound)
  1.1142 +		{
  1.1143 +		ERR_PRINTF1(_L("Error - No support for secondary screen"));
  1.1144 +		ret = EFalse;
  1.1145 +		}
  1.1146 +	supportedScreens.Close();
  1.1147 +#endif
  1.1148 +	// check a format that isn't supposed to be supported
  1.1149 +	testFormat = KTestPostProcInfoNegativeFormat;
  1.1150 +	testFormat.iYuvFormat = KTestYuvFormat1;
  1.1151 +	if (aInfo->SupportsFormat(testFormat))
  1.1152 +		{
  1.1153 +		ERR_PRINTF1(_L("Error - Failed negative SupportsFormat() check!"));
  1.1154 +		ret = EFalse;
  1.1155 +		}
  1.1156 +	
  1.1157 +	// finally check a combination that isn't supposed to be supported
  1.1158 +	testComb = KTestPostProcInfoNegativeComb;
  1.1159 +	if (aInfo->SupportsCombination(testComb))
  1.1160 +		{
  1.1161 +		ERR_PRINTF1(_L("Error - Failed negative SupportsCombination() check!"));
  1.1162 +		ret = EFalse;
  1.1163 +		}
  1.1164 +
  1.1165 +	if (!aInfo->SupportsContentProtected())//Check if flah is set indicating Content Protection is supported.
  1.1166 +		{
  1.1167 +		ERR_PRINTF1(_L("Error - Failed To get flag indicating support of Content Protection!"));
  1.1168 +		ret = EFalse;
  1.1169 +		}
  1.1170 +
  1.1171 +	return ret;
  1.1172 +	}
  1.1173 +
  1.1174 +TVerdict CTestDevVideoPlayGetPostProcInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1175 +	{
  1.1176 +	TVerdict ret = EPass;
  1.1177 +	TInt expErr = KErrNone;
  1.1178 +	
  1.1179 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  GetPostProcInfo"));
  1.1180 +	
  1.1181 +	// expected results
  1.1182 +	if (iTestType != ETestValid)
  1.1183 +		{
  1.1184 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1185 +		return EInconclusive;
  1.1186 +		}
  1.1187 +	
  1.1188 +	TInt err = KErrNone;
  1.1189 +	CPostProcessorInfo *procInfo = NULL;
  1.1190 +	TBool valid = EFalse;
  1.1191 +	
  1.1192 +	// get decoder information from test decoder plugin
  1.1193 +	TRAP(err, 
  1.1194 +		procInfo = aDevVideoPlay.PostProcessorInfoLC(KUidDevVideoTestPostProcHwDevice);
  1.1195 +	        procInfo->SetSupportsContentProtected(ETrue);	
  1.1196 +		valid = ValidPostProcInfo(procInfo);
  1.1197 +		CleanupStack::PopAndDestroy(procInfo); );
  1.1198 +
  1.1199 +	if (err != expErr)
  1.1200 +		{
  1.1201 +		ERR_PRINTF3(_L("PostProcessorInfoLC() gave error %d (expected %d)"),err, expErr);
  1.1202 +		ret = EFail;
  1.1203 +		}
  1.1204 +	// check the Video Post Processor
  1.1205 +	else if (!valid)
  1.1206 +		{
  1.1207 +		ERR_PRINTF1(_L("CPostProcessorInfo class is corrupt!"));
  1.1208 +		ret = EFail;
  1.1209 +		}
  1.1210 +	else
  1.1211 +		{
  1.1212 +		INFO_PRINTF1(_L("CPostProcessorInfo passed check successfully"));
  1.1213 +		INFO_PRINTF3(_L("PostProcessorInfoLC(), %d = %d"), err, expErr);
  1.1214 +		}
  1.1215 +
  1.1216 +	return ret;
  1.1217 +	}
  1.1218 +
  1.1219 +//------------------------------------------------------------------
  1.1220 +
  1.1221 +CTestDevVideoPlaySelectDecoder::CTestDevVideoPlaySelectDecoder(const TDesC& aTestName, TTestType aTestType)
  1.1222 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1223 +	{
  1.1224 +	}
  1.1225 +
  1.1226 +CTestDevVideoPlaySelectDecoder* CTestDevVideoPlaySelectDecoder::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1227 +	{
  1.1228 +	CTestDevVideoPlaySelectDecoder* self = new(ELeave) CTestDevVideoPlaySelectDecoder(aTestName, aTestType);
  1.1229 +	return self;
  1.1230 +	}
  1.1231 +
  1.1232 +TVerdict CTestDevVideoPlaySelectDecoder::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1233 +	{
  1.1234 +	TVerdict ret = EPass;
  1.1235 +	TInt expErr = KErrNone;
  1.1236 +	
  1.1237 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  SelectDecoder"));
  1.1238 +	
  1.1239 +	// expected results
  1.1240 +	if (iTestType != ETestValid)
  1.1241 +		{
  1.1242 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1243 +		return EInconclusive;
  1.1244 +		}
  1.1245 +	
  1.1246 +	iError = KErrNone;
  1.1247 +
  1.1248 +	// this will leave if an error occurs
  1.1249 +	TRAP( iError, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice) );
  1.1250 +
  1.1251 +	if (iError != expErr)
  1.1252 +		{
  1.1253 +		ERR_PRINTF3(_L("SelectDecoderL() gave error %d (expected %d)"),iError, expErr);
  1.1254 +		ret = EFail;
  1.1255 +		}
  1.1256 +	else
  1.1257 +		INFO_PRINTF3(_L("SelectDecoderL(), %d = %d"), iError, expErr);
  1.1258 +	
  1.1259 +	return ret;
  1.1260 +	}
  1.1261 +
  1.1262 +//------------------------------------------------------------------
  1.1263 +
  1.1264 +CTestDevVideoPlaySelectPostProc::CTestDevVideoPlaySelectPostProc(const TDesC& aTestName, TTestType aTestType)
  1.1265 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1266 +	{
  1.1267 +	}
  1.1268 +
  1.1269 +CTestDevVideoPlaySelectPostProc* CTestDevVideoPlaySelectPostProc::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1270 +	{
  1.1271 +	CTestDevVideoPlaySelectPostProc* self = new(ELeave) CTestDevVideoPlaySelectPostProc(aTestName, aTestType);
  1.1272 +	return self;
  1.1273 +	}
  1.1274 +
  1.1275 +TVerdict CTestDevVideoPlaySelectPostProc::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1276 +	{
  1.1277 +	TVerdict ret = EPass;
  1.1278 +	TInt expErr = KErrNone;
  1.1279 +	
  1.1280 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  SelectPostProc"));
  1.1281 +	
  1.1282 +	// expected results
  1.1283 +	if (iTestType != ETestValid)
  1.1284 +		{
  1.1285 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1286 +		return EInconclusive;
  1.1287 +		}
  1.1288 +	
  1.1289 +	iError = KErrNone;
  1.1290 +	
  1.1291 +	// this will leave if an error occurs
  1.1292 +	TRAP( iError, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice) );
  1.1293 +
  1.1294 +	if (iError != expErr)
  1.1295 +		{
  1.1296 +		ERR_PRINTF3(_L("SelectPostProcessorL() gave error %d (expected %d)"),iError, expErr);
  1.1297 +		ret = EFail;
  1.1298 +		}
  1.1299 +	else
  1.1300 +		INFO_PRINTF3(_L("SelectPostProcessorL(), %d = %d"), iError, expErr);
  1.1301 +	
  1.1302 +	return ret;
  1.1303 +	}
  1.1304 +
  1.1305 +//------------------------------------------------------------------
  1.1306 +
  1.1307 +CTestDevVideoPlayGetHeaderInfo::CTestDevVideoPlayGetHeaderInfo(const TDesC& aTestName, TTestType aTestType)
  1.1308 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1309 +	{
  1.1310 +	}
  1.1311 +
  1.1312 +CTestDevVideoPlayGetHeaderInfo* CTestDevVideoPlayGetHeaderInfo::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1313 +	{
  1.1314 +	CTestDevVideoPlayGetHeaderInfo* self = new(ELeave) CTestDevVideoPlayGetHeaderInfo(aTestName, aTestType);
  1.1315 +	return self;
  1.1316 +	}
  1.1317 +
  1.1318 +TBool CTestDevVideoPlayGetHeaderInfo::ValidPictureHeader(const TVideoPictureHeader* aPictureHeader)
  1.1319 +	{
  1.1320 +	TBool ret = EFalse;
  1.1321 +
  1.1322 +	if (!aPictureHeader)
  1.1323 +		{
  1.1324 +		ERR_PRINTF1(_L("Error - Picture Header is NULL!"));
  1.1325 +		return EFalse;
  1.1326 +		}
  1.1327 +
  1.1328 +	TTimeIntervalMicroSeconds testTime(KTestInputBufferTimestamp);
  1.1329 +
  1.1330 +	// check the picture header
  1.1331 +	if (aPictureHeader->iOptions != KTestPictureHeaderOptions)
  1.1332 +		{
  1.1333 +		ERR_PRINTF1(_L("Error - Options are incorrect!"));
  1.1334 +		}
  1.1335 +
  1.1336 +	else if (!(aPictureHeader->iPresentationTimestamp == testTime))
  1.1337 +		{
  1.1338 +		ERR_PRINTF1(_L("Error - Timestamp is incorrect!"));
  1.1339 +		}
  1.1340 +	else if (!(*(aPictureHeader->iOptional) == KTestInputBufferData()))
  1.1341 +		{	
  1.1342 +		ERR_PRINTF1(_L("Error - Optional data is corrupt!"));
  1.1343 +		}
  1.1344 +	else 
  1.1345 +		{
  1.1346 +		INFO_PRINTF1(_L("Picture Header is valid"));
  1.1347 +		ret = ETrue;
  1.1348 +		}
  1.1349 +
  1.1350 +	return ret;
  1.1351 +	}
  1.1352 +
  1.1353 +TVerdict CTestDevVideoPlayGetHeaderInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1354 +	{
  1.1355 +	TVerdict ret = EPass;
  1.1356 +	TInt expErr = KErrNone;
  1.1357 +	
  1.1358 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  GetHeaderInfo"));
  1.1359 +	
  1.1360 +	// expected results
  1.1361 +	if (iTestType != ETestValid)
  1.1362 +		{
  1.1363 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1364 +		return EInconclusive;
  1.1365 +		}
  1.1366 +	
  1.1367 +	TInt err = KErrNone;
  1.1368 +//	THwDeviceId hwDecoder = 0;
  1.1369 +
  1.1370 +	// select decoder
  1.1371 +//	TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
  1.1372 +	TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));	// EABI warning removal
  1.1373 +	if (err != KErrNone)
  1.1374 +		{
  1.1375 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1376 +		return EInconclusive;
  1.1377 +		}
  1.1378 +
  1.1379 +	// construct a test video input buffer with a valid timestamp
  1.1380 +	TPtrC8 testInputBufferDataLitCPtr(KTestInputBufferData);
  1.1381 +	HBufC8* testInputBufferData = testInputBufferDataLitCPtr.AllocLC();
  1.1382 +
  1.1383 +	TVideoInputBuffer testBuffer;
  1.1384 +	testBuffer.iOptions = KTestInputBufferOptions;
  1.1385 +	testBuffer.iPresentationTimestamp = KTestInputBufferTimestamp;
  1.1386 +	testBuffer.iData.Set(testInputBufferData->Des());
  1.1387 +
  1.1388 +	TVideoPictureHeader* picHeader = NULL;
  1.1389 +	// get header information from test data unit
  1.1390 +	TRAP(err, picHeader = aDevVideoPlay.GetHeaderInformationL(KTestDataUnitType, KTestDataUnitEncap, &testBuffer) );
  1.1391 +
  1.1392 +	if (err != expErr)
  1.1393 +		{
  1.1394 +		ERR_PRINTF3(_L("GetHeaderInformationL() gave error %d (expected %d)"),err, expErr);
  1.1395 +		ret = EFail;
  1.1396 +		}
  1.1397 +	else if (!ValidPictureHeader(picHeader))
  1.1398 +		{
  1.1399 +		ERR_PRINTF1(_L("Picture header corrupt!"));
  1.1400 +		ret = EFail;
  1.1401 +		}
  1.1402 +	else
  1.1403 +		{
  1.1404 +		INFO_PRINTF1(_L("Header information retrieved successfully"));
  1.1405 +		INFO_PRINTF3(_L("GetHeaderInformationL(), %d = %d"), err, expErr);	
  1.1406 +		}
  1.1407 +
  1.1408 +	CleanupStack::PopAndDestroy(testInputBufferData);
  1.1409 +	
  1.1410 +	return ret;
  1.1411 +	}
  1.1412 +
  1.1413 +//------------------------------------------------------------------
  1.1414 +
  1.1415 +CTestDevVideoPlayReturnHeader::CTestDevVideoPlayReturnHeader(const TDesC& aTestName, TTestType aTestType)
  1.1416 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1417 +	{
  1.1418 +	}
  1.1419 +
  1.1420 +CTestDevVideoPlayReturnHeader* CTestDevVideoPlayReturnHeader::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1421 +	{
  1.1422 +	CTestDevVideoPlayReturnHeader* self = new(ELeave) CTestDevVideoPlayReturnHeader(aTestName, aTestType);
  1.1423 +	return self;
  1.1424 +	}
  1.1425 +
  1.1426 +TVerdict CTestDevVideoPlayReturnHeader::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1427 +	{
  1.1428 +	TVerdict ret = EPass;
  1.1429 +	
  1.1430 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  ReturnHeader"));
  1.1431 +	
  1.1432 +	// expected results
  1.1433 +	if (iTestType != ETestValid)
  1.1434 +		{
  1.1435 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1436 +		return EInconclusive;
  1.1437 +		}
  1.1438 +	
  1.1439 +	TInt err = KErrNone;
  1.1440 +//	THwDeviceId hwDecoder = 0;
  1.1441 +
  1.1442 +	// select decoder
  1.1443 +//	TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
  1.1444 +	TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));	// EABI warning removal
  1.1445 +	if (err != KErrNone)
  1.1446 +		{
  1.1447 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1448 +		return EInconclusive;
  1.1449 +		}
  1.1450 +
  1.1451 +	TVideoPictureHeader picHeader;
  1.1452 +	picHeader.iOptions = KTestPictureHeaderOptions;
  1.1453 +	TTimeIntervalMicroSeconds testTime(KTestPictureHeaderTimestamp);
  1.1454 +	picHeader.iPresentationTimestamp = testTime;
  1.1455 +
  1.1456 +	// return picture header [can use a local TVideoPictureHeader because we
  1.1457 +	// are testing a fake plugin - normally this would be a header supplied by
  1.1458 +	// the video plugin].
  1.1459 +	aDevVideoPlay.ReturnHeader(&picHeader);
  1.1460 +	
  1.1461 +	// if plugin didn't PANIC then test has passed
  1.1462 +	INFO_PRINTF1(_L("Header information returned successfully"));
  1.1463 +			
  1.1464 +	return ret;
  1.1465 +	}
  1.1466 +
  1.1467 +//------------------------------------------------------------------
  1.1468 +
  1.1469 +CTestDevVideoPlayConfigureDecoder::CTestDevVideoPlayConfigureDecoder(const TDesC& aTestName, TTestType aTestType)
  1.1470 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1471 +	{
  1.1472 +	}
  1.1473 +
  1.1474 +CTestDevVideoPlayConfigureDecoder* CTestDevVideoPlayConfigureDecoder::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1475 +	{
  1.1476 +	CTestDevVideoPlayConfigureDecoder* self = new(ELeave) CTestDevVideoPlayConfigureDecoder(aTestName, aTestType);
  1.1477 +	return self;
  1.1478 +	}
  1.1479 +
  1.1480 +TVerdict CTestDevVideoPlayConfigureDecoder::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1481 +	{
  1.1482 +	TVerdict ret = EPass;
  1.1483 +	TInt expErr;
  1.1484 +
  1.1485 +	expErr = KErrNone;
  1.1486 +	
  1.1487 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  ConfigureDecoderL"));
  1.1488 +	
  1.1489 +	// expected results
  1.1490 +	if (iTestType != ETestValid)
  1.1491 +		{
  1.1492 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1493 +		return EInconclusive;
  1.1494 +		}
  1.1495 +	
  1.1496 +	TInt err = KErrNone;
  1.1497 +	TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));	// EABI warning removal
  1.1498 +	if (err != KErrNone)
  1.1499 +		{
  1.1500 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1501 +		return EInconclusive;
  1.1502 +		}
  1.1503 +
  1.1504 +	//construct a test picture header
  1.1505 +	TVideoPictureHeader pictureHeader;
  1.1506 +	pictureHeader.iOptions = KTestPictureHeaderOptions;
  1.1507 +	pictureHeader.iPresentationTimestamp = KTestInputBufferTimestamp;
  1.1508 +
  1.1509 +	TPtrC8 testInputBufferDataLitCPtr(KTestInputBufferData);
  1.1510 +	pictureHeader.iOptional = &testInputBufferDataLitCPtr;
  1.1511 +
  1.1512 +	// get header information from test data unit
  1.1513 +	TRAP(err, aDevVideoPlay.ConfigureDecoderL(pictureHeader));
  1.1514 +
  1.1515 +	if (err != expErr)
  1.1516 +		{
  1.1517 +		ERR_PRINTF3(_L("ConfigureDecoderL() gave error %d (expected %d)"),err, expErr);
  1.1518 +		ret = EFail;
  1.1519 +		}
  1.1520 +	else
  1.1521 +		{
  1.1522 +		if (err == KErrNone)
  1.1523 +			{
  1.1524 +			INFO_PRINTF1(_L("Header information successfully configured in Decoder"));
  1.1525 +			}
  1.1526 +		INFO_PRINTF3(_L("ConfigureDecoderL(), error %d = expected %d"), err, expErr);	
  1.1527 +		}
  1.1528 +	
  1.1529 +	return ret;
  1.1530 +	}
  1.1531 +
  1.1532 +//------------------------------------------------------------------
  1.1533 +
  1.1534 +CTestDevVideoPlaySetInputFormatUC::CTestDevVideoPlaySetInputFormatUC(const TDesC& aTestName, TTestType aTestType)
  1.1535 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1536 +	{
  1.1537 +	}
  1.1538 +
  1.1539 +CTestDevVideoPlaySetInputFormatUC* CTestDevVideoPlaySetInputFormatUC::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1540 +	{
  1.1541 +	CTestDevVideoPlaySetInputFormatUC* self = new(ELeave) CTestDevVideoPlaySetInputFormatUC(aTestName, aTestType);
  1.1542 +	return self;
  1.1543 +	}
  1.1544 +
  1.1545 +TVerdict CTestDevVideoPlaySetInputFormatUC::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1546 +	{
  1.1547 +	TVerdict ret = EPass;
  1.1548 +	TInt expErr = KErrNone;
  1.1549 +	
  1.1550 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  SetInputFormatUC"));
  1.1551 +	
  1.1552 +	// expected results
  1.1553 +	if (iTestType != ETestValid)
  1.1554 +		{
  1.1555 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1556 +		return EInconclusive;
  1.1557 +		}
  1.1558 +
  1.1559 +	TInt err = KErrNone;
  1.1560 +
  1.1561 +//	THwDeviceId hwDecoder = 0;
  1.1562 +	THwDeviceId hwPostProc = 0;
  1.1563 +
  1.1564 +	// select decoder
  1.1565 +//	TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
  1.1566 +	TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));	// EABI warning removal
  1.1567 +	if (err != KErrNone)
  1.1568 +		{
  1.1569 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1570 +		return EInconclusive;
  1.1571 +		}
  1.1572 +
  1.1573 +	// select post-processor
  1.1574 +	TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
  1.1575 +	if (err != KErrNone)
  1.1576 +		{
  1.1577 +		ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
  1.1578 +		return EInconclusive;
  1.1579 +		}
  1.1580 +
  1.1581 +	// this will leave if an error occurs in either plugin
  1.1582 +	TRAP(err, aDevVideoPlay.SetInputFormatL(hwPostProc, KTestVidFormat2) );
  1.1583 +
  1.1584 +	if ( err != expErr )
  1.1585 +		{
  1.1586 +		ERR_PRINTF3(_L("SetInputFormatL() on Post-Processor gave error %d (expected %d)"),err, expErr);
  1.1587 +		ret = EFail;
  1.1588 +		}
  1.1589 +	else
  1.1590 +		INFO_PRINTF3(_L("SetInputFormat(), %d = %d"), err, expErr);
  1.1591 +	
  1.1592 +	return ret;
  1.1593 +	}
  1.1594 +//------------------------------------------------------------------
  1.1595 +
  1.1596 +CTestDevVideoPlaySetInputFormat::CTestDevVideoPlaySetInputFormat(const TDesC& aTestName, TTestType aTestType)
  1.1597 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1598 +	{
  1.1599 +	}
  1.1600 +
  1.1601 +CTestDevVideoPlaySetInputFormat* CTestDevVideoPlaySetInputFormat::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1602 +	{
  1.1603 +	CTestDevVideoPlaySetInputFormat* self = new(ELeave) CTestDevVideoPlaySetInputFormat(aTestName, aTestType);
  1.1604 +	return self;
  1.1605 +	}
  1.1606 +
  1.1607 +TVerdict CTestDevVideoPlaySetInputFormat::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1608 +	{
  1.1609 +	TVerdict ret = EPass;
  1.1610 +	TInt expErr = KErrNone;
  1.1611 +	
  1.1612 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  SetInputFormat"));
  1.1613 +	
  1.1614 +	// expected results
  1.1615 +	if (iTestType != ETestValid)
  1.1616 +		{
  1.1617 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1618 +		return EInconclusive;
  1.1619 +		}
  1.1620 +
  1.1621 +	TInt err = KErrNone;
  1.1622 +
  1.1623 +	THwDeviceId hwDecoder = 0;
  1.1624 +//	THwDeviceId hwPostProc = 0;
  1.1625 +
  1.1626 +	// select decoder
  1.1627 +	TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
  1.1628 +	if (err != KErrNone)
  1.1629 +		{
  1.1630 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1631 +		return EInconclusive;
  1.1632 +		}
  1.1633 +
  1.1634 +	// select post-processor
  1.1635 +//	TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
  1.1636 +	TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));	// EABI warning removal
  1.1637 +	if (err != KErrNone)
  1.1638 +		{
  1.1639 +		ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
  1.1640 +		return EInconclusive;
  1.1641 +		}
  1.1642 +
  1.1643 +	// get a temporary compressed video class
  1.1644 +	CCompressedVideoFormat *tempCFormat = NULL;
  1.1645 +	TRAP(err, tempCFormat = GetTestCVFormatL(KTestMimeType1));
  1.1646 +	if (err != KErrNone)
  1.1647 +		{
  1.1648 +		ERR_PRINTF1(_L("Error - couldn't initialize compressed video class"));
  1.1649 +		return EInconclusive;
  1.1650 +		}
  1.1651 +
  1.1652 +	// this will leave if an error occurs
  1.1653 +	TRAP(err, aDevVideoPlay.SetInputFormatL(hwDecoder, *tempCFormat, KTestUnitType1, KTestEncapType1, ETrue) );
  1.1654 +
  1.1655 +	// delete compressed video class
  1.1656 +	delete tempCFormat;	
  1.1657 +	tempCFormat = NULL;
  1.1658 +
  1.1659 +	if ( err != expErr )
  1.1660 +		{
  1.1661 +		ERR_PRINTF3(_L("SetInputFormatL() on Decoder gave error %d (expected %d)"),err, expErr);
  1.1662 +		ret = EFail;
  1.1663 +		}
  1.1664 +	else
  1.1665 +		INFO_PRINTF3(_L("SetInputFormat(), %d = %d"), err, expErr);
  1.1666 +	
  1.1667 +	return ret;
  1.1668 +	}
  1.1669 +//------------------------------------------------------------------
  1.1670 +
  1.1671 +CTestDevVideoPlayGetOutputFormatList::CTestDevVideoPlayGetOutputFormatList(const TDesC& aTestName, TTestType aTestType)
  1.1672 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1673 +	{
  1.1674 +	}
  1.1675 +
  1.1676 +CTestDevVideoPlayGetOutputFormatList* CTestDevVideoPlayGetOutputFormatList::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1677 +	{
  1.1678 +	CTestDevVideoPlayGetOutputFormatList* self = new(ELeave) CTestDevVideoPlayGetOutputFormatList(aTestName, aTestType);
  1.1679 +	return self;
  1.1680 +	}
  1.1681 +
  1.1682 +TVerdict CTestDevVideoPlayGetOutputFormatList::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1683 +	{
  1.1684 +	TVerdict ret = EPass;
  1.1685 +	TInt expErr = KErrNone;
  1.1686 +	
  1.1687 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  GetOutputFormatList"));
  1.1688 +	
  1.1689 +	// expected results
  1.1690 +	if (iTestType != ETestValid)
  1.1691 +		{
  1.1692 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1693 +		return EInconclusive;
  1.1694 +		}
  1.1695 +
  1.1696 +	TInt err = KErrNone;
  1.1697 +	TInt err2 = KErrNone;
  1.1698 +
  1.1699 +	THwDeviceId hwDecoder = 0;
  1.1700 +	THwDeviceId hwPostProc = 0;
  1.1701 +
  1.1702 +	// select decoder
  1.1703 +	TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
  1.1704 +	if (err != KErrNone)
  1.1705 +		{
  1.1706 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1707 +		return EInconclusive;
  1.1708 +		}
  1.1709 +
  1.1710 +	// select post-processor
  1.1711 +	TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
  1.1712 +	if (err != KErrNone)
  1.1713 +		{
  1.1714 +		ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
  1.1715 +		return EInconclusive;
  1.1716 +		}
  1.1717 +
  1.1718 +	RArray<TUncompressedVideoFormat> decodeList;
  1.1719 +	RArray<TUncompressedVideoFormat> postProcList;
  1.1720 +
  1.1721 +	// Get output format list for decoder
  1.1722 +	TRAP(err, aDevVideoPlay.GetOutputFormatListL(hwDecoder, decodeList));
  1.1723 +		
  1.1724 +	// Get output format list for post-processor
  1.1725 +	TRAP(err2, aDevVideoPlay.GetOutputFormatListL(hwPostProc, postProcList));
  1.1726 +	
  1.1727 +	if ((err != expErr) || (err2 != expErr))
  1.1728 +		{
  1.1729 +		ERR_PRINTF3(_L("GetOutputFormatListL() on Decoder gave error %d (expected %d)"),err, expErr);
  1.1730 +		ERR_PRINTF3(_L("GetOutputFormatListL() on Post-Processor gave error %d (expected %d)"),err2, expErr);
  1.1731 +		ret = EFail;
  1.1732 +		}
  1.1733 +	else
  1.1734 +		{
  1.1735 +		TBool decPass = EFalse;
  1.1736 +		TBool posPass = EFalse;
  1.1737 +
  1.1738 +		// expecting KTestVidFormat1,2,3 - check
  1.1739 +		TInt count = decodeList.Count();
  1.1740 +		if (count == 3) 
  1.1741 +			{
  1.1742 +			if ((decodeList[0] == KTestVidFormat1) &&
  1.1743 +				(decodeList[1] == KTestVidFormat2) &&
  1.1744 +				(decodeList[2] == KTestVidFormat3) )
  1.1745 +				{
  1.1746 +				INFO_PRINTF1(_L("Decoder output list checks ok"));
  1.1747 +				decPass = ETrue;
  1.1748 +				}
  1.1749 +			}
  1.1750 +
  1.1751 +		// expecting KTestVidFormat3,2,1 - check
  1.1752 +		count = postProcList.Count();
  1.1753 +		if (count == 3) 
  1.1754 +			{
  1.1755 +			if ((postProcList[0] == KTestVidFormat3) &&
  1.1756 +				(postProcList[1] == KTestVidFormat2) &&
  1.1757 +				(postProcList[2] == KTestVidFormat1) )
  1.1758 +				{
  1.1759 +				INFO_PRINTF1(_L("Post-Processor output list checks ok"));
  1.1760 +				posPass = ETrue;
  1.1761 +				}
  1.1762 +			}
  1.1763 +		
  1.1764 +		if (!decPass)
  1.1765 +			{
  1.1766 +			ERR_PRINTF1(_L("Decoder output list corrupt!"));
  1.1767 +			ret = EFail;
  1.1768 +			}
  1.1769 +		
  1.1770 +		if (!posPass)
  1.1771 +			{
  1.1772 +			ERR_PRINTF1(_L("Post-Processor output list corrupt!"));
  1.1773 +			ret = EFail;
  1.1774 +			}
  1.1775 +	
  1.1776 +		INFO_PRINTF4(_L("GetOutputFormatListL(), %d, %d = %d"), err, err2, expErr);
  1.1777 +		}	
  1.1778 +
  1.1779 +	// close the arrays
  1.1780 +	decodeList.Reset();		
  1.1781 +	decodeList.Close();
  1.1782 +	
  1.1783 +	postProcList.Reset();	
  1.1784 +	postProcList.Close();
  1.1785 +	
  1.1786 +	return ret;
  1.1787 +	}
  1.1788 +//------------------------------------------------------------------
  1.1789 +
  1.1790 +CTestDevVideoPlaySetOutputFormat::CTestDevVideoPlaySetOutputFormat(const TDesC& aTestName, TTestType aTestType)
  1.1791 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1792 +	{
  1.1793 +	}
  1.1794 +
  1.1795 +CTestDevVideoPlaySetOutputFormat* CTestDevVideoPlaySetOutputFormat::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1796 +	{
  1.1797 +	CTestDevVideoPlaySetOutputFormat* self = new(ELeave) CTestDevVideoPlaySetOutputFormat(aTestName, aTestType);
  1.1798 +	return self;
  1.1799 +	}
  1.1800 +
  1.1801 +TVerdict CTestDevVideoPlaySetOutputFormat::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1802 +	{
  1.1803 +	TVerdict ret = EPass;
  1.1804 +	TInt expErr = KErrNone;
  1.1805 +	
  1.1806 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  SetOutputFormat"));
  1.1807 +	
  1.1808 +	// expected results
  1.1809 +	if (iTestType != ETestValid)
  1.1810 +		{
  1.1811 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1812 +		return EInconclusive;
  1.1813 +		}
  1.1814 +
  1.1815 +	TInt err = KErrNone;
  1.1816 +	TInt err2 = KErrNone;
  1.1817 +
  1.1818 +	THwDeviceId hwDecoder = 0;
  1.1819 +	THwDeviceId hwPostProc = 0;
  1.1820 +
  1.1821 +	// select decoder
  1.1822 +	TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
  1.1823 +	if (err != KErrNone)
  1.1824 +		{
  1.1825 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1826 +		return EInconclusive;
  1.1827 +		}
  1.1828 +
  1.1829 +	// select post-processor
  1.1830 +	TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
  1.1831 +	if (err != KErrNone)
  1.1832 +		{
  1.1833 +		ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
  1.1834 +		return EInconclusive;
  1.1835 +		}
  1.1836 +
  1.1837 +	// set output format on decoder
  1.1838 +	TRAP(err, aDevVideoPlay.SetOutputFormatL(hwDecoder, KTestVidFormat1) )
  1.1839 +	
  1.1840 +	// set output format on post-processor
  1.1841 +	TRAP(err2, aDevVideoPlay.SetOutputFormatL(hwPostProc, KTestVidFormat2) )
  1.1842 +
  1.1843 +
  1.1844 +	if ((err != expErr) || (err2 != expErr))
  1.1845 +		{
  1.1846 +		ERR_PRINTF3(_L("SetOutputFormatL() on Decoder gave error %d (expected %d)"),err, expErr);
  1.1847 +		ERR_PRINTF3(_L("SetOutputFormatL() on Post-Processor gave error %d (expected %d)"),err2, expErr);
  1.1848 +		ret = EFail;
  1.1849 +		}
  1.1850 +	else
  1.1851 +		INFO_PRINTF4(_L("SetOutputFormat(), %d, %d= %d"), err, err2, expErr);
  1.1852 +	
  1.1853 +	return ret;
  1.1854 +	}
  1.1855 +//------------------------------------------------------------------
  1.1856 +
  1.1857 +CTestDevVideoPlaySetPostProcTypes::CTestDevVideoPlaySetPostProcTypes(const TDesC& aTestName, TTestType aTestType)
  1.1858 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1859 +	{
  1.1860 +	}
  1.1861 +
  1.1862 +CTestDevVideoPlaySetPostProcTypes* CTestDevVideoPlaySetPostProcTypes::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1863 +	{
  1.1864 +	CTestDevVideoPlaySetPostProcTypes* self = new(ELeave) CTestDevVideoPlaySetPostProcTypes(aTestName, aTestType);
  1.1865 +	return self;
  1.1866 +	}
  1.1867 +
  1.1868 +TVerdict CTestDevVideoPlaySetPostProcTypes::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.1869 +	{
  1.1870 +	TVerdict ret = EPass;
  1.1871 +	TInt expErr = KErrNone;
  1.1872 +	
  1.1873 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  SetPostProcTypes"));
  1.1874 +	
  1.1875 +	// expected results
  1.1876 +	if (iTestType != ETestValid)
  1.1877 +		{
  1.1878 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.1879 +		return EInconclusive;
  1.1880 +		}
  1.1881 +
  1.1882 +	TInt err = KErrNone;
  1.1883 +	TInt err2 = KErrNone;
  1.1884 +
  1.1885 +	THwDeviceId hwDecoder = 0;
  1.1886 +	THwDeviceId hwPostProc = 0;
  1.1887 +
  1.1888 +	// select decoder
  1.1889 +	TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
  1.1890 +	if (err != KErrNone)
  1.1891 +		{
  1.1892 +		ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
  1.1893 +		return EInconclusive;
  1.1894 +		}
  1.1895 +
  1.1896 +	// select post-processor
  1.1897 +	TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
  1.1898 +	if (err != KErrNone)
  1.1899 +		{
  1.1900 +		ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
  1.1901 +		return EInconclusive;
  1.1902 +		}
  1.1903 +
  1.1904 +	// set post-process types on decoder
  1.1905 +	TRAP(err, aDevVideoPlay.SetPostProcessTypesL(hwDecoder, KTestProcessType1) )
  1.1906 +	
  1.1907 +	// set post-process types on post-processor
  1.1908 +	TRAP(err2, aDevVideoPlay.SetPostProcessTypesL(hwPostProc, KTestProcessType2) )
  1.1909 +
  1.1910 +
  1.1911 +	if ((err != expErr) || (err2 != expErr))
  1.1912 +		{
  1.1913 +		ERR_PRINTF3(_L("SetPostProcessTypesL() on Decoder gave error %d (expected %d)"),err, expErr);
  1.1914 +		ERR_PRINTF3(_L("SetPostProcessTypesL() on Post-Processor gave error %d (expected %d)"),err2, expErr);
  1.1915 +		ret = EFail;
  1.1916 +		}
  1.1917 +	else
  1.1918 +		INFO_PRINTF4(_L("SetPostProcessTypes(), %d, %d= %d"), err, err2, expErr);
  1.1919 +	
  1.1920 +	return ret;
  1.1921 +	}
  1.1922 +//------------------------------------------------------------------
  1.1923 +
  1.1924 +CTestDevVideoPlayGetDecoderPostProcInfo::CTestDevVideoPlayGetDecoderPostProcInfo(const TDesC& aTestName, TTestType aTestType)
  1.1925 +	:CTestDevVideoPlayStep(aTestName, aTestType)
  1.1926 +	{
  1.1927 +	}
  1.1928 +
  1.1929 +CTestDevVideoPlayGetDecoderPostProcInfo* CTestDevVideoPlayGetDecoderPostProcInfo::NewL(const TDesC& aTestName, TTestType aTestType)
  1.1930 +	{
  1.1931 +	CTestDevVideoPlayGetDecoderPostProcInfo* self = new(ELeave) CTestDevVideoPlayGetDecoderPostProcInfo(aTestName, aTestType);
  1.1932 +	return self;
  1.1933 +	}
  1.1934 +
  1.1935 +TBool CTestDevVideoPlayGetDecoderPostProcInfo::ValidPostProcInfo(CPostProcessorInfo* aInfo)
  1.1936 +	{
  1.1937 +	// do null pointer check
  1.1938 +	if (!aInfo) 
  1.1939 +		{
  1.1940 +		ERR_PRINTF1(_L("Error - Post Processor Info is NULL!"));
  1.1941 +		return EFalse;
  1.1942 +		}
  1.1943 +	
  1.1944 +	// check the post processor against test data
  1.1945 +	// need to check every call so as to keep code coverage
  1.1946 +	// and prevent a situation where if the first test fails
  1.1947 +	// then subsequent tests will not be called
  1.1948 +	TBool ret = ETrue;
  1.1949 +
  1.1950 +	// UID check
  1.1951 +	if (aInfo->Uid() != KUidDevVideoTestDecodeHwDevice)
  1.1952 +		{
  1.1953 +		ERR_PRINTF1(_L("Error - Decoder UID is incorrect!"));
  1.1954 +		ret = EFalse;
  1.1955 +		}
  1.1956 +	// Manufacturer check
  1.1957 +	if (!(aInfo->Manufacturer() == KTestPostProcInfoManufacturer))
  1.1958 +		{
  1.1959 +		ERR_PRINTF1(_L("Error - Manufacturer is incorrect!"));
  1.1960 +		ret = EFalse;
  1.1961 +		}
  1.1962 +	// Identifier check
  1.1963 +	if (!(aInfo->Identifier() == KTestPostProcInfoIdentifier))
  1.1964 +		{
  1.1965 +		ERR_PRINTF1(_L("Error - Identifier is incorrect!"));
  1.1966 +		ret = EFalse;
  1.1967 +		}
  1.1968 +	// Version check
  1.1969 +	TVersion posVer = aInfo->Version();
  1.1970 +	if ( (posVer.iMajor != KTestPostProcInfoVersionMaj) ||
  1.1971 +		 (posVer.iMinor != KTestPostProcInfoVersionMin) ||
  1.1972 +		 (posVer.iBuild != KTestPostProcInfoVersionBuild) )
  1.1973 +		{
  1.1974 +		ERR_PRINTF1(_L("Error - Version is incorrect!"));
  1.1975 +		ret = EFalse;
  1.1976 +		}
  1.1977 +	// Accelerated check
  1.1978 +	if (!aInfo->Accelerated())
  1.1979 +		{
  1.1980 +		ERR_PRINTF1(_L("Error - Accelerated = EFalse!"));
  1.1981 +		ret = EFalse;
  1.1982 +		}
  1.1983 +	// Direct display check
  1.1984 +	if (!aInfo->SupportsDirectDisplay())
  1.1985 +		{
  1.1986 +		ERR_PRINTF1(_L("Error - Supports Direct Display = EFalse!"));
  1.1987 +		ret = EFalse;
  1.1988 +		}
  1.1989 +	// YUVToRGB Capabilities
  1.1990 +	if (!CompareYuvRgbCaps(aInfo->YuvToRgbCapabilities(), KTestPostProcInfoYuvToRgbCaps))
  1.1991 +		{
  1.1992 +		ERR_PRINTF1(_L("Error - YUV To RGB capabilities is incorrect!"));
  1.1993 +		ret = EFalse;
  1.1994 +		}
  1.1995 +	//Content Protection	
  1.1996 +	if (!aInfo->SupportsContentProtected())//Check if flag is set indicating Content Protection is supported.
  1.1997 +		{
  1.1998 +		ERR_PRINTF1(_L("Error - Failed To get flag indicating support of Content Protection!"));
  1.1999 +		ret = EFalse;
  1.2000 +		}
  1.2001 +
  1.2002 +	// Supported rotations
  1.2003 +	if (aInfo->SupportedRotations() != KTestPostProcInfoRotations)
  1.2004 +		{
  1.2005 +		ERR_PRINTF1(_L("Error - Supported Rotations is incorrect!"));
  1.2006 +		ret = EFalse;
  1.2007 +		}
  1.2008 +
  1.2009 +	// Supports arbitrary scaling check
  1.2010 +	if (!aInfo->AntiAliasedScaling())
  1.2011 +		{
  1.2012 +		ERR_PRINTF1(_L("Error - Anti-Aliased Scaling = EFalse!"));
  1.2013 +		ret = EFalse;
  1.2014 +		}
  1.2015 +	// Supports anti-aliased scaling check
  1.2016 +	if (!aInfo->SupportsArbitraryScaling())
  1.2017 +		{
  1.2018 +		ERR_PRINTF1(_L("Error - Supports Arbitrary Scaling = EFalse!"));
  1.2019 +		ret = EFalse;
  1.2020 +		}
  1.2021 +	// Implementation info
  1.2022 +	if (!(aInfo->ImplementationSpecificInfo() == KTestDecoderInfoISInfo))
  1.2023 +		{
  1.2024 +		ERR_PRINTF1(_L("Error - Implementation specific info is incorrect!"));
  1.2025 +		ret = EFalse;
  1.2026 +		}
  1.2027 +
  1.2028 +	// get some test compressed video formats
  1.2029 +	TUncompressedVideoFormat testFormat;
  1.2030 +	TUint32 testComb = 0;
  1.2031 +	TScaleFactor testFactor = {0, 0};
  1.2032 +
  1.2033 +	// get supported formats
  1.2034 +	const RArray<TUncompressedVideoFormat>& vidFormats = aInfo->SupportedFormats();
  1.2035 +	
  1.2036 +	// get supported combinations
  1.2037 +	const RArray<TUint32>& suppCombs = aInfo->SupportedCombinations();
  1.2038 +
  1.2039 +	// get supported scale factors
  1.2040 +	const RArray<TScaleFactor>& scaleFactors = aInfo->SupportedScaleFactors();
  1.2041 +
  1.2042 +	// test formats, combinations, and scale factors supported
  1.2043 +	for (TUint i = 0; i < KTestPostProcInfoCount; i++)
  1.2044 +		{
  1.2045 +		testFormat = KTestPostProcInfoFormatArray[i];
  1.2046 +		if (!(testFormat == (vidFormats[i])) || !(aInfo->SupportsFormat(testFormat)))
  1.2047 +			{
  1.2048 +			ERR_PRINTF2(_L("Error - Video Format %d is corrupt!"), i);
  1.2049 +			ret = EFalse;
  1.2050 +			}
  1.2051 +
  1.2052 +		testComb = KTestPostProcInfoCombsArray[i];
  1.2053 +		if (!(testComb == (suppCombs[i])) || !(aInfo->SupportsCombination(testComb)))
  1.2054 +			{
  1.2055 +			ERR_PRINTF2(_L("Error - Combination %d is corrupt!"), i);
  1.2056 +			ret = EFalse;
  1.2057 +			}
  1.2058 +
  1.2059 +		testFactor = KTestPostProcInfoScaleFactorsArray[i];
  1.2060 +		if (!CompareScaleFactors(testFactor, scaleFactors[i]))
  1.2061 +			{
  1.2062 +			ERR_PRINTF2(_L("Error - Scale factor %d is corrupt!"), i);
  1.2063 +			ret = EFalse;
  1.2064 +			}
  1.2065 +		}
  1.2066 +
  1.2067 +	// check a format that isn't supposed to be supported
  1.2068 +	testFormat = KTestPostProcInfoNegativeFormat;
  1.2069 +	testFormat.iYuvFormat = KTestYuvFormat1;
  1.2070 +	if (aInfo->SupportsFormat(testFormat))
  1.2071 +		{
  1.2072 +		ERR_PRINTF1(_L("Error - Failed negative SupportsFormat() check!"));
  1.2073 +		ret = EFalse;
  1.2074 +		}
  1.2075 +	
  1.2076 +	// finally check a combination that isn't supposed to be supported
  1.2077 +	testComb = KTestPostProcInfoNegativeComb;
  1.2078 +	if (aInfo->SupportsCombination(testComb))
  1.2079 +		{
  1.2080 +		ERR_PRINTF1(_L("Error - Failed negative SupportsCombination() check!"));
  1.2081 +		ret = EFalse;
  1.2082 +		}
  1.2083 +
  1.2084 +	if (!aInfo->SupportsContentProtected())
  1.2085 +		{
  1.2086 +		ERR_PRINTF1(_L("Error - Failed to Set Content Protected Support!"));
  1.2087 +		ret = EFalse;
  1.2088 +		}
  1.2089 +
  1.2090 +	return ret;
  1.2091 +	}
  1.2092 +
  1.2093 +TVerdict CTestDevVideoPlayGetDecoderPostProcInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
  1.2094 +	{
  1.2095 +	TVerdict ret = EPass;
  1.2096 +	TInt expErr = KErrNone;
  1.2097 +	
  1.2098 +	INFO_PRINTF1(_L("CMMFDevVideoPlay:  GetPostProcInfo"));
  1.2099 +	
  1.2100 +	// expected results
  1.2101 +	if (iTestType != ETestValid)
  1.2102 +		{
  1.2103 +		ERR_PRINTF1(_L("Error - invalid test step type"));
  1.2104 +		return EInconclusive;
  1.2105 +		}
  1.2106 +	
  1.2107 +	TInt err = KErrNone;
  1.2108 +	CPostProcessorInfo *procInfo = NULL;
  1.2109 +	TBool valid = EFalse;
  1.2110 +	
  1.2111 +	// get decoder information from test decoder plugin
  1.2112 +	TRAP(err, 
  1.2113 +		procInfo = aDevVideoPlay.PostProcessorInfoLC(KUidDevVideoTestDecodeHwDevice); 
  1.2114 +		procInfo->SetSupportsContentProtected(ETrue);
  1.2115 +		valid = ValidPostProcInfo(procInfo);
  1.2116 +		CleanupStack::PopAndDestroy(procInfo); );
  1.2117 +
  1.2118 +	if (err != expErr)
  1.2119 +		{
  1.2120 +		ERR_PRINTF3(_L("PostProcessorInfoLC() gave error %d (expected %d)"),err, expErr);
  1.2121 +		ret = EFail;
  1.2122 +		}
  1.2123 +	// check the Video Decoder
  1.2124 +	else if (!valid)
  1.2125 +		{
  1.2126 +		ERR_PRINTF1(_L("CPostProcessorInfo class is corrupt!"));
  1.2127 +		ret = EFail;
  1.2128 +		}
  1.2129 +	else
  1.2130 +		{
  1.2131 +		INFO_PRINTF1(_L("CPostProcessorInfo passed check successfully"));
  1.2132 +		INFO_PRINTF3(_L("PostProcessorInfoLC(), %d = %d"), err, expErr);
  1.2133 +		}
  1.2134 +
  1.2135 +	return ret;
  1.2136 +	}