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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "../TestDevVideoPlayTestData.h"
19 _LIT(KDevVideoPreProcPanicCategory, "DevVideoPreProcessor");
20 void DevVideoPreProcPanic(TInt aReason)
22 User::Panic(KDevVideoPreProcPanicCategory, aReason);
25 CMMFVideoPreProcHwDevice* CMMFTestVideoPreProcHwDevice::NewL(TAny* /*aInitParams*/)
27 CMMFTestVideoPreProcHwDevice* s = new(ELeave) CMMFTestVideoPreProcHwDevice;
28 return (STATIC_CAST(CMMFVideoPreProcHwDevice*, s));
31 CMMFTestVideoPreProcHwDevice::CMMFTestVideoPreProcHwDevice()
32 :iRecPosition(KTestRecordPosition)
36 CMMFTestVideoPreProcHwDevice::~CMMFTestVideoPreProcHwDevice()
38 iInputVidFormats.Reset();
39 iInputVidFormats.Close();
41 iOutputVidFormats.Reset();
42 iOutputVidFormats.Close();
44 iScaleFactors.Reset();
45 iScaleFactors.Close();
47 iCombinations.Reset();
48 iCombinations.Close();
51 TAny* CMMFTestVideoPreProcHwDevice::CustomInterface(TUid aInterface)
53 if (aInterface == KUidCustomInterfaceFour)
55 return this;//just want to return something non-null!
63 CPreProcessorInfo* CMMFTestVideoPreProcHwDevice::PreProcessorInfoLC()
65 // construct array of test types
66 for (TUint i = 0; i < KTestPostProcInfoCount; i++)
68 // append the input video formats
69 TUncompressedVideoFormat vid = KTestPreProcInfoInputFormatArray[i];
70 User::LeaveIfError(iInputVidFormats.Append(vid));
72 // append the output video formats
73 vid = KTestPreProcInfoOutputFormatArray[i];
74 User::LeaveIfError(iOutputVidFormats.Append(vid));
76 // append the combinations
77 TUint32 comb = KTestPostProcInfoCombsArray[i];
78 User::LeaveIfError(iCombinations.Append(comb));
80 // append the scale factors
81 TScaleFactor scale = KTestPostProcInfoScaleFactorsArray[i];
82 User::LeaveIfError(iScaleFactors.Append(scale));
85 // construct the video decoder info object
86 CPreProcessorInfo* vInfo = CPreProcessorInfo::NewL(
87 KUidDevVideoTestPreProcHwDevice,
88 KTestPreProcInfoManufacturer,
89 KTestPreProcInfoIdentifier,
90 TVersion(KTestPreProcInfoVersionMaj, KTestPreProcInfoVersionMin, KTestPreProcInfoVersionBuild),
92 ETrue, // supports direct capture
93 iInputVidFormats.Array(),
94 iOutputVidFormats.Array(),
95 iCombinations.Array(),
97 ETrue, // anti-aliasing
98 iScaleFactors.Array(),
99 KTestPreProcInfoYuvToYuvCaps,
100 KTestPreProcInfoRgbRanges,
101 KTestPreProcInfoRotations,
102 KTestPreProcInfoISInfo );
104 CleanupStack::PushL(vInfo);
108 void CMMFTestVideoPreProcHwDevice::SetInputFormatL(const TUncompressedVideoFormat& aFormat, const TSize& aPictureSize)
110 TSize testSize(KTestInputSize2X, KTestInputSize2Y);
112 if (!(aFormat == KTestVidFormat2) || !(aPictureSize == testSize))
113 User::Leave(KErrCorrupt);
116 void CMMFTestVideoPreProcHwDevice::SetSourceCameraL(TInt aCameraHandle, TReal aPictureRate)
118 if (aCameraHandle == KTestCamHandleFatal)
119 iProxy->MdvrpFatalError(this, KErrDied);
120 else if ((KTestCamHandlePre != aCameraHandle) || (KTestPictureRate != aPictureRate))
121 User::Leave(KErrCorrupt);
124 void CMMFTestVideoPreProcHwDevice::SetSourceMemoryL(TReal aMaxPictureRate, TBool aConstantPictureRate, TBool aProcessRealtime)
126 if ((KTestPictureRate != aMaxPictureRate) || !aConstantPictureRate || aProcessRealtime)
127 User::Leave(KErrCorrupt);
130 void CMMFTestVideoPreProcHwDevice::SetClockSource(MMMFClockSource* aClock)
132 __ASSERT_ALWAYS(aClock, DevVideoPreProcPanic(EPreProcPanicClockSource));
134 // call Time() to check that clock can be used
135 TTimeIntervalMicroSeconds currTime(0); // done this way to remove compiler warning
136 currTime = aClock->Time();
139 void CMMFTestVideoPreProcHwDevice::SetPreProcessTypesL(TUint32 aPreProcessTypes)
141 if (!(aPreProcessTypes == KTestProcessType2))
142 User::Leave(KErrCorrupt);
145 void CMMFTestVideoPreProcHwDevice::SetRgbToYuvOptionsL(TRgbRange aRange, const TYuvFormat& aOutputFormat)
147 // check against test data
148 if ((aRange != KTestRgbRange2) || !CompareYuvFormats(aOutputFormat, KTestYuvFormat2) )
149 User::Leave(KErrCorrupt);
152 void CMMFTestVideoPreProcHwDevice::SetYuvToYuvOptionsL(const TYuvFormat& aInputFormat, const TYuvFormat& aOutputFormat)
154 if (!CompareYuvFormats(aInputFormat, KTestYuvFormat2) || !CompareYuvFormats(aOutputFormat, KTestYuvFormat1) )
155 User::Leave(KErrCorrupt);
158 void CMMFTestVideoPreProcHwDevice::SetRotateOptionsL(TRotationType aRotationType)
160 if (!(aRotationType == KTestRotate2))
161 User::Leave(KErrCorrupt);
164 void CMMFTestVideoPreProcHwDevice::SetScaleOptionsL(const TSize& aTargetSize, TBool aAntiAliasFiltering)
166 TSize testScale(KTestScaleY, KTestScaleX);
167 if (!(aTargetSize == testScale) || !aAntiAliasFiltering)
168 User::Leave(KErrCorrupt);
171 void CMMFTestVideoPreProcHwDevice::SetInputCropOptionsL(const TRect& aRect)
173 TRect testRect(KTestInputCropRectD, KTestInputCropRectC, KTestInputCropRectB, KTestInputCropRectA);
174 if (!(aRect == testRect))
175 User::Leave(KErrCorrupt);
178 void CMMFTestVideoPreProcHwDevice::SetOutputCropOptionsL(const TRect& aRect)
180 TRect testRect(KTestOutputCropRectD, KTestOutputCropRectC, KTestOutputCropRectB, KTestOutputCropRectA);
181 if (!(aRect == testRect))
182 User::Leave(KErrCorrupt);
185 void CMMFTestVideoPreProcHwDevice::SetOutputPadOptionsL(const TSize& aOutputSize, const TPoint& aPicturePos)
187 TSize testPad(KTestPadY, KTestPadX);
188 TPoint testPoint(KTestPadPointY, KTestPadPointX);
190 if (!(testPad == aOutputSize) || !(testPoint == aPicturePos))
191 User::Leave(KErrCorrupt);
194 void CMMFTestVideoPreProcHwDevice::SetColorEnhancementOptionsL(const TColorEnhancementOptions& aOptions)
196 if (!CompareColorEnhancements(aOptions, KTestColorEnhance2))
197 User::Leave(KErrCorrupt);
200 void CMMFTestVideoPreProcHwDevice::SetFrameStabilisationOptionsL(const TSize& aOutputSize, TBool aFrameStabilisation)
202 TSize testSize(KTestScaleY, KTestScaleX);
203 if (!(aOutputSize == testSize) || !aFrameStabilisation)
204 User::Leave(KErrCorrupt);
207 void CMMFTestVideoPreProcHwDevice::SetCustomPreProcessOptionsL(const TDesC8& aOptions)
209 if (!(aOptions == KTestCustomPreProc2))
210 User::Leave(KErrCorrupt);
213 void CMMFTestVideoPreProcHwDevice::Initialize()
215 iProxy->MdvrpInitializeComplete(this, KErrNone);
218 void CMMFTestVideoPreProcHwDevice::WritePictureL(TVideoPicture* aPicture)
220 iProxy->MdvrpReturnPicture(aPicture);
223 void CMMFTestVideoPreProcHwDevice::InputEnd()
225 iProxy->MdvrpStreamEnd();
228 void CMMFTestVideoPreProcHwDevice::Start()
230 iRecPosition = KTestRecTimeStartPre;
231 iIsRecording = ETrue;
234 void CMMFTestVideoPreProcHwDevice::Stop()
236 iRecPosition = KTestRecTimeStop;
237 iIsRecording = EFalse;
240 void CMMFTestVideoPreProcHwDevice::Pause()
242 iRecPosition = KTestRecTimePausePre;
243 iIsRecording = EFalse;
246 void CMMFTestVideoPreProcHwDevice::Resume()
248 iRecPosition = KTestRecTimeResumePre;
249 iIsRecording = ETrue;
252 void CMMFTestVideoPreProcHwDevice::Freeze()
256 void CMMFTestVideoPreProcHwDevice::ReleaseFreeze()
260 TTimeIntervalMicroSeconds CMMFTestVideoPreProcHwDevice::RecordingPosition()
265 void CMMFTestVideoPreProcHwDevice::GetPictureCounters(CMMFDevVideoRecord::TPictureCounters& aCounters)
267 aCounters = GetTestEncPictureCounters();
270 void CMMFTestVideoPreProcHwDevice::GetFrameStabilisationOutput(TRect& aRect)
272 aRect = TRect(KTestFrameStableY1, KTestFrameStableX1, KTestFrameStableY2, KTestFrameStableX2);
275 TUint CMMFTestVideoPreProcHwDevice::NumComplexityLevels()
277 return KTestNumComplexityLevels2;
280 void CMMFTestVideoPreProcHwDevice::SetComplexityLevel(TUint aLevel)
282 __ASSERT_ALWAYS(aLevel == KTestComplexityLevel2, DevVideoPreProcPanic(EPreProcPanicComplexityLevel));
285 void CMMFTestVideoPreProcHwDevice::SetOutputFormatL(const TUncompressedVideoFormat& aFormat)
287 if (!(aFormat == KTestVidFormat2))
289 User::Leave(KErrCorrupt);
293 void CMMFTestVideoPreProcHwDevice::SetOutputDevice(CMMFVideoEncodeHwDevice* /*aDevice*/)
297 void CMMFTestVideoPreProcHwDevice::ReturnPicture(TVideoPicture* /*aPicture*/)
301 void CMMFTestVideoPreProcHwDevice::CommitL()
305 void CMMFTestVideoPreProcHwDevice::Revert()
309 void CMMFTestVideoPreProcHwDevice::SetProxy(MMMFDevVideoRecordProxy& aProxy)
311 ASSERT(iProxy == NULL);