1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevVideo/src/TestDevVideoPlugins/decoder.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,590 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "decoder.h"
1.20 +#include "../TestDevVideoPlayTestData.h"
1.21 +
1.22 +_LIT(KDevVideoDecoderPanicCategory, "DevVideoDecoder");
1.23 +void DevVideoDecoderPanic(TInt aReason)
1.24 + {
1.25 + User::Panic(KDevVideoDecoderPanicCategory, aReason);
1.26 + }
1.27 +
1.28 +CMMFVideoDecodeHwDevice* CMMFTestVideoDecodeHwDevice::NewL(TAny* /*aInitParams*/)
1.29 + {
1.30 + CMMFTestVideoDecodeHwDevice* s = new(ELeave) CMMFTestVideoDecodeHwDevice;
1.31 + return (STATIC_CAST(CMMFVideoDecodeHwDevice*, s));
1.32 + }
1.33 +
1.34 +CMMFTestVideoDecodeHwDevice::CMMFTestVideoDecodeHwDevice()
1.35 + :iExtensionUid(KUidDevVideoPlayHwDeviceExtensionScanCopy)
1.36 + {
1.37 + }
1.38 +
1.39 +CMMFTestVideoDecodeHwDevice::~CMMFTestVideoDecodeHwDevice()
1.40 + {
1.41 + // destroy objects in RArray
1.42 + for (TInt i = 0; i < iVidFormats.Count(); i++)
1.43 + {
1.44 + delete iVidFormats[i];
1.45 + }
1.46 +
1.47 + iVidFormats.Reset();
1.48 + iVidFormats.Close();
1.49 +
1.50 + iPictureRates.Reset();
1.51 + iPictureRates.Close();
1.52 +
1.53 + iCombinations.Reset();
1.54 + iCombinations.Close();
1.55 +
1.56 + iPostProcVidFormats.Reset();
1.57 + iPostProcVidFormats.Close();
1.58 +
1.59 + iScaleFactors.Reset();
1.60 + iScaleFactors.Close();
1.61 +
1.62 + delete iBufferDataArea;
1.63 + }
1.64 +
1.65 +TAny* CMMFTestVideoDecodeHwDevice::CustomInterface(TUid aInterface)
1.66 + {
1.67 + if (aInterface == KUidCustomInterfaceOne)
1.68 + {
1.69 + return this;//just want to return something non-null!
1.70 + }
1.71 + else if (aInterface == iExtensionUid)
1.72 + {
1.73 + return static_cast<MMMFVideoPlayHwDeviceExtensionScanCopy*>(this);
1.74 + }
1.75 + else
1.76 + {
1.77 + return NULL;
1.78 + }
1.79 + }
1.80 +
1.81 +// post processor info may be obtained from this plugin or the post processor plugin
1.82 +CPostProcessorInfo* CMMFTestVideoDecodeHwDevice::PostProcessorInfoLC()
1.83 + {
1.84 + // construct array of test types
1.85 + for (TUint i = 0; i < KTestPostProcInfoCount; i++)
1.86 + {
1.87 + // append the video formats
1.88 + TUncompressedVideoFormat vid = KTestPostProcInfoFormatArray[i];
1.89 + User::LeaveIfError(iPostProcVidFormats.Append(vid));
1.90 +
1.91 + // append the combinations
1.92 + TUint32 comb = KTestPostProcInfoCombsArray[i];
1.93 + User::LeaveIfError(iCombinations.Append(comb));
1.94 +
1.95 + // append the scale factors
1.96 + TScaleFactor scale = KTestPostProcInfoScaleFactorsArray[i];
1.97 + User::LeaveIfError(iScaleFactors.Append(scale));
1.98 + }
1.99 +
1.100 + // construct the video decoder info object
1.101 + CPostProcessorInfo* info = CPostProcessorInfo::NewL( KUidDevVideoTestDecodeHwDevice,
1.102 + KTestPostProcInfoManufacturer,
1.103 + KTestPostProcInfoIdentifier,
1.104 + TVersion(KTestPostProcInfoVersionMaj,
1.105 + KTestPostProcInfoVersionMin,
1.106 + KTestPostProcInfoVersionBuild),
1.107 + iPostProcVidFormats.Array(),
1.108 + iCombinations.Array(),
1.109 + ETrue, // accelerated
1.110 + ETrue, // direct display support
1.111 + KTestPostProcInfoYuvToRgbCaps,
1.112 + KTestPostProcInfoRotations,
1.113 + ETrue, // scaling
1.114 + iScaleFactors.Array(),
1.115 + ETrue, // anti-aliasing
1.116 + KTestDecoderInfoISInfo );
1.117 + CleanupStack::PushL(info);
1.118 +
1.119 + return info;
1.120 + }
1.121 +
1.122 +void CMMFTestVideoDecodeHwDevice::GetOutputFormatListL(RArray<TUncompressedVideoFormat>& aFormats)
1.123 + {
1.124 + // append in order 1, 2, 3
1.125 + User::LeaveIfError(aFormats.Append(KTestVidFormat1));
1.126 + User::LeaveIfError(aFormats.Append(KTestVidFormat2));
1.127 + User::LeaveIfError(aFormats.Append(KTestVidFormat3));
1.128 + }
1.129 +
1.130 +void CMMFTestVideoDecodeHwDevice::SetOutputFormatL(const TUncompressedVideoFormat &aFormat)
1.131 + {
1.132 + if (!(aFormat == KTestVidFormat1))
1.133 + User::Leave(KErrCorrupt);
1.134 + }
1.135 +
1.136 +void CMMFTestVideoDecodeHwDevice::SetPostProcessTypesL(TUint32 aPostProcCombination)
1.137 + {
1.138 + if (!(aPostProcCombination == KTestProcessType1))
1.139 + User::Leave(KErrCorrupt);
1.140 + }
1.141 +
1.142 +void CMMFTestVideoDecodeHwDevice::SetInputCropOptionsL(const TRect& aRect)
1.143 + {
1.144 + TRect testRect(KTestInputCropRectA, KTestInputCropRectB, KTestInputCropRectC, KTestInputCropRectD);
1.145 + if (!(aRect == testRect))
1.146 + User::Leave(KErrCorrupt);
1.147 + }
1.148 +
1.149 +void CMMFTestVideoDecodeHwDevice::SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions, const TYuvFormat& aYuvFormat, TRgbFormat aRgbFormat)
1.150 + {
1.151 + // check options first
1.152 + if (!CompareYuvRgbOptions(aOptions, KTestYuvToRgb1))
1.153 + User::Leave(KErrCorrupt);
1.154 +
1.155 + // now check formats
1.156 + if ( !(CompareYuvFormats(aYuvFormat, KTestYuvFormat1)) ||
1.157 + !(aRgbFormat == KTestRgbFormat1) )
1.158 + User::Leave(KErrCorrupt);
1.159 + }
1.160 +
1.161 +void CMMFTestVideoDecodeHwDevice::SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions)
1.162 + {
1.163 + if (!CompareYuvRgbOptions(aOptions, KTestYuvToRgb1))
1.164 + User::Leave(KErrCorrupt);
1.165 + }
1.166 +
1.167 +void CMMFTestVideoDecodeHwDevice::SetRotateOptionsL(TRotationType aRotationType)
1.168 + {
1.169 + if (!(aRotationType == KTestRotate1))
1.170 + User::Leave(KErrCorrupt);
1.171 + }
1.172 +
1.173 +void CMMFTestVideoDecodeHwDevice::SetScaleOptionsL(const TSize& aTargetSize, TBool aAntiAliasFiltering)
1.174 + {
1.175 + TSize testScale(KTestScaleX, KTestScaleY);
1.176 + if (!(aTargetSize == testScale) || !aAntiAliasFiltering)
1.177 + User::Leave(KErrCorrupt);
1.178 + }
1.179 +
1.180 +void CMMFTestVideoDecodeHwDevice::SetOutputCropOptionsL(const TRect& aRect)
1.181 + {
1.182 + TRect testRect(KTestOutputCropRectA, KTestOutputCropRectB, KTestOutputCropRectC, KTestOutputCropRectD);
1.183 + if (!(aRect == testRect))
1.184 + User::Leave(KErrCorrupt);
1.185 + }
1.186 +
1.187 +void CMMFTestVideoDecodeHwDevice::SetPostProcSpecificOptionsL(const TDesC8& aOptions)
1.188 + {
1.189 + if (!(aOptions == KTestPostProcOptions1))
1.190 + User::Leave(KErrCorrupt);
1.191 + }
1.192 +
1.193 +void CMMFTestVideoDecodeHwDevice::SetClockSource(MMMFClockSource* aClock)
1.194 + {
1.195 + __ASSERT_ALWAYS(aClock, DevVideoDecoderPanic(EDecoderPanicClockSource));
1.196 +
1.197 + // call Time() to check that clock can be used
1.198 + TTimeIntervalMicroSeconds currTime(0); // done this way to remove compiler warning
1.199 + currTime = aClock->Time();
1.200 + }
1.201 +
1.202 +void CMMFTestVideoDecodeHwDevice::SetVideoDestScreenL(TBool /*aScreen*/)
1.203 + {
1.204 + }
1.205 +
1.206 +void CMMFTestVideoDecodeHwDevice::Initialize()
1.207 + {
1.208 + iProxy->MdvppInitializeComplete(this, KErrNone);
1.209 + }
1.210 +
1.211 +void CMMFTestVideoDecodeHwDevice::StartDirectScreenAccessL(const TRect& aVideoRect, CFbsScreenDevice& /*aScreenDevice*/, const TRegion& aClipRegion)
1.212 + {
1.213 + TRect dsaRect(KTestDSARectA, KTestDSARectB, KTestDSARectC, KTestDSARectD);
1.214 + TRegionFix<1> dsaReg(dsaRect);
1.215 +
1.216 + // probably no need to check aScreenDevice
1.217 + if ( /*!(&aScreenDevice) || */!(dsaRect == aVideoRect) ||
1.218 + !(dsaReg.BoundingRect() == aClipRegion.BoundingRect()) )
1.219 + User::Leave(KErrNotSupported);
1.220 + }
1.221 +
1.222 +void CMMFTestVideoDecodeHwDevice::SetScreenClipRegion(const TRegion& aRegion)
1.223 + {
1.224 + TRect dsaRect(KTestDSARectA, KTestDSARectB, KTestDSARectC, KTestDSARectD);
1.225 + TRegionFix<1> dsaReg(dsaRect);
1.226 +
1.227 + __ASSERT_ALWAYS(dsaReg.BoundingRect() == aRegion.BoundingRect(),
1.228 + DevVideoDecoderPanic(EDecoderPanicScreenClipRegion));
1.229 + }
1.230 +
1.231 +void CMMFTestVideoDecodeHwDevice::SetPauseOnClipFail(TBool aPause)
1.232 + {
1.233 + __ASSERT_ALWAYS(aPause, DevVideoDecoderPanic(EDecoderPanicPauseClipFail));
1.234 + }
1.235 +
1.236 +void CMMFTestVideoDecodeHwDevice::AbortDirectScreenAccess()
1.237 + {
1.238 + // do something here?
1.239 + }
1.240 +
1.241 +TBool CMMFTestVideoDecodeHwDevice::IsPlaying()
1.242 + {
1.243 + return iIsPlaying;
1.244 + }
1.245 +
1.246 +void CMMFTestVideoDecodeHwDevice::Redraw()
1.247 + {
1.248 + // do something here?
1.249 + }
1.250 +
1.251 +void CMMFTestVideoDecodeHwDevice::Start()
1.252 + {
1.253 + iIsPlaying = ETrue;
1.254 + }
1.255 +
1.256 +void CMMFTestVideoDecodeHwDevice::Stop()
1.257 + {
1.258 + iIsPlaying = EFalse;
1.259 + }
1.260 +
1.261 +void CMMFTestVideoDecodeHwDevice::Pause()
1.262 + {
1.263 + iIsPlaying = EFalse;
1.264 + }
1.265 +
1.266 +void CMMFTestVideoDecodeHwDevice::Resume()
1.267 + {
1.268 + iIsPlaying = ETrue;
1.269 + }
1.270 +
1.271 +void CMMFTestVideoDecodeHwDevice::SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition)
1.272 + {
1.273 + if (aPlaybackPosition == TTimeIntervalMicroSeconds(KTestPositionFatal))
1.274 + {
1.275 + iProxy->MdvppFatalError(this, KErrDied);
1.276 + }
1.277 + else
1.278 + {
1.279 + __ASSERT_ALWAYS(aPlaybackPosition == TTimeIntervalMicroSeconds(KTestPosition), DevVideoDecoderPanic(EDecoderPanicSetPosition));
1.280 + }
1.281 + }
1.282 +
1.283 +void CMMFTestVideoDecodeHwDevice::FreezePicture(const TTimeIntervalMicroSeconds& aTimestamp)
1.284 + {
1.285 + __ASSERT_ALWAYS(aTimestamp == TTimeIntervalMicroSeconds(KTestPosition), DevVideoDecoderPanic(EDecoderPanicFreezePicture));
1.286 + }
1.287 +
1.288 +void CMMFTestVideoDecodeHwDevice::ReleaseFreeze(const TTimeIntervalMicroSeconds& aTimestamp)
1.289 + {
1.290 + __ASSERT_ALWAYS(aTimestamp == TTimeIntervalMicroSeconds(KTestPosition), DevVideoDecoderPanic(EDecoderPanicReleaseFreeze));
1.291 + }
1.292 +
1.293 +TTimeIntervalMicroSeconds CMMFTestVideoDecodeHwDevice::PlaybackPosition()
1.294 + {
1.295 + return TTimeIntervalMicroSeconds(KTestPlayPosition);
1.296 + }
1.297 +
1.298 +TUint CMMFTestVideoDecodeHwDevice::PictureBufferBytes()
1.299 + {
1.300 + return KTestPictureBytes;
1.301 + }
1.302 +
1.303 +void CMMFTestVideoDecodeHwDevice::GetPictureCounters(CMMFDevVideoPlay::TPictureCounters& aCounters)
1.304 + {
1.305 + aCounters = GetTestPictureCounters();
1.306 + }
1.307 +
1.308 +void CMMFTestVideoDecodeHwDevice::SetComplexityLevel(TUint aLevel)
1.309 + {
1.310 + __ASSERT_ALWAYS(aLevel == KTestComplexityLevel1, DevVideoDecoderPanic(EDecoderPanicComplexityLevel));
1.311 + }
1.312 +
1.313 +TUint CMMFTestVideoDecodeHwDevice::NumComplexityLevels()
1.314 + {
1.315 + return KTestNumComplexityLevels1;
1.316 + }
1.317 +
1.318 +void CMMFTestVideoDecodeHwDevice::GetComplexityLevelInfo(TUint aLevel, CMMFDevVideoPlay::TComplexityLevelInfo& aInfo)
1.319 + {
1.320 + __ASSERT_ALWAYS(aLevel == KTestComplexityLevel1, DevVideoDecoderPanic(EDecoderPanicComplexityLevelInfo));
1.321 +
1.322 + aInfo = GetTestLevelInfo(aLevel);
1.323 + }
1.324 +
1.325 +void CMMFTestVideoDecodeHwDevice::ReturnPicture(TVideoPicture* /*aPicture*/)
1.326 + {
1.327 + }
1.328 +
1.329 +TBool CMMFTestVideoDecodeHwDevice::GetSnapshotL(TPictureData& /*aPictureData*/, const TUncompressedVideoFormat& /*aFormat*/)
1.330 + {
1.331 + return EFalse;
1.332 + }
1.333 +
1.334 +// this method should be called on the post processor not on the decoder
1.335 +// ending up here is a programming error and hence a PANIC condition
1.336 +void CMMFTestVideoDecodeHwDevice::GetTimedSnapshotL(TPictureData* /*aPictureData*/, const TUncompressedVideoFormat& /*aFormat*/, const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/)
1.337 + {
1.338 + DevVideoDecoderPanic(EDecoderPanicTimedSnapshot);
1.339 + }
1.340 +
1.341 +// this method should be called on the post processor not on the decoder
1.342 +// ending up here is a programming error and hence a PANIC condition
1.343 +void CMMFTestVideoDecodeHwDevice::GetTimedSnapshotL(TPictureData* /*aPictureData*/, const TUncompressedVideoFormat& /*aFormat*/, const TPictureId& /*aPictureId*/)
1.344 + {
1.345 + DevVideoDecoderPanic(EDecoderPanicTimedSnapshotId);
1.346 + }
1.347 +
1.348 +// this method should be called on the post processor not on the decoder
1.349 +// ending up here is a programming error and hence a PANIC condition
1.350 +void CMMFTestVideoDecodeHwDevice::CancelTimedSnapshot()
1.351 + {
1.352 + DevVideoDecoderPanic(EDecoderPanicCancelTimedSnapshot);
1.353 + }
1.354 +
1.355 +// this method should be called on the post processor not on the decoder
1.356 +// ending up here is a programming error and hence a PANIC condition
1.357 +void CMMFTestVideoDecodeHwDevice::GetSupportedSnapshotFormatsL(RArray<TUncompressedVideoFormat>& /*aFormats*/)
1.358 + {
1.359 + DevVideoDecoderPanic(EDecoderPanicSupportedSnapshotFormats);
1.360 + }
1.361 +
1.362 +void CMMFTestVideoDecodeHwDevice::InputEnd()
1.363 + {
1.364 + iProxy->MdvppStreamEnd();
1.365 + }
1.366 +
1.367 +CVideoDecoderInfo* CMMFTestVideoDecodeHwDevice::VideoDecoderInfoLC()
1.368 + {
1.369 + // construct array of test types
1.370 + for (TUint i = 0; i < KTestDecoderInfoCount; i++)
1.371 + {
1.372 + // construct the video types for iVidTypes
1.373 + CCompressedVideoFormat* vid = NULL;
1.374 + TPtrC8 mimeType = KTestDecoderInfoMimeArray[i];
1.375 + vid = GetTestCVFormatL(mimeType);
1.376 + CleanupStack::PushL(vid);
1.377 + User::LeaveIfError(iVidFormats.Append(vid));
1.378 + CleanupStack::Pop(vid); // CCompressedVideo object is destroyed in destructor
1.379 +
1.380 + // append the max picture rates
1.381 + TPictureRateAndSize rate;
1.382 + GetTestEncoderInfoRate(i, rate);
1.383 + User::LeaveIfError(iPictureRates.Append(rate));
1.384 + }
1.385 +
1.386 + // construct the video decoder info object
1.387 + CVideoDecoderInfo* vInfo = CVideoDecoderInfo::NewL(
1.388 + KUidDevVideoTestDecodeHwDevice,
1.389 + KTestDecoderInfoManufacturer,
1.390 + KTestDecoderInfoIdentifier,
1.391 + TVersion(KTestDecoderInfoVersionMaj, KTestDecoderInfoVersionMin, KTestDecoderInfoVersionBuild),
1.392 + iVidFormats.Array(),
1.393 + ETrue, // accelerated
1.394 + ETrue, // supports direct display
1.395 + TSize(KTestDecoderInfoMaxSizeX,KTestDecoderInfoMaxSizeY),
1.396 + KMaxTUint, //aMaxBitrate
1.397 + iPictureRates.Array(),
1.398 + ETrue, // aSupportsPictureLoss
1.399 + EFalse, // aSupportsSliceLoss
1.400 + KTestDecoderInfoCSInfo,
1.401 + KTestDecoderInfoISInfo );
1.402 + CleanupStack::PushL(vInfo);
1.403 +#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
1.404 + vInfo->AddSupportedScreenL(KDecoderDefaultScreenNumber);
1.405 + vInfo->AddSupportedScreenL(KDecoderSecondaryScreenNumber);
1.406 +#endif
1.407 + vInfo->SetSupportsContentProtected(ETrue);
1.408 + return vInfo;
1.409 + }
1.410 +
1.411 +
1.412 +TVideoPictureHeader* CMMFTestVideoDecodeHwDevice::GetHeaderInformationL(TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation, TVideoInputBuffer* aDataUnit)
1.413 + {
1.414 + // check KTestDataUnitType, KTestDataUnitEncap
1.415 + if ((aDataUnitType != KTestDataUnitType) ||
1.416 + (aEncapsulation != KTestDataUnitEncap) ||
1.417 + (aDataUnit->iOptions != KTestInputBufferOptions) )
1.418 + {
1.419 + User::Leave(KErrCorrupt);
1.420 + }
1.421 +
1.422 + // repackage picture header
1.423 + iPictureHeader.iOptions = KTestPictureHeaderOptions;
1.424 + iPictureHeader.iPresentationTimestamp = aDataUnit->iPresentationTimestamp;
1.425 + iPictureHeader.iOptional = &(aDataUnit->iData);
1.426 + return &iPictureHeader;
1.427 + }
1.428 +
1.429 +void CMMFTestVideoDecodeHwDevice::ConfigureDecoderL(const TVideoPictureHeader& aVideoPictureHeader)
1.430 + {
1.431 + TTimeIntervalMicroSeconds testTime(KTestInputBufferTimestamp);
1.432 +
1.433 + // check the picture header
1.434 + if ( (aVideoPictureHeader.iOptions != KTestPictureHeaderOptions)
1.435 + ||(!(aVideoPictureHeader.iPresentationTimestamp == testTime))
1.436 + ||(!(*(aVideoPictureHeader.iOptional) == KTestInputBufferData())))
1.437 + {
1.438 + User::Leave(KErrCorrupt);
1.439 + }
1.440 +
1.441 + iPictureHeader = aVideoPictureHeader;
1.442 + }
1.443 +
1.444 +void CMMFTestVideoDecodeHwDevice::ReturnHeader(TVideoPictureHeader* aHeader)
1.445 + {
1.446 + __ASSERT_ALWAYS(aHeader, DevVideoDecoderPanic(EDecoderPanicPictureHeader));
1.447 + __ASSERT_ALWAYS(aHeader->iOptions == KTestPictureHeaderOptions, DevVideoDecoderPanic(EDecoderPanicPictureHeaderOptions));
1.448 + __ASSERT_ALWAYS(aHeader->iPresentationTimestamp == TTimeIntervalMicroSeconds(KTestPictureHeaderTimestamp), DevVideoDecoderPanic(EDecoderPanicPictureHeaderTimestamp));
1.449 + }
1.450 +
1.451 +void CMMFTestVideoDecodeHwDevice::SetInputFormatL(const CCompressedVideoFormat& aFormat, TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation, TBool aDataInOrder)
1.452 + {
1.453 + // check expected parameters - TClasses first
1.454 + if (!((aDataUnitType == KTestUnitType1) && (aEncapsulation == KTestEncapType1) && (aDataInOrder)))
1.455 + User::Leave(KErrCorrupt);
1.456 +
1.457 + // construct a temporary compressed video class [will leave on error]
1.458 + CCompressedVideoFormat *compVideo = GetTestCVFormatL(KTestMimeType1);
1.459 + CleanupStack::PushL(compVideo);
1.460 +
1.461 + // compare to received class
1.462 + if (!(aFormat == *compVideo))
1.463 + User::Leave(KErrCorrupt);
1.464 +
1.465 + // destroy temporary class
1.466 + CleanupStack::PopAndDestroy(compVideo);
1.467 + }
1.468 +
1.469 +void CMMFTestVideoDecodeHwDevice::SynchronizeDecoding(TBool aSynchronize)
1.470 + {
1.471 + __ASSERT_ALWAYS(aSynchronize, DevVideoDecoderPanic(EDecoderPanicSynchronizeDecoding));
1.472 + }
1.473 +
1.474 +void CMMFTestVideoDecodeHwDevice::SetBufferOptionsL(const CMMFDevVideoPlay::TBufferOptions& aOptions)
1.475 + {
1.476 + CMMFDevVideoPlay::TBufferOptions buffOptions = GetTestBufferOptions();
1.477 +
1.478 + if (!CompareBufferOptions(aOptions, buffOptions))
1.479 + User::Leave(KErrCorrupt);
1.480 + }
1.481 +
1.482 +void CMMFTestVideoDecodeHwDevice::GetBufferOptions(CMMFDevVideoPlay::TBufferOptions& aOptions)
1.483 + {
1.484 + aOptions = GetTestBufferOptions();
1.485 + }
1.486 +
1.487 +void CMMFTestVideoDecodeHwDevice::SetHrdVbvSpec(THrdVbvSpecification aHrdVbvSpec, const TDesC8& aHrdVbvParams)
1.488 + {
1.489 + __ASSERT_ALWAYS(aHrdVbvSpec == KTestHrdVbvSpec, DevVideoDecoderPanic(EDecoderPanicHrdVbvSpec));
1.490 + __ASSERT_ALWAYS(aHrdVbvParams == KTestHrdVbvParams, DevVideoDecoderPanic(EDecoderPanicHrdVbvParams));
1.491 + }
1.492 +
1.493 +void CMMFTestVideoDecodeHwDevice::SetOutputDevice(CMMFVideoPostProcHwDevice* /*aDevice*/)
1.494 + {
1.495 + }
1.496 +
1.497 +TTimeIntervalMicroSeconds CMMFTestVideoDecodeHwDevice::DecodingPosition()
1.498 + {
1.499 + return TTimeIntervalMicroSeconds(KTestDecodePosition);
1.500 + }
1.501 +
1.502 +TUint CMMFTestVideoDecodeHwDevice::PreDecoderBufferBytes()
1.503 + {
1.504 + return KTestPreDecoderBytes;
1.505 + }
1.506 +
1.507 +void CMMFTestVideoDecodeHwDevice::GetBitstreamCounters(CMMFDevVideoPlay::TBitstreamCounters& aCounters)
1.508 + {
1.509 + aCounters = GetTestBitstreamCounters();
1.510 + }
1.511 +
1.512 +TUint CMMFTestVideoDecodeHwDevice::NumFreeBuffers()
1.513 + {
1.514 + return KTestNumFreeBuffers;
1.515 + }
1.516 +
1.517 +TVideoInputBuffer* CMMFTestVideoDecodeHwDevice::GetBufferL(TUint aBufferSize)
1.518 + {
1.519 + if (!iBufferDataArea)
1.520 + {
1.521 + TPtrC8 testBufferString(KTestBufferString);
1.522 + iBufferDataArea = testBufferString.AllocL();
1.523 + }
1.524 +
1.525 + TPtr8 dataAreaPtr = iBufferDataArea->Des();
1.526 + TInt reqBufferSize = aBufferSize;
1.527 + if (reqBufferSize > dataAreaPtr.MaxLength())
1.528 + User::Leave(KErrTooBig);
1.529 +
1.530 + // initialize iInputBuffer with test data
1.531 + iInputBuffer.iOptions = KTestBufferOptions;
1.532 + iInputBuffer.iDecodingTimestamp = aBufferSize;
1.533 + iInputBuffer.iData.Set(dataAreaPtr);
1.534 +
1.535 + // call new buffer callback
1.536 + iProxy->MdvppNewBuffers();
1.537 +
1.538 + return &iInputBuffer;
1.539 + }
1.540 +
1.541 +void CMMFTestVideoDecodeHwDevice::WriteCodedDataL(TVideoInputBuffer* aBuffer)
1.542 + {
1.543 + TTimeIntervalMicroSeconds testTime(KTestBufferSize);
1.544 +
1.545 + // check received buffer against test data
1.546 + if (!(aBuffer->iOptions == KTestBufferOptions) ||
1.547 + !(aBuffer->iDecodingTimestamp == testTime) ||
1.548 + !(aBuffer->iData == KTestBufferString))
1.549 + {
1.550 + User::Leave(KErrCorrupt);
1.551 + }
1.552 + }
1.553 +
1.554 +void CMMFTestVideoDecodeHwDevice::WriteCodedDataL(TVideoInputBuffer* aBuffer, TFramePortion aPortion)
1.555 + {
1.556 + TTimeIntervalMicroSeconds testTime(KTestBufferSize);
1.557 +
1.558 + // check received buffer against test data
1.559 + if ((aPortion != EFramePortionEndFragment) ||
1.560 + !(aBuffer->iOptions == KTestBufferOptions) ||
1.561 + !(aBuffer->iDecodingTimestamp == testTime) ||
1.562 + !(aBuffer->iData == KTestBufferString))
1.563 + {
1.564 + User::Leave(KErrCorrupt);
1.565 + }
1.566 + }
1.567 +
1.568 +void CMMFTestVideoDecodeHwDevice::ScanAndCopyCodedDataL(TPtr8 aCodedData, TVideoInputBuffer* aBuffer, TInt& aConsumed, TFramePortion aPortion)
1.569 + {
1.570 + //compare ptr data to test data
1.571 + if ((aPortion != EFramePortionEndFragment) ||
1.572 + (aCodedData != KTestBufferString))
1.573 + {
1.574 + User::Leave(KErrCorrupt);
1.575 + }
1.576 + //copy data into buffer
1.577 + aBuffer->iData.Set(aCodedData);
1.578 + aConsumed = aBuffer->iData.Length();
1.579 + }
1.580 +
1.581 +void CMMFTestVideoDecodeHwDevice::CommitL()
1.582 + {
1.583 + }
1.584 +
1.585 +void CMMFTestVideoDecodeHwDevice::Revert()
1.586 + {
1.587 + }
1.588 +
1.589 +void CMMFTestVideoDecodeHwDevice::SetProxy(MMMFDevVideoPlayProxy& aProxy)
1.590 + {
1.591 + ASSERT(iProxy == NULL);
1.592 + iProxy = &aProxy;
1.593 + }