sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "NGAPostProcHwDevice.h"
|
sl@0
|
20 |
#include "NGAPostProcSessionManager.h"
|
sl@0
|
21 |
#include "NGAPostProcSurfaceHandler.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
// post-processor info
|
sl@0
|
24 |
const TUid KUidVideoPostProcHwDevice = {KUidNGAPostProcHwDeviceImplUid};
|
sl@0
|
25 |
_LIT(KManufacturer, "Nokia Inc.");
|
sl@0
|
26 |
_LIT(KIdentifier, "Nokia S60 Video Post Processor Hardware Device Plugin");
|
sl@0
|
27 |
|
sl@0
|
28 |
// --- Constants ---
|
sl@0
|
29 |
const TInt KMaxVBMBuffers = 4;
|
sl@0
|
30 |
const TInt KMinVBMInputWidth = 32;
|
sl@0
|
31 |
const TInt KMinVBMInputHeight = 32;
|
sl@0
|
32 |
const TInt KMaxVBMInputWidth = 1280;
|
sl@0
|
33 |
const TInt KMaxVBMInputHeight = 720;
|
sl@0
|
34 |
const TInt KRenderAhead = 50000;
|
sl@0
|
35 |
const TInt KMaxRenderDelay = 50000;
|
sl@0
|
36 |
const TInt KPostingOfset = 0;
|
sl@0
|
37 |
const TInt KColorConversionBuffers = 3;
|
sl@0
|
38 |
const TInt KMaxBuffersGceCanHold = 3;
|
sl@0
|
39 |
const TInt KDefPlayRate = 100;
|
sl@0
|
40 |
const TInt KMaxAllowedSkipInNFrames = 40;
|
sl@0
|
41 |
#ifdef __cplusplus
|
sl@0
|
42 |
extern "C"
|
sl@0
|
43 |
{
|
sl@0
|
44 |
#endif
|
sl@0
|
45 |
|
sl@0
|
46 |
int32 gColorConvYUVtoYUV422Int (tBaseVideoFrame *yuv420Frame, tBaseVideoFrame* yuv422Frame,
|
sl@0
|
47 |
uint8 outClrFmt, int16 stride);
|
sl@0
|
48 |
|
sl@0
|
49 |
int32 Emz_VDec_gColorConv_YUVtoRGB (
|
sl@0
|
50 |
tBaseVideoFrame *srcImage, uint8 *dstImage, tWndParam *srcWindow,
|
sl@0
|
51 |
tWndParam *dstWindow, uint8 srcImageFormat, uint8 dstImageFormat,
|
sl@0
|
52 |
uint8 colorConvScheme);
|
sl@0
|
53 |
|
sl@0
|
54 |
#ifdef __cplusplus
|
sl@0
|
55 |
}
|
sl@0
|
56 |
#endif
|
sl@0
|
57 |
|
sl@0
|
58 |
//**************************************************
|
sl@0
|
59 |
|
sl@0
|
60 |
CMMFVideoPostProcHwDevice* CNGAPostProcHwDevice::NewL()
|
sl@0
|
61 |
{
|
sl@0
|
62 |
PP_DEBUG(_L("CNGAPostProcHwDevice::NewL() ++"));
|
sl@0
|
63 |
|
sl@0
|
64 |
CNGAPostProcHwDevice* self = new (ELeave) CNGAPostProcHwDevice;
|
sl@0
|
65 |
CleanupStack::PushL(self);
|
sl@0
|
66 |
self->ConstructL();
|
sl@0
|
67 |
CleanupStack::Pop();
|
sl@0
|
68 |
|
sl@0
|
69 |
PP_DEBUG(_L("CNGAPostProcHwDevice::NewL() --"));
|
sl@0
|
70 |
return (CMMFVideoPostProcHwDevice*)self;
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
void CNGAPostProcHwDevice::ConstructL()
|
sl@0
|
74 |
{
|
sl@0
|
75 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::ConstructL() ++"), this);
|
sl@0
|
76 |
|
sl@0
|
77 |
// support for VBM buffer interface
|
sl@0
|
78 |
iVBMBufferOptions.iNumInputBuffers = KMaxVBMBuffers;
|
sl@0
|
79 |
iVBMBufferOptions.iBufferSize = TSize(KMaxVBMInputWidth, KMaxVBMInputHeight);
|
sl@0
|
80 |
iPostingTimer = CNGAPostProcTimer::NewL(*this);
|
sl@0
|
81 |
iWsSession.Connect();
|
sl@0
|
82 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::ConstructL() --"), this);
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
CNGAPostProcHwDevice::CNGAPostProcHwDevice()
|
sl@0
|
86 |
: iProxy(NULL),
|
sl@0
|
87 |
iInputDecoderDevice(NULL),
|
sl@0
|
88 |
iCurrentPlaybackPosition(TTimeIntervalMicroSeconds(0)),
|
sl@0
|
89 |
iPPState(EInitializing),
|
sl@0
|
90 |
iSurfaceHandler(NULL),
|
sl@0
|
91 |
iSessionManager(NULL),
|
sl@0
|
92 |
iIsInputEnded(EFalse),
|
sl@0
|
93 |
iPostingTimer(NULL),
|
sl@0
|
94 |
iFirstPictureUpdated(EFalse),
|
sl@0
|
95 |
iUsingExternalSurface(EFalse),
|
sl@0
|
96 |
iIsColorConversionNeeded(EFalse),
|
sl@0
|
97 |
iSurfaceCreatedEventPublished(EFalse),
|
sl@0
|
98 |
iOverflowPictureCounter(0),
|
sl@0
|
99 |
iVideoFrameBufSize(0),
|
sl@0
|
100 |
iResourceLost(EFalse),
|
sl@0
|
101 |
iRedrawDone(EFalse),
|
sl@0
|
102 |
iRedrawSurfaceInUse(EFalse),
|
sl@0
|
103 |
iVBMObserver(NULL),
|
sl@0
|
104 |
count(0),
|
sl@0
|
105 |
iSurfaceMask(surfaceHints::EAllowAllExternals),
|
sl@0
|
106 |
iSurfaceKey(TUid::Uid(surfaceHints::KSurfaceProtection)),
|
sl@0
|
107 |
iVideoSurfaceObserver(NULL),
|
sl@0
|
108 |
iVPObserver(NULL),
|
sl@0
|
109 |
iPicSize(0,0),
|
sl@0
|
110 |
iAspectRatioNum(1),
|
sl@0
|
111 |
iAspectRatioDenom(1),
|
sl@0
|
112 |
iStepFrameCount(0),
|
sl@0
|
113 |
iPlayRate(KDefPlayRate),
|
sl@0
|
114 |
iKeyFrameMode(EFalse),
|
sl@0
|
115 |
iFPObserver(NULL)
|
sl@0
|
116 |
{
|
sl@0
|
117 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
118 |
iAttributes().iPixelFormat = EUidPixelFormatYUV_422Interleaved;
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
CNGAPostProcHwDevice::~CNGAPostProcHwDevice()
|
sl@0
|
122 |
{
|
sl@0
|
123 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::~CNGAPostProcHwDevice() ++"), this);
|
sl@0
|
124 |
if (iSessionManager)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
iSessionManager->CancelUpdate();
|
sl@0
|
127 |
delete iSessionManager;
|
sl@0
|
128 |
iSessionManager = NULL;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
while (iSupportedInputFormats.Count()>0)
|
sl@0
|
132 |
{
|
sl@0
|
133 |
iSupportedInputFormats.Remove(0);
|
sl@0
|
134 |
}
|
sl@0
|
135 |
|
sl@0
|
136 |
while (iProcessQ.Count()>0)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
iProcessQ.Remove(0);
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
if(iPostingTimer)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
iPostingTimer->Cancel();
|
sl@0
|
144 |
delete iPostingTimer;
|
sl@0
|
145 |
iPostingTimer = NULL;
|
sl@0
|
146 |
}
|
sl@0
|
147 |
|
sl@0
|
148 |
while (iVBMBufferReferenceQ.Count()>0)
|
sl@0
|
149 |
{
|
sl@0
|
150 |
TVideoPicture* pic = iVBMBufferReferenceQ[0];
|
sl@0
|
151 |
iVBMBufferReferenceQ.Remove(0);
|
sl@0
|
152 |
if (iColorConversionQ.Count()>0)
|
sl@0
|
153 |
{
|
sl@0
|
154 |
iColorConversionQ.Remove(0);
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
if (pic->iHeader) delete pic->iHeader;
|
sl@0
|
158 |
delete pic->iData.iRawData;
|
sl@0
|
159 |
delete pic;
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
iSupportedInputFormats.Reset();
|
sl@0
|
163 |
iSupportedInputFormats.Close();
|
sl@0
|
164 |
|
sl@0
|
165 |
iVBMBufferReferenceQ.Reset();
|
sl@0
|
166 |
iVBMBufferReferenceQ.Close();
|
sl@0
|
167 |
|
sl@0
|
168 |
iColorConversionQ.Reset();
|
sl@0
|
169 |
iColorConversionQ.Close();
|
sl@0
|
170 |
|
sl@0
|
171 |
iVBMBufferQ.Reset();
|
sl@0
|
172 |
iVBMBufferQ.Close();
|
sl@0
|
173 |
|
sl@0
|
174 |
iProcessQ.Reset();
|
sl@0
|
175 |
iProcessQ.Close();
|
sl@0
|
176 |
|
sl@0
|
177 |
iInputQ.Reset();
|
sl@0
|
178 |
iInputQ.Close();
|
sl@0
|
179 |
|
sl@0
|
180 |
if (iSurfaceHandler)
|
sl@0
|
181 |
{
|
sl@0
|
182 |
if(!iSurfaceId.IsNull())
|
sl@0
|
183 |
{
|
sl@0
|
184 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::UnregisterSurface"), this);
|
sl@0
|
185 |
TInt numScreens = iWsSession.NumberOfScreens();
|
sl@0
|
186 |
for(TInt i=0;i < numScreens;i++)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
iWsSession.UnregisterSurface(i, iSurfaceId);
|
sl@0
|
189 |
}
|
sl@0
|
190 |
iWsSession.Flush();
|
sl@0
|
191 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
192 |
}
|
sl@0
|
193 |
delete iSurfaceHandler;
|
sl@0
|
194 |
iSurfaceHandler = NULL;
|
sl@0
|
195 |
}
|
sl@0
|
196 |
|
sl@0
|
197 |
iWsSession.Close();
|
sl@0
|
198 |
iChunk.Close();
|
sl@0
|
199 |
RDebug::Printf("------ Statistics of Post Processor ------");
|
sl@0
|
200 |
RDebug::Printf(" Pictures Received : %d", iPictureCounters.iTotalPictures);
|
sl@0
|
201 |
RDebug::Printf(" Pictures Displayed: %d", iPictureCounters.iPicturesDisplayed);
|
sl@0
|
202 |
RDebug::Printf(" Pictures Skipped : %d", iPictureCounters.iPicturesSkipped);
|
sl@0
|
203 |
RDebug::Printf(" Pictures overflow : %d", iOverflowPictureCounter);
|
sl@0
|
204 |
RDebug::Printf("------------------------------------------");
|
sl@0
|
205 |
|
sl@0
|
206 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:~() --"), this);
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
void CNGAPostProcHwDevice::SetInputFormatL(const TUncompressedVideoFormat& aFormat)
|
sl@0
|
210 |
{
|
sl@0
|
211 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputFormatL() Pattern= %x ++"), this, aFormat.iYuvFormat.iPattern);
|
sl@0
|
212 |
if (iPPState != EInitializing)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputFormatL() FAILED: Unexpected state"), this);
|
sl@0
|
215 |
User::Leave(KErrNotReady);
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
iVideoFormat = aFormat;
|
sl@0
|
219 |
if( ((iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma1) ||
|
sl@0
|
220 |
(iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma2) ||
|
sl@0
|
221 |
(iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma3) ))
|
sl@0
|
222 |
{
|
sl@0
|
223 |
iVideoFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
|
sl@0
|
224 |
iVideoFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
225 |
iVideoFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
|
sl@0
|
226 |
|
sl@0
|
227 |
#if defined __WINSCW__
|
sl@0
|
228 |
iIsColorConversionNeeded = ETrue;
|
sl@0
|
229 |
#else
|
sl@0
|
230 |
iAttributes().iPixelFormat = EUidPixelFormatYUV_420Planar;
|
sl@0
|
231 |
#endif //__WINSCW__
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputFormatL() WARNING: -- Not Found!"), this);
|
sl@0
|
235 |
}
|
sl@0
|
236 |
|
sl@0
|
237 |
|
sl@0
|
238 |
void CNGAPostProcHwDevice::SetInputDevice(CMMFVideoDecodeHwDevice* aDevice)
|
sl@0
|
239 |
{
|
sl@0
|
240 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputDevice() ++"), this);
|
sl@0
|
241 |
|
sl@0
|
242 |
if (iPPState != EInitializing)
|
sl@0
|
243 |
{
|
sl@0
|
244 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputDevice() FAILED: unexpected state"), this);
|
sl@0
|
245 |
return;
|
sl@0
|
246 |
}
|
sl@0
|
247 |
|
sl@0
|
248 |
iInputDecoderDevice = aDevice;
|
sl@0
|
249 |
|
sl@0
|
250 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputDevice() --"), this);
|
sl@0
|
251 |
}
|
sl@0
|
252 |
|
sl@0
|
253 |
void CNGAPostProcHwDevice::GetOutputFormatListL(RArray<TUncompressedVideoFormat>& )
|
sl@0
|
254 |
{
|
sl@0
|
255 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetOutputFormatListL() ++"), this);
|
sl@0
|
256 |
|
sl@0
|
257 |
|
sl@0
|
258 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetOutputFormatListL() --"), this);
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
void CNGAPostProcHwDevice::SetOutputFormatL(const TUncompressedVideoFormat& )
|
sl@0
|
262 |
{
|
sl@0
|
263 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetOutputFormatL() ++"), this);
|
sl@0
|
264 |
|
sl@0
|
265 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetOutputFormatL() --"), this);
|
sl@0
|
266 |
}
|
sl@0
|
267 |
|
sl@0
|
268 |
void CNGAPostProcHwDevice::SetClockSource(MMMFClockSource* aClock)
|
sl@0
|
269 |
{
|
sl@0
|
270 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetClockSource() ++"), this);
|
sl@0
|
271 |
|
sl@0
|
272 |
if (iPPState != EInitializing)
|
sl@0
|
273 |
{
|
sl@0
|
274 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetClockSource() FAILED: Unexpected state"), this);
|
sl@0
|
275 |
return;
|
sl@0
|
276 |
}
|
sl@0
|
277 |
iClockSource = aClock;
|
sl@0
|
278 |
|
sl@0
|
279 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetClockSource() --"), this);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
void CNGAPostProcHwDevice::SetVideoDestScreenL(TBool /*aScreen*/)
|
sl@0
|
283 |
{
|
sl@0
|
284 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetVideoDestScreenL() ++"), this);
|
sl@0
|
285 |
|
sl@0
|
286 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetVideoDestScreenL() --"), this);
|
sl@0
|
287 |
}
|
sl@0
|
288 |
|
sl@0
|
289 |
void CNGAPostProcHwDevice::SetProxy(MMMFDevVideoPlayProxy& aProxy)
|
sl@0
|
290 |
{
|
sl@0
|
291 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetProxy() ++"), this);
|
sl@0
|
292 |
|
sl@0
|
293 |
if (iPPState != EInitializing)
|
sl@0
|
294 |
{
|
sl@0
|
295 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetProxy() FAILED: Unexpected state"), this);
|
sl@0
|
296 |
return;
|
sl@0
|
297 |
}
|
sl@0
|
298 |
|
sl@0
|
299 |
iProxy = &aProxy;
|
sl@0
|
300 |
|
sl@0
|
301 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetProxy() --"), this);
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
void CNGAPostProcHwDevice::Initialize()
|
sl@0
|
305 |
{
|
sl@0
|
306 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize ++"));
|
sl@0
|
307 |
TInt err = KErrNone;
|
sl@0
|
308 |
|
sl@0
|
309 |
if (iPPState != EInitializing)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize() FAILED: Unexpected state"), this);
|
sl@0
|
312 |
return;
|
sl@0
|
313 |
}
|
sl@0
|
314 |
if (!iSurfaceHandler)
|
sl@0
|
315 |
{
|
sl@0
|
316 |
TRAP(err, iSurfaceHandler = CNGAPostProcSurfaceHandler::NewL());
|
sl@0
|
317 |
if (err != KErrNone)
|
sl@0
|
318 |
{
|
sl@0
|
319 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create SurfaceHandler."), this);
|
sl@0
|
320 |
return;
|
sl@0
|
321 |
}
|
sl@0
|
322 |
}
|
sl@0
|
323 |
if (!iSessionManager)
|
sl@0
|
324 |
{
|
sl@0
|
325 |
TRAP(err, iSessionManager = CNGAPostProcSessionManager::NewL());
|
sl@0
|
326 |
if (err != KErrNone)
|
sl@0
|
327 |
{
|
sl@0
|
328 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create SessionManager."), this);
|
sl@0
|
329 |
return;
|
sl@0
|
330 |
}
|
sl@0
|
331 |
iSessionManager->SetObserver(*this);
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
if (iInputDecoderDevice)
|
sl@0
|
335 |
{
|
sl@0
|
336 |
MMmfVideoResourceHandler* handler = NULL;
|
sl@0
|
337 |
handler = (MMmfVideoResourceHandler*)iInputDecoderDevice->CustomInterface(KUidMmfVideoResourceManagement);
|
sl@0
|
338 |
if (handler)
|
sl@0
|
339 |
{
|
sl@0
|
340 |
handler->MmvrhSetObserver((MMmfVideoResourceObserver*)this);
|
sl@0
|
341 |
}
|
sl@0
|
342 |
else
|
sl@0
|
343 |
{
|
sl@0
|
344 |
PP_DEBUG(_L("ppHwDev[%x]:Initialize() decoder yet to implement MMmfVideoResourceHandler CI"), this);
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
MMmfVideoPropertiesNotifier* VPHandler = NULL;
|
sl@0
|
348 |
VPHandler = (MMmfVideoPropertiesNotifier*)iInputDecoderDevice->CustomInterface(KUidMmfVideoPropertiesManagement);
|
sl@0
|
349 |
if (VPHandler)
|
sl@0
|
350 |
{
|
sl@0
|
351 |
PP_DEBUG(_L("ppHwDev[%x]:Initialize() Register for video property changes"), this);
|
sl@0
|
352 |
VPHandler->MmvpnSetObserver((MMmfVideoPropertiesObserver*)this);
|
sl@0
|
353 |
}
|
sl@0
|
354 |
else
|
sl@0
|
355 |
{
|
sl@0
|
356 |
PP_DEBUG(_L("ppHwDev[%x]:Initialize() decoder yet to implement MMmfVideoPropertiesNotifier CI"), this);
|
sl@0
|
357 |
}
|
sl@0
|
358 |
}
|
sl@0
|
359 |
|
sl@0
|
360 |
// Initialize picture counters
|
sl@0
|
361 |
iPictureCounters.iPicturesSkipped = 0;
|
sl@0
|
362 |
iPictureCounters.iPicturesDisplayed = 0;
|
sl@0
|
363 |
iPictureCounters.iTotalPictures = 0;
|
sl@0
|
364 |
iOverflowPictureCounter = 0;
|
sl@0
|
365 |
if (iProxy)
|
sl@0
|
366 |
{
|
sl@0
|
367 |
iProxy->MdvppInitializeComplete(this, err);
|
sl@0
|
368 |
}
|
sl@0
|
369 |
iPPState = EInitialized;
|
sl@0
|
370 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize --"), this);
|
sl@0
|
371 |
}
|
sl@0
|
372 |
|
sl@0
|
373 |
void CNGAPostProcHwDevice::WritePictureL(TVideoPicture* aPicture)
|
sl@0
|
374 |
{
|
sl@0
|
375 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:WritePicture bufId = %d"), this,GetID(aPicture));
|
sl@0
|
376 |
TVideoPicture* pic;
|
sl@0
|
377 |
if (iPPState==EInitializing || iPPState==EStopped || iIsInputEnded)
|
sl@0
|
378 |
{
|
sl@0
|
379 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:WritePictureL() FAILED: Unexpected state"), this);
|
sl@0
|
380 |
User::Leave(KErrNotReady);
|
sl@0
|
381 |
}
|
sl@0
|
382 |
|
sl@0
|
383 |
if(!aPicture)
|
sl@0
|
384 |
{
|
sl@0
|
385 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:WritePictureL() FAILED: Invalid argument"), this);
|
sl@0
|
386 |
User::Leave(KErrArgument);
|
sl@0
|
387 |
}
|
sl@0
|
388 |
pic = aPicture;
|
sl@0
|
389 |
iPictureCounters.iTotalPictures++;
|
sl@0
|
390 |
if((iPPState != EPlaying) && (iFirstPictureUpdated))
|
sl@0
|
391 |
{
|
sl@0
|
392 |
AddToQ(pic);
|
sl@0
|
393 |
}
|
sl@0
|
394 |
else if( iInputQ.Count() > 0 )
|
sl@0
|
395 |
{
|
sl@0
|
396 |
AddToQ(pic);
|
sl@0
|
397 |
AttemptToPost();
|
sl@0
|
398 |
}
|
sl@0
|
399 |
else
|
sl@0
|
400 |
{
|
sl@0
|
401 |
TInt64 delta = 0;
|
sl@0
|
402 |
TTimeToPost iTimeToPost = (TTimeToPost)IsTimeToPost(pic, delta);
|
sl@0
|
403 |
if(!IsGceReady())
|
sl@0
|
404 |
{
|
sl@0
|
405 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:WritePictureL GCE not ready"), this );
|
sl@0
|
406 |
if(iTimeToPost == EPostIt)
|
sl@0
|
407 |
{
|
sl@0
|
408 |
iTimeToPost = EDelayIt;
|
sl@0
|
409 |
}
|
sl@0
|
410 |
}
|
sl@0
|
411 |
if (delta > 0x7FFFFFFF)
|
sl@0
|
412 |
{
|
sl@0
|
413 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:WritePictureL Too large delta .. skipping"), this );
|
sl@0
|
414 |
iTimeToPost = ESkipIt;
|
sl@0
|
415 |
}
|
sl@0
|
416 |
if(!iFirstPictureUpdated)
|
sl@0
|
417 |
{
|
sl@0
|
418 |
if(iTimeToPost == EDelayIt)
|
sl@0
|
419 |
{
|
sl@0
|
420 |
iTimeToPost = EPostIt;
|
sl@0
|
421 |
}
|
sl@0
|
422 |
}
|
sl@0
|
423 |
switch(iTimeToPost)
|
sl@0
|
424 |
{
|
sl@0
|
425 |
case EDelayIt:
|
sl@0
|
426 |
{
|
sl@0
|
427 |
if(AddToQ(pic) != 0)
|
sl@0
|
428 |
{
|
sl@0
|
429 |
break;
|
sl@0
|
430 |
}
|
sl@0
|
431 |
iPostingTimer->Cancel();
|
sl@0
|
432 |
SetTimer(delta);
|
sl@0
|
433 |
}
|
sl@0
|
434 |
break;
|
sl@0
|
435 |
case EPostIt:
|
sl@0
|
436 |
{
|
sl@0
|
437 |
|
sl@0
|
438 |
if(iIsColorConversionNeeded)
|
sl@0
|
439 |
{
|
sl@0
|
440 |
TVideoPicture* ccPic;
|
sl@0
|
441 |
ccPic = DoColorConvert(pic); // output will be in ccPic
|
sl@0
|
442 |
pic = ccPic;
|
sl@0
|
443 |
}
|
sl@0
|
444 |
iProcessQ.Append(pic);
|
sl@0
|
445 |
|
sl@0
|
446 |
#ifdef _DUMP_YUV_FRAMES
|
sl@0
|
447 |
captureYuv(pic);
|
sl@0
|
448 |
#endif
|
sl@0
|
449 |
iSessionManager->PostPicture(iSurfaceId, GetID(pic), iInfo().iBuffers, ETrue);
|
sl@0
|
450 |
iCurrentPlaybackPosition = pic->iTimestamp;
|
sl@0
|
451 |
|
sl@0
|
452 |
if(!iFirstPictureUpdated)
|
sl@0
|
453 |
{
|
sl@0
|
454 |
iFirstPictureUpdated = ETrue;
|
sl@0
|
455 |
if(!iSurfaceCreatedEventPublished)
|
sl@0
|
456 |
{
|
sl@0
|
457 |
PublishSurfaceCreated();
|
sl@0
|
458 |
}
|
sl@0
|
459 |
}
|
sl@0
|
460 |
}
|
sl@0
|
461 |
break;
|
sl@0
|
462 |
case ESkipIt:
|
sl@0
|
463 |
{
|
sl@0
|
464 |
ReleasePicture(pic);
|
sl@0
|
465 |
PicturesSkipped();
|
sl@0
|
466 |
}
|
sl@0
|
467 |
break;
|
sl@0
|
468 |
}
|
sl@0
|
469 |
}
|
sl@0
|
470 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:WritePicture --"), this);
|
sl@0
|
471 |
}
|
sl@0
|
472 |
|
sl@0
|
473 |
|
sl@0
|
474 |
CPostProcessorInfo*
|
sl@0
|
475 |
CNGAPostProcHwDevice::PostProcessorInfoLC()
|
sl@0
|
476 |
{
|
sl@0
|
477 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:PostProcessorInfoLC() ++"), this);
|
sl@0
|
478 |
TUncompressedVideoFormat yuvFormat;
|
sl@0
|
479 |
RArray<TUint32> SupportedPostProcess;
|
sl@0
|
480 |
TBool SupportedHwAcceleration = ETrue; //Non-Accelerated ETrue,
|
sl@0
|
481 |
TYuvToRgbCapabilities SupportedYuvToRgbCapab;
|
sl@0
|
482 |
TInt32 SupportedRotations = ERotateNone; // no rotation supported
|
sl@0
|
483 |
|
sl@0
|
484 |
TBool SupportedArbitraryScaling = EFalse; // no scaling supported
|
sl@0
|
485 |
RArray<TScaleFactor> SupportedScaleFactors;
|
sl@0
|
486 |
TBool SupportedAntiAliasing = EFalse;
|
sl@0
|
487 |
|
sl@0
|
488 |
//default
|
sl@0
|
489 |
yuvFormat.iDataFormat = EYuvRawData;
|
sl@0
|
490 |
yuvFormat.iYuvFormat.iYuv2RgbMatrix = 0;
|
sl@0
|
491 |
yuvFormat.iYuvFormat.iRgb2YuvMatrix = 0;
|
sl@0
|
492 |
yuvFormat.iYuvFormat.iAspectRatioNum = 1;
|
sl@0
|
493 |
yuvFormat.iYuvFormat.iAspectRatioDenom = 1;
|
sl@0
|
494 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
|
sl@0
|
495 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
496 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
|
sl@0
|
497 |
|
sl@0
|
498 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
499 |
|
sl@0
|
500 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
501 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
502 |
|
sl@0
|
503 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
|
sl@0
|
504 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
505 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
|
sl@0
|
506 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
507 |
|
sl@0
|
508 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
509 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
510 |
|
sl@0
|
511 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
|
sl@0
|
512 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
513 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedLE;
|
sl@0
|
514 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
515 |
|
sl@0
|
516 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
517 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
518 |
|
sl@0
|
519 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
|
sl@0
|
520 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
521 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedLE;
|
sl@0
|
522 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
523 |
|
sl@0
|
524 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
525 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
526 |
|
sl@0
|
527 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt601Range0;
|
sl@0
|
528 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
529 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
|
sl@0
|
530 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
531 |
|
sl@0
|
532 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
533 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
534 |
|
sl@0
|
535 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
|
sl@0
|
536 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
537 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
|
sl@0
|
538 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
539 |
|
sl@0
|
540 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
541 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
542 |
|
sl@0
|
543 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt601Range0;
|
sl@0
|
544 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
545 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedLE;
|
sl@0
|
546 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
547 |
|
sl@0
|
548 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
549 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
550 |
|
sl@0
|
551 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
|
sl@0
|
552 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
sl@0
|
553 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedLE;
|
sl@0
|
554 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
555 |
|
sl@0
|
556 |
yuvFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
sl@0
|
557 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
558 |
|
sl@0
|
559 |
//YUV 420 planar
|
sl@0
|
560 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
|
sl@0
|
561 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma1;
|
sl@0
|
562 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
|
sl@0
|
563 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
564 |
|
sl@0
|
565 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma2;
|
sl@0
|
566 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
567 |
|
sl@0
|
568 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma3;
|
sl@0
|
569 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
570 |
|
sl@0
|
571 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
|
sl@0
|
572 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma1;
|
sl@0
|
573 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
|
sl@0
|
574 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
575 |
|
sl@0
|
576 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma2;
|
sl@0
|
577 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
578 |
|
sl@0
|
579 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma3;
|
sl@0
|
580 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
581 |
|
sl@0
|
582 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
|
sl@0
|
583 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma1;
|
sl@0
|
584 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
|
sl@0
|
585 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
586 |
|
sl@0
|
587 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma2;
|
sl@0
|
588 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
589 |
|
sl@0
|
590 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma3;
|
sl@0
|
591 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
592 |
|
sl@0
|
593 |
yuvFormat.iYuvFormat.iCoefficients = EYuvBt601Range0;
|
sl@0
|
594 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma1;
|
sl@0
|
595 |
yuvFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
|
sl@0
|
596 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
597 |
|
sl@0
|
598 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma2;
|
sl@0
|
599 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
600 |
|
sl@0
|
601 |
yuvFormat.iYuvFormat.iPattern = EYuv420Chroma3;
|
sl@0
|
602 |
User::LeaveIfError(iSupportedInputFormats.Append(yuvFormat));
|
sl@0
|
603 |
|
sl@0
|
604 |
CPostProcessorInfo* postProcessorInfo = CPostProcessorInfo::NewL(
|
sl@0
|
605 |
KUidVideoPostProcHwDevice,
|
sl@0
|
606 |
KManufacturer,
|
sl@0
|
607 |
KIdentifier,
|
sl@0
|
608 |
TVersion(1, 0, 0),
|
sl@0
|
609 |
iSupportedInputFormats.Array(),
|
sl@0
|
610 |
SupportedPostProcess.Array(),
|
sl@0
|
611 |
SupportedHwAcceleration,
|
sl@0
|
612 |
ETrue, //Direct Display
|
sl@0
|
613 |
SupportedYuvToRgbCapab,
|
sl@0
|
614 |
SupportedRotations,
|
sl@0
|
615 |
SupportedArbitraryScaling,
|
sl@0
|
616 |
SupportedScaleFactors.Array(),
|
sl@0
|
617 |
SupportedAntiAliasing);
|
sl@0
|
618 |
|
sl@0
|
619 |
CleanupStack::PushL(postProcessorInfo);
|
sl@0
|
620 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:PostProcessorInfoLC() --"), this);
|
sl@0
|
621 |
return postProcessorInfo;
|
sl@0
|
622 |
}
|
sl@0
|
623 |
|
sl@0
|
624 |
void CNGAPostProcHwDevice::MmvprcGetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCap)
|
sl@0
|
625 |
{
|
sl@0
|
626 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcGetPlayRateCapabilitiesL ++"), this);
|
sl@0
|
627 |
aCap.iPlayForward = ETrue;
|
sl@0
|
628 |
aCap.iPlayBackward = ETrue;
|
sl@0
|
629 |
aCap.iStepForward = ETrue;
|
sl@0
|
630 |
aCap.iStepBackward = ETrue;
|
sl@0
|
631 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcGetPlayRateCapabilitiesL --"), this);
|
sl@0
|
632 |
}
|
sl@0
|
633 |
|
sl@0
|
634 |
void CNGAPostProcHwDevice::MmvprcSetPlayRateL(const TInt aRate)
|
sl@0
|
635 |
{
|
sl@0
|
636 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcSetPlayRateL ++"), this);
|
sl@0
|
637 |
iPlayRate = aRate;
|
sl@0
|
638 |
if (iPlayRate<0)
|
sl@0
|
639 |
{
|
sl@0
|
640 |
iKeyFrameMode = ETrue;
|
sl@0
|
641 |
}
|
sl@0
|
642 |
else
|
sl@0
|
643 |
{
|
sl@0
|
644 |
iKeyFrameMode = EFalse;
|
sl@0
|
645 |
ResetCountingBuffer();
|
sl@0
|
646 |
}
|
sl@0
|
647 |
//In fast forward go direct to key frame mode if speed >4X =
|
sl@0
|
648 |
if (iPlayRate>KDefPlayRate*4)
|
sl@0
|
649 |
{
|
sl@0
|
650 |
if (iFPObserver)
|
sl@0
|
651 |
{
|
sl@0
|
652 |
iFPObserver->MmvproKeyFrameModeRequest();
|
sl@0
|
653 |
iKeyFrameMode=ETrue;
|
sl@0
|
654 |
}
|
sl@0
|
655 |
}
|
sl@0
|
656 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcSetPlayRateL=%d --"), this, aRate);
|
sl@0
|
657 |
}
|
sl@0
|
658 |
|
sl@0
|
659 |
TInt CNGAPostProcHwDevice::MmvprcPlayRateL()
|
sl@0
|
660 |
{
|
sl@0
|
661 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcPlayRateL= ++"), this);
|
sl@0
|
662 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcPlayRateL= --"), this);
|
sl@0
|
663 |
return iPlayRate;
|
sl@0
|
664 |
}
|
sl@0
|
665 |
|
sl@0
|
666 |
void CNGAPostProcHwDevice::MmvprcStepFrameL(const TInt aStep)
|
sl@0
|
667 |
{
|
sl@0
|
668 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcStepFrameL= ++"), this);
|
sl@0
|
669 |
iStepFrameCount = aStep;
|
sl@0
|
670 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcStepFrameL=%d --"), this, aStep);
|
sl@0
|
671 |
}
|
sl@0
|
672 |
|
sl@0
|
673 |
void CNGAPostProcHwDevice::MmvprcSetObserver(MMmfVideoPlayRateObserver& aObserver)
|
sl@0
|
674 |
{
|
sl@0
|
675 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcSetObserver ++"), this);
|
sl@0
|
676 |
iFPObserver = &aObserver;
|
sl@0
|
677 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvprcSetObserver --"), this);
|
sl@0
|
678 |
}
|
sl@0
|
679 |
|
sl@0
|
680 |
void CNGAPostProcHwDevice::MmvsoSetSecureOutputL(TBool aSecure)
|
sl@0
|
681 |
{
|
sl@0
|
682 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvsoSetSecureOutputL aSecure = %d++"), this, aSecure);
|
sl@0
|
683 |
TInt err = KErrNone;
|
sl@0
|
684 |
if(aSecure)
|
sl@0
|
685 |
{
|
sl@0
|
686 |
iSurfaceMask = surfaceHints::EAllowInternalOnly;
|
sl@0
|
687 |
}
|
sl@0
|
688 |
else
|
sl@0
|
689 |
{
|
sl@0
|
690 |
iSurfaceMask = surfaceHints::EAllowAllExternals;
|
sl@0
|
691 |
}
|
sl@0
|
692 |
if(!iSurfaceId.IsNull())
|
sl@0
|
693 |
{
|
sl@0
|
694 |
err = AddHints();
|
sl@0
|
695 |
if(err != KErrNone)
|
sl@0
|
696 |
{
|
sl@0
|
697 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvsoSetSecureOutputL -- leaving err = %d"), this, err);
|
sl@0
|
698 |
User::Leave(err);
|
sl@0
|
699 |
}
|
sl@0
|
700 |
}
|
sl@0
|
701 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvsoSetSecureOutputL --"), this);
|
sl@0
|
702 |
}
|
sl@0
|
703 |
|
sl@0
|
704 |
void CNGAPostProcHwDevice::MmavsoSetAllowedOutputL(TUint aAllowedOutputMask)
|
sl@0
|
705 |
{
|
sl@0
|
706 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmavsoSetAllowedOutputL aAllowedOutputMask=0x%08x ++"), this,aAllowedOutputMask);
|
sl@0
|
707 |
TInt err = KErrNone;
|
sl@0
|
708 |
iSurfaceMask = surfaceHints::EAllowInternalOnly;
|
sl@0
|
709 |
if (aAllowedOutputMask == EVideoAllowAll)
|
sl@0
|
710 |
{
|
sl@0
|
711 |
iSurfaceMask = surfaceHints::EAllowAllExternals;
|
sl@0
|
712 |
}
|
sl@0
|
713 |
else if (aAllowedOutputMask == EVideoAllowInternalOnly)
|
sl@0
|
714 |
{
|
sl@0
|
715 |
iSurfaceMask = surfaceHints::EAllowInternalOnly;
|
sl@0
|
716 |
}
|
sl@0
|
717 |
else
|
sl@0
|
718 |
{
|
sl@0
|
719 |
// we hope to find some valid output prefs
|
sl@0
|
720 |
if (aAllowedOutputMask & EVideoAllowAnalog)
|
sl@0
|
721 |
{
|
sl@0
|
722 |
iSurfaceMask |= surfaceHints::EAllowAnalog;
|
sl@0
|
723 |
}
|
sl@0
|
724 |
if (aAllowedOutputMask & EVideoAllowMacroVision)
|
sl@0
|
725 |
{
|
sl@0
|
726 |
iSurfaceMask |= surfaceHints::EAllowAnalogProtectionRequired;
|
sl@0
|
727 |
}
|
sl@0
|
728 |
if (aAllowedOutputMask & EVideoAllowHDMI)
|
sl@0
|
729 |
{
|
sl@0
|
730 |
iSurfaceMask |= surfaceHints::EAllowDigital;
|
sl@0
|
731 |
}
|
sl@0
|
732 |
if (aAllowedOutputMask & EVideoAllowHdmiHdcpRequested)
|
sl@0
|
733 |
{
|
sl@0
|
734 |
iSurfaceMask |= surfaceHints::EAllowDigitalProtectionRequested;
|
sl@0
|
735 |
}
|
sl@0
|
736 |
if (aAllowedOutputMask & EVideoAllowHdmiHdcpRequired)
|
sl@0
|
737 |
{
|
sl@0
|
738 |
iSurfaceMask |= surfaceHints::EAllowDigitalProtectionRequired;
|
sl@0
|
739 |
}
|
sl@0
|
740 |
}
|
sl@0
|
741 |
|
sl@0
|
742 |
if((!iSurfaceId.IsNull()))
|
sl@0
|
743 |
{
|
sl@0
|
744 |
err = AddHints();
|
sl@0
|
745 |
if(err != KErrNone)
|
sl@0
|
746 |
{
|
sl@0
|
747 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmavsoSetAllowedOutputL -- leaving err = %d"), this, err);
|
sl@0
|
748 |
User::Leave(err);
|
sl@0
|
749 |
}
|
sl@0
|
750 |
}
|
sl@0
|
751 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmavsoSetAllowedOutputL --"), this);
|
sl@0
|
752 |
}
|
sl@0
|
753 |
|
sl@0
|
754 |
void CNGAPostProcHwDevice::SetPostProcessTypesL(TUint32 /*aCombination*/)
|
sl@0
|
755 |
{
|
sl@0
|
756 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetPostProcessTypesL ++"), this);
|
sl@0
|
757 |
|
sl@0
|
758 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetPostProcessTypesL --"), this);
|
sl@0
|
759 |
}
|
sl@0
|
760 |
|
sl@0
|
761 |
void CNGAPostProcHwDevice::SetInputCropOptionsL(const TRect& /*aRect*/)
|
sl@0
|
762 |
{
|
sl@0
|
763 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputCropOptionsL ++"), this);
|
sl@0
|
764 |
|
sl@0
|
765 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetInputCropOptionsL --"), this);
|
sl@0
|
766 |
}
|
sl@0
|
767 |
|
sl@0
|
768 |
void CNGAPostProcHwDevice::SetYuvToRgbOptionsL( const TYuvToRgbOptions& /*aOptions*/, const TYuvFormat& /*aYuvFormat*/, TRgbFormat /*aRgbFormat*/)
|
sl@0
|
769 |
{
|
sl@0
|
770 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetYuvToRgbOptionsL ++"), this);
|
sl@0
|
771 |
|
sl@0
|
772 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetYuvToRgbOptionsL --"), this);
|
sl@0
|
773 |
}
|
sl@0
|
774 |
|
sl@0
|
775 |
void CNGAPostProcHwDevice::SetYuvToRgbOptionsL(const TYuvToRgbOptions& /*aOptions*/)
|
sl@0
|
776 |
{
|
sl@0
|
777 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetYuvToRgbOptionsL ++"), this);
|
sl@0
|
778 |
|
sl@0
|
779 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetYuvToRgbOptionsL --"), this);
|
sl@0
|
780 |
}
|
sl@0
|
781 |
|
sl@0
|
782 |
void CNGAPostProcHwDevice::SetRotateOptionsL(TRotationType )
|
sl@0
|
783 |
{
|
sl@0
|
784 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetRotateOptionsL ++"), this);
|
sl@0
|
785 |
|
sl@0
|
786 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetRotateOptionsL --"));
|
sl@0
|
787 |
}
|
sl@0
|
788 |
|
sl@0
|
789 |
void CNGAPostProcHwDevice::SetScaleOptionsL(const TSize& /*aTargetSize*/, TBool /*aAntiAliasFiltering*/)
|
sl@0
|
790 |
{
|
sl@0
|
791 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetScaleOptionsL ++"), this);
|
sl@0
|
792 |
|
sl@0
|
793 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetScaleOptionsL --"), this);
|
sl@0
|
794 |
}
|
sl@0
|
795 |
|
sl@0
|
796 |
void CNGAPostProcHwDevice::SetOutputCropOptionsL(const TRect& /*aRect*/)
|
sl@0
|
797 |
{
|
sl@0
|
798 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetOutputCropOptionsL ++"), this);
|
sl@0
|
799 |
|
sl@0
|
800 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetOutputCropOptionsL --"), this);
|
sl@0
|
801 |
}
|
sl@0
|
802 |
|
sl@0
|
803 |
void CNGAPostProcHwDevice::SetPostProcSpecificOptionsL(const TDesC8& )
|
sl@0
|
804 |
{
|
sl@0
|
805 |
//ignore
|
sl@0
|
806 |
}
|
sl@0
|
807 |
|
sl@0
|
808 |
void CNGAPostProcHwDevice::CommitL()
|
sl@0
|
809 |
{
|
sl@0
|
810 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:CommitL ++"), this);
|
sl@0
|
811 |
|
sl@0
|
812 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:CommitL --"), this);
|
sl@0
|
813 |
}
|
sl@0
|
814 |
|
sl@0
|
815 |
void CNGAPostProcHwDevice::Revert()
|
sl@0
|
816 |
{
|
sl@0
|
817 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Revert ++"), this);
|
sl@0
|
818 |
|
sl@0
|
819 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Revert --"), this);
|
sl@0
|
820 |
}
|
sl@0
|
821 |
|
sl@0
|
822 |
void CNGAPostProcHwDevice::StartDirectScreenAccessL( const TRect& /*aVideoRect*/, CFbsScreenDevice& /*aScreenDevice*/, const TRegion& /*aClipRegion*/)
|
sl@0
|
823 |
{
|
sl@0
|
824 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:StartDSA ++"), this);
|
sl@0
|
825 |
|
sl@0
|
826 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:StartDSA --"), this);
|
sl@0
|
827 |
}
|
sl@0
|
828 |
|
sl@0
|
829 |
void CNGAPostProcHwDevice::AbortDirectScreenAccess()
|
sl@0
|
830 |
{
|
sl@0
|
831 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AbortDSA ++"), this);
|
sl@0
|
832 |
|
sl@0
|
833 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AbortDSA --"), this);
|
sl@0
|
834 |
}
|
sl@0
|
835 |
|
sl@0
|
836 |
void CNGAPostProcHwDevice::SetScreenClipRegion(const TRegion& /*aRegion*/)
|
sl@0
|
837 |
{
|
sl@0
|
838 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetScreenClipRegion ++"), this);
|
sl@0
|
839 |
|
sl@0
|
840 |
|
sl@0
|
841 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetScreenClipRegion --"), this);
|
sl@0
|
842 |
}
|
sl@0
|
843 |
|
sl@0
|
844 |
void CNGAPostProcHwDevice::SetPauseOnClipFail(TBool )
|
sl@0
|
845 |
{
|
sl@0
|
846 |
//ignore. Post Processor will always behave as aPause==False.
|
sl@0
|
847 |
}
|
sl@0
|
848 |
|
sl@0
|
849 |
TBool CNGAPostProcHwDevice::IsPlaying()
|
sl@0
|
850 |
{
|
sl@0
|
851 |
if( iPPState == EPlaying)
|
sl@0
|
852 |
{
|
sl@0
|
853 |
return ETrue;
|
sl@0
|
854 |
}
|
sl@0
|
855 |
else
|
sl@0
|
856 |
{
|
sl@0
|
857 |
return EFalse;
|
sl@0
|
858 |
}
|
sl@0
|
859 |
}
|
sl@0
|
860 |
|
sl@0
|
861 |
void CNGAPostProcHwDevice::Redraw()
|
sl@0
|
862 |
{
|
sl@0
|
863 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw ++"), this);
|
sl@0
|
864 |
TInt err = KErrNone;
|
sl@0
|
865 |
if(iRedrawSurfaceInUse && !iRedrawDone)
|
sl@0
|
866 |
{
|
sl@0
|
867 |
err = AddHints();
|
sl@0
|
868 |
if (err != KErrNone)
|
sl@0
|
869 |
{
|
sl@0
|
870 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw -- failed to AddHints %d"),
|
sl@0
|
871 |
this, err);
|
sl@0
|
872 |
iProxy->MdvppFatalError(this, err);
|
sl@0
|
873 |
return;
|
sl@0
|
874 |
}
|
sl@0
|
875 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw registering the temp surface"), this);
|
sl@0
|
876 |
err = RegisterSurface(iSurfaceId);
|
sl@0
|
877 |
if (err != KErrNone)
|
sl@0
|
878 |
{
|
sl@0
|
879 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw -- failed to Register Surface %d"),
|
sl@0
|
880 |
this, err);
|
sl@0
|
881 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
882 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
883 |
iProxy->MdvppFatalError(this, err);
|
sl@0
|
884 |
return;
|
sl@0
|
885 |
}
|
sl@0
|
886 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw registering the temp surface done"), this);
|
sl@0
|
887 |
iSessionManager->PostPicture(iSurfaceId, 0, 1, EFalse);
|
sl@0
|
888 |
PublishSurfaceCreated();
|
sl@0
|
889 |
iRedrawDone = ETrue;
|
sl@0
|
890 |
}
|
sl@0
|
891 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw --"), this);
|
sl@0
|
892 |
}
|
sl@0
|
893 |
|
sl@0
|
894 |
void CNGAPostProcHwDevice::Start()
|
sl@0
|
895 |
{
|
sl@0
|
896 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Start ++"), this);
|
sl@0
|
897 |
iPPState = EPlaying;
|
sl@0
|
898 |
AttemptToPost();
|
sl@0
|
899 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Start --"), this);
|
sl@0
|
900 |
}
|
sl@0
|
901 |
|
sl@0
|
902 |
void CNGAPostProcHwDevice::Stop()
|
sl@0
|
903 |
{
|
sl@0
|
904 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Stop ++"), this);
|
sl@0
|
905 |
iPPState = EStopped;
|
sl@0
|
906 |
iPostingTimer->Cancel();
|
sl@0
|
907 |
ReleaseInputQ();
|
sl@0
|
908 |
|
sl@0
|
909 |
RDebug::Printf("------ Statistics of Post Processor ------");
|
sl@0
|
910 |
RDebug::Printf(" Pictures Received : %d", iPictureCounters.iTotalPictures);
|
sl@0
|
911 |
RDebug::Printf(" Pictures Displayed: %d", iPictureCounters.iPicturesDisplayed);
|
sl@0
|
912 |
RDebug::Printf(" Pictures Skipped : %d", iPictureCounters.iPicturesSkipped);
|
sl@0
|
913 |
RDebug::Printf("------------------------------------------");
|
sl@0
|
914 |
|
sl@0
|
915 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Stop --"), this);
|
sl@0
|
916 |
}
|
sl@0
|
917 |
|
sl@0
|
918 |
void CNGAPostProcHwDevice::Pause()
|
sl@0
|
919 |
{
|
sl@0
|
920 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Pause ++"), this);
|
sl@0
|
921 |
iPPState = EPaused;
|
sl@0
|
922 |
iPostingTimer->Cancel();
|
sl@0
|
923 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Pause --"), this);
|
sl@0
|
924 |
}
|
sl@0
|
925 |
|
sl@0
|
926 |
void CNGAPostProcHwDevice::Resume()
|
sl@0
|
927 |
{
|
sl@0
|
928 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Resume ++"), this);
|
sl@0
|
929 |
iPPState = EPlaying;
|
sl@0
|
930 |
AttemptToPost();
|
sl@0
|
931 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Resume --"), this);
|
sl@0
|
932 |
}
|
sl@0
|
933 |
|
sl@0
|
934 |
void CNGAPostProcHwDevice::SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition)
|
sl@0
|
935 |
{
|
sl@0
|
936 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetPosition ++"), this);
|
sl@0
|
937 |
|
sl@0
|
938 |
if (iPPState == EInitializing)
|
sl@0
|
939 |
{
|
sl@0
|
940 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetPosition FAILED: Unexpected state"), this);
|
sl@0
|
941 |
return;
|
sl@0
|
942 |
}
|
sl@0
|
943 |
if (iPPState == EPaused)
|
sl@0
|
944 |
{
|
sl@0
|
945 |
iFirstPictureUpdated = EFalse;
|
sl@0
|
946 |
}
|
sl@0
|
947 |
iCurrentPlaybackPosition = aPlaybackPosition;
|
sl@0
|
948 |
|
sl@0
|
949 |
ReleaseInputQ();
|
sl@0
|
950 |
|
sl@0
|
951 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetPosition --"), this);
|
sl@0
|
952 |
}
|
sl@0
|
953 |
|
sl@0
|
954 |
void CNGAPostProcHwDevice::FreezePicture(const TTimeIntervalMicroSeconds& )
|
sl@0
|
955 |
{
|
sl@0
|
956 |
//TODO:
|
sl@0
|
957 |
}
|
sl@0
|
958 |
|
sl@0
|
959 |
void CNGAPostProcHwDevice::ReleaseFreeze(const TTimeIntervalMicroSeconds& )
|
sl@0
|
960 |
{
|
sl@0
|
961 |
//TODO:
|
sl@0
|
962 |
}
|
sl@0
|
963 |
|
sl@0
|
964 |
TTimeIntervalMicroSeconds
|
sl@0
|
965 |
CNGAPostProcHwDevice::PlaybackPosition()
|
sl@0
|
966 |
{
|
sl@0
|
967 |
if (iPPState == EInitializing)
|
sl@0
|
968 |
{
|
sl@0
|
969 |
return TTimeIntervalMicroSeconds(0);
|
sl@0
|
970 |
}
|
sl@0
|
971 |
|
sl@0
|
972 |
return iCurrentPlaybackPosition;
|
sl@0
|
973 |
}
|
sl@0
|
974 |
|
sl@0
|
975 |
TUint CNGAPostProcHwDevice::PictureBufferBytes()
|
sl@0
|
976 |
{ //TODO
|
sl@0
|
977 |
return 0;
|
sl@0
|
978 |
}
|
sl@0
|
979 |
|
sl@0
|
980 |
void CNGAPostProcHwDevice::GetPictureCounters( CMMFDevVideoPlay::TPictureCounters& aCounters)
|
sl@0
|
981 |
{
|
sl@0
|
982 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetPictureCounters ++"), this);
|
sl@0
|
983 |
|
sl@0
|
984 |
if (iPPState == EInitializing)
|
sl@0
|
985 |
return;
|
sl@0
|
986 |
aCounters = iPictureCounters;
|
sl@0
|
987 |
|
sl@0
|
988 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetPictureCounters --"), this);
|
sl@0
|
989 |
}
|
sl@0
|
990 |
|
sl@0
|
991 |
void CNGAPostProcHwDevice::SetComplexityLevel(TUint )
|
sl@0
|
992 |
{
|
sl@0
|
993 |
//not required
|
sl@0
|
994 |
}
|
sl@0
|
995 |
|
sl@0
|
996 |
TUint CNGAPostProcHwDevice::NumComplexityLevels()
|
sl@0
|
997 |
{
|
sl@0
|
998 |
//not required
|
sl@0
|
999 |
return 1;
|
sl@0
|
1000 |
}
|
sl@0
|
1001 |
|
sl@0
|
1002 |
void CNGAPostProcHwDevice::GetComplexityLevelInfo(TUint , CMMFDevVideoPlay::TComplexityLevelInfo& )
|
sl@0
|
1003 |
{
|
sl@0
|
1004 |
//not required
|
sl@0
|
1005 |
}
|
sl@0
|
1006 |
|
sl@0
|
1007 |
void CNGAPostProcHwDevice::ReturnPicture(TVideoPicture* )
|
sl@0
|
1008 |
{
|
sl@0
|
1009 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReturnPicture +-"), this);
|
sl@0
|
1010 |
//not required for direct rendering
|
sl@0
|
1011 |
}
|
sl@0
|
1012 |
|
sl@0
|
1013 |
TBool CNGAPostProcHwDevice::GetSnapshotL(TPictureData& aPictureData, const TUncompressedVideoFormat& /*aFormat*/)
|
sl@0
|
1014 |
{
|
sl@0
|
1015 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL %d %d ++"), this, iVBMEnabled, iProcessQ.Count());
|
sl@0
|
1016 |
TVideoPicture* pic = NULL;
|
sl@0
|
1017 |
TInt err = KErrNone;
|
sl@0
|
1018 |
TBool frameAvailable =EFalse;
|
sl@0
|
1019 |
tWndParam inputCropWindow;
|
sl@0
|
1020 |
tWndParam outputCropWindow;
|
sl@0
|
1021 |
tBaseVideoFrame inputFrame;
|
sl@0
|
1022 |
inputFrame.lum = NULL;
|
sl@0
|
1023 |
|
sl@0
|
1024 |
if(aPictureData.iDataFormat == ERgbFbsBitmap)
|
sl@0
|
1025 |
{
|
sl@0
|
1026 |
if(iProcessQ.Count())
|
sl@0
|
1027 |
{
|
sl@0
|
1028 |
pic = iProcessQ[0]; //frame already submitted for display
|
sl@0
|
1029 |
}
|
sl@0
|
1030 |
else if(iInputQ.Count())
|
sl@0
|
1031 |
{
|
sl@0
|
1032 |
pic = iInputQ[0]; //frame yet to be displayed
|
sl@0
|
1033 |
}
|
sl@0
|
1034 |
if(pic)
|
sl@0
|
1035 |
{
|
sl@0
|
1036 |
if (iVBMEnabled)
|
sl@0
|
1037 |
{
|
sl@0
|
1038 |
inputFrame.lum = (TUint8*)pic->iData.iRawData->Ptr();
|
sl@0
|
1039 |
}
|
sl@0
|
1040 |
else
|
sl@0
|
1041 |
{
|
sl@0
|
1042 |
if (iInputDecoderDevice)
|
sl@0
|
1043 |
{
|
sl@0
|
1044 |
MMmfVideoFetchFrame* VFHandler = NULL;
|
sl@0
|
1045 |
VFHandler = (MMmfVideoFetchFrame*)iInputDecoderDevice->CustomInterface(KUidMMFVideoFetchFrame);
|
sl@0
|
1046 |
if (VFHandler)
|
sl@0
|
1047 |
{
|
sl@0
|
1048 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL() fetch frame"), this);
|
sl@0
|
1049 |
inputFrame.lum = (TUint8*)VFHandler->MmvffGetFrame(GetID(pic));
|
sl@0
|
1050 |
}
|
sl@0
|
1051 |
else
|
sl@0
|
1052 |
{
|
sl@0
|
1053 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL() decoder yet to implement MMmfVideoFetchFrame CI"), this);
|
sl@0
|
1054 |
}
|
sl@0
|
1055 |
}
|
sl@0
|
1056 |
}
|
sl@0
|
1057 |
}
|
sl@0
|
1058 |
if(inputFrame.lum)
|
sl@0
|
1059 |
{
|
sl@0
|
1060 |
inputFrame.cb = inputFrame.lum + iPicSize.iWidth * iPicSize.iHeight;
|
sl@0
|
1061 |
|
sl@0
|
1062 |
if( ((iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma1) ||
|
sl@0
|
1063 |
(iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma2) ||
|
sl@0
|
1064 |
(iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma3) ))
|
sl@0
|
1065 |
{
|
sl@0
|
1066 |
inputFrame.cr = inputFrame.lum + (iPicSize.iWidth * iPicSize.iHeight*5)/4;
|
sl@0
|
1067 |
}
|
sl@0
|
1068 |
else
|
sl@0
|
1069 |
{
|
sl@0
|
1070 |
inputFrame.cr = inputFrame.lum + (iPicSize.iWidth * iPicSize.iHeight*3)/2;
|
sl@0
|
1071 |
}
|
sl@0
|
1072 |
|
sl@0
|
1073 |
inputFrame.width = (unsigned short)iPicSize.iWidth;
|
sl@0
|
1074 |
inputFrame.height = (unsigned short)iPicSize.iHeight;
|
sl@0
|
1075 |
|
sl@0
|
1076 |
outputCropWindow.wndHeight = iPicSize.iHeight;
|
sl@0
|
1077 |
outputCropWindow.wndWidth = iPicSize.iWidth;
|
sl@0
|
1078 |
outputCropWindow.xOffset = 0;
|
sl@0
|
1079 |
outputCropWindow.yOffset = 0;
|
sl@0
|
1080 |
|
sl@0
|
1081 |
inputCropWindow.wndHeight = iPicSize.iHeight;
|
sl@0
|
1082 |
inputCropWindow.wndWidth = iPicSize.iWidth;
|
sl@0
|
1083 |
inputCropWindow.xOffset = 0;
|
sl@0
|
1084 |
inputCropWindow.yOffset = 0;
|
sl@0
|
1085 |
|
sl@0
|
1086 |
RFbsSession fbs;
|
sl@0
|
1087 |
fbs.Connect();
|
sl@0
|
1088 |
CFbsBitmap* iOutBitmap = aPictureData.iRgbBitmap;
|
sl@0
|
1089 |
TInt status = iOutBitmap->Resize(iPicSize);
|
sl@0
|
1090 |
if (status == KErrNone)
|
sl@0
|
1091 |
{
|
sl@0
|
1092 |
// Lock the heap to prevent the FBS server from invalidating the address
|
sl@0
|
1093 |
iOutBitmap->LockHeap();
|
sl@0
|
1094 |
TUint8* dataAddress = (TUint8*)iOutBitmap->DataAddress();
|
sl@0
|
1095 |
err = ColorConvert(&inputFrame, dataAddress, &inputCropWindow, &outputCropWindow);
|
sl@0
|
1096 |
iOutBitmap->UnlockHeap();
|
sl@0
|
1097 |
frameAvailable = ETrue;
|
sl@0
|
1098 |
}
|
sl@0
|
1099 |
fbs.Disconnect();
|
sl@0
|
1100 |
}
|
sl@0
|
1101 |
}
|
sl@0
|
1102 |
else
|
sl@0
|
1103 |
{
|
sl@0
|
1104 |
err = KErrNotSupported;
|
sl@0
|
1105 |
}
|
sl@0
|
1106 |
if(err != KErrNone)
|
sl@0
|
1107 |
{
|
sl@0
|
1108 |
User::Leave(err);
|
sl@0
|
1109 |
}
|
sl@0
|
1110 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL --"), this);
|
sl@0
|
1111 |
return(frameAvailable);
|
sl@0
|
1112 |
}
|
sl@0
|
1113 |
|
sl@0
|
1114 |
void CNGAPostProcHwDevice::InputEnd()
|
sl@0
|
1115 |
{
|
sl@0
|
1116 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:InputEnd ++"), this);
|
sl@0
|
1117 |
|
sl@0
|
1118 |
if (iPPState!=EPlaying && iPPState!=EPaused)
|
sl@0
|
1119 |
{
|
sl@0
|
1120 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:InputEnd FAILED: Unexpected state"), this);
|
sl@0
|
1121 |
return;
|
sl@0
|
1122 |
}
|
sl@0
|
1123 |
iIsInputEnded = ETrue;
|
sl@0
|
1124 |
|
sl@0
|
1125 |
if( (iProcessQ.Count() == 1) && (iInputQ.Count() == 0))
|
sl@0
|
1126 |
{
|
sl@0
|
1127 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:InputEnd() Stream end"), this);
|
sl@0
|
1128 |
iProxy->MdvppStreamEnd();
|
sl@0
|
1129 |
}
|
sl@0
|
1130 |
|
sl@0
|
1131 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:InputEnd --"), this);
|
sl@0
|
1132 |
}
|
sl@0
|
1133 |
|
sl@0
|
1134 |
TAny* CNGAPostProcHwDevice::CustomInterface(TUid aInterface)
|
sl@0
|
1135 |
{
|
sl@0
|
1136 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:CustomInterface UID = %d ++"), this, aInterface.iUid);
|
sl@0
|
1137 |
|
sl@0
|
1138 |
if (aInterface == KUidMmfVideoBufferManagement)
|
sl@0
|
1139 |
{
|
sl@0
|
1140 |
return (MMmfVideoBufferManagement *)this;
|
sl@0
|
1141 |
}
|
sl@0
|
1142 |
if (aInterface == KUidMMFVideoSurfaceSupport)
|
sl@0
|
1143 |
{
|
sl@0
|
1144 |
return (MMMFVideoSurfaceSupport *)this;
|
sl@0
|
1145 |
}
|
sl@0
|
1146 |
if (aInterface == KUidMMFVideoSurfaceHandleControl)
|
sl@0
|
1147 |
{
|
sl@0
|
1148 |
return (MMmfVideoSurfaceHandleControl *)this;
|
sl@0
|
1149 |
}
|
sl@0
|
1150 |
if (aInterface == KUidMmfVideoPlayRateControl)
|
sl@0
|
1151 |
{
|
sl@0
|
1152 |
return (MMmfVideoPlayRateControl *)this;
|
sl@0
|
1153 |
}
|
sl@0
|
1154 |
if (aInterface == KMmfVideoAdvancedSecureOutputUid)
|
sl@0
|
1155 |
{
|
sl@0
|
1156 |
return (MMmfAdvancedVideoSecureOutput *)this;
|
sl@0
|
1157 |
}
|
sl@0
|
1158 |
if (aInterface == KUidMmfVideoResourceManagement)
|
sl@0
|
1159 |
{
|
sl@0
|
1160 |
return (MMmfVideoResourceObserver *)this;
|
sl@0
|
1161 |
}
|
sl@0
|
1162 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:CustomInterface --"), this);
|
sl@0
|
1163 |
return NULL;
|
sl@0
|
1164 |
}
|
sl@0
|
1165 |
|
sl@0
|
1166 |
void CNGAPostProcHwDevice::BufferAvailable(TInt aBufId, TInt aStatus)
|
sl@0
|
1167 |
{
|
sl@0
|
1168 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:CNGAPostProcHwDevice::BufferAvailable aStatus = %d aBufId = %d++"), this, aStatus, aBufId);
|
sl@0
|
1169 |
TVideoPicture* pic = NULL;
|
sl@0
|
1170 |
if((aStatus != KErrNone) && (aStatus != KErrOverflow) && (aStatus != KErrNotVisible))
|
sl@0
|
1171 |
{
|
sl@0
|
1172 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:BufferAvailable FAILED: aStatus = %d"), this, aStatus);
|
sl@0
|
1173 |
iProxy->MdvppFatalError(this, aStatus);
|
sl@0
|
1174 |
}
|
sl@0
|
1175 |
|
sl@0
|
1176 |
if(aStatus == KErrOverflow)
|
sl@0
|
1177 |
{
|
sl@0
|
1178 |
iOverflowPictureCounter++;
|
sl@0
|
1179 |
PicturesSkipped();
|
sl@0
|
1180 |
}
|
sl@0
|
1181 |
|
sl@0
|
1182 |
if (iVBMEnabled)
|
sl@0
|
1183 |
{
|
sl@0
|
1184 |
for(TInt i=0; i < iProcessQ.Count(); i++)
|
sl@0
|
1185 |
{
|
sl@0
|
1186 |
if(iVBMBufferReferenceQ[aBufId] == iProcessQ[i])
|
sl@0
|
1187 |
{
|
sl@0
|
1188 |
pic = iProcessQ[i];
|
sl@0
|
1189 |
iProcessQ.Remove(i);
|
sl@0
|
1190 |
ReturnPicToDecoder(pic);
|
sl@0
|
1191 |
if (iIsColorConversionNeeded)
|
sl@0
|
1192 |
{
|
sl@0
|
1193 |
AddPictureToColorConversionQ(pic);
|
sl@0
|
1194 |
}
|
sl@0
|
1195 |
else
|
sl@0
|
1196 |
{
|
sl@0
|
1197 |
AddPictureToVBMQ(pic);
|
sl@0
|
1198 |
}
|
sl@0
|
1199 |
break;
|
sl@0
|
1200 |
}
|
sl@0
|
1201 |
}
|
sl@0
|
1202 |
}
|
sl@0
|
1203 |
else if (iUsingExternalSurface)
|
sl@0
|
1204 |
{
|
sl@0
|
1205 |
for(TInt i=0; i < iProcessQ.Count(); i++)
|
sl@0
|
1206 |
{
|
sl@0
|
1207 |
if (aBufId == GetExternalBufferID(iProcessQ[i]))
|
sl@0
|
1208 |
{
|
sl@0
|
1209 |
pic = iProcessQ[i];
|
sl@0
|
1210 |
iProcessQ.Remove(i);
|
sl@0
|
1211 |
ReturnPicToDecoder(pic);
|
sl@0
|
1212 |
break;
|
sl@0
|
1213 |
}
|
sl@0
|
1214 |
}
|
sl@0
|
1215 |
}
|
sl@0
|
1216 |
|
sl@0
|
1217 |
if(aStatus == KErrNone)
|
sl@0
|
1218 |
{
|
sl@0
|
1219 |
if (!iKeyFrameMode && iPlayRate>KDefPlayRate)
|
sl@0
|
1220 |
{
|
sl@0
|
1221 |
if (iSkippedFramesCountingBuffer[iCurrentPosInFramesCountingBuffer]==1)
|
sl@0
|
1222 |
{
|
sl@0
|
1223 |
iSkippedFramesCountingBuffer[iCurrentPosInFramesCountingBuffer] = 0;
|
sl@0
|
1224 |
iSkippedFramesInLast64Frames--;
|
sl@0
|
1225 |
}
|
sl@0
|
1226 |
iCurrentPosInFramesCountingBuffer = ++iCurrentPosInFramesCountingBuffer%64;
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
iPictureCounters.iPicturesDisplayed++;
|
sl@0
|
1229 |
if (iStepFrameCount != 0)
|
sl@0
|
1230 |
{
|
sl@0
|
1231 |
iStepFrameCount > 0 ? iStepFrameCount-- : iStepFrameCount++;
|
sl@0
|
1232 |
if (iStepFrameCount==0 && iFPObserver)
|
sl@0
|
1233 |
{
|
sl@0
|
1234 |
iFPObserver->MmvproStepFrameComplete(pic->iTimestamp);
|
sl@0
|
1235 |
}
|
sl@0
|
1236 |
}
|
sl@0
|
1237 |
}
|
sl@0
|
1238 |
|
sl@0
|
1239 |
if(iPPState == EPlaying)
|
sl@0
|
1240 |
{
|
sl@0
|
1241 |
AttemptToPost();
|
sl@0
|
1242 |
}
|
sl@0
|
1243 |
|
sl@0
|
1244 |
if( iIsInputEnded && (iProcessQ.Count() == 1) && (iInputQ.Count() == 0))
|
sl@0
|
1245 |
{
|
sl@0
|
1246 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:BufferAvailable() Stream end"), this);
|
sl@0
|
1247 |
iProxy->MdvppStreamEnd();
|
sl@0
|
1248 |
}
|
sl@0
|
1249 |
|
sl@0
|
1250 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:CNGAPostProcHwDevice::BufferAvailable --"), this);
|
sl@0
|
1251 |
}
|
sl@0
|
1252 |
|
sl@0
|
1253 |
//=== MMmfVideoBufferManagement ===
|
sl@0
|
1254 |
void CNGAPostProcHwDevice::MmvbmSetObserver(MMmfVideoBufferManagementObserver* aObserver)
|
sl@0
|
1255 |
{
|
sl@0
|
1256 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetObserver() ++"), this);
|
sl@0
|
1257 |
|
sl@0
|
1258 |
if (iPPState != EInitializing)
|
sl@0
|
1259 |
{
|
sl@0
|
1260 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetObserver FAILED: Unexpected state"), this);
|
sl@0
|
1261 |
iProxy->MdvppFatalError(this, KErrNotReady);
|
sl@0
|
1262 |
}
|
sl@0
|
1263 |
|
sl@0
|
1264 |
iVBMObserver = aObserver;
|
sl@0
|
1265 |
|
sl@0
|
1266 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetObserver() --"), this);
|
sl@0
|
1267 |
}
|
sl@0
|
1268 |
|
sl@0
|
1269 |
|
sl@0
|
1270 |
void CNGAPostProcHwDevice::MmvbmEnable(TBool aEnable)
|
sl@0
|
1271 |
{
|
sl@0
|
1272 |
if (iPPState != EInitializing)
|
sl@0
|
1273 |
{
|
sl@0
|
1274 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmEnable FAILED: Unexpected state"), this);
|
sl@0
|
1275 |
iProxy->MdvppFatalError(this, KErrNotReady);
|
sl@0
|
1276 |
}
|
sl@0
|
1277 |
|
sl@0
|
1278 |
iVBMEnabled = aEnable;
|
sl@0
|
1279 |
}
|
sl@0
|
1280 |
|
sl@0
|
1281 |
void CNGAPostProcHwDevice::MmvbmSetBufferOptionsL(const TBufferOptions& aOptions)
|
sl@0
|
1282 |
{
|
sl@0
|
1283 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetBufferOptionsL ++"), this);
|
sl@0
|
1284 |
|
sl@0
|
1285 |
if (iPPState != EInitializing)
|
sl@0
|
1286 |
{
|
sl@0
|
1287 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetBufferOptionsL FAILED: Unexpected state"), this);
|
sl@0
|
1288 |
User::Leave(KErrNotReady);
|
sl@0
|
1289 |
}
|
sl@0
|
1290 |
|
sl@0
|
1291 |
if (aOptions.iNumInputBuffers > KMaxVBMBuffers
|
sl@0
|
1292 |
|| aOptions.iNumInputBuffers <= 1) //at least two buffers
|
sl@0
|
1293 |
{
|
sl@0
|
1294 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetBufferOptionsL FAILED: Input buffer count limit"), this);
|
sl@0
|
1295 |
User::Leave(KErrNotSupported);
|
sl@0
|
1296 |
}
|
sl@0
|
1297 |
|
sl@0
|
1298 |
if (aOptions.iNumInputBuffers == 0
|
sl@0
|
1299 |
|| aOptions.iBufferSize.iWidth <= KMinVBMInputWidth
|
sl@0
|
1300 |
|| aOptions.iBufferSize.iHeight <= KMinVBMInputHeight
|
sl@0
|
1301 |
|| aOptions.iBufferSize.iWidth > KMaxVBMInputWidth
|
sl@0
|
1302 |
|| aOptions.iBufferSize.iHeight > KMaxVBMInputHeight)
|
sl@0
|
1303 |
{
|
sl@0
|
1304 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetBufferOptionsL FAILED: Unexpected buffer size"), this);
|
sl@0
|
1305 |
User::Leave(KErrArgument);
|
sl@0
|
1306 |
}
|
sl@0
|
1307 |
|
sl@0
|
1308 |
iVBMBufferOptions.iNumInputBuffers = aOptions.iNumInputBuffers;
|
sl@0
|
1309 |
iVBMBufferOptions.iBufferSize = aOptions.iBufferSize;
|
sl@0
|
1310 |
|
sl@0
|
1311 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmSetBufferOptionsL --"), this);
|
sl@0
|
1312 |
}
|
sl@0
|
1313 |
|
sl@0
|
1314 |
void CNGAPostProcHwDevice::MmvbmGetBufferOptions(TBufferOptions& aOptions)
|
sl@0
|
1315 |
{
|
sl@0
|
1316 |
if (iPPState == EInitializing)
|
sl@0
|
1317 |
{
|
sl@0
|
1318 |
aOptions = iVBMBufferOptions;
|
sl@0
|
1319 |
}
|
sl@0
|
1320 |
else
|
sl@0
|
1321 |
{
|
sl@0
|
1322 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferOptions FAILED: Unexpected state"), this);
|
sl@0
|
1323 |
iProxy->MdvppFatalError(this, KErrNotReady);
|
sl@0
|
1324 |
}
|
sl@0
|
1325 |
}
|
sl@0
|
1326 |
|
sl@0
|
1327 |
TVideoPicture* CNGAPostProcHwDevice::MmvbmGetBufferL(const TSize& aSize)
|
sl@0
|
1328 |
{
|
sl@0
|
1329 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferL() ++"), this);
|
sl@0
|
1330 |
|
sl@0
|
1331 |
TInt err = KErrNone;
|
sl@0
|
1332 |
TVideoPicture* lPic = NULL;
|
sl@0
|
1333 |
|
sl@0
|
1334 |
if (iPPState == EInitializing)
|
sl@0
|
1335 |
{
|
sl@0
|
1336 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferL() FAILED: Unexpected state"), this);
|
sl@0
|
1337 |
User::Leave(KErrNotReady);
|
sl@0
|
1338 |
}
|
sl@0
|
1339 |
|
sl@0
|
1340 |
if (aSize.iWidth < KMinVBMInputWidth
|
sl@0
|
1341 |
|| aSize.iHeight < KMinVBMInputHeight
|
sl@0
|
1342 |
|| aSize.iWidth > iVBMBufferOptions.iBufferSize.iWidth
|
sl@0
|
1343 |
|| aSize.iHeight > iVBMBufferOptions.iBufferSize.iHeight)
|
sl@0
|
1344 |
{
|
sl@0
|
1345 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferL() FAILED: Unexpected buffer size w=%d h=%d "), this,aSize.iWidth,aSize.iHeight );
|
sl@0
|
1346 |
User::Leave(KErrNotSupported);
|
sl@0
|
1347 |
}
|
sl@0
|
1348 |
|
sl@0
|
1349 |
if(iVBMBufferReferenceQ.Count() == 0)
|
sl@0
|
1350 |
{
|
sl@0
|
1351 |
iPicSize = aSize;
|
sl@0
|
1352 |
err = SetupSurface(aSize);
|
sl@0
|
1353 |
if(err)
|
sl@0
|
1354 |
{
|
sl@0
|
1355 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferL() Surface Setup Failed %d"), this, err);
|
sl@0
|
1356 |
User::Leave(err);
|
sl@0
|
1357 |
}
|
sl@0
|
1358 |
}
|
sl@0
|
1359 |
|
sl@0
|
1360 |
if(!iVBMBufferQ.Count())
|
sl@0
|
1361 |
{
|
sl@0
|
1362 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferL() WARNING: Queue buffer count zero"), this);
|
sl@0
|
1363 |
return NULL;
|
sl@0
|
1364 |
}
|
sl@0
|
1365 |
|
sl@0
|
1366 |
lPic = iVBMBufferQ[0];
|
sl@0
|
1367 |
iVBMBufferQ.Remove(0);
|
sl@0
|
1368 |
|
sl@0
|
1369 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferL() -- %d"), this, lPic);
|
sl@0
|
1370 |
return lPic;
|
sl@0
|
1371 |
}
|
sl@0
|
1372 |
|
sl@0
|
1373 |
void CNGAPostProcHwDevice::MmvbmReleaseBuffer(TVideoPicture* aBuffer)
|
sl@0
|
1374 |
{
|
sl@0
|
1375 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmReleaseBuffer() ++"), this);
|
sl@0
|
1376 |
|
sl@0
|
1377 |
if(!aBuffer)
|
sl@0
|
1378 |
{
|
sl@0
|
1379 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmReleaseBuffer() FAILED: Invalid buffer ptr"), this);
|
sl@0
|
1380 |
iProxy->MdvppFatalError(this, KErrArgument);
|
sl@0
|
1381 |
}
|
sl@0
|
1382 |
|
sl@0
|
1383 |
TInt err = iVBMBufferQ.Append(aBuffer);
|
sl@0
|
1384 |
if (err)
|
sl@0
|
1385 |
{
|
sl@0
|
1386 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmReleaseBuffer() FAILED: Failed to append"), this);
|
sl@0
|
1387 |
iProxy->MdvppFatalError(this, err);
|
sl@0
|
1388 |
}
|
sl@0
|
1389 |
|
sl@0
|
1390 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmReleaseBuffer() --"), this);
|
sl@0
|
1391 |
}
|
sl@0
|
1392 |
|
sl@0
|
1393 |
//=== MMMFVideoSurfaceSupport ===
|
sl@0
|
1394 |
|
sl@0
|
1395 |
void CNGAPostProcHwDevice::MmvssUseSurfaces()
|
sl@0
|
1396 |
{
|
sl@0
|
1397 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssUseSurfaces() ++"), this);
|
sl@0
|
1398 |
// do nothing
|
sl@0
|
1399 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssUseSurfaces() --"), this);
|
sl@0
|
1400 |
}
|
sl@0
|
1401 |
|
sl@0
|
1402 |
void CNGAPostProcHwDevice::MmvssSetObserver(MMMFVideoSurfaceObserver& aObserver)
|
sl@0
|
1403 |
{
|
sl@0
|
1404 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSetObserver() ++"), this);
|
sl@0
|
1405 |
iVideoSurfaceObserver = &aObserver;
|
sl@0
|
1406 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSetObserver() --"), this);
|
sl@0
|
1407 |
}
|
sl@0
|
1408 |
|
sl@0
|
1409 |
void CNGAPostProcHwDevice::MmvssGetSurfaceParametersL(TSurfaceId& aSurfaceId,
|
sl@0
|
1410 |
TRect& aCropRect, TVideoAspectRatio& aPixelAspectRatio)
|
sl@0
|
1411 |
{
|
sl@0
|
1412 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() ++"), this);
|
sl@0
|
1413 |
|
sl@0
|
1414 |
iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo);
|
sl@0
|
1415 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() \
|
sl@0
|
1416 |
surfaceWidth = %d surfaceHeight = %d SurfaceId = 0x%x --"),
|
sl@0
|
1417 |
this, iInfo().iSize.iWidth, iInfo().iSize.iHeight, iSurfaceId);
|
sl@0
|
1418 |
aSurfaceId = iSurfaceId;
|
sl@0
|
1419 |
aCropRect = TRect(0, 0, iInfo().iSize.iWidth, iInfo().iSize.iHeight);
|
sl@0
|
1420 |
if((iPicSize.iWidth > 0) && (iPicSize.iHeight > 0))
|
sl@0
|
1421 |
{
|
sl@0
|
1422 |
aCropRect.Intersection( iPicSize);
|
sl@0
|
1423 |
}
|
sl@0
|
1424 |
aPixelAspectRatio = TVideoAspectRatio(iAspectRatioNum,iAspectRatioDenom);
|
sl@0
|
1425 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() \
|
sl@0
|
1426 |
cropRectWidth = %d cropRectHeight = %d"), this, aCropRect.Width(), aCropRect.Height());
|
sl@0
|
1427 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() \
|
sl@0
|
1428 |
PAR Num = %d PAR Denom = %d"), this, aPixelAspectRatio.iNumerator, aPixelAspectRatio.iDenominator);
|
sl@0
|
1429 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() --"), this);
|
sl@0
|
1430 |
}
|
sl@0
|
1431 |
|
sl@0
|
1432 |
void CNGAPostProcHwDevice::MmvssSurfaceRemovedL(const TSurfaceId& aSurfaceId)
|
sl@0
|
1433 |
{
|
sl@0
|
1434 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL()++"), this);
|
sl@0
|
1435 |
if(!aSurfaceId.IsNull())
|
sl@0
|
1436 |
{
|
sl@0
|
1437 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL(): UnregisterSurface ID = 0x%x"), this, aSurfaceId );
|
sl@0
|
1438 |
TInt numScreens = iWsSession.NumberOfScreens();
|
sl@0
|
1439 |
for(TInt i=0;i < numScreens;i++)
|
sl@0
|
1440 |
{
|
sl@0
|
1441 |
iWsSession.UnregisterSurface(i, aSurfaceId);
|
sl@0
|
1442 |
}
|
sl@0
|
1443 |
iWsSession.Flush();
|
sl@0
|
1444 |
iSurfaceHandler->DestroySurface(aSurfaceId);
|
sl@0
|
1445 |
if(iSurfaceId == aSurfaceId)
|
sl@0
|
1446 |
{
|
sl@0
|
1447 |
iSurfaceCreatedEventPublished = EFalse;
|
sl@0
|
1448 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
1449 |
iChunk.Close();
|
sl@0
|
1450 |
}
|
sl@0
|
1451 |
}
|
sl@0
|
1452 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL() --"), this);
|
sl@0
|
1453 |
}
|
sl@0
|
1454 |
|
sl@0
|
1455 |
// === MMmfVideoPropertiesObserver ===
|
sl@0
|
1456 |
|
sl@0
|
1457 |
void CNGAPostProcHwDevice::MmvpoUpdateVideoProperties(const TYuvFormat& aYuvFormat, const TSize& aPictureSize)
|
sl@0
|
1458 |
{
|
sl@0
|
1459 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties ++"), this);
|
sl@0
|
1460 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties PAR \
|
sl@0
|
1461 |
iAspectRatioNum = %d, iAspectRatioDenom = %d"), this,
|
sl@0
|
1462 |
aYuvFormat.iAspectRatioNum,aYuvFormat.iAspectRatioDenom);
|
sl@0
|
1463 |
iPicSize = aPictureSize;
|
sl@0
|
1464 |
iAspectRatioNum = aYuvFormat.iAspectRatioNum;
|
sl@0
|
1465 |
iAspectRatioDenom = aYuvFormat.iAspectRatioDenom;
|
sl@0
|
1466 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties Picture Size \
|
sl@0
|
1467 |
iWidth = %d, iHeight = %d, iSurfaceCreatedEventPublished = %d"),
|
sl@0
|
1468 |
this, iPicSize.iWidth,iPicSize.iHeight, iSurfaceCreatedEventPublished?1:0);
|
sl@0
|
1469 |
|
sl@0
|
1470 |
if(iVPObserver)
|
sl@0
|
1471 |
{
|
sl@0
|
1472 |
iVPObserver->MmvpoUpdateVideoProperties(aYuvFormat, aPictureSize);
|
sl@0
|
1473 |
}
|
sl@0
|
1474 |
if(iVideoSurfaceObserver && iSurfaceCreatedEventPublished)
|
sl@0
|
1475 |
{
|
sl@0
|
1476 |
iVideoSurfaceObserver->MmvsoSurfaceParametersChanged();
|
sl@0
|
1477 |
}
|
sl@0
|
1478 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties --"), this);
|
sl@0
|
1479 |
}
|
sl@0
|
1480 |
|
sl@0
|
1481 |
// === MMmfVideoResourceObserver ===
|
sl@0
|
1482 |
|
sl@0
|
1483 |
void CNGAPostProcHwDevice::MmvroResourcesLost(TUid )
|
sl@0
|
1484 |
{
|
sl@0
|
1485 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost ++"), this);
|
sl@0
|
1486 |
if(!iResourceLost)
|
sl@0
|
1487 |
{
|
sl@0
|
1488 |
iResourceLost = ETrue;
|
sl@0
|
1489 |
iRedrawDone = EFalse;
|
sl@0
|
1490 |
Pause();
|
sl@0
|
1491 |
ReleaseInputQ();
|
sl@0
|
1492 |
iSessionManager->CancelUpdate();
|
sl@0
|
1493 |
ReleaseProcessQ();
|
sl@0
|
1494 |
if(iVideoSurfaceObserver && iSurfaceCreatedEventPublished)
|
sl@0
|
1495 |
{
|
sl@0
|
1496 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost - Telling client to remove surface"), this);
|
sl@0
|
1497 |
iVideoSurfaceObserver->MmvsoRemoveSurface();
|
sl@0
|
1498 |
iSurfaceCreatedEventPublished = EFalse;
|
sl@0
|
1499 |
}
|
sl@0
|
1500 |
}
|
sl@0
|
1501 |
else if(iResourceLost && iRedrawDone)
|
sl@0
|
1502 |
{
|
sl@0
|
1503 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost ResourceLost happening \
|
sl@0
|
1504 |
while Postprocessor is already in ResourceLoss state"),
|
sl@0
|
1505 |
this);
|
sl@0
|
1506 |
iProxy->MdvppFatalError(this, KErrHardwareNotAvailable);
|
sl@0
|
1507 |
return;
|
sl@0
|
1508 |
}
|
sl@0
|
1509 |
else
|
sl@0
|
1510 |
{
|
sl@0
|
1511 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost Ignoring the \
|
sl@0
|
1512 |
duplicate ResourceLoss call"),
|
sl@0
|
1513 |
this);
|
sl@0
|
1514 |
}
|
sl@0
|
1515 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost --"), this);
|
sl@0
|
1516 |
}
|
sl@0
|
1517 |
|
sl@0
|
1518 |
// === MMmfVideoPropertiesNotifier ===
|
sl@0
|
1519 |
|
sl@0
|
1520 |
void CNGAPostProcHwDevice::MmvpnSetObserver(MMmfVideoPropertiesObserver* aObserver)
|
sl@0
|
1521 |
{
|
sl@0
|
1522 |
PP_DEBUG(_L("ppHwDev[%x]::MmvpnSetObserver ++"), this);
|
sl@0
|
1523 |
iVPObserver = aObserver;
|
sl@0
|
1524 |
PP_DEBUG(_L("ppHwDev[%x]::MmvpnSetObserver --"), this);
|
sl@0
|
1525 |
}
|
sl@0
|
1526 |
|
sl@0
|
1527 |
void CNGAPostProcHwDevice::MmvroResourcesRestored(TUid )
|
sl@0
|
1528 |
{
|
sl@0
|
1529 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvroResourcesRestored ++"), this);
|
sl@0
|
1530 |
iFirstPictureUpdated = EFalse;
|
sl@0
|
1531 |
iResourceLost = EFalse;
|
sl@0
|
1532 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvroResourcesRestored state=%d --"),
|
sl@0
|
1533 |
this, iPPState);
|
sl@0
|
1534 |
}
|
sl@0
|
1535 |
|
sl@0
|
1536 |
void CNGAPostProcHwDevice::MmvshcSetSurfaceHandle(const TSurfaceId &aSurfaceID)
|
sl@0
|
1537 |
{
|
sl@0
|
1538 |
|
sl@0
|
1539 |
SetupExternalSurface(aSurfaceID);
|
sl@0
|
1540 |
|
sl@0
|
1541 |
}
|
sl@0
|
1542 |
|
sl@0
|
1543 |
void CNGAPostProcHwDevice::MmvshcRedrawBufferToSurface(TPtrC8& aRedrawBuffer)
|
sl@0
|
1544 |
{
|
sl@0
|
1545 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface ++"), this);
|
sl@0
|
1546 |
|
sl@0
|
1547 |
TUint8* lPtr;
|
sl@0
|
1548 |
TInt offset;
|
sl@0
|
1549 |
|
sl@0
|
1550 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface -- Creating %d x %d surface"), this, iPicSize.iWidth, iPicSize.iHeight);
|
sl@0
|
1551 |
|
sl@0
|
1552 |
TInt err = KErrNone;
|
sl@0
|
1553 |
SetSurfaceAttributes(iPicSize, 1);
|
sl@0
|
1554 |
|
sl@0
|
1555 |
err = iSurfaceHandler->CreateSurface(iAttributes, iSurfaceId);
|
sl@0
|
1556 |
if (err != KErrNone)
|
sl@0
|
1557 |
{
|
sl@0
|
1558 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to create Surface %d"),
|
sl@0
|
1559 |
this, err);
|
sl@0
|
1560 |
iProxy->MdvppFatalError(this, err);
|
sl@0
|
1561 |
return;
|
sl@0
|
1562 |
}
|
sl@0
|
1563 |
|
sl@0
|
1564 |
err = iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo);
|
sl@0
|
1565 |
if (err != KErrNone)
|
sl@0
|
1566 |
{
|
sl@0
|
1567 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to get Surface info %d"),
|
sl@0
|
1568 |
this, err);
|
sl@0
|
1569 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
1570 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
1571 |
iProxy->MdvppFatalError(this, err);
|
sl@0
|
1572 |
return;
|
sl@0
|
1573 |
}
|
sl@0
|
1574 |
|
sl@0
|
1575 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface() \
|
sl@0
|
1576 |
surfaceWidth = %d surfaceHeight = %d surfaceStride = %d"), this, iInfo().iSize.iWidth, iInfo().iSize.iHeight, iInfo().iStride);
|
sl@0
|
1577 |
|
sl@0
|
1578 |
TInt redrawBufferSize = aRedrawBuffer.Size();
|
sl@0
|
1579 |
TInt surfaceSize = iInfo().iStride * iInfo().iSize.iHeight;
|
sl@0
|
1580 |
|
sl@0
|
1581 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface RedrawBuffer size= %d Surface size = %d"), this, redrawBufferSize, surfaceSize);
|
sl@0
|
1582 |
|
sl@0
|
1583 |
// Check whether redraw buffer will fit onto the surface.
|
sl@0
|
1584 |
// If this check fails then we won't raise a fatal error - We just won't create the redraw surface
|
sl@0
|
1585 |
if (redrawBufferSize > surfaceSize)
|
sl@0
|
1586 |
{
|
sl@0
|
1587 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface Redraw buffer size larger than surface size"), this);
|
sl@0
|
1588 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
1589 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
1590 |
return;
|
sl@0
|
1591 |
}
|
sl@0
|
1592 |
|
sl@0
|
1593 |
err = iSurfaceHandler->MapSurface(iSurfaceId, iChunk);
|
sl@0
|
1594 |
if (err != KErrNone)
|
sl@0
|
1595 |
{
|
sl@0
|
1596 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to map Surface %d"),
|
sl@0
|
1597 |
this, err);
|
sl@0
|
1598 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
1599 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
1600 |
iProxy->MdvppFatalError(this, err);
|
sl@0
|
1601 |
return;
|
sl@0
|
1602 |
}
|
sl@0
|
1603 |
|
sl@0
|
1604 |
if((err = iSurfaceHandler->GetBufferOffset(iSurfaceId, 0, offset)) != KErrNone)
|
sl@0
|
1605 |
{
|
sl@0
|
1606 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface offset query failed %d"), this, err);
|
sl@0
|
1607 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
1608 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
1609 |
iChunk.Close();
|
sl@0
|
1610 |
iProxy->MdvppFatalError(this, err);
|
sl@0
|
1611 |
return;
|
sl@0
|
1612 |
}
|
sl@0
|
1613 |
|
sl@0
|
1614 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface offset = %d"), this, offset);
|
sl@0
|
1615 |
|
sl@0
|
1616 |
lPtr = reinterpret_cast<TUint8*>(iChunk.Base() + offset);
|
sl@0
|
1617 |
memcpy((TAny *)lPtr, (TAny *)aRedrawBuffer.Ptr(), redrawBufferSize);
|
sl@0
|
1618 |
|
sl@0
|
1619 |
iRedrawSurfaceInUse = ETrue;
|
sl@0
|
1620 |
|
sl@0
|
1621 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface(): New surface = 0x%x"), this, iSurfaceId);
|
sl@0
|
1622 |
|
sl@0
|
1623 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface error = %d --"), this, err);
|
sl@0
|
1624 |
}
|
sl@0
|
1625 |
|
sl@0
|
1626 |
TInt CNGAPostProcHwDevice::SetupExternalSurface(const TSurfaceId &aSurfaceID)
|
sl@0
|
1627 |
{
|
sl@0
|
1628 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface(): aSurfaceID = 0x%x"), this, aSurfaceID );
|
sl@0
|
1629 |
|
sl@0
|
1630 |
TInt err = KErrNone;
|
sl@0
|
1631 |
|
sl@0
|
1632 |
if(!iSurfaceId.IsNull())
|
sl@0
|
1633 |
{
|
sl@0
|
1634 |
if (iVideoSurfaceObserver && iSurfaceCreatedEventPublished)
|
sl@0
|
1635 |
{
|
sl@0
|
1636 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface - Telling client to remove old surface"), this);
|
sl@0
|
1637 |
iVideoSurfaceObserver->MmvsoRemoveSurface();
|
sl@0
|
1638 |
iSurfaceCreatedEventPublished = EFalse;
|
sl@0
|
1639 |
}
|
sl@0
|
1640 |
else
|
sl@0
|
1641 |
{
|
sl@0
|
1642 |
// We never told the client about the surface, so we must destroy it ourselves
|
sl@0
|
1643 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface - Destroying old surface"), this);
|
sl@0
|
1644 |
TInt numScreens = iWsSession.NumberOfScreens();
|
sl@0
|
1645 |
for(TInt i=0;i < numScreens;i++)
|
sl@0
|
1646 |
{
|
sl@0
|
1647 |
iWsSession.UnregisterSurface(i, iSurfaceId);
|
sl@0
|
1648 |
}
|
sl@0
|
1649 |
iWsSession.Flush();
|
sl@0
|
1650 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
1651 |
}
|
sl@0
|
1652 |
|
sl@0
|
1653 |
iChunk.Close();
|
sl@0
|
1654 |
}
|
sl@0
|
1655 |
|
sl@0
|
1656 |
iSurfaceId = aSurfaceID;
|
sl@0
|
1657 |
iUsingExternalSurface = ETrue;
|
sl@0
|
1658 |
iRedrawSurfaceInUse = EFalse;
|
sl@0
|
1659 |
|
sl@0
|
1660 |
// Create the surface handler if it doesn't exist.
|
sl@0
|
1661 |
if (!iSurfaceHandler)
|
sl@0
|
1662 |
{
|
sl@0
|
1663 |
TRAP(err, iSurfaceHandler = CNGAPostProcSurfaceHandler::NewL());
|
sl@0
|
1664 |
if (err != KErrNone)
|
sl@0
|
1665 |
{
|
sl@0
|
1666 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed to create SurfaceHandler."), this);
|
sl@0
|
1667 |
return err;
|
sl@0
|
1668 |
}
|
sl@0
|
1669 |
}
|
sl@0
|
1670 |
|
sl@0
|
1671 |
err = iSurfaceHandler->OpenSurface(iSurfaceId);
|
sl@0
|
1672 |
if (err != KErrNone)
|
sl@0
|
1673 |
{
|
sl@0
|
1674 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed OpenSurface %d"),
|
sl@0
|
1675 |
this, err);
|
sl@0
|
1676 |
return err;
|
sl@0
|
1677 |
}
|
sl@0
|
1678 |
err = AddHints();
|
sl@0
|
1679 |
if (err != KErrNone)
|
sl@0
|
1680 |
{
|
sl@0
|
1681 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed to AddHints %d"),
|
sl@0
|
1682 |
this, err);
|
sl@0
|
1683 |
return err;
|
sl@0
|
1684 |
}
|
sl@0
|
1685 |
err = RegisterSurface(iSurfaceId);
|
sl@0
|
1686 |
if (err != KErrNone)
|
sl@0
|
1687 |
{
|
sl@0
|
1688 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed RegisterSurface %d"),
|
sl@0
|
1689 |
this, err);
|
sl@0
|
1690 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
1691 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
1692 |
return err;
|
sl@0
|
1693 |
}
|
sl@0
|
1694 |
|
sl@0
|
1695 |
err = iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo);
|
sl@0
|
1696 |
if (err != KErrNone)
|
sl@0
|
1697 |
{
|
sl@0
|
1698 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed to get Surface info %d"),
|
sl@0
|
1699 |
this, err);
|
sl@0
|
1700 |
return err;
|
sl@0
|
1701 |
}
|
sl@0
|
1702 |
|
sl@0
|
1703 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface err=%d"), this, err);
|
sl@0
|
1704 |
return err;
|
sl@0
|
1705 |
}
|
sl@0
|
1706 |
|
sl@0
|
1707 |
//=== Internal ===
|
sl@0
|
1708 |
TVideoPicture* CNGAPostProcHwDevice::CreateBuffersL(TInt aBufId)
|
sl@0
|
1709 |
{
|
sl@0
|
1710 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::CreateBuffersL ++"), this);
|
sl@0
|
1711 |
|
sl@0
|
1712 |
TVideoPicture* lVideoPicture = NULL;
|
sl@0
|
1713 |
TUint8* lPtr;
|
sl@0
|
1714 |
TPtr8* lTemp;
|
sl@0
|
1715 |
TInt offset;
|
sl@0
|
1716 |
|
sl@0
|
1717 |
lVideoPicture = new (ELeave) TVideoPicture;
|
sl@0
|
1718 |
CleanupStack::PushL(lVideoPicture);
|
sl@0
|
1719 |
if(TInt err = iSurfaceHandler->GetBufferOffset(iSurfaceId, aBufId, offset) != KErrNone)
|
sl@0
|
1720 |
{
|
sl@0
|
1721 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::CreateBuffersL offset query failed %d"), this, err);
|
sl@0
|
1722 |
}
|
sl@0
|
1723 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::CreateBuffersL offset = %d id =%d --"), this, offset, aBufId);
|
sl@0
|
1724 |
|
sl@0
|
1725 |
lPtr = reinterpret_cast<TUint8*>(iChunk.Base() + offset);
|
sl@0
|
1726 |
|
sl@0
|
1727 |
lTemp = new (ELeave) TPtr8(lPtr, 0, (iVideoFrameBufSize ));
|
sl@0
|
1728 |
CleanupStack::PushL(lTemp);
|
sl@0
|
1729 |
|
sl@0
|
1730 |
lVideoPicture->iData.iRawData = lTemp;
|
sl@0
|
1731 |
lVideoPicture->iHeader = NULL ;
|
sl@0
|
1732 |
lVideoPicture->iLayerBitRates = NULL ;
|
sl@0
|
1733 |
|
sl@0
|
1734 |
CleanupStack::Pop(2);
|
sl@0
|
1735 |
|
sl@0
|
1736 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::CreateVBMBuffersL --"), this);
|
sl@0
|
1737 |
return lVideoPicture;
|
sl@0
|
1738 |
}
|
sl@0
|
1739 |
|
sl@0
|
1740 |
void CNGAPostProcHwDevice::CreateVBMBuffersL()
|
sl@0
|
1741 |
{
|
sl@0
|
1742 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::CreateVBMBuffersL ++"), this);
|
sl@0
|
1743 |
|
sl@0
|
1744 |
TInt err = KErrNone;
|
sl@0
|
1745 |
TVideoPicture* pic = NULL;
|
sl@0
|
1746 |
iVBMBufferReferenceQ.Reset();
|
sl@0
|
1747 |
iVBMBufferQ.Reset();
|
sl@0
|
1748 |
iColorConversionQ.Reset();
|
sl@0
|
1749 |
|
sl@0
|
1750 |
for(TInt i = 0; i < iVBMBufferOptions.iNumInputBuffers; i++)
|
sl@0
|
1751 |
{
|
sl@0
|
1752 |
TRAP(err, pic = CreateBuffersL(i));
|
sl@0
|
1753 |
if (err != KErrNone)
|
sl@0
|
1754 |
{
|
sl@0
|
1755 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create VBM buffer %d"), this, err);
|
sl@0
|
1756 |
User::Leave(err);
|
sl@0
|
1757 |
}
|
sl@0
|
1758 |
|
sl@0
|
1759 |
// This will hold the references which will be used in destructor
|
sl@0
|
1760 |
User::LeaveIfError(iVBMBufferReferenceQ.Append(pic));
|
sl@0
|
1761 |
User::LeaveIfError(iVBMBufferQ.Append(pic));
|
sl@0
|
1762 |
}
|
sl@0
|
1763 |
if(iIsColorConversionNeeded)
|
sl@0
|
1764 |
{
|
sl@0
|
1765 |
for(TInt i = iVBMBufferOptions.iNumInputBuffers ;
|
sl@0
|
1766 |
i < (iVBMBufferOptions.iNumInputBuffers + KColorConversionBuffers ); i++)
|
sl@0
|
1767 |
{
|
sl@0
|
1768 |
TRAP(err, pic = CreateBuffersL(i));
|
sl@0
|
1769 |
if (err != KErrNone)
|
sl@0
|
1770 |
{
|
sl@0
|
1771 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create VBM buffer %d"), this, err);
|
sl@0
|
1772 |
User::Leave(err);
|
sl@0
|
1773 |
}
|
sl@0
|
1774 |
|
sl@0
|
1775 |
// This will hold the references which will be used in destructor
|
sl@0
|
1776 |
User::LeaveIfError(iVBMBufferReferenceQ.Append(pic));
|
sl@0
|
1777 |
User::LeaveIfError(iColorConversionQ.Append(pic));
|
sl@0
|
1778 |
}
|
sl@0
|
1779 |
}
|
sl@0
|
1780 |
|
sl@0
|
1781 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::CreateVBMBuffersL --"), this);
|
sl@0
|
1782 |
}
|
sl@0
|
1783 |
|
sl@0
|
1784 |
void CNGAPostProcHwDevice::ReturnPicToDecoder(TVideoPicture* aPic)
|
sl@0
|
1785 |
{
|
sl@0
|
1786 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReturnPicToDecoder ++"), this);
|
sl@0
|
1787 |
if (aPic == NULL)
|
sl@0
|
1788 |
{
|
sl@0
|
1789 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseInputPicture FAILED: Invalid pic ptr."), this);
|
sl@0
|
1790 |
return;
|
sl@0
|
1791 |
}
|
sl@0
|
1792 |
|
sl@0
|
1793 |
if (iInputDecoderDevice)
|
sl@0
|
1794 |
{
|
sl@0
|
1795 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseInputPicture .. before return picture. 2"), this);
|
sl@0
|
1796 |
iInputDecoderDevice->ReturnPicture(aPic);
|
sl@0
|
1797 |
}
|
sl@0
|
1798 |
|
sl@0
|
1799 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReturnPicToDecoder --"), this);
|
sl@0
|
1800 |
}
|
sl@0
|
1801 |
|
sl@0
|
1802 |
TInt CNGAPostProcHwDevice::AttemptToPost()
|
sl@0
|
1803 |
{
|
sl@0
|
1804 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AttemptToPost ++ Q:%d"), this, iInputQ.Count());
|
sl@0
|
1805 |
if (iPPState == EPaused)
|
sl@0
|
1806 |
{
|
sl@0
|
1807 |
return KErrNone;
|
sl@0
|
1808 |
}
|
sl@0
|
1809 |
|
sl@0
|
1810 |
TInt err = KErrNotReady;
|
sl@0
|
1811 |
TInt count = iInputQ.Count();
|
sl@0
|
1812 |
TBool bDone = EFalse;
|
sl@0
|
1813 |
TVideoPicture* pic = PeekQ();
|
sl@0
|
1814 |
while(pic && !bDone)
|
sl@0
|
1815 |
{
|
sl@0
|
1816 |
if(!IsGceReady())
|
sl@0
|
1817 |
{
|
sl@0
|
1818 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AttemptToPost GCE not ready"), this );
|
sl@0
|
1819 |
return err; //no need to catch this error
|
sl@0
|
1820 |
}
|
sl@0
|
1821 |
TInt64 delta = 0;
|
sl@0
|
1822 |
TTimeToPost iTimeToPost = (TTimeToPost)IsTimeToPost(pic, delta);
|
sl@0
|
1823 |
switch(iTimeToPost)
|
sl@0
|
1824 |
{
|
sl@0
|
1825 |
case EDelayIt:
|
sl@0
|
1826 |
{
|
sl@0
|
1827 |
iPostingTimer->Cancel();
|
sl@0
|
1828 |
SetTimer(delta);
|
sl@0
|
1829 |
bDone = ETrue;
|
sl@0
|
1830 |
}
|
sl@0
|
1831 |
break;
|
sl@0
|
1832 |
case EPostIt:
|
sl@0
|
1833 |
{
|
sl@0
|
1834 |
RemoveFromQ(); // remove the pic that was returned by PeekQ
|
sl@0
|
1835 |
if(iIsColorConversionNeeded)
|
sl@0
|
1836 |
{
|
sl@0
|
1837 |
TVideoPicture* ccPic;
|
sl@0
|
1838 |
ccPic = DoColorConvert(pic); // output will be in ccPic
|
sl@0
|
1839 |
pic = ccPic;
|
sl@0
|
1840 |
}
|
sl@0
|
1841 |
iProcessQ.Append(pic);
|
sl@0
|
1842 |
#ifdef _DUMP_YUV_FRAMES
|
sl@0
|
1843 |
captureYuv(pic);
|
sl@0
|
1844 |
#endif
|
sl@0
|
1845 |
iSessionManager->PostPicture(iSurfaceId, GetID(pic), iInfo().iBuffers, ETrue);
|
sl@0
|
1846 |
iCurrentPlaybackPosition = pic->iTimestamp;
|
sl@0
|
1847 |
if(!iFirstPictureUpdated)
|
sl@0
|
1848 |
{
|
sl@0
|
1849 |
iFirstPictureUpdated = ETrue;
|
sl@0
|
1850 |
if(!iSurfaceCreatedEventPublished)
|
sl@0
|
1851 |
{
|
sl@0
|
1852 |
PublishSurfaceCreated();
|
sl@0
|
1853 |
}
|
sl@0
|
1854 |
}
|
sl@0
|
1855 |
} // end of postit
|
sl@0
|
1856 |
break;
|
sl@0
|
1857 |
case ESkipIt:
|
sl@0
|
1858 |
{
|
sl@0
|
1859 |
RemoveFromQ();
|
sl@0
|
1860 |
ReleasePicture(pic);
|
sl@0
|
1861 |
PicturesSkipped();
|
sl@0
|
1862 |
}
|
sl@0
|
1863 |
break;
|
sl@0
|
1864 |
} // end of switch
|
sl@0
|
1865 |
|
sl@0
|
1866 |
// get the next picture
|
sl@0
|
1867 |
pic = PeekQ();
|
sl@0
|
1868 |
} // end of while
|
sl@0
|
1869 |
|
sl@0
|
1870 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AttemptToPost --"), this);
|
sl@0
|
1871 |
return err;
|
sl@0
|
1872 |
}
|
sl@0
|
1873 |
|
sl@0
|
1874 |
TInt CNGAPostProcHwDevice::IsTimeToPost(TVideoPicture* frame, TInt64& delta)
|
sl@0
|
1875 |
{
|
sl@0
|
1876 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost ++"), this);
|
sl@0
|
1877 |
|
sl@0
|
1878 |
if (!frame)
|
sl@0
|
1879 |
{
|
sl@0
|
1880 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost FAILED: Invalid frame ptr."), this);
|
sl@0
|
1881 |
return KErrGeneral;
|
sl@0
|
1882 |
}
|
sl@0
|
1883 |
|
sl@0
|
1884 |
TInt resp = EPostIt;
|
sl@0
|
1885 |
// Frame presentation time
|
sl@0
|
1886 |
TInt64 uPresTime = frame->iTimestamp.Int64();
|
sl@0
|
1887 |
|
sl@0
|
1888 |
// Check if this is an out of order frame in case of forward playback
|
sl@0
|
1889 |
if((iCurrentPlaybackPosition.Int64() > uPresTime) && (iPlayRate > 0))
|
sl@0
|
1890 |
{
|
sl@0
|
1891 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost : Out of order frame (forward playback) Tfm=%d"), this,(TInt)uPresTime);
|
sl@0
|
1892 |
resp = ESkipIt; //drop
|
sl@0
|
1893 |
} // Check if this is an out of order frame in case of backward playback
|
sl@0
|
1894 |
else if((iCurrentPlaybackPosition.Int64() < uPresTime) && (iPlayRate < 0))
|
sl@0
|
1895 |
{
|
sl@0
|
1896 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost : Out of order frame (backward playback) Tfm=%d"), this,(TInt)uPresTime);
|
sl@0
|
1897 |
resp = ESkipIt; //drop
|
sl@0
|
1898 |
}
|
sl@0
|
1899 |
else if (iClockSource)
|
sl@0
|
1900 |
{
|
sl@0
|
1901 |
// The time to sync with.
|
sl@0
|
1902 |
TInt64 uSyncTime = iClockSource->Time().Int64();
|
sl@0
|
1903 |
|
sl@0
|
1904 |
delta = uPresTime - uSyncTime;
|
sl@0
|
1905 |
if (( delta > KRenderAhead ) && (iPlayRate > 0)) // Delay condition not checked for
|
sl@0
|
1906 |
{ // backward playback
|
sl@0
|
1907 |
resp = EDelayIt; //wait
|
sl@0
|
1908 |
}
|
sl@0
|
1909 |
else if ( (delta < (-KMaxRenderDelay) && (iPlayRate > 0))
|
sl@0
|
1910 |
|| ((delta > KMaxRenderDelay) && (iPlayRate < 0)))
|
sl@0
|
1911 |
{
|
sl@0
|
1912 |
resp = ESkipIt; //drop
|
sl@0
|
1913 |
}
|
sl@0
|
1914 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost .. Tfm=%d, Tcs=%d, delta=%d"), this, (TInt)uPresTime, (TInt)uSyncTime, (TInt)delta);
|
sl@0
|
1915 |
}
|
sl@0
|
1916 |
|
sl@0
|
1917 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost -- %d BufID = %d"), this, resp, GetID(frame));
|
sl@0
|
1918 |
return resp;
|
sl@0
|
1919 |
}
|
sl@0
|
1920 |
|
sl@0
|
1921 |
void CNGAPostProcHwDevice::ReleaseInputQ()
|
sl@0
|
1922 |
{
|
sl@0
|
1923 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseInputQ ++ Q = %d"), this, iInputQ.Count());
|
sl@0
|
1924 |
while (iInputQ.Count()>0)
|
sl@0
|
1925 |
{
|
sl@0
|
1926 |
ReleasePicture(iInputQ[0]);
|
sl@0
|
1927 |
iInputQ.Remove(0);
|
sl@0
|
1928 |
}
|
sl@0
|
1929 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseInputQ --"), this);
|
sl@0
|
1930 |
}
|
sl@0
|
1931 |
|
sl@0
|
1932 |
void CNGAPostProcHwDevice::ReleaseProcessQ()
|
sl@0
|
1933 |
{
|
sl@0
|
1934 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseProcessQ ++ Q = %d"), this, iProcessQ.Count() );
|
sl@0
|
1935 |
TVideoPicture* pic = NULL;
|
sl@0
|
1936 |
|
sl@0
|
1937 |
while (iProcessQ.Count()>0)
|
sl@0
|
1938 |
{
|
sl@0
|
1939 |
pic = iProcessQ[0];
|
sl@0
|
1940 |
iProcessQ.Remove(0);
|
sl@0
|
1941 |
ReturnPicToDecoder(pic);
|
sl@0
|
1942 |
}
|
sl@0
|
1943 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseProcessQ --"), this);
|
sl@0
|
1944 |
}
|
sl@0
|
1945 |
|
sl@0
|
1946 |
void CNGAPostProcHwDevice::ReleasePicture(TVideoPicture *pic)
|
sl@0
|
1947 |
{
|
sl@0
|
1948 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleasePicture ++"), this);
|
sl@0
|
1949 |
if (pic == NULL)
|
sl@0
|
1950 |
{
|
sl@0
|
1951 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseInputPicture FAILED: Invalid pic ptr."), this);
|
sl@0
|
1952 |
return;
|
sl@0
|
1953 |
}
|
sl@0
|
1954 |
|
sl@0
|
1955 |
if (iInputDecoderDevice)
|
sl@0
|
1956 |
{
|
sl@0
|
1957 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleaseInputPicture .. before return picture. 2"), this);
|
sl@0
|
1958 |
iInputDecoderDevice->ReturnPicture(pic);
|
sl@0
|
1959 |
}
|
sl@0
|
1960 |
if (iVBMEnabled)
|
sl@0
|
1961 |
{
|
sl@0
|
1962 |
iVBMBufferQ.Append(pic);
|
sl@0
|
1963 |
|
sl@0
|
1964 |
if ( !iIsInputEnded && iPPState != EStopped )
|
sl@0
|
1965 |
{
|
sl@0
|
1966 |
iVBMObserver->MmvbmoNewBuffers();
|
sl@0
|
1967 |
}
|
sl@0
|
1968 |
}
|
sl@0
|
1969 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReleasePicture --"), this);
|
sl@0
|
1970 |
}
|
sl@0
|
1971 |
|
sl@0
|
1972 |
void CNGAPostProcHwDevice::PublishSurfaceCreated()
|
sl@0
|
1973 |
{
|
sl@0
|
1974 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:PublishSurfaceCreated ++"), this);
|
sl@0
|
1975 |
if(iVideoSurfaceObserver)
|
sl@0
|
1976 |
{
|
sl@0
|
1977 |
iVideoSurfaceObserver->MmvsoSurfaceCreated();
|
sl@0
|
1978 |
iSurfaceCreatedEventPublished = ETrue;
|
sl@0
|
1979 |
}
|
sl@0
|
1980 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:PublishSurfaceCreated --"), this);
|
sl@0
|
1981 |
}
|
sl@0
|
1982 |
|
sl@0
|
1983 |
TInt CNGAPostProcHwDevice::SetupSurface(const TSize& aSize)
|
sl@0
|
1984 |
{
|
sl@0
|
1985 |
TInt err = KErrNone;
|
sl@0
|
1986 |
if(iVBMEnabled && iVBMObserver)
|
sl@0
|
1987 |
{
|
sl@0
|
1988 |
SetSurfaceAttributes(aSize, KMaxVBMBuffers);
|
sl@0
|
1989 |
iVBMBufferOptions.iNumInputBuffers = KMaxVBMBuffers;
|
sl@0
|
1990 |
|
sl@0
|
1991 |
//Decoder needs the buffer size to fit in yuv422 decoded output.
|
sl@0
|
1992 |
iVBMBufferOptions.iBufferSize = aSize;
|
sl@0
|
1993 |
|
sl@0
|
1994 |
err = iSurfaceHandler->CreateSurface(iAttributes, iSurfaceId);
|
sl@0
|
1995 |
if (err != KErrNone)
|
sl@0
|
1996 |
{
|
sl@0
|
1997 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create Surface %d"), this, err);
|
sl@0
|
1998 |
return err;
|
sl@0
|
1999 |
}
|
sl@0
|
2000 |
err = iSurfaceHandler->MapSurface(iSurfaceId, iChunk);
|
sl@0
|
2001 |
if (err != KErrNone)
|
sl@0
|
2002 |
{
|
sl@0
|
2003 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to map Surface %d"), this, err);
|
sl@0
|
2004 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
2005 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
2006 |
return err;
|
sl@0
|
2007 |
}
|
sl@0
|
2008 |
err = iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo);
|
sl@0
|
2009 |
if (err != KErrNone)
|
sl@0
|
2010 |
{
|
sl@0
|
2011 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to get Surface info %d"), this, err);
|
sl@0
|
2012 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
2013 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
2014 |
return err;
|
sl@0
|
2015 |
}
|
sl@0
|
2016 |
TRAP(err, CreateVBMBuffersL());
|
sl@0
|
2017 |
if (err != KErrNone)
|
sl@0
|
2018 |
{
|
sl@0
|
2019 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create VBM buffer %d"), this, err);
|
sl@0
|
2020 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
2021 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
2022 |
return err;
|
sl@0
|
2023 |
}
|
sl@0
|
2024 |
err = AddHints();
|
sl@0
|
2025 |
if (err != KErrNone)
|
sl@0
|
2026 |
{
|
sl@0
|
2027 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to AddHints %d"), this, err);
|
sl@0
|
2028 |
return err;
|
sl@0
|
2029 |
}
|
sl@0
|
2030 |
err = RegisterSurface(iSurfaceId);
|
sl@0
|
2031 |
if (err != KErrNone)
|
sl@0
|
2032 |
{
|
sl@0
|
2033 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to RegisterSurface %d"), this, err);
|
sl@0
|
2034 |
iSurfaceHandler->DestroySurface(iSurfaceId);
|
sl@0
|
2035 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
2036 |
return err;
|
sl@0
|
2037 |
}
|
sl@0
|
2038 |
|
sl@0
|
2039 |
}
|
sl@0
|
2040 |
return err;
|
sl@0
|
2041 |
}
|
sl@0
|
2042 |
|
sl@0
|
2043 |
void CNGAPostProcHwDevice::SetSurfaceAttributes(const TSize& aSize, TInt aNumBuf)
|
sl@0
|
2044 |
{
|
sl@0
|
2045 |
iAttributes().iSize = aSize; // size of the video frame
|
sl@0
|
2046 |
iAttributes().iBuffers = aNumBuf;
|
sl@0
|
2047 |
|
sl@0
|
2048 |
/* The stride needs to be calculated for the surface manager to know
|
sl@0
|
2049 |
how much memory to allocate */
|
sl@0
|
2050 |
|
sl@0
|
2051 |
if(iAttributes().iPixelFormat == EUidPixelFormatYUV_420Planar)
|
sl@0
|
2052 |
{
|
sl@0
|
2053 |
iAttributes().iStride = aSize.iWidth * 3/2;
|
sl@0
|
2054 |
iVideoFrameBufSize = aSize.iWidth * aSize.iHeight * 3/2;
|
sl@0
|
2055 |
}
|
sl@0
|
2056 |
else
|
sl@0
|
2057 |
{
|
sl@0
|
2058 |
iAttributes().iStride = aSize.iWidth * 2;
|
sl@0
|
2059 |
iVideoFrameBufSize = aSize.iWidth * aSize.iHeight * 2;
|
sl@0
|
2060 |
}
|
sl@0
|
2061 |
|
sl@0
|
2062 |
if(iIsColorConversionNeeded)
|
sl@0
|
2063 |
{
|
sl@0
|
2064 |
iAttributes().iBuffers = aNumBuf + KColorConversionBuffers;
|
sl@0
|
2065 |
}
|
sl@0
|
2066 |
else
|
sl@0
|
2067 |
{
|
sl@0
|
2068 |
iAttributes().iBuffers = aNumBuf;
|
sl@0
|
2069 |
}
|
sl@0
|
2070 |
|
sl@0
|
2071 |
iAttributes().iOffsetToFirstBuffer = 0;
|
sl@0
|
2072 |
iAttributes().iAlignment = 4;
|
sl@0
|
2073 |
iAttributes().iContiguous = ETrue;
|
sl@0
|
2074 |
iAttributes().iHintCount = 0;
|
sl@0
|
2075 |
iAttributes().iMappable = ETrue;
|
sl@0
|
2076 |
}
|
sl@0
|
2077 |
|
sl@0
|
2078 |
TInt CNGAPostProcHwDevice::GetID(TVideoPicture *aPicture)
|
sl@0
|
2079 |
{
|
sl@0
|
2080 |
if (iUsingExternalSurface)
|
sl@0
|
2081 |
{
|
sl@0
|
2082 |
return GetExternalBufferID(aPicture);
|
sl@0
|
2083 |
}
|
sl@0
|
2084 |
else
|
sl@0
|
2085 |
{
|
sl@0
|
2086 |
TUint8* aPtr = (TUint8*) aPicture->iData.iRawData->Ptr();
|
sl@0
|
2087 |
return( (TInt) ((aPtr - iChunk.Base() - iAttributes().iOffsetToFirstBuffer) /
|
sl@0
|
2088 |
(iVideoFrameBufSize )));
|
sl@0
|
2089 |
}
|
sl@0
|
2090 |
}
|
sl@0
|
2091 |
|
sl@0
|
2092 |
TInt CNGAPostProcHwDevice::GetExternalBufferID(TVideoPicture *aPicture)
|
sl@0
|
2093 |
{
|
sl@0
|
2094 |
// currently type cast the pointer as buffer ID.
|
sl@0
|
2095 |
// FIXME once the new data structure is available.
|
sl@0
|
2096 |
return( (TInt) aPicture->iData.iRawData->Ptr());
|
sl@0
|
2097 |
}
|
sl@0
|
2098 |
|
sl@0
|
2099 |
TInt CNGAPostProcHwDevice::RegisterSurface(const TSurfaceId& aSurfaceId)
|
sl@0
|
2100 |
{
|
sl@0
|
2101 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:RegisterSurface(): RegisterSurface ID = 0x%x"), this, aSurfaceId);
|
sl@0
|
2102 |
TInt err = KErrNone;
|
sl@0
|
2103 |
TInt numScreens = iWsSession.NumberOfScreens();
|
sl@0
|
2104 |
for(TInt i=0; (i < numScreens && err == KErrNone); i++)
|
sl@0
|
2105 |
{
|
sl@0
|
2106 |
err = iWsSession.RegisterSurface(i, aSurfaceId);
|
sl@0
|
2107 |
}
|
sl@0
|
2108 |
return(err);
|
sl@0
|
2109 |
}
|
sl@0
|
2110 |
|
sl@0
|
2111 |
TInt CNGAPostProcHwDevice::IsGceReady()
|
sl@0
|
2112 |
{
|
sl@0
|
2113 |
if(iProcessQ.Count() >= KMaxBuffersGceCanHold)
|
sl@0
|
2114 |
{
|
sl@0
|
2115 |
return EFalse;
|
sl@0
|
2116 |
}
|
sl@0
|
2117 |
return ETrue;
|
sl@0
|
2118 |
}
|
sl@0
|
2119 |
|
sl@0
|
2120 |
void CNGAPostProcHwDevice::SetTimer(TInt64 aDelta)
|
sl@0
|
2121 |
{
|
sl@0
|
2122 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetTimer .. aDelta=%d"), this, (TInt)aDelta);
|
sl@0
|
2123 |
if(aDelta <= KRenderAhead)
|
sl@0
|
2124 |
{
|
sl@0
|
2125 |
if(aDelta < 0)
|
sl@0
|
2126 |
{
|
sl@0
|
2127 |
iPostingTimer->After(aDelta * -1);
|
sl@0
|
2128 |
}
|
sl@0
|
2129 |
else
|
sl@0
|
2130 |
{
|
sl@0
|
2131 |
iPostingTimer->After((aDelta - KRenderAhead) * -1);
|
sl@0
|
2132 |
}
|
sl@0
|
2133 |
}
|
sl@0
|
2134 |
else
|
sl@0
|
2135 |
{
|
sl@0
|
2136 |
iPostingTimer->After(aDelta - KRenderAhead - KPostingOfset);
|
sl@0
|
2137 |
}
|
sl@0
|
2138 |
}
|
sl@0
|
2139 |
//
|
sl@0
|
2140 |
// Convert YUV420 to YUV422InterLeaved.
|
sl@0
|
2141 |
//
|
sl@0
|
2142 |
TInt CNGAPostProcHwDevice::ConvertPostProcBuffer(TVideoPicture* pSrc, TVideoPicture* pDest)
|
sl@0
|
2143 |
{
|
sl@0
|
2144 |
PP_DEBUG(_L("CMdfPostingSurfaceProxy::ConvertPostProcBuffer ++"));
|
sl@0
|
2145 |
TInt err = KErrNone;
|
sl@0
|
2146 |
if (!pDest && !pSrc)
|
sl@0
|
2147 |
{
|
sl@0
|
2148 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ConvertPostProcBuffer FAILED: Invalid pic pSrc %x pDest %x."), this, pSrc, pDest);
|
sl@0
|
2149 |
return KErrArgument;
|
sl@0
|
2150 |
}
|
sl@0
|
2151 |
|
sl@0
|
2152 |
// --- Prepare wrappers ---
|
sl@0
|
2153 |
tBaseVideoFrame tFrame420, tFrame422;
|
sl@0
|
2154 |
TInt frameSize = pSrc->iData.iDataSize.iWidth * pSrc->iData.iDataSize.iHeight;
|
sl@0
|
2155 |
|
sl@0
|
2156 |
PP_DEBUG(_L("CMdfPostingSurfaceProxy::ConvertPostProcBuffer .. w=%d, h=%d"), pSrc->iData.iDataSize.iWidth, pSrc->iData.iDataSize.iHeight);
|
sl@0
|
2157 |
|
sl@0
|
2158 |
tFrame420.width = pSrc->iData.iDataSize.iWidth;
|
sl@0
|
2159 |
tFrame420.height= pSrc->iData.iDataSize.iHeight;
|
sl@0
|
2160 |
tFrame420.lum = (TUint8*)pSrc->iData.iRawData->Ptr();
|
sl@0
|
2161 |
tFrame420.cb = (TUint8*)tFrame420.lum + frameSize;
|
sl@0
|
2162 |
tFrame420.cr = (TUint8*)tFrame420.lum + (frameSize*5)/4;
|
sl@0
|
2163 |
|
sl@0
|
2164 |
tFrame422.width = pSrc->iData.iDataSize.iWidth;
|
sl@0
|
2165 |
tFrame422.height= pSrc->iData.iDataSize.iHeight;
|
sl@0
|
2166 |
tFrame422.lum = (TUint8*)pDest->iData.iRawData->Ptr();
|
sl@0
|
2167 |
tFrame422.cb = 0;
|
sl@0
|
2168 |
tFrame422.cr = 0;
|
sl@0
|
2169 |
|
sl@0
|
2170 |
// --- Convertion to posting buffer ---
|
sl@0
|
2171 |
TInt stride = pSrc->iData.iDataSize.iWidth * 2;
|
sl@0
|
2172 |
EBufferLayout422 layout = YUV422INT_BE;
|
sl@0
|
2173 |
|
sl@0
|
2174 |
err = gColorConvYUVtoYUV422Int(&tFrame420, &tFrame422, layout, stride);
|
sl@0
|
2175 |
if(err != KErrNone)
|
sl@0
|
2176 |
{
|
sl@0
|
2177 |
PP_DEBUG(_L("CNGAPostProcHwDevice::ConvertPostProcBuffer .. err= %d."), err);
|
sl@0
|
2178 |
}
|
sl@0
|
2179 |
return err;
|
sl@0
|
2180 |
}
|
sl@0
|
2181 |
|
sl@0
|
2182 |
void CNGAPostProcHwDevice::AddPictureToVBMQ(TVideoPicture *pic)
|
sl@0
|
2183 |
{
|
sl@0
|
2184 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddPictureToVBMQ ++"), this);
|
sl@0
|
2185 |
iVBMBufferQ.Append(pic);
|
sl@0
|
2186 |
|
sl@0
|
2187 |
if ( !iIsInputEnded && iPPState != EStopped )
|
sl@0
|
2188 |
{
|
sl@0
|
2189 |
iVBMObserver->MmvbmoNewBuffers();
|
sl@0
|
2190 |
}
|
sl@0
|
2191 |
|
sl@0
|
2192 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddPictureToVBMQ --"), this);
|
sl@0
|
2193 |
}
|
sl@0
|
2194 |
|
sl@0
|
2195 |
void CNGAPostProcHwDevice::AddPictureToColorConversionQ(TVideoPicture *pic)
|
sl@0
|
2196 |
{
|
sl@0
|
2197 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddPictureToColorConversionQ ++"), this);
|
sl@0
|
2198 |
iColorConversionQ.Append(pic);
|
sl@0
|
2199 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddPictureToColorConversionQ --"), this);
|
sl@0
|
2200 |
}
|
sl@0
|
2201 |
|
sl@0
|
2202 |
#ifdef _DUMP_YUV_FRAMES
|
sl@0
|
2203 |
void CNGAPostProcHwDevice::captureYuv(TVideoPicture* aPicture)
|
sl@0
|
2204 |
{
|
sl@0
|
2205 |
char buf[128];
|
sl@0
|
2206 |
sprintf(buf, "c:\\fb%d.yuv", count++);
|
sl@0
|
2207 |
FILE *fp = ::fopen(buf, "w");
|
sl@0
|
2208 |
TInt size = aPicture->iData.iRawData->Size();
|
sl@0
|
2209 |
//{FILE* f1 = fopen(MY_LOG_FILE_NAME, "a+"));if(f1){fprintf(f1, "Size %d \n"), size );fclose(f1); }}
|
sl@0
|
2210 |
|
sl@0
|
2211 |
::fwrite(aPicture->iData.iRawData->Ptr(), 1, size, fp);
|
sl@0
|
2212 |
::fclose(fp);
|
sl@0
|
2213 |
}
|
sl@0
|
2214 |
#endif
|
sl@0
|
2215 |
|
sl@0
|
2216 |
void CNGAPostProcHwDevice::ResetCountingBuffer()
|
sl@0
|
2217 |
{
|
sl@0
|
2218 |
memset(iSkippedFramesCountingBuffer,0,sizeof(iSkippedFramesCountingBuffer));
|
sl@0
|
2219 |
iSkippedFramesInLast64Frames = 0;
|
sl@0
|
2220 |
iCurrentPosInFramesCountingBuffer = 0;
|
sl@0
|
2221 |
}
|
sl@0
|
2222 |
|
sl@0
|
2223 |
void CNGAPostProcHwDevice::PicturesSkipped()
|
sl@0
|
2224 |
{
|
sl@0
|
2225 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:PicturesSkipped ++"), this);
|
sl@0
|
2226 |
iPictureCounters.iPicturesSkipped++;
|
sl@0
|
2227 |
if (!iKeyFrameMode && iPlayRate>KDefPlayRate)
|
sl@0
|
2228 |
{
|
sl@0
|
2229 |
if (iSkippedFramesCountingBuffer[iCurrentPosInFramesCountingBuffer]==0)
|
sl@0
|
2230 |
{
|
sl@0
|
2231 |
iSkippedFramesCountingBuffer[iCurrentPosInFramesCountingBuffer] = 1;
|
sl@0
|
2232 |
iSkippedFramesInLast64Frames++;
|
sl@0
|
2233 |
if (iSkippedFramesInLast64Frames>KMaxAllowedSkipInNFrames && iFPObserver )
|
sl@0
|
2234 |
{
|
sl@0
|
2235 |
iFPObserver->MmvproKeyFrameModeRequest();
|
sl@0
|
2236 |
iKeyFrameMode=ETrue;
|
sl@0
|
2237 |
ResetCountingBuffer();
|
sl@0
|
2238 |
}
|
sl@0
|
2239 |
}
|
sl@0
|
2240 |
iCurrentPosInFramesCountingBuffer = ++iCurrentPosInFramesCountingBuffer%64;
|
sl@0
|
2241 |
}
|
sl@0
|
2242 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:PicturesSkipped --"), this);
|
sl@0
|
2243 |
}
|
sl@0
|
2244 |
|
sl@0
|
2245 |
TVideoPicture* CNGAPostProcHwDevice::DoColorConvert(TVideoPicture* aPicture)
|
sl@0
|
2246 |
{
|
sl@0
|
2247 |
TVideoPicture *pOutPicture = aPicture;
|
sl@0
|
2248 |
|
sl@0
|
2249 |
if(iColorConversionQ.Count())
|
sl@0
|
2250 |
{
|
sl@0
|
2251 |
pOutPicture = iColorConversionQ[0];
|
sl@0
|
2252 |
iColorConversionQ.Remove(0);
|
sl@0
|
2253 |
ConvertPostProcBuffer(aPicture, pOutPicture);
|
sl@0
|
2254 |
pOutPicture->iTimestamp = aPicture->iTimestamp;
|
sl@0
|
2255 |
ReleasePicture(aPicture);
|
sl@0
|
2256 |
}
|
sl@0
|
2257 |
else
|
sl@0
|
2258 |
{
|
sl@0
|
2259 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:WritePictureL() FAILED: color conversion"), this);
|
sl@0
|
2260 |
}
|
sl@0
|
2261 |
|
sl@0
|
2262 |
return pOutPicture;
|
sl@0
|
2263 |
}
|
sl@0
|
2264 |
|
sl@0
|
2265 |
TInt CNGAPostProcHwDevice::AddToQ(TVideoPicture* aPicture)
|
sl@0
|
2266 |
{
|
sl@0
|
2267 |
TVideoPicture* pic = aPicture;
|
sl@0
|
2268 |
TInt pos = -1;
|
sl@0
|
2269 |
if(iInputQ.Count() == 0)
|
sl@0
|
2270 |
{
|
sl@0
|
2271 |
iInputQ.Append(pic);
|
sl@0
|
2272 |
}
|
sl@0
|
2273 |
else
|
sl@0
|
2274 |
{
|
sl@0
|
2275 |
pos = iInputQ.Count()-1;
|
sl@0
|
2276 |
for(; pos >= 0; pos--)
|
sl@0
|
2277 |
{
|
sl@0
|
2278 |
if(pic->iTimestamp.Int64() > iInputQ[pos]->iTimestamp.Int64())
|
sl@0
|
2279 |
{
|
sl@0
|
2280 |
break;
|
sl@0
|
2281 |
}
|
sl@0
|
2282 |
}
|
sl@0
|
2283 |
if(iInputQ.Count() == pos+1)
|
sl@0
|
2284 |
{
|
sl@0
|
2285 |
iInputQ.Append(pic);
|
sl@0
|
2286 |
}
|
sl@0
|
2287 |
else
|
sl@0
|
2288 |
{
|
sl@0
|
2289 |
iInputQ.Insert(pic, pos+1);
|
sl@0
|
2290 |
}
|
sl@0
|
2291 |
}
|
sl@0
|
2292 |
return pos+1;
|
sl@0
|
2293 |
}
|
sl@0
|
2294 |
|
sl@0
|
2295 |
void CNGAPostProcHwDevice::RemoveFromQ()
|
sl@0
|
2296 |
{
|
sl@0
|
2297 |
if(iInputQ.Count())
|
sl@0
|
2298 |
{
|
sl@0
|
2299 |
if(iPlayRate > 0)
|
sl@0
|
2300 |
{
|
sl@0
|
2301 |
iInputQ.Remove(0);
|
sl@0
|
2302 |
}
|
sl@0
|
2303 |
else
|
sl@0
|
2304 |
{
|
sl@0
|
2305 |
iInputQ.Remove(iInputQ.Count()-1);
|
sl@0
|
2306 |
}
|
sl@0
|
2307 |
}
|
sl@0
|
2308 |
}
|
sl@0
|
2309 |
|
sl@0
|
2310 |
TVideoPicture* CNGAPostProcHwDevice::PeekQ()
|
sl@0
|
2311 |
{
|
sl@0
|
2312 |
TVideoPicture *pic = NULL;
|
sl@0
|
2313 |
if(iInputQ.Count())
|
sl@0
|
2314 |
{
|
sl@0
|
2315 |
if(iPlayRate > 0)
|
sl@0
|
2316 |
{
|
sl@0
|
2317 |
pic = iInputQ[0];
|
sl@0
|
2318 |
}
|
sl@0
|
2319 |
else
|
sl@0
|
2320 |
{
|
sl@0
|
2321 |
pic = iInputQ[iInputQ.Count()-1];
|
sl@0
|
2322 |
}
|
sl@0
|
2323 |
}
|
sl@0
|
2324 |
return pic;
|
sl@0
|
2325 |
}
|
sl@0
|
2326 |
|
sl@0
|
2327 |
TInt CNGAPostProcHwDevice::AddHints()
|
sl@0
|
2328 |
{
|
sl@0
|
2329 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints iSurfaceMask 0x%08x ++"), this, iSurfaceMask);
|
sl@0
|
2330 |
TInt err = KErrNone;
|
sl@0
|
2331 |
iHint.Set(iSurfaceKey,iSurfaceMask,ETrue);
|
sl@0
|
2332 |
err = iSurfaceHandler->AddSurfaceHint(iSurfaceId,iHint);
|
sl@0
|
2333 |
if(err == KErrAlreadyExists)
|
sl@0
|
2334 |
{
|
sl@0
|
2335 |
err = iSurfaceHandler->SetSurfaceHint(iSurfaceId,iHint);
|
sl@0
|
2336 |
}
|
sl@0
|
2337 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints. err = %d --"), this,err);
|
sl@0
|
2338 |
iHint.iKey.iUid = surfaceHints::KSurfaceContent;
|
sl@0
|
2339 |
iHint.iValue = surfaceHints::EVideoPlayback;
|
sl@0
|
2340 |
iHint.iMutable = ETrue;
|
sl@0
|
2341 |
err = iSurfaceHandler->AddSurfaceHint(iSurfaceId,iHint);
|
sl@0
|
2342 |
if(err == KErrAlreadyExists)
|
sl@0
|
2343 |
{
|
sl@0
|
2344 |
err = iSurfaceHandler->SetSurfaceHint(iSurfaceId,iHint);
|
sl@0
|
2345 |
}
|
sl@0
|
2346 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints. err = %d --"), this,err);
|
sl@0
|
2347 |
if(iUsingExternalSurface)
|
sl@0
|
2348 |
{
|
sl@0
|
2349 |
iHint.iKey.iUid = surfaceHints::KSurfaceCharacteristics;
|
sl@0
|
2350 |
iHint.iValue = surfaceHints::ENotPersistable;
|
sl@0
|
2351 |
iHint.iMutable = ETrue;
|
sl@0
|
2352 |
err = iSurfaceHandler->AddSurfaceHint(iSurfaceId,iHint);
|
sl@0
|
2353 |
if(err == KErrAlreadyExists)
|
sl@0
|
2354 |
{
|
sl@0
|
2355 |
err = iSurfaceHandler->SetSurfaceHint(iSurfaceId,iHint);
|
sl@0
|
2356 |
}
|
sl@0
|
2357 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints. err = %d --"), this,err);
|
sl@0
|
2358 |
}
|
sl@0
|
2359 |
return err;
|
sl@0
|
2360 |
}
|
sl@0
|
2361 |
|
sl@0
|
2362 |
TInt CNGAPostProcHwDevice::ColorConvert(tBaseVideoFrame* aInputFrame, TUint8* aDestPtr, tWndParam* aInputCropWindow, tWndParam* aOutputCropWindow)
|
sl@0
|
2363 |
{
|
sl@0
|
2364 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ColorConvert ++"), this);
|
sl@0
|
2365 |
__ASSERT_ALWAYS(aDestPtr, User::Invariant());
|
sl@0
|
2366 |
TInt lError = E_SUCCESS;
|
sl@0
|
2367 |
TInt err = KErrNone;
|
sl@0
|
2368 |
|
sl@0
|
2369 |
err = SetSourceFormat();
|
sl@0
|
2370 |
if(err == KErrNone)
|
sl@0
|
2371 |
{
|
sl@0
|
2372 |
err = SetSourceRange();
|
sl@0
|
2373 |
if(err == KErrNone)
|
sl@0
|
2374 |
{
|
sl@0
|
2375 |
|
sl@0
|
2376 |
lError = Emz_VDec_gColorConv_YUVtoRGB(aInputFrame,aDestPtr,
|
sl@0
|
2377 |
aInputCropWindow, aOutputCropWindow, iSourceFormat,
|
sl@0
|
2378 |
EBitmapColor16MU, iSourceRange);
|
sl@0
|
2379 |
|
sl@0
|
2380 |
if(lError)
|
sl@0
|
2381 |
{
|
sl@0
|
2382 |
if(lError == E_OUT_OF_MEMORY)
|
sl@0
|
2383 |
{
|
sl@0
|
2384 |
err = KErrNoMemory;
|
sl@0
|
2385 |
}
|
sl@0
|
2386 |
else if(lError == E_FAILURE)
|
sl@0
|
2387 |
{
|
sl@0
|
2388 |
err = KErrNotSupported;
|
sl@0
|
2389 |
}
|
sl@0
|
2390 |
else
|
sl@0
|
2391 |
{
|
sl@0
|
2392 |
err = KErrGeneral;
|
sl@0
|
2393 |
}
|
sl@0
|
2394 |
}
|
sl@0
|
2395 |
}
|
sl@0
|
2396 |
}
|
sl@0
|
2397 |
|
sl@0
|
2398 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ColorConvert --"), this);
|
sl@0
|
2399 |
return err;
|
sl@0
|
2400 |
}
|
sl@0
|
2401 |
|
sl@0
|
2402 |
TInt CNGAPostProcHwDevice::SetSourceFormat()
|
sl@0
|
2403 |
{
|
sl@0
|
2404 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceFormatL ++"), this);
|
sl@0
|
2405 |
TInt err = KErrNone;
|
sl@0
|
2406 |
switch (iVideoFormat.iYuvFormat.iPattern)
|
sl@0
|
2407 |
{
|
sl@0
|
2408 |
case EYuv420Chroma1:
|
sl@0
|
2409 |
iSourceFormat = EYuv420Chroma1_Planar;
|
sl@0
|
2410 |
break;
|
sl@0
|
2411 |
case EYuv420Chroma2:
|
sl@0
|
2412 |
iSourceFormat = EYuv420Chroma2_Planar;
|
sl@0
|
2413 |
break;
|
sl@0
|
2414 |
case EYuv420Chroma3:
|
sl@0
|
2415 |
iSourceFormat = EYuv420Chroma3_Planar;
|
sl@0
|
2416 |
break;
|
sl@0
|
2417 |
case EYuv422Chroma1:
|
sl@0
|
2418 |
if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedLE)
|
sl@0
|
2419 |
iSourceFormat = EYuv422Chroma1_LE;
|
sl@0
|
2420 |
else if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedBE )
|
sl@0
|
2421 |
iSourceFormat = EYuv422Chroma1_BE;
|
sl@0
|
2422 |
else
|
sl@0
|
2423 |
err = KErrArgument;
|
sl@0
|
2424 |
break;
|
sl@0
|
2425 |
case EYuv422Chroma2:
|
sl@0
|
2426 |
if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedLE)
|
sl@0
|
2427 |
iSourceFormat = EYuv422Chroma2_LE;
|
sl@0
|
2428 |
else if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedBE )
|
sl@0
|
2429 |
iSourceFormat = EYuv422Chroma2_BE;
|
sl@0
|
2430 |
else
|
sl@0
|
2431 |
err = KErrArgument;
|
sl@0
|
2432 |
break;
|
sl@0
|
2433 |
default:
|
sl@0
|
2434 |
err = KErrNotSupported;
|
sl@0
|
2435 |
}
|
sl@0
|
2436 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceFormatL --"), this);
|
sl@0
|
2437 |
return err;
|
sl@0
|
2438 |
}
|
sl@0
|
2439 |
|
sl@0
|
2440 |
|
sl@0
|
2441 |
TInt CNGAPostProcHwDevice::SetSourceRange()
|
sl@0
|
2442 |
{
|
sl@0
|
2443 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceRangeL ++"), this);
|
sl@0
|
2444 |
TInt err = KErrNone;
|
sl@0
|
2445 |
switch (iVideoFormat.iYuvFormat.iCoefficients)
|
sl@0
|
2446 |
{
|
sl@0
|
2447 |
case EYuvBt601Range0:
|
sl@0
|
2448 |
iSourceRange = EITU601_5_REDUCEDRANGE;
|
sl@0
|
2449 |
break;
|
sl@0
|
2450 |
case EYuvBt601Range1:
|
sl@0
|
2451 |
iSourceRange = EITU601_5_FULLRANGE;
|
sl@0
|
2452 |
break;
|
sl@0
|
2453 |
case EYuvBt709Range0:
|
sl@0
|
2454 |
iSourceRange = EB709_REDUCEDRANGE;
|
sl@0
|
2455 |
break;
|
sl@0
|
2456 |
case EYuvBt709Range1:
|
sl@0
|
2457 |
iSourceRange = EB709_FULLRANGE;
|
sl@0
|
2458 |
break;
|
sl@0
|
2459 |
default:
|
sl@0
|
2460 |
err = KErrNotSupported;
|
sl@0
|
2461 |
}
|
sl@0
|
2462 |
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceRangeL --"), this);
|
sl@0
|
2463 |
return err;
|
sl@0
|
2464 |
}
|
sl@0
|
2465 |
|
sl@0
|
2466 |
CNGAPostProcTimer::CNGAPostProcTimer( CNGAPostProcHwDevice& aParent )
|
sl@0
|
2467 |
:CTimer(EPriorityHigh),iParent(aParent)
|
sl@0
|
2468 |
{
|
sl@0
|
2469 |
CActiveScheduler::Add(this);
|
sl@0
|
2470 |
}
|
sl@0
|
2471 |
|
sl@0
|
2472 |
CNGAPostProcTimer::~CNGAPostProcTimer()
|
sl@0
|
2473 |
{
|
sl@0
|
2474 |
PP_DEBUG(_L("CNGAPostProcTimer[%x]:~CNGAPostProcTimer ++"), this);
|
sl@0
|
2475 |
Cancel();
|
sl@0
|
2476 |
PP_DEBUG(_L("CNGAPostProcTimer[%x]:~CNGAPostProcTimer --"), this);
|
sl@0
|
2477 |
}
|
sl@0
|
2478 |
|
sl@0
|
2479 |
CNGAPostProcTimer* CNGAPostProcTimer::NewL( CNGAPostProcHwDevice& aParent )
|
sl@0
|
2480 |
{
|
sl@0
|
2481 |
CNGAPostProcTimer* self = new (ELeave)CNGAPostProcTimer(aParent);
|
sl@0
|
2482 |
CleanupStack::PushL( self );
|
sl@0
|
2483 |
self->ConstructL();
|
sl@0
|
2484 |
CleanupStack::Pop( self );
|
sl@0
|
2485 |
return self;
|
sl@0
|
2486 |
}
|
sl@0
|
2487 |
|
sl@0
|
2488 |
void CNGAPostProcTimer::ConstructL()
|
sl@0
|
2489 |
{
|
sl@0
|
2490 |
CTimer::ConstructL();
|
sl@0
|
2491 |
}
|
sl@0
|
2492 |
|
sl@0
|
2493 |
void CNGAPostProcTimer::RunL()
|
sl@0
|
2494 |
{
|
sl@0
|
2495 |
PP_DEBUG(_L("CNGAPostProcTimer[%x]:RunL ++"), this);
|
sl@0
|
2496 |
if (iStatus ==KErrCancel)
|
sl@0
|
2497 |
{
|
sl@0
|
2498 |
PP_DEBUG(_L("CNGAPostProcNotifier[%x]:CNGAPostProcNotifier:RunL State canceled"), this);
|
sl@0
|
2499 |
return;
|
sl@0
|
2500 |
}
|
sl@0
|
2501 |
iParent.AttemptToPost();
|
sl@0
|
2502 |
PP_DEBUG(_L("CNGAPostProcTimer[%x]:RunL --"), this);
|
sl@0
|
2503 |
}
|
sl@0
|
2504 |
|