First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <mmf/devvideo/videoplayhwdevice.h>
17 #include <mmf/server/mmfdatabuffer.h>
18 #include "videoplayfile_cov.h"
20 #include "../../PU/video/src/Plugin/VideoTestDecoderPU/videotestdecoderpu.hrh"
21 #include "../../PU/video/src/Plugin/VideoTestEncoderPU/videotestencoderpu.hrh"
23 const TInt KInputBufferSize = 8192;
24 const TInt KFilePositionZero = 0;
25 const TInt KTBufSize = 256;
26 const TInt KTRegionFixSize = 1;
27 const TInt64 KInterval=2184;
28 const TInt KVideoDecoderMaxDataBufferSize = 0x40000;
29 const TUint KMinInputBuffers=2;
30 _LIT8(KMime,"video/x-symbiantest");
34 // **************************************************
35 // instructs the Hw Device Adapter to play a file
36 // **************************************************
37 CPlayVideoFileCov::CPlayVideoFileCov(RTestStepVideoCodecs* aParent) :
38 CActive(EPriorityNormal),
39 iState(EHwDeviceInit),
44 void CPlayVideoFileCov::ConstructL()
46 CActiveScheduler::Add(this);
47 User::LeaveIfError(RFbsSession::Connect());
50 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16MA));
51 if (err == KErrNotSupported)
53 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16M));
55 if (err == KErrNotSupported)
57 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor64K));
59 if (err == KErrNotSupported)
61 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor4K));
63 if (err == KErrNotSupported)
65 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor256));
67 if (err == KErrNotSupported)
69 iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16MAP);
73 User::LeaveIfError(err);
77 CPlayVideoFileCov* CPlayVideoFileCov::NewL(RTestStepVideoCodecs* aParent)
79 CPlayVideoFileCov* self = new (ELeave) CPlayVideoFileCov(aParent);
80 CleanupStack::PushL(self);
82 CleanupStack::Pop(self);
87 void CPlayVideoFileCov::DoCancel()
91 CPlayVideoFileCov::~CPlayVideoFileCov()
96 delete iVideoHwDevice;
98 RFbsSession::Disconnect();
102 void CPlayVideoFileCov::LoadCodecL()
104 iParent->InfoMessage(_L("Loading Hw Device Adapter and PU Codec"));
106 RImplInfoPtrArray array;
107 REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), array);
108 TBool found = EFalse;
109 CImplementationInformation* info = NULL;
110 for (TInt i=0;i<array.Count() && !found;i++)
113 if (info->ImplementationUid() == TUid::Uid(KUidVideoTestDecoderPu))
118 TInt err = KErrNotFound;
121 TRAP(err, iVideoHwDevice = CMMFVideoDecodeHwDevice::NewPuAdapterL(*info,*this));
127 CVideoDecoderInfo* vInfo=NULL;
128 iParent->InfoMessage(_L("VideoDecoderInfoLC"));
129 TRAP(iError, vInfo=iVideoHwDevice->VideoDecoderInfoLC(); CleanupStack::Pop(vInfo) );
130 if (iError!=KErrNone)
132 iParent->InfoMessage(_L("VideoDecoderInfoLC Failed"));
133 SetState(EHwDeviceError);
136 CCompressedVideoFormat* format=CCompressedVideoFormat::NewL(KMime);
137 TVideoDataUnitType dataUnitType=EDuCodedPicture;
138 TVideoDataUnitEncapsulation encapsulation=EDuElementaryStream;
139 TBool dataInOrder=ETrue;
140 iParent->InfoMessage(_L("SetInputFormatL"));
141 TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
142 if (iError!=KErrNone)
144 iParent->InfoMessage(_L("SetInputFormatL Failed"));
145 SetState(EHwDeviceError);
147 //Negative test case for SetInputFormatL
148 CCompressedVideoFormat* format2=CCompressedVideoFormat::NewL(KBlank);
149 TRAP(iError, iVideoHwDevice->SetInputFormatL(*format2,dataUnitType,encapsulation,dataInOrder));
150 if (iError!=KErrNotSupported)
152 iParent->InfoMessage(_L("SetInputFormatL Failed"));
153 SetState(EHwDeviceError);
156 //Negative test case for SetInputFormatL
157 dataUnitType=EDuVideoSegment;
158 TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
159 if (iError!=KErrNotSupported)
161 iParent->InfoMessage(_L("SetInputFormatL Failed"));
162 SetState(EHwDeviceError);
164 //Negative test case for SetInputFormatL
165 dataUnitType=EDuCodedPicture;
166 encapsulation=EDuGenericPayload;
167 TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
168 if (iError!=KErrNotSupported)
170 iParent->InfoMessage(_L("SetInputFormatL Failed"));
171 SetState(EHwDeviceError);
173 //Negative test case for SetInputFormatL
174 encapsulation=EDuElementaryStream;
176 TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder));
177 if (iError!=KErrNotSupported)
179 iParent->InfoMessage(_L("SetInputFormatL Failed"));
180 SetState(EHwDeviceError);
183 array.ResetAndDestroy();
184 User::LeaveIfError(err);
188 void CPlayVideoFileCov::SetDSA(TBool aUseDSA)
190 // Need new version of this to load from a PU based uid
194 void CPlayVideoFileCov::StartPlaybackL()
197 SetState(EHwDeviceInit);
198 CActiveScheduler::Start();
201 void CPlayVideoFileCov::SetState(TPlayVideoFileState aState)
205 TRequestStatus* status = &iStatus;
206 User::RequestComplete(status, KErrNone);
209 void CPlayVideoFileCov::OpenTestFileL()
212 buf.Format(_L("Opening test input file %S"), &KTestPlaybackFile);
213 iParent->InfoMessage(buf);
214 User::LeaveIfError(iFs.Connect());
215 User::LeaveIfError(iFile.Open(iFs, KTestPlaybackFile, EFileRead));
218 void CPlayVideoFileCov::RunL()
224 iParent->InfoMessage(_L("State: EHwDeviceInit"));
225 TRAPD(err, InitializeL());
228 CleanupAndSetDeviceError(_L("Cannot intialize HwDevice"));
233 case EHwDeviceStartDecode:
235 // if we are playing a file, first we have to open the file
236 iParent->InfoMessage(_L("State: EHwDeviceStartDecode"));
237 TRAPD(err, StartDecodeL());
240 CleanupAndSetDeviceError(_L("Cannot start decoding"));
245 case EHwDeviceAllowToComplete:
246 iParent->InfoMessage(_L("State: EHwDeviceAllowToComplete"));
250 iParent->InfoMessage(_L("State: EHwDeviceDeviceDone"));
252 CActiveScheduler::Stop();
258 buf.Format(_L("State: EHwDeviceDeviceError %d"), iError);
259 iParent->SetVerdict(buf, EFail);
261 CActiveScheduler::Stop();
266 CleanupAndSetDeviceError(_L("Unknown CPlayVideoFileCov iState"));
273 void CPlayVideoFileCov::InitializeL()
275 iParent->InfoMessage(_L("InitializeL()"));
277 CMMFDevVideoPlay::TBufferOptions bufferOptions;
278 bufferOptions.iMaxInputBufferSize=0x40000;
279 iVideoHwDevice->SetBufferOptionsL(bufferOptions);
281 TTimeIntervalMicroSeconds Interval(KInterval);
282 iVideoHwDevice->SetPosition(Interval);
284 CMMFDevVideoPlay::TBitstreamCounters bitstreamCounters;
285 iVideoHwDevice->GetBitstreamCounters(bitstreamCounters);
287 CMMFDevVideoPlay::TBufferOptions Options;
288 Options.iMaxInputBufferSize=0x40000;
289 iVideoHwDevice->SetBufferOptionsL(Options);
291 CMMFDevVideoPlay::TBitstreamCounters Counters;
292 iVideoHwDevice->GetBitstreamCounters(Counters);
294 TUint complexityLevel=1;
295 iParent->InfoMessage(_L("SetComplexityLevel"));
296 TRAP(iError, iVideoHwDevice->SetComplexityLevel(complexityLevel) );
297 if (iError!=KErrNone)
299 iParent->InfoMessage(_L("SetComplexityLevel Failed"));
300 SetState(EHwDeviceError);
302 THrdVbvSpecification HrdVbvSpec=EHrdVbvNone;
303 iParent->InfoMessage(_L("SetHrdVbvSpec"));
304 TRAP(iError, iVideoHwDevice->SetHrdVbvSpec(HrdVbvSpec,KBlank) );
305 if (iError!=KErrNone)
307 iParent->InfoMessage(_L("SetHrdVbvSpec Failed"));
308 SetState(EHwDeviceError);
311 iParent->InfoMessage(_L("SetInputCropOptionsL"));
312 TRAP(iError, iVideoHwDevice->SetInputCropOptionsL(rect) );
313 if (iError!=KErrNotSupported)
315 iParent->InfoMessage(_L("SetInputCropOptionsL Failed"));
316 SetState(EHwDeviceError);
318 iParent->InfoMessage(_L("SetOutputCropOptionsL"));
319 TRAP(iError, iVideoHwDevice->SetOutputCropOptionsL(rect) );
320 if (iError!=KErrNotSupported)
322 iParent->InfoMessage(_L("SetOutputCropOptionsL Failed"));
323 SetState(EHwDeviceError);
325 iParent->InfoMessage(_L("SetPauseOnClipFail"));
326 TRAP(iError, iVideoHwDevice->SetPauseOnClipFail(ETrue) );
327 if (iError!=KErrNone)
329 iParent->InfoMessage(_L("SetPauseOnClipFail Failed"));
330 SetState(EHwDeviceError);
332 iParent->InfoMessage(_L("SetPostProcessTypesL"));
333 TRAP(iError, iVideoHwDevice->SetPostProcessTypesL(ETrue) );
334 if (iError!=KErrNotSupported)
336 iParent->InfoMessage(_L("SetPostProcessTypesL Failed"));
337 SetState(EHwDeviceError);
339 iParent->InfoMessage(_L("SetPostProcSpecificOptionsL"));
340 TRAP(iError, iVideoHwDevice->SetPostProcSpecificOptionsL(KBlank) );
341 if (iError!=KErrNotSupported)
343 iParent->InfoMessage(_L("SetPostProcSpecificOptionsL Failed"));
344 SetState(EHwDeviceError);
346 TRotationType rotType=ERotate90Clockwise;
347 iParent->InfoMessage(_L("SetRotateOptionsL"));
348 TRAP(iError, iVideoHwDevice->SetRotateOptionsL(rotType) );
349 if (iError!=KErrNotSupported)
351 iParent->InfoMessage(_L("SetRotateOptionsL Failed"));
352 SetState(EHwDeviceError);
355 iParent->InfoMessage(_L("SetScaleOptionsL"));
356 TRAP(iError, iVideoHwDevice->SetScaleOptionsL(size,ETrue) );
357 if (iError!=KErrNotSupported)
359 iParent->InfoMessage(_L("SetScaleOptionsL Failed"));
360 SetState(EHwDeviceError);
362 TYuvToRgbOptions YuvOption;
364 iParent->InfoMessage(_L("SetYuvToRgbOptionsL"));
365 TRAP(iError, iVideoHwDevice->SetYuvToRgbOptionsL(YuvOption) );
366 if (iError!=KErrNotSupported)
368 iParent->InfoMessage(_L("SetYuvToRgbOptionsL Failed"));
369 SetState(EHwDeviceError);
371 TYuvFormat YuvFormat;
372 TRgbFormat RgbFormat=ERgb16bit444;
373 iParent->InfoMessage(_L("SetYuvToRgbOptionsL"));
374 TRAP(iError, iVideoHwDevice->SetYuvToRgbOptionsL(YuvOption,YuvFormat,RgbFormat) );
375 if (iError!=KErrNotSupported)
377 iParent->InfoMessage(_L("SetYuvToRgbOptionsL Failed"));
378 SetState(EHwDeviceError);
380 CMMFVideoPostProcHwDevice *outDevice = NULL;
381 iParent->InfoMessage(_L("SetOutputDevice"));
382 TRAP(iError, iVideoHwDevice->SetOutputDevice(outDevice) );
383 if (iError!=KErrNone)
385 iParent->InfoMessage(_L("SetOutputDevice Failed"));
386 SetState(EHwDeviceError);
389 TVideoPictureHeader videoPictureHeader;
390 iParent->InfoMessage(_L("ConfigureDecoderL"));
391 TRAP(iError, iVideoHwDevice->ConfigureDecoderL(videoPictureHeader) );
392 if (iError!=KErrNotSupported)
394 iParent->InfoMessage(_L("ConfigureDecoderL Failed"));
395 SetState(EHwDeviceError);
397 TUncompressedVideoFormat reqFormat;
399 reqFormat.iDataFormat = ERgbFbsBitmap;
400 reqFormat.iRgbFormat = EFbsBitmapColor16M;
402 RArray<TUncompressedVideoFormat> decodeFormats;
403 iVideoHwDevice->GetOutputFormatListL(decodeFormats);
404 CleanupClosePushL(decodeFormats);
405 User::LeaveIfError(decodeFormats.Find(reqFormat));
407 iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
408 iVideoHwDevice->SetOutputFormatL(reqFormat);
409 CleanupStack::PopAndDestroy(&decodeFormats);
411 CMMFDescriptorBuffer* buffer = CMMFDescriptorBuffer::NewL(KInputBufferSize);
412 CleanupStack::PushL(buffer);
413 TVideoInputBuffer inputBuffer;
415 TDes8& des = buffer->Data();
416 // read header data from file
417 User::LeaveIfError(iFile.Read(des));
418 TInt pos = KFilePositionZero;
419 // seek back to start
420 User::LeaveIfError(iFile.Seek(ESeekStart, pos));
423 buf.Format(_L("Read header of size %d"),inputBuffer.iData.Length());
424 iParent->InfoMessage(buf);
429 inputBuffer.iData.Set(&des[0],des.Length(),des.MaxLength());
431 iParent->InfoMessage(_L("Call VideoHwDevice GetHeaderInformationL()"));
432 TVideoPictureHeader* header = iVideoHwDevice->GetHeaderInformationL(EDuArbitraryStreamSection,
435 TVideoPictureHeader* header2 =NULL;
436 //Call ReturnHeader for negative test
437 iVideoHwDevice->ReturnHeader(header2);
438 iFrameSize = header->iSizeInMemory;
439 iVideoHwDevice->ReturnHeader(header);
443 // Cannot read any data from file, so no point in continuing
444 User::Leave(KErrCorrupt);
447 CleanupStack::PopAndDestroy(buffer);
449 iParent->InfoMessage(_L("Call VideoHwDevice SetVideoDestScreenL()"));
450 iVideoHwDevice->SetVideoDestScreenL(iUseDSA);
452 iParent->InfoMessage(_L("Call VideoHwDevice->Initialize()"));
453 iVideoHwDevice->Initialize();
457 void CPlayVideoFileCov::StartDecodeL()
459 iParent->InfoMessage(_L("SynchronizeDecoding"));
460 TRAP(iError, iVideoHwDevice->SynchronizeDecoding(ETrue) );
461 if (iError!=KErrNone)
463 iParent->InfoMessage(_L("SynchronizeDecoding Failed"));
464 SetState(EHwDeviceError);
466 iParent->InfoMessage(_L("StartDecodeL()"));
470 StartDirectScreenAccessL();
472 // tell the HwDeviceAdapter to play the file
473 iParent->InfoMessage(_L("Call VideoHwDevice->Start()"));
474 iVideoHwDevice->Start();
475 CSystemClockSource *time1= NULL;
477 iParent->InfoMessage(_L("SetClockSource"));
478 TRAP(iError, iVideoHwDevice->SetClockSource(time1) );
479 if (iError!=KErrNone)
481 iParent->InfoMessage(_L("SetClockSource Failed"));
482 SetState(EHwDeviceError);
486 iVideoHwDevice->PictureBufferBytes();
487 CMMFDevVideoPlay::TComplexityLevelInfo aInfo;
488 iVideoHwDevice->GetComplexityLevelInfo(0,aInfo);
489 //Call GetComplexityLevelInfo for False condition coverage
490 iVideoHwDevice->GetComplexityLevelInfo(1,aInfo);
491 iVideoHwDevice->IsPlaying();
492 CMMFDevVideoPlay::TPictureCounters PictureCounters;
493 iParent->InfoMessage(_L("GetPictureCounters"));
494 TRAP(iError, iVideoHwDevice->GetPictureCounters(PictureCounters) );
495 if (iError!=KErrNone)
497 iParent->InfoMessage(_L("GetPictureCounters Failed"));
498 SetState(EHwDeviceError);
500 TPictureData PictureData;
501 TUncompressedVideoFormat UncomprossedVideoFormat;
502 iParent->InfoMessage(_L("GetSnapshotL"));
503 TRAP(iError, iVideoHwDevice->GetSnapshotL(PictureData,UncomprossedVideoFormat) );
504 if (iError!=KErrNotSupported)
506 iParent->InfoMessage(_L("GetSnapshotL Failed"));
507 SetState(EHwDeviceError);
509 CMMFDevVideoPlay::TBufferOptions bufferOptions;
510 iVideoHwDevice->GetBufferOptions(bufferOptions);
511 iVideoHwDevice->NumComplexityLevels();
513 iParent->InfoMessage(_L("NumFreeBuffers"));
514 TRAP(iError, iVideoHwDevice->NumFreeBuffers() );
515 if (iError!=KErrNone)
517 iParent->InfoMessage(_L("NumFreeBuffers Failed"));
518 SetState(EHwDeviceError);
520 iParent->InfoMessage(_L("PlaybackPosition"));
521 TRAP(iError, iVideoHwDevice->PlaybackPosition() );
522 if (iError!=KErrNone)
524 iParent->InfoMessage(_L("PlaybackPosition Failed"));
525 SetState(EHwDeviceError);
527 iParent->InfoMessage(_L("DecodingPosition"));
528 TRAP(iError, iVideoHwDevice->DecodingPosition() );
529 if (iError!=KErrNone)
531 iParent->InfoMessage(_L("DecodingPosition Failed"));
532 SetState(EHwDeviceError);
534 iParent->InfoMessage(_L("Redraw"));
535 TRAP(iError, iVideoHwDevice->Redraw() );
536 if (iError!=KErrNone)
538 iParent->InfoMessage(_L("Redraw Failed"));
539 SetState(EHwDeviceError);
541 iParent->InfoMessage(_L("AbortDirectScreenAccess"));
542 TRAP(iError, iVideoHwDevice->AbortDirectScreenAccess() );
543 if (iError!=KErrNone)
545 iParent->InfoMessage(_L("AbortDirectScreenAccess Failed"));
546 SetState(EHwDeviceError);
548 iParent->InfoMessage(_L("CommitL"));
549 TRAP(iError, iVideoHwDevice->CommitL() );
550 if (iError!=KErrNotSupported)
552 iParent->InfoMessage(_L("CommitL Failed"));
553 SetState(EHwDeviceError);
555 TTimeIntervalMicroSeconds Timestamp;
556 iParent->InfoMessage(_L("FreezePicture"));
557 TRAP(iError, iVideoHwDevice->FreezePicture(Timestamp) );
558 if (iError!=KErrNone)
560 iParent->InfoMessage(_L("FreezePicture Failed"));
561 SetState(EHwDeviceError);
563 iParent->InfoMessage(_L("PostProcessorInfoLC"));
564 TRAP(iError, iVideoHwDevice->PostProcessorInfoLC() );
565 if (iError!=KErrNone)
567 iParent->InfoMessage(_L("PostProcessorInfoLC Failed"));
568 SetState(EHwDeviceError);
570 iParent->InfoMessage(_L("PreDecoderBufferBytes"));
571 TRAP(iError, iVideoHwDevice->PreDecoderBufferBytes() );
572 if (iError!=KErrNone)
574 iParent->InfoMessage(_L("PreDecoderBufferBytes Failed"));
575 SetState(EHwDeviceError);
577 iParent->InfoMessage(_L("ReleaseFreeze"));
578 TRAP(iError, iVideoHwDevice->ReleaseFreeze(Timestamp) );
579 if (iError!=KErrNone)
581 iParent->InfoMessage(_L("ReleaseFreeze Failed"));
582 SetState(EHwDeviceError);
584 iParent->InfoMessage(_L("Revert"));
585 TRAP(iError, iVideoHwDevice->Revert() );
586 if (iError!=KErrNone)
588 iParent->InfoMessage(_L("Revert Failed"));
589 SetState(EHwDeviceError);
591 iParent->InfoMessage(_L("Redraw"));
592 TRAP(iError, iVideoHwDevice->Redraw() );
593 if (iError!=KErrNone)
595 iParent->InfoMessage(_L("Redraw Failed"));
596 SetState(EHwDeviceError);
603 void CPlayVideoFileCov::ReadNextBufferL()
605 // check that we aren't waiting for the input buffer to be returned
606 iParent->InfoMessage(_L("ReadNextBufferL()"));
607 TVideoInputBuffer* inputBuffer = iVideoHwDevice->GetBufferL(KInputBufferSize);
608 CMMFDevVideoPlay::TBufferOptions aOptions;
609 iVideoHwDevice->GetBufferOptions(aOptions);
610 iVideoHwDevice->NumComplexityLevels();
616 buf.Format(_L("inputBuffer size %d"),inputBuffer->iData.Length());
617 iParent->InfoMessage(buf);
618 User::LeaveIfError(iFile.Read(inputBuffer->iData));
619 buf.Format(_L("Read from file %d bytes"),inputBuffer->iData.Length());
620 iParent->InfoMessage(buf);
621 if (inputBuffer->iData.Length()>0)
623 iParent->InfoMessage(_L("Call HwDevice->WriteCodedData()"));
625 iVideoHwDevice->WriteCodedDataL(inputBuffer);
629 iParent->InfoMessage(_L("End of input stream"));
630 iParent->InfoMessage(_L("Call HwDevice->InputEnd()"));
631 iVideoHwDevice->InputEnd();
636 void CPlayVideoFileCov::CleanupAndSetDeviceError(TPtrC16 aText)
638 iParent->SetVerdict(aText, EFail);
639 delete iVideoHwDevice;
640 SetState(EHwDeviceError);
643 void CPlayVideoFileCov::MdvppNewPicture(TVideoPicture* aPicture)
645 iParent->InfoMessage(_L("MdvppNewPicture - Received Frame"));
646 iVideoHwDevice->ReturnPicture(aPicture);
647 iParent->InfoMessage(_L("MdvppNewPicture - finished returning Frame"));
650 void CPlayVideoFileCov::MdvppNewBuffers()
652 iParent->InfoMessage(_L("MdvppNewBuffers()"));
653 TRAP(iError, ReadNextBufferL());
654 if (iError != KErrNone)
656 iParent->SetVerdict(_L("Error reading next buffer"),EFail);
657 iVideoHwDevice->Stop();
658 SetState(EHwDeviceError);
662 void CPlayVideoFileCov::MdvppReturnPicture(TVideoPicture* /*aPicture*/)
664 iParent->InfoMessage(_L("MdvppReturnPicture()"));
667 void CPlayVideoFileCov::MdvppSupplementalInformation(const TDesC8& /*aData*/,
668 const TTimeIntervalMicroSeconds& /*aTimestamp*/, const TPictureId& /*aPictureId*/)
672 void CPlayVideoFileCov::MdvppPictureLoss()
674 iParent->InfoMessage(_L("MdvppPictureLoss()"));
677 void CPlayVideoFileCov::MdvppPictureLoss(const TArray<TPictureId>& /*aPictures*/)
679 iParent->InfoMessage(_L("MdvppPictureLoss()"));
682 void CPlayVideoFileCov::MdvppSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/)
684 iParent->InfoMessage(_L("MdvppSliceLoss()"));
687 void CPlayVideoFileCov::MdvppReferencePictureSelection(const TDesC8& /*aSelectionData*/)
691 void CPlayVideoFileCov::MdvppTimedSnapshotComplete(TInt /*aError*/, TPictureData* /*aPictureData*/,
692 const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, const TPictureId& /*aPictureId*/)
696 void CPlayVideoFileCov::MdvppFatalError(CMMFVideoHwDevice* /*aDevice*/, TInt aError)
699 iParent->InfoMessage(_L("MdvppFatalError()"));
700 SetState(EHwDeviceError);
703 void CPlayVideoFileCov::MdvppInitializeComplete(CMMFVideoHwDevice* /*aDevice*/, TInt aError)
705 iParent->InfoMessage(_L("MdvppInitializeComplete()"));
707 if (iError == KErrNone)
709 iParent->InfoMessage(_L("The Hw Device Adapter initialised correctly"));
710 SetState(EHwDeviceStartDecode);
714 iParent->InfoMessage(_L("Failure intialising the hw device adapter"));
715 SetState(EHwDeviceError);
719 void CPlayVideoFileCov::MdvppStreamEnd()
721 iParent->InfoMessage(_L("MdvppStreamEnd()"));
722 SetState(EHwDeviceDone);
725 void CPlayVideoFileCov::StartDirectScreenAccessL()
727 TRegionFix<KTRegionFixSize> reg;
728 TRect pos(iFrameSize);
730 iVideoHwDevice->StartDirectScreenAccessL(pos, *iScreenDevice, reg);
731 iParent->InfoMessage(_L("Pause"));
732 TRAP(iError, iVideoHwDevice->Pause() );
733 if (iError!=KErrNone)
735 iParent->InfoMessage(_L("Pause Failed"));
736 SetState(EHwDeviceError);
738 iParent->InfoMessage(_L("Resume"));
739 TRAP(iError, iVideoHwDevice->Resume() );
740 if (iError!=KErrNone)
742 iParent->InfoMessage(_L("Resume Failed"));
743 SetState(EHwDeviceError);
746 iParent->InfoMessage(_L("SetScreenClipRegion"));
747 TRAP(iError, iVideoHwDevice->SetScreenClipRegion(region) );
748 if (iError!=KErrNone)
750 iParent->InfoMessage(_L("SetScreenClipRegion Failed"));
751 SetState(EHwDeviceError);
754 void CPlayVideoFileCov::CancelTimedSnapshot()
756 iParent->InfoMessage(_L("CancelTimedSnapshot"));
757 TRAP(iError, iVideoHwDevice->CancelTimedSnapshot() );
758 if (iError!=KErrNone)
760 iParent->InfoMessage(_L("CancelTimedSnapshot Failed"));
761 SetState(EHwDeviceError);
765 void CPlayVideoFileCov::GetTimedSnapshot1()
767 TPictureData* pictureData=NULL;
768 TUncompressedVideoFormat format;
769 TTimeIntervalMicroSeconds presentationTimestamp;
770 iParent->InfoMessage(_L("GetTimedSnapshotL"));
771 TRAP(iError, iVideoHwDevice->GetTimedSnapshotL(pictureData,format,presentationTimestamp) );
772 if (iError!=KErrNone)
774 iParent->InfoMessage(_L("GetTimedSnapshotL Failed"));
775 SetState(EHwDeviceError);
780 void CPlayVideoFileCov::GetTimedSnapshot2()
782 TPictureData* pictureData=NULL;
783 TUncompressedVideoFormat format;
784 TPictureId pictureId;
785 iParent->InfoMessage(_L("GetTimedSnapshotL"));
786 TRAP(iError, iVideoHwDevice->GetTimedSnapshotL(pictureData,format,pictureId) );
787 if (iError!=KErrNone)
789 iParent->InfoMessage(_L("GetTimedSnapshotL Failed"));
790 SetState(EHwDeviceError);
795 void CPlayVideoFileCov::GetSupportedSnapshotFormats()
797 RArray<TUncompressedVideoFormat> formats;
798 iParent->InfoMessage(_L("GetSupportedSnapshotFormatsL"));
799 TRAP(iError, iVideoHwDevice->GetSupportedSnapshotFormatsL(formats) );
800 if (iError!=KErrNone)
802 iParent->InfoMessage(_L("GetSupportedSnapshotFormatsL Failed"));
803 SetState(EHwDeviceError);
810 void CPlayVideoFileCov::NegTests()
812 //call PlayBackPosition Before initializing iFrameRate
813 TRAP(iError, iVideoHwDevice->PlaybackPosition() );
814 if (iError!=KErrNone)
816 iParent->InfoMessage(_L("PlaybackPosition Failed"));
819 //call DecodingPosition Before initializing iFrameRate
820 TRAP(iError, iVideoHwDevice->DecodingPosition() );
821 if (iError!=KErrNone)
823 iParent->InfoMessage(_L("DecodingPosition Failed"));
827 //call StartDirectScreenAccess before DSA is enabled
828 TRegionFix<KTRegionFixSize> reg;
829 TRect pos(iFrameSize);
832 TRAP(iError, iVideoHwDevice->StartDirectScreenAccessL(pos, *iScreenDevice, reg) );
833 if (iError!=KErrNotReady)
835 iParent->InfoMessage(_L("StartDirectScreenAccessL Failed"));
838 TUncompressedVideoFormat reqFormat;
839 reqFormat.iDataFormat = ERgbFbsBitmap;
840 reqFormat.iRgbFormat = EFbsBitmapColor16M;
844 iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
846 TRAP(iError, iVideoHwDevice->SetOutputFormatL(reqFormat) );
847 if (iError!=KErrNotReady)
849 iParent->InfoMessage(_L("SetOutputFormatL Failed"));
856 //Call initialize without settting output format
857 //Negative Test to improve code coverage
858 iVideoHwDevice->Initialize();
859 iVideoHwDevice->IsPlaying();
860 Cancel(); //Cancel pending requests
867 void CPlayVideoFileCov::InitializeCov1()
871 //Negative test for Buffer Options
872 CMMFDevVideoPlay::TBufferOptions bufferOptions;
873 bufferOptions.iMaxInputBufferSize=0x40000;
874 bufferOptions.iPreDecoderBufferPeriod=1;
875 TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
876 if (iError!=KErrNotSupported)
878 iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
881 bufferOptions.iPreDecoderBufferPeriod=0;
882 bufferOptions.iMaxPostDecodeBufferSize=1;
883 TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
884 if (iError!=KErrNotSupported)
886 iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
889 bufferOptions.iMaxPostDecodeBufferSize=0;
890 bufferOptions.iPostDecoderBufferPeriod=1;
891 TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
892 if (iError!=KErrNotSupported)
894 iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
897 bufferOptions.iPostDecoderBufferPeriod=0;
898 bufferOptions.iMaxInputBufferSize=KVideoDecoderMaxDataBufferSize+1;
899 TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
900 if (iError!=KErrNotSupported)
902 iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
905 bufferOptions.iMaxInputBufferSize=0;
906 bufferOptions.iMinNumInputBuffers=KMinInputBuffers;
907 TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); );
908 if (iError!=KErrNotSupported)
910 iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
913 //Call SetVideoDest before iFormat has been set
914 iParent->InfoMessage(_L("Call VideoHwDevice SetVideoDestScreenL()"));
915 TRAP(iError, iVideoHwDevice->SetVideoDestScreenL(ETrue); );
916 if (iError!=KErrNotReady)
918 iParent->InfoMessage(_L("SetVideoDestScreenL Failed"));
923 //SetOutputFormat which is not supported
924 TUncompressedVideoFormat reqFormat;
925 reqFormat.iDataFormat = ERgbRawData;
926 reqFormat.iRgbFormat = EFbsBitmapColor16M;
928 RArray<TUncompressedVideoFormat> decodeFormats;
929 TRAP(iError,iVideoHwDevice->GetOutputFormatListL(decodeFormats));
930 CleanupClosePushL(decodeFormats);
931 User::LeaveIfError(decodeFormats.Find(reqFormat));
933 iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
934 TRAP(iError, iVideoHwDevice->SetOutputFormatL(reqFormat) );
935 if (iError!=KErrNotReady)
937 iParent->InfoMessage(_L("SetOutputFormatL Failed"));
940 //Call WriteCodedDataL with a NULL buffer
941 TVideoInputBuffer* inputBuffer=NULL;
942 iParent->InfoMessage(_L("Call VideoHwDevice->WriteCodedDataL()"));
943 TRAP(iError, iVideoHwDevice->WriteCodedDataL(inputBuffer) );
944 if (iError!=KErrArgument)
946 iParent->InfoMessage(_L("WriteCodedDataL Failed"));
949 CleanupStack::PopAndDestroy(&decodeFormats);
951 iVideoHwDevice->Initialize();
957 void CPlayVideoFileCov::InitializeCov2()
962 TUncompressedVideoFormat reqFormat;
963 reqFormat.iDataFormat = ERgbRawData;
964 reqFormat.iRgbFormat = EFbsBitmapColor16M;
966 RArray<TUncompressedVideoFormat> decodeFormats;
967 TRAP(iError,iVideoHwDevice->GetOutputFormatListL(decodeFormats));
968 CleanupClosePushL(decodeFormats);
969 User::LeaveIfError(decodeFormats.Find(reqFormat));
971 iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()"));
972 iVideoHwDevice->SetOutputFormatL(reqFormat);
973 CleanupStack::PopAndDestroy(&decodeFormats);
975 iVideoHwDevice->Initialize();