os/mm/mmapitest/devvideohaitest/src/T_CMMFDevVideoPlayData.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmapitest/devvideohaitest/src/T_CMMFDevVideoPlayData.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,3327 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <datawrapper.h>
    1.23 +#include <devvideoplay.h>
    1.24 +#include <devvideobase.h> 
    1.25 +#include <hal.h>
    1.26 +#include <devvideoconstants.h>
    1.27 +#include "t_cmmfdevvideoplaydata.h"
    1.28 +#include "t_devvideoconstants.h"
    1.29 +
    1.30 +/*@{*/
    1.31 +//LIT's to get params from ini files
    1.32 +_LIT(KPostPro,								"postprocessor");
    1.33 +_LIT(KCodec,								"codec");
    1.34 +_LIT(KCombination,							"combination");
    1.35 +_LIT(KScreenout,							"screen");
    1.36 +_LIT(KFramerate,							"framerate");
    1.37 +_LIT(KInputfile,							"inputfile");
    1.38 +_LIT(KOutputfile,							"outputfile");
    1.39 +_LIT(KSynch,								"synch");
    1.40 +_LIT(KDecoder, 								"dec");
    1.41 +_LIT(KRotation, 							"rotation");
    1.42 +_LIT(KWidth, 								"width");
    1.43 +_LIT(KHeight, 								"height");
    1.44 +_LIT(Kx, 									"x");
    1.45 +_LIT(Ky, 									"y");
    1.46 +_LIT(KPos, 									"pos");
    1.47 +_LIT(KAntiAliasFiltering,					"antiAliasFiltering");
    1.48 +_LIT(KMimeType,								"mimeType");
    1.49 +_LIT(KUseDecoder,							"useDecoder");
    1.50 +_LIT(KInputPath,							"inputPath");
    1.51 +_LIT(KOutputPath,							"outputPath");
    1.52 +_LIT(KDisplayMode,							"displayMode");
    1.53 +_LIT(KBuf,									"buffer");
    1.54 +_LIT(KDataInOrder, 							"dataInOrder");
    1.55 +_LIT(KTVideoDataUnitType, 					"TVideoDataUnitType");
    1.56 +_LIT(KTVideoDataUnitEncapsulation, 			"TVideoDataUnitEncapsulation");
    1.57 +//H264
    1.58 +_LIT(KUid,									"uidInt");
    1.59 +_LIT(KBuffMgmt,								"buffMgmt");
    1.60 +_LIT(KOutput,								"output");
    1.61 +_LIT(KHwdev,								"hwdev");
    1.62 +_LIT(KDataUnitTypeInt,						"dataUnitTypeInt");
    1.63 +_LIT(KEncapsulation,						"encapsulation");
    1.64 +_LIT(KFormat,								"format");
    1.65 +_LIT(KDataFormat,                           "dataFormat");
    1.66 +_LIT(KDataLayout,                           "dataLayout");
    1.67 +_LIT(KPattern,                              "pattern");
    1.68 +_LIT(KAspectRatioNum,                       "aspectRatioNum");
    1.69 +_LIT(KAspectRatioDenom,                     "aspectRatioDenom");
    1.70 +_LIT(KCoefficients,                         "coefficients");
    1.71 +_LIT(KPreDecodeBufferSize,                  "preDecodeBufferSize");
    1.72 +_LIT(KMaxPostDecodeBufferSize,              "maxPostDecodeBufferSize");
    1.73 +_LIT(KPreDecoderBufferPeriodInt,			"preDecoderBufferPeriodInt");
    1.74 +_LIT(KPostDecoderBufferPeriodInt,           "postDecoderBufferPeriodInt");
    1.75 +_LIT(KMaxInputBufferSize,                   "maxInputBufferSize");
    1.76 +_LIT(KMinNumInputBuffers,                   "minNumInputBuffers");
    1.77 +_LIT(KInputEnd,								"inputEnd");
    1.78 +_LIT(KDest,                                 "dest");
    1.79 +_LIT(KX,                                    "x");
    1.80 +_LIT(KY,                                    "y");
    1.81 +_LIT(KSync,                                 "sync");
    1.82 +/*@}*/
    1.83 +
    1.84 +/*@{*/
    1.85 +//LIT's to identify commands
    1.86 +_LIT(KCmdNewL,								"NewL");
    1.87 +_LIT(KCmdDestructor,						"~");
    1.88 +_LIT(KCmdInitialize,						"Initialize");
    1.89 +_LIT(KCmdStart,								"Start");
    1.90 +_LIT(KCmdStop,								"Stop");
    1.91 +_LIT(KCmdPause,								"Pause");
    1.92 +_LIT(KCmdResume,							"Resume");
    1.93 +_LIT(KCmdSetRotateOptionsL,					"SetRotateOptionsL");
    1.94 +_LIT(KCmdSetScaleOptionsL,					"SetScaleOptionsL");
    1.95 +_LIT(KCmdSetPosition,						"SetPosition");
    1.96 +_LIT(KCmdSetClockSource,					"SetClockSource");
    1.97 +_LIT(KCmdSelectDecoderL,					"SelectDecoderL");
    1.98 +_LIT(KCmdSetInputFormat,					"SetInputFormat");
    1.99 +_LIT(KCmdSelectPostProcessorL,				"SelectPostProcessorL");
   1.100 +_LIT(KCmdPostProcessorInfoLC,				"PostProcessorInfoLC");
   1.101 +_LIT(KCmdFindCommonFormat,					"FindCommonFormat");
   1.102 +_LIT(KCmdSetOutputFormatL,					"SetOutputFormatL");
   1.103 +_LIT(KCmdGetHeaderInformationL,				"GetHeaderInformationL");
   1.104 +_LIT(KCmdReturnHeader,						"ReturnHeader");
   1.105 +_LIT(KCmdSetVideoDestScreenL,				"SetVideoDestScreenL");
   1.106 +_LIT(KCmdGetBufferOptions,					"GetBufferOptions");
   1.107 +_LIT(KCmdSetBufferOptionsL,					"SetBufferOptionsL");
   1.108 +_LIT(KCmdSetPostProcessTypesL,				"SetPostProcessTypesL");
   1.109 +_LIT(KCmdGetOutputFormatListL,				"GetOutputFormatListL");
   1.110 +_LIT(KCmdAbortDirectScreenAccess,			"AbortDirectScreenAccess");
   1.111 +_LIT(KCmdStartDirectScreenAccess,			"StartDirectScreenAccess");
   1.112 +_LIT(KCmdUtilityGetEnvironment,  			"UtilityGetEnvironment");
   1.113 +/*@}*/
   1.114 +_LIT(KCmdH264CreateDecTest,  				"H264CreateDecTest");
   1.115 +_LIT(KCmdH264SelectPostProcessor,           "H264SelectPostProcessor");
   1.116 +_LIT(KCmdH264SetPostProcessTypes,           "H264SetPostProcessTypes");
   1.117 +_LIT(KCmdH264SetInputFormatCompr,			"H264SetInputFormatCompr");	
   1.118 +_LIT(KCmdH264SetOutputFormat,				"H264SetOutputFormat");
   1.119 +_LIT(KCmdH264SetBufferOptions,				"H264SetBufferOptions");
   1.120 +_LIT(KCmdH264ListFrameSize,                 "H264ListFrameSize");
   1.121 +_LIT(KCmdH264SetVideoDestScreen,            "H264SetVideoDestScreen"); 
   1.122 +_LIT(KCmdH264SetWindowRect,                 "H264SetWindowRect");    
   1.123 +_LIT(KCmdH264Initialize,					"H264Initialize");
   1.124 +_LIT(KCmdH264Start,							"H264Start");
   1.125 +_LIT(KCmdH264Stop,							"H264Stop");
   1.126 +_LIT(KCmdH264Pause,                         "H264Pause");
   1.127 +_LIT(KCmdH264Resume,                        "H264Resume");
   1.128 +_LIT(KCmdH264IOFrameMatch,					"H264IOFrameMatch");
   1.129 +_LIT(KCmdH264FindCommonFormats,             "H264FindCommonFormats");    
   1.130 +_LIT(KCmdH264GetHeaderInformation,          "H264GetHeaderInformation");
   1.131 +_LIT(KCmdH264EnableSynchronization,         "H264EnableSynchronization");
   1.132 +_LIT(KCmdH264SetScaleOptions,               "H264SetScaleOptions");
   1.133 +_LIT(KCmdH264SetRotateOptions,              "H264SetRotateOptions");
   1.134 +_LIT(KCmdH264SynchronizeDecoding,           "H264SynchronizeDecoding");
   1.135 +_LIT(KCmdH264Delete,                        "H264Delete");
   1.136 +_LIT(KCmdH264SetPosition,                   "H264SetPosition");
   1.137 +_LIT(KCmdH264AbortDirectScreenAccess,       "H264AbortDirectScreenAccess");
   1.138 +
   1.139 +/*@{*/
   1.140 +_LIT(KNoCodec,								"ENoCodec");
   1.141 +_LIT(KH263,									"EH263");
   1.142 +_LIT(KMPEG4,								"EMPEG4");
   1.143 +_LIT(KH264,									"EH264");
   1.144 +_LIT(KRV9,									"ERV9");
   1.145 +/*@}*/
   1.146 +
   1.147 +const CDataWrapperBase::TEnumEntryTable	CT_CMMFDevVideoPlay::iCodecs[] =
   1.148 +	{
   1.149 +	KNoCodec,	ENoCodec,
   1.150 +	KH263,		EH263,
   1.151 +	KMPEG4,		EMPEG4,
   1.152 +	KH264,		EH264,
   1.153 +	KRV9,		ERV9
   1.154 +	};
   1.155 +
   1.156 +/*@{*/
   1.157 +//LIT's for display mode
   1.158 +_LIT(KNone,									"ENone");
   1.159 +_LIT(KGray2,								"EGray2");
   1.160 +_LIT(KGray4,								"EGray4");
   1.161 +_LIT(KGray16,								"EGray16");
   1.162 +_LIT(KGray256,								"EGray256");
   1.163 +_LIT(KColor16,								"EColor16");
   1.164 +_LIT(KColor256,								"EColor256");
   1.165 +_LIT(KColor64K,								"EColor64K");
   1.166 +_LIT(KColor16M,								"EColor16M");
   1.167 +_LIT(KRgb,									"ERgb");
   1.168 +_LIT(KColor4K,								"EColor4K");
   1.169 +_LIT(KColor16MU,							"EColor16MU");
   1.170 +_LIT(KColor16MA,							"EColor16MA");
   1.171 +_LIT(KColorLast,							"EColorLast");
   1.172 +/*@}*/
   1.173 +
   1.174 +const CDataWrapperBase::TEnumEntryTable	CT_CMMFDevVideoPlay::iDisplayModes[] =
   1.175 +	{
   1.176 +	KNone,		ENone,
   1.177 +	KGray2,		EGray2,
   1.178 +	KGray4,		EGray4,
   1.179 +	KGray16,	EGray16,
   1.180 +	KGray256,	EGray256,
   1.181 +	KColor16,	EColor16,
   1.182 +	KColor256,	EColor256,
   1.183 +	KColor64K,	EColor64K,
   1.184 +	KColor16M,	EColor16M,
   1.185 +	KRgb,		ERgb,
   1.186 +	KColor4K,	EColor4K,
   1.187 +	KColor16MU,	EColor16MU,
   1.188 +	KColor16MA,	EColor16MA,
   1.189 +	KColorLast,	EColorLast,
   1.190 +	KColor64K,	EColor64K,
   1.191 +	};
   1.192 +
   1.193 +/*@{*/
   1.194 +//LIT's for rotation
   1.195 +_LIT(KRotateNone,							"ERotateNone");
   1.196 +_LIT(KRotate90Clockwise,					"ERotate90Clockwise");
   1.197 +_LIT(KRotate90Anticlockwise,				"ERotate90Anticlockwise");
   1.198 +_LIT(KRotate180,							"ERotate180");
   1.199 +/*@}*/
   1.200 +const CDataWrapperBase::TEnumEntryTable	CT_CMMFDevVideoPlay::iRotations[] =
   1.201 +	{
   1.202 +	KRotateNone,			ERotateNone,
   1.203 +	KRotate90Clockwise,		ERotate90Clockwise,
   1.204 +	KRotate90Anticlockwise,	ERotate90Anticlockwise,
   1.205 +	KRotate180,				ERotate180
   1.206 +	};
   1.207 +
   1.208 +/*@{*/
   1.209 +//LIT's for Video Data Unit Type
   1.210 +_LIT(KEDuCodedPicture,						"EDuCodedPicture");
   1.211 +_LIT(KEDuVideoSegment,						"EDuVideoSegment");
   1.212 +_LIT(KEDuSeveralSegments,					"EDuSeveralSegments");
   1.213 +_LIT(KEDuArbitraryStreamSection,			"EDuArbitraryStreamSection");
   1.214 +/*@}*/
   1.215 +
   1.216 +const CDataWrapperBase::TEnumEntryTable	CT_CMMFDevVideoPlay::iTVideoDataUnitType[] =
   1.217 +	{
   1.218 +	KEDuCodedPicture,				EDuCodedPicture,
   1.219 +	KEDuVideoSegment,				EDuVideoSegment,
   1.220 +	KEDuSeveralSegments,			EDuSeveralSegments,
   1.221 +	KEDuArbitraryStreamSection,		EDuArbitraryStreamSection 
   1.222 +	};
   1.223 +
   1.224 +/*@{*/
   1.225 +//LIT's for video data unit encapsulation
   1.226 +_LIT(KEDuElementaryStream,					"EDuElementaryStream");
   1.227 +_LIT(KEDuGenericPayload,					"EDuGenericPayload");
   1.228 +_LIT(KEDuRtpPayload,						"EDuRtpPayload");
   1.229 +/*@}*/
   1.230 +const CDataWrapperBase::TEnumEntryTable	CT_CMMFDevVideoPlay::iTVideoDataUnitEncapsulation[] =
   1.231 +	{
   1.232 +	KEDuElementaryStream,	EDuElementaryStream,
   1.233 +	KEDuGenericPayload,		EDuGenericPayload,
   1.234 +	KEDuRtpPayload,			EDuRtpPayload
   1.235 +	};
   1.236 +
   1.237 +//H264
   1.238 +// -----------------------------------------------------------------------------
   1.239 +// class CEngineObserver
   1.240 +// -----------------------------------------------------------------------------
   1.241 +//
   1.242 +CEngineObserver::CEngineObserver(CT_CMMFDevVideoPlay& aTestClass) :
   1.243 +  iTestClass(aTestClass)
   1.244 +    {
   1.245 +    
   1.246 +    }
   1.247 +void CEngineObserver::MvdeStreamEndReached()
   1.248 +    {
   1.249 +    iTestClass.DecOutstanding();
   1.250 +    }
   1.251 +void CEngineObserver::MvdeSetError(TInt aError)
   1.252 +    {
   1.253 +    iTestClass.SetError(aError);
   1.254 +    }
   1.255 +
   1.256 +/**
   1.257 + * Public destructor
   1.258 + */
   1.259 +CT_CMMFDevVideoPlay::~CT_CMMFDevVideoPlay()
   1.260 +	{
   1.261 +	INFO_PRINTF1(_L("CT_CMMFDevVideoPlay Destructor In"));
   1.262 +	if(!iUse264)
   1.263 +	    {
   1.264 +	    if(iDsaStarted)
   1.265 +	        {
   1.266 +	        iDevvp->AbortDirectScreenAccess();      
   1.267 +	        iDsaStarted = EFalse;
   1.268 +	        }
   1.269 +	    DestroyData();
   1.270 +	    }
   1.271 +
   1.272 +    iUse264 = EFalse;
   1.273 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay Destructor Out"));
   1.274 +	}
   1.275 +
   1.276 +/**
   1.277 + * Return a pointer to the object that the data wraps
   1.278 + * @return	pointer to the object that the data wraps
   1.279 + */
   1.280 +TAny* CT_CMMFDevVideoPlay::GetObject()
   1.281 +	{
   1.282 +	return iDevvp;
   1.283 +	}
   1.284 +
   1.285 +/**
   1.286 + * Command that destroy the wrapped object and helper objects
   1.287 + */ 
   1.288 +void CT_CMMFDevVideoPlay::DoCmdDestructor()
   1.289 +	{
   1.290 +	DestroyData();	
   1.291 +	if ( iFileOpen )
   1.292 +		{
   1.293 +		CloseFile();
   1.294 +		iFileOpen = EFalse;
   1.295 +		}
   1.296 +	if ( iDsaStarted )
   1.297 +		{
   1.298 +		iDevvp->AbortDirectScreenAccess();      
   1.299 +		iDsaStarted = EFalse;
   1.300 +		}      		
   1.301 +	//Postproc input buffer
   1.302 +	if ( !iCIBuffMgmtOn && iRawInBuffer)
   1.303 +		{ 
   1.304 +		delete (TUint8*)iRawInBuffer->iData.iRawData->Ptr();
   1.305 +		delete iRawInBuffer->iData.iRawData;
   1.306 +		delete iRawInBuffer;
   1.307 +		iRawInBuffer = NULL;
   1.308 +		}    	
   1.309 +	if(iScreenDevice)
   1.310 +		{
   1.311 +		delete iScreenDevice;
   1.312 +		iScreenDevice = NULL;
   1.313 +		RFbsSession::Disconnect();
   1.314 +		}		
   1.315 +	if(iClock)
   1.316 +		{
   1.317 +		delete iClock;
   1.318 +		iClock = NULL;
   1.319 +		}		
   1.320 +	iFrameSizeList.Close();
   1.321 +	iFs.Close();
   1.322 +	REComSession::FinalClose(); 	
   1.323 +	if(iInfo)
   1.324 +		{
   1.325 +		delete iInfo;
   1.326 +		iInfo=NULL;
   1.327 +		}	
   1.328 +	while(Outstanding())
   1.329 +		{
   1.330 +		INFO_PRINTF1(_L("DoCmdDestructor DecOutstanding()"));
   1.331 +		DecOutstanding();
   1.332 +		}
   1.333 +	}
   1.334 +
   1.335 +/**
   1.336 + * Helper method tha destroy the wrapped object
   1.337 + */
   1.338 +void CT_CMMFDevVideoPlay::DestroyData()
   1.339 +{
   1.340 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DestroyData")); 
   1.341 +	// Delete Devvideo play 
   1.342 +	delete iDevvp;
   1.343 +	iDevvp = NULL;
   1.344 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DestroyData"));
   1.345 +}
   1.346 +
   1.347 +/**
   1.348 + * Two phase constructor
   1.349 + *
   1.350 + * @leave	system wide error
   1.351 + */
   1.352 +CT_CMMFDevVideoPlay* CT_CMMFDevVideoPlay::NewL()
   1.353 +	{	
   1.354 +	CT_CMMFDevVideoPlay*	ret=new (ELeave) CT_CMMFDevVideoPlay();
   1.355 +	CleanupStack::PushL(ret);
   1.356 +	ret->ConstructL();
   1.357 +	CleanupStack::Pop(ret);
   1.358 +	return ret;		
   1.359 +	}
   1.360 +
   1.361 +/**
   1.362 + * Protected constructor. First phase construction
   1.363 + */
   1.364 +CT_CMMFDevVideoPlay::CT_CMMFDevVideoPlay()
   1.365 +	:
   1.366 +	iDevvp(NULL),
   1.367 +	iDecHWDevId(0),
   1.368 +	iPostProcId(0),
   1.369 +	iInBuffSize(0),
   1.370 +	iInputEnd(EFalse),
   1.371 +	iDsaStarted(EFalse),
   1.372 +	iSynchronized(EFalse),
   1.373 +	iFrameListed(EFalse),
   1.374 +	iPictureSize(0,0),
   1.375 +	iAsyncErrorIndex(0),
   1.376 +	iFileOpen(EFalse),
   1.377 +	iCodedInBuffer(NULL),
   1.378 +	iOutBuffer(NULL),
   1.379 +	iRawInBuffer(NULL),
   1.380 +	iTimeStamp(0),
   1.381 +	iFrameTimeInterval(0),
   1.382 +	iSentBuffCount(0),
   1.383 +	iReturnedBuffCount(0),
   1.384 +	iPictureLoss(0),
   1.385 +	iStreamEnd(EFalse),
   1.386 +	iCodecType(EH263),
   1.387 +	iClock(NULL),
   1.388 +	iDirectScreenAccess(EFalse),
   1.389 +	iCIBuffMgmtOn(EFalse),
   1.390 +	iFrameMeasurement(EFalse),
   1.391 +	iCommonFormatFound(EFalse),
   1.392 +	iErrorInputBuffer(EFalse),
   1.393 +	iEngine(NULL),
   1.394 +	iObserver(NULL),
   1.395 +	iUse264(EFalse),
   1.396 +	iFrameRate(15)
   1.397 +	{
   1.398 +	}
   1.399 +
   1.400 +/**
   1.401 + * Second phase construction
   1.402 + * @internalComponent
   1.403 + * @return	N/A
   1.404 + * @pre		None
   1.405 + * @post	None * @leave	system wide error
   1.406 + */
   1.407 +void CT_CMMFDevVideoPlay::ConstructL()
   1.408 +	{		
   1.409 +    iClock = CSystemClockSource::NewL();
   1.410 +	}
   1.411 +
   1.412 +/**
   1.413 + * Process a command read from the ini file
   1.414 + * @param aCommand			The command to process
   1.415 + * @param aSection			The section in the ini containing data for the command
   1.416 + * @param aAsyncErrorIndex	Command index for async calls to return errors to 
   1.417 + * @return					ETrue if the command is processed *
   1.418 + * @leave					System wide error
   1.419 + */
   1.420 +TBool CT_CMMFDevVideoPlay::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection,
   1.421 +											 const TInt aAsyncErrorIndex)
   1.422 +	{	
   1.423 +	TBool	ret=ETrue;
   1.424 +
   1.425 +	if ( aCommand==KCmdDestructor )
   1.426 +		{
   1.427 +		DoCmdDestructor();
   1.428 +		}
   1.429 +	else if ( aCommand==KCmdNewL )
   1.430 +		{
   1.431 +		DoCmdNewL(aSection);
   1.432 +		}
   1.433 +	else if ( aCommand==KCmdInitialize )
   1.434 +		{
   1.435 +		DoCmdInitialize(aAsyncErrorIndex);
   1.436 +		}
   1.437 +	else if ( aCommand==KCmdStart )
   1.438 +		{
   1.439 +		DoCmdStart(aAsyncErrorIndex);
   1.440 +		}
   1.441 +	else if ( aCommand==KCmdStop )
   1.442 +		{
   1.443 +		DoCmdStop();
   1.444 +		}
   1.445 +	else if ( aCommand==KCmdSetPosition )
   1.446 +		{
   1.447 +		DoCmdSetPosition(aSection);
   1.448 +		}
   1.449 +	else if ( aCommand==KCmdPause )
   1.450 +		{
   1.451 +		DoCmdPause();
   1.452 +		}
   1.453 +	else if ( aCommand==KCmdResume )
   1.454 +		{
   1.455 +		DoCmdResume();
   1.456 +		}
   1.457 +	else if ( aCommand==KCmdSetRotateOptionsL )
   1.458 +		{
   1.459 +		DoCmdSetRotateOptionsL(aSection);
   1.460 +		}
   1.461 +	else if ( aCommand==KCmdSetScaleOptionsL )
   1.462 +		{
   1.463 +		DoCmdSetScaleOptionsL(aSection);
   1.464 +		}
   1.465 +	else if ( aCommand==KCmdSetClockSource )
   1.466 +		{
   1.467 +		DoCmdSetClockSource(aSection);
   1.468 +		}
   1.469 +	else if ( aCommand==KCmdSelectDecoderL )
   1.470 +		{
   1.471 +		DoCmdSelectDecoderL(aSection);
   1.472 +		}
   1.473 +	else if ( aCommand==KCmdSelectPostProcessorL )
   1.474 +		{
   1.475 +		DoCmdSelectPostProcessorL(aSection);
   1.476 +		}
   1.477 +	else if ( aCommand==KCmdPostProcessorInfoLC )
   1.478 +		{
   1.479 +		DoCmdPostProcessorInfoLC();
   1.480 +		}
   1.481 +	else if ( aCommand==KCmdGetOutputFormatListL )
   1.482 +		{
   1.483 +		DoCmdGetOutputFormatListL(aSection);
   1.484 +		}	
   1.485 +	else if ( aCommand==KCmdFindCommonFormat )
   1.486 +		{
   1.487 +		DoCmdFindCommonFormat();
   1.488 +		}
   1.489 +	else if ( aCommand==KCmdSetOutputFormatL )
   1.490 +		{
   1.491 +		DoCmdSetOutputFormatL(aSection);
   1.492 +		}
   1.493 +	else if ( aCommand==KCmdGetHeaderInformationL )
   1.494 +		{
   1.495 +		DoCmdGetHeaderInformationL(aSection);
   1.496 +		}	
   1.497 +	else if ( aCommand==KCmdReturnHeader )
   1.498 +		{
   1.499 +		DoCmdReturnHeader();
   1.500 +		}	
   1.501 +	else if ( aCommand==KCmdSetVideoDestScreenL )
   1.502 +		{
   1.503 +		DoCmdSetVideoDestScreenL();
   1.504 +		}
   1.505 +	else if ( aCommand==KCmdGetBufferOptions )
   1.506 +		{
   1.507 +		DoCmdGetBufferOptions();
   1.508 +		}
   1.509 +	else if ( aCommand==KCmdSetBufferOptionsL )
   1.510 +		{
   1.511 +		DoCmdSetBufferOptionsL();
   1.512 +		}	
   1.513 +	else if ( aCommand==KCmdSetPostProcessTypesL )
   1.514 +		{
   1.515 +		DoCmdSetPostProcessTypesL(aSection);
   1.516 +		}
   1.517 +	else if ( aCommand==KCmdSetInputFormat )
   1.518 +		{
   1.519 +		DoCmdSetInputFormatL(aSection);
   1.520 +		}
   1.521 +	else if ( aCommand==KCmdStartDirectScreenAccess )
   1.522 +		{
   1.523 +		DoCmdStartDirectScreenAccessL(aSection);
   1.524 +		}
   1.525 +	else if ( aCommand==KCmdAbortDirectScreenAccess )
   1.526 +		{
   1.527 +		DoCmdAbortDirectScreenAccess();
   1.528 +		}
   1.529 +	else if ( aCommand==KCmdUtilityGetEnvironment )
   1.530 +		{
   1.531 +		DoCmdUtilityGetEnvironmentL();
   1.532 +		}
   1.533 +	else if ( aCommand==KCmdH264CreateDecTest)
   1.534 +		{
   1.535 +		DoCmdH264CreateDecTest(aSection);
   1.536 +		}
   1.537 +	else if (aCommand==KCmdH264SelectPostProcessor)
   1.538 +	    {
   1.539 +	    DoCmdH264SelectPostProcessor(aSection);
   1.540 +	    }
   1.541 +	else if (aCommand==KCmdH264SetPostProcessTypes)
   1.542 +	    {
   1.543 +	    DoCmdH264SetPostProcessTypes(aSection);
   1.544 +	    }
   1.545 +	else if (aCommand==KCmdH264SetInputFormatCompr)
   1.546 +		{
   1.547 +		DoCmdH264SetInputFormatCompr(aSection);
   1.548 +		}
   1.549 +	else if (aCommand==KCmdH264SetOutputFormat)
   1.550 +		{
   1.551 +		DoCmdH264SetOutputFormat(aSection);
   1.552 +		}
   1.553 +	else if (aCommand==KCmdH264SetBufferOptions)
   1.554 +		{
   1.555 +		DoCmdH264SetBufferOptions(aSection);
   1.556 +		}
   1.557 +	else if (aCommand==KCmdH264ListFrameSize)
   1.558 +	    {
   1.559 +	    DoCmdH264ListFrameSize();
   1.560 +	    }
   1.561 +	else if (aCommand==KCmdH264SetVideoDestScreen)
   1.562 +	    {
   1.563 +	    DoCmdH264SetVideoDestScreen(aSection);
   1.564 +	    }
   1.565 +	else if (aCommand==KCmdH264SetWindowRect)
   1.566 +	    {
   1.567 +	    DoCmdH264SetWindowRect(aSection);
   1.568 +	    }
   1.569 +	else if (aCommand==KCmdH264Initialize)
   1.570 +		{
   1.571 +		DoCmdH264Initialize();
   1.572 +		}
   1.573 +	else if (aCommand==KCmdH264Start)
   1.574 +		{
   1.575 +		DoCmdH264Start(aSection);
   1.576 +		}
   1.577 +	else if (aCommand==KCmdH264IOFrameMatch)
   1.578 +		{
   1.579 +		DoCmdH264IOFrameNumMatch();
   1.580 +		}
   1.581 +	else if (aCommand==KCmdH264Stop)
   1.582 +		{
   1.583 +		DoCmdH264Stop();
   1.584 +		}
   1.585 +	else if (aCommand==KCmdH264GetHeaderInformation)
   1.586 +	    {
   1.587 +	    DoCmdH264GetHeaderInformation(aSection);
   1.588 +	    }
   1.589 +	else if (aCommand==KCmdH264FindCommonFormats)
   1.590 +	    {
   1.591 +	    DoCmdH264FindCommonFormats();
   1.592 +	    }
   1.593 +	else if (aCommand==KCmdH264EnableSynchronization)
   1.594 +	    {
   1.595 +	    DoCmdH264EnableSynchronization(aSection);
   1.596 +	    }
   1.597 +	else if (aCommand==KCmdH264SetScaleOptions)
   1.598 +	    {
   1.599 +	    DoCmdH264SetScaleOptions(aSection);
   1.600 +	    }
   1.601 +	else if (aCommand==KCmdH264SetRotateOptions)
   1.602 +	    {
   1.603 +	    DoCmdH264SetRotateOptions(aSection);
   1.604 +	    }
   1.605 +	else if (aCommand==KCmdH264SynchronizeDecoding)
   1.606 +	    {
   1.607 +	    DoCmdH264SynchronizeDecoding(aSection);
   1.608 +	    }
   1.609 +	else if (aCommand==KCmdH264Delete)
   1.610 +	    {
   1.611 +	    DoCmdH264Delete();
   1.612 +	    }
   1.613 +    else if (aCommand==KCmdH264Pause)
   1.614 +        {
   1.615 +        DoCmdH264Pause();
   1.616 +        }
   1.617 +    else if (aCommand==KCmdH264Resume)
   1.618 +        {
   1.619 +        DoCmdH264Resume();
   1.620 +        }
   1.621 +    else if (aCommand==KCmdH264SetPosition)
   1.622 +        {
   1.623 +        DoCmdH264SetPosition(aSection);
   1.624 +        }
   1.625 +	else if (aCommand==KCmdH264AbortDirectScreenAccess)
   1.626 +		{
   1.627 +		DoCmdH264AbortDirectScreenAccess();
   1.628 +		}
   1.629 +	else
   1.630 +		{
   1.631 +		ERR_PRINTF1(_L("Unknown command"));
   1.632 +		ret = EFalse;
   1.633 +		}
   1.634 +	return ret;
   1.635 +	}
   1.636 +
   1.637 +/**
   1.638 + * Constructs CMMFDevVideoPlay instance and initialize params.
   1.639 + * @param	aSection	- The section to read from the ini file
   1.640 + * @return	none
   1.641 + */
   1.642 +void CT_CMMFDevVideoPlay::DoCmdNewL(const TTEFSectionName& aSection)
   1.643 +	{
   1.644 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdNewL"));
   1.645 +	TBool dataOk = ETrue;
   1.646 +	DestroyData();	
   1.647 +	TRAPD(err, iDevvp = CMMFDevVideoPlay::NewL(*this));
   1.648 +	if ( err!=KErrNone)
   1.649 +		{
   1.650 +		ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), err);
   1.651 +		SetError (err);
   1.652 +		dataOk = EFalse;
   1.653 +		}	
   1.654 +	if(dataOk)
   1.655 +		{
   1.656 +		TRAP(err, InitializeParamsL(aSection));	
   1.657 +		if (err != KErrNone)
   1.658 +			{
   1.659 +			ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed in InitializeParamsL. Error: %d"), err);
   1.660 +			SetError (err);
   1.661 +			}
   1.662 +		CreateFiles(aSection);	
   1.663 +		}	
   1.664 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdNewL"));
   1.665 +	}  
   1.666 +
   1.667 +/**
   1.668 + * Open File session
   1.669 + */ 
   1.670 +void CT_CMMFDevVideoPlay::CreateFiles(const TTEFSectionName& aSection)
   1.671 +	{     
   1.672 +	TPtrC inputPath;
   1.673 +	TPtrC outputPath;
   1.674 +	TPtrC inputfile;
   1.675 +	TPtrC outputfile;
   1.676 +	TBool screenout = EFalse;
   1.677 +	TInt error = KErrNone;
   1.678 +	TBool dataOk = ETrue;
   1.679 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::CreateFiles"));
   1.680 +	
   1.681 +	if ( !(GetBoolFromConfig(aSection, KScreenout(), screenout)))
   1.682 +		{
   1.683 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScreenout());
   1.684 +		SetBlockResult(EFail);
   1.685 +		dataOk = EFalse;
   1.686 +		}
   1.687 +	if ( !(GetStringFromConfig(aSection, KInputfile(),inputfile)))
   1.688 +		{
   1.689 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputfile());
   1.690 +		SetBlockResult(EFail);
   1.691 +		dataOk = EFalse;
   1.692 +		}
   1.693 +	if ( !screenout)
   1.694 +		{
   1.695 +		if ( !(GetStringFromConfig(aSection, KOutputfile(),outputfile)))
   1.696 +			{
   1.697 +			ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputfile());
   1.698 +			SetBlockResult(EFail);
   1.699 +			dataOk = EFalse;
   1.700 +			}
   1.701 +		} 
   1.702 +	if ( !(GetStringFromConfig(aSection, KInputPath(),inputPath)))
   1.703 +		{
   1.704 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputPath());
   1.705 +		SetBlockResult(EFail);
   1.706 +		dataOk = EFalse;
   1.707 +		}			
   1.708 +	if(dataOk)
   1.709 +		{		
   1.710 +		error = iFs.Connect ();
   1.711 +		if ( error!=KErrNone)
   1.712 +			{
   1.713 +			ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), error);
   1.714 +			SetError (error);
   1.715 +			}
   1.716 +		else
   1.717 +			{
   1.718 +			TFileName inFileName(inputPath);
   1.719 +			inFileName.Append (inputfile);
   1.720 +			//Open File
   1.721 +			if ( screenout)
   1.722 +				{
   1.723 +				TRAPD(err, OpenFileL(inFileName));
   1.724 +				if ( err != KErrNone)
   1.725 +					{
   1.726 +					ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), err);
   1.727 +					SetError (err);
   1.728 +					}
   1.729 +				iFileOpen = ETrue;
   1.730 +				INFO_PRINTF1(_L("File Opened!"));
   1.731 +				}
   1.732 +			else
   1.733 +				{
   1.734 +				if ( ! (GetStringFromConfig(aSection, KOutputPath(),outputPath)))
   1.735 +					{
   1.736 +					ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputPath());
   1.737 +					SetBlockResult(EFail);
   1.738 +					}
   1.739 +				TFileName outFileName(outputPath);
   1.740 +				outFileName.Append (outputfile);
   1.741 +				TRAPD(err, OpenFileL(outFileName, inFileName));
   1.742 +				if ( err != KErrNone)
   1.743 +					{
   1.744 +					ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::OpenFileL failed with error %d"), err);
   1.745 +					SetError (err);
   1.746 +					}
   1.747 +				iFileOpen = ETrue;
   1.748 +				}
   1.749 +			}												
   1.750 +		}	
   1.751 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::CreateFiles"));
   1.752 +	}
   1.753 +
   1.754 +/**
   1.755 + * Initilize Engine parameters 
   1.756 + * @param	aSection	-	The section to read from the ini file
   1.757 + * @return	none
   1.758 + */
   1.759 +void CT_CMMFDevVideoPlay::InitializeParamsL(const TTEFSectionName& aSection)
   1.760 +	{
   1.761 +	TInt codec = 0;
   1.762 +	TBool dataOk = ETrue;
   1.763 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::InitializeParamsL"));
   1.764 +	if ( !(GetEnumFromConfig(aSection, KCodec(), iCodecs, codec)))
   1.765 +		{
   1.766 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCodec());
   1.767 +		SetBlockResult(EFail);
   1.768 +		dataOk = EFalse;
   1.769 +		}	
   1.770 +	if ( !(GetBoolFromConfig(aSection, KScreenout(), iDirectScreenAccess)))
   1.771 +		{
   1.772 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScreenout());
   1.773 +		SetBlockResult(EFail);
   1.774 +		dataOk = EFalse;
   1.775 +		}
   1.776 +	
   1.777 +	if(dataOk)
   1.778 +		{
   1.779 +		iCodecType=(TVideoCodec)codec;
   1.780 +		if (iDirectScreenAccess)
   1.781 +			{
   1.782 +			User::LeaveIfError(FbsStartup());
   1.783 +			}
   1.784 +		}	
   1.785 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::InitializeParamsL"));
   1.786 +	}
   1.787 +
   1.788 +/**
   1.789 + * Sets the clock source in case the sync parameter is true
   1.790 + * @param	aSection	- The section to read from the ini file
   1.791 + * @return	none
   1.792 + */
   1.793 +void CT_CMMFDevVideoPlay::DoCmdSetClockSource(const TTEFSectionName& aSection)
   1.794 +	{
   1.795 +	TInt framerate = 0;
   1.796 +	TInt synch = 0;
   1.797 +	TBool dataOk = ETrue;
   1.798 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetClockSource"));	
   1.799 +	if ( !( GetIntFromConfig(aSection, KFramerate(), framerate)) )
   1.800 +        {
   1.801 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFramerate());
   1.802 +        SetBlockResult(EFail);
   1.803 +        dataOk = EFalse;
   1.804 +        }
   1.805 +	if ( !( GetIntFromConfig(aSection,KSynch(), synch)) )
   1.806 +        {
   1.807 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSynch());
   1.808 +        SetBlockResult(EFail);
   1.809 +        dataOk = EFalse;
   1.810 +        }
   1.811 +	if(dataOk)
   1.812 +		{
   1.813 +		if (synch) //Set Clock and frame rate for syncronization    
   1.814 +	       	{    
   1.815 +	       	TRAPD(err, ListFrameSizeL(iCodecType));
   1.816 +	    	if ( err != KErrNone)
   1.817 +	    		{
   1.818 +	    		ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::ListFrameSizeL failed with error %d"), err);
   1.819 +	    		SetError (err);
   1.820 +	    		}
   1.821 +	    	else
   1.822 +	    		{
   1.823 +	    		INFO_PRINTF1(_L("List Frame done!"));    	
   1.824 +		       	iDevvp->SetClockSource(iClock);  
   1.825 +		        iSynchronized = ETrue;
   1.826 +		        iFrameTimeInterval = (TInt64)(1000000/framerate);
   1.827 +		        iFramerate = framerate;
   1.828 +	    		}	    	
   1.829 +	       	}
   1.830 +		}		
   1.831 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetClockSource"));
   1.832 +	}
   1.833 +
   1.834 +/**
   1.835 + * Gets the decoders list and Select a Decoder
   1.836 + * @param	aSection	-	Section to read from the ini file
   1.837 + * @return none
   1.838 + */
   1.839 +void CT_CMMFDevVideoPlay::DoCmdSelectDecoderL(const TTEFSectionName& aSection)
   1.840 +	{
   1.841 +	TInt decoder;
   1.842 +	TBool dataOk = ETrue;
   1.843 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSelectDecoder"));
   1.844 +	if ( !(GetHexFromConfig(aSection, KDecoder(), decoder)))
   1.845 +		{
   1.846 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDecoder());
   1.847 +		SetBlockResult(EFail);
   1.848 +		dataOk = EFalse;
   1.849 +		}
   1.850 +	if(dataOk)
   1.851 +		{
   1.852 +		iSelectDecoder=TUid::Uid(decoder);
   1.853 +		TRAPD(err, iDecHWDevId = iDevvp->SelectDecoderL(iSelectDecoder));
   1.854 +		if (err != KErrNone)
   1.855 +			{
   1.856 +			ERR_PRINTF2(_L("SelectDecoderL left with error: %d"), err);
   1.857 +			SetError(err);
   1.858 +			}
   1.859 +		}	
   1.860 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSelectDecoder"));
   1.861 +	}
   1.862 +
   1.863 +/**
   1.864 + * Gets the postprocessores list and Select a PostProcessor
   1.865 + * @param	aSection	-	Section to read from the ini file
   1.866 + * @return	none
   1.867 + */
   1.868 +void CT_CMMFDevVideoPlay::DoCmdSelectPostProcessorL(const TTEFSectionName& aSection)
   1.869 +	{
   1.870 +	TInt postPro;
   1.871 +	TBool dataOk = ETrue;
   1.872 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSelectPostProcessor"));
   1.873 +	if ( !(GetHexFromConfig(aSection, KPostPro(), postPro)))
   1.874 +		{
   1.875 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDecoder());
   1.876 +		SetBlockResult(EFail);
   1.877 +		dataOk = EFalse;
   1.878 +		}
   1.879 +	if(dataOk)
   1.880 +		{
   1.881 +		iSelectPostProcessor=TUid::Uid(postPro);
   1.882 +		TRAPD(err, iPostProcId = iDevvp->SelectPostProcessorL(iSelectPostProcessor));
   1.883 +		if (err != KErrNone)
   1.884 +			{
   1.885 +			ERR_PRINTF2(_L("SelectPostProcessorL left with error %d"), err);
   1.886 +	        SetError(err);
   1.887 +			}
   1.888 +		}	
   1.889 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSelectPostProcessor"));
   1.890 +	}
   1.891 +
   1.892 +/**
   1.893 + * Sets the input format for the decoder and the postprocessor
   1.894 + * @param	aSection	-	Section to read from the ini file
   1.895 + * @return	none
   1.896 + */
   1.897 +void CT_CMMFDevVideoPlay::DoCmdSetInputFormatL(const TTEFSectionName& aSection)
   1.898 +	{
   1.899 +	TBuf8<50> mimetype;
   1.900 +	TBool useDecoder = ETrue;
   1.901 +	TInt tVideoDataUnitType = EDuCodedPicture;
   1.902 +	TInt tVideoDataUnitEncapsulation = EDuElementaryStream;
   1.903 +	TBool dataInOrder=ETrue;	
   1.904 +	TPtrC mimeType;
   1.905 +	TBool dataOk = ETrue;
   1.906 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetInputFormat"));
   1.907 +	if(!GetStringFromConfig(aSection, KMimeType(), mimeType))
   1.908 +		{
   1.909 +		ERR_PRINTF1(_L("Mime type not retrieved, command will not be executed"));
   1.910 +		SetBlockResult(EFail);
   1.911 +		dataOk = EFalse;
   1.912 +		}
   1.913 +	if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
   1.914 +		{
   1.915 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
   1.916 +		SetBlockResult(EFail);
   1.917 +		dataOk = EFalse;
   1.918 +		}
   1.919 +		
   1.920 +	if( !(GetBoolFromConfig(aSection, KDataInOrder(), dataInOrder)))
   1.921 +		{
   1.922 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KDataInOrder());
   1.923 +		}			
   1.924 +	if(! (GetEnumFromConfig(aSection, KTVideoDataUnitType(), iTVideoDataUnitType,tVideoDataUnitType)))
   1.925 +		{
   1.926 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KTVideoDataUnitType());
   1.927 +		}
   1.928 +	if( !(GetEnumFromConfig(aSection, KTVideoDataUnitEncapsulation(), iTVideoDataUnitEncapsulation,tVideoDataUnitEncapsulation)))
   1.929 +		{
   1.930 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KTVideoDataUnitEncapsulation());
   1.931 +		}	
   1.932 +	if(dataOk)
   1.933 +		{
   1.934 +		mimetype.Append(mimeType);
   1.935 +		if ( useDecoder) //Decoder
   1.936 +			{
   1.937 +			CCompressedVideoFormat* compressedFormat=NULL;
   1.938 +			TRAPD(error, compressedFormat = CCompressedVideoFormat::NewL (mimetype));
   1.939 +			if (error != KErrNone)
   1.940 +				{
   1.941 +				ERR_PRINTF2(_L("Error in CCompressedVideoFormat::NewL: %d"), error);
   1.942 +				SetError (error);
   1.943 +				}
   1.944 +			else
   1.945 +				{
   1.946 +				CleanupStack::PushL (compressedFormat);
   1.947 +				TRAP(error,
   1.948 +						iDevvp->SetInputFormatL(iDecHWDevId, *compressedFormat, 
   1.949 +									(TVideoDataUnitType)tVideoDataUnitType, 
   1.950 +									(TVideoDataUnitEncapsulation)tVideoDataUnitEncapsulation,
   1.951 +									dataInOrder));
   1.952 +				CleanupStack::PopAndDestroy (compressedFormat);
   1.953 +				if ( error != KErrNone)
   1.954 +					{
   1.955 +					ERR_PRINTF2(_L("Error in SetInputFormatL for decoder: %d"), error);
   1.956 +					SetError (error);
   1.957 +					}
   1.958 +				else
   1.959 +					{
   1.960 +					INFO_PRINTF1(_L("SetInputFormatL done!"));			
   1.961 +					}
   1.962 +				}
   1.963 +			
   1.964 +			}
   1.965 +		else // PostProcessor
   1.966 +			{
   1.967 +			TRAPD(err, iDevvp->SetInputFormatL(iPostProcId, iCommonFormat));
   1.968 +			if ( err != KErrNone)
   1.969 +				{
   1.970 +				ERR_PRINTF2(_L("Error in SetInputFormatL for PostProcessor: %d"), err);
   1.971 +				SetError (err);
   1.972 +				}
   1.973 +			}
   1.974 +		}	
   1.975 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetInputFormat"));
   1.976 +	}
   1.977 +
   1.978 +/**
   1.979 + * Gets the output format list from the decoder and the postprocessor
   1.980 + * @param	aSection	-	The section to read from the ini file
   1.981 + * @return	none
   1.982 + */
   1.983 +void CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL(const TTEFSectionName& aSection)
   1.984 +	{
   1.985 +	TBool useDecoder = ETrue; //ETrue - Decoder , EFalse - PostProcessor
   1.986 +	TBool dataOk = ETrue;
   1.987 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL"));
   1.988 +	if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
   1.989 +		{
   1.990 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
   1.991 +		SetBlockResult(EFail);
   1.992 +		dataOk = EFalse;
   1.993 +		}
   1.994 +	if(dataOk)
   1.995 +		{
   1.996 +		if ( useDecoder) //Decoder
   1.997 +			{
   1.998 +			TRAPD(err, iDevvp->GetOutputFormatListL(iDecHWDevId, iDecFormats));
   1.999 +			if ( err != KErrNone)
  1.1000 +				{
  1.1001 +				ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL failed with error %d"), err);
  1.1002 +				SetError (err);
  1.1003 +				}
  1.1004 +			}
  1.1005 +		else //PostProcessor
  1.1006 +			{
  1.1007 +			TRAPD(err1, iDevvp->GetOutputFormatListL(iPostProcId, iPPFormats));
  1.1008 +			if ( err1 != KErrNone)
  1.1009 +				{
  1.1010 +				ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL left with error %d"), err1);
  1.1011 +				SetError (err1);
  1.1012 +				}
  1.1013 +			}
  1.1014 +		}	
  1.1015 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL"));
  1.1016 +	}
  1.1017 +
  1.1018 +/**
  1.1019 + * Gets the postprocessor info.
  1.1020 + */
  1.1021 +void CT_CMMFDevVideoPlay::DoCmdPostProcessorInfoLC()
  1.1022 +	{
  1.1023 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdPostProcessorInfo"));
  1.1024 +	delete iInfo;
  1.1025 +	iInfo=NULL;
  1.1026 +	TRAPD(err, {iInfo = iDevvp->PostProcessorInfoLC(iSelectPostProcessor); CleanupStack::Pop(iInfo);} );
  1.1027 +	if ( err!=KErrNone )
  1.1028 +		{
  1.1029 +		ERR_PRINTF2(_L("PostProcessorInfoLC failed with error %i"),err);
  1.1030 +		}
  1.1031 +	else
  1.1032 +		{
  1.1033 +		iPPFormats = iInfo->SupportedFormats();
  1.1034 +		}
  1.1035 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdPostProcessorInfo"));
  1.1036 +	}
  1.1037 +
  1.1038 +/**
  1.1039 + * Find common format for dec output and postproc input. 
  1.1040 + * Precondition: The command GetOutputList has to be called before, for the Decoder and the postprocessor,
  1.1041 + * because in this method we use both list to find the common format.
  1.1042 + */
  1.1043 +void CT_CMMFDevVideoPlay::DoCmdFindCommonFormat()
  1.1044 +	{
  1.1045 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdFindCommonFormat"));
  1.1046 +	if ( iDevvp->FindCommonFormat (iDecFormats.Array (), iPPFormats.Array (), iCommonFormat) )
  1.1047 +		{
  1.1048 +		INFO_PRINTF1(_L("DoCmdFindCommonFormat found common Format!"));
  1.1049 +		}
  1.1050 +	else
  1.1051 +		{
  1.1052 +		iCommonFormat = iDecFormats[0];
  1.1053 +		ERR_PRINTF1(_L("Error in CT_CMMFDevVideoPlay::DoCmdFindCommonFormat: Common Format not found."));
  1.1054 +		SetBlockResult(EFail);
  1.1055 +		}
  1.1056 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdFindCommonFormat"));
  1.1057 +	}
  1.1058 +
  1.1059 +/**
  1.1060 + * Sets the output format for both the decoder and the postprocessor.
  1.1061 + * @param	aSection	-	The section to read from the ini file
  1.1062 + * @return	none
  1.1063 + */
  1.1064 +void CT_CMMFDevVideoPlay::DoCmdSetOutputFormatL(const TTEFSectionName& aSection)
  1.1065 +	{
  1.1066 +	TBool useDecoder = ETrue;
  1.1067 +	TBool dataOk = ETrue;
  1.1068 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetOutputFormat"));
  1.1069 +	if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
  1.1070 +		{
  1.1071 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
  1.1072 +		SetBlockResult(EFail);
  1.1073 +		dataOk = EFalse;
  1.1074 +		}
  1.1075 +	if(dataOk)
  1.1076 +		{
  1.1077 +		if ( useDecoder)
  1.1078 +			{ //Decoder			
  1.1079 +			TRAPD(error, iDevvp->SetOutputFormatL (iDecHWDevId, iCommonFormat));
  1.1080 +			if(error != KErrNone)
  1.1081 +				{
  1.1082 +				ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
  1.1083 +				SetError(error);
  1.1084 +				}
  1.1085 +			}
  1.1086 +		else
  1.1087 +			{ //PostProcessor
  1.1088 +			if ( iDirectScreenAccess)
  1.1089 +				{
  1.1090 +				//Set Output Fomat
  1.1091 +				TUncompressedVideoFormat outFormat;
  1.1092 +				outFormat.iDataFormat = ERgbRawData;
  1.1093 +				outFormat.iRgbFormat = ERgb32bit888; //RGB format for display         
  1.1094 +				TRAPD(error, iDevvp->SetOutputFormatL (iPostProcId, outFormat));
  1.1095 +				if(error != KErrNone)
  1.1096 +					{
  1.1097 +					ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
  1.1098 +					SetError(error);
  1.1099 +					}
  1.1100 +
  1.1101 +				}
  1.1102 +			else // Memory buffer output
  1.1103 +				{
  1.1104 +				TRAPD(error, iDevvp->SetOutputFormatL (iPostProcId, iCommonFormat));
  1.1105 +				if(error != KErrNone)
  1.1106 +					{
  1.1107 +					ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
  1.1108 +					SetError(error);
  1.1109 +					}
  1.1110 +				}
  1.1111 +			}
  1.1112 +		}	
  1.1113 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetOutputFormat"));
  1.1114 +	}
  1.1115 +
  1.1116 +
  1.1117 +/**
  1.1118 + * Gets the header information.
  1.1119 + * @param	aSection	-	The section to read from the ini file
  1.1120 + * @return	none
  1.1121 + */
  1.1122 +void CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL(const TTEFSectionName& aSection)
  1.1123 +	{
  1.1124 +	TInt bufSize = 0;
  1.1125 +	TBool dataOk = ETrue;
  1.1126 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL"));
  1.1127 +	if ( !(GetIntFromConfig(aSection, KBuf(), bufSize)))
  1.1128 +		{
  1.1129 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBuf());
  1.1130 +		SetBlockResult(EFail);
  1.1131 +		dataOk = EFalse;
  1.1132 +		}		
  1.1133 +	if(dataOk)
  1.1134 +		{
  1.1135 +		INFO_PRINTF1(_L("GetHeaderInformationL init..!"));
  1.1136 +		TInt err = KErrNone;
  1.1137 +		iHeaderInfo = NULL;
  1.1138 +		HBufC8* tempBuff=  NULL;
  1.1139 +		//Read Picture header : Size is not known
  1.1140 +		TVideoInputBuffer* codedBuffer = new(ELeave) TVideoInputBuffer;
  1.1141 +		CleanupStack::PushL ( codedBuffer);
  1.1142 +		if ( iFrameListed) //frame size known 
  1.1143 +			{
  1.1144 +			tempBuff = HBufC8::NewLC(iInBuffSize);
  1.1145 +			codedBuffer->iData.Set (tempBuff->Des ());
  1.1146 +			if(iFrameSizeList.Count() > 0)
  1.1147 +				{
  1.1148 +				err = ReadOneCodedPicture (codedBuffer, iFrameSizeList[0]);
  1.1149 +				}
  1.1150 +			else
  1.1151 +				{
  1.1152 +				err = KErrGeneral;
  1.1153 +				}
  1.1154 +			
  1.1155 +			TInt pos =0;
  1.1156 +			if ( iInFile.Seek (ESeekStart, pos))
  1.1157 +				{
  1.1158 +				err = KErrGeneral;
  1.1159 +				}
  1.1160 +			if ( err < 0)
  1.1161 +				{
  1.1162 +				CleanupStack::PopAndDestroy (tempBuff);
  1.1163 +				}
  1.1164 +			}
  1.1165 +		else //frame size not known 
  1.1166 +			{
  1.1167 +			iInBuffSize = KH263MaxCodedSizeQCIF;
  1.1168 +			err = KErrOverflow;
  1.1169 +			while ( (err == KErrOverflow) && (iInBuffSize <= KMP4MaxCodedSizeVGA))
  1.1170 +				{
  1.1171 +				tempBuff = HBufC8::NewLC(iInBuffSize);
  1.1172 +				codedBuffer->iData.Set (tempBuff->Des ());
  1.1173 +				err = ReadOneCodedPicture (codedBuffer);
  1.1174 +				TInt pos =0;
  1.1175 +				if ( iInFile.Seek (ESeekStart, pos))
  1.1176 +					{
  1.1177 +					err = KErrGeneral;
  1.1178 +					}
  1.1179 +				if ( iInputEnd)
  1.1180 +					{
  1.1181 +					err = KErrNotFound;
  1.1182 +					}
  1.1183 +				if ( err < 0)
  1.1184 +					{
  1.1185 +					CleanupStack::PopAndDestroy (tempBuff);
  1.1186 +					iInBuffSize = 4*iInBuffSize;
  1.1187 +					}
  1.1188 +				}
  1.1189 +			}
  1.1190 +		// Reitrieve header information from bitstream 
  1.1191 +		if ( err < 0)
  1.1192 +			{
  1.1193 +			CleanupStack::PopAndDestroy (codedBuffer);
  1.1194 +			}
  1.1195 +		else
  1.1196 +			{
  1.1197 +			TRAPD(error, iHeaderInfo = iDevvp->GetHeaderInformationL(EDuCodedPicture, EDuElementaryStream,codedBuffer));
  1.1198 +			CleanupStack::PopAndDestroy (tempBuff);
  1.1199 +			CleanupStack::PopAndDestroy (codedBuffer);		
  1.1200 +			if ( error != KErrNone)
  1.1201 +				{
  1.1202 +				ERR_PRINTF2(_L("Error in DoCmdGetHeaderInformationL: %d"), error);
  1.1203 +				SetError(error);				
  1.1204 +				}
  1.1205 +			else
  1.1206 +				{
  1.1207 +				//Check Header info 
  1.1208 +				if ( iHeaderInfo)
  1.1209 +					{
  1.1210 +					//Size in Memory
  1.1211 +					iPictureSize = iHeaderInfo->iDisplayedRect.Size ();
  1.1212 +					// Display rect  
  1.1213 +					TSize dispsize = iHeaderInfo->iDisplayedRect.Size ();
  1.1214 +					iDispRect.SetSize (dispsize);
  1.1215 +					INFO_PRINTF3(_L("Size from Header, Height: %d Width: %d"),dispsize.iHeight,
  1.1216 +							dispsize.iWidth);
  1.1217 +					INFO_PRINTF3(_L("Size from iPictureSize, Height: %d Width: %d"),iPictureSize.iHeight,
  1.1218 +							iPictureSize.iWidth);
  1.1219 +					}
  1.1220 +				// Set size of decoder input buffer
  1.1221 +				if ( !iFrameListed)
  1.1222 +					{
  1.1223 +					iInBuffSize = bufSize;
  1.1224 +					}
  1.1225 +				}				
  1.1226 +			}
  1.1227 +		}
  1.1228 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL"));
  1.1229 +	}
  1.1230 +
  1.1231 +/**
  1.1232 + * Returns  the HeaderInformation of the video
  1.1233 + */
  1.1234 +void CT_CMMFDevVideoPlay::DoCmdReturnHeader()
  1.1235 +	{
  1.1236 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdReturnHeader"));
  1.1237 +	if (iHeaderInfo)
  1.1238 +		{
  1.1239 +		iDevvp->ReturnHeader(iHeaderInfo);
  1.1240 +		}
  1.1241 +	else
  1.1242 +		{
  1.1243 +		ERR_PRINTF1(_L("Error in DoCmdReturnHeader!"));
  1.1244 +  		SetBlockResult(EFail);
  1.1245 +		}
  1.1246 +		INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdReturnHeader"));
  1.1247 +	}
  1.1248 +
  1.1249 +/**
  1.1250 + * Sets output on screen or memory buffer
  1.1251 + */
  1.1252 +void CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL()
  1.1253 +	{
  1.1254 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL"));
  1.1255 +	TRAPD(err, iDevvp->SetVideoDestScreenL(iDirectScreenAccess));
  1.1256 +	if (err != KErrNone)
  1.1257 +  		{
  1.1258 +  		ERR_PRINTF2(_L("Error in DoCmdSetVideoDestScreenL: %d"), err);
  1.1259 +  		SetError(err);
  1.1260 +  		}	
  1.1261 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL"));
  1.1262 +	}
  1.1263 +    
  1.1264 +/**
  1.1265 + * Gets the buffer options.
  1.1266 + */
  1.1267 +void CT_CMMFDevVideoPlay::DoCmdGetBufferOptions()
  1.1268 +	{
  1.1269 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetBufferOptions"));
  1.1270 +	iDevvp->GetBufferOptions(iBufferOptions);	
  1.1271 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetBufferOptions"));
  1.1272 +	}
  1.1273 +
  1.1274 +/**
  1.1275 + * Sets the buffer options for the DevVideoPlay
  1.1276 + */
  1.1277 +void CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL()
  1.1278 +	{
  1.1279 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL"));
  1.1280 +	iBufferOptions.iMaxInputBufferSize = iInBuffSize;
  1.1281 +	//iBufferOptions.iMaxPostDecodeBufferSize = 0;	
  1.1282 +	iBufferOptions.iPreDecodeBufferSize = 0;
  1.1283 +	iBufferOptions.iMinNumInputBuffers = KNumOfInputBuffers;
  1.1284 +	TRAPD(err, iDevvp->SetBufferOptionsL(iBufferOptions));
  1.1285 +	if ( err != KErrNone)
  1.1286 +		{
  1.1287 +		ERR_PRINTF2(_L("Error in DoCmdSetBufferOptionsL: %d"), err);
  1.1288 +		SetError (err);
  1.1289 +		}
  1.1290 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL"));
  1.1291 +	}
  1.1292 +
  1.1293 +/**
  1.1294 + * Sets the options for the postprocessor
  1.1295 + */
  1.1296 +void CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL(const TTEFSectionName& aSection)
  1.1297 +	{
  1.1298 +	TInt combination = 0;
  1.1299 +	TBool dataOk = ETrue;
  1.1300 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL"));
  1.1301 +	if ( ! (GetHexFromConfig(aSection, KCombination(), combination)) )
  1.1302 +        {
  1.1303 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCombination());
  1.1304 +        SetBlockResult(EFail);
  1.1305 +        dataOk = EFalse;
  1.1306 +        }
  1.1307 +	if(dataOk)
  1.1308 +		{
  1.1309 +		TRAPD(err,iDevvp->SetPostProcessTypesL(iPostProcId, combination));
  1.1310 +		if( err!=KErrNone )
  1.1311 +			{
  1.1312 +			ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL left with error %d"), err);
  1.1313 +			SetError(err);		
  1.1314 +			} 
  1.1315 +		}	
  1.1316 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL"));
  1.1317 +	}
  1.1318 +
  1.1319 +/**
  1.1320 + * Initialize the decoder with the specified parameters.
  1.1321 + * @return - KErrNone if no error
  1.1322 + */ 
  1.1323 +void CT_CMMFDevVideoPlay::DoCmdInitialize(const TInt aAsyncErrorIndex)
  1.1324 +    {  
  1.1325 +    INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdInitialize"));
  1.1326 +    iAsyncErrorIndex = aAsyncErrorIndex;    
  1.1327 +    iDevvp->Initialize();
  1.1328 +    IncOutstanding();	
  1.1329 +    INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdInitialize"));
  1.1330 +    }
  1.1331 +
  1.1332 +/**
  1.1333 + * Starts video decoding directly to the display frame buffer using Direct Screen Access. Playback to the display can start immediately.
  1.1334 + * 
  1.1335 + * @return None
  1.1336 + */
  1.1337 +void CT_CMMFDevVideoPlay::DoCmdStart(const TInt aAsyncErrorIndex)
  1.1338 +    {
  1.1339 +    INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStart"));
  1.1340 +    iAsyncErrorIndex = aAsyncErrorIndex;
  1.1341 +    // Start DevVideoPlay
  1.1342 +    INFO_PRINTF1(_L("Start Decoding Engine.."));
  1.1343 +   	iDevvp->Start();    	
  1.1344 +   	//Reset Clock at Stream Start
  1.1345 +   	if ( iSynchronized ) 
  1.1346 +   	    { 	
  1.1347 +   	    TTimeIntervalMicroSeconds offset(KStartOffset);
  1.1348 +   	    iClock->Reset(offset);  
  1.1349 +   	    }
  1.1350 +   	INFO_PRINTF1(_L("Start Data transfer."));
  1.1351 +   	TRAPD(err, HandleNewBufferL()); 
  1.1352 +   	if (err != KErrNone)
  1.1353 +   	    {
  1.1354 +   	    ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err);
  1.1355 +   	    SetError(err);
  1.1356 +   	    }
  1.1357 +   	else
  1.1358 +   	   {
  1.1359 +   	    if(!iErrorInputBuffer)
  1.1360 +   	    	{
  1.1361 +   	    	IncOutstanding();
  1.1362 +   		    INFO_PRINTF1(_L("Start..done!"));     
  1.1363 +   		    INFO_PRINTF2(_L("iFrameSizeList.Count %d"),iFrameSizeList.Count());  
  1.1364 +   	    	} 	       
  1.1365 +   	   }         	   
  1.1366 +    INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStart"));
  1.1367 +    }
  1.1368 +
  1.1369 +/**
  1.1370 + * Stops the playback
  1.1371 + * @param	aSection	-	The section to read from the ini file
  1.1372 + * @return	none
  1.1373 + */
  1.1374 +void CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL(const TTEFSectionName& aSection)
  1.1375 +	{
  1.1376 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL"));	
  1.1377 +	if ( !iScreenDevice)
  1.1378 +		{
  1.1379 +		delete iScreenDevice;
  1.1380 +		iScreenDevice = NULL;
  1.1381 +		RFbsSession::Disconnect();
  1.1382 +		TDisplayMode displayMode; //0 - Decoder , 1 - PostProcessor
  1.1383 +		TInt value = 0;
  1.1384 +		if ( !(GetEnumFromConfig(aSection, KDisplayMode(), iDisplayModes, value)))
  1.1385 +			{
  1.1386 +			ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDisplayMode());
  1.1387 +			SetBlockResult(EFail);
  1.1388 +			}
  1.1389 +		displayMode = (TDisplayMode)value;
  1.1390 +		User::LeaveIfError (RFbsSession::Connect());
  1.1391 +		
  1.1392 +		TRAPD(error, iScreenDevice = CFbsScreenDevice::NewL (KScreenNumber, displayMode));
  1.1393 +		if(error != KErrNone)
  1.1394 +			{
  1.1395 +			ERR_PRINTF2(_L("Error creating screen device"),error);
  1.1396 +			SetError(error);
  1.1397 +			}
  1.1398 +		}
  1.1399 +	
  1.1400 +	if ( iDispRect.iBr.iY > KQVGAHeight)
  1.1401 +		{
  1.1402 +		iDispRect.iTl.iY = 0;
  1.1403 +		iDispRect.SetHeight (KQVGAHeight);
  1.1404 +		}
  1.1405 +	if ( iDispRect.iBr.iX > KQVGAWidth)
  1.1406 +		{
  1.1407 +		iDispRect.iTl.iX = 0;
  1.1408 +		iDispRect.SetWidth (KQVGAWidth);
  1.1409 +		}
  1.1410 +	
  1.1411 +	TRegionFix<1> region(iDispRect);
  1.1412 +	//Start DSA
  1.1413 +
  1.1414 +	INFO_PRINTF2(_L("Size window Y: %d"),iDispRect.Height());
  1.1415 +	INFO_PRINTF2(_L("Size window X: %d"),iDispRect.Width());
  1.1416 +
  1.1417 +	TRAPD(error,iDevvp->StartDirectScreenAccessL(iDispRect, *iScreenDevice, region));
  1.1418 +	if ( error != KErrNone)
  1.1419 +		{
  1.1420 +		ERR_PRINTF2(_L("StartDirectScreenAccessL error: %d"),error);
  1.1421 +		SetError(error);
  1.1422 +		}
  1.1423 +	else
  1.1424 +		{
  1.1425 +		iDsaStarted = ETrue;
  1.1426 +		}
  1.1427 +	
  1.1428 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL"));
  1.1429 +	}
  1.1430 +
  1.1431 +/** 
  1.1432 + * Stop Devvideoplay 
  1.1433 + */
  1.1434 +void CT_CMMFDevVideoPlay::DoCmdStop()
  1.1435 +	{
  1.1436 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStop"));
  1.1437 +	iDevvp->Stop ();
  1.1438 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStop"));
  1.1439 +	}
  1.1440 +
  1.1441 +/**
  1.1442 + * Aborts Direct Screen Access completely
  1.1443 + * @return None
  1.1444 + */
  1.1445 +void CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess()
  1.1446 +	{
  1.1447 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess"));
  1.1448 +	if ( iDirectScreenAccess && iDsaStarted)
  1.1449 +		{
  1.1450 +		iDevvp->AbortDirectScreenAccess ();
  1.1451 +		INFO_PRINTF1(_L("Abort Direct Screen Access Done"));
  1.1452 +		iDsaStarted = EFalse;
  1.1453 +		}
  1.1454 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess"));
  1.1455 +	}
  1.1456 +
  1.1457 +/**
  1.1458 + * Pause the decoding process
  1.1459 + */
  1.1460 +void CT_CMMFDevVideoPlay::DoCmdPause()
  1.1461 +	{
  1.1462 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdPause"));
  1.1463 +	if ( iSynchronized)
  1.1464 +		{
  1.1465 +		iClock->Suspend (); //Stop Clock source
  1.1466 +		}
  1.1467 +	iDevvp->Pause();
  1.1468 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdPause"));
  1.1469 +	}
  1.1470 +
  1.1471 +/**
  1.1472 + * Resume the decodind process
  1.1473 + */
  1.1474 +void CT_CMMFDevVideoPlay::DoCmdResume()
  1.1475 +	{
  1.1476 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdResume"));
  1.1477 +	if ( iSynchronized)
  1.1478 +		{
  1.1479 +		iClock->Resume (); //Restart Clock source
  1.1480 +		}
  1.1481 +	iDevvp->Resume ();	
  1.1482 +	if ( iDecHWDevId)
  1.1483 +		{		
  1.1484 +		if ( iDevvp->NumFreeBuffers () > 0 )
  1.1485 +			{
  1.1486 +			INFO_PRINTF1(_L("Restart data transfer."));
  1.1487 +	    	TRAPD(err1, HandleNewBufferL()); 
  1.1488 +	        if (err1 != KErrNone)
  1.1489 +	        	{
  1.1490 +	        	ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err1);
  1.1491 +	        	SetError(err1);
  1.1492 +	        	return;
  1.1493 +	        	}
  1.1494 +			}
  1.1495 +		}
  1.1496 +
  1.1497 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdResume"));
  1.1498 +	}
  1.1499 +
  1.1500 +/**
  1.1501 + * Rotating the display
  1.1502 + * @param	aSection	-	The section to read from the ini file
  1.1503 + * @return	none
  1.1504 + */
  1.1505 +void CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL(const TTEFSectionName& aSection)
  1.1506 +	{
  1.1507 +	TRotationType rotation;
  1.1508 +	TInt rotItem;
  1.1509 +	TBool dataOk = ETrue;
  1.1510 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL"));
  1.1511 +	if ( !( GetEnumFromConfig(aSection, KRotation(), iRotations, rotItem)))
  1.1512 +		{
  1.1513 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KRotation());
  1.1514 +        SetBlockResult(EFail);
  1.1515 +        dataOk = EFalse;
  1.1516 +		}
  1.1517 +	if(dataOk)
  1.1518 +		{
  1.1519 +		rotation = (TRotationType)rotItem;		
  1.1520 +		TRAPD(error,iDevvp->SetRotateOptionsL(iPostProcId, rotation));
  1.1521 +		if ( error != KErrNone)
  1.1522 +			{
  1.1523 +			ERR_PRINTF2(_L("DoCmdSetRotateOptionsL! Error = %d"),error);
  1.1524 +			SetError (error);
  1.1525 +			}
  1.1526 +		}	
  1.1527 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL"));
  1.1528 +	}
  1.1529 +
  1.1530 +/**
  1.1531 + * Setting the screen options
  1.1532 + * @param	aSection	-	The section to read from the ini file
  1.1533 + * @return	none
  1.1534 + */
  1.1535 +void CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL(const TTEFSectionName& aSection)
  1.1536 +    {
  1.1537 +	TInt width;
  1.1538 +	TInt height;
  1.1539 +  	TInt x,y;
  1.1540 +  	TBool antiAliasFiltering = ETrue;
  1.1541 +  	TBool dataOk = ETrue;
  1.1542 +  	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL"));
  1.1543 +	if ( !(GetIntFromConfig(aSection, Kx(), x)) )
  1.1544 +        {
  1.1545 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &Kx());
  1.1546 +        SetBlockResult(EFail);
  1.1547 +        dataOk = EFalse;
  1.1548 +        }
  1.1549 +	if ( !(GetIntFromConfig(aSection, Ky(), y)) )
  1.1550 +        {
  1.1551 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &Ky());
  1.1552 +        SetBlockResult(EFail);
  1.1553 +        dataOk = EFalse;
  1.1554 +        } 
  1.1555 +	if ( !(GetIntFromConfig(aSection, KWidth(), width)) )
  1.1556 +        {
  1.1557 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
  1.1558 +        SetBlockResult(EFail);
  1.1559 +        dataOk = EFalse;
  1.1560 +        }
  1.1561 +	if ( !(GetIntFromConfig(aSection, KHeight(), height)) )
  1.1562 +        {
  1.1563 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
  1.1564 +        SetBlockResult(EFail);
  1.1565 +        dataOk = EFalse;
  1.1566 +        }	
  1.1567 +	GetBoolFromConfig(aSection, KAntiAliasFiltering(),antiAliasFiltering);
  1.1568 + 	if(dataOk)
  1.1569 + 		{
  1.1570 + 		TSize size(width, height);	  
  1.1571 + 		TRAPD(error, SetWindowRect(x, y,size));
  1.1572 + 		if ( error != KErrNone)
  1.1573 + 			{
  1.1574 + 			ERR_PRINTF2(_L("SetWindowRect! left with Error = %d"),error);
  1.1575 + 			SetBlockResult (EFail);
  1.1576 + 			}
  1.1577 +
  1.1578 + 		TRAP(error, iDevvp->SetScaleOptionsL(iPostProcId, size, antiAliasFiltering));
  1.1579 + 		if ( error != KErrNone)
  1.1580 + 			{
  1.1581 + 			ERR_PRINTF2(_L("SetScaleOptionsL! left with Error = %d"),error);
  1.1582 + 			SetError (error);
  1.1583 + 			}
  1.1584 + 		}	
  1.1585 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL"));
  1.1586 +    }
  1.1587 +
  1.1588 +/**
  1.1589 + * Sets the new position for playback and decoding. It is use for forward and backward
  1.1590 + */
  1.1591 +void CT_CMMFDevVideoPlay::DoCmdSetPosition(const TTEFSectionName& aSection)
  1.1592 +	{
  1.1593 +	TInt pos;
  1.1594 +	Int64 time = 0;
  1.1595 +	TBool dataOk = ETrue;
  1.1596 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetPosition"));
  1.1597 +	if ( !(GetIntFromConfig(aSection, KPos(), pos)) ) //This parameter indicates seconds to move forward/backward from the current position
  1.1598 +		{
  1.1599 +	    ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPos());
  1.1600 +	    SetBlockResult(EFail);
  1.1601 +	    dataOk = EFalse;
  1.1602 +		}
  1.1603 +	if(dataOk)
  1.1604 +		{
  1.1605 +		pos = pos*iFramerate;	
  1.1606 +		INFO_PRINTF2(_L("pos %i"),pos);
  1.1607 +		if((pos > iFrameSizeList.Count()) || ((pos+iSentBuffCount) < 0))
  1.1608 +			{
  1.1609 +			ERR_PRINTF2(_L("Invalid value, check %S from INI file"), &KPos());
  1.1610 +			//SetBlockResult(EFail);
  1.1611 +			}
  1.1612 +		else
  1.1613 +			{
  1.1614 +			iSentBuffCount +=pos;
  1.1615 +			TTimeIntervalMicroSeconds timeStamp;	
  1.1616 +			if ( iSynchronized )
  1.1617 +				{
  1.1618 +				timeStamp = (TTimeIntervalMicroSeconds)(iSentBuffCount*iFrameTimeInterval);
  1.1619 +				time = timeStamp.Int64();
  1.1620 +				iClock->Reset(timeStamp);  
  1.1621 +				iTimeStamp = time; 		 
  1.1622 +				}
  1.1623 +			else
  1.1624 +				{
  1.1625 +				timeStamp = (TTimeIntervalMicroSeconds)(iSentBuffCount);    
  1.1626 +				}
  1.1627 +			 
  1.1628 +			iDevvp->SetPosition(timeStamp);
  1.1629 +			 
  1.1630 +			TInt temp=0;
  1.1631 +			for(TInt i=0; i < iSentBuffCount; i++)
  1.1632 +				{
  1.1633 +				temp += iFrameSizeList[i];
  1.1634 +				}			 
  1.1635 +			TInt error = KErrNone;
  1.1636 +			error = iInFile.Seek(ESeekStart,temp);
  1.1637 +			if (error != KErrNone)
  1.1638 +				{
  1.1639 +				ERR_PRINTF2(_L("Error Seeking in file, check ini for parameter POS: %d"),error);
  1.1640 +				SetBlockResult(EFail);
  1.1641 +				}
  1.1642 +			}		
  1.1643 +		}	
  1.1644 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetPosition"));
  1.1645 +	}
  1.1646 +
  1.1647 +/**
  1.1648 + * Utility command to get the initial parameters
  1.1649 + */
  1.1650 +void CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL()
  1.1651 +	{	
  1.1652 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL"));
  1.1653 +			
  1.1654 +	CPostProcessorInfo *infoPost = NULL;
  1.1655 +	RArray< TUid > postProcessors;
  1.1656 +	iDevvp->GetPostProcessorListL(postProcessors);
  1.1657 +	for(TInt i = 0; i< postProcessors.Count(); i++)
  1.1658 +		{
  1.1659 +		INFO_PRINTF3(_L("PostProcessors %d = 0x%x"),i,postProcessors[i]);
  1.1660 +		TRAPD(err,infoPost = iDevvp->PostProcessorInfoLC(postProcessors[i]);CleanupStack::Pop(infoPost));
  1.1661 +		if(err != KErrNone)
  1.1662 +			{
  1.1663 +			ERR_PRINTF1(_L("Error in getting Devvp->PostProcessorInfoLC(postProcessors[i])"));
  1.1664 +			}
  1.1665 +		else
  1.1666 +			{
  1.1667 +			TBool supported = infoPost->SupportsDirectDisplay();
  1.1668 +			if (supported)
  1.1669 +				{
  1.1670 +				INFO_PRINTF1(_L("Direct Display Supported"));
  1.1671 +				}
  1.1672 +			else
  1.1673 +				{
  1.1674 +				INFO_PRINTF1(_L("Direct Display Not Supported"));
  1.1675 +				}	
  1.1676 +			const RArray<TUint32> combinations = infoPost->SupportedCombinations();	  
  1.1677 +			for (i = 0; i < combinations.Count(); i++)
  1.1678 +				{
  1.1679 +				INFO_PRINTF2(_L("Supported Combination : %d"),combinations[i]);
  1.1680 +				}
  1.1681 +			TUint32 test = 0x3040;	
  1.1682 +			if (infoPost->SupportsCombination(test))
  1.1683 +				{
  1.1684 +				INFO_PRINTF2(_L("Combination %x is Supported"),test);
  1.1685 +				}
  1.1686 +			else
  1.1687 +				{
  1.1688 +				INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
  1.1689 +				}
  1.1690 +			test = 0x40;//play	
  1.1691 +			if (infoPost->SupportsCombination(test))
  1.1692 +				{
  1.1693 +				INFO_PRINTF2(_L("Combination %x is Supported"),test);
  1.1694 +				}
  1.1695 +			else
  1.1696 +				{
  1.1697 +				INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
  1.1698 +				}
  1.1699 +			test = 0x44;//rotation
  1.1700 +			if (infoPost->SupportsCombination(test))
  1.1701 +				{
  1.1702 +				INFO_PRINTF2(_L("Combination %x is Supported"),test);
  1.1703 +				}
  1.1704 +			else
  1.1705 +				{
  1.1706 +				INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
  1.1707 +				}
  1.1708 +			test = 0x48;//scale
  1.1709 +			if (infoPost->SupportsCombination(test))
  1.1710 +				{
  1.1711 +				INFO_PRINTF2(_L("Combination %x is Supported"),test);
  1.1712 +				}
  1.1713 +			else
  1.1714 +				{
  1.1715 +				INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
  1.1716 +				}
  1.1717 +			TUint32 rotations = infoPost->SupportedRotations();
  1.1718 +			if (rotations == 0)
  1.1719 +				{
  1.1720 +				INFO_PRINTF1(_L("Rotation is Not Supported"));
  1.1721 +				}
  1.1722 +			else
  1.1723 +				{
  1.1724 +				INFO_PRINTF2(_L("Supported rotation : %d"),rotations);
  1.1725 +				}
  1.1726 +			supported = infoPost->SupportsArbitraryScaling();
  1.1727 +			if (supported)
  1.1728 +				{
  1.1729 +				INFO_PRINTF1(_L("Arbitrary Scaling is Supported"));
  1.1730 +				}
  1.1731 +			else
  1.1732 +				{
  1.1733 +				RArray<TScaleFactor> scaleFactors = infoPost->SupportedScaleFactors();
  1.1734 +				TScaleFactor factor;
  1.1735 +				for (i = 0; i < scaleFactors.Count(); i++)
  1.1736 +					{
  1.1737 +					factor = scaleFactors[i];
  1.1738 +					INFO_PRINTF3(_L("Scale factor: scale num - %d scale denom - %d"),factor.iScaleNum,factor.iScaleDenom);
  1.1739 +					}		
  1.1740 +				}
  1.1741 +			}
  1.1742 +		
  1.1743 +		}
  1.1744 +	
  1.1745 +  			
  1.1746 +	RArray<TUid> decoders;
  1.1747 +	iDevvp->GetDecoderListL(decoders);
  1.1748 +	CVideoDecoderInfo *infDec =NULL;
  1.1749 +	INFO_PRINTF1(_L("INFORMATION ABOUT DECODERS:"));
  1.1750 +	for(TInt i = 0; i< decoders.Count(); i++)
  1.1751 +		{		
  1.1752 +		TRAPD(err, infDec = iDevvp->VideoDecoderInfoLC(decoders[i]);CleanupStack::Pop(infDec));		
  1.1753 +		if(err != KErrNone )
  1.1754 +			{
  1.1755 +			 ERR_PRINTF1(_L("Error in iDevvp->VideoDecoderInfoLC(decoders[i])"));
  1.1756 +			}
  1.1757 +		else
  1.1758 +			{
  1.1759 +			INFO_PRINTF6(_L("\nDecoder =0x%x\n Identifier = %S\n Accelerated = %i\n Supports Direct Display: %i\n Manufacturer%S"), 
  1.1760 +					decoders[i].iUid,
  1.1761 +					&infDec->Identifier(),
  1.1762 +					infDec->Accelerated(),
  1.1763 +					infDec->SupportsDirectDisplay(),
  1.1764 +					&infDec->Manufacturer());				
  1.1765 +			INFO_PRINTF1(_L("SUPPORTED FORMATS:"));
  1.1766 +			TBuf<255> mime;
  1.1767 +			const RPointerArray<CCompressedVideoFormat>& outputFormats =infDec->SupportedFormats();
  1.1768 +			for (TInt j = 0; j < outputFormats.Count(); j++)
  1.1769 +				{
  1.1770 +				mime.Copy(outputFormats[j]->MimeType());		
  1.1771 +				INFO_PRINTF3(_L("Supported type %d MIMETYPE: %S"),j,&mime);					
  1.1772 +				}	
  1.1773 +			INFO_PRINTF1(_L("\n\n"));	
  1.1774 +			}						
  1.1775 +		}
  1.1776 +		    
  1.1777 +	TInt colors = 0;
  1.1778 +	HAL::Get(HALData::EDisplayColors, colors);
  1.1779 +	INFO_PRINTF2(_L("Display colors : %d"),colors);
  1.1780 +	INFO_PRINTF1(_L("Display mode!"));
  1.1781 +	switch(colors)
  1.1782 +		{
  1.1783 +		case 0:
  1.1784 +	 		INFO_PRINTF1(_L("None"));
  1.1785 +	 	break;		
  1.1786 +		case 16777216:
  1.1787 +			INFO_PRINTF1(_L("EColor16MU"));
  1.1788 +		break;
  1.1789 +		case 65536:
  1.1790 +			INFO_PRINTF1(_L("EColor64K"));
  1.1791 +		break;
  1.1792 +		case 4096:
  1.1793 +			INFO_PRINTF1(_L("EColor4K"));
  1.1794 +		break;
  1.1795 +		default:
  1.1796 +			INFO_PRINTF1(_L("Default mode EColor4K"));
  1.1797 +		}
  1.1798 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL"));
  1.1799 +	}
  1.1800 +
  1.1801 +/**
  1.1802 + * Sets the original window for display
  1.1803 + */
  1.1804 +void CT_CMMFDevVideoPlay::SetWindowRect(TInt aX, TInt aY, TSize aSize)
  1.1805 +    {
  1.1806 +    INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SetWindowRect"));
  1.1807 +    iDispRect.SetRect(TPoint(aX,aY),aSize);
  1.1808 +    INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SetWindowRect"));
  1.1809 +    }
  1.1810 +
  1.1811 +/**
  1.1812 + * Read one coded picture into decoder input buffer
  1.1813 + * 
  1.1814 + * @param aCodedInBuffer
  1.1815 + * 
  1.1816 + * @return err
  1.1817 + */
  1.1818 +TInt CT_CMMFDevVideoPlay::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer)
  1.1819 +	{
  1.1820 +	TInt buffLength = iInBuffSize;
  1.1821 +	TBool found = EFalse;
  1.1822 +	TInt pos =0;
  1.1823 +	TUint8* testData= NULL;
  1.1824 +	TInt err = KErrNone;	
  1.1825 +	if ( aCodedInBuffer->iData.MaxLength ()< buffLength)
  1.1826 +		{
  1.1827 +		err = KErrOverflow;
  1.1828 +		return err;
  1.1829 +		}
  1.1830 +	aCodedInBuffer->iData.SetLength (0);
  1.1831 +	//Read data from Input File  
  1.1832 +	err = iInFile.Read (aCodedInBuffer->iData, buffLength);
  1.1833 +	if ( err != KErrNone)
  1.1834 +		{
  1.1835 +		return err;
  1.1836 +		}
  1.1837 +	//Buffer is not full,  reset size of buffer   
  1.1838 +	if ( aCodedInBuffer->iData.Length ()< buffLength)
  1.1839 +		{
  1.1840 +		buffLength = aCodedInBuffer->iData.Length ();
  1.1841 +		}
  1.1842 +	testData = const_cast<TUint8*>(aCodedInBuffer->iData.Ptr());
  1.1843 +	//Check the length of one coded picture
  1.1844 +	if ( (iCodecType == EH263) || ((testData[0] == 0x00) && (testData[1] == 0x00) & ((testData[2] & 0xFC) == 0x80)))
  1.1845 +		{
  1.1846 +		if ( (aCodedInBuffer->iData.Length() > 0))
  1.1847 +			{
  1.1848 +			pos = KScLength; //skip first 3 byte (PSC)   
  1.1849 +			// Find next PSC
  1.1850 +			while ( pos < (buffLength - KScLength) && !found)
  1.1851 +				{
  1.1852 +				if ( (testData[pos+1] == 0x00) && (testData[pos+2] == 0x00) & ((testData[pos+3] & 0xFC) == 0x80))
  1.1853 +					{
  1.1854 +					found = ETrue;
  1.1855 +					}
  1.1856 +				pos++;
  1.1857 +				}
  1.1858 +			}
  1.1859 +		else
  1.1860 +			{
  1.1861 +			iInputEnd = ETrue;
  1.1862 +			return err;
  1.1863 +			}
  1.1864 +		}
  1.1865 +	else
  1.1866 +		if ( iCodecType == EMPEG4)
  1.1867 +			{
  1.1868 +			if ( (aCodedInBuffer->iData.Length() > 0))
  1.1869 +				{
  1.1870 +				// Check if start code of Visual Object Sequence              
  1.1871 +				pos = 0;
  1.1872 +				while ( pos < (buffLength - KScLength) && !found)
  1.1873 +					{ // Find 1st VOP start code in the buffer              
  1.1874 +					if ( (testData[pos] == 0x00) && (testData[pos+1] == 0x00)&& (testData[pos+2] == 0x01) && (testData[pos+3] == 0xB6))
  1.1875 +						{
  1.1876 +						while (pos < (buffLength - KScLength-1) && !found)
  1.1877 +							{
  1.1878 +							pos++;
  1.1879 +							// Find 2nd start code in the buffer >> End of a Picture
  1.1880 +							if ( (testData[pos+1] == 0x00) && (testData[pos+2] == 0x00)&& (testData[pos+3] == 0x01) && (testData[pos+4] != 0xB1))
  1.1881 +								{
  1.1882 +								found = ETrue;
  1.1883 +								}
  1.1884 +							}
  1.1885 +						}
  1.1886 +					pos++;
  1.1887 +					}
  1.1888 +				}
  1.1889 +			else
  1.1890 +				{
  1.1891 +				iInputEnd = ETrue;
  1.1892 +				return err;
  1.1893 +				}
  1.1894 +			}
  1.1895 +		else
  1.1896 +			{
  1.1897 +			err = KErrNotSupported;
  1.1898 +			}
  1.1899 +	// Start and End of a picure are found 
  1.1900 +	if ( found)
  1.1901 +		{
  1.1902 +		//Set Size to length of the header + one picure, and reset position to be read next time
  1.1903 +		aCodedInBuffer->iData.SetLength (pos);
  1.1904 +		TInt tempLength = pos - buffLength;
  1.1905 +		err = iInFile.Seek (ESeekCurrent, tempLength);
  1.1906 +		}
  1.1907 +	// All data in Buffer are checked and end of data not found 
  1.1908 +	else
  1.1909 +		{
  1.1910 +		if ( pos >= (iInBuffSize-3))
  1.1911 +			{
  1.1912 +			err = KErrOverflow;
  1.1913 +			}
  1.1914 +		}
  1.1915 +	if ( err == KErrNone)
  1.1916 +		{
  1.1917 +		err = pos;
  1.1918 +		}	
  1.1919 +	return err;	
  1.1920 +	}          
  1.1921 +    
  1.1922 +/**
  1.1923 + * Read one coded picture into decoder input buffer, frame size is known 
  1.1924 + * 
  1.1925 + * @param aCodedInBuffer
  1.1926 + * @param aSize				- frame size
  1.1927 + * @return err				- The error
  1.1928 + */
  1.1929 +TInt CT_CMMFDevVideoPlay::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer, TInt aSize)
  1.1930 +    {
  1.1931 +    TInt err = KErrNone;        
  1.1932 +    if(aCodedInBuffer !=NULL)
  1.1933 +    	{
  1.1934 +    	err = iInFile.Read(aCodedInBuffer->iData, aSize);                
  1.1935 +    	}
  1.1936 +    else
  1.1937 +    	{
  1.1938 +    	INFO_PRINTF1(_L("aCodedInBuffer is NULL"));
  1.1939 +    	err = KErrNotFound;
  1.1940 +    	}
  1.1941 +    if (aSize == 0)
  1.1942 +    	{
  1.1943 +    	iInputEnd = ETrue;
  1.1944 +    	}
  1.1945 +    return err;
  1.1946 +    }
  1.1947 +
  1.1948 +
  1.1949 +/**
  1.1950 + * Notifies the client that one or more new empty input buffers are available
  1.1951 + * @return None
  1.1952 + */
  1.1953 +void CT_CMMFDevVideoPlay::MdvpoNewBuffers()
  1.1954 +    {
  1.1955 +	TRAPD(err, HandleNewBufferL()); 
  1.1956 +	if (err != KErrNone)
  1.1957 +		{
  1.1958 +		ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err);
  1.1959 +		SetBlockResult(EFail);    	
  1.1960 +		}
  1.1961 +    }
  1.1962 +
  1.1963 +/**
  1.1964 + * Returns a used input video picture back to the caller. The picture memory can be re-used or freed. 
  1.1965 + * 
  1.1966 + * @param aPicture	the picture to return
  1.1967 + */
  1.1968 +void CT_CMMFDevVideoPlay::MdvpoReturnPicture(TVideoPicture* aPicture)
  1.1969 +    {   
  1.1970 +    if ( iRawInBuffer == aPicture )
  1.1971 +        {        
  1.1972 +    	TRAPD(err1, HandleNewBufferL()); 
  1.1973 +        if (err1 != KErrNone)
  1.1974 +        	{
  1.1975 +        	ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err1);
  1.1976 +        	SetBlockResult(EFail);
  1.1977 +        	}
  1.1978 +        }    
  1.1979 +    }
  1.1980 +
  1.1981 +/**
  1.1982 + * Delivers supplemental information from a coded data unit.
  1.1983 + * 
  1.1984 + * @param aData			The supplemental data. The reference is only valid until the method returns, and thus the data must be processed or copied immediately
  1.1985 + * @param aTimestamp	The presentation timestamp for the picture that the supplemental data is part of
  1.1986 + * @param aPictureId	Picture identifier for the picture. If a picture ID is not available, aPictureId.iIdType is set to ENone
  1.1987 + * 
  1.1988 + * @return None
  1.1989 + */
  1.1990 +void CT_CMMFDevVideoPlay::MdvpoSupplementalInformation(const TDesC8& /*aData*/, const TTimeIntervalMicroSeconds& /*aTimestamp*/, const TPictureId& /*aPictureId*/)
  1.1991 +    {	  
  1.1992 +    }
  1.1993 +
  1.1994 +/**
  1.1995 + * Back channel information from the decoder, indicating a picture loss without specifying the lost picture.
  1.1996 + * 
  1.1997 + * @return None
  1.1998 + */
  1.1999 +void CT_CMMFDevVideoPlay::MdvpoPictureLoss()
  1.2000 +    {
  1.2001 +    iPictureLoss++;      
  1.2002 +    }
  1.2003 +
  1.2004 +/**
  1.2005 + * Back channel information from the decoder, indicating a picture loss without specifying the lost picture.
  1.2006 + * 
  1.2007 + * @param aPictures	Picture identifiers for the lost pictures.
  1.2008 + * 
  1.2009 + * @return None
  1.2010 + */
  1.2011 +void CT_CMMFDevVideoPlay::MdvpoPictureLoss(const TArray<TPictureId>& aPictures)
  1.2012 +    {         
  1.2013 +    iPictureLoss += aPictures.Count();     
  1.2014 +    }
  1.2015 +
  1.2016 +/**
  1.2017 + * Back channel information from the decoder, indicating the loss of consecutive macroblocks in raster scan order.
  1.2018 + * 
  1.2019 + * @param aFirstMacroblock	The first lost macroblock
  1.2020 + * @param aNumMacroblocks	The number of lost macroblocks that are consecutive in raster-scan order
  1.2021 + * @param aPicture			The picture identifier for the picture where the macroblocks were lost
  1.2022 + * 
  1.2023 + * @return None
  1.2024 + */
  1.2025 +void CT_CMMFDevVideoPlay::MdvpoSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/)
  1.2026 +    {  
  1.2027 +    }
  1.2028 +
  1.2029 +/**
  1.2030 + * Back channel information from the decoder, indicating a reference picture selection request. 
  1.2031 + * 
  1.2032 + * @param aSelectionData	The	reference picture selection request message. 
  1.2033 + * 
  1.2034 + * @return None
  1.2035 + */
  1.2036 +void CT_CMMFDevVideoPlay::MdvpoReferencePictureSelection(const TDesC8& /*aSelectionData*/)
  1.2037 +    {
  1.2038 +    }
  1.2039 +
  1.2040 +/**
  1.2041 + * 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. 
  1.2042 + * 
  1.2043 + * @param aError					An error code, KErrNone if no errors occurred.
  1.2044 + * @param aPictureData				The snapshot picture data
  1.2045 + * @param aPresentationTimestamp	The presentation timestamp for the snapshot picture
  1.2046 + * @param aPictureId				Picture identifier for the picture. If a picture ID is not available, aPictureId.iIdType is set to ENone
  1.2047 + * 
  1.2048 + * @return None
  1.2049 + */
  1.2050 +void CT_CMMFDevVideoPlay::MdvpoTimedSnapshotComplete(TInt aError, TPictureData* /*aPictureData*/, 
  1.2051 +														const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/,
  1.2052 +														const TPictureId& /*aPictureId*/)
  1.2053 +    {
  1.2054 +    if(aError!= KErrNone)
  1.2055 +    	{
  1.2056 +    	INFO_PRINTF2(_L("An error has ocurred: %i in CT_CMMFDevVideoPlay::MdvpoTimedSnapshotComplete"),aError);
  1.2057 +    	}    
  1.2058 +    }    
  1.2059 +
  1.2060 +/**
  1.2061 + * Notifies the client that one or more new output pictures are available. 
  1.2062 + * 
  1.2063 + * @return None
  1.2064 + */    
  1.2065 +void CT_CMMFDevVideoPlay::MdvpoNewPictures()
  1.2066 +    {    
  1.2067 +    GetReturnedPicture();
  1.2068 +    }
  1.2069 +
  1.2070 +/**
  1.2071 + * Reports a fatal decoding or playback error to the client.
  1.2072 + * 
  1.2073 + * @param aError	The error code
  1.2074 + * 
  1.2075 + * @return None
  1.2076 + */       
  1.2077 +void CT_CMMFDevVideoPlay::MdvpoFatalError(TInt aError)
  1.2078 +    {
  1.2079 +    INFO_PRINTF1(_L("MdvpoFatalError DecOutstanding"));
  1.2080 +    DecOutstanding();
  1.2081 +    ERR_PRINTF2(_L("A Fatal error has ocurred: %i"),aError);
  1.2082 +    HandleRuntimeError(aError);  
  1.2083 +    }
  1.2084 +
  1.2085 +/**
  1.2086 + * Reports that DevVideoPlay initialization has completed. The interface can now be used for video playback. 
  1.2087 + * 
  1.2088 + * @param aError	Initialization error code, KErrNone if no error occurred
  1.2089 + * 
  1.2090 + * @return None
  1.2091 + */
  1.2092 +void CT_CMMFDevVideoPlay::MdvpoInitComplete(TInt aError)
  1.2093 +	{
  1.2094 +
  1.2095 +	if ( aError == KErrNone)
  1.2096 +		{
  1.2097 +		INFO_PRINTF1(_L("MdvpoInitComplete OK"));
  1.2098 +		//Initilize parameters for Decoding/Playback
  1.2099 +		iCodedInBuffer = NULL;
  1.2100 +		iOutBuffer =NULL;
  1.2101 +		iSentBuffCount = 0;
  1.2102 +		iReturnedBuffCount = 0;
  1.2103 +		iPictureLoss =0;
  1.2104 +		iInputEnd = EFalse;
  1.2105 +		iStreamEnd = EFalse;
  1.2106 +		iTimeStamp = 0;
  1.2107 +		}
  1.2108 +	else
  1.2109 +		{		
  1.2110 +		ERR_PRINTF2(_L("MdvpoInitComplete Error %d"), aError);
  1.2111 +		SetAsyncError (iAsyncErrorIndex, aError);
  1.2112 +		}
  1.2113 +	INFO_PRINTF1(_L("MdvpoInitComplete DecOutstanding"));	
  1.2114 +	DecOutstanding ();
  1.2115 +	}
  1.2116 +
  1.2117 +/**
  1.2118 + * Reports that the input video stream end has been reached and all pictures have been processed.
  1.2119 + * This method is only called after the client has called InputEnd(). No more output pictures will be available.
  1.2120 + * 
  1.2121 + * @return None
  1.2122 + */
  1.2123 +void CT_CMMFDevVideoPlay::MdvpoStreamEnd()
  1.2124 +    {
  1.2125 +	iStreamEnd = ETrue;     
  1.2126 +    INFO_PRINTF1(_L("Stream End!"));
  1.2127 +    INFO_PRINTF2(_L("iSentBuffCount: %d"),iSentBuffCount);
  1.2128 +    INFO_PRINTF2(_L("iReturnedBuffCount: %d"),iReturnedBuffCount);
  1.2129 +    INFO_PRINTF2(_L("iPictureLoss: %d"),iPictureLoss);
  1.2130 +    INFO_PRINTF1(_L("MdvpoStreamEnd DecOutStanding"));
  1.2131 +   	DecOutstanding();
  1.2132 +    }
  1.2133 +
  1.2134 +
  1.2135 +/**
  1.2136 + * Get Next input data 
  1.2137 + * 
  1.2138 + * @return None
  1.2139 + */
  1.2140 +void CT_CMMFDevVideoPlay::HandleNewBufferL()
  1.2141 +    {
  1.2142 +	if ( !iInputEnd )
  1.2143 +		{
  1.2144 +		if ( iDecHWDevId || iCIBuffMgmtOn ) //Retrieve buffer from Hwdevice
  1.2145 +			{
  1.2146 +			GetInputBuffer();     
  1.2147 +			}
  1.2148 +		else
  1.2149 +			{
  1.2150 +			FillAndSendBufferL();   // Postproc input
  1.2151 +			}
  1.2152 +		}	
  1.2153 +    }
  1.2154 +
  1.2155 +/**
  1.2156 + * Retrieve decoder input buffer
  1.2157 + * 
  1.2158 + * @return None
  1.2159 + */
  1.2160 +void CT_CMMFDevVideoPlay::GetInputBuffer()
  1.2161 +    {
  1.2162 +    //TBool buffer = EFalse; 	 	 
  1.2163 +    if ( iDecHWDevId )
  1.2164 +    	{	
  1.2165 +    	TRAPD(error, iCodedInBuffer = iDevvp->GetBufferL(iInBuffSize));
  1.2166 +    	if (error != KErrNone)
  1.2167 +    		{	
  1.2168 +    		ERR_PRINTF2(_L("Error GetInputBufferL!. Error %d"),error);
  1.2169 +    		iErrorInputBuffer = ETrue;
  1.2170 +    		SetError(error);    		
  1.2171 +    		}
  1.2172 +    	else
  1.2173 +    		{
  1.2174 +    		if ( iCodedInBuffer )
  1.2175 +    	    	{    	    	    	       	    	
  1.2176 +    	        TRAPD(error, FillAndSendBufferL());
  1.2177 +    	        if (error != KErrNone)
  1.2178 +    	     	   {
  1.2179 +    	     	   ERR_PRINTF2(_L("Error GetInputBufferL->FillAndSendBufferL!. Error %d"),error);
  1.2180 +    	     	   SetBlockResult(EFail);        	   
  1.2181 +    	     	   }
  1.2182 +    	    	}
  1.2183 +    		}    
  1.2184 +    	} 
  1.2185 +    }
  1.2186 +    
  1.2187 +    
  1.2188 +    
  1.2189 +/**
  1.2190 + * Fill data into input buffer and send to devvideoplay 
  1.2191 + * 
  1.2192 + * @return None
  1.2193 + */
  1.2194 +void CT_CMMFDevVideoPlay::FillAndSendBufferL()
  1.2195 +	{
  1.2196 +	TInt err = KErrNone;	
  1.2197 +	if ( iDecHWDevId)
  1.2198 +		{
  1.2199 +		if ( iSynchronized)
  1.2200 +			{
  1.2201 +			TInt size = 0;
  1.2202 +			if((iSentBuffCount>=0) && (iSentBuffCount < iFrameSizeList.Count()))
  1.2203 +				{
  1.2204 +				size = iFrameSizeList[iSentBuffCount];
  1.2205 +				}
  1.2206 +			else
  1.2207 +				{
  1.2208 +				ERR_PRINTF2(_L("error %i"),iSentBuffCount);
  1.2209 +				}
  1.2210 +			
  1.2211 +			err = ReadOneCodedPicture (iCodedInBuffer, size); // Read compressed data of one picture from file 
  1.2212 +			}
  1.2213 +		else
  1.2214 +			{
  1.2215 +			err = ReadOneCodedPicture (iCodedInBuffer); // Read compressed data of one picture from file 
  1.2216 +			}
  1.2217 +		}
  1.2218 +	else // Postproc input case
  1.2219 +		{
  1.2220 +		err = ReadRawPicture (); // Read raw data for one picture      
  1.2221 +		}
  1.2222 +	if ( iInputEnd)
  1.2223 +		{
  1.2224 +		iDevvp->InputEnd (); // All input Data sent        
  1.2225 +		return;
  1.2226 +		}
  1.2227 +	if ( err >= 0)
  1.2228 +		{
  1.2229 +		if ( iDecHWDevId)
  1.2230 +			{
  1.2231 +			iCodedInBuffer->iOptions = TVideoInputBuffer::EDecodingTimestamp;
  1.2232 +			if ( iPostProcId)
  1.2233 +				{
  1.2234 +				iCodedInBuffer->iOptions |= TVideoInputBuffer::EPresentationTimestamp;
  1.2235 +				}
  1.2236 +			if ( iSynchronized)
  1.2237 +				{
  1.2238 +				iCodedInBuffer->iDecodingTimestamp = iTimeStamp;
  1.2239 +				if ( iPostProcId)
  1.2240 +					{
  1.2241 +					iCodedInBuffer->iPresentationTimestamp = iTimeStamp;
  1.2242 +					}
  1.2243 +				iTimeStamp += iFrameTimeInterval;
  1.2244 +				}
  1.2245 +			else // Clock source is not set
  1.2246 +				{
  1.2247 +				iCodedInBuffer->iDecodingTimestamp = iSentBuffCount;
  1.2248 +				if ( iPostProcId)
  1.2249 +					{
  1.2250 +					iCodedInBuffer->iPresentationTimestamp = iSentBuffCount;
  1.2251 +					}
  1.2252 +				}
  1.2253 +			if ( iFrameMeasurement)
  1.2254 +				{
  1.2255 +				iClock->Reset (); // Reset Timer 
  1.2256 +				}
  1.2257 +			TRAPD(error,iDevvp->WriteCodedDataL(iCodedInBuffer)); // Input Data Sent to Decoder 
  1.2258 +			if ( error != KErrNone)
  1.2259 +				{
  1.2260 +				ERR_PRINTF2(_L("Error Writing data!. Error %d"),error);
  1.2261 +				SetError(error);
  1.2262 +				return;
  1.2263 +				}
  1.2264 +			}
  1.2265 +		else
  1.2266 +			{
  1.2267 +			iRawInBuffer->iData.iDataSize.SetSize (iPictureSize.iWidth,
  1.2268 +					iPictureSize.iHeight);
  1.2269 +			iRawInBuffer->iOptions |= (TVideoPicture::ETimestamp);
  1.2270 +			if ( iSynchronized)
  1.2271 +				{
  1.2272 +				iRawInBuffer->iTimestamp = iTimeStamp;
  1.2273 +				iTimeStamp += iFrameTimeInterval;
  1.2274 +				}
  1.2275 +			else
  1.2276 +				{
  1.2277 +				iRawInBuffer->iTimestamp = iSentBuffCount;
  1.2278 +				}
  1.2279 +			TRAPD(error, iDevvp->WritePictureL (iRawInBuffer)); // Input Data Sent to PostProcessor 
  1.2280 +			if (error != KErrNone)
  1.2281 +				{
  1.2282 +				ERR_PRINTF2(_L("Error Writing Picture!. Error %d"),error);
  1.2283 +				SetError(error);
  1.2284 +				return;
  1.2285 +				}
  1.2286 +			}
  1.2287 +		iSentBuffCount++;
  1.2288 +		}
  1.2289 +	else
  1.2290 +		{
  1.2291 +		iInputEnd = ETrue;
  1.2292 +		iDevvp->InputEnd ();
  1.2293 +		return;
  1.2294 +		}	
  1.2295 +	} 
  1.2296 +   
  1.2297 +
  1.2298 +/**
  1.2299 + * Retrieve output picture
  1.2300 + * 
  1.2301 + * @return None
  1.2302 + */
  1.2303 +void CT_CMMFDevVideoPlay::GetReturnedPicture()
  1.2304 +	{
  1.2305 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::GetReturnedPicture"));
  1.2306 +	TRAPD(err, iOutBuffer = iDevvp->NextPictureL());
  1.2307 +	if ( err != KErrNone)
  1.2308 +		{
  1.2309 +        HandleRuntimeError(err);
  1.2310 +        ERR_PRINTF1(_L("Error en GetReturnedPicture!!"));
  1.2311 +        }        
  1.2312 +    if ( iOutBuffer )
  1.2313 +        {       
  1.2314 +        iReturnedBuffCount++;
  1.2315 +        SaveAndReturnPicture();
  1.2316 +        }
  1.2317 +    INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::GetReturnedPicture"));
  1.2318 +    }
  1.2319 +
  1.2320 +/**
  1.2321 + * This function finishes the async call depending on the error occured while handling the picture
  1.2322 + * 
  1.2323 + * @param aError Error Value passed
  1.2324 + * @return none
  1.2325 + */
  1.2326 +void CT_CMMFDevVideoPlay::HandleRuntimeError(TInt aError)
  1.2327 +	{
  1.2328 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::HandleRuntimeError"));
  1.2329 +	ERR_PRINTF2(_L("HandleRuntimeError! Error = %d"),aError);
  1.2330 +	SetError (aError);
  1.2331 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::HandleRuntimeError"));
  1.2332 +	}    
  1.2333 +
  1.2334 +/**
  1.2335 + * Store output data into a file
  1.2336 + * 
  1.2337 + * @return None
  1.2338 + */
  1.2339 +void CT_CMMFDevVideoPlay::SaveAndReturnPicture()
  1.2340 +	{
  1.2341 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SaveAndReturnPicture"));
  1.2342 +	TInt err = iOutFile.Write (*(iOutBuffer->iData.iRawData), iOutBuffer->iData.iRawData->Size ());
  1.2343 +	iDevvp->ReturnPicture (iOutBuffer);
  1.2344 +	iOutBuffer = NULL;
  1.2345 +	if ( err != KErrNone)
  1.2346 +		{
  1.2347 +		HandleRuntimeError (err);
  1.2348 +		}
  1.2349 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::SaveAndReturnPicture"));
  1.2350 +	}
  1.2351 +
  1.2352 +/**
  1.2353 + * List size of each frame of coded bitstream 
  1.2354 + * 
  1.2355 + * @param  aCodec picture 
  1.2356 + * @return none
  1.2357 + */
  1.2358 +void CT_CMMFDevVideoPlay::ListFrameSizeL(TVideoCodec aCodec)
  1.2359 +	{
  1.2360 +	TInt framesize = 0;
  1.2361 +	TInt readpos = 0;
  1.2362 +	TInt buffsize = KH263MaxCodedSizeQCIF; //buffer size for listing frame size
  1.2363 +	iCodecType = aCodec; // this is for ReadOneCodedPicture
  1.2364 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::ListFrameSizeL"));
  1.2365 +	//Initial buffer size
  1.2366 +	// Allocate buffer 
  1.2367 +	TVideoInputBuffer* videoBuffer = new(ELeave) TVideoInputBuffer;
  1.2368 +	CleanupStack::PushL (videoBuffer);
  1.2369 +	HBufC8* tempBuff = HBufC8::NewLC( buffsize);
  1.2370 +	videoBuffer->iData.Set (tempBuff->Des ());
  1.2371 +	while (!iInputEnd)
  1.2372 +		{
  1.2373 +		iInBuffSize = buffsize;
  1.2374 +		videoBuffer->iData.SetLength (0);
  1.2375 +		framesize = ReadOneCodedPicture (videoBuffer);//        
  1.2376 +		if ( framesize >= 0) // Frame size is added to list
  1.2377 +			{
  1.2378 +			iFrameSizeList.AppendL (framesize);
  1.2379 +			readpos += framesize;
  1.2380 +			}
  1.2381 +		else // resize buffer to bigger one
  1.2382 +			{
  1.2383 +			if ( buffsize < KMP4MaxCodedSizeVGA)
  1.2384 +				{
  1.2385 +				CleanupStack::PopAndDestroy(tempBuff);
  1.2386 +				buffsize = buffsize + KH263MaxCodedSizeQCIF;
  1.2387 +				tempBuff = HBufC8::NewLC( buffsize);
  1.2388 +				videoBuffer->iData.Set (tempBuff->Des ());
  1.2389 +				iInFile.Seek (ESeekStart, readpos);
  1.2390 +				}
  1.2391 +			else
  1.2392 +				{
  1.2393 +				framesize = KErrNotFound;
  1.2394 +				break;
  1.2395 +				}
  1.2396 +			}
  1.2397 +		}
  1.2398 +	//Reset file postion to start
  1.2399 +	TInt pos =0;
  1.2400 +	iInFile.Seek (ESeekStart, pos);
  1.2401 +	iInputEnd = EFalse;
  1.2402 +	// cleanup    
  1.2403 +	CleanupStack::PopAndDestroy(2, videoBuffer);
  1.2404 +	//Error case
  1.2405 +	if ( framesize < 0)
  1.2406 +		{
  1.2407 +		User::Leave (framesize);
  1.2408 +		}
  1.2409 +	//Set frame size listed   
  1.2410 +	iFrameListed = ETrue;
  1.2411 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::ListFrameSizeL"));
  1.2412 +	}
  1.2413 +
  1.2414 +/**
  1.2415 + * Closes the opened files
  1.2416 + */
  1.2417 +void CT_CMMFDevVideoPlay::CloseFile()
  1.2418 +	{	
  1.2419 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::CloseFile"));
  1.2420 +	iInFile.Close ();
  1.2421 +	if ( !iDirectScreenAccess)
  1.2422 +		{
  1.2423 +		iOutFile.Close ();
  1.2424 +		}
  1.2425 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::CloseFile"));
  1.2426 +	}
  1.2427 +
  1.2428 +/**
  1.2429 + * Opens the input and output file
  1.2430 + * @param	aInFileName		-	The name of input file
  1.2431 + * @param	aOutFileName	-	The name of output file
  1.2432 + * @return	none
  1.2433 + */
  1.2434 +void CT_CMMFDevVideoPlay::OpenFileL(TFileName& aOutFileName, TFileName& aInFileName)
  1.2435 +	{
  1.2436 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::OpenFileL"));
  1.2437 +	TInt err = iInFile.Open (iFs, aInFileName, EFileRead | EFileShareReadersOnly);
  1.2438 +	User::LeaveIfError (err);
  1.2439 +	err = iOutFile.Replace (iFs, aOutFileName,
  1.2440 +			EFileShareExclusive|EFileWrite);
  1.2441 +	if ( err!= KErrNone)
  1.2442 +		{
  1.2443 +		iInFile.Close ();
  1.2444 +		User::Leave(err);
  1.2445 +		}
  1.2446 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::OpenFileL"));
  1.2447 +	}
  1.2448 +
  1.2449 +/**
  1.2450 + * Opens the input File
  1.2451 + * @param	aInFileName	-The name of input file
  1.2452 + * @return	none 
  1.2453 + */
  1.2454 +void CT_CMMFDevVideoPlay::OpenFileL(TFileName& aInFileName)
  1.2455 +	{
  1.2456 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::OpenFileL"));
  1.2457 +	User::LeaveIfError(iInFile.Open (iFs, aInFileName, EFileRead | EFileShareReadersOnly));
  1.2458 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::OpenFileL"));
  1.2459 +	}
  1.2460 +
  1.2461 +/**
  1.2462 + * Read one raw picture into postprocessor input buffer
  1.2463 + */
  1.2464 +TInt CT_CMMFDevVideoPlay::ReadRawPicture()
  1.2465 +	{
  1.2466 +	INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::ReadRawPicture"));
  1.2467 +	iRawInBuffer->iData.iRawData->Set ((TUint8*)iRawInBuffer->iData.iRawData->Ptr(), 0, iInBuffSize);
  1.2468 +	TInt err = iInFile.Read (*(iRawInBuffer->iData.iRawData), iInBuffSize);
  1.2469 +	if ( !err)
  1.2470 +		{
  1.2471 +		if ( (iRawInBuffer->iData.iRawData->Length()) == 0)
  1.2472 +			{
  1.2473 +			iInputEnd = ETrue;
  1.2474 +			}
  1.2475 +		}
  1.2476 +	INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::ReadRawPicture"));
  1.2477 +	return err;
  1.2478 +	}
  1.2479 +
  1.2480 +void CT_CMMFDevVideoPlay::DoCmdH264CreateDecTest(const TTEFSectionName& aSection)
  1.2481 +    {
  1.2482 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::CreateDecTest, In"));
  1.2483 +    iUse264 = ETrue;
  1.2484 +    TInt uidInt = 0;
  1.2485 +    TInt output = 0;
  1.2486 +    TInt width = 0;
  1.2487 +    TInt height = 0;
  1.2488 +    TInt buffMgmt = 0;
  1.2489 +    TInt codec = 0;
  1.2490 +    TPtrC inputfile;
  1.2491 +    TPtrC inputDirectory;
  1.2492 +    
  1.2493 +    iObserver = new (ELeave) CEngineObserver(*this);
  1.2494 +    //Create Decoder test engine     
  1.2495 +    iEngine = CVDecTestEngine::NewL(*iObserver);    
  1.2496 +
  1.2497 +    //Read from test case file 
  1.2498 +	if(!GetHexFromConfig(aSection, KUid(), uidInt))
  1.2499 +		{
  1.2500 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUid());
  1.2501 +		SetBlockResult(EFail);
  1.2502 +		}
  1.2503 +	if(!GetIntFromConfig(aSection, KBuffMgmt(), buffMgmt))
  1.2504 +		{
  1.2505 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBuffMgmt());
  1.2506 +		SetBlockResult(EFail);
  1.2507 +		}
  1.2508 +	if(!GetIntFromConfig(aSection, KOutput(), output))
  1.2509 +		{
  1.2510 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutput());
  1.2511 +		SetBlockResult(EFail);
  1.2512 +		}
  1.2513 +	if(!GetIntFromConfig(aSection, KWidth(), width))
  1.2514 +		{
  1.2515 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
  1.2516 +		SetBlockResult(EFail);
  1.2517 +		}
  1.2518 +	if(!GetIntFromConfig(aSection, KHeight(), height))
  1.2519 +		{
  1.2520 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
  1.2521 +		SetBlockResult(EFail);
  1.2522 +		}
  1.2523 +	if(!GetIntFromConfig(aSection, KCodec(), codec))
  1.2524 +		{
  1.2525 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCodec());
  1.2526 +		SetBlockResult(EFail);
  1.2527 +		}
  1.2528 +	if(!GetStringFromConfig(aSection, KInputPath(), inputDirectory))
  1.2529 +		{
  1.2530 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputPath());
  1.2531 +		SetBlockResult(EFail);
  1.2532 +		}
  1.2533 +	if(!GetStringFromConfig(aSection, KInputfile(), inputfile))
  1.2534 +		{
  1.2535 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputfile());
  1.2536 +		SetBlockResult(EFail);
  1.2537 +		}
  1.2538 +  
  1.2539 +	//Open File
  1.2540 +    TFileName inFileName(inputDirectory);
  1.2541 +    inFileName.Append(inputfile);
  1.2542 +
  1.2543 +	TUid decoderUid;
  1.2544 +    decoderUid.iUid = uidInt;
  1.2545 +    INFO_PRINTF2(_L("Decoder uid is [%x]"), decoderUid.iUid);
  1.2546 +
  1.2547 +	TSize size;
  1.2548 +	size.SetSize(width, height);
  1.2549 +        
  1.2550 +    if (output == EDecodedFile) 
  1.2551 +    	{
  1.2552 +    	TPtrC outputfile;
  1.2553 +    	TPtrC outputDirectory;
  1.2554 +		if ( ! (GetStringFromConfig(aSection, KOutputPath(),outputDirectory)))
  1.2555 +			{
  1.2556 +			ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputPath());
  1.2557 +			SetBlockResult(EFail);
  1.2558 +			}
  1.2559 +		if ( !(GetStringFromConfig(aSection, KOutputfile(),outputfile)))
  1.2560 +			{
  1.2561 +			ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputfile());
  1.2562 +			SetBlockResult(EFail);
  1.2563 +			}
  1.2564 +    		
  1.2565 +    	//Start sequence    
  1.2566 +    	iEngine->SetUpL(size, EFalse, buffMgmt);
  1.2567 +    	TFileName outFileName(outputDirectory);
  1.2568 +    	outFileName.Append(outputfile);   
  1.2569 +    	iEngine->OpenFileL(outFileName, inFileName);
  1.2570 +    	}
  1.2571 +    else if (output == EScreenOutput) 
  1.2572 +    	{
  1.2573 +   		iEngine->SetUpL(size, ETrue, buffMgmt);    	   
  1.2574 +    	iEngine->OpenFileL(inFileName);    	
  1.2575 +    	}               
  1.2576 +    
  1.2577 +    TRAPD(result, iEngine->SelectDecoderL(decoderUid));
  1.2578 +    if(result != KErrNone)
  1.2579 +        {
  1.2580 +        ERR_PRINTF2(_L("SelectDecoderL left with error %d"), result);
  1.2581 +        SetError(result);
  1.2582 +        }
  1.2583 +    
  1.2584 +    TVideoCodec videoCodec;
  1.2585 +    if (codec == 1) 
  1.2586 +    	{
  1.2587 +    	videoCodec = EH263;	
  1.2588 +    	}
  1.2589 +    else if (codec == 2) 
  1.2590 +    	{
  1.2591 +    	videoCodec = EMPEG4;	
  1.2592 +    	}
  1.2593 +    else if (codec == 3) 
  1.2594 +    	{
  1.2595 +    	videoCodec = EAVC;	
  1.2596 +    	}
  1.2597 +    else if (codec == 4) 
  1.2598 +    	{
  1.2599 +    	videoCodec = EVC1;	
  1.2600 +    	}	
  1.2601 +    else if (codec == 5) 
  1.2602 +    	{
  1.2603 +    	videoCodec = EFLV;	
  1.2604 +    	}	
  1.2605 +		else if (codec == 6) 
  1.2606 +    	{
  1.2607 +    	videoCodec = EVP6;	
  1.2608 +    	}
  1.2609 +    else 
  1.2610 +    	{
  1.2611 +    	videoCodec = EMPEG4;	
  1.2612 +    	}
  1.2613 +    iEngine->SetCodecType(videoCodec);
  1.2614 +    
  1.2615 +    iFileOpen = ETrue;
  1.2616 +   
  1.2617 +	INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::CreateDecTest, Out"));
  1.2618 +    }
  1.2619 +
  1.2620 +void CT_CMMFDevVideoPlay::DoCmdH264SetInputFormatCompr(const TTEFSectionName& aSection)
  1.2621 +    {
  1.2622 +    INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::SetInputFormatCompr, In"));
  1.2623 +  
  1.2624 +    TInt hwdev = 0;
  1.2625 +    TInt dataUnitTypeInt = 0;
  1.2626 +    TInt encapsulation = 0;
  1.2627 +    TInt dataInOrder = 0;
  1.2628 +    TPtrC format;
  1.2629 +	if(!GetIntFromConfig(aSection, KHwdev(), hwdev))
  1.2630 +		{
  1.2631 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
  1.2632 +		SetBlockResult(EFail);
  1.2633 +		}
  1.2634 +	if(!GetIntFromConfig(aSection, KDataUnitTypeInt(), dataUnitTypeInt))
  1.2635 +		{
  1.2636 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataUnitTypeInt());
  1.2637 +		SetBlockResult(EFail);
  1.2638 +		}
  1.2639 +	if(!GetIntFromConfig(aSection, KEncapsulation(), encapsulation))
  1.2640 +		{
  1.2641 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KEncapsulation());
  1.2642 +		SetBlockResult(EFail);
  1.2643 +		}
  1.2644 +	if(!GetBoolFromConfig(aSection, KDataInOrder(), dataInOrder))
  1.2645 +		{
  1.2646 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataInOrder());
  1.2647 +		SetBlockResult(EFail);
  1.2648 +		}
  1.2649 +	if(!GetStringFromConfig(aSection, KFormat(), format))
  1.2650 +		{
  1.2651 +		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFormat());
  1.2652 +		SetBlockResult(EFail);
  1.2653 +		}
  1.2654 +	
  1.2655 +	TVideoDataUnitType dataUnitType;
  1.2656 +	switch (dataUnitTypeInt)
  1.2657 +		{
  1.2658 +		case 1: dataUnitType = EDuCodedPicture;
  1.2659 +				break;
  1.2660 +		case 2: dataUnitType = EDuVideoSegment;
  1.2661 +				break;
  1.2662 +		case 3: dataUnitType = EDuSeveralSegments;
  1.2663 +				break;			
  1.2664 +		case 4: dataUnitType = EDuArbitraryStreamSection;
  1.2665 +				break;				
  1.2666 +		default:dataUnitType = EDuCodedPicture;			
  1.2667 +		}
  1.2668 +			
  1.2669 +	TVideoDataUnitEncapsulation dataEncapsulation;
  1.2670 +	
  1.2671 +	switch (encapsulation) 
  1.2672 +		{
  1.2673 +		case 1: dataEncapsulation = EDuElementaryStream;
  1.2674 +				break;
  1.2675 +		case 2: dataEncapsulation = EDuGenericPayload;
  1.2676 +				break;
  1.2677 +		case 3: dataEncapsulation = EDuRtpPayload;
  1.2678 +				break;
  1.2679 +		default:dataEncapsulation = EDuElementaryStream;				
  1.2680 +		}
  1.2681 +	
  1.2682 +	TBuf8<128> buf;
  1.2683 +	buf.Copy(format);
  1.2684 +	CCompressedVideoFormat* compressedFormat = CCompressedVideoFormat::NewL(buf);    
  1.2685 +			     	
  1.2686 +	TRAPD(result, iEngine->SetInputFormatL(hwdev,*compressedFormat, dataUnitType, dataEncapsulation, dataInOrder));
  1.2687 +    if(result != KErrNone)
  1.2688 +        {
  1.2689 +        ERR_PRINTF2(_L("SetInputFormatL left with error %d"), result);
  1.2690 +        SetError(result);
  1.2691 +        }    
  1.2692 +    delete compressedFormat;
  1.2693 +    
  1.2694 +    INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::SetInputFormatCompr, Out"));
  1.2695 +    }
  1.2696 +
  1.2697 +void CT_CMMFDevVideoPlay::DoCmdH264SetOutputFormat(const TTEFSectionName& aSection)
  1.2698 +	{
  1.2699 +	TInt hwdev = 0;
  1.2700 +	TInt dataFormat = 0;
  1.2701 +    TInt dataLayout = 0;
  1.2702 +    TInt pattern = 0;
  1.2703 +    TInt aspectRatioNum = 1;
  1.2704 +    TInt aspectRatioDenom = 1;
  1.2705 +    TInt coefficients = 0;
  1.2706 +        
  1.2707 +    //Read from test case file 
  1.2708 +    if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
  1.2709 +        {
  1.2710 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
  1.2711 +        SetBlockResult(EFail);
  1.2712 +        }
  1.2713 +    if ( !(GetIntFromConfig(aSection, KDataFormat(), dataFormat)))
  1.2714 +        {
  1.2715 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataFormat());
  1.2716 +        SetBlockResult(EFail);
  1.2717 +        }
  1.2718 +    
  1.2719 +    if ( !(GetIntFromConfig(aSection, KDataLayout(), dataLayout)))
  1.2720 +        {
  1.2721 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataLayout());
  1.2722 +        SetBlockResult(EFail);
  1.2723 +        }   
  1.2724 +    
  1.2725 +    TUncompressedVideoFormat unCompressedFormat;
  1.2726 +    
  1.2727 +    switch (dataFormat)
  1.2728 +    	{
  1.2729 +    	case 1: 
  1.2730 +    	    unCompressedFormat.iDataFormat = ERgbRawData;    				
  1.2731 +    		unCompressedFormat.iRgbFormat = ERgb32bit888;
  1.2732 +    		break;    				
  1.2733 +    	case 2: unCompressedFormat.iDataFormat = ERgbFbsBitmap;
  1.2734 +    			switch (dataLayout) 
  1.2735 +    				{
  1.2736 +    				case 1: unCompressedFormat.iRgbFormat = ERgb16bit444;
  1.2737 +    						break;
  1.2738 +    				case 2: unCompressedFormat.iRgbFormat = ERgb16bit565;
  1.2739 +    						break;
  1.2740 +					case 3: unCompressedFormat.iRgbFormat = ERgb32bit888;
  1.2741 +    						break;
  1.2742 +    				case 4: unCompressedFormat.iRgbFormat = EFbsBitmapColor4K;
  1.2743 +    						break;
  1.2744 +    				case 5: unCompressedFormat.iRgbFormat = EFbsBitmapColor16M;
  1.2745 +    						break;				    							
  1.2746 +    				case 6: unCompressedFormat.iRgbFormat = EFbsBitmapColor16MU;
  1.2747 +    						break;		
  1.2748 +    				default: unCompressedFormat.iRgbFormat = ERgb16bit444;
  1.2749 +    				}
  1.2750 +    			break;
  1.2751 +    	case 3: unCompressedFormat.iDataFormat = EYuvRawData;
  1.2752 +                if ( !(GetIntFromConfig(aSection, KPattern(), pattern)))
  1.2753 +                    {
  1.2754 +                    ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPattern());
  1.2755 +                    SetBlockResult(EFail);
  1.2756 +                    }
  1.2757 +                if ( !(GetIntFromConfig(aSection, KAspectRatioNum(), aspectRatioNum)))
  1.2758 +                    {
  1.2759 +                    ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KAspectRatioNum());
  1.2760 +                    SetBlockResult(EFail);
  1.2761 +                    }
  1.2762 +                if ( !(GetIntFromConfig(aSection, KAspectRatioDenom(), aspectRatioDenom)))
  1.2763 +                    {
  1.2764 +                    ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KAspectRatioDenom());
  1.2765 +                    SetBlockResult(EFail);
  1.2766 +                    }
  1.2767 +                if(!GetHexFromConfig(aSection, KCoefficients(), coefficients))
  1.2768 +                    {
  1.2769 +                    ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCoefficients());
  1.2770 +                    SetBlockResult(EFail);
  1.2771 +                    }
  1.2772 +    			switch (dataLayout) 
  1.2773 +    				{
  1.2774 +    				case 1: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
  1.2775 +    						break;
  1.2776 +    				case 2: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedLE;
  1.2777 +    						break;
  1.2778 +					case 3: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
  1.2779 +    						break;
  1.2780 +    				case 4: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataSemiPlanar;
  1.2781 +    						break;
  1.2782 +    				default:unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;    							    					 
  1.2783 +    				}
  1.2784 +    			switch (pattern) 
  1.2785 +    				{
  1.2786 +    				case 1: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma1;
  1.2787 +    						break;
  1.2788 +    				case 2: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2;
  1.2789 +    						break;
  1.2790 +					case 3: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma3;
  1.2791 +    						break;
  1.2792 +    				case 4: unCompressedFormat.iYuvFormat.iPattern = EYuv422Chroma1;
  1.2793 +    						break;
  1.2794 +    				case 5: unCompressedFormat.iYuvFormat.iPattern = EYuv422Chroma2;
  1.2795 +    						break;    							
  1.2796 +    				default:unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2; 
  1.2797 +    				}
  1.2798 +    			switch (coefficients) 
  1.2799 +    				{
  1.2800 +    				case 1: unCompressedFormat.iYuvFormat.iCoefficients = EYuvRange0;
  1.2801 +    						break;
  1.2802 +    				case 2: unCompressedFormat.iYuvFormat.iCoefficients = EYuvRange1;
  1.2803 +    						break;
  1.2804 +					case 3: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709;
  1.2805 +    						break;
  1.2806 +    				case 4: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
  1.2807 +    						break;
  1.2808 +    				case 5: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
  1.2809 +    						break;    							
  1.2810 +    				case 6: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601;
  1.2811 +    						break;    							
  1.2812 +    				case 7: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range0;
  1.2813 +    						break;    							
  1.2814 +    				case 8: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
  1.2815 +    						break;    									
  1.2816 +    				case 9: unCompressedFormat.iYuvFormat.iCoefficients = ECustomYuvMatrix;
  1.2817 +    						break;    							
  1.2818 +    				default:unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range0; 
  1.2819 +    				}	
  1.2820 +    			unCompressedFormat.iYuvFormat.iAspectRatioNum = aspectRatioNum;
  1.2821 +    			unCompressedFormat.iYuvFormat.iAspectRatioDenom = aspectRatioDenom;
  1.2822 +    			// We don't use conversion
  1.2823 +				unCompressedFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
  1.2824 +				unCompressedFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
  1.2825 +
  1.2826 +    			break;
  1.2827 +    		default:	    unCompressedFormat.iDataFormat = EYuvRawData;
  1.2828 +						    unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar; 
  1.2829 +						    unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma1;
  1.2830 +						    unCompressedFormat.iYuvFormat.iAspectRatioNum = 1;
  1.2831 +						    unCompressedFormat.iYuvFormat.iAspectRatioDenom = 1;
  1.2832 +						    unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
  1.2833 +						    
  1.2834 +						    // We don't use conversion
  1.2835 +						    unCompressedFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
  1.2836 +						    unCompressedFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
  1.2837 +    	}            
  1.2838 +    
  1.2839 +    TRAPD(result, iEngine->SetOutputFormatL(hwdev, unCompressedFormat));
  1.2840 +    if(result != KErrNone)
  1.2841 +        {
  1.2842 +        ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), result);
  1.2843 +        SetError(result);
  1.2844 +        }
  1.2845 +	}
  1.2846 +
  1.2847 +void CT_CMMFDevVideoPlay::DoCmdH264SetBufferOptions(const TTEFSectionName& aSection)
  1.2848 +	{
  1.2849 +    TInt preDecodeBufferSize = 0;
  1.2850 +	TInt maxPostDecodeBufferSize = 0;
  1.2851 +	TInt preDecoderBufferPeriodInt = 0;
  1.2852 +	TInt postDecoderBufferPeriodInt = 0;
  1.2853 +	TInt maxInputBufferSize = 0;
  1.2854 +	TInt minNumInputBuffers = 0;
  1.2855 +
  1.2856 +    if ( !(GetIntFromConfig(aSection, KPreDecodeBufferSize(), preDecodeBufferSize)))
  1.2857 +        {
  1.2858 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPreDecodeBufferSize());
  1.2859 +        SetBlockResult(EFail);
  1.2860 +        }
  1.2861 +    if ( !(GetIntFromConfig(aSection, KMaxPostDecodeBufferSize(), maxPostDecodeBufferSize)))
  1.2862 +        {
  1.2863 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMaxPostDecodeBufferSize());
  1.2864 +        SetBlockResult(EFail);
  1.2865 +        }
  1.2866 +    if ( !(GetIntFromConfig(aSection, KPreDecoderBufferPeriodInt(), preDecoderBufferPeriodInt)))
  1.2867 +        {
  1.2868 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPreDecoderBufferPeriodInt());
  1.2869 +        SetBlockResult(EFail);
  1.2870 +        }
  1.2871 +    if ( !(GetIntFromConfig(aSection, KPostDecoderBufferPeriodInt(), postDecoderBufferPeriodInt)))
  1.2872 +        {
  1.2873 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPostDecoderBufferPeriodInt());
  1.2874 +        SetBlockResult(EFail);
  1.2875 +        }
  1.2876 +    if ( !(GetIntFromConfig(aSection, KMaxInputBufferSize(), maxInputBufferSize)))
  1.2877 +        {
  1.2878 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMaxInputBufferSize());
  1.2879 +        SetBlockResult(EFail);
  1.2880 +        }
  1.2881 +    if ( !(GetIntFromConfig(aSection, KMinNumInputBuffers(), minNumInputBuffers)))
  1.2882 +        {
  1.2883 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMinNumInputBuffers());
  1.2884 +        SetBlockResult(EFail);
  1.2885 +        }    
  1.2886 +
  1.2887 +    CMMFDevVideoPlay::TBufferOptions bufferOptions;
  1.2888 +	bufferOptions.iPreDecodeBufferSize = preDecodeBufferSize;
  1.2889 +	bufferOptions.iMaxPostDecodeBufferSize = maxPostDecodeBufferSize;
  1.2890 +	bufferOptions.iPreDecoderBufferPeriod = preDecoderBufferPeriodInt;
  1.2891 +	bufferOptions.iPostDecoderBufferPeriod = postDecoderBufferPeriodInt;
  1.2892 +	bufferOptions.iMaxInputBufferSize = maxInputBufferSize;
  1.2893 +	bufferOptions.iMinNumInputBuffers = minNumInputBuffers;
  1.2894 +
  1.2895 +	TRAPD(result, iEngine->SetBufferOptionsL(bufferOptions));
  1.2896 +    if(result != KErrNone)
  1.2897 +        {
  1.2898 +        ERR_PRINTF2(_L("SetBufferOptionsL left with error %d"), result);
  1.2899 +        SetError(result);
  1.2900 +        }
  1.2901 +	}
  1.2902 +
  1.2903 +void CT_CMMFDevVideoPlay::DoCmdH264Initialize()
  1.2904 +	{
  1.2905 +	INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Initialize, In"));
  1.2906 +	iEngine->Initialize();
  1.2907 +	IncOutstanding();
  1.2908 +	INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Initialize, Out"));
  1.2909 +	}
  1.2910 +
  1.2911 +void  CT_CMMFDevVideoPlay::DoCmdH264Start(const TTEFSectionName& aSection)
  1.2912 +	{
  1.2913 +	INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Start, In"));
  1.2914 +    TInt inputEnd = 0;
  1.2915 +    if ( !(GetIntFromConfig(aSection, KInputEnd(), inputEnd)))
  1.2916 +        {
  1.2917 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputEnd());
  1.2918 +        SetBlockResult(EFail);
  1.2919 +        }
  1.2920 +    if (inputEnd != 0)  
  1.2921 +    	{
  1.2922 +    	iEngine->Start(ETrue);
  1.2923 +    	}
  1.2924 +    else 
  1.2925 +    	{
  1.2926 +    	iEngine->Start(EFalse);
  1.2927 +    	}
  1.2928 +    IncOutstanding();
  1.2929 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Start, Out"));
  1.2930 +	}
  1.2931 +
  1.2932 +void CT_CMMFDevVideoPlay::DoCmdH264Stop()
  1.2933 +    {
  1.2934 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Stop, In"));
  1.2935 +    TRAPD(result, iEngine->Stop());
  1.2936 +    if(result != KErrNone)
  1.2937 +        {
  1.2938 +        ERR_PRINTF2(_L("Stop left with error %d"), result);
  1.2939 +        SetError(result);
  1.2940 +        }
  1.2941 +    INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Stop, Out result=%d"),result);
  1.2942 +    }
  1.2943 +
  1.2944 +void CT_CMMFDevVideoPlay::DoCmdH264Pause()
  1.2945 +    {
  1.2946 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Pause, In"));
  1.2947 +    TInt result = KErrNone;
  1.2948 +    result = iEngine->Pause();
  1.2949 +    INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Pause, Out result=%d"),result);    
  1.2950 +    }
  1.2951 +
  1.2952 +void CT_CMMFDevVideoPlay::DoCmdH264Resume()
  1.2953 +    {
  1.2954 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Resume, In"));
  1.2955 +    TInt result = KErrNone;
  1.2956 +    result = iEngine->Resume();
  1.2957 +    INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Resume, Out result=%d"),result);    
  1.2958 +    }
  1.2959 +
  1.2960 +void CT_CMMFDevVideoPlay::DoCmdH264IOFrameNumMatch()
  1.2961 +	{
  1.2962 +    iEngine->SetFrameMatch( ETrue );
  1.2963 +	}
  1.2964 +
  1.2965 +void CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize()
  1.2966 +    {
  1.2967 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize, In"));
  1.2968 +    RArray<TInt> framesizes;
  1.2969 +    TRAPD(result, iEngine->ListFrameSizeL(framesizes));
  1.2970 +    if(result != KErrNone)
  1.2971 +        {
  1.2972 +        ERR_PRINTF2(_L("ListFrameSizeL left with error %d"), result);
  1.2973 +        SetError(result);
  1.2974 +        }
  1.2975 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize, Out"));
  1.2976 +    }
  1.2977 +
  1.2978 +void CT_CMMFDevVideoPlay::DoCmdH264SetVideoDestScreen(const TTEFSectionName& aSection)
  1.2979 +    {
  1.2980 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::SetVideoDestScreen, In"));
  1.2981 +   
  1.2982 +    TBool dest = 0;
  1.2983 +    if(!GetBoolFromConfig(aSection, KDest(), dest))
  1.2984 +        {
  1.2985 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDest());
  1.2986 +        SetBlockResult(EFail);
  1.2987 +        }
  1.2988 +
  1.2989 +    TRAPD(result, iEngine->SetVideoDestScreenL(dest));
  1.2990 +    if(result != KErrNone)
  1.2991 +        {
  1.2992 +        ERR_PRINTF2(_L("SetVideoDestScreenL left with error %d"), result);
  1.2993 +        SetError(result);
  1.2994 +        }    
  1.2995 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetVideoDestScreen, Out"));
  1.2996 +    } 
  1.2997 +
  1.2998 +void CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect(const TTEFSectionName& aSection)
  1.2999 +    {
  1.3000 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect, In"));
  1.3001 +    
  1.3002 +    TInt x;
  1.3003 +    TInt y;
  1.3004 +    TInt width;
  1.3005 +    TInt height;
  1.3006 +
  1.3007 +    if ( !(GetIntFromConfig(aSection, KX(), x)))
  1.3008 +        {
  1.3009 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KX());
  1.3010 +        SetBlockResult(EFail);
  1.3011 +        }
  1.3012 +    if ( !(GetIntFromConfig(aSection, KY(), y)))
  1.3013 +        {
  1.3014 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KY());
  1.3015 +        SetBlockResult(EFail);
  1.3016 +        }
  1.3017 +    if ( !(GetIntFromConfig(aSection, KWidth(), width)))
  1.3018 +        {
  1.3019 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
  1.3020 +        SetBlockResult(EFail);
  1.3021 +        }
  1.3022 +    if ( !(GetIntFromConfig(aSection, KHeight(), height)))
  1.3023 +        {
  1.3024 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
  1.3025 +        SetBlockResult(EFail);
  1.3026 +        }
  1.3027 +
  1.3028 +    TSize size(width, height);
  1.3029 +    
  1.3030 +    iEngine->SetWindowRect(x, y, size);
  1.3031 +    
  1.3032 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect, Out"));  
  1.3033 +    }
  1.3034 +
  1.3035 +void CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor(const TTEFSectionName& aSection)
  1.3036 +    {
  1.3037 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor, In"));
  1.3038 +    
  1.3039 +    TInt uidInt = 0;
  1.3040 +    if(!GetHexFromConfig(aSection, KUid(), uidInt))
  1.3041 +        {
  1.3042 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUid());
  1.3043 +        SetBlockResult(EFail);
  1.3044 +        }
  1.3045 +    
  1.3046 +    TUid postproUid;
  1.3047 +    postproUid.iUid = uidInt;
  1.3048 +    INFO_PRINTF2(_L("PostProcessor uid is [%x]"), postproUid.iUid);
  1.3049 +                
  1.3050 +    TRAPD(result, iEngine->SelectPostProcessorL(postproUid));
  1.3051 +    if(result != KErrNone)
  1.3052 +        {
  1.3053 +        ERR_PRINTF2(_L("SelectPostProcessorL left with error %d"), result);
  1.3054 +        SetError(result);
  1.3055 +        }     
  1.3056 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor, Out"));
  1.3057 +    }
  1.3058 +
  1.3059 +void CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes(const TTEFSectionName& aSection)
  1.3060 +    {
  1.3061 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes, In"));
  1.3062 +    
  1.3063 +    TInt combination = 0;
  1.3064 +    TInt hwdev = 0;
  1.3065 +
  1.3066 +    if(!GetIntFromConfig(aSection, KHwdev(), hwdev))
  1.3067 +        {
  1.3068 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
  1.3069 +        SetBlockResult(EFail);
  1.3070 +        }
  1.3071 +    if(!GetHexFromConfig(aSection, KCombination(), combination))
  1.3072 +        {
  1.3073 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCombination());
  1.3074 +        SetBlockResult(EFail);
  1.3075 +        }
  1.3076 +    
  1.3077 +    TRAPD(result, iEngine->SetPostProcessTypesL(hwdev, combination));
  1.3078 +    if(result != KErrNone)
  1.3079 +        {
  1.3080 +        ERR_PRINTF2(_L("SetPostProcessTypesL left with error %d"), result);
  1.3081 +        SetError(result);
  1.3082 +        }    
  1.3083 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes, In"));
  1.3084 +    }
  1.3085 +
  1.3086 +void CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats()
  1.3087 +    {
  1.3088 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats, In") );
  1.3089 +      
  1.3090 +    TRAPD(result, iEngine->FindCommonFormatsL());
  1.3091 +    if(result != KErrNone)
  1.3092 +        {
  1.3093 +        ERR_PRINTF2(_L("FindCommonFormatsL left with error %d"), result);
  1.3094 +        SetError(result);
  1.3095 +        }     
  1.3096 +    INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats, Out [%d]"), result);
  1.3097 +    }
  1.3098 +
  1.3099 +
  1.3100 +void CT_CMMFDevVideoPlay::DoCmdH264GetHeaderInformation(const TTEFSectionName& aSection)
  1.3101 +    {
  1.3102 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::GetHeaderInformation, In") );
  1.3103 +    TInt result = KErrNone; 
  1.3104 +    TInt dataUnitTypeInt = 0;
  1.3105 +    TBool getDataUnitTypeInt = ETrue;
  1.3106 +    if(!GetIntFromConfig(aSection, KDataUnitTypeInt(), dataUnitTypeInt))
  1.3107 +        {
  1.3108 +        getDataUnitTypeInt = EFalse;
  1.3109 +        }
  1.3110 +    TInt encapsulation = 0;
  1.3111 +    TBool getEncapsulation = ETrue;
  1.3112 +    if(!GetIntFromConfig(aSection, KEncapsulation(), encapsulation))
  1.3113 +        {
  1.3114 +        getEncapsulation = EFalse;
  1.3115 +        }
  1.3116 +    if(getDataUnitTypeInt && getEncapsulation)
  1.3117 +        {
  1.3118 +        TVideoDataUnitType dataUnitType;
  1.3119 +        switch (dataUnitTypeInt)
  1.3120 +            {
  1.3121 +            case 1: dataUnitType = EDuCodedPicture;
  1.3122 +                    break;
  1.3123 +            case 2: dataUnitType = EDuVideoSegment;
  1.3124 +                    break;
  1.3125 +            case 3: dataUnitType = EDuSeveralSegments;
  1.3126 +                    break;          
  1.3127 +            case 4: dataUnitType = EDuArbitraryStreamSection;
  1.3128 +                    break;              
  1.3129 +            default:dataUnitType = EDuCodedPicture;         
  1.3130 +            }
  1.3131 +                
  1.3132 +        TVideoDataUnitEncapsulation dataEncapsulation;      
  1.3133 +        switch (encapsulation) 
  1.3134 +            {
  1.3135 +            case 1: dataEncapsulation = EDuElementaryStream;
  1.3136 +                    break;
  1.3137 +            case 2: dataEncapsulation = EDuGenericPayload;
  1.3138 +                    break;
  1.3139 +            case 3: dataEncapsulation = EDuRtpPayload;
  1.3140 +                    break;
  1.3141 +            default:dataEncapsulation = EDuElementaryStream;                
  1.3142 +            }
  1.3143 +        
  1.3144 +        TRAP(result, iEngine->GetHeaderInformationL(dataUnitType, dataEncapsulation));
  1.3145 +        }
  1.3146 +    else 
  1.3147 +        {
  1.3148 +        TRAP(result, iEngine->GetHeaderInformationL());
  1.3149 +        }           
  1.3150 +    if(result != KErrNone)
  1.3151 +        {
  1.3152 +        ERR_PRINTF2(_L("GetHeaderInformationL left with error %d"), result);
  1.3153 +        SetError(result);
  1.3154 +        }     
  1.3155 +    INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::GetHeaderInformation, Out [%d]"), result);
  1.3156 +    }
  1.3157 +
  1.3158 +void CT_CMMFDevVideoPlay::DoCmdH264EnableSynchronization(const TTEFSectionName& aSection)
  1.3159 +    {
  1.3160 +    if(!GetIntFromConfig(aSection, KFramerate(), iFrameRate))
  1.3161 +        {
  1.3162 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFramerate());
  1.3163 +        SetBlockResult(EFail);
  1.3164 +        }
  1.3165 +    
  1.3166 +    iEngine->EnableSynchronization(iFrameRate);
  1.3167 +    }
  1.3168 +
  1.3169 +void CT_CMMFDevVideoPlay::DoCmdH264SetScaleOptions(const TTEFSectionName& aSection)
  1.3170 +    {
  1.3171 +    TInt width = 0;
  1.3172 +    TInt height = 0;
  1.3173 +    TInt antiAliasing = 0;
  1.3174 +    TInt hwdev = 0;
  1.3175 +
  1.3176 +    if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
  1.3177 +        {
  1.3178 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
  1.3179 +        SetBlockResult(EFail);
  1.3180 +        }   
  1.3181 +    if ( !(GetIntFromConfig(aSection, KWidth(), width)))
  1.3182 +        {
  1.3183 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
  1.3184 +        SetBlockResult(EFail);
  1.3185 +        }
  1.3186 +    if ( !(GetIntFromConfig(aSection, KHeight(), height)))
  1.3187 +        {
  1.3188 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
  1.3189 +        SetBlockResult(EFail);
  1.3190 +        }
  1.3191 +    if ( !(GetIntFromConfig(aSection, KY(), antiAliasing)))
  1.3192 +        {
  1.3193 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KY());
  1.3194 +        SetBlockResult(EFail);
  1.3195 +        }
  1.3196 + 
  1.3197 +    TSize size(width, height);
  1.3198 +      
  1.3199 +    TRAPD(result, iEngine->SetScaleOptionsL(hwdev, size, antiAliasing));
  1.3200 +    if(result != KErrNone)
  1.3201 +        {
  1.3202 +        ERR_PRINTF2(_L("FindCommonFormatsL left with error %d"), result);
  1.3203 +        SetError(result);
  1.3204 +        } 
  1.3205 +    }
  1.3206 +
  1.3207 +void CT_CMMFDevVideoPlay::DoCmdH264SetRotateOptions(const TTEFSectionName& aSection)
  1.3208 +{
  1.3209 +    TInt rotItem = 0;       
  1.3210 +    TInt hwdev = 0;
  1.3211 +    if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
  1.3212 +        {
  1.3213 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
  1.3214 +        SetBlockResult(EFail);
  1.3215 +        }   
  1.3216 +    if ( !(GetIntFromConfig(aSection, KRotation(), rotItem)))
  1.3217 +        {
  1.3218 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KRotation());
  1.3219 +        SetBlockResult(EFail);
  1.3220 +        }
  1.3221 +    TRotationType rotation;   
  1.3222 +    switch(rotItem)
  1.3223 +    {
  1.3224 +        case 0:
  1.3225 +            rotation = ERotateNone;
  1.3226 +            break;
  1.3227 +        case 90:
  1.3228 +            rotation = ERotate90Clockwise;
  1.3229 +            break;              
  1.3230 +        case 180:        
  1.3231 +            rotation = ERotate180;
  1.3232 +            break;        
  1.3233 +        case 270:
  1.3234 +            rotation = ERotate90Anticlockwise;
  1.3235 +            break;              
  1.3236 +        default:               
  1.3237 +            rotation = ERotateNone;                             
  1.3238 +    }
  1.3239 +    TRAPD(result, iEngine->SetRotateOptionsL(hwdev, rotation));
  1.3240 +    if(result != KErrNone)
  1.3241 +        {
  1.3242 +        ERR_PRINTF2(_L("SetRotateOptionsL left with error %d"), result);
  1.3243 +        SetError(result);
  1.3244 +        } 
  1.3245 +}
  1.3246 +
  1.3247 +void CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding(const TTEFSectionName& aSection)
  1.3248 +    {
  1.3249 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding, In"));
  1.3250 +    TBool sync = 0;
  1.3251 +    if(!GetBoolFromConfig(aSection, KSync(), sync))
  1.3252 +        {
  1.3253 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSync());
  1.3254 +        SetBlockResult(EFail);
  1.3255 +        }
  1.3256 +    iEngine->SynchronizeDecoding(sync);
  1.3257 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding, Out"));
  1.3258 +    }
  1.3259 +
  1.3260 +void CT_CMMFDevVideoPlay::DoCmdH264Delete()
  1.3261 +    {
  1.3262 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete, In"));
  1.3263 +    if (iFileOpen && iUse264)
  1.3264 +        {
  1.3265 +        iEngine->CloseFile();
  1.3266 +        }
  1.3267 +    iEngine->TearDown();
  1.3268 +    if(iEngine)
  1.3269 +        {
  1.3270 +        delete iEngine;
  1.3271 +        iEngine = NULL;
  1.3272 +        }
  1.3273 +    if(iObserver)
  1.3274 +        {
  1.3275 +        delete iObserver;
  1.3276 +        iObserver = NULL;
  1.3277 +        }
  1.3278 +    if(iClock)
  1.3279 +        {
  1.3280 +        delete iClock;
  1.3281 +        iClock = NULL;
  1.3282 +        }
  1.3283 +    while(Outstanding())
  1.3284 +        {
  1.3285 +        INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete DecOutstanding()"));
  1.3286 +        DecOutstanding();
  1.3287 +        }
  1.3288 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete, Out"));
  1.3289 +    }
  1.3290 +
  1.3291 +void CT_CMMFDevVideoPlay::DoCmdH264SetPosition(const TTEFSectionName& aSection)
  1.3292 +    {
  1.3293 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPosition, In"));
  1.3294 +    TInt pos;
  1.3295 +    TBool dataOk = ETrue;
  1.3296 +    if ( !(GetIntFromConfig(aSection, KPos(), pos)) ) //This parameter indicates seconds to move forward/backward from the current position
  1.3297 +        {
  1.3298 +        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPos());
  1.3299 +        SetBlockResult(EFail);
  1.3300 +        dataOk = EFalse;
  1.3301 +        }
  1.3302 +    if(dataOk)
  1.3303 +        {
  1.3304 +        TInt frameTimeInterval = (TInt64)(1000000/iFrameRate);
  1.3305 +        TInt newPosition = (iEngine->PlaybackPosition()).Int64()/frameTimeInterval + pos;
  1.3306 +        INFO_PRINTF2(_L("set to position %d"),newPosition);
  1.3307 +        TInt maxPosition = iEngine->GetFrameSizeCount();
  1.3308 +        INFO_PRINTF2(_L("total framesize count %d"),maxPosition);
  1.3309 +        if(newPosition >= maxPosition)
  1.3310 +            {
  1.3311 +            INFO_PRINTF3(_L("Invalid forward position %d, auto set to maximum framesize count %d"),newPosition,maxPosition-1);
  1.3312 +            newPosition = maxPosition - 1;
  1.3313 +            }
  1.3314 +        if(newPosition <= 0)
  1.3315 +            {
  1.3316 +            INFO_PRINTF2(_L("Invalid backward position %d, auto set to starting position."),newPosition);
  1.3317 +            newPosition = 1;
  1.3318 +            }
  1.3319 +        TTimeIntervalMicroSeconds timestamp = newPosition*frameTimeInterval;  
  1.3320 +        iEngine->SetPosition(timestamp);
  1.3321 +        }
  1.3322 +    INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPosition, Out"));
  1.3323 +    }
  1.3324 +
  1.3325 +void CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess()
  1.3326 +	{
  1.3327 +	INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess In"));
  1.3328 +	iEngine->AbortDirectScreenAccess();
  1.3329 +	INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess, Out"));
  1.3330 +	}