os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevVideo/src/TestDevVideoPlugins/decoder.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "decoder.h"
    17 #include "../TestDevVideoPlayTestData.h"
    18 
    19 _LIT(KDevVideoDecoderPanicCategory, "DevVideoDecoder");
    20 void DevVideoDecoderPanic(TInt aReason)
    21 	{
    22 	User::Panic(KDevVideoDecoderPanicCategory, aReason);
    23 	}
    24 
    25 CMMFVideoDecodeHwDevice* CMMFTestVideoDecodeHwDevice::NewL(TAny* /*aInitParams*/)
    26 	{
    27 	CMMFTestVideoDecodeHwDevice* s = new(ELeave) CMMFTestVideoDecodeHwDevice;
    28 	return (STATIC_CAST(CMMFVideoDecodeHwDevice*, s));
    29 	}
    30 
    31 CMMFTestVideoDecodeHwDevice::CMMFTestVideoDecodeHwDevice()
    32 	:iExtensionUid(KUidDevVideoPlayHwDeviceExtensionScanCopy)
    33 	{
    34 	}
    35 
    36 CMMFTestVideoDecodeHwDevice::~CMMFTestVideoDecodeHwDevice()
    37 	{
    38 	// destroy objects in RArray
    39 	for (TInt i = 0; i < iVidFormats.Count(); i++)
    40 		{
    41 		delete iVidFormats[i];
    42 		}
    43 
    44 	iVidFormats.Reset();
    45 	iVidFormats.Close();
    46 
    47 	iPictureRates.Reset();
    48 	iPictureRates.Close();
    49 
    50 	iCombinations.Reset();
    51 	iCombinations.Close();
    52 	
    53 	iPostProcVidFormats.Reset();
    54 	iPostProcVidFormats.Close();
    55 	
    56 	iScaleFactors.Reset();
    57 	iScaleFactors.Close();
    58 		
    59 	delete iBufferDataArea;
    60 	}
    61 
    62 TAny* CMMFTestVideoDecodeHwDevice::CustomInterface(TUid aInterface)
    63 	{
    64    	if (aInterface == KUidCustomInterfaceOne)
    65    		{
    66   		return this;//just want to return something non-null!
    67    		}
    68 	else if (aInterface == iExtensionUid)
    69 		{
    70 		return static_cast<MMMFVideoPlayHwDeviceExtensionScanCopy*>(this);
    71 		}
    72 	else
    73 		{
    74 		return NULL;
    75 		}
    76 	}
    77 
    78 // post processor info may be obtained from this plugin or the post processor plugin
    79 CPostProcessorInfo* CMMFTestVideoDecodeHwDevice::PostProcessorInfoLC()
    80 	{
    81 	// construct array of test types
    82 	for (TUint i = 0; i < KTestPostProcInfoCount; i++)
    83 		{
    84 		// append the video formats
    85 		TUncompressedVideoFormat vid = KTestPostProcInfoFormatArray[i];
    86 		User::LeaveIfError(iPostProcVidFormats.Append(vid));
    87 
    88 		// append the combinations
    89 		TUint32 comb = KTestPostProcInfoCombsArray[i];
    90 		User::LeaveIfError(iCombinations.Append(comb));
    91 
    92 		// append the scale factors
    93 		TScaleFactor scale = KTestPostProcInfoScaleFactorsArray[i];
    94 		User::LeaveIfError(iScaleFactors.Append(scale));
    95 		}
    96 		
    97 	// construct the video decoder info object
    98 	CPostProcessorInfo* info = CPostProcessorInfo::NewL( KUidDevVideoTestDecodeHwDevice,
    99 														 KTestPostProcInfoManufacturer,
   100 														 KTestPostProcInfoIdentifier,
   101 														 TVersion(KTestPostProcInfoVersionMaj,
   102 														 		  KTestPostProcInfoVersionMin,
   103 														 		  KTestPostProcInfoVersionBuild),
   104 														 iPostProcVidFormats.Array(),
   105 														 iCombinations.Array(),
   106 														 ETrue, // accelerated
   107 														 ETrue, // direct display support
   108 														 KTestPostProcInfoYuvToRgbCaps,
   109 														 KTestPostProcInfoRotations,
   110 														 ETrue,	// scaling
   111 														 iScaleFactors.Array(),
   112 														 ETrue,	// anti-aliasing
   113 														 KTestDecoderInfoISInfo );
   114 	CleanupStack::PushL(info);
   115 	
   116 	return info;
   117 	}
   118 
   119 void CMMFTestVideoDecodeHwDevice::GetOutputFormatListL(RArray<TUncompressedVideoFormat>& aFormats)
   120 	{
   121 	// append in order 1, 2, 3
   122 	User::LeaveIfError(aFormats.Append(KTestVidFormat1));
   123 	User::LeaveIfError(aFormats.Append(KTestVidFormat2));
   124 	User::LeaveIfError(aFormats.Append(KTestVidFormat3));
   125 	}
   126 
   127 void CMMFTestVideoDecodeHwDevice::SetOutputFormatL(const TUncompressedVideoFormat &aFormat)
   128 	{
   129 	if (!(aFormat == KTestVidFormat1))
   130 		User::Leave(KErrCorrupt);
   131 	}
   132 
   133 void CMMFTestVideoDecodeHwDevice::SetPostProcessTypesL(TUint32 aPostProcCombination)
   134 	{
   135 	if (!(aPostProcCombination == KTestProcessType1))
   136 		User::Leave(KErrCorrupt);
   137 	}
   138 
   139 void CMMFTestVideoDecodeHwDevice::SetInputCropOptionsL(const TRect& aRect)
   140 	{
   141 	TRect testRect(KTestInputCropRectA, KTestInputCropRectB, KTestInputCropRectC, KTestInputCropRectD);
   142 	if (!(aRect == testRect))
   143 		User::Leave(KErrCorrupt);
   144 	}
   145 
   146 void CMMFTestVideoDecodeHwDevice::SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions, const TYuvFormat& aYuvFormat, TRgbFormat aRgbFormat)
   147 	{
   148 	// check options first
   149 	if (!CompareYuvRgbOptions(aOptions, KTestYuvToRgb1))
   150 		User::Leave(KErrCorrupt);
   151 
   152 	// now check formats
   153 	if ( !(CompareYuvFormats(aYuvFormat, KTestYuvFormat1)) || 
   154 		 !(aRgbFormat == KTestRgbFormat1) )
   155 		User::Leave(KErrCorrupt);
   156 	}
   157 
   158 void CMMFTestVideoDecodeHwDevice::SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions)
   159 	{
   160 	if (!CompareYuvRgbOptions(aOptions, KTestYuvToRgb1))
   161 		User::Leave(KErrCorrupt);
   162 	}
   163 
   164 void CMMFTestVideoDecodeHwDevice::SetRotateOptionsL(TRotationType aRotationType)
   165 	{
   166 	if (!(aRotationType == KTestRotate1))
   167 		User::Leave(KErrCorrupt);
   168 	}
   169 
   170 void CMMFTestVideoDecodeHwDevice::SetScaleOptionsL(const TSize& aTargetSize, TBool aAntiAliasFiltering)
   171 	{
   172 	TSize testScale(KTestScaleX, KTestScaleY);
   173 	if (!(aTargetSize == testScale) || !aAntiAliasFiltering)
   174 		User::Leave(KErrCorrupt);
   175 	}
   176 
   177 void CMMFTestVideoDecodeHwDevice::SetOutputCropOptionsL(const TRect& aRect)
   178 	{
   179 	TRect testRect(KTestOutputCropRectA, KTestOutputCropRectB, KTestOutputCropRectC, KTestOutputCropRectD);
   180 	if (!(aRect == testRect))
   181 		User::Leave(KErrCorrupt);
   182 	}
   183 
   184 void CMMFTestVideoDecodeHwDevice::SetPostProcSpecificOptionsL(const TDesC8& aOptions)
   185 	{
   186 	if (!(aOptions == KTestPostProcOptions1))
   187 		User::Leave(KErrCorrupt);
   188 	}
   189 
   190 void CMMFTestVideoDecodeHwDevice::SetClockSource(MMMFClockSource* aClock)
   191 	{
   192 	__ASSERT_ALWAYS(aClock, DevVideoDecoderPanic(EDecoderPanicClockSource)); 
   193 
   194 	// call Time() to check that clock can be used
   195 	TTimeIntervalMicroSeconds currTime(0); // done this way to remove compiler warning
   196 	currTime = aClock->Time();
   197 	}
   198 
   199 void CMMFTestVideoDecodeHwDevice::SetVideoDestScreenL(TBool /*aScreen*/)
   200 	{
   201 	}
   202 
   203 void CMMFTestVideoDecodeHwDevice::Initialize()
   204 	{
   205 	iProxy->MdvppInitializeComplete(this, KErrNone);
   206 	}
   207 
   208 void CMMFTestVideoDecodeHwDevice::StartDirectScreenAccessL(const TRect& aVideoRect, CFbsScreenDevice& /*aScreenDevice*/, const TRegion& aClipRegion)
   209 	{
   210 	TRect dsaRect(KTestDSARectA, KTestDSARectB, KTestDSARectC, KTestDSARectD);
   211 	TRegionFix<1> dsaReg(dsaRect);
   212 
   213 	// probably no need to check aScreenDevice
   214 	if ( /*!(&aScreenDevice) || */!(dsaRect == aVideoRect) || 
   215 		 !(dsaReg.BoundingRect() == aClipRegion.BoundingRect()) )
   216 		 User::Leave(KErrNotSupported);
   217 	}
   218 
   219 void CMMFTestVideoDecodeHwDevice::SetScreenClipRegion(const TRegion& aRegion)
   220 	{
   221 	TRect dsaRect(KTestDSARectA, KTestDSARectB, KTestDSARectC, KTestDSARectD);
   222 	TRegionFix<1> dsaReg(dsaRect);
   223 
   224 	__ASSERT_ALWAYS(dsaReg.BoundingRect() == aRegion.BoundingRect(), 
   225 		DevVideoDecoderPanic(EDecoderPanicScreenClipRegion)); 
   226 	}
   227 
   228 void CMMFTestVideoDecodeHwDevice::SetPauseOnClipFail(TBool aPause)
   229 	{
   230 	__ASSERT_ALWAYS(aPause, DevVideoDecoderPanic(EDecoderPanicPauseClipFail));
   231 	}
   232 
   233 void CMMFTestVideoDecodeHwDevice::AbortDirectScreenAccess()
   234 	{
   235 	// do something here?
   236 	}
   237 
   238 TBool CMMFTestVideoDecodeHwDevice::IsPlaying()
   239 	{
   240 	return iIsPlaying;
   241 	}
   242 
   243 void CMMFTestVideoDecodeHwDevice::Redraw()
   244 	{
   245 	// do something here?
   246 	}
   247 
   248 void CMMFTestVideoDecodeHwDevice::Start()
   249 	{
   250 	iIsPlaying = ETrue;
   251 	}
   252 
   253 void CMMFTestVideoDecodeHwDevice::Stop()
   254 	{
   255 	iIsPlaying = EFalse;
   256 	}
   257 
   258 void CMMFTestVideoDecodeHwDevice::Pause()
   259 	{
   260 	iIsPlaying = EFalse;
   261 	}
   262 
   263 void CMMFTestVideoDecodeHwDevice::Resume()
   264 	{
   265 	iIsPlaying = ETrue;
   266 	}
   267 
   268 void CMMFTestVideoDecodeHwDevice::SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition)
   269 	{
   270 	if (aPlaybackPosition == TTimeIntervalMicroSeconds(KTestPositionFatal))
   271 		{
   272 		iProxy->MdvppFatalError(this, KErrDied);
   273 		}
   274 	else
   275 		{
   276 		__ASSERT_ALWAYS(aPlaybackPosition == TTimeIntervalMicroSeconds(KTestPosition), DevVideoDecoderPanic(EDecoderPanicSetPosition));
   277 		}
   278 	}
   279 
   280 void CMMFTestVideoDecodeHwDevice::FreezePicture(const TTimeIntervalMicroSeconds& aTimestamp)
   281 	{
   282 	__ASSERT_ALWAYS(aTimestamp == TTimeIntervalMicroSeconds(KTestPosition), DevVideoDecoderPanic(EDecoderPanicFreezePicture));
   283 	}
   284 
   285 void CMMFTestVideoDecodeHwDevice::ReleaseFreeze(const TTimeIntervalMicroSeconds& aTimestamp)
   286 	{
   287 	__ASSERT_ALWAYS(aTimestamp == TTimeIntervalMicroSeconds(KTestPosition), DevVideoDecoderPanic(EDecoderPanicReleaseFreeze));
   288 	}
   289 
   290 TTimeIntervalMicroSeconds CMMFTestVideoDecodeHwDevice::PlaybackPosition()
   291 	{
   292 	return TTimeIntervalMicroSeconds(KTestPlayPosition);
   293 	}
   294 
   295 TUint CMMFTestVideoDecodeHwDevice::PictureBufferBytes()
   296 	{
   297 	return KTestPictureBytes;
   298 	}
   299 
   300 void CMMFTestVideoDecodeHwDevice::GetPictureCounters(CMMFDevVideoPlay::TPictureCounters& aCounters)
   301 	{
   302 	aCounters = GetTestPictureCounters();
   303 	}
   304 
   305 void CMMFTestVideoDecodeHwDevice::SetComplexityLevel(TUint aLevel)
   306 	{
   307 	__ASSERT_ALWAYS(aLevel == KTestComplexityLevel1, DevVideoDecoderPanic(EDecoderPanicComplexityLevel));
   308 	}
   309 
   310 TUint CMMFTestVideoDecodeHwDevice::NumComplexityLevels()
   311 	{
   312 	return KTestNumComplexityLevels1;
   313 	}
   314 
   315 void CMMFTestVideoDecodeHwDevice::GetComplexityLevelInfo(TUint aLevel, CMMFDevVideoPlay::TComplexityLevelInfo& aInfo)
   316 	{
   317 	__ASSERT_ALWAYS(aLevel == KTestComplexityLevel1, DevVideoDecoderPanic(EDecoderPanicComplexityLevelInfo));
   318 
   319 	aInfo = GetTestLevelInfo(aLevel);
   320 	}
   321 
   322 void CMMFTestVideoDecodeHwDevice::ReturnPicture(TVideoPicture* /*aPicture*/)
   323 	{
   324 	}
   325 
   326 TBool CMMFTestVideoDecodeHwDevice::GetSnapshotL(TPictureData& /*aPictureData*/, const TUncompressedVideoFormat& /*aFormat*/)
   327 	{
   328 	return EFalse;
   329 	}
   330 
   331 // this method should be called on the post processor not on the decoder
   332 // ending up here is a programming error and hence a PANIC condition
   333 void CMMFTestVideoDecodeHwDevice::GetTimedSnapshotL(TPictureData* /*aPictureData*/, const TUncompressedVideoFormat& /*aFormat*/, const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/)
   334 	{
   335 	DevVideoDecoderPanic(EDecoderPanicTimedSnapshot);
   336 	}
   337 
   338 // this method should be called on the post processor not on the decoder
   339 // ending up here is a programming error and hence a PANIC condition
   340 void CMMFTestVideoDecodeHwDevice::GetTimedSnapshotL(TPictureData* /*aPictureData*/, const TUncompressedVideoFormat& /*aFormat*/, const TPictureId& /*aPictureId*/)
   341 	{
   342 	DevVideoDecoderPanic(EDecoderPanicTimedSnapshotId);
   343 	}
   344 
   345 // this method should be called on the post processor not on the decoder
   346 // ending up here is a programming error and hence a PANIC condition
   347 void CMMFTestVideoDecodeHwDevice::CancelTimedSnapshot()
   348 	{
   349 	DevVideoDecoderPanic(EDecoderPanicCancelTimedSnapshot);
   350 	}
   351 
   352 // this method should be called on the post processor not on the decoder
   353 // ending up here is a programming error and hence a PANIC condition
   354 void CMMFTestVideoDecodeHwDevice::GetSupportedSnapshotFormatsL(RArray<TUncompressedVideoFormat>& /*aFormats*/)
   355 	{
   356 	DevVideoDecoderPanic(EDecoderPanicSupportedSnapshotFormats);
   357 	}
   358 
   359 void CMMFTestVideoDecodeHwDevice::InputEnd()
   360 	{
   361 	iProxy->MdvppStreamEnd();
   362 	}
   363 
   364 CVideoDecoderInfo* CMMFTestVideoDecodeHwDevice::VideoDecoderInfoLC()
   365 	{
   366 	// construct array of test types
   367 	for (TUint i = 0; i < KTestDecoderInfoCount; i++)
   368 		{
   369 		// construct the video types for iVidTypes
   370 		CCompressedVideoFormat* vid = NULL;
   371 		TPtrC8 mimeType = KTestDecoderInfoMimeArray[i];
   372 		vid = GetTestCVFormatL(mimeType);
   373 		CleanupStack::PushL(vid);
   374 		User::LeaveIfError(iVidFormats.Append(vid));
   375 		CleanupStack::Pop(vid);	// CCompressedVideo object is destroyed in destructor
   376 
   377 		// append the max picture rates
   378 		TPictureRateAndSize rate;
   379 		GetTestEncoderInfoRate(i, rate);
   380 		User::LeaveIfError(iPictureRates.Append(rate));
   381 		}
   382 	
   383 	// construct the video decoder info object
   384 	CVideoDecoderInfo* vInfo = CVideoDecoderInfo::NewL(
   385 		KUidDevVideoTestDecodeHwDevice,
   386 		KTestDecoderInfoManufacturer,
   387 		KTestDecoderInfoIdentifier,
   388 		TVersion(KTestDecoderInfoVersionMaj, KTestDecoderInfoVersionMin, KTestDecoderInfoVersionBuild),
   389 		iVidFormats.Array(),
   390 		ETrue,	// accelerated
   391 		ETrue,	// supports direct display
   392 		TSize(KTestDecoderInfoMaxSizeX,KTestDecoderInfoMaxSizeY),
   393 		KMaxTUint, //aMaxBitrate
   394 		iPictureRates.Array(),
   395 		ETrue,	// aSupportsPictureLoss
   396 		EFalse, // aSupportsSliceLoss
   397 		KTestDecoderInfoCSInfo,
   398 		KTestDecoderInfoISInfo );
   399 	CleanupStack::PushL(vInfo);
   400 #ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
   401 	vInfo->AddSupportedScreenL(KDecoderDefaultScreenNumber);
   402 	vInfo->AddSupportedScreenL(KDecoderSecondaryScreenNumber);
   403 #endif
   404 	vInfo->SetSupportsContentProtected(ETrue);
   405 	return vInfo;
   406 	}
   407 
   408 
   409 TVideoPictureHeader* CMMFTestVideoDecodeHwDevice::GetHeaderInformationL(TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation, TVideoInputBuffer* aDataUnit)
   410 	{
   411 	// check KTestDataUnitType, KTestDataUnitEncap
   412 	if ((aDataUnitType != KTestDataUnitType) || 
   413 		(aEncapsulation != KTestDataUnitEncap) ||
   414 		(aDataUnit->iOptions != KTestInputBufferOptions) )
   415 		{
   416 		User::Leave(KErrCorrupt);
   417 		}
   418 	
   419 	// repackage picture header
   420 	iPictureHeader.iOptions = KTestPictureHeaderOptions;
   421 	iPictureHeader.iPresentationTimestamp = aDataUnit->iPresentationTimestamp;
   422 	iPictureHeader.iOptional = &(aDataUnit->iData);
   423 	return &iPictureHeader;
   424 	}
   425 
   426 void CMMFTestVideoDecodeHwDevice::ConfigureDecoderL(const TVideoPictureHeader& aVideoPictureHeader)
   427 	{
   428 	TTimeIntervalMicroSeconds testTime(KTestInputBufferTimestamp);
   429 
   430 	// check the picture header
   431 	if (  (aVideoPictureHeader.iOptions != KTestPictureHeaderOptions)
   432 		||(!(aVideoPictureHeader.iPresentationTimestamp == testTime))
   433 		||(!(*(aVideoPictureHeader.iOptional) == KTestInputBufferData())))
   434 		{
   435 		User::Leave(KErrCorrupt);
   436 		}
   437 
   438 	iPictureHeader = aVideoPictureHeader;
   439 	}
   440 
   441 void CMMFTestVideoDecodeHwDevice::ReturnHeader(TVideoPictureHeader* aHeader)
   442 	{
   443 	__ASSERT_ALWAYS(aHeader, DevVideoDecoderPanic(EDecoderPanicPictureHeader)); 
   444 	__ASSERT_ALWAYS(aHeader->iOptions == KTestPictureHeaderOptions, DevVideoDecoderPanic(EDecoderPanicPictureHeaderOptions));
   445 	__ASSERT_ALWAYS(aHeader->iPresentationTimestamp == TTimeIntervalMicroSeconds(KTestPictureHeaderTimestamp), DevVideoDecoderPanic(EDecoderPanicPictureHeaderTimestamp));
   446 	}
   447 
   448 void CMMFTestVideoDecodeHwDevice::SetInputFormatL(const CCompressedVideoFormat& aFormat, TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation, TBool aDataInOrder)
   449 	{
   450 	// check expected parameters - TClasses first
   451 	if (!((aDataUnitType == KTestUnitType1) && (aEncapsulation == KTestEncapType1) && (aDataInOrder)))
   452 		User::Leave(KErrCorrupt);
   453 	
   454 	// construct a temporary compressed video class	[will leave on error]
   455 	CCompressedVideoFormat *compVideo = GetTestCVFormatL(KTestMimeType1);
   456 	CleanupStack::PushL(compVideo);
   457 
   458 	// compare to received class
   459 	if (!(aFormat == *compVideo))
   460 		User::Leave(KErrCorrupt);
   461 
   462 	// destroy temporary class
   463 	CleanupStack::PopAndDestroy(compVideo);
   464 	}
   465 
   466 void CMMFTestVideoDecodeHwDevice::SynchronizeDecoding(TBool aSynchronize)
   467 	{
   468 	__ASSERT_ALWAYS(aSynchronize, DevVideoDecoderPanic(EDecoderPanicSynchronizeDecoding)); 
   469 	}
   470 
   471 void CMMFTestVideoDecodeHwDevice::SetBufferOptionsL(const CMMFDevVideoPlay::TBufferOptions& aOptions)
   472 	{
   473 	CMMFDevVideoPlay::TBufferOptions buffOptions = GetTestBufferOptions();
   474 
   475 	if (!CompareBufferOptions(aOptions, buffOptions))
   476 		User::Leave(KErrCorrupt);
   477 	}
   478 
   479 void CMMFTestVideoDecodeHwDevice::GetBufferOptions(CMMFDevVideoPlay::TBufferOptions& aOptions)
   480 	{
   481 	aOptions = GetTestBufferOptions();
   482 	}
   483 
   484 void CMMFTestVideoDecodeHwDevice::SetHrdVbvSpec(THrdVbvSpecification aHrdVbvSpec, const TDesC8& aHrdVbvParams)
   485 	{
   486 	__ASSERT_ALWAYS(aHrdVbvSpec == KTestHrdVbvSpec, DevVideoDecoderPanic(EDecoderPanicHrdVbvSpec)); 
   487 	__ASSERT_ALWAYS(aHrdVbvParams == KTestHrdVbvParams, DevVideoDecoderPanic(EDecoderPanicHrdVbvParams));
   488 	}
   489 
   490 void CMMFTestVideoDecodeHwDevice::SetOutputDevice(CMMFVideoPostProcHwDevice* /*aDevice*/)
   491 	{
   492 	}
   493 
   494 TTimeIntervalMicroSeconds CMMFTestVideoDecodeHwDevice::DecodingPosition()
   495 	{
   496 	return TTimeIntervalMicroSeconds(KTestDecodePosition);
   497 	}
   498 
   499 TUint CMMFTestVideoDecodeHwDevice::PreDecoderBufferBytes()
   500 	{
   501 	return KTestPreDecoderBytes;
   502 	}
   503 
   504 void CMMFTestVideoDecodeHwDevice::GetBitstreamCounters(CMMFDevVideoPlay::TBitstreamCounters& aCounters)
   505 	{
   506 	aCounters = GetTestBitstreamCounters();
   507 	}
   508 
   509 TUint CMMFTestVideoDecodeHwDevice::NumFreeBuffers()
   510 	{
   511 	return KTestNumFreeBuffers;
   512 	}
   513 
   514 TVideoInputBuffer* CMMFTestVideoDecodeHwDevice::GetBufferL(TUint aBufferSize)
   515 	{
   516 	if (!iBufferDataArea)
   517 		{
   518 		TPtrC8 testBufferString(KTestBufferString);
   519 		iBufferDataArea = testBufferString.AllocL();
   520 		}
   521 
   522 	TPtr8 dataAreaPtr = iBufferDataArea->Des();
   523 	TInt reqBufferSize = aBufferSize;
   524 	if (reqBufferSize > dataAreaPtr.MaxLength())
   525 		User::Leave(KErrTooBig);
   526 
   527 	// initialize iInputBuffer with test data
   528 	iInputBuffer.iOptions = KTestBufferOptions;
   529 	iInputBuffer.iDecodingTimestamp = aBufferSize;
   530 	iInputBuffer.iData.Set(dataAreaPtr);
   531 
   532 	// call new buffer callback
   533 	iProxy->MdvppNewBuffers();
   534 
   535 	return &iInputBuffer;
   536 	}
   537 
   538 void CMMFTestVideoDecodeHwDevice::WriteCodedDataL(TVideoInputBuffer* aBuffer)
   539 	{
   540 	TTimeIntervalMicroSeconds testTime(KTestBufferSize);
   541 
   542 	// check received buffer against test data
   543 	if (!(aBuffer->iOptions == KTestBufferOptions) ||
   544 		!(aBuffer->iDecodingTimestamp == testTime) ||
   545 		!(aBuffer->iData == KTestBufferString))
   546 		{
   547 		User::Leave(KErrCorrupt);
   548 		}
   549 	}
   550 
   551 void CMMFTestVideoDecodeHwDevice::WriteCodedDataL(TVideoInputBuffer* aBuffer, TFramePortion aPortion)
   552 	{
   553 	TTimeIntervalMicroSeconds testTime(KTestBufferSize);
   554 
   555 	// check received buffer against test data
   556 	if  ((aPortion != EFramePortionEndFragment) ||
   557 		!(aBuffer->iOptions == KTestBufferOptions) ||
   558 		!(aBuffer->iDecodingTimestamp == testTime) ||
   559 		!(aBuffer->iData == KTestBufferString))
   560 		{
   561 		User::Leave(KErrCorrupt);
   562 		}
   563 	}
   564 
   565 void CMMFTestVideoDecodeHwDevice::ScanAndCopyCodedDataL(TPtr8 aCodedData, TVideoInputBuffer* aBuffer, TInt& aConsumed, TFramePortion aPortion)
   566 	{
   567 	//compare ptr data to test data
   568 	if ((aPortion != EFramePortionEndFragment) ||
   569 		(aCodedData != KTestBufferString))
   570 		{
   571 		User::Leave(KErrCorrupt);
   572 		}
   573 	//copy data into buffer
   574 	aBuffer->iData.Set(aCodedData);
   575 	aConsumed = aBuffer->iData.Length();
   576 	}
   577 
   578 void CMMFTestVideoDecodeHwDevice::CommitL()
   579 	{
   580 	}
   581 
   582 void CMMFTestVideoDecodeHwDevice::Revert()
   583 	{
   584 	}
   585 
   586 void CMMFTestVideoDecodeHwDevice::SetProxy(MMMFDevVideoPlayProxy& aProxy)
   587 	{
   588 	ASSERT(iProxy == NULL);
   589 	iProxy = &aProxy;
   590 	}