os/mm/mmdevicefw/mdfunittest/codecapi/video/src/videoplayfile_cov.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <mmf/devvideo/videoplayhwdevice.h>
sl@0
    17
#include <mmf/server/mmfdatabuffer.h>
sl@0
    18
#include "videoplayfile_cov.h"
sl@0
    19
sl@0
    20
#include "../../PU/video/src/Plugin/VideoTestDecoderPU/videotestdecoderpu.hrh"
sl@0
    21
#include "../../PU/video/src/Plugin/VideoTestEncoderPU/videotestencoderpu.hrh"
sl@0
    22
sl@0
    23
const TInt KInputBufferSize = 8192;
sl@0
    24
const TInt KFilePositionZero = 0;
sl@0
    25
const TInt KTBufSize = 256;
sl@0
    26
const TInt KTRegionFixSize = 1;
sl@0
    27
const TInt64 KInterval=2184;
sl@0
    28
const TInt KVideoDecoderMaxDataBufferSize = 0x40000;
sl@0
    29
const TUint KMinInputBuffers=2;
sl@0
    30
_LIT8(KMime,"video/x-symbiantest");
sl@0
    31
_LIT8(KBlank,"");
sl@0
    32
sl@0
    33
sl@0
    34
// **************************************************
sl@0
    35
// instructs the Hw Device Adapter to play a file	
sl@0
    36
// **************************************************
sl@0
    37
CPlayVideoFileCov::CPlayVideoFileCov(RTestStepVideoCodecs* aParent) : 
sl@0
    38
	CActive(EPriorityNormal),
sl@0
    39
	iState(EHwDeviceInit),
sl@0
    40
	iParent(aParent)
sl@0
    41
	{
sl@0
    42
	}
sl@0
    43
sl@0
    44
void  CPlayVideoFileCov::ConstructL()
sl@0
    45
	{
sl@0
    46
	CActiveScheduler::Add(this);
sl@0
    47
	User::LeaveIfError(RFbsSession::Connect());
sl@0
    48
sl@0
    49
	TInt err = KErrNone;
sl@0
    50
	TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16MA));
sl@0
    51
	if (err == KErrNotSupported)
sl@0
    52
		{
sl@0
    53
		TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16M));
sl@0
    54
		}
sl@0
    55
	if (err == KErrNotSupported)
sl@0
    56
		{
sl@0
    57
		TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor64K));
sl@0
    58
		}
sl@0
    59
	if (err == KErrNotSupported)
sl@0
    60
		{
sl@0
    61
		TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor4K));
sl@0
    62
		}
sl@0
    63
	if (err == KErrNotSupported)
sl@0
    64
		{
sl@0
    65
		TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor256));
sl@0
    66
		}
sl@0
    67
	if (err == KErrNotSupported)
sl@0
    68
		{
sl@0
    69
		iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16MAP);
sl@0
    70
		}	
sl@0
    71
	else
sl@0
    72
		{
sl@0
    73
		User::LeaveIfError(err);		
sl@0
    74
		}
sl@0
    75
	}
sl@0
    76
sl@0
    77
CPlayVideoFileCov* CPlayVideoFileCov::NewL(RTestStepVideoCodecs* aParent)
sl@0
    78
	{
sl@0
    79
	CPlayVideoFileCov* self = new (ELeave) CPlayVideoFileCov(aParent);
sl@0
    80
	CleanupStack::PushL(self);
sl@0
    81
	self->ConstructL();
sl@0
    82
	CleanupStack::Pop(self);
sl@0
    83
	return self;
sl@0
    84
	}
sl@0
    85
	
sl@0
    86
	
sl@0
    87
void CPlayVideoFileCov::DoCancel()
sl@0
    88
	{
sl@0
    89
	}
sl@0
    90
sl@0
    91
CPlayVideoFileCov::~CPlayVideoFileCov()
sl@0
    92
	{
sl@0
    93
	iFile.Close();
sl@0
    94
	iFs.Close();
sl@0
    95
	
sl@0
    96
	delete iVideoHwDevice;
sl@0
    97
	delete iScreenDevice;
sl@0
    98
	RFbsSession::Disconnect();
sl@0
    99
	}
sl@0
   100
	
sl@0
   101
	
sl@0
   102
void CPlayVideoFileCov::LoadCodecL()	
sl@0
   103
	{
sl@0
   104
	iParent->InfoMessage(_L("Loading Hw Device Adapter and PU Codec"));
sl@0
   105
sl@0
   106
	RImplInfoPtrArray array;
sl@0
   107
	REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), array);
sl@0
   108
	TBool found = EFalse;
sl@0
   109
	CImplementationInformation* info = NULL;
sl@0
   110
	for (TInt i=0;i<array.Count() && !found;i++)
sl@0
   111
		{
sl@0
   112
		info = array[i];
sl@0
   113
		if (info->ImplementationUid() == TUid::Uid(KUidVideoTestDecoderPu))
sl@0
   114
			{
sl@0
   115
			found = ETrue;
sl@0
   116
			}
sl@0
   117
		}
sl@0
   118
	TInt err = KErrNotFound;
sl@0
   119
	if (found)
sl@0
   120
		{
sl@0
   121
		TRAP(err, iVideoHwDevice = CMMFVideoDecodeHwDevice::NewPuAdapterL(*info,*this));
sl@0
   122
		}
sl@0
   123
	else
sl@0
   124
		{
sl@0
   125
		err = KErrNotFound;
sl@0
   126
		}
sl@0
   127
	CVideoDecoderInfo* vInfo=NULL;
sl@0
   128
	iParent->InfoMessage(_L("VideoDecoderInfoLC"));
sl@0
   129
	TRAP(iError, vInfo=iVideoHwDevice->VideoDecoderInfoLC(); CleanupStack::Pop(vInfo) );
sl@0
   130
	if (iError!=KErrNone)
sl@0
   131
		{
sl@0
   132
		iParent->InfoMessage(_L("VideoDecoderInfoLC Failed"));
sl@0
   133
		SetState(EHwDeviceError);
sl@0
   134
		}
sl@0
   135
	delete vInfo;
sl@0
   136
	CCompressedVideoFormat* format=CCompressedVideoFormat::NewL(KMime);
sl@0
   137
	TVideoDataUnitType dataUnitType=EDuCodedPicture;
sl@0
   138
	TVideoDataUnitEncapsulation encapsulation=EDuElementaryStream;
sl@0
   139
	TBool dataInOrder=ETrue;
sl@0
   140
	iParent->InfoMessage(_L("SetInputFormatL"));
sl@0
   141
	TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
sl@0
   142
	if (iError!=KErrNone)
sl@0
   143
		{
sl@0
   144
		iParent->InfoMessage(_L("SetInputFormatL Failed"));
sl@0
   145
		SetState(EHwDeviceError);
sl@0
   146
		}
sl@0
   147
	//Negative test case for  SetInputFormatL
sl@0
   148
	CCompressedVideoFormat* format2=CCompressedVideoFormat::NewL(KBlank);
sl@0
   149
	TRAP(iError, iVideoHwDevice->SetInputFormatL(*format2,dataUnitType,encapsulation,dataInOrder));
sl@0
   150
	if (iError!=KErrNotSupported)
sl@0
   151
		{
sl@0
   152
		iParent->InfoMessage(_L("SetInputFormatL Failed"));
sl@0
   153
		SetState(EHwDeviceError);
sl@0
   154
		}
sl@0
   155
	delete format2;
sl@0
   156
	//Negative test case for SetInputFormatL
sl@0
   157
	dataUnitType=EDuVideoSegment;
sl@0
   158
	TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
sl@0
   159
	if (iError!=KErrNotSupported)
sl@0
   160
		{
sl@0
   161
		iParent->InfoMessage(_L("SetInputFormatL Failed"));
sl@0
   162
		SetState(EHwDeviceError);
sl@0
   163
		}
sl@0
   164
	//Negative test case for SetInputFormatL
sl@0
   165
	dataUnitType=EDuCodedPicture;
sl@0
   166
	encapsulation=EDuGenericPayload;
sl@0
   167
	TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
sl@0
   168
	if (iError!=KErrNotSupported)
sl@0
   169
		{
sl@0
   170
		iParent->InfoMessage(_L("SetInputFormatL Failed"));
sl@0
   171
		SetState(EHwDeviceError);
sl@0
   172
		}
sl@0
   173
	//Negative test case for SetInputFormatL
sl@0
   174
	encapsulation=EDuElementaryStream;
sl@0
   175
	dataInOrder=EFalse;
sl@0
   176
	TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
sl@0
   177
	if (iError!=KErrNotSupported)
sl@0
   178
		{
sl@0
   179
		iParent->InfoMessage(_L("SetInputFormatL Failed"));
sl@0
   180
		SetState(EHwDeviceError);
sl@0
   181
		}
sl@0
   182
	delete format;
sl@0
   183
	array.ResetAndDestroy();
sl@0
   184
	User::LeaveIfError(err);
sl@0
   185
sl@0
   186
	}
sl@0
   187
	
sl@0
   188
void CPlayVideoFileCov::SetDSA(TBool aUseDSA)	
sl@0
   189
	{
sl@0
   190
	// Need new version of this to load from a PU based uid
sl@0
   191
	iUseDSA = aUseDSA;
sl@0
   192
	}
sl@0
   193
	
sl@0
   194
void CPlayVideoFileCov::StartPlaybackL()	
sl@0
   195
	{
sl@0
   196
	OpenTestFileL();
sl@0
   197
	SetState(EHwDeviceInit);
sl@0
   198
	CActiveScheduler::Start();
sl@0
   199
	}
sl@0
   200
sl@0
   201
void CPlayVideoFileCov::SetState(TPlayVideoFileState aState)
sl@0
   202
	{
sl@0
   203
	iState = aState;
sl@0
   204
	SetActive();	
sl@0
   205
	TRequestStatus* status = &iStatus;
sl@0
   206
	User::RequestComplete(status, KErrNone);	
sl@0
   207
	}
sl@0
   208
sl@0
   209
void CPlayVideoFileCov::OpenTestFileL()
sl@0
   210
	{
sl@0
   211
	TBuf<KTBufSize> buf;
sl@0
   212
	buf.Format(_L("Opening test input file %S"), &KTestPlaybackFile);
sl@0
   213
	iParent->InfoMessage(buf);
sl@0
   214
	User::LeaveIfError(iFs.Connect());
sl@0
   215
	User::LeaveIfError(iFile.Open(iFs, KTestPlaybackFile, EFileRead));
sl@0
   216
	}
sl@0
   217
sl@0
   218
void CPlayVideoFileCov::RunL()
sl@0
   219
 	{
sl@0
   220
	switch (iState)
sl@0
   221
		{
sl@0
   222
		case EHwDeviceInit:
sl@0
   223
			{
sl@0
   224
			iParent->InfoMessage(_L("State: EHwDeviceInit"));
sl@0
   225
			TRAPD(err, InitializeL());
sl@0
   226
			if (err != KErrNone)
sl@0
   227
				{
sl@0
   228
				CleanupAndSetDeviceError(_L("Cannot intialize HwDevice"));
sl@0
   229
				break;
sl@0
   230
				}
sl@0
   231
			break;
sl@0
   232
			}
sl@0
   233
		case EHwDeviceStartDecode:
sl@0
   234
			{
sl@0
   235
			// if we are playing a file, first we have to open the file
sl@0
   236
			iParent->InfoMessage(_L("State: EHwDeviceStartDecode"));
sl@0
   237
			TRAPD(err, StartDecodeL());
sl@0
   238
			if (err != KErrNone)
sl@0
   239
				{
sl@0
   240
				CleanupAndSetDeviceError(_L("Cannot start decoding"));
sl@0
   241
				break;
sl@0
   242
				}
sl@0
   243
			break;
sl@0
   244
			}
sl@0
   245
		case EHwDeviceAllowToComplete:
sl@0
   246
			iParent->InfoMessage(_L("State: EHwDeviceAllowToComplete"));
sl@0
   247
			break;
sl@0
   248
		case EHwDeviceDone:
sl@0
   249
			{
sl@0
   250
			iParent->InfoMessage(_L("State: EHwDeviceDeviceDone"));
sl@0
   251
			Cancel();
sl@0
   252
			CActiveScheduler::Stop();
sl@0
   253
			break;
sl@0
   254
			}				
sl@0
   255
		case EHwDeviceError:
sl@0
   256
			{
sl@0
   257
			TBuf<KTBufSize> buf;
sl@0
   258
			buf.Format(_L("State: EHwDeviceDeviceError %d"), iError);
sl@0
   259
			iParent->SetVerdict(buf, EFail);
sl@0
   260
			
sl@0
   261
			CActiveScheduler::Stop();
sl@0
   262
			break;
sl@0
   263
			}
sl@0
   264
		default:
sl@0
   265
			{
sl@0
   266
			CleanupAndSetDeviceError(_L("Unknown CPlayVideoFileCov iState"));
sl@0
   267
			break;
sl@0
   268
			}
sl@0
   269
		}
sl@0
   270
	}
sl@0
   271
	
sl@0
   272
	
sl@0
   273
void CPlayVideoFileCov::InitializeL()
sl@0
   274
	{
sl@0
   275
	iParent->InfoMessage(_L("InitializeL()"));
sl@0
   276
sl@0
   277
	CMMFDevVideoPlay::TBufferOptions bufferOptions;
sl@0
   278
	bufferOptions.iMaxInputBufferSize=0x40000;
sl@0
   279
	iVideoHwDevice->SetBufferOptionsL(bufferOptions);
sl@0
   280
	
sl@0
   281
	TTimeIntervalMicroSeconds Interval(KInterval);
sl@0
   282
	iVideoHwDevice->SetPosition(Interval);
sl@0
   283
	
sl@0
   284
	CMMFDevVideoPlay::TBitstreamCounters bitstreamCounters;
sl@0
   285
	iVideoHwDevice->GetBitstreamCounters(bitstreamCounters);
sl@0
   286
sl@0
   287
	CMMFDevVideoPlay::TBufferOptions Options;
sl@0
   288
	Options.iMaxInputBufferSize=0x40000;
sl@0
   289
	iVideoHwDevice->SetBufferOptionsL(Options);
sl@0
   290
	
sl@0
   291
	CMMFDevVideoPlay::TBitstreamCounters Counters;
sl@0
   292
	iVideoHwDevice->GetBitstreamCounters(Counters);
sl@0
   293
	
sl@0
   294
	TUint complexityLevel=1;
sl@0
   295
	iParent->InfoMessage(_L("SetComplexityLevel"));
sl@0
   296
	TRAP(iError, iVideoHwDevice->SetComplexityLevel(complexityLevel) );
sl@0
   297
	if (iError!=KErrNone)
sl@0
   298
		{
sl@0
   299
		iParent->InfoMessage(_L("SetComplexityLevel Failed"));
sl@0
   300
		SetState(EHwDeviceError);
sl@0
   301
		}
sl@0
   302
	THrdVbvSpecification HrdVbvSpec=EHrdVbvNone;
sl@0
   303
	iParent->InfoMessage(_L("SetHrdVbvSpec"));
sl@0
   304
	TRAP(iError, iVideoHwDevice->SetHrdVbvSpec(HrdVbvSpec,KBlank) );
sl@0
   305
	if (iError!=KErrNone)
sl@0
   306
		{
sl@0
   307
		iParent->InfoMessage(_L("SetHrdVbvSpec Failed"));
sl@0
   308
		SetState(EHwDeviceError);
sl@0
   309
		}
sl@0
   310
	TRect rect;
sl@0
   311
	iParent->InfoMessage(_L("SetInputCropOptionsL"));
sl@0
   312
	TRAP(iError, iVideoHwDevice->SetInputCropOptionsL(rect) );
sl@0
   313
	if (iError!=KErrNotSupported)
sl@0
   314
		{
sl@0
   315
		iParent->InfoMessage(_L("SetInputCropOptionsL Failed"));
sl@0
   316
		SetState(EHwDeviceError);
sl@0
   317
		}
sl@0
   318
	iParent->InfoMessage(_L("SetOutputCropOptionsL"));
sl@0
   319
	TRAP(iError, iVideoHwDevice->SetOutputCropOptionsL(rect) );
sl@0
   320
	if (iError!=KErrNotSupported)
sl@0
   321
		{
sl@0
   322
		iParent->InfoMessage(_L("SetOutputCropOptionsL Failed"));
sl@0
   323
		SetState(EHwDeviceError);
sl@0
   324
		}
sl@0
   325
	iParent->InfoMessage(_L("SetPauseOnClipFail"));
sl@0
   326
	TRAP(iError, iVideoHwDevice->SetPauseOnClipFail(ETrue) );
sl@0
   327
	if (iError!=KErrNone)
sl@0
   328
		{
sl@0
   329
		iParent->InfoMessage(_L("SetPauseOnClipFail Failed"));
sl@0
   330
		SetState(EHwDeviceError);
sl@0
   331
		}
sl@0
   332
	iParent->InfoMessage(_L("SetPostProcessTypesL"));
sl@0
   333
	TRAP(iError, iVideoHwDevice->SetPostProcessTypesL(ETrue) );
sl@0
   334
	if (iError!=KErrNotSupported)
sl@0
   335
		{
sl@0
   336
		iParent->InfoMessage(_L("SetPostProcessTypesL Failed"));
sl@0
   337
		SetState(EHwDeviceError);
sl@0
   338
		}
sl@0
   339
	iParent->InfoMessage(_L("SetPostProcSpecificOptionsL"));
sl@0
   340
	TRAP(iError, iVideoHwDevice->SetPostProcSpecificOptionsL(KBlank) );
sl@0
   341
	if (iError!=KErrNotSupported)
sl@0
   342
		{
sl@0
   343
		iParent->InfoMessage(_L("SetPostProcSpecificOptionsL Failed"));
sl@0
   344
		SetState(EHwDeviceError);
sl@0
   345
		}
sl@0
   346
	TRotationType rotType=ERotate90Clockwise;
sl@0
   347
	iParent->InfoMessage(_L("SetRotateOptionsL"));
sl@0
   348
	TRAP(iError, iVideoHwDevice->SetRotateOptionsL(rotType) );
sl@0
   349
	if (iError!=KErrNotSupported)
sl@0
   350
		{
sl@0
   351
		iParent->InfoMessage(_L("SetRotateOptionsL Failed"));
sl@0
   352
		SetState(EHwDeviceError);
sl@0
   353
		}
sl@0
   354
	TSize size(12,30);
sl@0
   355
	iParent->InfoMessage(_L("SetScaleOptionsL"));
sl@0
   356
	TRAP(iError, iVideoHwDevice->SetScaleOptionsL(size,ETrue) );
sl@0
   357
	if (iError!=KErrNotSupported)
sl@0
   358
		{
sl@0
   359
		iParent->InfoMessage(_L("SetScaleOptionsL Failed"));
sl@0
   360
		SetState(EHwDeviceError);
sl@0
   361
		}
sl@0
   362
	TYuvToRgbOptions YuvOption;
sl@0
   363
	
sl@0
   364
	iParent->InfoMessage(_L("SetYuvToRgbOptionsL"));
sl@0
   365
	TRAP(iError, iVideoHwDevice->SetYuvToRgbOptionsL(YuvOption) );
sl@0
   366
	if (iError!=KErrNotSupported)
sl@0
   367
		{
sl@0
   368
		iParent->InfoMessage(_L("SetYuvToRgbOptionsL Failed"));
sl@0
   369
		SetState(EHwDeviceError);
sl@0
   370
		}
sl@0
   371
	TYuvFormat YuvFormat;
sl@0
   372
	TRgbFormat RgbFormat=ERgb16bit444;
sl@0
   373
	iParent->InfoMessage(_L("SetYuvToRgbOptionsL"));
sl@0
   374
	TRAP(iError, iVideoHwDevice->SetYuvToRgbOptionsL(YuvOption,YuvFormat,RgbFormat) );
sl@0
   375
	if (iError!=KErrNotSupported)
sl@0
   376
		{
sl@0
   377
		iParent->InfoMessage(_L("SetYuvToRgbOptionsL Failed"));
sl@0
   378
		SetState(EHwDeviceError);
sl@0
   379
		}
sl@0
   380
	CMMFVideoPostProcHwDevice *outDevice = NULL;
sl@0
   381
	iParent->InfoMessage(_L("SetOutputDevice"));
sl@0
   382
	TRAP(iError, iVideoHwDevice->SetOutputDevice(outDevice) );
sl@0
   383
	if (iError!=KErrNone)
sl@0
   384
		{
sl@0
   385
		iParent->InfoMessage(_L("SetOutputDevice Failed"));
sl@0
   386
		SetState(EHwDeviceError);
sl@0
   387
		}
sl@0
   388
	
sl@0
   389
	TVideoPictureHeader  videoPictureHeader;
sl@0
   390
	iParent->InfoMessage(_L("ConfigureDecoderL"));
sl@0
   391
	TRAP(iError, iVideoHwDevice->ConfigureDecoderL(videoPictureHeader) );
sl@0
   392
	if (iError!=KErrNotSupported)
sl@0
   393
		{
sl@0
   394
		iParent->InfoMessage(_L("ConfigureDecoderL Failed"));
sl@0
   395
		SetState(EHwDeviceError);
sl@0
   396
		}
sl@0
   397
	TUncompressedVideoFormat reqFormat;
sl@0
   398
		
sl@0
   399
	reqFormat.iDataFormat = ERgbFbsBitmap;
sl@0
   400
	reqFormat.iRgbFormat = EFbsBitmapColor16M;
sl@0
   401
	
sl@0
   402
	RArray<TUncompressedVideoFormat> decodeFormats;
sl@0
   403
	iVideoHwDevice->GetOutputFormatListL(decodeFormats);
sl@0
   404
	CleanupClosePushL(decodeFormats);
sl@0
   405
	User::LeaveIfError(decodeFormats.Find(reqFormat));
sl@0
   406
sl@0
   407
	iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
sl@0
   408
	iVideoHwDevice->SetOutputFormatL(reqFormat);
sl@0
   409
	CleanupStack::PopAndDestroy(&decodeFormats);	
sl@0
   410
	
sl@0
   411
	CMMFDescriptorBuffer* buffer = CMMFDescriptorBuffer::NewL(KInputBufferSize);
sl@0
   412
	CleanupStack::PushL(buffer);
sl@0
   413
	TVideoInputBuffer inputBuffer;
sl@0
   414
	
sl@0
   415
	TDes8& des = buffer->Data();
sl@0
   416
	// read header data from file
sl@0
   417
	User::LeaveIfError(iFile.Read(des));
sl@0
   418
	TInt pos = KFilePositionZero;
sl@0
   419
	// seek back to start
sl@0
   420
	User::LeaveIfError(iFile.Seek(ESeekStart, pos));
sl@0
   421
sl@0
   422
	TBuf<KTBufSize> buf;
sl@0
   423
	buf.Format(_L("Read header of size %d"),inputBuffer.iData.Length());
sl@0
   424
	iParent->InfoMessage(buf);
sl@0
   425
	
sl@0
   426
	if (des.Length()>0)
sl@0
   427
		{
sl@0
   428
		// Set the pointer
sl@0
   429
		inputBuffer.iData.Set(&des[0],des.Length(),des.MaxLength());
sl@0
   430
		
sl@0
   431
		iParent->InfoMessage(_L("Call VideoHwDevice GetHeaderInformationL()"));
sl@0
   432
		TVideoPictureHeader* header = iVideoHwDevice->GetHeaderInformationL(EDuArbitraryStreamSection, 
sl@0
   433
												EDuElementaryStream,
sl@0
   434
												&inputBuffer);
sl@0
   435
		TVideoPictureHeader* header2 =NULL;
sl@0
   436
		//Call ReturnHeader for negative test
sl@0
   437
		iVideoHwDevice->ReturnHeader(header2);
sl@0
   438
		iFrameSize = header->iSizeInMemory;
sl@0
   439
		iVideoHwDevice->ReturnHeader(header);
sl@0
   440
		}
sl@0
   441
	else
sl@0
   442
		{
sl@0
   443
		// Cannot read any data from file, so no point in continuing
sl@0
   444
		User::Leave(KErrCorrupt);
sl@0
   445
		}
sl@0
   446
		
sl@0
   447
	CleanupStack::PopAndDestroy(buffer);	
sl@0
   448
	
sl@0
   449
	iParent->InfoMessage(_L("Call VideoHwDevice SetVideoDestScreenL()"));
sl@0
   450
	iVideoHwDevice->SetVideoDestScreenL(iUseDSA);
sl@0
   451
	
sl@0
   452
	iParent->InfoMessage(_L("Call VideoHwDevice->Initialize()"));
sl@0
   453
	iVideoHwDevice->Initialize();
sl@0
   454
	}
sl@0
   455
	
sl@0
   456
	
sl@0
   457
void CPlayVideoFileCov::StartDecodeL()
sl@0
   458
	{
sl@0
   459
	iParent->InfoMessage(_L("SynchronizeDecoding"));
sl@0
   460
	TRAP(iError, iVideoHwDevice->SynchronizeDecoding(ETrue) );
sl@0
   461
	if (iError!=KErrNone)
sl@0
   462
		{
sl@0
   463
		iParent->InfoMessage(_L("SynchronizeDecoding Failed"));
sl@0
   464
		SetState(EHwDeviceError);
sl@0
   465
		}
sl@0
   466
	iParent->InfoMessage(_L("StartDecodeL()"));
sl@0
   467
sl@0
   468
	if (iUseDSA)
sl@0
   469
		{
sl@0
   470
		StartDirectScreenAccessL();
sl@0
   471
		}
sl@0
   472
	// tell the HwDeviceAdapter to play the file
sl@0
   473
	iParent->InfoMessage(_L("Call VideoHwDevice->Start()"));
sl@0
   474
	iVideoHwDevice->Start();
sl@0
   475
	CSystemClockSource *time1= NULL;
sl@0
   476
	
sl@0
   477
	iParent->InfoMessage(_L("SetClockSource"));
sl@0
   478
	TRAP(iError, iVideoHwDevice->SetClockSource(time1) );
sl@0
   479
	if (iError!=KErrNone)
sl@0
   480
		{
sl@0
   481
		iParent->InfoMessage(_L("SetClockSource Failed"));
sl@0
   482
		SetState(EHwDeviceError);
sl@0
   483
		}
sl@0
   484
	
sl@0
   485
	delete time1;
sl@0
   486
	iVideoHwDevice->PictureBufferBytes();
sl@0
   487
	CMMFDevVideoPlay::TComplexityLevelInfo aInfo;
sl@0
   488
	iVideoHwDevice->GetComplexityLevelInfo(0,aInfo);
sl@0
   489
	//Call GetComplexityLevelInfo for False condition coverage
sl@0
   490
	iVideoHwDevice->GetComplexityLevelInfo(1,aInfo);
sl@0
   491
	iVideoHwDevice->IsPlaying();
sl@0
   492
	CMMFDevVideoPlay::TPictureCounters PictureCounters;
sl@0
   493
	iParent->InfoMessage(_L("GetPictureCounters"));
sl@0
   494
	TRAP(iError, iVideoHwDevice->GetPictureCounters(PictureCounters) );
sl@0
   495
	if (iError!=KErrNone)
sl@0
   496
		{
sl@0
   497
		iParent->InfoMessage(_L("GetPictureCounters Failed"));
sl@0
   498
		SetState(EHwDeviceError);
sl@0
   499
		}
sl@0
   500
	TPictureData PictureData;
sl@0
   501
	TUncompressedVideoFormat UncomprossedVideoFormat;
sl@0
   502
	iParent->InfoMessage(_L("GetSnapshotL"));
sl@0
   503
	TRAP(iError, iVideoHwDevice->GetSnapshotL(PictureData,UncomprossedVideoFormat) );
sl@0
   504
	if (iError!=KErrNotSupported)
sl@0
   505
		{
sl@0
   506
		iParent->InfoMessage(_L("GetSnapshotL Failed"));
sl@0
   507
		SetState(EHwDeviceError);
sl@0
   508
		}
sl@0
   509
	CMMFDevVideoPlay::TBufferOptions bufferOptions;
sl@0
   510
	iVideoHwDevice->GetBufferOptions(bufferOptions);
sl@0
   511
	iVideoHwDevice->NumComplexityLevels();
sl@0
   512
sl@0
   513
	iParent->InfoMessage(_L("NumFreeBuffers"));
sl@0
   514
	TRAP(iError, iVideoHwDevice->NumFreeBuffers() );
sl@0
   515
	if (iError!=KErrNone)
sl@0
   516
		{
sl@0
   517
		iParent->InfoMessage(_L("NumFreeBuffers Failed"));
sl@0
   518
		SetState(EHwDeviceError);
sl@0
   519
		}
sl@0
   520
	iParent->InfoMessage(_L("PlaybackPosition"));
sl@0
   521
	TRAP(iError, iVideoHwDevice->PlaybackPosition() );
sl@0
   522
	if (iError!=KErrNone)
sl@0
   523
		{
sl@0
   524
		iParent->InfoMessage(_L("PlaybackPosition Failed"));
sl@0
   525
		SetState(EHwDeviceError);
sl@0
   526
		}
sl@0
   527
	iParent->InfoMessage(_L("DecodingPosition"));
sl@0
   528
	TRAP(iError, iVideoHwDevice->DecodingPosition() );
sl@0
   529
	if (iError!=KErrNone)
sl@0
   530
		{
sl@0
   531
		iParent->InfoMessage(_L("DecodingPosition Failed"));
sl@0
   532
		SetState(EHwDeviceError);
sl@0
   533
		}
sl@0
   534
	iParent->InfoMessage(_L("Redraw"));
sl@0
   535
	TRAP(iError, iVideoHwDevice->Redraw() );
sl@0
   536
	if (iError!=KErrNone)
sl@0
   537
		{
sl@0
   538
		iParent->InfoMessage(_L("Redraw Failed"));
sl@0
   539
		SetState(EHwDeviceError);
sl@0
   540
		}
sl@0
   541
	iParent->InfoMessage(_L("AbortDirectScreenAccess"));
sl@0
   542
	TRAP(iError, iVideoHwDevice->AbortDirectScreenAccess() );
sl@0
   543
	if (iError!=KErrNone)
sl@0
   544
		{
sl@0
   545
		iParent->InfoMessage(_L("AbortDirectScreenAccess Failed"));
sl@0
   546
		SetState(EHwDeviceError);
sl@0
   547
		}
sl@0
   548
	iParent->InfoMessage(_L("CommitL"));
sl@0
   549
	TRAP(iError, iVideoHwDevice->CommitL() );
sl@0
   550
	if (iError!=KErrNotSupported)
sl@0
   551
		{
sl@0
   552
		iParent->InfoMessage(_L("CommitL Failed"));
sl@0
   553
		SetState(EHwDeviceError);
sl@0
   554
		}
sl@0
   555
	TTimeIntervalMicroSeconds Timestamp;
sl@0
   556
	iParent->InfoMessage(_L("FreezePicture"));
sl@0
   557
	TRAP(iError, iVideoHwDevice->FreezePicture(Timestamp) );
sl@0
   558
	if (iError!=KErrNone)
sl@0
   559
		{
sl@0
   560
		iParent->InfoMessage(_L("FreezePicture Failed"));
sl@0
   561
		SetState(EHwDeviceError);
sl@0
   562
		}
sl@0
   563
	iParent->InfoMessage(_L("PostProcessorInfoLC"));
sl@0
   564
	TRAP(iError, iVideoHwDevice->PostProcessorInfoLC() );
sl@0
   565
	if (iError!=KErrNone)
sl@0
   566
		{
sl@0
   567
		iParent->InfoMessage(_L("PostProcessorInfoLC Failed"));
sl@0
   568
		SetState(EHwDeviceError);
sl@0
   569
		}
sl@0
   570
	iParent->InfoMessage(_L("PreDecoderBufferBytes"));
sl@0
   571
	TRAP(iError, iVideoHwDevice->PreDecoderBufferBytes() );
sl@0
   572
	if (iError!=KErrNone)
sl@0
   573
		{
sl@0
   574
		iParent->InfoMessage(_L("PreDecoderBufferBytes Failed"));
sl@0
   575
		SetState(EHwDeviceError);
sl@0
   576
		}
sl@0
   577
	iParent->InfoMessage(_L("ReleaseFreeze"));
sl@0
   578
	TRAP(iError, iVideoHwDevice->ReleaseFreeze(Timestamp) );
sl@0
   579
	if (iError!=KErrNone)
sl@0
   580
		{
sl@0
   581
		iParent->InfoMessage(_L("ReleaseFreeze Failed"));
sl@0
   582
		SetState(EHwDeviceError);
sl@0
   583
		}
sl@0
   584
	iParent->InfoMessage(_L("Revert"));
sl@0
   585
	TRAP(iError, iVideoHwDevice->Revert() );
sl@0
   586
	if (iError!=KErrNone)
sl@0
   587
		{
sl@0
   588
		iParent->InfoMessage(_L("Revert Failed"));
sl@0
   589
		SetState(EHwDeviceError);
sl@0
   590
		}
sl@0
   591
	iParent->InfoMessage(_L("Redraw"));
sl@0
   592
	TRAP(iError, iVideoHwDevice->Redraw() );
sl@0
   593
	if (iError!=KErrNone)
sl@0
   594
		{
sl@0
   595
		iParent->InfoMessage(_L("Redraw Failed"));
sl@0
   596
		SetState(EHwDeviceError);
sl@0
   597
		}
sl@0
   598
	
sl@0
   599
	}
sl@0
   600
	
sl@0
   601
sl@0
   602
	
sl@0
   603
void CPlayVideoFileCov::ReadNextBufferL()
sl@0
   604
	{
sl@0
   605
	// check that we aren't waiting for the input buffer to be returned
sl@0
   606
	iParent->InfoMessage(_L("ReadNextBufferL()"));
sl@0
   607
	TVideoInputBuffer* inputBuffer = iVideoHwDevice->GetBufferL(KInputBufferSize);	
sl@0
   608
	CMMFDevVideoPlay::TBufferOptions aOptions;
sl@0
   609
	iVideoHwDevice->GetBufferOptions(aOptions);
sl@0
   610
	iVideoHwDevice->NumComplexityLevels();
sl@0
   611
	
sl@0
   612
	
sl@0
   613
	if (inputBuffer)
sl@0
   614
		{
sl@0
   615
		TBuf<KTBufSize> buf;
sl@0
   616
		buf.Format(_L("inputBuffer size %d"),inputBuffer->iData.Length());
sl@0
   617
		iParent->InfoMessage(buf);
sl@0
   618
		User::LeaveIfError(iFile.Read(inputBuffer->iData));
sl@0
   619
		buf.Format(_L("Read from file %d bytes"),inputBuffer->iData.Length());
sl@0
   620
		iParent->InfoMessage(buf);
sl@0
   621
		if (inputBuffer->iData.Length()>0)
sl@0
   622
			{
sl@0
   623
			iParent->InfoMessage(_L("Call HwDevice->WriteCodedData()"));
sl@0
   624
			
sl@0
   625
			iVideoHwDevice->WriteCodedDataL(inputBuffer);
sl@0
   626
			}
sl@0
   627
		else
sl@0
   628
			{
sl@0
   629
			iParent->InfoMessage(_L("End of input stream"));
sl@0
   630
			iParent->InfoMessage(_L("Call HwDevice->InputEnd()"));
sl@0
   631
			iVideoHwDevice->InputEnd();
sl@0
   632
			}
sl@0
   633
		}
sl@0
   634
	}
sl@0
   635
		
sl@0
   636
void CPlayVideoFileCov::CleanupAndSetDeviceError(TPtrC16 aText)
sl@0
   637
	{
sl@0
   638
	iParent->SetVerdict(aText, EFail);
sl@0
   639
	delete iVideoHwDevice;
sl@0
   640
	SetState(EHwDeviceError);
sl@0
   641
	}
sl@0
   642
	
sl@0
   643
void CPlayVideoFileCov::MdvppNewPicture(TVideoPicture* aPicture)
sl@0
   644
	{
sl@0
   645
	iParent->InfoMessage(_L("MdvppNewPicture - Received Frame"));
sl@0
   646
	iVideoHwDevice->ReturnPicture(aPicture);
sl@0
   647
	iParent->InfoMessage(_L("MdvppNewPicture - finished returning Frame"));
sl@0
   648
	}
sl@0
   649
sl@0
   650
void CPlayVideoFileCov::MdvppNewBuffers()
sl@0
   651
	{
sl@0
   652
	iParent->InfoMessage(_L("MdvppNewBuffers()"));
sl@0
   653
	TRAP(iError, ReadNextBufferL());
sl@0
   654
	if (iError != KErrNone)
sl@0
   655
		{
sl@0
   656
		iParent->SetVerdict(_L("Error reading next buffer"),EFail);		
sl@0
   657
		iVideoHwDevice->Stop();
sl@0
   658
		SetState(EHwDeviceError);
sl@0
   659
		}
sl@0
   660
	}
sl@0
   661
sl@0
   662
void CPlayVideoFileCov::MdvppReturnPicture(TVideoPicture* /*aPicture*/)
sl@0
   663
	{
sl@0
   664
	iParent->InfoMessage(_L("MdvppReturnPicture()"));
sl@0
   665
	}
sl@0
   666
	
sl@0
   667
void CPlayVideoFileCov::MdvppSupplementalInformation(const TDesC8& /*aData*/, 
sl@0
   668
	const TTimeIntervalMicroSeconds& /*aTimestamp*/, const TPictureId& /*aPictureId*/)
sl@0
   669
	{
sl@0
   670
	}
sl@0
   671
	
sl@0
   672
void CPlayVideoFileCov::MdvppPictureLoss()
sl@0
   673
	{
sl@0
   674
	iParent->InfoMessage(_L("MdvppPictureLoss()"));
sl@0
   675
	}
sl@0
   676
	
sl@0
   677
void CPlayVideoFileCov::MdvppPictureLoss(const TArray<TPictureId>& /*aPictures*/)
sl@0
   678
	{
sl@0
   679
	iParent->InfoMessage(_L("MdvppPictureLoss()"));
sl@0
   680
	}
sl@0
   681
	
sl@0
   682
void CPlayVideoFileCov::MdvppSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/)
sl@0
   683
	{
sl@0
   684
	iParent->InfoMessage(_L("MdvppSliceLoss()"));
sl@0
   685
	}
sl@0
   686
	
sl@0
   687
void CPlayVideoFileCov::MdvppReferencePictureSelection(const TDesC8& /*aSelectionData*/)
sl@0
   688
	{
sl@0
   689
	}
sl@0
   690
	
sl@0
   691
void CPlayVideoFileCov::MdvppTimedSnapshotComplete(TInt /*aError*/, TPictureData* /*aPictureData*/, 
sl@0
   692
	const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, const TPictureId& /*aPictureId*/)
sl@0
   693
	{
sl@0
   694
	}
sl@0
   695
	
sl@0
   696
void CPlayVideoFileCov::MdvppFatalError(CMMFVideoHwDevice* /*aDevice*/, TInt aError)
sl@0
   697
	{
sl@0
   698
	iError = aError;
sl@0
   699
	iParent->InfoMessage(_L("MdvppFatalError()"));
sl@0
   700
	SetState(EHwDeviceError);
sl@0
   701
	}
sl@0
   702
	
sl@0
   703
void CPlayVideoFileCov::MdvppInitializeComplete(CMMFVideoHwDevice* /*aDevice*/, TInt aError)
sl@0
   704
	{
sl@0
   705
	iParent->InfoMessage(_L("MdvppInitializeComplete()"));
sl@0
   706
	iError = aError;
sl@0
   707
	if (iError == KErrNone)
sl@0
   708
		{
sl@0
   709
		iParent->InfoMessage(_L("The Hw Device Adapter initialised correctly"));
sl@0
   710
		SetState(EHwDeviceStartDecode);
sl@0
   711
		}
sl@0
   712
	else
sl@0
   713
		{
sl@0
   714
		iParent->InfoMessage(_L("Failure intialising the hw device adapter"));
sl@0
   715
		SetState(EHwDeviceError);
sl@0
   716
		}
sl@0
   717
	}
sl@0
   718
	
sl@0
   719
void CPlayVideoFileCov::MdvppStreamEnd()
sl@0
   720
	{
sl@0
   721
	iParent->InfoMessage(_L("MdvppStreamEnd()"));
sl@0
   722
	SetState(EHwDeviceDone);
sl@0
   723
	}
sl@0
   724
sl@0
   725
void CPlayVideoFileCov::StartDirectScreenAccessL()
sl@0
   726
	{
sl@0
   727
	TRegionFix<KTRegionFixSize> reg;
sl@0
   728
	TRect pos(iFrameSize);
sl@0
   729
	reg.AddRect(pos);
sl@0
   730
	iVideoHwDevice->StartDirectScreenAccessL(pos, *iScreenDevice, reg);
sl@0
   731
	iParent->InfoMessage(_L("Pause"));
sl@0
   732
	TRAP(iError, iVideoHwDevice->Pause() );
sl@0
   733
	if (iError!=KErrNone)
sl@0
   734
		{
sl@0
   735
		iParent->InfoMessage(_L("Pause Failed"));
sl@0
   736
		SetState(EHwDeviceError);
sl@0
   737
		}
sl@0
   738
	iParent->InfoMessage(_L("Resume"));
sl@0
   739
	TRAP(iError, iVideoHwDevice->Resume() );
sl@0
   740
	if (iError!=KErrNone)
sl@0
   741
		{
sl@0
   742
		iParent->InfoMessage(_L("Resume Failed"));
sl@0
   743
		SetState(EHwDeviceError);
sl@0
   744
		}
sl@0
   745
	RRegion region;
sl@0
   746
	iParent->InfoMessage(_L("SetScreenClipRegion"));
sl@0
   747
	TRAP(iError, iVideoHwDevice->SetScreenClipRegion(region) );
sl@0
   748
	if (iError!=KErrNone)
sl@0
   749
		{
sl@0
   750
		iParent->InfoMessage(_L("SetScreenClipRegion Failed"));
sl@0
   751
		SetState(EHwDeviceError);
sl@0
   752
		}
sl@0
   753
	}
sl@0
   754
void CPlayVideoFileCov::CancelTimedSnapshot()
sl@0
   755
	{
sl@0
   756
iParent->InfoMessage(_L("CancelTimedSnapshot"));
sl@0
   757
TRAP(iError, iVideoHwDevice->CancelTimedSnapshot() );
sl@0
   758
if (iError!=KErrNone)
sl@0
   759
	{
sl@0
   760
	iParent->InfoMessage(_L("CancelTimedSnapshot Failed"));
sl@0
   761
	SetState(EHwDeviceError);
sl@0
   762
	}
sl@0
   763
}
sl@0
   764
sl@0
   765
void CPlayVideoFileCov::GetTimedSnapshot1()
sl@0
   766
	{
sl@0
   767
TPictureData* pictureData=NULL;
sl@0
   768
TUncompressedVideoFormat format;
sl@0
   769
TTimeIntervalMicroSeconds presentationTimestamp;
sl@0
   770
iParent->InfoMessage(_L("GetTimedSnapshotL"));
sl@0
   771
TRAP(iError, iVideoHwDevice->GetTimedSnapshotL(pictureData,format,presentationTimestamp) );
sl@0
   772
if (iError!=KErrNone)
sl@0
   773
		{
sl@0
   774
		iParent->InfoMessage(_L("GetTimedSnapshotL Failed"));
sl@0
   775
		SetState(EHwDeviceError);
sl@0
   776
		}
sl@0
   777
sl@0
   778
	}
sl@0
   779
sl@0
   780
void CPlayVideoFileCov::GetTimedSnapshot2()
sl@0
   781
	{
sl@0
   782
TPictureData* pictureData=NULL;
sl@0
   783
TUncompressedVideoFormat format;
sl@0
   784
TPictureId pictureId;
sl@0
   785
iParent->InfoMessage(_L("GetTimedSnapshotL"));
sl@0
   786
TRAP(iError, iVideoHwDevice->GetTimedSnapshotL(pictureData,format,pictureId) );
sl@0
   787
if (iError!=KErrNone)
sl@0
   788
		{
sl@0
   789
		iParent->InfoMessage(_L("GetTimedSnapshotL Failed"));
sl@0
   790
		SetState(EHwDeviceError);
sl@0
   791
		}
sl@0
   792
sl@0
   793
	}
sl@0
   794
sl@0
   795
void CPlayVideoFileCov::GetSupportedSnapshotFormats()
sl@0
   796
	{
sl@0
   797
RArray<TUncompressedVideoFormat> formats;
sl@0
   798
iParent->InfoMessage(_L("GetSupportedSnapshotFormatsL"));
sl@0
   799
TRAP(iError, iVideoHwDevice->GetSupportedSnapshotFormatsL(formats) );
sl@0
   800
if (iError!=KErrNone)
sl@0
   801
		{
sl@0
   802
		iParent->InfoMessage(_L("GetSupportedSnapshotFormatsL Failed"));
sl@0
   803
		SetState(EHwDeviceError);
sl@0
   804
		}
sl@0
   805
sl@0
   806
	}
sl@0
   807
sl@0
   808
sl@0
   809
sl@0
   810
void CPlayVideoFileCov::NegTests()
sl@0
   811
	{
sl@0
   812
	//call PlayBackPosition Before initializing iFrameRate
sl@0
   813
	TRAP(iError, iVideoHwDevice->PlaybackPosition() );
sl@0
   814
	if (iError!=KErrNone)
sl@0
   815
		{
sl@0
   816
		iParent->InfoMessage(_L("PlaybackPosition Failed"));
sl@0
   817
		
sl@0
   818
		}
sl@0
   819
	//call DecodingPosition Before initializing iFrameRate
sl@0
   820
	TRAP(iError, iVideoHwDevice->DecodingPosition() );
sl@0
   821
	if (iError!=KErrNone)
sl@0
   822
		{
sl@0
   823
		iParent->InfoMessage(_L("DecodingPosition Failed"));
sl@0
   824
		
sl@0
   825
		}
sl@0
   826
	
sl@0
   827
	//call StartDirectScreenAccess before DSA is enabled
sl@0
   828
	TRegionFix<KTRegionFixSize> reg;
sl@0
   829
	TRect pos(iFrameSize);
sl@0
   830
	reg.AddRect(pos);
sl@0
   831
	
sl@0
   832
	TRAP(iError, iVideoHwDevice->StartDirectScreenAccessL(pos, *iScreenDevice, reg) );
sl@0
   833
	if (iError!=KErrNotReady)
sl@0
   834
		{
sl@0
   835
		iParent->InfoMessage(_L("StartDirectScreenAccessL Failed"));
sl@0
   836
		
sl@0
   837
		}
sl@0
   838
	TUncompressedVideoFormat reqFormat;
sl@0
   839
	reqFormat.iDataFormat = ERgbFbsBitmap;
sl@0
   840
	reqFormat.iRgbFormat = EFbsBitmapColor16M;
sl@0
   841
	
sl@0
   842
	
sl@0
   843
	
sl@0
   844
	iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
sl@0
   845
	
sl@0
   846
	TRAP(iError, iVideoHwDevice->SetOutputFormatL(reqFormat) );
sl@0
   847
	if (iError!=KErrNotReady)
sl@0
   848
		{
sl@0
   849
		iParent->InfoMessage(_L("SetOutputFormatL Failed"));
sl@0
   850
		
sl@0
   851
		}
sl@0
   852
	
sl@0
   853
	
sl@0
   854
	
sl@0
   855
sl@0
   856
	//Call initialize without settting output format
sl@0
   857
	//Negative Test to improve code coverage
sl@0
   858
	iVideoHwDevice->Initialize();
sl@0
   859
	iVideoHwDevice->IsPlaying();
sl@0
   860
	Cancel(); //Cancel pending requests
sl@0
   861
	
sl@0
   862
	
sl@0
   863
	
sl@0
   864
sl@0
   865
	}
sl@0
   866
sl@0
   867
void CPlayVideoFileCov::InitializeCov1()
sl@0
   868
	{
sl@0
   869
	
sl@0
   870
	
sl@0
   871
	//Negative test for Buffer Options
sl@0
   872
	CMMFDevVideoPlay::TBufferOptions bufferOptions;
sl@0
   873
	bufferOptions.iMaxInputBufferSize=0x40000;
sl@0
   874
	bufferOptions.iPreDecoderBufferPeriod=1;
sl@0
   875
	TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
sl@0
   876
	if (iError!=KErrNotSupported)
sl@0
   877
		{
sl@0
   878
		iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
sl@0
   879
		
sl@0
   880
		}
sl@0
   881
	bufferOptions.iPreDecoderBufferPeriod=0;
sl@0
   882
	bufferOptions.iMaxPostDecodeBufferSize=1;
sl@0
   883
	TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
sl@0
   884
	if (iError!=KErrNotSupported)
sl@0
   885
		{
sl@0
   886
		iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
sl@0
   887
		
sl@0
   888
		}
sl@0
   889
	bufferOptions.iMaxPostDecodeBufferSize=0;
sl@0
   890
	bufferOptions.iPostDecoderBufferPeriod=1;
sl@0
   891
	TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
sl@0
   892
	if (iError!=KErrNotSupported)
sl@0
   893
		{
sl@0
   894
		iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
sl@0
   895
		
sl@0
   896
		}
sl@0
   897
	bufferOptions.iPostDecoderBufferPeriod=0;
sl@0
   898
	bufferOptions.iMaxInputBufferSize=KVideoDecoderMaxDataBufferSize+1;
sl@0
   899
	TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
sl@0
   900
	if (iError!=KErrNotSupported)
sl@0
   901
		{
sl@0
   902
		iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
sl@0
   903
		
sl@0
   904
		}
sl@0
   905
	bufferOptions.iMaxInputBufferSize=0;
sl@0
   906
	bufferOptions.iMinNumInputBuffers=KMinInputBuffers;
sl@0
   907
	TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
sl@0
   908
	if (iError!=KErrNotSupported)
sl@0
   909
		{
sl@0
   910
		iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
sl@0
   911
		
sl@0
   912
		}
sl@0
   913
	//Call SetVideoDest before iFormat has been set
sl@0
   914
	iParent->InfoMessage(_L("Call VideoHwDevice SetVideoDestScreenL()"));
sl@0
   915
	TRAP(iError, iVideoHwDevice->SetVideoDestScreenL(ETrue); );
sl@0
   916
	if (iError!=KErrNotReady)
sl@0
   917
		{
sl@0
   918
		iParent->InfoMessage(_L("SetVideoDestScreenL Failed"));
sl@0
   919
		
sl@0
   920
		}
sl@0
   921
	
sl@0
   922
	
sl@0
   923
	//SetOutputFormat which is not supported
sl@0
   924
	TUncompressedVideoFormat reqFormat;
sl@0
   925
	reqFormat.iDataFormat = ERgbRawData;
sl@0
   926
	reqFormat.iRgbFormat = EFbsBitmapColor16M;
sl@0
   927
sl@0
   928
	RArray<TUncompressedVideoFormat> decodeFormats;
sl@0
   929
	TRAP(iError,iVideoHwDevice->GetOutputFormatListL(decodeFormats));
sl@0
   930
	CleanupClosePushL(decodeFormats);
sl@0
   931
	User::LeaveIfError(decodeFormats.Find(reqFormat));
sl@0
   932
sl@0
   933
	iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
sl@0
   934
	TRAP(iError, iVideoHwDevice->SetOutputFormatL(reqFormat) );
sl@0
   935
	if (iError!=KErrNotReady)
sl@0
   936
		{
sl@0
   937
		iParent->InfoMessage(_L("SetOutputFormatL Failed"));
sl@0
   938
		
sl@0
   939
		}
sl@0
   940
	//Call WriteCodedDataL with a NULL buffer
sl@0
   941
	TVideoInputBuffer* inputBuffer=NULL;
sl@0
   942
	iParent->InfoMessage(_L("Call VideoHwDevice->WriteCodedDataL()"));
sl@0
   943
	TRAP(iError, iVideoHwDevice->WriteCodedDataL(inputBuffer) );
sl@0
   944
	if (iError!=KErrArgument)
sl@0
   945
		{
sl@0
   946
		iParent->InfoMessage(_L("WriteCodedDataL Failed"));
sl@0
   947
		
sl@0
   948
		}
sl@0
   949
	CleanupStack::PopAndDestroy(&decodeFormats);	
sl@0
   950
	
sl@0
   951
	iVideoHwDevice->Initialize();
sl@0
   952
	
sl@0
   953
	Cancel();
sl@0
   954
sl@0
   955
	}
sl@0
   956
sl@0
   957
void CPlayVideoFileCov::InitializeCov2()
sl@0
   958
	{
sl@0
   959
	
sl@0
   960
	
sl@0
   961
	
sl@0
   962
	TUncompressedVideoFormat reqFormat;
sl@0
   963
	reqFormat.iDataFormat = ERgbRawData;
sl@0
   964
	reqFormat.iRgbFormat = EFbsBitmapColor16M;
sl@0
   965
	
sl@0
   966
	RArray<TUncompressedVideoFormat> decodeFormats;
sl@0
   967
	TRAP(iError,iVideoHwDevice->GetOutputFormatListL(decodeFormats));
sl@0
   968
	CleanupClosePushL(decodeFormats);
sl@0
   969
	User::LeaveIfError(decodeFormats.Find(reqFormat));
sl@0
   970
sl@0
   971
	iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
sl@0
   972
	iVideoHwDevice->SetOutputFormatL(reqFormat);
sl@0
   973
	CleanupStack::PopAndDestroy(&decodeFormats);	
sl@0
   974
	
sl@0
   975
	iVideoHwDevice->Initialize();
sl@0
   976
sl@0
   977
	}
sl@0
   978
	
sl@0
   979
sl@0
   980