Exemplo n.º 1
0
t_rc REM_RecordFileManager::OpenRecordFile(const char *f_name, REM_RecordFileHandle &rfh)	{

                                                                                        // Close record file handler if it's already open 
	if (rfh.is_open) {
		CloseRecordFile(rfh);
	}
	
                                                                                        // Open file
	t_rc rc = this->sm->OpenFile(f_name, rfh.sfh);
	if (rc != OK) { return rc; }
	
	
                                                                                       
	STORM_PageHandle page_handle;
                                                                                         // Get the first page. */
	rc = rfh.sfh.GetFirstPage(page_handle);
	if (rc != OK) { return rc; }
	
                                                                                        // Get the REM File Header 
	rc = page_handle.GetDataPtr(&rfh.pData_fileHeader);
	if (rc != OK) { return rc; }
	
	rc = page_handle.GetPageID(rfh.page_num_file_header);
	if (rc != OK) { return rc; }
	
	
	memcpy(&rfh.rem_file_header, &rfh.pData_fileHeader[0], REM_FILEHEADER_SIZE);
	
	printf ("We now have number of records = %d with size = %d and we store per page = %d in file %s \n", rfh.rem_file_header.n_records, rfh.rem_file_header.record_size,rfh.rem_file_header.records_per_page, f_name);
	
	
	rfh.is_open = true;
	
	return (OK);
}
Exemplo n.º 2
0
void CRecordVideoFile::RunL()
	{
	TBuf<KTBufSize> buf;
	switch (iState)
		{		
		case EHwDeviceLoadImages:			
			buf.Format(_L("Loading test frame %d"),iCurrentFrame);
			iParent->InfoMessage(buf);
			if (iCurrentFrame<iNumFrames)
				{
				iImageDecoder->Convert(&iStatus, *iBitmaps[iCurrentFrame], iCurrentFrame);
				SetActive();
				iCurrentFrame++;
				}
			else
				{
				iCurrentFrame = 0;
				SetState(EHwDeviceInit);			
				}			
			break;
		case EHwDeviceInit:
			{	
			iParent->InfoMessage(_L("State EHwDeviceInit"));
			// Configure Encoder HwDevice
			TSize size = iBitmaps[iCurrentFrame]->SizeInPixels();
		
			// set video format.
			TUncompressedVideoFormat videoFormat;
			videoFormat.iDataFormat = ERgbFbsBitmap;
			videoFormat.iRgbFormat = EFbsBitmapColor16M;

			iParent->InfoMessage(_L("SetInputFormat"));
			// set encoder settings
			TRAP(iError, iVideoHwDevice->SetInputFormatL(videoFormat, size) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetInputFormat Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetSourceMemory"));
			TRAP(iError, iVideoHwDevice->SetSourceMemoryL(KMaxPictureRate, ETrue, ETrue) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetSourceMemory Failed"));
				SetState(EHwDeviceError);
				}
				
			iParent->InfoMessage(_L("Initialize HwDevice"));
			iVideoHwDevice->Initialize();
			break;
			}					
		case EHwDeviceStartEncode:
			{		
			iVideoHwDevice->Start();				
			TRAP(iError, EncodeNextFrameL());
			if (iError!=KErrNone)
				{
				SetState(EHwDeviceError);
				}

			break;
			}			
		case EHwDeviceEncodeNextFrame:
			{
			if (iCurrentFrame<iNumFrames)
				{
				
				TRAP(iError, EncodeNextFrameL());
				if (iError!=KErrNone)
					{
					SetState(EHwDeviceError);
					}
				}
			else
				{
				iParent->InfoMessage(_L("End of input frames"));

				iVideoHwDevice->InputEnd();
				}
			break;
			}		
		case EHwDeviceEncodeCheckData:			
			{
			SetState(EHwDeviceDone);
			break;
			}
		case EHwDeviceAllowToComplete:
			break;
		case EHwDeviceDone:
			{
			Cancel();
			CActiveScheduler::Stop();
			CloseRecordFile();
			break;
			}
		case EHwDeviceError:
			{
			buf.Format(_L("HwDevice Error %d"),iError);
			iParent->SetVerdict(buf, EFail);
			CActiveScheduler::Stop();
			CloseRecordFile();
			break;
			}
		default:
			{
			CleanupAndSetDeviceError(_L("Unknown CRecordVideoFile iState"));
			break;
			}
		}
	}
Exemplo n.º 3
0
void main(int /*argc*/, char *argv[])
{
    if (OpenRecordFile(argv[0])) {
        _poserror("OpenRecordFile");
        return;
    }

    DlgBoxOk(CBOLDON "Overlay Demo - Main" CPLAINTEXT,
             "Click OK to call Overlay One.");

    if (PointRecord(1)) {
        _poserror("PointRecord.1");
        return;
    }

    /* The macro definitions OVERLAY_ADDR and OVERLAY_SIZE were generated in
     * overlay-demores.h by grc65. They contain the overlay area address and
     * size specific to a certain program.
     */
    if (ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE)) {
        _poserror("ReadRecord.1");
        return;
    }

    /* The linker makes sure that the call to foo() ends up at the right mem
     * addr. However it's up to user to make sure that the - right - overlay
     * is actually loaded before making the the call.
     */
    foo();

    DlgBoxOk(CBOLDON "Overlay Demo - Main" CPLAINTEXT,
             "Click OK to call Overlay Two.");

    if (PointRecord(2)) {
        _poserror("PointRecord.2");
        return;
    }

    /* Replacing one overlay with another one can only happen from the main
     * program. This implies that an overlay can never load another overlay.
     */
    if (ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE)) {
        _poserror("ReadRecord.2");
        return;
    }

    bar();

    DlgBoxOk(CBOLDON "Overlay Demo - Main" CPLAINTEXT,
             "Click OK to call Overlay Three.");

    if (PointRecord(3)) {
        _poserror("PointRecord.3");
        return;
    }

    if (ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE)) {
        _poserror("ReadRecord.3");
        return;
    }

    foobar();

    if (CloseRecordFile()) {
        _poserror("CloseRecordFile");
        return;
    }
}
void CRecordVideoFileCov::RunL()
	{
	TBuf<KTBufSize> buf;
	switch (iState)
		{		
		case EHwDeviceLoadImages:			
			buf.Format(_L("Loading test frame %d"),iCurrentFrame);
			iParent->InfoMessage(buf);
			if (iCurrentFrame<iNumFrames)
				{
				iImageDecoder->Convert(&iStatus, *iBitmaps[iCurrentFrame], iCurrentFrame);
				SetActive();
				iCurrentFrame++;
				}
			else
				{
				iCurrentFrame = 0;
				SetState(EHwDeviceInit);			
				}			
			break;
		case EHwDeviceInit:
			{	
			iParent->InfoMessage(_L("State EHwDeviceInit"));
			// Configure Encoder HwDevice
			TSize size = iBitmaps[iCurrentFrame]->SizeInPixels();
		
			// set video format.
			TUncompressedVideoFormat videoFormat;
			videoFormat.iDataFormat = ERgbFbsBitmap;
			videoFormat.iRgbFormat = EFbsBitmapColor16M;

			iParent->InfoMessage(_L("SetInputFormat"));
			// set encoder settings
			TRAP(iError, iVideoHwDevice->SetInputFormatL(videoFormat, size) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetInputFormat Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetSourceMemory"));
			TRAP(iError, iVideoHwDevice->SetSourceMemoryL(KMaxPictureRate, ETrue, ETrue) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetSourceMemory Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetChannelBitErrorRate"));
			TRAP(iError, iVideoHwDevice->SetChannelBitErrorRate(KChannelBitErrorLevel, KChannelBitErrorRate, KChannelBitErrorStdDeviation) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetChannelBitErrorRate Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetBufferOptions"));
			TRAP(iError, iVideoHwDevice->SetBufferOptionsL(KOptions) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetBufferOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetChannelPacketLossRate"));
			TRAP(iError, iVideoHwDevice->SetChannelPacketLossRate(KLevel,KLossRate,KLossBurstLength) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetChannelPacketLossRate Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetCodingStandardSpecificOptionsL"));
			TRAP(iError, iVideoHwDevice->SetCodingStandardSpecificOptionsL(KCodingOptionsPtr) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetCodingStandardSpecificOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetColorEnhancementOptionsL"));
			TRAP(iError, iVideoHwDevice->SetColorEnhancementOptionsL(KColorEnhancementOptions) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetColorEnhancementOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetComplexityLevel"));
			TRAP(iError, iVideoHwDevice->SetComplexityLevel(KComplexityLevel) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetComplexityLevel Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetCustomPreProcessOptionsL"));
			TRAP(iError, iVideoHwDevice->SetCustomPreProcessOptionsL(KCustomPreProcessOptions) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetCustomPreProcessOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetErrorProtectionLevelL"));
			TRAP(iError, iVideoHwDevice->SetErrorProtectionLevelL(KLevel,KBitRate,KStrength) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetErrorProtectionLevelL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetErrorProtectionLevelsL"));
			TRAP(iError, iVideoHwDevice->SetErrorProtectionLevelsL(KNumLevels,ETrue) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetErrorProtectionLevelsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetErrorsExpected"));
			TRAP(iError, iVideoHwDevice->SetErrorsExpected(ETrue,ETrue) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetErrorsExpected Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetFrameStabilisationOptionsL"));
			TRAP(iError, iVideoHwDevice->SetFrameStabilisationOptionsL(KOutputSize,ETrue) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetFrameStabilisationOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetGlobalReferenceOptions"));
			TRAP(iError, iVideoHwDevice->SetGlobalReferenceOptions(KMaxReferencePictures, KMaxPictureOrderDelay) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetGlobalReferenceOptions Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetInputCropOptionsL"));
			TRAP(iError, iVideoHwDevice->SetInputCropOptionsL(KRect) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetInputCropOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetLayerPromotionPointPeriod"));
			TRAP(iError, iVideoHwDevice->SetLayerPromotionPointPeriod(KLayer,KPeriod) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetLayerPromotionPointPeriod Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetLayerReferenceOptions"));
			TRAP(iError, iVideoHwDevice->SetLayerReferenceOptions(KLayer, KMaxReferencePictures , KMaxPictureOrderDelay ) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetLayerReferenceOptions Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetMinRandomAccessRate"));
			TRAP(iError, iVideoHwDevice->SetMinRandomAccessRate(KMinRandomAccessRate ) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetMinRandomAccessRate Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetNumBitrateLayersL"));
			TRAP(iError, iVideoHwDevice->SetNumBitrateLayersL(KNumBitLayers) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetNumBitrateLayersL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetOutputCropOptionsL"));
			TRAP(iError, iVideoHwDevice->SetOutputCropOptionsL(KRect) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetOutputCropOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetOutputPadOptionsL"));
			TRAP(iError, iVideoHwDevice->SetOutputPadOptionsL(KOutputSize, KPicturePos) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetOutputPadOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetOutputRectL"));
			TRAP(iError, iVideoHwDevice->SetOutputRectL(KRect) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetOutputRectL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetPreProcessTypesL"));
			TRAP(iError, iVideoHwDevice->SetPreProcessTypesL(KPreProcessTypes) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetPreProcessTypesL Failed"));
				SetState(EHwDeviceError);
				}
			TRateControlOptions KRateOptions;
			iParent->InfoMessage(_L("SetRateControlOptions"));
			TRAP(iError, iVideoHwDevice->SetRateControlOptions(KLayer, KRateOptions) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetRateControlOptions Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetRgbToYuvOptionsL"));
			TRAP(iError, iVideoHwDevice->SetRgbToYuvOptionsL(KRgbRange, KYuvOutput) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetRgbToYuvOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetRotateOptionsL"));
			TRAP(iError, iVideoHwDevice->SetRotateOptionsL(KRotationType) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetRotateOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetScalabilityLayerTypeL"));
			TRAP(iError, iVideoHwDevice->SetScalabilityLayerTypeL(KLayer,KScalabilityType ) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetScalabilityLayerTypeL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetScaleOptionsL"));
			TRAP(iError, iVideoHwDevice->SetScaleOptionsL(KOutputSize,EFalse ) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetScaleOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetSegmentTargetSize"));
			TRAP(iError, iVideoHwDevice->SetSegmentTargetSize(KLayer,KSizeBytes, KSizeMacroblocks ) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetSegmentTargetSize Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetSourceCameraL"));
			TRAP(iError, iVideoHwDevice->SetSourceCameraL(KCameraHandle,KMaxPictureRate ) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetSourceCameraL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetYuvToYuvOptionsL"));
			TRAP(iError, iVideoHwDevice->SetYuvToYuvOptionsL(KYuvInput,KYuvOutput ) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetYuvToYuvOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("SetImplementationSpecificEncoderOptionsL"));
			TRAP(iError, iVideoHwDevice->SetImplementationSpecificEncoderOptionsL(KImplementationSpecificOptions ) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetImplementationSpecificEncoderOptionsL Failed"));
				SetState(EHwDeviceError);
				}
			 CCompressedVideoFormat* Format=CCompressedVideoFormat::NewL(KVideoMimeType,KBlank) ;
			 TVideoDataUnitType DataUnitType=EDuCodedPicture ; 					
			 TVideoDataUnitEncapsulation DataEncapsulation=EDuElementaryStream;
			  
			iParent->InfoMessage(_L("SetOutputFormatL"));
			TRAP(iError, iVideoHwDevice->SetOutputFormatL(*Format,DataUnitType,DataEncapsulation,ETrue ) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetOutputFormatL Failed"));
				SetState(EHwDeviceError);
				}
			delete Format;
			iParent->InfoMessage(_L("Initialize HwDevice"));
			iVideoHwDevice->Initialize();
			break;
			}					
		case EHwDeviceStartEncode:
			{
			TRect Rect;
			iParent->InfoMessage(_L("GetFrameStabilisationOutput"));
			TRAP(iError, iVideoHwDevice->GetFrameStabilisationOutput(Rect ) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("GetFrameStabilisationOutput Failed"));
				SetState(EHwDeviceError);
				}
			TUint NumFreeBuffers, TotalFreeBytes;
			iParent->InfoMessage(_L("GetOutputBufferStatus"));
			TRAP(iError, iVideoHwDevice->GetOutputBufferStatus(NumFreeBuffers, TotalFreeBytes ) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("GetOutputBufferStatus Failed"));
				SetState(EHwDeviceError);
				}
			CMMFDevVideoRecord::TPictureCounters Counters;
			iParent->InfoMessage(_L("GetPictureCounters"));
			TRAP(iError, iVideoHwDevice->GetPictureCounters(Counters ) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("GetPictureCounters Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("NumComplexityLevels"));
			TRAP(iError, iVideoHwDevice->NumComplexityLevels() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("NumComplexityLevels Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("NumComplexityLevels"));
			TRAP(iError, iVideoHwDevice->NumComplexityLevels() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("NumComplexityLevels Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("PictureLoss"));
			TRAP(iError, iVideoHwDevice->PictureLoss() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("PictureLoss Failed"));
				SetState(EHwDeviceError);
				}
			
			iParent->InfoMessage(_L("PreProcessorInfoLC"));
			TRAP(iError, iVideoHwDevice->PreProcessorInfoLC() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("PreProcessorInfoLC Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("CancelSupplementalInfo"));
			TRAP(iError, iVideoHwDevice->CancelSupplementalInfo() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("CancelSupplementalInfo Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("CancelSupplementalInfo"));
			TRAP(iError, iVideoHwDevice->CancelSupplementalInfo() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("CancelSupplementalInfo Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("CodingStandardSpecificInitOutputLC"));
			TRAP(iError, iVideoHwDevice->CodingStandardSpecificInitOutputLC() );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("CodingStandardSpecificInitOutputLC Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("ImplementationSpecificInitOutputLC"));
			TRAP(iError, iVideoHwDevice->ImplementationSpecificInitOutputLC() );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("ImplementationSpecificInitOutputLC Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("CodingStandardSpecificSettingsOutputLC"));
			TRAP(iError, iVideoHwDevice->CodingStandardSpecificSettingsOutputLC() );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("CodingStandardSpecificSettingsOutputLC Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("ImplementationSpecificSettingsOutputLC"));
			TRAP(iError, iVideoHwDevice->ImplementationSpecificSettingsOutputLC() );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("ImplementationSpecificSettingsOutputLC Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("CommitL"));
			TRAP(iError, iVideoHwDevice->CommitL() );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("CommitL Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("Revert"));
			TRAP(iError, iVideoHwDevice->Revert() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("Revert Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("InputEnd"));
			TRAP(iError, iVideoHwDevice->InputEnd() );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("InputEnd Failed"));
				SetState(EHwDeviceError);
				}
			TBufC8<8> buffer;
			TPtr8  PictureSelection = buffer.Des();
			iParent->InfoMessage(_L("ReferencePictureSelection"));
			TRAP(iError, iVideoHwDevice->ReferencePictureSelection(PictureSelection) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("ReferencePictureSelection Failed"));
				SetState(EHwDeviceError);
				}
			TPtr8  SupplementalInfo = buffer.Des();
			iParent->InfoMessage(_L("SendSupplementalInfoL"));
			TRAP(iError, iVideoHwDevice->SendSupplementalInfoL(SupplementalInfo) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SendSupplementalInfoL Failed"));
				SetState(EHwDeviceError);
				}
			TTimeIntervalMicroSeconds TimeStamp;
			iParent->InfoMessage(_L("SendSupplementalInfoL"));
			TRAP(iError, iVideoHwDevice->SendSupplementalInfoL(SupplementalInfo,TimeStamp) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SendSupplementalInfoL Failed"));
				SetState(EHwDeviceError);
				}
			
			CVideoEncoderInfo* EncoderInfo=NULL;
			iParent->InfoMessage(_L("VideoEncoderInfoLC"));
			TRAP(iError, EncoderInfo=iVideoHwDevice->VideoEncoderInfoLC();CleanupStack::Pop(EncoderInfo) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("VideoEncoderInfoLC Failed"));
				SetState(EHwDeviceError);
				}
			delete EncoderInfo;
			
			iParent->InfoMessage(_L("Freeze"));
			TRAP(iError, iVideoHwDevice->Freeze());
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("Freeze Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("ReleaseFreeze"));
			TRAP(iError, iVideoHwDevice->ReleaseFreeze());
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("ReleaseFreeze Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("Pause"));
			TRAP(iError, iVideoHwDevice->Pause());
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("Pause Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("Resume"));
			TRAP(iError, iVideoHwDevice->Resume());
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("Resume Failed"));
				SetState(EHwDeviceError);
				}
			TTimeIntervalMicroSeconds Pos;
			iParent->InfoMessage(_L("RecordingPosition"));
			TRAP(iError, Pos=iVideoHwDevice->RecordingPosition());
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("RecordingPosition Failed"));
				SetState(EHwDeviceError);
				}
			iParent->InfoMessage(_L("Stop"));
			TRAP(iError, iVideoHwDevice->Stop());
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("Stop Failed"));
				SetState(EHwDeviceError);
				}
			TUint FirstMacroblock=1, NumMacroblocks=2;
			TPictureId picId;
			iParent->InfoMessage(_L("SliceLoss"));
			TRAP(iError, iVideoHwDevice->SliceLoss(FirstMacroblock,NumMacroblocks,picId));
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SliceLoss Failed"));
				SetState(EHwDeviceError);
				}
			RArray<TPictureId> testIds;
			User::LeaveIfError(testIds.Append(KTestPictureId1));
			User::LeaveIfError(testIds.Append(KTestPictureId2));
			User::LeaveIfError(testIds.Append(KTestPictureId3));
			TArray<TPictureId> testIds2=testIds.Array();
			iParent->InfoMessage(_L("PictureLoss"));
			TRAP(iError, iVideoHwDevice->PictureLoss(testIds2) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("PictureLoss Failed"));
				SetState(EHwDeviceError);
				}
			testIds.Close();
			CSystemClockSource *time1 = NULL;
			iParent->InfoMessage(_L("SetClockSource"));
			TRAP(iError, iVideoHwDevice->SetClockSource(time1) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetClockSource Failed"));
				SetState(EHwDeviceError);
				}
			CMMFVideoPreProcHwDevice *inpDevice = NULL;
			iParent->InfoMessage(_L("SetInputDevice"));
			TRAP(iError, iVideoHwDevice->SetInputDevice(inpDevice) );
			if (iError!=KErrNone)
				{
				iParent->InfoMessage(_L("SetInputDevice Failed"));
				SetState(EHwDeviceError);
				}
			TUint layer=1;
			TUint numSteps=2;
			TInLayerScalabilityType scalabilityType=EInLScalabilityTemporal;
			RArray<TUint> bitRate;
			User::LeaveIfError(bitRate.Append(0));
			const TArray<TUint> bitRate2=bitRate.Array();
			iParent->InfoMessage(_L("SetInLayerScalabilityL"));
			TRAP(iError, iVideoHwDevice->SetInLayerScalabilityL(layer,numSteps,scalabilityType,bitRate2,bitRate2) );
			if (iError!=KErrNotSupported)
				{
				iParent->InfoMessage(_L("SetInLayerScalabilityL Failed"));
				SetState(EHwDeviceError);
				}
			bitRate.Close();
			iVideoHwDevice->Start();				
			TRAP(iError, EncodeNextFrameL());
			if (iError!=KErrNone)
				{
				SetState(EHwDeviceError);
				}

			break;
			}			
		case EHwDeviceEncodeNextFrame:
			{
			if (iCurrentFrame<iNumFrames)
				{
				
				TRAP(iError, EncodeNextFrameL());
				if (iError!=KErrNone)
					{
					SetState(EHwDeviceError);
					}
				}
			else
				{
				iParent->InfoMessage(_L("End of input frames"));

				iVideoHwDevice->InputEnd();
				}
			break;
			}		
		case EHwDeviceEncodeCheckData:			
			{
			SetState(EHwDeviceDone);
			break;
			}
		case EHwDeviceAllowToComplete:
			break;
		case EHwDeviceDone:
			{
			Cancel();
			CActiveScheduler::Stop();
			CloseRecordFile();
			break;
			}
		case EHwDeviceError:
			{
			buf.Format(_L("HwDevice Error %d"),iError);
			iParent->SetVerdict(buf, EFail);
			CActiveScheduler::Stop();
			CloseRecordFile();
			break;
			}
		default:
			{
			CleanupAndSetDeviceError(_L("Unknown CRecordVideoFileCov iState"));
			break;
			}
		}
	}