26
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <datawrapper.h>
|
|
20 |
#include <devvideoplay.h>
|
|
21 |
#include <devvideobase.h>
|
|
22 |
#include <hal.h>
|
|
23 |
#include <devvideoconstants.h>
|
|
24 |
#include "t_cmmfdevvideoplaydata.h"
|
|
25 |
#include "t_devvideoconstants.h"
|
|
26 |
|
|
27 |
/*@{*/
|
|
28 |
//LIT's to get params from ini files
|
|
29 |
_LIT(KPostPro, "postprocessor");
|
|
30 |
_LIT(KCodec, "codec");
|
|
31 |
_LIT(KCombination, "combination");
|
|
32 |
_LIT(KScreenout, "screen");
|
|
33 |
_LIT(KFramerate, "framerate");
|
|
34 |
_LIT(KInputfile, "inputfile");
|
|
35 |
_LIT(KOutputfile, "outputfile");
|
|
36 |
_LIT(KSynch, "synch");
|
|
37 |
_LIT(KDecoder, "dec");
|
|
38 |
_LIT(KRotation, "rotation");
|
|
39 |
_LIT(KWidth, "width");
|
|
40 |
_LIT(KHeight, "height");
|
|
41 |
_LIT(Kx, "x");
|
|
42 |
_LIT(Ky, "y");
|
|
43 |
_LIT(KPos, "pos");
|
|
44 |
_LIT(KAntiAliasFiltering, "antiAliasFiltering");
|
|
45 |
_LIT(KMimeType, "mimeType");
|
|
46 |
_LIT(KUseDecoder, "useDecoder");
|
|
47 |
_LIT(KInputPath, "inputPath");
|
|
48 |
_LIT(KOutputPath, "outputPath");
|
|
49 |
_LIT(KDisplayMode, "displayMode");
|
|
50 |
_LIT(KBuf, "buffer");
|
|
51 |
_LIT(KDataInOrder, "dataInOrder");
|
|
52 |
_LIT(KTVideoDataUnitType, "TVideoDataUnitType");
|
|
53 |
_LIT(KTVideoDataUnitEncapsulation, "TVideoDataUnitEncapsulation");
|
|
54 |
//H264
|
|
55 |
_LIT(KUid, "uidInt");
|
|
56 |
_LIT(KBuffMgmt, "buffMgmt");
|
|
57 |
_LIT(KOutput, "output");
|
|
58 |
_LIT(KHwdev, "hwdev");
|
|
59 |
_LIT(KDataUnitTypeInt, "dataUnitTypeInt");
|
|
60 |
_LIT(KEncapsulation, "encapsulation");
|
|
61 |
_LIT(KFormat, "format");
|
|
62 |
_LIT(KDataFormat, "dataFormat");
|
|
63 |
_LIT(KDataLayout, "dataLayout");
|
|
64 |
_LIT(KPattern, "pattern");
|
|
65 |
_LIT(KAspectRatioNum, "aspectRatioNum");
|
|
66 |
_LIT(KAspectRatioDenom, "aspectRatioDenom");
|
|
67 |
_LIT(KCoefficients, "coefficients");
|
|
68 |
_LIT(KPreDecodeBufferSize, "preDecodeBufferSize");
|
|
69 |
_LIT(KMaxPostDecodeBufferSize, "maxPostDecodeBufferSize");
|
|
70 |
_LIT(KPreDecoderBufferPeriodInt, "preDecoderBufferPeriodInt");
|
|
71 |
_LIT(KPostDecoderBufferPeriodInt, "postDecoderBufferPeriodInt");
|
|
72 |
_LIT(KMaxInputBufferSize, "maxInputBufferSize");
|
|
73 |
_LIT(KMinNumInputBuffers, "minNumInputBuffers");
|
|
74 |
_LIT(KInputEnd, "inputEnd");
|
|
75 |
_LIT(KDest, "dest");
|
|
76 |
_LIT(KX, "x");
|
|
77 |
_LIT(KY, "y");
|
|
78 |
_LIT(KSync, "sync");
|
|
79 |
/*@}*/
|
|
80 |
|
|
81 |
/*@{*/
|
|
82 |
//LIT's to identify commands
|
|
83 |
_LIT(KCmdNewL, "NewL");
|
|
84 |
_LIT(KCmdDestructor, "~");
|
|
85 |
_LIT(KCmdInitialize, "Initialize");
|
|
86 |
_LIT(KCmdStart, "Start");
|
|
87 |
_LIT(KCmdStop, "Stop");
|
|
88 |
_LIT(KCmdPause, "Pause");
|
|
89 |
_LIT(KCmdResume, "Resume");
|
|
90 |
_LIT(KCmdSetRotateOptionsL, "SetRotateOptionsL");
|
|
91 |
_LIT(KCmdSetScaleOptionsL, "SetScaleOptionsL");
|
|
92 |
_LIT(KCmdSetPosition, "SetPosition");
|
|
93 |
_LIT(KCmdSetClockSource, "SetClockSource");
|
|
94 |
_LIT(KCmdSelectDecoderL, "SelectDecoderL");
|
|
95 |
_LIT(KCmdSetInputFormat, "SetInputFormat");
|
|
96 |
_LIT(KCmdSelectPostProcessorL, "SelectPostProcessorL");
|
|
97 |
_LIT(KCmdPostProcessorInfoLC, "PostProcessorInfoLC");
|
|
98 |
_LIT(KCmdFindCommonFormat, "FindCommonFormat");
|
|
99 |
_LIT(KCmdSetOutputFormatL, "SetOutputFormatL");
|
|
100 |
_LIT(KCmdGetHeaderInformationL, "GetHeaderInformationL");
|
|
101 |
_LIT(KCmdReturnHeader, "ReturnHeader");
|
|
102 |
_LIT(KCmdSetVideoDestScreenL, "SetVideoDestScreenL");
|
|
103 |
_LIT(KCmdGetBufferOptions, "GetBufferOptions");
|
|
104 |
_LIT(KCmdSetBufferOptionsL, "SetBufferOptionsL");
|
|
105 |
_LIT(KCmdSetPostProcessTypesL, "SetPostProcessTypesL");
|
|
106 |
_LIT(KCmdGetOutputFormatListL, "GetOutputFormatListL");
|
|
107 |
_LIT(KCmdAbortDirectScreenAccess, "AbortDirectScreenAccess");
|
|
108 |
_LIT(KCmdStartDirectScreenAccess, "StartDirectScreenAccess");
|
|
109 |
_LIT(KCmdUtilityGetEnvironment, "UtilityGetEnvironment");
|
|
110 |
/*@}*/
|
|
111 |
_LIT(KCmdH264CreateDecTest, "H264CreateDecTest");
|
|
112 |
_LIT(KCmdH264SelectPostProcessor, "H264SelectPostProcessor");
|
|
113 |
_LIT(KCmdH264SetPostProcessTypes, "H264SetPostProcessTypes");
|
|
114 |
_LIT(KCmdH264SetInputFormatCompr, "H264SetInputFormatCompr");
|
|
115 |
_LIT(KCmdH264SetOutputFormat, "H264SetOutputFormat");
|
|
116 |
_LIT(KCmdH264SetBufferOptions, "H264SetBufferOptions");
|
|
117 |
_LIT(KCmdH264ListFrameSize, "H264ListFrameSize");
|
|
118 |
_LIT(KCmdH264SetVideoDestScreen, "H264SetVideoDestScreen");
|
|
119 |
_LIT(KCmdH264SetWindowRect, "H264SetWindowRect");
|
|
120 |
_LIT(KCmdH264Initialize, "H264Initialize");
|
|
121 |
_LIT(KCmdH264Start, "H264Start");
|
|
122 |
_LIT(KCmdH264Stop, "H264Stop");
|
|
123 |
_LIT(KCmdH264Pause, "H264Pause");
|
|
124 |
_LIT(KCmdH264Resume, "H264Resume");
|
|
125 |
_LIT(KCmdH264IOFrameMatch, "H264IOFrameMatch");
|
|
126 |
_LIT(KCmdH264FindCommonFormats, "H264FindCommonFormats");
|
|
127 |
_LIT(KCmdH264GetHeaderInformation, "H264GetHeaderInformation");
|
|
128 |
_LIT(KCmdH264EnableSynchronization, "H264EnableSynchronization");
|
|
129 |
_LIT(KCmdH264SetScaleOptions, "H264SetScaleOptions");
|
|
130 |
_LIT(KCmdH264SetRotateOptions, "H264SetRotateOptions");
|
|
131 |
_LIT(KCmdH264SynchronizeDecoding, "H264SynchronizeDecoding");
|
|
132 |
_LIT(KCmdH264Delete, "H264Delete");
|
|
133 |
_LIT(KCmdH264SetPosition, "H264SetPosition");
|
|
134 |
_LIT(KCmdH264AbortDirectScreenAccess, "H264AbortDirectScreenAccess");
|
|
135 |
|
|
136 |
/*@{*/
|
|
137 |
_LIT(KNoCodec, "ENoCodec");
|
|
138 |
_LIT(KH263, "EH263");
|
|
139 |
_LIT(KMPEG4, "EMPEG4");
|
|
140 |
_LIT(KH264, "EH264");
|
|
141 |
_LIT(KRV9, "ERV9");
|
|
142 |
/*@}*/
|
|
143 |
|
|
144 |
const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iCodecs[] =
|
|
145 |
{
|
|
146 |
KNoCodec, ENoCodec,
|
|
147 |
KH263, EH263,
|
|
148 |
KMPEG4, EMPEG4,
|
|
149 |
KH264, EH264,
|
|
150 |
KRV9, ERV9
|
|
151 |
};
|
|
152 |
|
|
153 |
/*@{*/
|
|
154 |
//LIT's for display mode
|
|
155 |
_LIT(KNone, "ENone");
|
|
156 |
_LIT(KGray2, "EGray2");
|
|
157 |
_LIT(KGray4, "EGray4");
|
|
158 |
_LIT(KGray16, "EGray16");
|
|
159 |
_LIT(KGray256, "EGray256");
|
|
160 |
_LIT(KColor16, "EColor16");
|
|
161 |
_LIT(KColor256, "EColor256");
|
|
162 |
_LIT(KColor64K, "EColor64K");
|
|
163 |
_LIT(KColor16M, "EColor16M");
|
|
164 |
_LIT(KRgb, "ERgb");
|
|
165 |
_LIT(KColor4K, "EColor4K");
|
|
166 |
_LIT(KColor16MU, "EColor16MU");
|
|
167 |
_LIT(KColor16MA, "EColor16MA");
|
|
168 |
_LIT(KColorLast, "EColorLast");
|
|
169 |
/*@}*/
|
|
170 |
|
|
171 |
const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iDisplayModes[] =
|
|
172 |
{
|
|
173 |
KNone, ENone,
|
|
174 |
KGray2, EGray2,
|
|
175 |
KGray4, EGray4,
|
|
176 |
KGray16, EGray16,
|
|
177 |
KGray256, EGray256,
|
|
178 |
KColor16, EColor16,
|
|
179 |
KColor256, EColor256,
|
|
180 |
KColor64K, EColor64K,
|
|
181 |
KColor16M, EColor16M,
|
|
182 |
KRgb, ERgb,
|
|
183 |
KColor4K, EColor4K,
|
|
184 |
KColor16MU, EColor16MU,
|
|
185 |
KColor16MA, EColor16MA,
|
|
186 |
KColorLast, EColorLast,
|
|
187 |
KColor64K, EColor64K,
|
|
188 |
};
|
|
189 |
|
|
190 |
/*@{*/
|
|
191 |
//LIT's for rotation
|
|
192 |
_LIT(KRotateNone, "ERotateNone");
|
|
193 |
_LIT(KRotate90Clockwise, "ERotate90Clockwise");
|
|
194 |
_LIT(KRotate90Anticlockwise, "ERotate90Anticlockwise");
|
|
195 |
_LIT(KRotate180, "ERotate180");
|
|
196 |
/*@}*/
|
|
197 |
const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iRotations[] =
|
|
198 |
{
|
|
199 |
KRotateNone, ERotateNone,
|
|
200 |
KRotate90Clockwise, ERotate90Clockwise,
|
|
201 |
KRotate90Anticlockwise, ERotate90Anticlockwise,
|
|
202 |
KRotate180, ERotate180
|
|
203 |
};
|
|
204 |
|
|
205 |
/*@{*/
|
|
206 |
//LIT's for Video Data Unit Type
|
|
207 |
_LIT(KEDuCodedPicture, "EDuCodedPicture");
|
|
208 |
_LIT(KEDuVideoSegment, "EDuVideoSegment");
|
|
209 |
_LIT(KEDuSeveralSegments, "EDuSeveralSegments");
|
|
210 |
_LIT(KEDuArbitraryStreamSection, "EDuArbitraryStreamSection");
|
|
211 |
/*@}*/
|
|
212 |
|
|
213 |
const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iTVideoDataUnitType[] =
|
|
214 |
{
|
|
215 |
KEDuCodedPicture, EDuCodedPicture,
|
|
216 |
KEDuVideoSegment, EDuVideoSegment,
|
|
217 |
KEDuSeveralSegments, EDuSeveralSegments,
|
|
218 |
KEDuArbitraryStreamSection, EDuArbitraryStreamSection
|
|
219 |
};
|
|
220 |
|
|
221 |
/*@{*/
|
|
222 |
//LIT's for video data unit encapsulation
|
|
223 |
_LIT(KEDuElementaryStream, "EDuElementaryStream");
|
|
224 |
_LIT(KEDuGenericPayload, "EDuGenericPayload");
|
|
225 |
_LIT(KEDuRtpPayload, "EDuRtpPayload");
|
|
226 |
/*@}*/
|
|
227 |
const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iTVideoDataUnitEncapsulation[] =
|
|
228 |
{
|
|
229 |
KEDuElementaryStream, EDuElementaryStream,
|
|
230 |
KEDuGenericPayload, EDuGenericPayload,
|
|
231 |
KEDuRtpPayload, EDuRtpPayload
|
|
232 |
};
|
|
233 |
|
|
234 |
//H264
|
|
235 |
// -----------------------------------------------------------------------------
|
|
236 |
// class CEngineObserver
|
|
237 |
// -----------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
CEngineObserver::CEngineObserver(CT_CMMFDevVideoPlay& aTestClass) :
|
|
240 |
iTestClass(aTestClass)
|
|
241 |
{
|
|
242 |
|
|
243 |
}
|
|
244 |
void CEngineObserver::MvdeStreamEndReached()
|
|
245 |
{
|
|
246 |
iTestClass.DecOutstanding();
|
|
247 |
}
|
|
248 |
void CEngineObserver::MvdeSetError(TInt aError)
|
|
249 |
{
|
|
250 |
iTestClass.SetError(aError);
|
|
251 |
}
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Public destructor
|
|
255 |
*/
|
|
256 |
CT_CMMFDevVideoPlay::~CT_CMMFDevVideoPlay()
|
|
257 |
{
|
|
258 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay Destructor In"));
|
|
259 |
if(!iUse264)
|
|
260 |
{
|
|
261 |
if(iDsaStarted)
|
|
262 |
{
|
|
263 |
iDevvp->AbortDirectScreenAccess();
|
|
264 |
iDsaStarted = EFalse;
|
|
265 |
}
|
|
266 |
DestroyData();
|
|
267 |
}
|
|
268 |
|
|
269 |
iUse264 = EFalse;
|
|
270 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay Destructor Out"));
|
|
271 |
}
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Return a pointer to the object that the data wraps
|
|
275 |
* @return pointer to the object that the data wraps
|
|
276 |
*/
|
|
277 |
TAny* CT_CMMFDevVideoPlay::GetObject()
|
|
278 |
{
|
|
279 |
return iDevvp;
|
|
280 |
}
|
|
281 |
|
|
282 |
/**
|
|
283 |
* Command that destroy the wrapped object and helper objects
|
|
284 |
*/
|
|
285 |
void CT_CMMFDevVideoPlay::DoCmdDestructor()
|
|
286 |
{
|
|
287 |
DestroyData();
|
|
288 |
if ( iFileOpen )
|
|
289 |
{
|
|
290 |
CloseFile();
|
|
291 |
iFileOpen = EFalse;
|
|
292 |
}
|
|
293 |
if ( iDsaStarted )
|
|
294 |
{
|
|
295 |
iDevvp->AbortDirectScreenAccess();
|
|
296 |
iDsaStarted = EFalse;
|
|
297 |
}
|
|
298 |
//Postproc input buffer
|
|
299 |
if ( !iCIBuffMgmtOn && iRawInBuffer)
|
|
300 |
{
|
|
301 |
delete (TUint8*)iRawInBuffer->iData.iRawData->Ptr();
|
|
302 |
delete iRawInBuffer->iData.iRawData;
|
|
303 |
delete iRawInBuffer;
|
|
304 |
iRawInBuffer = NULL;
|
|
305 |
}
|
|
306 |
if(iScreenDevice)
|
|
307 |
{
|
|
308 |
delete iScreenDevice;
|
|
309 |
iScreenDevice = NULL;
|
|
310 |
RFbsSession::Disconnect();
|
|
311 |
}
|
|
312 |
if(iClock)
|
|
313 |
{
|
|
314 |
delete iClock;
|
|
315 |
iClock = NULL;
|
|
316 |
}
|
|
317 |
iFrameSizeList.Close();
|
|
318 |
iFs.Close();
|
|
319 |
REComSession::FinalClose();
|
|
320 |
if(iInfo)
|
|
321 |
{
|
|
322 |
delete iInfo;
|
|
323 |
iInfo=NULL;
|
|
324 |
}
|
|
325 |
while(Outstanding())
|
|
326 |
{
|
|
327 |
INFO_PRINTF1(_L("DoCmdDestructor DecOutstanding()"));
|
|
328 |
DecOutstanding();
|
|
329 |
}
|
|
330 |
}
|
|
331 |
|
|
332 |
/**
|
|
333 |
* Helper method tha destroy the wrapped object
|
|
334 |
*/
|
|
335 |
void CT_CMMFDevVideoPlay::DestroyData()
|
|
336 |
{
|
|
337 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DestroyData"));
|
|
338 |
// Delete Devvideo play
|
|
339 |
delete iDevvp;
|
|
340 |
iDevvp = NULL;
|
|
341 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DestroyData"));
|
|
342 |
}
|
|
343 |
|
|
344 |
/**
|
|
345 |
* Two phase constructor
|
|
346 |
*
|
|
347 |
* @leave system wide error
|
|
348 |
*/
|
|
349 |
CT_CMMFDevVideoPlay* CT_CMMFDevVideoPlay::NewL()
|
|
350 |
{
|
|
351 |
CT_CMMFDevVideoPlay* ret=new (ELeave) CT_CMMFDevVideoPlay();
|
|
352 |
CleanupStack::PushL(ret);
|
|
353 |
ret->ConstructL();
|
|
354 |
CleanupStack::Pop(ret);
|
|
355 |
return ret;
|
|
356 |
}
|
|
357 |
|
|
358 |
/**
|
|
359 |
* Protected constructor. First phase construction
|
|
360 |
*/
|
|
361 |
CT_CMMFDevVideoPlay::CT_CMMFDevVideoPlay()
|
|
362 |
:
|
|
363 |
iDevvp(NULL),
|
|
364 |
iDecHWDevId(0),
|
|
365 |
iPostProcId(0),
|
|
366 |
iInBuffSize(0),
|
|
367 |
iInputEnd(EFalse),
|
|
368 |
iDsaStarted(EFalse),
|
|
369 |
iSynchronized(EFalse),
|
|
370 |
iFrameListed(EFalse),
|
|
371 |
iPictureSize(0,0),
|
|
372 |
iAsyncErrorIndex(0),
|
|
373 |
iFileOpen(EFalse),
|
|
374 |
iCodedInBuffer(NULL),
|
|
375 |
iOutBuffer(NULL),
|
|
376 |
iRawInBuffer(NULL),
|
|
377 |
iTimeStamp(0),
|
|
378 |
iFrameTimeInterval(0),
|
|
379 |
iSentBuffCount(0),
|
|
380 |
iReturnedBuffCount(0),
|
|
381 |
iPictureLoss(0),
|
|
382 |
iStreamEnd(EFalse),
|
|
383 |
iCodecType(EH263),
|
|
384 |
iClock(NULL),
|
|
385 |
iDirectScreenAccess(EFalse),
|
|
386 |
iCIBuffMgmtOn(EFalse),
|
|
387 |
iFrameMeasurement(EFalse),
|
|
388 |
iCommonFormatFound(EFalse),
|
|
389 |
iErrorInputBuffer(EFalse),
|
|
390 |
iEngine(NULL),
|
|
391 |
iObserver(NULL),
|
|
392 |
iUse264(EFalse),
|
|
393 |
iFrameRate(15)
|
|
394 |
{
|
|
395 |
}
|
|
396 |
|
|
397 |
/**
|
|
398 |
* Second phase construction
|
|
399 |
* @internalComponent
|
|
400 |
* @return N/A
|
|
401 |
* @pre None
|
|
402 |
* @post None * @leave system wide error
|
|
403 |
*/
|
|
404 |
void CT_CMMFDevVideoPlay::ConstructL()
|
|
405 |
{
|
|
406 |
iClock = CSystemClockSource::NewL();
|
|
407 |
}
|
|
408 |
|
|
409 |
/**
|
|
410 |
* Process a command read from the ini file
|
|
411 |
* @param aCommand The command to process
|
|
412 |
* @param aSection The section in the ini containing data for the command
|
|
413 |
* @param aAsyncErrorIndex Command index for async calls to return errors to
|
|
414 |
* @return ETrue if the command is processed *
|
|
415 |
* @leave System wide error
|
|
416 |
*/
|
|
417 |
TBool CT_CMMFDevVideoPlay::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection,
|
|
418 |
const TInt aAsyncErrorIndex)
|
|
419 |
{
|
|
420 |
TBool ret=ETrue;
|
|
421 |
|
|
422 |
if ( aCommand==KCmdDestructor )
|
|
423 |
{
|
|
424 |
DoCmdDestructor();
|
|
425 |
}
|
|
426 |
else if ( aCommand==KCmdNewL )
|
|
427 |
{
|
|
428 |
DoCmdNewL(aSection);
|
|
429 |
}
|
|
430 |
else if ( aCommand==KCmdInitialize )
|
|
431 |
{
|
|
432 |
DoCmdInitialize(aAsyncErrorIndex);
|
|
433 |
}
|
|
434 |
else if ( aCommand==KCmdStart )
|
|
435 |
{
|
|
436 |
DoCmdStart(aAsyncErrorIndex);
|
|
437 |
}
|
|
438 |
else if ( aCommand==KCmdStop )
|
|
439 |
{
|
|
440 |
DoCmdStop();
|
|
441 |
}
|
|
442 |
else if ( aCommand==KCmdSetPosition )
|
|
443 |
{
|
|
444 |
DoCmdSetPosition(aSection);
|
|
445 |
}
|
|
446 |
else if ( aCommand==KCmdPause )
|
|
447 |
{
|
|
448 |
DoCmdPause();
|
|
449 |
}
|
|
450 |
else if ( aCommand==KCmdResume )
|
|
451 |
{
|
|
452 |
DoCmdResume();
|
|
453 |
}
|
|
454 |
else if ( aCommand==KCmdSetRotateOptionsL )
|
|
455 |
{
|
|
456 |
DoCmdSetRotateOptionsL(aSection);
|
|
457 |
}
|
|
458 |
else if ( aCommand==KCmdSetScaleOptionsL )
|
|
459 |
{
|
|
460 |
DoCmdSetScaleOptionsL(aSection);
|
|
461 |
}
|
|
462 |
else if ( aCommand==KCmdSetClockSource )
|
|
463 |
{
|
|
464 |
DoCmdSetClockSource(aSection);
|
|
465 |
}
|
|
466 |
else if ( aCommand==KCmdSelectDecoderL )
|
|
467 |
{
|
|
468 |
DoCmdSelectDecoderL(aSection);
|
|
469 |
}
|
|
470 |
else if ( aCommand==KCmdSelectPostProcessorL )
|
|
471 |
{
|
|
472 |
DoCmdSelectPostProcessorL(aSection);
|
|
473 |
}
|
|
474 |
else if ( aCommand==KCmdPostProcessorInfoLC )
|
|
475 |
{
|
|
476 |
DoCmdPostProcessorInfoLC();
|
|
477 |
}
|
|
478 |
else if ( aCommand==KCmdGetOutputFormatListL )
|
|
479 |
{
|
|
480 |
DoCmdGetOutputFormatListL(aSection);
|
|
481 |
}
|
|
482 |
else if ( aCommand==KCmdFindCommonFormat )
|
|
483 |
{
|
|
484 |
DoCmdFindCommonFormat();
|
|
485 |
}
|
|
486 |
else if ( aCommand==KCmdSetOutputFormatL )
|
|
487 |
{
|
|
488 |
DoCmdSetOutputFormatL(aSection);
|
|
489 |
}
|
|
490 |
else if ( aCommand==KCmdGetHeaderInformationL )
|
|
491 |
{
|
|
492 |
DoCmdGetHeaderInformationL(aSection);
|
|
493 |
}
|
|
494 |
else if ( aCommand==KCmdReturnHeader )
|
|
495 |
{
|
|
496 |
DoCmdReturnHeader();
|
|
497 |
}
|
|
498 |
else if ( aCommand==KCmdSetVideoDestScreenL )
|
|
499 |
{
|
|
500 |
DoCmdSetVideoDestScreenL();
|
|
501 |
}
|
|
502 |
else if ( aCommand==KCmdGetBufferOptions )
|
|
503 |
{
|
|
504 |
DoCmdGetBufferOptions();
|
|
505 |
}
|
|
506 |
else if ( aCommand==KCmdSetBufferOptionsL )
|
|
507 |
{
|
|
508 |
DoCmdSetBufferOptionsL();
|
|
509 |
}
|
|
510 |
else if ( aCommand==KCmdSetPostProcessTypesL )
|
|
511 |
{
|
|
512 |
DoCmdSetPostProcessTypesL(aSection);
|
|
513 |
}
|
|
514 |
else if ( aCommand==KCmdSetInputFormat )
|
|
515 |
{
|
|
516 |
DoCmdSetInputFormatL(aSection);
|
|
517 |
}
|
|
518 |
else if ( aCommand==KCmdStartDirectScreenAccess )
|
|
519 |
{
|
|
520 |
DoCmdStartDirectScreenAccessL(aSection);
|
|
521 |
}
|
|
522 |
else if ( aCommand==KCmdAbortDirectScreenAccess )
|
|
523 |
{
|
|
524 |
DoCmdAbortDirectScreenAccess();
|
|
525 |
}
|
|
526 |
else if ( aCommand==KCmdUtilityGetEnvironment )
|
|
527 |
{
|
|
528 |
DoCmdUtilityGetEnvironmentL();
|
|
529 |
}
|
|
530 |
else if ( aCommand==KCmdH264CreateDecTest)
|
|
531 |
{
|
|
532 |
DoCmdH264CreateDecTest(aSection);
|
|
533 |
}
|
|
534 |
else if (aCommand==KCmdH264SelectPostProcessor)
|
|
535 |
{
|
|
536 |
DoCmdH264SelectPostProcessor(aSection);
|
|
537 |
}
|
|
538 |
else if (aCommand==KCmdH264SetPostProcessTypes)
|
|
539 |
{
|
|
540 |
DoCmdH264SetPostProcessTypes(aSection);
|
|
541 |
}
|
|
542 |
else if (aCommand==KCmdH264SetInputFormatCompr)
|
|
543 |
{
|
|
544 |
DoCmdH264SetInputFormatCompr(aSection);
|
|
545 |
}
|
|
546 |
else if (aCommand==KCmdH264SetOutputFormat)
|
|
547 |
{
|
|
548 |
DoCmdH264SetOutputFormat(aSection);
|
|
549 |
}
|
|
550 |
else if (aCommand==KCmdH264SetBufferOptions)
|
|
551 |
{
|
|
552 |
DoCmdH264SetBufferOptions(aSection);
|
|
553 |
}
|
|
554 |
else if (aCommand==KCmdH264ListFrameSize)
|
|
555 |
{
|
|
556 |
DoCmdH264ListFrameSize();
|
|
557 |
}
|
|
558 |
else if (aCommand==KCmdH264SetVideoDestScreen)
|
|
559 |
{
|
|
560 |
DoCmdH264SetVideoDestScreen(aSection);
|
|
561 |
}
|
|
562 |
else if (aCommand==KCmdH264SetWindowRect)
|
|
563 |
{
|
|
564 |
DoCmdH264SetWindowRect(aSection);
|
|
565 |
}
|
|
566 |
else if (aCommand==KCmdH264Initialize)
|
|
567 |
{
|
|
568 |
DoCmdH264Initialize();
|
|
569 |
}
|
|
570 |
else if (aCommand==KCmdH264Start)
|
|
571 |
{
|
|
572 |
DoCmdH264Start(aSection);
|
|
573 |
}
|
|
574 |
else if (aCommand==KCmdH264IOFrameMatch)
|
|
575 |
{
|
|
576 |
DoCmdH264IOFrameNumMatch();
|
|
577 |
}
|
|
578 |
else if (aCommand==KCmdH264Stop)
|
|
579 |
{
|
|
580 |
DoCmdH264Stop();
|
|
581 |
}
|
|
582 |
else if (aCommand==KCmdH264GetHeaderInformation)
|
|
583 |
{
|
|
584 |
DoCmdH264GetHeaderInformation(aSection);
|
|
585 |
}
|
|
586 |
else if (aCommand==KCmdH264FindCommonFormats)
|
|
587 |
{
|
|
588 |
DoCmdH264FindCommonFormats();
|
|
589 |
}
|
|
590 |
else if (aCommand==KCmdH264EnableSynchronization)
|
|
591 |
{
|
|
592 |
DoCmdH264EnableSynchronization(aSection);
|
|
593 |
}
|
|
594 |
else if (aCommand==KCmdH264SetScaleOptions)
|
|
595 |
{
|
|
596 |
DoCmdH264SetScaleOptions(aSection);
|
|
597 |
}
|
|
598 |
else if (aCommand==KCmdH264SetRotateOptions)
|
|
599 |
{
|
|
600 |
DoCmdH264SetRotateOptions(aSection);
|
|
601 |
}
|
|
602 |
else if (aCommand==KCmdH264SynchronizeDecoding)
|
|
603 |
{
|
|
604 |
DoCmdH264SynchronizeDecoding(aSection);
|
|
605 |
}
|
|
606 |
else if (aCommand==KCmdH264Delete)
|
|
607 |
{
|
|
608 |
DoCmdH264Delete();
|
|
609 |
}
|
|
610 |
else if (aCommand==KCmdH264Pause)
|
|
611 |
{
|
|
612 |
DoCmdH264Pause();
|
|
613 |
}
|
|
614 |
else if (aCommand==KCmdH264Resume)
|
|
615 |
{
|
|
616 |
DoCmdH264Resume();
|
|
617 |
}
|
|
618 |
else if (aCommand==KCmdH264SetPosition)
|
|
619 |
{
|
|
620 |
DoCmdH264SetPosition(aSection);
|
|
621 |
}
|
|
622 |
else if (aCommand==KCmdH264AbortDirectScreenAccess)
|
|
623 |
{
|
|
624 |
DoCmdH264AbortDirectScreenAccess();
|
|
625 |
}
|
|
626 |
else
|
|
627 |
{
|
|
628 |
ERR_PRINTF1(_L("Unknown command"));
|
|
629 |
ret = EFalse;
|
|
630 |
}
|
|
631 |
return ret;
|
|
632 |
}
|
|
633 |
|
|
634 |
/**
|
|
635 |
* Constructs CMMFDevVideoPlay instance and initialize params.
|
|
636 |
* @param aSection - The section to read from the ini file
|
|
637 |
* @return none
|
|
638 |
*/
|
|
639 |
void CT_CMMFDevVideoPlay::DoCmdNewL(const TTEFSectionName& aSection)
|
|
640 |
{
|
|
641 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdNewL"));
|
|
642 |
TBool dataOk = ETrue;
|
|
643 |
DestroyData();
|
|
644 |
TRAPD(err, iDevvp = CMMFDevVideoPlay::NewL(*this));
|
|
645 |
if ( err!=KErrNone)
|
|
646 |
{
|
|
647 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), err);
|
|
648 |
SetError (err);
|
|
649 |
dataOk = EFalse;
|
|
650 |
}
|
|
651 |
if(dataOk)
|
|
652 |
{
|
|
653 |
TRAP(err, InitializeParamsL(aSection));
|
|
654 |
if (err != KErrNone)
|
|
655 |
{
|
|
656 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed in InitializeParamsL. Error: %d"), err);
|
|
657 |
SetError (err);
|
|
658 |
}
|
|
659 |
CreateFiles(aSection);
|
|
660 |
}
|
|
661 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdNewL"));
|
|
662 |
}
|
|
663 |
|
|
664 |
/**
|
|
665 |
* Open File session
|
|
666 |
*/
|
|
667 |
void CT_CMMFDevVideoPlay::CreateFiles(const TTEFSectionName& aSection)
|
|
668 |
{
|
|
669 |
TPtrC inputPath;
|
|
670 |
TPtrC outputPath;
|
|
671 |
TPtrC inputfile;
|
|
672 |
TPtrC outputfile;
|
|
673 |
TBool screenout = EFalse;
|
|
674 |
TInt error = KErrNone;
|
|
675 |
TBool dataOk = ETrue;
|
|
676 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::CreateFiles"));
|
|
677 |
|
|
678 |
if ( !(GetBoolFromConfig(aSection, KScreenout(), screenout)))
|
|
679 |
{
|
|
680 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScreenout());
|
|
681 |
SetBlockResult(EFail);
|
|
682 |
dataOk = EFalse;
|
|
683 |
}
|
|
684 |
if ( !(GetStringFromConfig(aSection, KInputfile(),inputfile)))
|
|
685 |
{
|
|
686 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputfile());
|
|
687 |
SetBlockResult(EFail);
|
|
688 |
dataOk = EFalse;
|
|
689 |
}
|
|
690 |
if ( !screenout)
|
|
691 |
{
|
|
692 |
if ( !(GetStringFromConfig(aSection, KOutputfile(),outputfile)))
|
|
693 |
{
|
|
694 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputfile());
|
|
695 |
SetBlockResult(EFail);
|
|
696 |
dataOk = EFalse;
|
|
697 |
}
|
|
698 |
}
|
|
699 |
if ( !(GetStringFromConfig(aSection, KInputPath(),inputPath)))
|
|
700 |
{
|
|
701 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputPath());
|
|
702 |
SetBlockResult(EFail);
|
|
703 |
dataOk = EFalse;
|
|
704 |
}
|
|
705 |
if(dataOk)
|
|
706 |
{
|
|
707 |
error = iFs.Connect ();
|
|
708 |
if ( error!=KErrNone)
|
|
709 |
{
|
|
710 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), error);
|
|
711 |
SetError (error);
|
|
712 |
}
|
|
713 |
else
|
|
714 |
{
|
|
715 |
TFileName inFileName(inputPath);
|
|
716 |
inFileName.Append (inputfile);
|
|
717 |
//Open File
|
|
718 |
if ( screenout)
|
|
719 |
{
|
|
720 |
TRAPD(err, OpenFileL(inFileName));
|
|
721 |
if ( err != KErrNone)
|
|
722 |
{
|
|
723 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), err);
|
|
724 |
SetError (err);
|
|
725 |
}
|
|
726 |
iFileOpen = ETrue;
|
|
727 |
INFO_PRINTF1(_L("File Opened!"));
|
|
728 |
}
|
|
729 |
else
|
|
730 |
{
|
|
731 |
if ( ! (GetStringFromConfig(aSection, KOutputPath(),outputPath)))
|
|
732 |
{
|
|
733 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputPath());
|
|
734 |
SetBlockResult(EFail);
|
|
735 |
}
|
|
736 |
TFileName outFileName(outputPath);
|
|
737 |
outFileName.Append (outputfile);
|
|
738 |
TRAPD(err, OpenFileL(outFileName, inFileName));
|
|
739 |
if ( err != KErrNone)
|
|
740 |
{
|
|
741 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::OpenFileL failed with error %d"), err);
|
|
742 |
SetError (err);
|
|
743 |
}
|
|
744 |
iFileOpen = ETrue;
|
|
745 |
}
|
|
746 |
}
|
|
747 |
}
|
|
748 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::CreateFiles"));
|
|
749 |
}
|
|
750 |
|
|
751 |
/**
|
|
752 |
* Initilize Engine parameters
|
|
753 |
* @param aSection - The section to read from the ini file
|
|
754 |
* @return none
|
|
755 |
*/
|
|
756 |
void CT_CMMFDevVideoPlay::InitializeParamsL(const TTEFSectionName& aSection)
|
|
757 |
{
|
|
758 |
TInt codec = 0;
|
|
759 |
TBool dataOk = ETrue;
|
|
760 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::InitializeParamsL"));
|
|
761 |
if ( !(GetEnumFromConfig(aSection, KCodec(), iCodecs, codec)))
|
|
762 |
{
|
|
763 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCodec());
|
|
764 |
SetBlockResult(EFail);
|
|
765 |
dataOk = EFalse;
|
|
766 |
}
|
|
767 |
if ( !(GetBoolFromConfig(aSection, KScreenout(), iDirectScreenAccess)))
|
|
768 |
{
|
|
769 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScreenout());
|
|
770 |
SetBlockResult(EFail);
|
|
771 |
dataOk = EFalse;
|
|
772 |
}
|
|
773 |
|
|
774 |
if(dataOk)
|
|
775 |
{
|
|
776 |
iCodecType=(TVideoCodec)codec;
|
|
777 |
if (iDirectScreenAccess)
|
|
778 |
{
|
|
779 |
User::LeaveIfError(FbsStartup());
|
|
780 |
}
|
|
781 |
}
|
|
782 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::InitializeParamsL"));
|
|
783 |
}
|
|
784 |
|
|
785 |
/**
|
|
786 |
* Sets the clock source in case the sync parameter is true
|
|
787 |
* @param aSection - The section to read from the ini file
|
|
788 |
* @return none
|
|
789 |
*/
|
|
790 |
void CT_CMMFDevVideoPlay::DoCmdSetClockSource(const TTEFSectionName& aSection)
|
|
791 |
{
|
|
792 |
TInt framerate = 0;
|
|
793 |
TInt synch = 0;
|
|
794 |
TBool dataOk = ETrue;
|
|
795 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetClockSource"));
|
|
796 |
if ( !( GetIntFromConfig(aSection, KFramerate(), framerate)) )
|
|
797 |
{
|
|
798 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFramerate());
|
|
799 |
SetBlockResult(EFail);
|
|
800 |
dataOk = EFalse;
|
|
801 |
}
|
|
802 |
if ( !( GetIntFromConfig(aSection,KSynch(), synch)) )
|
|
803 |
{
|
|
804 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSynch());
|
|
805 |
SetBlockResult(EFail);
|
|
806 |
dataOk = EFalse;
|
|
807 |
}
|
|
808 |
if(dataOk)
|
|
809 |
{
|
|
810 |
if (synch) //Set Clock and frame rate for syncronization
|
|
811 |
{
|
|
812 |
TRAPD(err, ListFrameSizeL(iCodecType));
|
|
813 |
if ( err != KErrNone)
|
|
814 |
{
|
|
815 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::ListFrameSizeL failed with error %d"), err);
|
|
816 |
SetError (err);
|
|
817 |
}
|
|
818 |
else
|
|
819 |
{
|
|
820 |
INFO_PRINTF1(_L("List Frame done!"));
|
|
821 |
iDevvp->SetClockSource(iClock);
|
|
822 |
iSynchronized = ETrue;
|
|
823 |
iFrameTimeInterval = (TInt64)(1000000/framerate);
|
|
824 |
iFramerate = framerate;
|
|
825 |
}
|
|
826 |
}
|
|
827 |
}
|
|
828 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetClockSource"));
|
|
829 |
}
|
|
830 |
|
|
831 |
/**
|
|
832 |
* Gets the decoders list and Select a Decoder
|
|
833 |
* @param aSection - Section to read from the ini file
|
|
834 |
* @return none
|
|
835 |
*/
|
|
836 |
void CT_CMMFDevVideoPlay::DoCmdSelectDecoderL(const TTEFSectionName& aSection)
|
|
837 |
{
|
|
838 |
TInt decoder;
|
|
839 |
TBool dataOk = ETrue;
|
|
840 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSelectDecoder"));
|
|
841 |
if ( !(GetHexFromConfig(aSection, KDecoder(), decoder)))
|
|
842 |
{
|
|
843 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDecoder());
|
|
844 |
SetBlockResult(EFail);
|
|
845 |
dataOk = EFalse;
|
|
846 |
}
|
|
847 |
if(dataOk)
|
|
848 |
{
|
|
849 |
iSelectDecoder=TUid::Uid(decoder);
|
|
850 |
TRAPD(err, iDecHWDevId = iDevvp->SelectDecoderL(iSelectDecoder));
|
|
851 |
if (err != KErrNone)
|
|
852 |
{
|
|
853 |
ERR_PRINTF2(_L("SelectDecoderL left with error: %d"), err);
|
|
854 |
SetError(err);
|
|
855 |
}
|
|
856 |
}
|
|
857 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSelectDecoder"));
|
|
858 |
}
|
|
859 |
|
|
860 |
/**
|
|
861 |
* Gets the postprocessores list and Select a PostProcessor
|
|
862 |
* @param aSection - Section to read from the ini file
|
|
863 |
* @return none
|
|
864 |
*/
|
|
865 |
void CT_CMMFDevVideoPlay::DoCmdSelectPostProcessorL(const TTEFSectionName& aSection)
|
|
866 |
{
|
|
867 |
TInt postPro;
|
|
868 |
TBool dataOk = ETrue;
|
|
869 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSelectPostProcessor"));
|
|
870 |
if ( !(GetHexFromConfig(aSection, KPostPro(), postPro)))
|
|
871 |
{
|
|
872 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDecoder());
|
|
873 |
SetBlockResult(EFail);
|
|
874 |
dataOk = EFalse;
|
|
875 |
}
|
|
876 |
if(dataOk)
|
|
877 |
{
|
|
878 |
iSelectPostProcessor=TUid::Uid(postPro);
|
|
879 |
TRAPD(err, iPostProcId = iDevvp->SelectPostProcessorL(iSelectPostProcessor));
|
|
880 |
if (err != KErrNone)
|
|
881 |
{
|
|
882 |
ERR_PRINTF2(_L("SelectPostProcessorL left with error %d"), err);
|
|
883 |
SetError(err);
|
|
884 |
}
|
|
885 |
}
|
|
886 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSelectPostProcessor"));
|
|
887 |
}
|
|
888 |
|
|
889 |
/**
|
|
890 |
* Sets the input format for the decoder and the postprocessor
|
|
891 |
* @param aSection - Section to read from the ini file
|
|
892 |
* @return none
|
|
893 |
*/
|
|
894 |
void CT_CMMFDevVideoPlay::DoCmdSetInputFormatL(const TTEFSectionName& aSection)
|
|
895 |
{
|
|
896 |
TBuf8<50> mimetype;
|
|
897 |
TBool useDecoder = ETrue;
|
|
898 |
TInt tVideoDataUnitType = EDuCodedPicture;
|
|
899 |
TInt tVideoDataUnitEncapsulation = EDuElementaryStream;
|
|
900 |
TBool dataInOrder=ETrue;
|
|
901 |
TPtrC mimeType;
|
|
902 |
TBool dataOk = ETrue;
|
|
903 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetInputFormat"));
|
|
904 |
if(!GetStringFromConfig(aSection, KMimeType(), mimeType))
|
|
905 |
{
|
|
906 |
ERR_PRINTF1(_L("Mime type not retrieved, command will not be executed"));
|
|
907 |
SetBlockResult(EFail);
|
|
908 |
dataOk = EFalse;
|
|
909 |
}
|
|
910 |
if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
|
|
911 |
{
|
|
912 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
|
|
913 |
SetBlockResult(EFail);
|
|
914 |
dataOk = EFalse;
|
|
915 |
}
|
|
916 |
|
|
917 |
if( !(GetBoolFromConfig(aSection, KDataInOrder(), dataInOrder)))
|
|
918 |
{
|
|
919 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KDataInOrder());
|
|
920 |
}
|
|
921 |
if(! (GetEnumFromConfig(aSection, KTVideoDataUnitType(), iTVideoDataUnitType,tVideoDataUnitType)))
|
|
922 |
{
|
|
923 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KTVideoDataUnitType());
|
|
924 |
}
|
|
925 |
if( !(GetEnumFromConfig(aSection, KTVideoDataUnitEncapsulation(), iTVideoDataUnitEncapsulation,tVideoDataUnitEncapsulation)))
|
|
926 |
{
|
|
927 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KTVideoDataUnitEncapsulation());
|
|
928 |
}
|
|
929 |
if(dataOk)
|
|
930 |
{
|
|
931 |
mimetype.Append(mimeType);
|
|
932 |
if ( useDecoder) //Decoder
|
|
933 |
{
|
|
934 |
CCompressedVideoFormat* compressedFormat=NULL;
|
|
935 |
TRAPD(error, compressedFormat = CCompressedVideoFormat::NewL (mimetype));
|
|
936 |
if (error != KErrNone)
|
|
937 |
{
|
|
938 |
ERR_PRINTF2(_L("Error in CCompressedVideoFormat::NewL: %d"), error);
|
|
939 |
SetError (error);
|
|
940 |
}
|
|
941 |
else
|
|
942 |
{
|
|
943 |
CleanupStack::PushL (compressedFormat);
|
|
944 |
TRAP(error,
|
|
945 |
iDevvp->SetInputFormatL(iDecHWDevId, *compressedFormat,
|
|
946 |
(TVideoDataUnitType)tVideoDataUnitType,
|
|
947 |
(TVideoDataUnitEncapsulation)tVideoDataUnitEncapsulation,
|
|
948 |
dataInOrder));
|
|
949 |
CleanupStack::PopAndDestroy (compressedFormat);
|
|
950 |
if ( error != KErrNone)
|
|
951 |
{
|
|
952 |
ERR_PRINTF2(_L("Error in SetInputFormatL for decoder: %d"), error);
|
|
953 |
SetError (error);
|
|
954 |
}
|
|
955 |
else
|
|
956 |
{
|
|
957 |
INFO_PRINTF1(_L("SetInputFormatL done!"));
|
|
958 |
}
|
|
959 |
}
|
|
960 |
|
|
961 |
}
|
|
962 |
else // PostProcessor
|
|
963 |
{
|
|
964 |
TRAPD(err, iDevvp->SetInputFormatL(iPostProcId, iCommonFormat));
|
|
965 |
if ( err != KErrNone)
|
|
966 |
{
|
|
967 |
ERR_PRINTF2(_L("Error in SetInputFormatL for PostProcessor: %d"), err);
|
|
968 |
SetError (err);
|
|
969 |
}
|
|
970 |
}
|
|
971 |
}
|
|
972 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetInputFormat"));
|
|
973 |
}
|
|
974 |
|
|
975 |
/**
|
|
976 |
* Gets the output format list from the decoder and the postprocessor
|
|
977 |
* @param aSection - The section to read from the ini file
|
|
978 |
* @return none
|
|
979 |
*/
|
|
980 |
void CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL(const TTEFSectionName& aSection)
|
|
981 |
{
|
|
982 |
TBool useDecoder = ETrue; //ETrue - Decoder , EFalse - PostProcessor
|
|
983 |
TBool dataOk = ETrue;
|
|
984 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL"));
|
|
985 |
if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
|
|
986 |
{
|
|
987 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
|
|
988 |
SetBlockResult(EFail);
|
|
989 |
dataOk = EFalse;
|
|
990 |
}
|
|
991 |
if(dataOk)
|
|
992 |
{
|
|
993 |
if ( useDecoder) //Decoder
|
|
994 |
{
|
|
995 |
TRAPD(err, iDevvp->GetOutputFormatListL(iDecHWDevId, iDecFormats));
|
|
996 |
if ( err != KErrNone)
|
|
997 |
{
|
|
998 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL failed with error %d"), err);
|
|
999 |
SetError (err);
|
|
1000 |
}
|
|
1001 |
}
|
|
1002 |
else //PostProcessor
|
|
1003 |
{
|
|
1004 |
TRAPD(err1, iDevvp->GetOutputFormatListL(iPostProcId, iPPFormats));
|
|
1005 |
if ( err1 != KErrNone)
|
|
1006 |
{
|
|
1007 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL left with error %d"), err1);
|
|
1008 |
SetError (err1);
|
|
1009 |
}
|
|
1010 |
}
|
|
1011 |
}
|
|
1012 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL"));
|
|
1013 |
}
|
|
1014 |
|
|
1015 |
/**
|
|
1016 |
* Gets the postprocessor info.
|
|
1017 |
*/
|
|
1018 |
void CT_CMMFDevVideoPlay::DoCmdPostProcessorInfoLC()
|
|
1019 |
{
|
|
1020 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdPostProcessorInfo"));
|
|
1021 |
delete iInfo;
|
|
1022 |
iInfo=NULL;
|
|
1023 |
TRAPD(err, {iInfo = iDevvp->PostProcessorInfoLC(iSelectPostProcessor); CleanupStack::Pop(iInfo);} );
|
|
1024 |
if ( err!=KErrNone )
|
|
1025 |
{
|
|
1026 |
ERR_PRINTF2(_L("PostProcessorInfoLC failed with error %i"),err);
|
|
1027 |
}
|
|
1028 |
else
|
|
1029 |
{
|
|
1030 |
iPPFormats = iInfo->SupportedFormats();
|
|
1031 |
}
|
|
1032 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdPostProcessorInfo"));
|
|
1033 |
}
|
|
1034 |
|
|
1035 |
/**
|
|
1036 |
* Find common format for dec output and postproc input.
|
|
1037 |
* Precondition: The command GetOutputList has to be called before, for the Decoder and the postprocessor,
|
|
1038 |
* because in this method we use both list to find the common format.
|
|
1039 |
*/
|
|
1040 |
void CT_CMMFDevVideoPlay::DoCmdFindCommonFormat()
|
|
1041 |
{
|
|
1042 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdFindCommonFormat"));
|
|
1043 |
if ( iDevvp->FindCommonFormat (iDecFormats.Array (), iPPFormats.Array (), iCommonFormat) )
|
|
1044 |
{
|
|
1045 |
INFO_PRINTF1(_L("DoCmdFindCommonFormat found common Format!"));
|
|
1046 |
}
|
|
1047 |
else
|
|
1048 |
{
|
|
1049 |
iCommonFormat = iDecFormats[0];
|
|
1050 |
ERR_PRINTF1(_L("Error in CT_CMMFDevVideoPlay::DoCmdFindCommonFormat: Common Format not found."));
|
|
1051 |
SetBlockResult(EFail);
|
|
1052 |
}
|
|
1053 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdFindCommonFormat"));
|
|
1054 |
}
|
|
1055 |
|
|
1056 |
/**
|
|
1057 |
* Sets the output format for both the decoder and the postprocessor.
|
|
1058 |
* @param aSection - The section to read from the ini file
|
|
1059 |
* @return none
|
|
1060 |
*/
|
|
1061 |
void CT_CMMFDevVideoPlay::DoCmdSetOutputFormatL(const TTEFSectionName& aSection)
|
|
1062 |
{
|
|
1063 |
TBool useDecoder = ETrue;
|
|
1064 |
TBool dataOk = ETrue;
|
|
1065 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetOutputFormat"));
|
|
1066 |
if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
|
|
1067 |
{
|
|
1068 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
|
|
1069 |
SetBlockResult(EFail);
|
|
1070 |
dataOk = EFalse;
|
|
1071 |
}
|
|
1072 |
if(dataOk)
|
|
1073 |
{
|
|
1074 |
if ( useDecoder)
|
|
1075 |
{ //Decoder
|
|
1076 |
TRAPD(error, iDevvp->SetOutputFormatL (iDecHWDevId, iCommonFormat));
|
|
1077 |
if(error != KErrNone)
|
|
1078 |
{
|
|
1079 |
ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
|
|
1080 |
SetError(error);
|
|
1081 |
}
|
|
1082 |
}
|
|
1083 |
else
|
|
1084 |
{ //PostProcessor
|
|
1085 |
if ( iDirectScreenAccess)
|
|
1086 |
{
|
|
1087 |
//Set Output Fomat
|
|
1088 |
TUncompressedVideoFormat outFormat;
|
|
1089 |
outFormat.iDataFormat = ERgbRawData;
|
|
1090 |
outFormat.iRgbFormat = ERgb32bit888; //RGB format for display
|
|
1091 |
TRAPD(error, iDevvp->SetOutputFormatL (iPostProcId, outFormat));
|
|
1092 |
if(error != KErrNone)
|
|
1093 |
{
|
|
1094 |
ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
|
|
1095 |
SetError(error);
|
|
1096 |
}
|
|
1097 |
|
|
1098 |
}
|
|
1099 |
else // Memory buffer output
|
|
1100 |
{
|
|
1101 |
TRAPD(error, iDevvp->SetOutputFormatL (iPostProcId, iCommonFormat));
|
|
1102 |
if(error != KErrNone)
|
|
1103 |
{
|
|
1104 |
ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
|
|
1105 |
SetError(error);
|
|
1106 |
}
|
|
1107 |
}
|
|
1108 |
}
|
|
1109 |
}
|
|
1110 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetOutputFormat"));
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
|
|
1114 |
/**
|
|
1115 |
* Gets the header information.
|
|
1116 |
* @param aSection - The section to read from the ini file
|
|
1117 |
* @return none
|
|
1118 |
*/
|
|
1119 |
void CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL(const TTEFSectionName& aSection)
|
|
1120 |
{
|
|
1121 |
TInt bufSize = 0;
|
|
1122 |
TBool dataOk = ETrue;
|
|
1123 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL"));
|
|
1124 |
if ( !(GetIntFromConfig(aSection, KBuf(), bufSize)))
|
|
1125 |
{
|
|
1126 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBuf());
|
|
1127 |
SetBlockResult(EFail);
|
|
1128 |
dataOk = EFalse;
|
|
1129 |
}
|
|
1130 |
if(dataOk)
|
|
1131 |
{
|
|
1132 |
INFO_PRINTF1(_L("GetHeaderInformationL init..!"));
|
|
1133 |
TInt err = KErrNone;
|
|
1134 |
iHeaderInfo = NULL;
|
|
1135 |
HBufC8* tempBuff= NULL;
|
|
1136 |
//Read Picture header : Size is not known
|
|
1137 |
TVideoInputBuffer* codedBuffer = new(ELeave) TVideoInputBuffer;
|
|
1138 |
CleanupStack::PushL ( codedBuffer);
|
|
1139 |
if ( iFrameListed) //frame size known
|
|
1140 |
{
|
|
1141 |
tempBuff = HBufC8::NewLC(iInBuffSize);
|
|
1142 |
codedBuffer->iData.Set (tempBuff->Des ());
|
|
1143 |
if(iFrameSizeList.Count() > 0)
|
|
1144 |
{
|
|
1145 |
err = ReadOneCodedPicture (codedBuffer, iFrameSizeList[0]);
|
|
1146 |
}
|
|
1147 |
else
|
|
1148 |
{
|
|
1149 |
err = KErrGeneral;
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
TInt pos =0;
|
|
1153 |
if ( iInFile.Seek (ESeekStart, pos))
|
|
1154 |
{
|
|
1155 |
err = KErrGeneral;
|
|
1156 |
}
|
|
1157 |
if ( err < 0)
|
|
1158 |
{
|
|
1159 |
CleanupStack::PopAndDestroy (tempBuff);
|
|
1160 |
}
|
|
1161 |
}
|
|
1162 |
else //frame size not known
|
|
1163 |
{
|
|
1164 |
iInBuffSize = KH263MaxCodedSizeQCIF;
|
|
1165 |
err = KErrOverflow;
|
|
1166 |
while ( (err == KErrOverflow) && (iInBuffSize <= KMP4MaxCodedSizeVGA))
|
|
1167 |
{
|
|
1168 |
tempBuff = HBufC8::NewLC(iInBuffSize);
|
|
1169 |
codedBuffer->iData.Set (tempBuff->Des ());
|
|
1170 |
err = ReadOneCodedPicture (codedBuffer);
|
|
1171 |
TInt pos =0;
|
|
1172 |
if ( iInFile.Seek (ESeekStart, pos))
|
|
1173 |
{
|
|
1174 |
err = KErrGeneral;
|
|
1175 |
}
|
|
1176 |
if ( iInputEnd)
|
|
1177 |
{
|
|
1178 |
err = KErrNotFound;
|
|
1179 |
}
|
|
1180 |
if ( err < 0)
|
|
1181 |
{
|
|
1182 |
CleanupStack::PopAndDestroy (tempBuff);
|
|
1183 |
iInBuffSize = 4*iInBuffSize;
|
|
1184 |
}
|
|
1185 |
}
|
|
1186 |
}
|
|
1187 |
// Reitrieve header information from bitstream
|
|
1188 |
if ( err < 0)
|
|
1189 |
{
|
|
1190 |
CleanupStack::PopAndDestroy (codedBuffer);
|
|
1191 |
}
|
|
1192 |
else
|
|
1193 |
{
|
|
1194 |
TRAPD(error, iHeaderInfo = iDevvp->GetHeaderInformationL(EDuCodedPicture, EDuElementaryStream,codedBuffer));
|
|
1195 |
CleanupStack::PopAndDestroy (tempBuff);
|
|
1196 |
CleanupStack::PopAndDestroy (codedBuffer);
|
|
1197 |
if ( error != KErrNone)
|
|
1198 |
{
|
|
1199 |
ERR_PRINTF2(_L("Error in DoCmdGetHeaderInformationL: %d"), error);
|
|
1200 |
SetError(error);
|
|
1201 |
}
|
|
1202 |
else
|
|
1203 |
{
|
|
1204 |
//Check Header info
|
|
1205 |
if ( iHeaderInfo)
|
|
1206 |
{
|
|
1207 |
//Size in Memory
|
|
1208 |
iPictureSize = iHeaderInfo->iDisplayedRect.Size ();
|
|
1209 |
// Display rect
|
|
1210 |
TSize dispsize = iHeaderInfo->iDisplayedRect.Size ();
|
|
1211 |
iDispRect.SetSize (dispsize);
|
|
1212 |
INFO_PRINTF3(_L("Size from Header, Height: %d Width: %d"),dispsize.iHeight,
|
|
1213 |
dispsize.iWidth);
|
|
1214 |
INFO_PRINTF3(_L("Size from iPictureSize, Height: %d Width: %d"),iPictureSize.iHeight,
|
|
1215 |
iPictureSize.iWidth);
|
|
1216 |
}
|
|
1217 |
// Set size of decoder input buffer
|
|
1218 |
if ( !iFrameListed)
|
|
1219 |
{
|
|
1220 |
iInBuffSize = bufSize;
|
|
1221 |
}
|
|
1222 |
}
|
|
1223 |
}
|
|
1224 |
}
|
|
1225 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL"));
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
/**
|
|
1229 |
* Returns the HeaderInformation of the video
|
|
1230 |
*/
|
|
1231 |
void CT_CMMFDevVideoPlay::DoCmdReturnHeader()
|
|
1232 |
{
|
|
1233 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdReturnHeader"));
|
|
1234 |
if (iHeaderInfo)
|
|
1235 |
{
|
|
1236 |
iDevvp->ReturnHeader(iHeaderInfo);
|
|
1237 |
}
|
|
1238 |
else
|
|
1239 |
{
|
|
1240 |
ERR_PRINTF1(_L("Error in DoCmdReturnHeader!"));
|
|
1241 |
SetBlockResult(EFail);
|
|
1242 |
}
|
|
1243 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdReturnHeader"));
|
|
1244 |
}
|
|
1245 |
|
|
1246 |
/**
|
|
1247 |
* Sets output on screen or memory buffer
|
|
1248 |
*/
|
|
1249 |
void CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL()
|
|
1250 |
{
|
|
1251 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL"));
|
|
1252 |
TRAPD(err, iDevvp->SetVideoDestScreenL(iDirectScreenAccess));
|
|
1253 |
if (err != KErrNone)
|
|
1254 |
{
|
|
1255 |
ERR_PRINTF2(_L("Error in DoCmdSetVideoDestScreenL: %d"), err);
|
|
1256 |
SetError(err);
|
|
1257 |
}
|
|
1258 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL"));
|
|
1259 |
}
|
|
1260 |
|
|
1261 |
/**
|
|
1262 |
* Gets the buffer options.
|
|
1263 |
*/
|
|
1264 |
void CT_CMMFDevVideoPlay::DoCmdGetBufferOptions()
|
|
1265 |
{
|
|
1266 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetBufferOptions"));
|
|
1267 |
iDevvp->GetBufferOptions(iBufferOptions);
|
|
1268 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetBufferOptions"));
|
|
1269 |
}
|
|
1270 |
|
|
1271 |
/**
|
|
1272 |
* Sets the buffer options for the DevVideoPlay
|
|
1273 |
*/
|
|
1274 |
void CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL()
|
|
1275 |
{
|
|
1276 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL"));
|
|
1277 |
iBufferOptions.iMaxInputBufferSize = iInBuffSize;
|
|
1278 |
//iBufferOptions.iMaxPostDecodeBufferSize = 0;
|
|
1279 |
iBufferOptions.iPreDecodeBufferSize = 0;
|
|
1280 |
iBufferOptions.iMinNumInputBuffers = KNumOfInputBuffers;
|
|
1281 |
TRAPD(err, iDevvp->SetBufferOptionsL(iBufferOptions));
|
|
1282 |
if ( err != KErrNone)
|
|
1283 |
{
|
|
1284 |
ERR_PRINTF2(_L("Error in DoCmdSetBufferOptionsL: %d"), err);
|
|
1285 |
SetError (err);
|
|
1286 |
}
|
|
1287 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL"));
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
/**
|
|
1291 |
* Sets the options for the postprocessor
|
|
1292 |
*/
|
|
1293 |
void CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL(const TTEFSectionName& aSection)
|
|
1294 |
{
|
|
1295 |
TInt combination = 0;
|
|
1296 |
TBool dataOk = ETrue;
|
|
1297 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL"));
|
|
1298 |
if ( ! (GetHexFromConfig(aSection, KCombination(), combination)) )
|
|
1299 |
{
|
|
1300 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCombination());
|
|
1301 |
SetBlockResult(EFail);
|
|
1302 |
dataOk = EFalse;
|
|
1303 |
}
|
|
1304 |
if(dataOk)
|
|
1305 |
{
|
|
1306 |
TRAPD(err,iDevvp->SetPostProcessTypesL(iPostProcId, combination));
|
|
1307 |
if( err!=KErrNone )
|
|
1308 |
{
|
|
1309 |
ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL left with error %d"), err);
|
|
1310 |
SetError(err);
|
|
1311 |
}
|
|
1312 |
}
|
|
1313 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL"));
|
|
1314 |
}
|
|
1315 |
|
|
1316 |
/**
|
|
1317 |
* Initialize the decoder with the specified parameters.
|
|
1318 |
* @return - KErrNone if no error
|
|
1319 |
*/
|
|
1320 |
void CT_CMMFDevVideoPlay::DoCmdInitialize(const TInt aAsyncErrorIndex)
|
|
1321 |
{
|
|
1322 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdInitialize"));
|
|
1323 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
|
1324 |
iDevvp->Initialize();
|
|
1325 |
IncOutstanding();
|
|
1326 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdInitialize"));
|
|
1327 |
}
|
|
1328 |
|
|
1329 |
/**
|
|
1330 |
* Starts video decoding directly to the display frame buffer using Direct Screen Access. Playback to the display can start immediately.
|
|
1331 |
*
|
|
1332 |
* @return None
|
|
1333 |
*/
|
|
1334 |
void CT_CMMFDevVideoPlay::DoCmdStart(const TInt aAsyncErrorIndex)
|
|
1335 |
{
|
|
1336 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStart"));
|
|
1337 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
|
1338 |
// Start DevVideoPlay
|
|
1339 |
INFO_PRINTF1(_L("Start Decoding Engine.."));
|
|
1340 |
iDevvp->Start();
|
|
1341 |
//Reset Clock at Stream Start
|
|
1342 |
if ( iSynchronized )
|
|
1343 |
{
|
|
1344 |
TTimeIntervalMicroSeconds offset(KStartOffset);
|
|
1345 |
iClock->Reset(offset);
|
|
1346 |
}
|
|
1347 |
INFO_PRINTF1(_L("Start Data transfer."));
|
|
1348 |
TRAPD(err, HandleNewBufferL());
|
|
1349 |
if (err != KErrNone)
|
|
1350 |
{
|
|
1351 |
ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err);
|
|
1352 |
SetError(err);
|
|
1353 |
}
|
|
1354 |
else
|
|
1355 |
{
|
|
1356 |
if(!iErrorInputBuffer)
|
|
1357 |
{
|
|
1358 |
IncOutstanding();
|
|
1359 |
INFO_PRINTF1(_L("Start..done!"));
|
|
1360 |
INFO_PRINTF2(_L("iFrameSizeList.Count %d"),iFrameSizeList.Count());
|
|
1361 |
}
|
|
1362 |
}
|
|
1363 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStart"));
|
|
1364 |
}
|
|
1365 |
|
|
1366 |
/**
|
|
1367 |
* Stops the playback
|
|
1368 |
* @param aSection - The section to read from the ini file
|
|
1369 |
* @return none
|
|
1370 |
*/
|
|
1371 |
void CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL(const TTEFSectionName& aSection)
|
|
1372 |
{
|
|
1373 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL"));
|
|
1374 |
if ( !iScreenDevice)
|
|
1375 |
{
|
|
1376 |
delete iScreenDevice;
|
|
1377 |
iScreenDevice = NULL;
|
|
1378 |
RFbsSession::Disconnect();
|
|
1379 |
TDisplayMode displayMode; //0 - Decoder , 1 - PostProcessor
|
|
1380 |
TInt value = 0;
|
|
1381 |
if ( !(GetEnumFromConfig(aSection, KDisplayMode(), iDisplayModes, value)))
|
|
1382 |
{
|
|
1383 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDisplayMode());
|
|
1384 |
SetBlockResult(EFail);
|
|
1385 |
}
|
|
1386 |
displayMode = (TDisplayMode)value;
|
|
1387 |
User::LeaveIfError (RFbsSession::Connect());
|
|
1388 |
|
|
1389 |
TRAPD(error, iScreenDevice = CFbsScreenDevice::NewL (KScreenNumber, displayMode));
|
|
1390 |
if(error != KErrNone)
|
|
1391 |
{
|
|
1392 |
ERR_PRINTF2(_L("Error creating screen device"),error);
|
|
1393 |
SetError(error);
|
|
1394 |
}
|
|
1395 |
}
|
|
1396 |
|
|
1397 |
if ( iDispRect.iBr.iY > KQVGAHeight)
|
|
1398 |
{
|
|
1399 |
iDispRect.iTl.iY = 0;
|
|
1400 |
iDispRect.SetHeight (KQVGAHeight);
|
|
1401 |
}
|
|
1402 |
if ( iDispRect.iBr.iX > KQVGAWidth)
|
|
1403 |
{
|
|
1404 |
iDispRect.iTl.iX = 0;
|
|
1405 |
iDispRect.SetWidth (KQVGAWidth);
|
|
1406 |
}
|
|
1407 |
|
|
1408 |
TRegionFix<1> region(iDispRect);
|
|
1409 |
//Start DSA
|
|
1410 |
|
|
1411 |
INFO_PRINTF2(_L("Size window Y: %d"),iDispRect.Height());
|
|
1412 |
INFO_PRINTF2(_L("Size window X: %d"),iDispRect.Width());
|
|
1413 |
|
|
1414 |
TRAPD(error,iDevvp->StartDirectScreenAccessL(iDispRect, *iScreenDevice, region));
|
|
1415 |
if ( error != KErrNone)
|
|
1416 |
{
|
|
1417 |
ERR_PRINTF2(_L("StartDirectScreenAccessL error: %d"),error);
|
|
1418 |
SetError(error);
|
|
1419 |
}
|
|
1420 |
else
|
|
1421 |
{
|
|
1422 |
iDsaStarted = ETrue;
|
|
1423 |
}
|
|
1424 |
|
|
1425 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL"));
|
|
1426 |
}
|
|
1427 |
|
|
1428 |
/**
|
|
1429 |
* Stop Devvideoplay
|
|
1430 |
*/
|
|
1431 |
void CT_CMMFDevVideoPlay::DoCmdStop()
|
|
1432 |
{
|
|
1433 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStop"));
|
|
1434 |
iDevvp->Stop ();
|
|
1435 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStop"));
|
|
1436 |
}
|
|
1437 |
|
|
1438 |
/**
|
|
1439 |
* Aborts Direct Screen Access completely
|
|
1440 |
* @return None
|
|
1441 |
*/
|
|
1442 |
void CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess()
|
|
1443 |
{
|
|
1444 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess"));
|
|
1445 |
if ( iDirectScreenAccess && iDsaStarted)
|
|
1446 |
{
|
|
1447 |
iDevvp->AbortDirectScreenAccess ();
|
|
1448 |
INFO_PRINTF1(_L("Abort Direct Screen Access Done"));
|
|
1449 |
iDsaStarted = EFalse;
|
|
1450 |
}
|
|
1451 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess"));
|
|
1452 |
}
|
|
1453 |
|
|
1454 |
/**
|
|
1455 |
* Pause the decoding process
|
|
1456 |
*/
|
|
1457 |
void CT_CMMFDevVideoPlay::DoCmdPause()
|
|
1458 |
{
|
|
1459 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdPause"));
|
|
1460 |
if ( iSynchronized)
|
|
1461 |
{
|
|
1462 |
iClock->Suspend (); //Stop Clock source
|
|
1463 |
}
|
|
1464 |
iDevvp->Pause();
|
|
1465 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdPause"));
|
|
1466 |
}
|
|
1467 |
|
|
1468 |
/**
|
|
1469 |
* Resume the decodind process
|
|
1470 |
*/
|
|
1471 |
void CT_CMMFDevVideoPlay::DoCmdResume()
|
|
1472 |
{
|
|
1473 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdResume"));
|
|
1474 |
if ( iSynchronized)
|
|
1475 |
{
|
|
1476 |
iClock->Resume (); //Restart Clock source
|
|
1477 |
}
|
|
1478 |
iDevvp->Resume ();
|
|
1479 |
if ( iDecHWDevId)
|
|
1480 |
{
|
|
1481 |
if ( iDevvp->NumFreeBuffers () > 0 )
|
|
1482 |
{
|
|
1483 |
INFO_PRINTF1(_L("Restart data transfer."));
|
|
1484 |
TRAPD(err1, HandleNewBufferL());
|
|
1485 |
if (err1 != KErrNone)
|
|
1486 |
{
|
|
1487 |
ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err1);
|
|
1488 |
SetError(err1);
|
|
1489 |
return;
|
|
1490 |
}
|
|
1491 |
}
|
|
1492 |
}
|
|
1493 |
|
|
1494 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdResume"));
|
|
1495 |
}
|
|
1496 |
|
|
1497 |
/**
|
|
1498 |
* Rotating the display
|
|
1499 |
* @param aSection - The section to read from the ini file
|
|
1500 |
* @return none
|
|
1501 |
*/
|
|
1502 |
void CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL(const TTEFSectionName& aSection)
|
|
1503 |
{
|
|
1504 |
TRotationType rotation;
|
|
1505 |
TInt rotItem;
|
|
1506 |
TBool dataOk = ETrue;
|
|
1507 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL"));
|
|
1508 |
if ( !( GetEnumFromConfig(aSection, KRotation(), iRotations, rotItem)))
|
|
1509 |
{
|
|
1510 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KRotation());
|
|
1511 |
SetBlockResult(EFail);
|
|
1512 |
dataOk = EFalse;
|
|
1513 |
}
|
|
1514 |
if(dataOk)
|
|
1515 |
{
|
|
1516 |
rotation = (TRotationType)rotItem;
|
|
1517 |
TRAPD(error,iDevvp->SetRotateOptionsL(iPostProcId, rotation));
|
|
1518 |
if ( error != KErrNone)
|
|
1519 |
{
|
|
1520 |
ERR_PRINTF2(_L("DoCmdSetRotateOptionsL! Error = %d"),error);
|
|
1521 |
SetError (error);
|
|
1522 |
}
|
|
1523 |
}
|
|
1524 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL"));
|
|
1525 |
}
|
|
1526 |
|
|
1527 |
/**
|
|
1528 |
* Setting the screen options
|
|
1529 |
* @param aSection - The section to read from the ini file
|
|
1530 |
* @return none
|
|
1531 |
*/
|
|
1532 |
void CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL(const TTEFSectionName& aSection)
|
|
1533 |
{
|
|
1534 |
TInt width;
|
|
1535 |
TInt height;
|
|
1536 |
TInt x,y;
|
|
1537 |
TBool antiAliasFiltering = ETrue;
|
|
1538 |
TBool dataOk = ETrue;
|
|
1539 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL"));
|
|
1540 |
if ( !(GetIntFromConfig(aSection, Kx(), x)) )
|
|
1541 |
{
|
|
1542 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &Kx());
|
|
1543 |
SetBlockResult(EFail);
|
|
1544 |
dataOk = EFalse;
|
|
1545 |
}
|
|
1546 |
if ( !(GetIntFromConfig(aSection, Ky(), y)) )
|
|
1547 |
{
|
|
1548 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &Ky());
|
|
1549 |
SetBlockResult(EFail);
|
|
1550 |
dataOk = EFalse;
|
|
1551 |
}
|
|
1552 |
if ( !(GetIntFromConfig(aSection, KWidth(), width)) )
|
|
1553 |
{
|
|
1554 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
|
|
1555 |
SetBlockResult(EFail);
|
|
1556 |
dataOk = EFalse;
|
|
1557 |
}
|
|
1558 |
if ( !(GetIntFromConfig(aSection, KHeight(), height)) )
|
|
1559 |
{
|
|
1560 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
|
|
1561 |
SetBlockResult(EFail);
|
|
1562 |
dataOk = EFalse;
|
|
1563 |
}
|
|
1564 |
GetBoolFromConfig(aSection, KAntiAliasFiltering(),antiAliasFiltering);
|
|
1565 |
if(dataOk)
|
|
1566 |
{
|
|
1567 |
TSize size(width, height);
|
|
1568 |
TRAPD(error, SetWindowRect(x, y,size));
|
|
1569 |
if ( error != KErrNone)
|
|
1570 |
{
|
|
1571 |
ERR_PRINTF2(_L("SetWindowRect! left with Error = %d"),error);
|
|
1572 |
SetBlockResult (EFail);
|
|
1573 |
}
|
|
1574 |
|
|
1575 |
TRAP(error, iDevvp->SetScaleOptionsL(iPostProcId, size, antiAliasFiltering));
|
|
1576 |
if ( error != KErrNone)
|
|
1577 |
{
|
|
1578 |
ERR_PRINTF2(_L("SetScaleOptionsL! left with Error = %d"),error);
|
|
1579 |
SetError (error);
|
|
1580 |
}
|
|
1581 |
}
|
|
1582 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL"));
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
/**
|
|
1586 |
* Sets the new position for playback and decoding. It is use for forward and backward
|
|
1587 |
*/
|
|
1588 |
void CT_CMMFDevVideoPlay::DoCmdSetPosition(const TTEFSectionName& aSection)
|
|
1589 |
{
|
|
1590 |
TInt pos;
|
|
1591 |
Int64 time = 0;
|
|
1592 |
TBool dataOk = ETrue;
|
|
1593 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetPosition"));
|
|
1594 |
if ( !(GetIntFromConfig(aSection, KPos(), pos)) ) //This parameter indicates seconds to move forward/backward from the current position
|
|
1595 |
{
|
|
1596 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPos());
|
|
1597 |
SetBlockResult(EFail);
|
|
1598 |
dataOk = EFalse;
|
|
1599 |
}
|
|
1600 |
if(dataOk)
|
|
1601 |
{
|
|
1602 |
pos = pos*iFramerate;
|
|
1603 |
INFO_PRINTF2(_L("pos %i"),pos);
|
|
1604 |
if((pos > iFrameSizeList.Count()) || ((pos+iSentBuffCount) < 0))
|
|
1605 |
{
|
|
1606 |
ERR_PRINTF2(_L("Invalid value, check %S from INI file"), &KPos());
|
|
1607 |
//SetBlockResult(EFail);
|
|
1608 |
}
|
|
1609 |
else
|
|
1610 |
{
|
|
1611 |
iSentBuffCount +=pos;
|
|
1612 |
TTimeIntervalMicroSeconds timeStamp;
|
|
1613 |
if ( iSynchronized )
|
|
1614 |
{
|
|
1615 |
timeStamp = (TTimeIntervalMicroSeconds)(iSentBuffCount*iFrameTimeInterval);
|
|
1616 |
time = timeStamp.Int64();
|
|
1617 |
iClock->Reset(timeStamp);
|
|
1618 |
iTimeStamp = time;
|
|
1619 |
}
|
|
1620 |
else
|
|
1621 |
{
|
|
1622 |
timeStamp = (TTimeIntervalMicroSeconds)(iSentBuffCount);
|
|
1623 |
}
|
|
1624 |
|
|
1625 |
iDevvp->SetPosition(timeStamp);
|
|
1626 |
|
|
1627 |
TInt temp=0;
|
|
1628 |
for(TInt i=0; i < iSentBuffCount; i++)
|
|
1629 |
{
|
|
1630 |
temp += iFrameSizeList[i];
|
|
1631 |
}
|
|
1632 |
TInt error = KErrNone;
|
|
1633 |
error = iInFile.Seek(ESeekStart,temp);
|
|
1634 |
if (error != KErrNone)
|
|
1635 |
{
|
|
1636 |
ERR_PRINTF2(_L("Error Seeking in file, check ini for parameter POS: %d"),error);
|
|
1637 |
SetBlockResult(EFail);
|
|
1638 |
}
|
|
1639 |
}
|
|
1640 |
}
|
|
1641 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetPosition"));
|
|
1642 |
}
|
|
1643 |
|
|
1644 |
/**
|
|
1645 |
* Utility command to get the initial parameters
|
|
1646 |
*/
|
|
1647 |
void CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL()
|
|
1648 |
{
|
|
1649 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL"));
|
|
1650 |
|
|
1651 |
CPostProcessorInfo *infoPost = NULL;
|
|
1652 |
RArray< TUid > postProcessors;
|
|
1653 |
iDevvp->GetPostProcessorListL(postProcessors);
|
|
1654 |
for(TInt i = 0; i< postProcessors.Count(); i++)
|
|
1655 |
{
|
|
1656 |
INFO_PRINTF3(_L("PostProcessors %d = 0x%x"),i,postProcessors[i]);
|
|
1657 |
TRAPD(err,infoPost = iDevvp->PostProcessorInfoLC(postProcessors[i]);CleanupStack::Pop(infoPost));
|
|
1658 |
if(err != KErrNone)
|
|
1659 |
{
|
|
1660 |
ERR_PRINTF1(_L("Error in getting Devvp->PostProcessorInfoLC(postProcessors[i])"));
|
|
1661 |
}
|
|
1662 |
else
|
|
1663 |
{
|
|
1664 |
TBool supported = infoPost->SupportsDirectDisplay();
|
|
1665 |
if (supported)
|
|
1666 |
{
|
|
1667 |
INFO_PRINTF1(_L("Direct Display Supported"));
|
|
1668 |
}
|
|
1669 |
else
|
|
1670 |
{
|
|
1671 |
INFO_PRINTF1(_L("Direct Display Not Supported"));
|
|
1672 |
}
|
|
1673 |
const RArray<TUint32> combinations = infoPost->SupportedCombinations();
|
|
1674 |
for (i = 0; i < combinations.Count(); i++)
|
|
1675 |
{
|
|
1676 |
INFO_PRINTF2(_L("Supported Combination : %d"),combinations[i]);
|
|
1677 |
}
|
|
1678 |
TUint32 test = 0x3040;
|
|
1679 |
if (infoPost->SupportsCombination(test))
|
|
1680 |
{
|
|
1681 |
INFO_PRINTF2(_L("Combination %x is Supported"),test);
|
|
1682 |
}
|
|
1683 |
else
|
|
1684 |
{
|
|
1685 |
INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
|
|
1686 |
}
|
|
1687 |
test = 0x40;//play
|
|
1688 |
if (infoPost->SupportsCombination(test))
|
|
1689 |
{
|
|
1690 |
INFO_PRINTF2(_L("Combination %x is Supported"),test);
|
|
1691 |
}
|
|
1692 |
else
|
|
1693 |
{
|
|
1694 |
INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
|
|
1695 |
}
|
|
1696 |
test = 0x44;//rotation
|
|
1697 |
if (infoPost->SupportsCombination(test))
|
|
1698 |
{
|
|
1699 |
INFO_PRINTF2(_L("Combination %x is Supported"),test);
|
|
1700 |
}
|
|
1701 |
else
|
|
1702 |
{
|
|
1703 |
INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
|
|
1704 |
}
|
|
1705 |
test = 0x48;//scale
|
|
1706 |
if (infoPost->SupportsCombination(test))
|
|
1707 |
{
|
|
1708 |
INFO_PRINTF2(_L("Combination %x is Supported"),test);
|
|
1709 |
}
|
|
1710 |
else
|
|
1711 |
{
|
|
1712 |
INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
|
|
1713 |
}
|
|
1714 |
TUint32 rotations = infoPost->SupportedRotations();
|
|
1715 |
if (rotations == 0)
|
|
1716 |
{
|
|
1717 |
INFO_PRINTF1(_L("Rotation is Not Supported"));
|
|
1718 |
}
|
|
1719 |
else
|
|
1720 |
{
|
|
1721 |
INFO_PRINTF2(_L("Supported rotation : %d"),rotations);
|
|
1722 |
}
|
|
1723 |
supported = infoPost->SupportsArbitraryScaling();
|
|
1724 |
if (supported)
|
|
1725 |
{
|
|
1726 |
INFO_PRINTF1(_L("Arbitrary Scaling is Supported"));
|
|
1727 |
}
|
|
1728 |
else
|
|
1729 |
{
|
|
1730 |
RArray<TScaleFactor> scaleFactors = infoPost->SupportedScaleFactors();
|
|
1731 |
TScaleFactor factor;
|
|
1732 |
for (i = 0; i < scaleFactors.Count(); i++)
|
|
1733 |
{
|
|
1734 |
factor = scaleFactors[i];
|
|
1735 |
INFO_PRINTF3(_L("Scale factor: scale num - %d scale denom - %d"),factor.iScaleNum,factor.iScaleDenom);
|
|
1736 |
}
|
|
1737 |
}
|
|
1738 |
}
|
|
1739 |
|
|
1740 |
}
|
|
1741 |
|
|
1742 |
|
|
1743 |
RArray<TUid> decoders;
|
|
1744 |
iDevvp->GetDecoderListL(decoders);
|
|
1745 |
CVideoDecoderInfo *infDec =NULL;
|
|
1746 |
INFO_PRINTF1(_L("INFORMATION ABOUT DECODERS:"));
|
|
1747 |
for(TInt i = 0; i< decoders.Count(); i++)
|
|
1748 |
{
|
|
1749 |
TRAPD(err, infDec = iDevvp->VideoDecoderInfoLC(decoders[i]);CleanupStack::Pop(infDec));
|
|
1750 |
if(err != KErrNone )
|
|
1751 |
{
|
|
1752 |
ERR_PRINTF1(_L("Error in iDevvp->VideoDecoderInfoLC(decoders[i])"));
|
|
1753 |
}
|
|
1754 |
else
|
|
1755 |
{
|
|
1756 |
INFO_PRINTF6(_L("\nDecoder =0x%x\n Identifier = %S\n Accelerated = %i\n Supports Direct Display: %i\n Manufacturer%S"),
|
|
1757 |
decoders[i].iUid,
|
|
1758 |
&infDec->Identifier(),
|
|
1759 |
infDec->Accelerated(),
|
|
1760 |
infDec->SupportsDirectDisplay(),
|
|
1761 |
&infDec->Manufacturer());
|
|
1762 |
INFO_PRINTF1(_L("SUPPORTED FORMATS:"));
|
|
1763 |
TBuf<255> mime;
|
|
1764 |
const RPointerArray<CCompressedVideoFormat>& outputFormats =infDec->SupportedFormats();
|
|
1765 |
for (TInt j = 0; j < outputFormats.Count(); j++)
|
|
1766 |
{
|
|
1767 |
mime.Copy(outputFormats[j]->MimeType());
|
|
1768 |
INFO_PRINTF3(_L("Supported type %d MIMETYPE: %S"),j,&mime);
|
|
1769 |
}
|
|
1770 |
INFO_PRINTF1(_L("\n\n"));
|
|
1771 |
}
|
|
1772 |
}
|
|
1773 |
|
|
1774 |
TInt colors = 0;
|
|
1775 |
HAL::Get(HALData::EDisplayColors, colors);
|
|
1776 |
INFO_PRINTF2(_L("Display colors : %d"),colors);
|
|
1777 |
INFO_PRINTF1(_L("Display mode!"));
|
|
1778 |
switch(colors)
|
|
1779 |
{
|
|
1780 |
case 0:
|
|
1781 |
INFO_PRINTF1(_L("None"));
|
|
1782 |
break;
|
|
1783 |
case 16777216:
|
|
1784 |
INFO_PRINTF1(_L("EColor16MU"));
|
|
1785 |
break;
|
|
1786 |
case 65536:
|
|
1787 |
INFO_PRINTF1(_L("EColor64K"));
|
|
1788 |
break;
|
|
1789 |
case 4096:
|
|
1790 |
INFO_PRINTF1(_L("EColor4K"));
|
|
1791 |
break;
|
|
1792 |
default:
|
|
1793 |
INFO_PRINTF1(_L("Default mode EColor4K"));
|
|
1794 |
}
|
|
1795 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL"));
|
|
1796 |
}
|
|
1797 |
|
|
1798 |
/**
|
|
1799 |
* Sets the original window for display
|
|
1800 |
*/
|
|
1801 |
void CT_CMMFDevVideoPlay::SetWindowRect(TInt aX, TInt aY, TSize aSize)
|
|
1802 |
{
|
|
1803 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SetWindowRect"));
|
|
1804 |
iDispRect.SetRect(TPoint(aX,aY),aSize);
|
|
1805 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SetWindowRect"));
|
|
1806 |
}
|
|
1807 |
|
|
1808 |
/**
|
|
1809 |
* Read one coded picture into decoder input buffer
|
|
1810 |
*
|
|
1811 |
* @param aCodedInBuffer
|
|
1812 |
*
|
|
1813 |
* @return err
|
|
1814 |
*/
|
|
1815 |
TInt CT_CMMFDevVideoPlay::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer)
|
|
1816 |
{
|
|
1817 |
TInt buffLength = iInBuffSize;
|
|
1818 |
TBool found = EFalse;
|
|
1819 |
TInt pos =0;
|
|
1820 |
TUint8* testData= NULL;
|
|
1821 |
TInt err = KErrNone;
|
|
1822 |
if ( aCodedInBuffer->iData.MaxLength ()< buffLength)
|
|
1823 |
{
|
|
1824 |
err = KErrOverflow;
|
|
1825 |
return err;
|
|
1826 |
}
|
|
1827 |
aCodedInBuffer->iData.SetLength (0);
|
|
1828 |
//Read data from Input File
|
|
1829 |
err = iInFile.Read (aCodedInBuffer->iData, buffLength);
|
|
1830 |
if ( err != KErrNone)
|
|
1831 |
{
|
|
1832 |
return err;
|
|
1833 |
}
|
|
1834 |
//Buffer is not full, reset size of buffer
|
|
1835 |
if ( aCodedInBuffer->iData.Length ()< buffLength)
|
|
1836 |
{
|
|
1837 |
buffLength = aCodedInBuffer->iData.Length ();
|
|
1838 |
}
|
|
1839 |
testData = const_cast<TUint8*>(aCodedInBuffer->iData.Ptr());
|
|
1840 |
//Check the length of one coded picture
|
|
1841 |
if ( (iCodecType == EH263) || ((testData[0] == 0x00) && (testData[1] == 0x00) & ((testData[2] & 0xFC) == 0x80)))
|
|
1842 |
{
|
|
1843 |
if ( (aCodedInBuffer->iData.Length() > 0))
|
|
1844 |
{
|
|
1845 |
pos = KScLength; //skip first 3 byte (PSC)
|
|
1846 |
// Find next PSC
|
|
1847 |
while ( pos < (buffLength - KScLength) && !found)
|
|
1848 |
{
|
|
1849 |
if ( (testData[pos+1] == 0x00) && (testData[pos+2] == 0x00) & ((testData[pos+3] & 0xFC) == 0x80))
|
|
1850 |
{
|
|
1851 |
found = ETrue;
|
|
1852 |
}
|
|
1853 |
pos++;
|
|
1854 |
}
|
|
1855 |
}
|
|
1856 |
else
|
|
1857 |
{
|
|
1858 |
iInputEnd = ETrue;
|
|
1859 |
return err;
|
|
1860 |
}
|
|
1861 |
}
|
|
1862 |
else
|
|
1863 |
if ( iCodecType == EMPEG4)
|
|
1864 |
{
|
|
1865 |
if ( (aCodedInBuffer->iData.Length() > 0))
|
|
1866 |
{
|
|
1867 |
// Check if start code of Visual Object Sequence
|
|
1868 |
pos = 0;
|
|
1869 |
while ( pos < (buffLength - KScLength) && !found)
|
|
1870 |
{ // Find 1st VOP start code in the buffer
|
|
1871 |
if ( (testData[pos] == 0x00) && (testData[pos+1] == 0x00)&& (testData[pos+2] == 0x01) && (testData[pos+3] == 0xB6))
|
|
1872 |
{
|
|
1873 |
while (pos < (buffLength - KScLength-1) && !found)
|
|
1874 |
{
|
|
1875 |
pos++;
|
|
1876 |
// Find 2nd start code in the buffer >> End of a Picture
|
|
1877 |
if ( (testData[pos+1] == 0x00) && (testData[pos+2] == 0x00)&& (testData[pos+3] == 0x01) && (testData[pos+4] != 0xB1))
|
|
1878 |
{
|
|
1879 |
found = ETrue;
|
|
1880 |
}
|
|
1881 |
}
|
|
1882 |
}
|
|
1883 |
pos++;
|
|
1884 |
}
|
|
1885 |
}
|
|
1886 |
else
|
|
1887 |
{
|
|
1888 |
iInputEnd = ETrue;
|
|
1889 |
return err;
|
|
1890 |
}
|
|
1891 |
}
|
|
1892 |
else
|
|
1893 |
{
|
|
1894 |
err = KErrNotSupported;
|
|
1895 |
}
|
|
1896 |
// Start and End of a picure are found
|
|
1897 |
if ( found)
|
|
1898 |
{
|
|
1899 |
//Set Size to length of the header + one picure, and reset position to be read next time
|
|
1900 |
aCodedInBuffer->iData.SetLength (pos);
|
|
1901 |
TInt tempLength = pos - buffLength;
|
|
1902 |
err = iInFile.Seek (ESeekCurrent, tempLength);
|
|
1903 |
}
|
|
1904 |
// All data in Buffer are checked and end of data not found
|
|
1905 |
else
|
|
1906 |
{
|
|
1907 |
if ( pos >= (iInBuffSize-3))
|
|
1908 |
{
|
|
1909 |
err = KErrOverflow;
|
|
1910 |
}
|
|
1911 |
}
|
|
1912 |
if ( err == KErrNone)
|
|
1913 |
{
|
|
1914 |
err = pos;
|
|
1915 |
}
|
|
1916 |
return err;
|
|
1917 |
}
|
|
1918 |
|
|
1919 |
/**
|
|
1920 |
* Read one coded picture into decoder input buffer, frame size is known
|
|
1921 |
*
|
|
1922 |
* @param aCodedInBuffer
|
|
1923 |
* @param aSize - frame size
|
|
1924 |
* @return err - The error
|
|
1925 |
*/
|
|
1926 |
TInt CT_CMMFDevVideoPlay::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer, TInt aSize)
|
|
1927 |
{
|
|
1928 |
TInt err = KErrNone;
|
|
1929 |
if(aCodedInBuffer !=NULL)
|
|
1930 |
{
|
|
1931 |
err = iInFile.Read(aCodedInBuffer->iData, aSize);
|
|
1932 |
}
|
|
1933 |
else
|
|
1934 |
{
|
|
1935 |
INFO_PRINTF1(_L("aCodedInBuffer is NULL"));
|
|
1936 |
err = KErrNotFound;
|
|
1937 |
}
|
|
1938 |
if (aSize == 0)
|
|
1939 |
{
|
|
1940 |
iInputEnd = ETrue;
|
|
1941 |
}
|
|
1942 |
return err;
|
|
1943 |
}
|
|
1944 |
|
|
1945 |
|
|
1946 |
/**
|
|
1947 |
* Notifies the client that one or more new empty input buffers are available
|
|
1948 |
* @return None
|
|
1949 |
*/
|
|
1950 |
void CT_CMMFDevVideoPlay::MdvpoNewBuffers()
|
|
1951 |
{
|
|
1952 |
TRAPD(err, HandleNewBufferL());
|
|
1953 |
if (err != KErrNone)
|
|
1954 |
{
|
|
1955 |
ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err);
|
|
1956 |
SetBlockResult(EFail);
|
|
1957 |
}
|
|
1958 |
}
|
|
1959 |
|
|
1960 |
/**
|
|
1961 |
* Returns a used input video picture back to the caller. The picture memory can be re-used or freed.
|
|
1962 |
*
|
|
1963 |
* @param aPicture the picture to return
|
|
1964 |
*/
|
|
1965 |
void CT_CMMFDevVideoPlay::MdvpoReturnPicture(TVideoPicture* aPicture)
|
|
1966 |
{
|
|
1967 |
if ( iRawInBuffer == aPicture )
|
|
1968 |
{
|
|
1969 |
TRAPD(err1, HandleNewBufferL());
|
|
1970 |
if (err1 != KErrNone)
|
|
1971 |
{
|
|
1972 |
ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err1);
|
|
1973 |
SetBlockResult(EFail);
|
|
1974 |
}
|
|
1975 |
}
|
|
1976 |
}
|
|
1977 |
|
|
1978 |
/**
|
|
1979 |
* Delivers supplemental information from a coded data unit.
|
|
1980 |
*
|
|
1981 |
* @param aData The supplemental data. The reference is only valid until the method returns, and thus the data must be processed or copied immediately
|
|
1982 |
* @param aTimestamp The presentation timestamp for the picture that the supplemental data is part of
|
|
1983 |
* @param aPictureId Picture identifier for the picture. If a picture ID is not available, aPictureId.iIdType is set to ENone
|
|
1984 |
*
|
|
1985 |
* @return None
|
|
1986 |
*/
|
|
1987 |
void CT_CMMFDevVideoPlay::MdvpoSupplementalInformation(const TDesC8& /*aData*/, const TTimeIntervalMicroSeconds& /*aTimestamp*/, const TPictureId& /*aPictureId*/)
|
|
1988 |
{
|
|
1989 |
}
|
|
1990 |
|
|
1991 |
/**
|
|
1992 |
* Back channel information from the decoder, indicating a picture loss without specifying the lost picture.
|
|
1993 |
*
|
|
1994 |
* @return None
|
|
1995 |
*/
|
|
1996 |
void CT_CMMFDevVideoPlay::MdvpoPictureLoss()
|
|
1997 |
{
|
|
1998 |
iPictureLoss++;
|
|
1999 |
}
|
|
2000 |
|
|
2001 |
/**
|
|
2002 |
* Back channel information from the decoder, indicating a picture loss without specifying the lost picture.
|
|
2003 |
*
|
|
2004 |
* @param aPictures Picture identifiers for the lost pictures.
|
|
2005 |
*
|
|
2006 |
* @return None
|
|
2007 |
*/
|
|
2008 |
void CT_CMMFDevVideoPlay::MdvpoPictureLoss(const TArray<TPictureId>& aPictures)
|
|
2009 |
{
|
|
2010 |
iPictureLoss += aPictures.Count();
|
|
2011 |
}
|
|
2012 |
|
|
2013 |
/**
|
|
2014 |
* Back channel information from the decoder, indicating the loss of consecutive macroblocks in raster scan order.
|
|
2015 |
*
|
|
2016 |
* @param aFirstMacroblock The first lost macroblock
|
|
2017 |
* @param aNumMacroblocks The number of lost macroblocks that are consecutive in raster-scan order
|
|
2018 |
* @param aPicture The picture identifier for the picture where the macroblocks were lost
|
|
2019 |
*
|
|
2020 |
* @return None
|
|
2021 |
*/
|
|
2022 |
void CT_CMMFDevVideoPlay::MdvpoSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/)
|
|
2023 |
{
|
|
2024 |
}
|
|
2025 |
|
|
2026 |
/**
|
|
2027 |
* Back channel information from the decoder, indicating a reference picture selection request.
|
|
2028 |
*
|
|
2029 |
* @param aSelectionData The reference picture selection request message.
|
|
2030 |
*
|
|
2031 |
* @return None
|
|
2032 |
*/
|
|
2033 |
void CT_CMMFDevVideoPlay::MdvpoReferencePictureSelection(const TDesC8& /*aSelectionData*/)
|
|
2034 |
{
|
|
2035 |
}
|
|
2036 |
|
|
2037 |
/**
|
|
2038 |
* Called when a timed snapshot request has been completed. When this method is called, the snapshot has been taken, and the memory reserved for the picture can be re-used or freed.
|
|
2039 |
*
|
|
2040 |
* @param aError An error code, KErrNone if no errors occurred.
|
|
2041 |
* @param aPictureData The snapshot picture data
|
|
2042 |
* @param aPresentationTimestamp The presentation timestamp for the snapshot picture
|
|
2043 |
* @param aPictureId Picture identifier for the picture. If a picture ID is not available, aPictureId.iIdType is set to ENone
|
|
2044 |
*
|
|
2045 |
* @return None
|
|
2046 |
*/
|
|
2047 |
void CT_CMMFDevVideoPlay::MdvpoTimedSnapshotComplete(TInt aError, TPictureData* /*aPictureData*/,
|
|
2048 |
const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/,
|
|
2049 |
const TPictureId& /*aPictureId*/)
|
|
2050 |
{
|
|
2051 |
if(aError!= KErrNone)
|
|
2052 |
{
|
|
2053 |
INFO_PRINTF2(_L("An error has ocurred: %i in CT_CMMFDevVideoPlay::MdvpoTimedSnapshotComplete"),aError);
|
|
2054 |
}
|
|
2055 |
}
|
|
2056 |
|
|
2057 |
/**
|
|
2058 |
* Notifies the client that one or more new output pictures are available.
|
|
2059 |
*
|
|
2060 |
* @return None
|
|
2061 |
*/
|
|
2062 |
void CT_CMMFDevVideoPlay::MdvpoNewPictures()
|
|
2063 |
{
|
|
2064 |
GetReturnedPicture();
|
|
2065 |
}
|
|
2066 |
|
|
2067 |
/**
|
|
2068 |
* Reports a fatal decoding or playback error to the client.
|
|
2069 |
*
|
|
2070 |
* @param aError The error code
|
|
2071 |
*
|
|
2072 |
* @return None
|
|
2073 |
*/
|
|
2074 |
void CT_CMMFDevVideoPlay::MdvpoFatalError(TInt aError)
|
|
2075 |
{
|
|
2076 |
INFO_PRINTF1(_L("MdvpoFatalError DecOutstanding"));
|
|
2077 |
DecOutstanding();
|
|
2078 |
ERR_PRINTF2(_L("A Fatal error has ocurred: %i"),aError);
|
|
2079 |
HandleRuntimeError(aError);
|
|
2080 |
}
|
|
2081 |
|
|
2082 |
/**
|
|
2083 |
* Reports that DevVideoPlay initialization has completed. The interface can now be used for video playback.
|
|
2084 |
*
|
|
2085 |
* @param aError Initialization error code, KErrNone if no error occurred
|
|
2086 |
*
|
|
2087 |
* @return None
|
|
2088 |
*/
|
|
2089 |
void CT_CMMFDevVideoPlay::MdvpoInitComplete(TInt aError)
|
|
2090 |
{
|
|
2091 |
|
|
2092 |
if ( aError == KErrNone)
|
|
2093 |
{
|
|
2094 |
INFO_PRINTF1(_L("MdvpoInitComplete OK"));
|
|
2095 |
//Initilize parameters for Decoding/Playback
|
|
2096 |
iCodedInBuffer = NULL;
|
|
2097 |
iOutBuffer =NULL;
|
|
2098 |
iSentBuffCount = 0;
|
|
2099 |
iReturnedBuffCount = 0;
|
|
2100 |
iPictureLoss =0;
|
|
2101 |
iInputEnd = EFalse;
|
|
2102 |
iStreamEnd = EFalse;
|
|
2103 |
iTimeStamp = 0;
|
|
2104 |
}
|
|
2105 |
else
|
|
2106 |
{
|
|
2107 |
ERR_PRINTF2(_L("MdvpoInitComplete Error %d"), aError);
|
|
2108 |
SetAsyncError (iAsyncErrorIndex, aError);
|
|
2109 |
}
|
|
2110 |
INFO_PRINTF1(_L("MdvpoInitComplete DecOutstanding"));
|
|
2111 |
DecOutstanding ();
|
|
2112 |
}
|
|
2113 |
|
|
2114 |
/**
|
|
2115 |
* Reports that the input video stream end has been reached and all pictures have been processed.
|
|
2116 |
* This method is only called after the client has called InputEnd(). No more output pictures will be available.
|
|
2117 |
*
|
|
2118 |
* @return None
|
|
2119 |
*/
|
|
2120 |
void CT_CMMFDevVideoPlay::MdvpoStreamEnd()
|
|
2121 |
{
|
|
2122 |
iStreamEnd = ETrue;
|
|
2123 |
INFO_PRINTF1(_L("Stream End!"));
|
|
2124 |
INFO_PRINTF2(_L("iSentBuffCount: %d"),iSentBuffCount);
|
|
2125 |
INFO_PRINTF2(_L("iReturnedBuffCount: %d"),iReturnedBuffCount);
|
|
2126 |
INFO_PRINTF2(_L("iPictureLoss: %d"),iPictureLoss);
|
|
2127 |
INFO_PRINTF1(_L("MdvpoStreamEnd DecOutStanding"));
|
|
2128 |
DecOutstanding();
|
|
2129 |
}
|
|
2130 |
|
|
2131 |
|
|
2132 |
/**
|
|
2133 |
* Get Next input data
|
|
2134 |
*
|
|
2135 |
* @return None
|
|
2136 |
*/
|
|
2137 |
void CT_CMMFDevVideoPlay::HandleNewBufferL()
|
|
2138 |
{
|
|
2139 |
if ( !iInputEnd )
|
|
2140 |
{
|
|
2141 |
if ( iDecHWDevId || iCIBuffMgmtOn ) //Retrieve buffer from Hwdevice
|
|
2142 |
{
|
|
2143 |
GetInputBuffer();
|
|
2144 |
}
|
|
2145 |
else
|
|
2146 |
{
|
|
2147 |
FillAndSendBufferL(); // Postproc input
|
|
2148 |
}
|
|
2149 |
}
|
|
2150 |
}
|
|
2151 |
|
|
2152 |
/**
|
|
2153 |
* Retrieve decoder input buffer
|
|
2154 |
*
|
|
2155 |
* @return None
|
|
2156 |
*/
|
|
2157 |
void CT_CMMFDevVideoPlay::GetInputBuffer()
|
|
2158 |
{
|
|
2159 |
//TBool buffer = EFalse;
|
|
2160 |
if ( iDecHWDevId )
|
|
2161 |
{
|
|
2162 |
TRAPD(error, iCodedInBuffer = iDevvp->GetBufferL(iInBuffSize));
|
|
2163 |
if (error != KErrNone)
|
|
2164 |
{
|
|
2165 |
ERR_PRINTF2(_L("Error GetInputBufferL!. Error %d"),error);
|
|
2166 |
iErrorInputBuffer = ETrue;
|
|
2167 |
SetError(error);
|
|
2168 |
}
|
|
2169 |
else
|
|
2170 |
{
|
|
2171 |
if ( iCodedInBuffer )
|
|
2172 |
{
|
|
2173 |
TRAPD(error, FillAndSendBufferL());
|
|
2174 |
if (error != KErrNone)
|
|
2175 |
{
|
|
2176 |
ERR_PRINTF2(_L("Error GetInputBufferL->FillAndSendBufferL!. Error %d"),error);
|
|
2177 |
SetBlockResult(EFail);
|
|
2178 |
}
|
|
2179 |
}
|
|
2180 |
}
|
|
2181 |
}
|
|
2182 |
}
|
|
2183 |
|
|
2184 |
|
|
2185 |
|
|
2186 |
/**
|
|
2187 |
* Fill data into input buffer and send to devvideoplay
|
|
2188 |
*
|
|
2189 |
* @return None
|
|
2190 |
*/
|
|
2191 |
void CT_CMMFDevVideoPlay::FillAndSendBufferL()
|
|
2192 |
{
|
|
2193 |
TInt err = KErrNone;
|
|
2194 |
if ( iDecHWDevId)
|
|
2195 |
{
|
|
2196 |
if ( iSynchronized)
|
|
2197 |
{
|
|
2198 |
TInt size = 0;
|
|
2199 |
if((iSentBuffCount>=0) && (iSentBuffCount < iFrameSizeList.Count()))
|
|
2200 |
{
|
|
2201 |
size = iFrameSizeList[iSentBuffCount];
|
|
2202 |
}
|
|
2203 |
else
|
|
2204 |
{
|
|
2205 |
ERR_PRINTF2(_L("error %i"),iSentBuffCount);
|
|
2206 |
}
|
|
2207 |
|
|
2208 |
err = ReadOneCodedPicture (iCodedInBuffer, size); // Read compressed data of one picture from file
|
|
2209 |
}
|
|
2210 |
else
|
|
2211 |
{
|
|
2212 |
err = ReadOneCodedPicture (iCodedInBuffer); // Read compressed data of one picture from file
|
|
2213 |
}
|
|
2214 |
}
|
|
2215 |
else // Postproc input case
|
|
2216 |
{
|
|
2217 |
err = ReadRawPicture (); // Read raw data for one picture
|
|
2218 |
}
|
|
2219 |
if ( iInputEnd)
|
|
2220 |
{
|
|
2221 |
iDevvp->InputEnd (); // All input Data sent
|
|
2222 |
return;
|
|
2223 |
}
|
|
2224 |
if ( err >= 0)
|
|
2225 |
{
|
|
2226 |
if ( iDecHWDevId)
|
|
2227 |
{
|
|
2228 |
iCodedInBuffer->iOptions = TVideoInputBuffer::EDecodingTimestamp;
|
|
2229 |
if ( iPostProcId)
|
|
2230 |
{
|
|
2231 |
iCodedInBuffer->iOptions |= TVideoInputBuffer::EPresentationTimestamp;
|
|
2232 |
}
|
|
2233 |
if ( iSynchronized)
|
|
2234 |
{
|
|
2235 |
iCodedInBuffer->iDecodingTimestamp = iTimeStamp;
|
|
2236 |
if ( iPostProcId)
|
|
2237 |
{
|
|
2238 |
iCodedInBuffer->iPresentationTimestamp = iTimeStamp;
|
|
2239 |
}
|
|
2240 |
iTimeStamp += iFrameTimeInterval;
|
|
2241 |
}
|
|
2242 |
else // Clock source is not set
|
|
2243 |
{
|
|
2244 |
iCodedInBuffer->iDecodingTimestamp = iSentBuffCount;
|
|
2245 |
if ( iPostProcId)
|
|
2246 |
{
|
|
2247 |
iCodedInBuffer->iPresentationTimestamp = iSentBuffCount;
|
|
2248 |
}
|
|
2249 |
}
|
|
2250 |
if ( iFrameMeasurement)
|
|
2251 |
{
|
|
2252 |
iClock->Reset (); // Reset Timer
|
|
2253 |
}
|
|
2254 |
TRAPD(error,iDevvp->WriteCodedDataL(iCodedInBuffer)); // Input Data Sent to Decoder
|
|
2255 |
if ( error != KErrNone)
|
|
2256 |
{
|
|
2257 |
ERR_PRINTF2(_L("Error Writing data!. Error %d"),error);
|
|
2258 |
SetError(error);
|
|
2259 |
return;
|
|
2260 |
}
|
|
2261 |
}
|
|
2262 |
else
|
|
2263 |
{
|
|
2264 |
iRawInBuffer->iData.iDataSize.SetSize (iPictureSize.iWidth,
|
|
2265 |
iPictureSize.iHeight);
|
|
2266 |
iRawInBuffer->iOptions |= (TVideoPicture::ETimestamp);
|
|
2267 |
if ( iSynchronized)
|
|
2268 |
{
|
|
2269 |
iRawInBuffer->iTimestamp = iTimeStamp;
|
|
2270 |
iTimeStamp += iFrameTimeInterval;
|
|
2271 |
}
|
|
2272 |
else
|
|
2273 |
{
|
|
2274 |
iRawInBuffer->iTimestamp = iSentBuffCount;
|
|
2275 |
}
|
|
2276 |
TRAPD(error, iDevvp->WritePictureL (iRawInBuffer)); // Input Data Sent to PostProcessor
|
|
2277 |
if (error != KErrNone)
|
|
2278 |
{
|
|
2279 |
ERR_PRINTF2(_L("Error Writing Picture!. Error %d"),error);
|
|
2280 |
SetError(error);
|
|
2281 |
return;
|
|
2282 |
}
|
|
2283 |
}
|
|
2284 |
iSentBuffCount++;
|
|
2285 |
}
|
|
2286 |
else
|
|
2287 |
{
|
|
2288 |
iInputEnd = ETrue;
|
|
2289 |
iDevvp->InputEnd ();
|
|
2290 |
return;
|
|
2291 |
}
|
|
2292 |
}
|
|
2293 |
|
|
2294 |
|
|
2295 |
/**
|
|
2296 |
* Retrieve output picture
|
|
2297 |
*
|
|
2298 |
* @return None
|
|
2299 |
*/
|
|
2300 |
void CT_CMMFDevVideoPlay::GetReturnedPicture()
|
|
2301 |
{
|
|
2302 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::GetReturnedPicture"));
|
|
2303 |
TRAPD(err, iOutBuffer = iDevvp->NextPictureL());
|
|
2304 |
if ( err != KErrNone)
|
|
2305 |
{
|
|
2306 |
HandleRuntimeError(err);
|
|
2307 |
ERR_PRINTF1(_L("Error en GetReturnedPicture!!"));
|
|
2308 |
}
|
|
2309 |
if ( iOutBuffer )
|
|
2310 |
{
|
|
2311 |
iReturnedBuffCount++;
|
|
2312 |
SaveAndReturnPicture();
|
|
2313 |
}
|
|
2314 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::GetReturnedPicture"));
|
|
2315 |
}
|
|
2316 |
|
|
2317 |
/**
|
|
2318 |
* This function finishes the async call depending on the error occured while handling the picture
|
|
2319 |
*
|
|
2320 |
* @param aError Error Value passed
|
|
2321 |
* @return none
|
|
2322 |
*/
|
|
2323 |
void CT_CMMFDevVideoPlay::HandleRuntimeError(TInt aError)
|
|
2324 |
{
|
|
2325 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::HandleRuntimeError"));
|
|
2326 |
ERR_PRINTF2(_L("HandleRuntimeError! Error = %d"),aError);
|
|
2327 |
SetError (aError);
|
|
2328 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::HandleRuntimeError"));
|
|
2329 |
}
|
|
2330 |
|
|
2331 |
/**
|
|
2332 |
* Store output data into a file
|
|
2333 |
*
|
|
2334 |
* @return None
|
|
2335 |
*/
|
|
2336 |
void CT_CMMFDevVideoPlay::SaveAndReturnPicture()
|
|
2337 |
{
|
|
2338 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SaveAndReturnPicture"));
|
|
2339 |
TInt err = iOutFile.Write (*(iOutBuffer->iData.iRawData), iOutBuffer->iData.iRawData->Size ());
|
|
2340 |
iDevvp->ReturnPicture (iOutBuffer);
|
|
2341 |
iOutBuffer = NULL;
|
|
2342 |
if ( err != KErrNone)
|
|
2343 |
{
|
|
2344 |
HandleRuntimeError (err);
|
|
2345 |
}
|
|
2346 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::SaveAndReturnPicture"));
|
|
2347 |
}
|
|
2348 |
|
|
2349 |
/**
|
|
2350 |
* List size of each frame of coded bitstream
|
|
2351 |
*
|
|
2352 |
* @param aCodec picture
|
|
2353 |
* @return none
|
|
2354 |
*/
|
|
2355 |
void CT_CMMFDevVideoPlay::ListFrameSizeL(TVideoCodec aCodec)
|
|
2356 |
{
|
|
2357 |
TInt framesize = 0;
|
|
2358 |
TInt readpos = 0;
|
|
2359 |
TInt buffsize = KH263MaxCodedSizeQCIF; //buffer size for listing frame size
|
|
2360 |
iCodecType = aCodec; // this is for ReadOneCodedPicture
|
|
2361 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::ListFrameSizeL"));
|
|
2362 |
//Initial buffer size
|
|
2363 |
// Allocate buffer
|
|
2364 |
TVideoInputBuffer* videoBuffer = new(ELeave) TVideoInputBuffer;
|
|
2365 |
CleanupStack::PushL (videoBuffer);
|
|
2366 |
HBufC8* tempBuff = HBufC8::NewLC( buffsize);
|
|
2367 |
videoBuffer->iData.Set (tempBuff->Des ());
|
|
2368 |
while (!iInputEnd)
|
|
2369 |
{
|
|
2370 |
iInBuffSize = buffsize;
|
|
2371 |
videoBuffer->iData.SetLength (0);
|
|
2372 |
framesize = ReadOneCodedPicture (videoBuffer);//
|
|
2373 |
if ( framesize >= 0) // Frame size is added to list
|
|
2374 |
{
|
|
2375 |
iFrameSizeList.AppendL (framesize);
|
|
2376 |
readpos += framesize;
|
|
2377 |
}
|
|
2378 |
else // resize buffer to bigger one
|
|
2379 |
{
|
|
2380 |
if ( buffsize < KMP4MaxCodedSizeVGA)
|
|
2381 |
{
|
|
2382 |
CleanupStack::PopAndDestroy(tempBuff);
|
|
2383 |
buffsize = buffsize + KH263MaxCodedSizeQCIF;
|
|
2384 |
tempBuff = HBufC8::NewLC( buffsize);
|
|
2385 |
videoBuffer->iData.Set (tempBuff->Des ());
|
|
2386 |
iInFile.Seek (ESeekStart, readpos);
|
|
2387 |
}
|
|
2388 |
else
|
|
2389 |
{
|
|
2390 |
framesize = KErrNotFound;
|
|
2391 |
break;
|
|
2392 |
}
|
|
2393 |
}
|
|
2394 |
}
|
|
2395 |
//Reset file postion to start
|
|
2396 |
TInt pos =0;
|
|
2397 |
iInFile.Seek (ESeekStart, pos);
|
|
2398 |
iInputEnd = EFalse;
|
|
2399 |
// cleanup
|
|
2400 |
CleanupStack::PopAndDestroy(2, videoBuffer);
|
|
2401 |
//Error case
|
|
2402 |
if ( framesize < 0)
|
|
2403 |
{
|
|
2404 |
User::Leave (framesize);
|
|
2405 |
}
|
|
2406 |
//Set frame size listed
|
|
2407 |
iFrameListed = ETrue;
|
|
2408 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::ListFrameSizeL"));
|
|
2409 |
}
|
|
2410 |
|
|
2411 |
/**
|
|
2412 |
* Closes the opened files
|
|
2413 |
*/
|
|
2414 |
void CT_CMMFDevVideoPlay::CloseFile()
|
|
2415 |
{
|
|
2416 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::CloseFile"));
|
|
2417 |
iInFile.Close ();
|
|
2418 |
if ( !iDirectScreenAccess)
|
|
2419 |
{
|
|
2420 |
iOutFile.Close ();
|
|
2421 |
}
|
|
2422 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::CloseFile"));
|
|
2423 |
}
|
|
2424 |
|
|
2425 |
/**
|
|
2426 |
* Opens the input and output file
|
|
2427 |
* @param aInFileName - The name of input file
|
|
2428 |
* @param aOutFileName - The name of output file
|
|
2429 |
* @return none
|
|
2430 |
*/
|
|
2431 |
void CT_CMMFDevVideoPlay::OpenFileL(TFileName& aOutFileName, TFileName& aInFileName)
|
|
2432 |
{
|
|
2433 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::OpenFileL"));
|
|
2434 |
TInt err = iInFile.Open (iFs, aInFileName, EFileRead | EFileShareReadersOnly);
|
|
2435 |
User::LeaveIfError (err);
|
|
2436 |
err = iOutFile.Replace (iFs, aOutFileName,
|
|
2437 |
EFileShareExclusive|EFileWrite);
|
|
2438 |
if ( err!= KErrNone)
|
|
2439 |
{
|
|
2440 |
iInFile.Close ();
|
|
2441 |
User::Leave(err);
|
|
2442 |
}
|
|
2443 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::OpenFileL"));
|
|
2444 |
}
|
|
2445 |
|
|
2446 |
/**
|
|
2447 |
* Opens the input File
|
|
2448 |
* @param aInFileName -The name of input file
|
|
2449 |
* @return none
|
|
2450 |
*/
|
|
2451 |
void CT_CMMFDevVideoPlay::OpenFileL(TFileName& aInFileName)
|
|
2452 |
{
|
|
2453 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::OpenFileL"));
|
|
2454 |
User::LeaveIfError(iInFile.Open (iFs, aInFileName, EFileRead | EFileShareReadersOnly));
|
|
2455 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::OpenFileL"));
|
|
2456 |
}
|
|
2457 |
|
|
2458 |
/**
|
|
2459 |
* Read one raw picture into postprocessor input buffer
|
|
2460 |
*/
|
|
2461 |
TInt CT_CMMFDevVideoPlay::ReadRawPicture()
|
|
2462 |
{
|
|
2463 |
INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::ReadRawPicture"));
|
|
2464 |
iRawInBuffer->iData.iRawData->Set ((TUint8*)iRawInBuffer->iData.iRawData->Ptr(), 0, iInBuffSize);
|
|
2465 |
TInt err = iInFile.Read (*(iRawInBuffer->iData.iRawData), iInBuffSize);
|
|
2466 |
if ( !err)
|
|
2467 |
{
|
|
2468 |
if ( (iRawInBuffer->iData.iRawData->Length()) == 0)
|
|
2469 |
{
|
|
2470 |
iInputEnd = ETrue;
|
|
2471 |
}
|
|
2472 |
}
|
|
2473 |
INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::ReadRawPicture"));
|
|
2474 |
return err;
|
|
2475 |
}
|
|
2476 |
|
|
2477 |
void CT_CMMFDevVideoPlay::DoCmdH264CreateDecTest(const TTEFSectionName& aSection)
|
|
2478 |
{
|
|
2479 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::CreateDecTest, In"));
|
|
2480 |
iUse264 = ETrue;
|
|
2481 |
TInt uidInt = 0;
|
|
2482 |
TInt output = 0;
|
|
2483 |
TInt width = 0;
|
|
2484 |
TInt height = 0;
|
|
2485 |
TInt buffMgmt = 0;
|
|
2486 |
TInt codec = 0;
|
|
2487 |
TPtrC inputfile;
|
|
2488 |
TPtrC inputDirectory;
|
|
2489 |
|
|
2490 |
iObserver = new (ELeave) CEngineObserver(*this);
|
|
2491 |
//Create Decoder test engine
|
|
2492 |
iEngine = CVDecTestEngine::NewL(*iObserver);
|
|
2493 |
|
|
2494 |
//Read from test case file
|
|
2495 |
if(!GetHexFromConfig(aSection, KUid(), uidInt))
|
|
2496 |
{
|
|
2497 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUid());
|
|
2498 |
SetBlockResult(EFail);
|
|
2499 |
}
|
|
2500 |
if(!GetIntFromConfig(aSection, KBuffMgmt(), buffMgmt))
|
|
2501 |
{
|
|
2502 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBuffMgmt());
|
|
2503 |
SetBlockResult(EFail);
|
|
2504 |
}
|
|
2505 |
if(!GetIntFromConfig(aSection, KOutput(), output))
|
|
2506 |
{
|
|
2507 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutput());
|
|
2508 |
SetBlockResult(EFail);
|
|
2509 |
}
|
|
2510 |
if(!GetIntFromConfig(aSection, KWidth(), width))
|
|
2511 |
{
|
|
2512 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
|
|
2513 |
SetBlockResult(EFail);
|
|
2514 |
}
|
|
2515 |
if(!GetIntFromConfig(aSection, KHeight(), height))
|
|
2516 |
{
|
|
2517 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
|
|
2518 |
SetBlockResult(EFail);
|
|
2519 |
}
|
|
2520 |
if(!GetIntFromConfig(aSection, KCodec(), codec))
|
|
2521 |
{
|
|
2522 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCodec());
|
|
2523 |
SetBlockResult(EFail);
|
|
2524 |
}
|
|
2525 |
if(!GetStringFromConfig(aSection, KInputPath(), inputDirectory))
|
|
2526 |
{
|
|
2527 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputPath());
|
|
2528 |
SetBlockResult(EFail);
|
|
2529 |
}
|
|
2530 |
if(!GetStringFromConfig(aSection, KInputfile(), inputfile))
|
|
2531 |
{
|
|
2532 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputfile());
|
|
2533 |
SetBlockResult(EFail);
|
|
2534 |
}
|
|
2535 |
|
|
2536 |
//Open File
|
|
2537 |
TFileName inFileName(inputDirectory);
|
|
2538 |
inFileName.Append(inputfile);
|
|
2539 |
|
|
2540 |
TUid decoderUid;
|
|
2541 |
decoderUid.iUid = uidInt;
|
|
2542 |
INFO_PRINTF2(_L("Decoder uid is [%x]"), decoderUid.iUid);
|
|
2543 |
|
|
2544 |
TSize size;
|
|
2545 |
size.SetSize(width, height);
|
|
2546 |
|
|
2547 |
if (output == EDecodedFile)
|
|
2548 |
{
|
|
2549 |
TPtrC outputfile;
|
|
2550 |
TPtrC outputDirectory;
|
|
2551 |
if ( ! (GetStringFromConfig(aSection, KOutputPath(),outputDirectory)))
|
|
2552 |
{
|
|
2553 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputPath());
|
|
2554 |
SetBlockResult(EFail);
|
|
2555 |
}
|
|
2556 |
if ( !(GetStringFromConfig(aSection, KOutputfile(),outputfile)))
|
|
2557 |
{
|
|
2558 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputfile());
|
|
2559 |
SetBlockResult(EFail);
|
|
2560 |
}
|
|
2561 |
|
|
2562 |
//Start sequence
|
|
2563 |
iEngine->SetUpL(size, EFalse, buffMgmt);
|
|
2564 |
TFileName outFileName(outputDirectory);
|
|
2565 |
outFileName.Append(outputfile);
|
|
2566 |
iEngine->OpenFileL(outFileName, inFileName);
|
|
2567 |
}
|
|
2568 |
else if (output == EScreenOutput)
|
|
2569 |
{
|
|
2570 |
iEngine->SetUpL(size, ETrue, buffMgmt);
|
|
2571 |
iEngine->OpenFileL(inFileName);
|
|
2572 |
}
|
|
2573 |
|
|
2574 |
TRAPD(result, iEngine->SelectDecoderL(decoderUid));
|
|
2575 |
if(result != KErrNone)
|
|
2576 |
{
|
|
2577 |
ERR_PRINTF2(_L("SelectDecoderL left with error %d"), result);
|
|
2578 |
SetError(result);
|
|
2579 |
}
|
|
2580 |
|
|
2581 |
TVideoCodec videoCodec;
|
|
2582 |
if (codec == 1)
|
|
2583 |
{
|
|
2584 |
videoCodec = EH263;
|
|
2585 |
}
|
|
2586 |
else if (codec == 2)
|
|
2587 |
{
|
|
2588 |
videoCodec = EMPEG4;
|
|
2589 |
}
|
|
2590 |
else if (codec == 3)
|
|
2591 |
{
|
|
2592 |
videoCodec = EAVC;
|
|
2593 |
}
|
|
2594 |
else if (codec == 4)
|
|
2595 |
{
|
|
2596 |
videoCodec = EVC1;
|
|
2597 |
}
|
|
2598 |
else if (codec == 5)
|
|
2599 |
{
|
|
2600 |
videoCodec = EFLV;
|
|
2601 |
}
|
|
2602 |
else if (codec == 6)
|
|
2603 |
{
|
|
2604 |
videoCodec = EVP6;
|
|
2605 |
}
|
|
2606 |
else
|
|
2607 |
{
|
|
2608 |
videoCodec = EMPEG4;
|
|
2609 |
}
|
|
2610 |
iEngine->SetCodecType(videoCodec);
|
|
2611 |
|
|
2612 |
iFileOpen = ETrue;
|
|
2613 |
|
|
2614 |
INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::CreateDecTest, Out"));
|
|
2615 |
}
|
|
2616 |
|
|
2617 |
void CT_CMMFDevVideoPlay::DoCmdH264SetInputFormatCompr(const TTEFSectionName& aSection)
|
|
2618 |
{
|
|
2619 |
INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::SetInputFormatCompr, In"));
|
|
2620 |
|
|
2621 |
TInt hwdev = 0;
|
|
2622 |
TInt dataUnitTypeInt = 0;
|
|
2623 |
TInt encapsulation = 0;
|
|
2624 |
TInt dataInOrder = 0;
|
|
2625 |
TPtrC format;
|
|
2626 |
if(!GetIntFromConfig(aSection, KHwdev(), hwdev))
|
|
2627 |
{
|
|
2628 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
|
|
2629 |
SetBlockResult(EFail);
|
|
2630 |
}
|
|
2631 |
if(!GetIntFromConfig(aSection, KDataUnitTypeInt(), dataUnitTypeInt))
|
|
2632 |
{
|
|
2633 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataUnitTypeInt());
|
|
2634 |
SetBlockResult(EFail);
|
|
2635 |
}
|
|
2636 |
if(!GetIntFromConfig(aSection, KEncapsulation(), encapsulation))
|
|
2637 |
{
|
|
2638 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KEncapsulation());
|
|
2639 |
SetBlockResult(EFail);
|
|
2640 |
}
|
|
2641 |
if(!GetBoolFromConfig(aSection, KDataInOrder(), dataInOrder))
|
|
2642 |
{
|
|
2643 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataInOrder());
|
|
2644 |
SetBlockResult(EFail);
|
|
2645 |
}
|
|
2646 |
if(!GetStringFromConfig(aSection, KFormat(), format))
|
|
2647 |
{
|
|
2648 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFormat());
|
|
2649 |
SetBlockResult(EFail);
|
|
2650 |
}
|
|
2651 |
|
|
2652 |
TVideoDataUnitType dataUnitType;
|
|
2653 |
switch (dataUnitTypeInt)
|
|
2654 |
{
|
|
2655 |
case 1: dataUnitType = EDuCodedPicture;
|
|
2656 |
break;
|
|
2657 |
case 2: dataUnitType = EDuVideoSegment;
|
|
2658 |
break;
|
|
2659 |
case 3: dataUnitType = EDuSeveralSegments;
|
|
2660 |
break;
|
|
2661 |
case 4: dataUnitType = EDuArbitraryStreamSection;
|
|
2662 |
break;
|
|
2663 |
default:dataUnitType = EDuCodedPicture;
|
|
2664 |
}
|
|
2665 |
|
|
2666 |
TVideoDataUnitEncapsulation dataEncapsulation;
|
|
2667 |
|
|
2668 |
switch (encapsulation)
|
|
2669 |
{
|
|
2670 |
case 1: dataEncapsulation = EDuElementaryStream;
|
|
2671 |
break;
|
|
2672 |
case 2: dataEncapsulation = EDuGenericPayload;
|
|
2673 |
break;
|
|
2674 |
case 3: dataEncapsulation = EDuRtpPayload;
|
|
2675 |
break;
|
|
2676 |
default:dataEncapsulation = EDuElementaryStream;
|
|
2677 |
}
|
|
2678 |
|
|
2679 |
TBuf8<128> buf;
|
|
2680 |
buf.Copy(format);
|
|
2681 |
CCompressedVideoFormat* compressedFormat = CCompressedVideoFormat::NewL(buf);
|
|
2682 |
|
|
2683 |
TRAPD(result, iEngine->SetInputFormatL(hwdev,*compressedFormat, dataUnitType, dataEncapsulation, dataInOrder));
|
|
2684 |
if(result != KErrNone)
|
|
2685 |
{
|
|
2686 |
ERR_PRINTF2(_L("SetInputFormatL left with error %d"), result);
|
|
2687 |
SetError(result);
|
|
2688 |
}
|
|
2689 |
delete compressedFormat;
|
|
2690 |
|
|
2691 |
INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::SetInputFormatCompr, Out"));
|
|
2692 |
}
|
|
2693 |
|
|
2694 |
void CT_CMMFDevVideoPlay::DoCmdH264SetOutputFormat(const TTEFSectionName& aSection)
|
|
2695 |
{
|
|
2696 |
TInt hwdev = 0;
|
|
2697 |
TInt dataFormat = 0;
|
|
2698 |
TInt dataLayout = 0;
|
|
2699 |
TInt pattern = 0;
|
|
2700 |
TInt aspectRatioNum = 1;
|
|
2701 |
TInt aspectRatioDenom = 1;
|
|
2702 |
TInt coefficients = 0;
|
|
2703 |
|
|
2704 |
//Read from test case file
|
|
2705 |
if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
|
|
2706 |
{
|
|
2707 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
|
|
2708 |
SetBlockResult(EFail);
|
|
2709 |
}
|
|
2710 |
if ( !(GetIntFromConfig(aSection, KDataFormat(), dataFormat)))
|
|
2711 |
{
|
|
2712 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataFormat());
|
|
2713 |
SetBlockResult(EFail);
|
|
2714 |
}
|
|
2715 |
|
|
2716 |
if ( !(GetIntFromConfig(aSection, KDataLayout(), dataLayout)))
|
|
2717 |
{
|
|
2718 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataLayout());
|
|
2719 |
SetBlockResult(EFail);
|
|
2720 |
}
|
|
2721 |
|
|
2722 |
TUncompressedVideoFormat unCompressedFormat;
|
|
2723 |
|
|
2724 |
switch (dataFormat)
|
|
2725 |
{
|
|
2726 |
case 1:
|
|
2727 |
unCompressedFormat.iDataFormat = ERgbRawData;
|
|
2728 |
unCompressedFormat.iRgbFormat = ERgb32bit888;
|
|
2729 |
break;
|
|
2730 |
case 2: unCompressedFormat.iDataFormat = ERgbFbsBitmap;
|
|
2731 |
switch (dataLayout)
|
|
2732 |
{
|
|
2733 |
case 1: unCompressedFormat.iRgbFormat = ERgb16bit444;
|
|
2734 |
break;
|
|
2735 |
case 2: unCompressedFormat.iRgbFormat = ERgb16bit565;
|
|
2736 |
break;
|
|
2737 |
case 3: unCompressedFormat.iRgbFormat = ERgb32bit888;
|
|
2738 |
break;
|
|
2739 |
case 4: unCompressedFormat.iRgbFormat = EFbsBitmapColor4K;
|
|
2740 |
break;
|
|
2741 |
case 5: unCompressedFormat.iRgbFormat = EFbsBitmapColor16M;
|
|
2742 |
break;
|
|
2743 |
case 6: unCompressedFormat.iRgbFormat = EFbsBitmapColor16MU;
|
|
2744 |
break;
|
|
2745 |
default: unCompressedFormat.iRgbFormat = ERgb16bit444;
|
|
2746 |
}
|
|
2747 |
break;
|
|
2748 |
case 3: unCompressedFormat.iDataFormat = EYuvRawData;
|
|
2749 |
if ( !(GetIntFromConfig(aSection, KPattern(), pattern)))
|
|
2750 |
{
|
|
2751 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPattern());
|
|
2752 |
SetBlockResult(EFail);
|
|
2753 |
}
|
|
2754 |
if ( !(GetIntFromConfig(aSection, KAspectRatioNum(), aspectRatioNum)))
|
|
2755 |
{
|
|
2756 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KAspectRatioNum());
|
|
2757 |
SetBlockResult(EFail);
|
|
2758 |
}
|
|
2759 |
if ( !(GetIntFromConfig(aSection, KAspectRatioDenom(), aspectRatioDenom)))
|
|
2760 |
{
|
|
2761 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KAspectRatioDenom());
|
|
2762 |
SetBlockResult(EFail);
|
|
2763 |
}
|
|
2764 |
if(!GetHexFromConfig(aSection, KCoefficients(), coefficients))
|
|
2765 |
{
|
|
2766 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCoefficients());
|
|
2767 |
SetBlockResult(EFail);
|
|
2768 |
}
|
|
2769 |
switch (dataLayout)
|
|
2770 |
{
|
|
2771 |
case 1: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
|
|
2772 |
break;
|
|
2773 |
case 2: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedLE;
|
|
2774 |
break;
|
|
2775 |
case 3: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
|
|
2776 |
break;
|
|
2777 |
case 4: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataSemiPlanar;
|
|
2778 |
break;
|
|
2779 |
default:unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
|
|
2780 |
}
|
|
2781 |
switch (pattern)
|
|
2782 |
{
|
|
2783 |
case 1: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma1;
|
|
2784 |
break;
|
|
2785 |
case 2: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2;
|
|
2786 |
break;
|
|
2787 |
case 3: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma3;
|
|
2788 |
break;
|
|
2789 |
case 4: unCompressedFormat.iYuvFormat.iPattern = EYuv422Chroma1;
|
|
2790 |
break;
|
|
2791 |
case 5: unCompressedFormat.iYuvFormat.iPattern = EYuv422Chroma2;
|
|
2792 |
break;
|
|
2793 |
default:unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2;
|
|
2794 |
}
|
|
2795 |
switch (coefficients)
|
|
2796 |
{
|
|
2797 |
case 1: unCompressedFormat.iYuvFormat.iCoefficients = EYuvRange0;
|
|
2798 |
break;
|
|
2799 |
case 2: unCompressedFormat.iYuvFormat.iCoefficients = EYuvRange1;
|
|
2800 |
break;
|
|
2801 |
case 3: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709;
|
|
2802 |
break;
|
|
2803 |
case 4: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
|
|
2804 |
break;
|
|
2805 |
case 5: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
|
|
2806 |
break;
|
|
2807 |
case 6: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601;
|
|
2808 |
break;
|
|
2809 |
case 7: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range0;
|
|
2810 |
break;
|
|
2811 |
case 8: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
|
|
2812 |
break;
|
|
2813 |
case 9: unCompressedFormat.iYuvFormat.iCoefficients = ECustomYuvMatrix;
|
|
2814 |
break;
|
|
2815 |
default:unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
|
|
2816 |
}
|
|
2817 |
unCompressedFormat.iYuvFormat.iAspectRatioNum = aspectRatioNum;
|
|
2818 |
unCompressedFormat.iYuvFormat.iAspectRatioDenom = aspectRatioDenom;
|
|
2819 |
// We don't use conversion
|
|
2820 |
unCompressedFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
|
|
2821 |
unCompressedFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
|
|
2822 |
|
|
2823 |
break;
|
|
2824 |
default: unCompressedFormat.iDataFormat = EYuvRawData;
|
|
2825 |
unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
|
|
2826 |
unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma1;
|
|
2827 |
unCompressedFormat.iYuvFormat.iAspectRatioNum = 1;
|
|
2828 |
unCompressedFormat.iYuvFormat.iAspectRatioDenom = 1;
|
|
2829 |
unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
|
|
2830 |
|
|
2831 |
// We don't use conversion
|
|
2832 |
unCompressedFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
|
|
2833 |
unCompressedFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
|
|
2834 |
}
|
|
2835 |
|
|
2836 |
TRAPD(result, iEngine->SetOutputFormatL(hwdev, unCompressedFormat));
|
|
2837 |
if(result != KErrNone)
|
|
2838 |
{
|
|
2839 |
ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), result);
|
|
2840 |
SetError(result);
|
|
2841 |
}
|
|
2842 |
}
|
|
2843 |
|
|
2844 |
void CT_CMMFDevVideoPlay::DoCmdH264SetBufferOptions(const TTEFSectionName& aSection)
|
|
2845 |
{
|
|
2846 |
TInt preDecodeBufferSize = 0;
|
|
2847 |
TInt maxPostDecodeBufferSize = 0;
|
|
2848 |
TInt preDecoderBufferPeriodInt = 0;
|
|
2849 |
TInt postDecoderBufferPeriodInt = 0;
|
|
2850 |
TInt maxInputBufferSize = 0;
|
|
2851 |
TInt minNumInputBuffers = 0;
|
|
2852 |
|
|
2853 |
if ( !(GetIntFromConfig(aSection, KPreDecodeBufferSize(), preDecodeBufferSize)))
|
|
2854 |
{
|
|
2855 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPreDecodeBufferSize());
|
|
2856 |
SetBlockResult(EFail);
|
|
2857 |
}
|
|
2858 |
if ( !(GetIntFromConfig(aSection, KMaxPostDecodeBufferSize(), maxPostDecodeBufferSize)))
|
|
2859 |
{
|
|
2860 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMaxPostDecodeBufferSize());
|
|
2861 |
SetBlockResult(EFail);
|
|
2862 |
}
|
|
2863 |
if ( !(GetIntFromConfig(aSection, KPreDecoderBufferPeriodInt(), preDecoderBufferPeriodInt)))
|
|
2864 |
{
|
|
2865 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPreDecoderBufferPeriodInt());
|
|
2866 |
SetBlockResult(EFail);
|
|
2867 |
}
|
|
2868 |
if ( !(GetIntFromConfig(aSection, KPostDecoderBufferPeriodInt(), postDecoderBufferPeriodInt)))
|
|
2869 |
{
|
|
2870 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPostDecoderBufferPeriodInt());
|
|
2871 |
SetBlockResult(EFail);
|
|
2872 |
}
|
|
2873 |
if ( !(GetIntFromConfig(aSection, KMaxInputBufferSize(), maxInputBufferSize)))
|
|
2874 |
{
|
|
2875 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMaxInputBufferSize());
|
|
2876 |
SetBlockResult(EFail);
|
|
2877 |
}
|
|
2878 |
if ( !(GetIntFromConfig(aSection, KMinNumInputBuffers(), minNumInputBuffers)))
|
|
2879 |
{
|
|
2880 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMinNumInputBuffers());
|
|
2881 |
SetBlockResult(EFail);
|
|
2882 |
}
|
|
2883 |
|
|
2884 |
CMMFDevVideoPlay::TBufferOptions bufferOptions;
|
|
2885 |
bufferOptions.iPreDecodeBufferSize = preDecodeBufferSize;
|
|
2886 |
bufferOptions.iMaxPostDecodeBufferSize = maxPostDecodeBufferSize;
|
|
2887 |
bufferOptions.iPreDecoderBufferPeriod = preDecoderBufferPeriodInt;
|
|
2888 |
bufferOptions.iPostDecoderBufferPeriod = postDecoderBufferPeriodInt;
|
|
2889 |
bufferOptions.iMaxInputBufferSize = maxInputBufferSize;
|
|
2890 |
bufferOptions.iMinNumInputBuffers = minNumInputBuffers;
|
|
2891 |
|
|
2892 |
TRAPD(result, iEngine->SetBufferOptionsL(bufferOptions));
|
|
2893 |
if(result != KErrNone)
|
|
2894 |
{
|
|
2895 |
ERR_PRINTF2(_L("SetBufferOptionsL left with error %d"), result);
|
|
2896 |
SetError(result);
|
|
2897 |
}
|
|
2898 |
}
|
|
2899 |
|
|
2900 |
void CT_CMMFDevVideoPlay::DoCmdH264Initialize()
|
|
2901 |
{
|
|
2902 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Initialize, In"));
|
|
2903 |
iEngine->Initialize();
|
|
2904 |
IncOutstanding();
|
|
2905 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Initialize, Out"));
|
|
2906 |
}
|
|
2907 |
|
|
2908 |
void CT_CMMFDevVideoPlay::DoCmdH264Start(const TTEFSectionName& aSection)
|
|
2909 |
{
|
|
2910 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Start, In"));
|
|
2911 |
TInt inputEnd = 0;
|
|
2912 |
if ( !(GetIntFromConfig(aSection, KInputEnd(), inputEnd)))
|
|
2913 |
{
|
|
2914 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputEnd());
|
|
2915 |
SetBlockResult(EFail);
|
|
2916 |
}
|
|
2917 |
if (inputEnd != 0)
|
|
2918 |
{
|
|
2919 |
iEngine->Start(ETrue);
|
|
2920 |
}
|
|
2921 |
else
|
|
2922 |
{
|
|
2923 |
iEngine->Start(EFalse);
|
|
2924 |
}
|
|
2925 |
IncOutstanding();
|
|
2926 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Start, Out"));
|
|
2927 |
}
|
|
2928 |
|
|
2929 |
void CT_CMMFDevVideoPlay::DoCmdH264Stop()
|
|
2930 |
{
|
|
2931 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Stop, In"));
|
|
2932 |
TRAPD(result, iEngine->Stop());
|
|
2933 |
if(result != KErrNone)
|
|
2934 |
{
|
|
2935 |
ERR_PRINTF2(_L("Stop left with error %d"), result);
|
|
2936 |
SetError(result);
|
|
2937 |
}
|
|
2938 |
INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Stop, Out result=%d"),result);
|
|
2939 |
}
|
|
2940 |
|
|
2941 |
void CT_CMMFDevVideoPlay::DoCmdH264Pause()
|
|
2942 |
{
|
|
2943 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Pause, In"));
|
|
2944 |
TInt result = KErrNone;
|
|
2945 |
result = iEngine->Pause();
|
|
2946 |
INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Pause, Out result=%d"),result);
|
|
2947 |
}
|
|
2948 |
|
|
2949 |
void CT_CMMFDevVideoPlay::DoCmdH264Resume()
|
|
2950 |
{
|
|
2951 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Resume, In"));
|
|
2952 |
TInt result = KErrNone;
|
|
2953 |
result = iEngine->Resume();
|
|
2954 |
INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Resume, Out result=%d"),result);
|
|
2955 |
}
|
|
2956 |
|
|
2957 |
void CT_CMMFDevVideoPlay::DoCmdH264IOFrameNumMatch()
|
|
2958 |
{
|
|
2959 |
iEngine->SetFrameMatch( ETrue );
|
|
2960 |
}
|
|
2961 |
|
|
2962 |
void CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize()
|
|
2963 |
{
|
|
2964 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize, In"));
|
|
2965 |
RArray<TInt> framesizes;
|
|
2966 |
TRAPD(result, iEngine->ListFrameSizeL(framesizes));
|
|
2967 |
if(result != KErrNone)
|
|
2968 |
{
|
|
2969 |
ERR_PRINTF2(_L("ListFrameSizeL left with error %d"), result);
|
|
2970 |
SetError(result);
|
|
2971 |
}
|
|
2972 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize, Out"));
|
|
2973 |
}
|
|
2974 |
|
|
2975 |
void CT_CMMFDevVideoPlay::DoCmdH264SetVideoDestScreen(const TTEFSectionName& aSection)
|
|
2976 |
{
|
|
2977 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::SetVideoDestScreen, In"));
|
|
2978 |
|
|
2979 |
TBool dest = 0;
|
|
2980 |
if(!GetBoolFromConfig(aSection, KDest(), dest))
|
|
2981 |
{
|
|
2982 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDest());
|
|
2983 |
SetBlockResult(EFail);
|
|
2984 |
}
|
|
2985 |
|
|
2986 |
TRAPD(result, iEngine->SetVideoDestScreenL(dest));
|
|
2987 |
if(result != KErrNone)
|
|
2988 |
{
|
|
2989 |
ERR_PRINTF2(_L("SetVideoDestScreenL left with error %d"), result);
|
|
2990 |
SetError(result);
|
|
2991 |
}
|
|
2992 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetVideoDestScreen, Out"));
|
|
2993 |
}
|
|
2994 |
|
|
2995 |
void CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect(const TTEFSectionName& aSection)
|
|
2996 |
{
|
|
2997 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect, In"));
|
|
2998 |
|
|
2999 |
TInt x;
|
|
3000 |
TInt y;
|
|
3001 |
TInt width;
|
|
3002 |
TInt height;
|
|
3003 |
|
|
3004 |
if ( !(GetIntFromConfig(aSection, KX(), x)))
|
|
3005 |
{
|
|
3006 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KX());
|
|
3007 |
SetBlockResult(EFail);
|
|
3008 |
}
|
|
3009 |
if ( !(GetIntFromConfig(aSection, KY(), y)))
|
|
3010 |
{
|
|
3011 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KY());
|
|
3012 |
SetBlockResult(EFail);
|
|
3013 |
}
|
|
3014 |
if ( !(GetIntFromConfig(aSection, KWidth(), width)))
|
|
3015 |
{
|
|
3016 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
|
|
3017 |
SetBlockResult(EFail);
|
|
3018 |
}
|
|
3019 |
if ( !(GetIntFromConfig(aSection, KHeight(), height)))
|
|
3020 |
{
|
|
3021 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
|
|
3022 |
SetBlockResult(EFail);
|
|
3023 |
}
|
|
3024 |
|
|
3025 |
TSize size(width, height);
|
|
3026 |
|
|
3027 |
iEngine->SetWindowRect(x, y, size);
|
|
3028 |
|
|
3029 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect, Out"));
|
|
3030 |
}
|
|
3031 |
|
|
3032 |
void CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor(const TTEFSectionName& aSection)
|
|
3033 |
{
|
|
3034 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor, In"));
|
|
3035 |
|
|
3036 |
TInt uidInt = 0;
|
|
3037 |
if(!GetHexFromConfig(aSection, KUid(), uidInt))
|
|
3038 |
{
|
|
3039 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUid());
|
|
3040 |
SetBlockResult(EFail);
|
|
3041 |
}
|
|
3042 |
|
|
3043 |
TUid postproUid;
|
|
3044 |
postproUid.iUid = uidInt;
|
|
3045 |
INFO_PRINTF2(_L("PostProcessor uid is [%x]"), postproUid.iUid);
|
|
3046 |
|
|
3047 |
TRAPD(result, iEngine->SelectPostProcessorL(postproUid));
|
|
3048 |
if(result != KErrNone)
|
|
3049 |
{
|
|
3050 |
ERR_PRINTF2(_L("SelectPostProcessorL left with error %d"), result);
|
|
3051 |
SetError(result);
|
|
3052 |
}
|
|
3053 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor, Out"));
|
|
3054 |
}
|
|
3055 |
|
|
3056 |
void CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes(const TTEFSectionName& aSection)
|
|
3057 |
{
|
|
3058 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes, In"));
|
|
3059 |
|
|
3060 |
TInt combination = 0;
|
|
3061 |
TInt hwdev = 0;
|
|
3062 |
|
|
3063 |
if(!GetIntFromConfig(aSection, KHwdev(), hwdev))
|
|
3064 |
{
|
|
3065 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
|
|
3066 |
SetBlockResult(EFail);
|
|
3067 |
}
|
|
3068 |
if(!GetHexFromConfig(aSection, KCombination(), combination))
|
|
3069 |
{
|
|
3070 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCombination());
|
|
3071 |
SetBlockResult(EFail);
|
|
3072 |
}
|
|
3073 |
|
|
3074 |
TRAPD(result, iEngine->SetPostProcessTypesL(hwdev, combination));
|
|
3075 |
if(result != KErrNone)
|
|
3076 |
{
|
|
3077 |
ERR_PRINTF2(_L("SetPostProcessTypesL left with error %d"), result);
|
|
3078 |
SetError(result);
|
|
3079 |
}
|
|
3080 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes, In"));
|
|
3081 |
}
|
|
3082 |
|
|
3083 |
void CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats()
|
|
3084 |
{
|
|
3085 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats, In") );
|
|
3086 |
|
|
3087 |
TRAPD(result, iEngine->FindCommonFormatsL());
|
|
3088 |
if(result != KErrNone)
|
|
3089 |
{
|
|
3090 |
ERR_PRINTF2(_L("FindCommonFormatsL left with error %d"), result);
|
|
3091 |
SetError(result);
|
|
3092 |
}
|
|
3093 |
INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats, Out [%d]"), result);
|
|
3094 |
}
|
|
3095 |
|
|
3096 |
|
|
3097 |
void CT_CMMFDevVideoPlay::DoCmdH264GetHeaderInformation(const TTEFSectionName& aSection)
|
|
3098 |
{
|
|
3099 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::GetHeaderInformation, In") );
|
|
3100 |
TInt result = KErrNone;
|
|
3101 |
TInt dataUnitTypeInt = 0;
|
|
3102 |
TBool getDataUnitTypeInt = ETrue;
|
|
3103 |
if(!GetIntFromConfig(aSection, KDataUnitTypeInt(), dataUnitTypeInt))
|
|
3104 |
{
|
|
3105 |
getDataUnitTypeInt = EFalse;
|
|
3106 |
}
|
|
3107 |
TInt encapsulation = 0;
|
|
3108 |
TBool getEncapsulation = ETrue;
|
|
3109 |
if(!GetIntFromConfig(aSection, KEncapsulation(), encapsulation))
|
|
3110 |
{
|
|
3111 |
getEncapsulation = EFalse;
|
|
3112 |
}
|
|
3113 |
if(getDataUnitTypeInt && getEncapsulation)
|
|
3114 |
{
|
|
3115 |
TVideoDataUnitType dataUnitType;
|
|
3116 |
switch (dataUnitTypeInt)
|
|
3117 |
{
|
|
3118 |
case 1: dataUnitType = EDuCodedPicture;
|
|
3119 |
break;
|
|
3120 |
case 2: dataUnitType = EDuVideoSegment;
|
|
3121 |
break;
|
|
3122 |
case 3: dataUnitType = EDuSeveralSegments;
|
|
3123 |
break;
|
|
3124 |
case 4: dataUnitType = EDuArbitraryStreamSection;
|
|
3125 |
break;
|
|
3126 |
default:dataUnitType = EDuCodedPicture;
|
|
3127 |
}
|
|
3128 |
|
|
3129 |
TVideoDataUnitEncapsulation dataEncapsulation;
|
|
3130 |
switch (encapsulation)
|
|
3131 |
{
|
|
3132 |
case 1: dataEncapsulation = EDuElementaryStream;
|
|
3133 |
break;
|
|
3134 |
case 2: dataEncapsulation = EDuGenericPayload;
|
|
3135 |
break;
|
|
3136 |
case 3: dataEncapsulation = EDuRtpPayload;
|
|
3137 |
break;
|
|
3138 |
default:dataEncapsulation = EDuElementaryStream;
|
|
3139 |
}
|
|
3140 |
|
|
3141 |
TRAP(result, iEngine->GetHeaderInformationL(dataUnitType, dataEncapsulation));
|
|
3142 |
}
|
|
3143 |
else
|
|
3144 |
{
|
|
3145 |
TRAP(result, iEngine->GetHeaderInformationL());
|
|
3146 |
}
|
|
3147 |
if(result != KErrNone)
|
|
3148 |
{
|
|
3149 |
ERR_PRINTF2(_L("GetHeaderInformationL left with error %d"), result);
|
|
3150 |
SetError(result);
|
|
3151 |
}
|
|
3152 |
INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::GetHeaderInformation, Out [%d]"), result);
|
|
3153 |
}
|
|
3154 |
|
|
3155 |
void CT_CMMFDevVideoPlay::DoCmdH264EnableSynchronization(const TTEFSectionName& aSection)
|
|
3156 |
{
|
|
3157 |
if(!GetIntFromConfig(aSection, KFramerate(), iFrameRate))
|
|
3158 |
{
|
|
3159 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFramerate());
|
|
3160 |
SetBlockResult(EFail);
|
|
3161 |
}
|
|
3162 |
|
|
3163 |
iEngine->EnableSynchronization(iFrameRate);
|
|
3164 |
}
|
|
3165 |
|
|
3166 |
void CT_CMMFDevVideoPlay::DoCmdH264SetScaleOptions(const TTEFSectionName& aSection)
|
|
3167 |
{
|
|
3168 |
TInt width = 0;
|
|
3169 |
TInt height = 0;
|
|
3170 |
TInt antiAliasing = 0;
|
|
3171 |
TInt hwdev = 0;
|
|
3172 |
|
|
3173 |
if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
|
|
3174 |
{
|
|
3175 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
|
|
3176 |
SetBlockResult(EFail);
|
|
3177 |
}
|
|
3178 |
if ( !(GetIntFromConfig(aSection, KWidth(), width)))
|
|
3179 |
{
|
|
3180 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
|
|
3181 |
SetBlockResult(EFail);
|
|
3182 |
}
|
|
3183 |
if ( !(GetIntFromConfig(aSection, KHeight(), height)))
|
|
3184 |
{
|
|
3185 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
|
|
3186 |
SetBlockResult(EFail);
|
|
3187 |
}
|
|
3188 |
if ( !(GetIntFromConfig(aSection, KY(), antiAliasing)))
|
|
3189 |
{
|
|
3190 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KY());
|
|
3191 |
SetBlockResult(EFail);
|
|
3192 |
}
|
|
3193 |
|
|
3194 |
TSize size(width, height);
|
|
3195 |
|
|
3196 |
TRAPD(result, iEngine->SetScaleOptionsL(hwdev, size, antiAliasing));
|
|
3197 |
if(result != KErrNone)
|
|
3198 |
{
|
|
3199 |
ERR_PRINTF2(_L("FindCommonFormatsL left with error %d"), result);
|
|
3200 |
SetError(result);
|
|
3201 |
}
|
|
3202 |
}
|
|
3203 |
|
|
3204 |
void CT_CMMFDevVideoPlay::DoCmdH264SetRotateOptions(const TTEFSectionName& aSection)
|
|
3205 |
{
|
|
3206 |
TInt rotItem = 0;
|
|
3207 |
TInt hwdev = 0;
|
|
3208 |
if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
|
|
3209 |
{
|
|
3210 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
|
|
3211 |
SetBlockResult(EFail);
|
|
3212 |
}
|
|
3213 |
if ( !(GetIntFromConfig(aSection, KRotation(), rotItem)))
|
|
3214 |
{
|
|
3215 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KRotation());
|
|
3216 |
SetBlockResult(EFail);
|
|
3217 |
}
|
|
3218 |
TRotationType rotation;
|
|
3219 |
switch(rotItem)
|
|
3220 |
{
|
|
3221 |
case 0:
|
|
3222 |
rotation = ERotateNone;
|
|
3223 |
break;
|
|
3224 |
case 90:
|
|
3225 |
rotation = ERotate90Clockwise;
|
|
3226 |
break;
|
|
3227 |
case 180:
|
|
3228 |
rotation = ERotate180;
|
|
3229 |
break;
|
|
3230 |
case 270:
|
|
3231 |
rotation = ERotate90Anticlockwise;
|
|
3232 |
break;
|
|
3233 |
default:
|
|
3234 |
rotation = ERotateNone;
|
|
3235 |
}
|
|
3236 |
TRAPD(result, iEngine->SetRotateOptionsL(hwdev, rotation));
|
|
3237 |
if(result != KErrNone)
|
|
3238 |
{
|
|
3239 |
ERR_PRINTF2(_L("SetRotateOptionsL left with error %d"), result);
|
|
3240 |
SetError(result);
|
|
3241 |
}
|
|
3242 |
}
|
|
3243 |
|
|
3244 |
void CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding(const TTEFSectionName& aSection)
|
|
3245 |
{
|
|
3246 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding, In"));
|
|
3247 |
TBool sync = 0;
|
|
3248 |
if(!GetBoolFromConfig(aSection, KSync(), sync))
|
|
3249 |
{
|
|
3250 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSync());
|
|
3251 |
SetBlockResult(EFail);
|
|
3252 |
}
|
|
3253 |
iEngine->SynchronizeDecoding(sync);
|
|
3254 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding, Out"));
|
|
3255 |
}
|
|
3256 |
|
|
3257 |
void CT_CMMFDevVideoPlay::DoCmdH264Delete()
|
|
3258 |
{
|
|
3259 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete, In"));
|
|
3260 |
if (iFileOpen && iUse264)
|
|
3261 |
{
|
|
3262 |
iEngine->CloseFile();
|
|
3263 |
}
|
|
3264 |
iEngine->TearDown();
|
|
3265 |
if(iEngine)
|
|
3266 |
{
|
|
3267 |
delete iEngine;
|
|
3268 |
iEngine = NULL;
|
|
3269 |
}
|
|
3270 |
if(iObserver)
|
|
3271 |
{
|
|
3272 |
delete iObserver;
|
|
3273 |
iObserver = NULL;
|
|
3274 |
}
|
|
3275 |
if(iClock)
|
|
3276 |
{
|
|
3277 |
delete iClock;
|
|
3278 |
iClock = NULL;
|
|
3279 |
}
|
|
3280 |
while(Outstanding())
|
|
3281 |
{
|
|
3282 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete DecOutstanding()"));
|
|
3283 |
DecOutstanding();
|
|
3284 |
}
|
|
3285 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete, Out"));
|
|
3286 |
}
|
|
3287 |
|
|
3288 |
void CT_CMMFDevVideoPlay::DoCmdH264SetPosition(const TTEFSectionName& aSection)
|
|
3289 |
{
|
|
3290 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPosition, In"));
|
|
3291 |
TInt pos;
|
|
3292 |
TBool dataOk = ETrue;
|
|
3293 |
if ( !(GetIntFromConfig(aSection, KPos(), pos)) ) //This parameter indicates seconds to move forward/backward from the current position
|
|
3294 |
{
|
|
3295 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPos());
|
|
3296 |
SetBlockResult(EFail);
|
|
3297 |
dataOk = EFalse;
|
|
3298 |
}
|
|
3299 |
if(dataOk)
|
|
3300 |
{
|
|
3301 |
TInt frameTimeInterval = (TInt64)(1000000/iFrameRate);
|
|
3302 |
TInt newPosition = (iEngine->PlaybackPosition()).Int64()/frameTimeInterval + pos;
|
|
3303 |
INFO_PRINTF2(_L("set to position %d"),newPosition);
|
|
3304 |
TInt maxPosition = iEngine->GetFrameSizeCount();
|
|
3305 |
INFO_PRINTF2(_L("total framesize count %d"),maxPosition);
|
|
3306 |
if(newPosition >= maxPosition)
|
|
3307 |
{
|
|
3308 |
INFO_PRINTF3(_L("Invalid forward position %d, auto set to maximum framesize count %d"),newPosition,maxPosition-1);
|
|
3309 |
newPosition = maxPosition - 1;
|
|
3310 |
}
|
|
3311 |
if(newPosition <= 0)
|
|
3312 |
{
|
|
3313 |
INFO_PRINTF2(_L("Invalid backward position %d, auto set to starting position."),newPosition);
|
|
3314 |
newPosition = 1;
|
|
3315 |
}
|
|
3316 |
TTimeIntervalMicroSeconds timestamp = newPosition*frameTimeInterval;
|
|
3317 |
iEngine->SetPosition(timestamp);
|
|
3318 |
}
|
|
3319 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPosition, Out"));
|
|
3320 |
}
|
|
3321 |
|
|
3322 |
void CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess()
|
|
3323 |
{
|
|
3324 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess In"));
|
|
3325 |
iEngine->AbortDirectScreenAccess();
|
|
3326 |
INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess, Out"));
|
|
3327 |
}
|