sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "videoplayfile_cov.h" sl@0: sl@0: #include "../../PU/video/src/Plugin/VideoTestDecoderPU/videotestdecoderpu.hrh" sl@0: #include "../../PU/video/src/Plugin/VideoTestEncoderPU/videotestencoderpu.hrh" sl@0: sl@0: const TInt KInputBufferSize = 8192; sl@0: const TInt KFilePositionZero = 0; sl@0: const TInt KTBufSize = 256; sl@0: const TInt KTRegionFixSize = 1; sl@0: const TInt64 KInterval=2184; sl@0: const TInt KVideoDecoderMaxDataBufferSize = 0x40000; sl@0: const TUint KMinInputBuffers=2; sl@0: _LIT8(KMime,"video/x-symbiantest"); sl@0: _LIT8(KBlank,""); sl@0: sl@0: sl@0: // ************************************************** sl@0: // instructs the Hw Device Adapter to play a file sl@0: // ************************************************** sl@0: CPlayVideoFileCov::CPlayVideoFileCov(RTestStepVideoCodecs* aParent) : sl@0: CActive(EPriorityNormal), sl@0: iState(EHwDeviceInit), sl@0: iParent(aParent) sl@0: { sl@0: } sl@0: sl@0: void CPlayVideoFileCov::ConstructL() sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: User::LeaveIfError(RFbsSession::Connect()); sl@0: sl@0: TInt err = KErrNone; sl@0: TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16MA)); sl@0: if (err == KErrNotSupported) sl@0: { sl@0: TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16M)); sl@0: } sl@0: if (err == KErrNotSupported) sl@0: { sl@0: TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor64K)); sl@0: } sl@0: if (err == KErrNotSupported) sl@0: { sl@0: TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor4K)); sl@0: } sl@0: if (err == KErrNotSupported) sl@0: { sl@0: TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor256)); sl@0: } sl@0: if (err == KErrNotSupported) sl@0: { sl@0: iScreenDevice = CFbsScreenDevice::NewL(_L(""),EColor16MAP); sl@0: } sl@0: else sl@0: { sl@0: User::LeaveIfError(err); sl@0: } sl@0: } sl@0: sl@0: CPlayVideoFileCov* CPlayVideoFileCov::NewL(RTestStepVideoCodecs* aParent) sl@0: { sl@0: CPlayVideoFileCov* self = new (ELeave) CPlayVideoFileCov(aParent); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: sl@0: void CPlayVideoFileCov::DoCancel() sl@0: { sl@0: } sl@0: sl@0: CPlayVideoFileCov::~CPlayVideoFileCov() sl@0: { sl@0: iFile.Close(); sl@0: iFs.Close(); sl@0: sl@0: delete iVideoHwDevice; sl@0: delete iScreenDevice; sl@0: RFbsSession::Disconnect(); sl@0: } sl@0: sl@0: sl@0: void CPlayVideoFileCov::LoadCodecL() sl@0: { sl@0: iParent->InfoMessage(_L("Loading Hw Device Adapter and PU Codec")); sl@0: sl@0: RImplInfoPtrArray array; sl@0: REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), array); sl@0: TBool found = EFalse; sl@0: CImplementationInformation* info = NULL; sl@0: for (TInt i=0;iImplementationUid() == TUid::Uid(KUidVideoTestDecoderPu)) sl@0: { sl@0: found = ETrue; sl@0: } sl@0: } sl@0: TInt err = KErrNotFound; sl@0: if (found) sl@0: { sl@0: TRAP(err, iVideoHwDevice = CMMFVideoDecodeHwDevice::NewPuAdapterL(*info,*this)); sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotFound; sl@0: } sl@0: CVideoDecoderInfo* vInfo=NULL; sl@0: iParent->InfoMessage(_L("VideoDecoderInfoLC")); sl@0: TRAP(iError, vInfo=iVideoHwDevice->VideoDecoderInfoLC(); CleanupStack::Pop(vInfo) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("VideoDecoderInfoLC Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: delete vInfo; sl@0: CCompressedVideoFormat* format=CCompressedVideoFormat::NewL(KMime); sl@0: TVideoDataUnitType dataUnitType=EDuCodedPicture; sl@0: TVideoDataUnitEncapsulation encapsulation=EDuElementaryStream; sl@0: TBool dataInOrder=ETrue; sl@0: iParent->InfoMessage(_L("SetInputFormatL")); sl@0: TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder)); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SetInputFormatL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: //Negative test case for SetInputFormatL sl@0: CCompressedVideoFormat* format2=CCompressedVideoFormat::NewL(KBlank); sl@0: TRAP(iError, iVideoHwDevice->SetInputFormatL(*format2,dataUnitType,encapsulation,dataInOrder)); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetInputFormatL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: delete format2; sl@0: //Negative test case for SetInputFormatL sl@0: dataUnitType=EDuVideoSegment; sl@0: TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder)); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetInputFormatL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: //Negative test case for SetInputFormatL sl@0: dataUnitType=EDuCodedPicture; sl@0: encapsulation=EDuGenericPayload; sl@0: TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder)); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetInputFormatL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: //Negative test case for SetInputFormatL sl@0: encapsulation=EDuElementaryStream; sl@0: dataInOrder=EFalse; sl@0: TRAP(iError, iVideoHwDevice->SetInputFormatL(*format,dataUnitType,encapsulation,dataInOrder)); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetInputFormatL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: delete format; sl@0: array.ResetAndDestroy(); sl@0: User::LeaveIfError(err); sl@0: sl@0: } sl@0: sl@0: void CPlayVideoFileCov::SetDSA(TBool aUseDSA) sl@0: { sl@0: // Need new version of this to load from a PU based uid sl@0: iUseDSA = aUseDSA; sl@0: } sl@0: sl@0: void CPlayVideoFileCov::StartPlaybackL() sl@0: { sl@0: OpenTestFileL(); sl@0: SetState(EHwDeviceInit); sl@0: CActiveScheduler::Start(); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::SetState(TPlayVideoFileState aState) sl@0: { sl@0: iState = aState; sl@0: SetActive(); sl@0: TRequestStatus* status = &iStatus; sl@0: User::RequestComplete(status, KErrNone); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::OpenTestFileL() sl@0: { sl@0: TBuf buf; sl@0: buf.Format(_L("Opening test input file %S"), &KTestPlaybackFile); sl@0: iParent->InfoMessage(buf); sl@0: User::LeaveIfError(iFs.Connect()); sl@0: User::LeaveIfError(iFile.Open(iFs, KTestPlaybackFile, EFileRead)); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::RunL() sl@0: { sl@0: switch (iState) sl@0: { sl@0: case EHwDeviceInit: sl@0: { sl@0: iParent->InfoMessage(_L("State: EHwDeviceInit")); sl@0: TRAPD(err, InitializeL()); sl@0: if (err != KErrNone) sl@0: { sl@0: CleanupAndSetDeviceError(_L("Cannot intialize HwDevice")); sl@0: break; sl@0: } sl@0: break; sl@0: } sl@0: case EHwDeviceStartDecode: sl@0: { sl@0: // if we are playing a file, first we have to open the file sl@0: iParent->InfoMessage(_L("State: EHwDeviceStartDecode")); sl@0: TRAPD(err, StartDecodeL()); sl@0: if (err != KErrNone) sl@0: { sl@0: CleanupAndSetDeviceError(_L("Cannot start decoding")); sl@0: break; sl@0: } sl@0: break; sl@0: } sl@0: case EHwDeviceAllowToComplete: sl@0: iParent->InfoMessage(_L("State: EHwDeviceAllowToComplete")); sl@0: break; sl@0: case EHwDeviceDone: sl@0: { sl@0: iParent->InfoMessage(_L("State: EHwDeviceDeviceDone")); sl@0: Cancel(); sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: case EHwDeviceError: sl@0: { sl@0: TBuf buf; sl@0: buf.Format(_L("State: EHwDeviceDeviceError %d"), iError); sl@0: iParent->SetVerdict(buf, EFail); sl@0: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: CleanupAndSetDeviceError(_L("Unknown CPlayVideoFileCov iState")); sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CPlayVideoFileCov::InitializeL() sl@0: { sl@0: iParent->InfoMessage(_L("InitializeL()")); sl@0: sl@0: CMMFDevVideoPlay::TBufferOptions bufferOptions; sl@0: bufferOptions.iMaxInputBufferSize=0x40000; sl@0: iVideoHwDevice->SetBufferOptionsL(bufferOptions); sl@0: sl@0: TTimeIntervalMicroSeconds Interval(KInterval); sl@0: iVideoHwDevice->SetPosition(Interval); sl@0: sl@0: CMMFDevVideoPlay::TBitstreamCounters bitstreamCounters; sl@0: iVideoHwDevice->GetBitstreamCounters(bitstreamCounters); sl@0: sl@0: CMMFDevVideoPlay::TBufferOptions Options; sl@0: Options.iMaxInputBufferSize=0x40000; sl@0: iVideoHwDevice->SetBufferOptionsL(Options); sl@0: sl@0: CMMFDevVideoPlay::TBitstreamCounters Counters; sl@0: iVideoHwDevice->GetBitstreamCounters(Counters); sl@0: sl@0: TUint complexityLevel=1; sl@0: iParent->InfoMessage(_L("SetComplexityLevel")); sl@0: TRAP(iError, iVideoHwDevice->SetComplexityLevel(complexityLevel) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SetComplexityLevel Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: THrdVbvSpecification HrdVbvSpec=EHrdVbvNone; sl@0: iParent->InfoMessage(_L("SetHrdVbvSpec")); sl@0: TRAP(iError, iVideoHwDevice->SetHrdVbvSpec(HrdVbvSpec,KBlank) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SetHrdVbvSpec Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TRect rect; sl@0: iParent->InfoMessage(_L("SetInputCropOptionsL")); sl@0: TRAP(iError, iVideoHwDevice->SetInputCropOptionsL(rect) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetInputCropOptionsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("SetOutputCropOptionsL")); sl@0: TRAP(iError, iVideoHwDevice->SetOutputCropOptionsL(rect) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetOutputCropOptionsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("SetPauseOnClipFail")); sl@0: TRAP(iError, iVideoHwDevice->SetPauseOnClipFail(ETrue) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SetPauseOnClipFail Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("SetPostProcessTypesL")); sl@0: TRAP(iError, iVideoHwDevice->SetPostProcessTypesL(ETrue) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetPostProcessTypesL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("SetPostProcSpecificOptionsL")); sl@0: TRAP(iError, iVideoHwDevice->SetPostProcSpecificOptionsL(KBlank) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetPostProcSpecificOptionsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TRotationType rotType=ERotate90Clockwise; sl@0: iParent->InfoMessage(_L("SetRotateOptionsL")); sl@0: TRAP(iError, iVideoHwDevice->SetRotateOptionsL(rotType) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetRotateOptionsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TSize size(12,30); sl@0: iParent->InfoMessage(_L("SetScaleOptionsL")); sl@0: TRAP(iError, iVideoHwDevice->SetScaleOptionsL(size,ETrue) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetScaleOptionsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TYuvToRgbOptions YuvOption; sl@0: sl@0: iParent->InfoMessage(_L("SetYuvToRgbOptionsL")); sl@0: TRAP(iError, iVideoHwDevice->SetYuvToRgbOptionsL(YuvOption) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetYuvToRgbOptionsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TYuvFormat YuvFormat; sl@0: TRgbFormat RgbFormat=ERgb16bit444; sl@0: iParent->InfoMessage(_L("SetYuvToRgbOptionsL")); sl@0: TRAP(iError, iVideoHwDevice->SetYuvToRgbOptionsL(YuvOption,YuvFormat,RgbFormat) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetYuvToRgbOptionsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: CMMFVideoPostProcHwDevice *outDevice = NULL; sl@0: iParent->InfoMessage(_L("SetOutputDevice")); sl@0: TRAP(iError, iVideoHwDevice->SetOutputDevice(outDevice) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SetOutputDevice Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: TVideoPictureHeader videoPictureHeader; sl@0: iParent->InfoMessage(_L("ConfigureDecoderL")); sl@0: TRAP(iError, iVideoHwDevice->ConfigureDecoderL(videoPictureHeader) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("ConfigureDecoderL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TUncompressedVideoFormat reqFormat; sl@0: sl@0: reqFormat.iDataFormat = ERgbFbsBitmap; sl@0: reqFormat.iRgbFormat = EFbsBitmapColor16M; sl@0: sl@0: RArray decodeFormats; sl@0: iVideoHwDevice->GetOutputFormatListL(decodeFormats); sl@0: CleanupClosePushL(decodeFormats); sl@0: User::LeaveIfError(decodeFormats.Find(reqFormat)); sl@0: sl@0: iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()")); sl@0: iVideoHwDevice->SetOutputFormatL(reqFormat); sl@0: CleanupStack::PopAndDestroy(&decodeFormats); sl@0: sl@0: CMMFDescriptorBuffer* buffer = CMMFDescriptorBuffer::NewL(KInputBufferSize); sl@0: CleanupStack::PushL(buffer); sl@0: TVideoInputBuffer inputBuffer; sl@0: sl@0: TDes8& des = buffer->Data(); sl@0: // read header data from file sl@0: User::LeaveIfError(iFile.Read(des)); sl@0: TInt pos = KFilePositionZero; sl@0: // seek back to start sl@0: User::LeaveIfError(iFile.Seek(ESeekStart, pos)); sl@0: sl@0: TBuf buf; sl@0: buf.Format(_L("Read header of size %d"),inputBuffer.iData.Length()); sl@0: iParent->InfoMessage(buf); sl@0: sl@0: if (des.Length()>0) sl@0: { sl@0: // Set the pointer sl@0: inputBuffer.iData.Set(&des[0],des.Length(),des.MaxLength()); sl@0: sl@0: iParent->InfoMessage(_L("Call VideoHwDevice GetHeaderInformationL()")); sl@0: TVideoPictureHeader* header = iVideoHwDevice->GetHeaderInformationL(EDuArbitraryStreamSection, sl@0: EDuElementaryStream, sl@0: &inputBuffer); sl@0: TVideoPictureHeader* header2 =NULL; sl@0: //Call ReturnHeader for negative test sl@0: iVideoHwDevice->ReturnHeader(header2); sl@0: iFrameSize = header->iSizeInMemory; sl@0: iVideoHwDevice->ReturnHeader(header); sl@0: } sl@0: else sl@0: { sl@0: // Cannot read any data from file, so no point in continuing sl@0: User::Leave(KErrCorrupt); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(buffer); sl@0: sl@0: iParent->InfoMessage(_L("Call VideoHwDevice SetVideoDestScreenL()")); sl@0: iVideoHwDevice->SetVideoDestScreenL(iUseDSA); sl@0: sl@0: iParent->InfoMessage(_L("Call VideoHwDevice->Initialize()")); sl@0: iVideoHwDevice->Initialize(); sl@0: } sl@0: sl@0: sl@0: void CPlayVideoFileCov::StartDecodeL() sl@0: { sl@0: iParent->InfoMessage(_L("SynchronizeDecoding")); sl@0: TRAP(iError, iVideoHwDevice->SynchronizeDecoding(ETrue) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SynchronizeDecoding Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("StartDecodeL()")); sl@0: sl@0: if (iUseDSA) sl@0: { sl@0: StartDirectScreenAccessL(); sl@0: } sl@0: // tell the HwDeviceAdapter to play the file sl@0: iParent->InfoMessage(_L("Call VideoHwDevice->Start()")); sl@0: iVideoHwDevice->Start(); sl@0: CSystemClockSource *time1= NULL; sl@0: sl@0: iParent->InfoMessage(_L("SetClockSource")); sl@0: TRAP(iError, iVideoHwDevice->SetClockSource(time1) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SetClockSource Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: delete time1; sl@0: iVideoHwDevice->PictureBufferBytes(); sl@0: CMMFDevVideoPlay::TComplexityLevelInfo aInfo; sl@0: iVideoHwDevice->GetComplexityLevelInfo(0,aInfo); sl@0: //Call GetComplexityLevelInfo for False condition coverage sl@0: iVideoHwDevice->GetComplexityLevelInfo(1,aInfo); sl@0: iVideoHwDevice->IsPlaying(); sl@0: CMMFDevVideoPlay::TPictureCounters PictureCounters; sl@0: iParent->InfoMessage(_L("GetPictureCounters")); sl@0: TRAP(iError, iVideoHwDevice->GetPictureCounters(PictureCounters) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("GetPictureCounters Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TPictureData PictureData; sl@0: TUncompressedVideoFormat UncomprossedVideoFormat; sl@0: iParent->InfoMessage(_L("GetSnapshotL")); sl@0: TRAP(iError, iVideoHwDevice->GetSnapshotL(PictureData,UncomprossedVideoFormat) ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("GetSnapshotL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: CMMFDevVideoPlay::TBufferOptions bufferOptions; sl@0: iVideoHwDevice->GetBufferOptions(bufferOptions); sl@0: iVideoHwDevice->NumComplexityLevels(); sl@0: sl@0: iParent->InfoMessage(_L("NumFreeBuffers")); sl@0: TRAP(iError, iVideoHwDevice->NumFreeBuffers() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("NumFreeBuffers Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("PlaybackPosition")); sl@0: TRAP(iError, iVideoHwDevice->PlaybackPosition() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("PlaybackPosition Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("DecodingPosition")); sl@0: TRAP(iError, iVideoHwDevice->DecodingPosition() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("DecodingPosition Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("Redraw")); sl@0: TRAP(iError, iVideoHwDevice->Redraw() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("Redraw Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("AbortDirectScreenAccess")); sl@0: TRAP(iError, iVideoHwDevice->AbortDirectScreenAccess() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("AbortDirectScreenAccess Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("CommitL")); sl@0: TRAP(iError, iVideoHwDevice->CommitL() ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("CommitL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: TTimeIntervalMicroSeconds Timestamp; sl@0: iParent->InfoMessage(_L("FreezePicture")); sl@0: TRAP(iError, iVideoHwDevice->FreezePicture(Timestamp) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("FreezePicture Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("PostProcessorInfoLC")); sl@0: TRAP(iError, iVideoHwDevice->PostProcessorInfoLC() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("PostProcessorInfoLC Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("PreDecoderBufferBytes")); sl@0: TRAP(iError, iVideoHwDevice->PreDecoderBufferBytes() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("PreDecoderBufferBytes Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("ReleaseFreeze")); sl@0: TRAP(iError, iVideoHwDevice->ReleaseFreeze(Timestamp) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("ReleaseFreeze Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("Revert")); sl@0: TRAP(iError, iVideoHwDevice->Revert() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("Revert Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("Redraw")); sl@0: TRAP(iError, iVideoHwDevice->Redraw() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("Redraw Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: void CPlayVideoFileCov::ReadNextBufferL() sl@0: { sl@0: // check that we aren't waiting for the input buffer to be returned sl@0: iParent->InfoMessage(_L("ReadNextBufferL()")); sl@0: TVideoInputBuffer* inputBuffer = iVideoHwDevice->GetBufferL(KInputBufferSize); sl@0: CMMFDevVideoPlay::TBufferOptions aOptions; sl@0: iVideoHwDevice->GetBufferOptions(aOptions); sl@0: iVideoHwDevice->NumComplexityLevels(); sl@0: sl@0: sl@0: if (inputBuffer) sl@0: { sl@0: TBuf buf; sl@0: buf.Format(_L("inputBuffer size %d"),inputBuffer->iData.Length()); sl@0: iParent->InfoMessage(buf); sl@0: User::LeaveIfError(iFile.Read(inputBuffer->iData)); sl@0: buf.Format(_L("Read from file %d bytes"),inputBuffer->iData.Length()); sl@0: iParent->InfoMessage(buf); sl@0: if (inputBuffer->iData.Length()>0) sl@0: { sl@0: iParent->InfoMessage(_L("Call HwDevice->WriteCodedData()")); sl@0: sl@0: iVideoHwDevice->WriteCodedDataL(inputBuffer); sl@0: } sl@0: else sl@0: { sl@0: iParent->InfoMessage(_L("End of input stream")); sl@0: iParent->InfoMessage(_L("Call HwDevice->InputEnd()")); sl@0: iVideoHwDevice->InputEnd(); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CPlayVideoFileCov::CleanupAndSetDeviceError(TPtrC16 aText) sl@0: { sl@0: iParent->SetVerdict(aText, EFail); sl@0: delete iVideoHwDevice; sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppNewPicture(TVideoPicture* aPicture) sl@0: { sl@0: iParent->InfoMessage(_L("MdvppNewPicture - Received Frame")); sl@0: iVideoHwDevice->ReturnPicture(aPicture); sl@0: iParent->InfoMessage(_L("MdvppNewPicture - finished returning Frame")); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppNewBuffers() sl@0: { sl@0: iParent->InfoMessage(_L("MdvppNewBuffers()")); sl@0: TRAP(iError, ReadNextBufferL()); sl@0: if (iError != KErrNone) sl@0: { sl@0: iParent->SetVerdict(_L("Error reading next buffer"),EFail); sl@0: iVideoHwDevice->Stop(); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppReturnPicture(TVideoPicture* /*aPicture*/) sl@0: { sl@0: iParent->InfoMessage(_L("MdvppReturnPicture()")); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppSupplementalInformation(const TDesC8& /*aData*/, sl@0: const TTimeIntervalMicroSeconds& /*aTimestamp*/, const TPictureId& /*aPictureId*/) sl@0: { sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppPictureLoss() sl@0: { sl@0: iParent->InfoMessage(_L("MdvppPictureLoss()")); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppPictureLoss(const TArray& /*aPictures*/) sl@0: { sl@0: iParent->InfoMessage(_L("MdvppPictureLoss()")); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/) sl@0: { sl@0: iParent->InfoMessage(_L("MdvppSliceLoss()")); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppReferencePictureSelection(const TDesC8& /*aSelectionData*/) sl@0: { sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppTimedSnapshotComplete(TInt /*aError*/, TPictureData* /*aPictureData*/, sl@0: const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, const TPictureId& /*aPictureId*/) sl@0: { sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppFatalError(CMMFVideoHwDevice* /*aDevice*/, TInt aError) sl@0: { sl@0: iError = aError; sl@0: iParent->InfoMessage(_L("MdvppFatalError()")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppInitializeComplete(CMMFVideoHwDevice* /*aDevice*/, TInt aError) sl@0: { sl@0: iParent->InfoMessage(_L("MdvppInitializeComplete()")); sl@0: iError = aError; sl@0: if (iError == KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("The Hw Device Adapter initialised correctly")); sl@0: SetState(EHwDeviceStartDecode); sl@0: } sl@0: else sl@0: { sl@0: iParent->InfoMessage(_L("Failure intialising the hw device adapter")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: } sl@0: sl@0: void CPlayVideoFileCov::MdvppStreamEnd() sl@0: { sl@0: iParent->InfoMessage(_L("MdvppStreamEnd()")); sl@0: SetState(EHwDeviceDone); sl@0: } sl@0: sl@0: void CPlayVideoFileCov::StartDirectScreenAccessL() sl@0: { sl@0: TRegionFix reg; sl@0: TRect pos(iFrameSize); sl@0: reg.AddRect(pos); sl@0: iVideoHwDevice->StartDirectScreenAccessL(pos, *iScreenDevice, reg); sl@0: iParent->InfoMessage(_L("Pause")); sl@0: TRAP(iError, iVideoHwDevice->Pause() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("Pause Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: iParent->InfoMessage(_L("Resume")); sl@0: TRAP(iError, iVideoHwDevice->Resume() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("Resume Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: RRegion region; sl@0: iParent->InfoMessage(_L("SetScreenClipRegion")); sl@0: TRAP(iError, iVideoHwDevice->SetScreenClipRegion(region) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("SetScreenClipRegion Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: } sl@0: void CPlayVideoFileCov::CancelTimedSnapshot() sl@0: { sl@0: iParent->InfoMessage(_L("CancelTimedSnapshot")); sl@0: TRAP(iError, iVideoHwDevice->CancelTimedSnapshot() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("CancelTimedSnapshot Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: } sl@0: sl@0: void CPlayVideoFileCov::GetTimedSnapshot1() sl@0: { sl@0: TPictureData* pictureData=NULL; sl@0: TUncompressedVideoFormat format; sl@0: TTimeIntervalMicroSeconds presentationTimestamp; sl@0: iParent->InfoMessage(_L("GetTimedSnapshotL")); sl@0: TRAP(iError, iVideoHwDevice->GetTimedSnapshotL(pictureData,format,presentationTimestamp) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("GetTimedSnapshotL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: } sl@0: sl@0: void CPlayVideoFileCov::GetTimedSnapshot2() sl@0: { sl@0: TPictureData* pictureData=NULL; sl@0: TUncompressedVideoFormat format; sl@0: TPictureId pictureId; sl@0: iParent->InfoMessage(_L("GetTimedSnapshotL")); sl@0: TRAP(iError, iVideoHwDevice->GetTimedSnapshotL(pictureData,format,pictureId) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("GetTimedSnapshotL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: } sl@0: sl@0: void CPlayVideoFileCov::GetSupportedSnapshotFormats() sl@0: { sl@0: RArray formats; sl@0: iParent->InfoMessage(_L("GetSupportedSnapshotFormatsL")); sl@0: TRAP(iError, iVideoHwDevice->GetSupportedSnapshotFormatsL(formats) ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("GetSupportedSnapshotFormatsL Failed")); sl@0: SetState(EHwDeviceError); sl@0: } sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: void CPlayVideoFileCov::NegTests() sl@0: { sl@0: //call PlayBackPosition Before initializing iFrameRate sl@0: TRAP(iError, iVideoHwDevice->PlaybackPosition() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("PlaybackPosition Failed")); sl@0: sl@0: } sl@0: //call DecodingPosition Before initializing iFrameRate sl@0: TRAP(iError, iVideoHwDevice->DecodingPosition() ); sl@0: if (iError!=KErrNone) sl@0: { sl@0: iParent->InfoMessage(_L("DecodingPosition Failed")); sl@0: sl@0: } sl@0: sl@0: //call StartDirectScreenAccess before DSA is enabled sl@0: TRegionFix reg; sl@0: TRect pos(iFrameSize); sl@0: reg.AddRect(pos); sl@0: sl@0: TRAP(iError, iVideoHwDevice->StartDirectScreenAccessL(pos, *iScreenDevice, reg) ); sl@0: if (iError!=KErrNotReady) sl@0: { sl@0: iParent->InfoMessage(_L("StartDirectScreenAccessL Failed")); sl@0: sl@0: } sl@0: TUncompressedVideoFormat reqFormat; sl@0: reqFormat.iDataFormat = ERgbFbsBitmap; sl@0: reqFormat.iRgbFormat = EFbsBitmapColor16M; sl@0: sl@0: sl@0: sl@0: iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()")); sl@0: sl@0: TRAP(iError, iVideoHwDevice->SetOutputFormatL(reqFormat) ); sl@0: if (iError!=KErrNotReady) sl@0: { sl@0: iParent->InfoMessage(_L("SetOutputFormatL Failed")); sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: //Call initialize without settting output format sl@0: //Negative Test to improve code coverage sl@0: iVideoHwDevice->Initialize(); sl@0: iVideoHwDevice->IsPlaying(); sl@0: Cancel(); //Cancel pending requests sl@0: sl@0: sl@0: sl@0: sl@0: } sl@0: sl@0: void CPlayVideoFileCov::InitializeCov1() sl@0: { sl@0: sl@0: sl@0: //Negative test for Buffer Options sl@0: CMMFDevVideoPlay::TBufferOptions bufferOptions; sl@0: bufferOptions.iMaxInputBufferSize=0x40000; sl@0: bufferOptions.iPreDecoderBufferPeriod=1; sl@0: TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetBufferOptionsL Failed")); sl@0: sl@0: } sl@0: bufferOptions.iPreDecoderBufferPeriod=0; sl@0: bufferOptions.iMaxPostDecodeBufferSize=1; sl@0: TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetBufferOptionsL Failed")); sl@0: sl@0: } sl@0: bufferOptions.iMaxPostDecodeBufferSize=0; sl@0: bufferOptions.iPostDecoderBufferPeriod=1; sl@0: TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetBufferOptionsL Failed")); sl@0: sl@0: } sl@0: bufferOptions.iPostDecoderBufferPeriod=0; sl@0: bufferOptions.iMaxInputBufferSize=KVideoDecoderMaxDataBufferSize+1; sl@0: TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetBufferOptionsL Failed")); sl@0: sl@0: } sl@0: bufferOptions.iMaxInputBufferSize=0; sl@0: bufferOptions.iMinNumInputBuffers=KMinInputBuffers; sl@0: TRAP(iError, iVideoHwDevice->SetBufferOptionsL(bufferOptions); ); sl@0: if (iError!=KErrNotSupported) sl@0: { sl@0: iParent->InfoMessage(_L("SetBufferOptionsL Failed")); sl@0: sl@0: } sl@0: //Call SetVideoDest before iFormat has been set sl@0: iParent->InfoMessage(_L("Call VideoHwDevice SetVideoDestScreenL()")); sl@0: TRAP(iError, iVideoHwDevice->SetVideoDestScreenL(ETrue); ); sl@0: if (iError!=KErrNotReady) sl@0: { sl@0: iParent->InfoMessage(_L("SetVideoDestScreenL Failed")); sl@0: sl@0: } sl@0: sl@0: sl@0: //SetOutputFormat which is not supported sl@0: TUncompressedVideoFormat reqFormat; sl@0: reqFormat.iDataFormat = ERgbRawData; sl@0: reqFormat.iRgbFormat = EFbsBitmapColor16M; sl@0: sl@0: RArray decodeFormats; sl@0: TRAP(iError,iVideoHwDevice->GetOutputFormatListL(decodeFormats)); sl@0: CleanupClosePushL(decodeFormats); sl@0: User::LeaveIfError(decodeFormats.Find(reqFormat)); sl@0: sl@0: iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()")); sl@0: TRAP(iError, iVideoHwDevice->SetOutputFormatL(reqFormat) ); sl@0: if (iError!=KErrNotReady) sl@0: { sl@0: iParent->InfoMessage(_L("SetOutputFormatL Failed")); sl@0: sl@0: } sl@0: //Call WriteCodedDataL with a NULL buffer sl@0: TVideoInputBuffer* inputBuffer=NULL; sl@0: iParent->InfoMessage(_L("Call VideoHwDevice->WriteCodedDataL()")); sl@0: TRAP(iError, iVideoHwDevice->WriteCodedDataL(inputBuffer) ); sl@0: if (iError!=KErrArgument) sl@0: { sl@0: iParent->InfoMessage(_L("WriteCodedDataL Failed")); sl@0: sl@0: } sl@0: CleanupStack::PopAndDestroy(&decodeFormats); sl@0: sl@0: iVideoHwDevice->Initialize(); sl@0: sl@0: Cancel(); sl@0: sl@0: } sl@0: sl@0: void CPlayVideoFileCov::InitializeCov2() sl@0: { sl@0: sl@0: sl@0: sl@0: TUncompressedVideoFormat reqFormat; sl@0: reqFormat.iDataFormat = ERgbRawData; sl@0: reqFormat.iRgbFormat = EFbsBitmapColor16M; sl@0: sl@0: RArray decodeFormats; sl@0: TRAP(iError,iVideoHwDevice->GetOutputFormatListL(decodeFormats)); sl@0: CleanupClosePushL(decodeFormats); sl@0: User::LeaveIfError(decodeFormats.Find(reqFormat)); sl@0: sl@0: iParent->InfoMessage(_L("Call VideoHwDevice->SetOutputFormat()")); sl@0: iVideoHwDevice->SetOutputFormatL(reqFormat); sl@0: CleanupStack::PopAndDestroy(&decodeFormats); sl@0: sl@0: iVideoHwDevice->Initialize(); sl@0: sl@0: } sl@0: sl@0: sl@0: