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