Revision: 200949
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 08:51:24 +0200
changeset 0 9b3e960ffc8a
child 1 2d3e1993fb02
Revision: 200949 Kit: 200951
camappengine/Build/bld.inf
camappengine/Engine/Bmarm/CAEENGINEU.DEF
camappengine/Engine/Bwins/CAEENGINEU.DEF
camappengine/Engine/Bwinscw/CAEENGINEU.DEF
camappengine/Engine/Eabi/CaeEngineU.DEF
camappengine/Engine/Group/CaeEngine.mmp
camappengine/Engine/Group/CaeEngineTestVersion.mmp
camappengine/Engine/Group/bld.inf
camappengine/Engine/Inc/CaeCallbackActive.h
camappengine/Engine/Inc/CaeCommon.h
camappengine/Engine/Inc/CaeDbgUtilities.h
camappengine/Engine/Inc/CaeEngineImp.h
camappengine/Engine/Inc/CaeEngineImpTestErrors.h
camappengine/Engine/Inc/CaeImageItem.h
camappengine/Engine/Inc/CaeImageItemExtPro.h
camappengine/Engine/Inc/CaeImageQueueExtPro.h
camappengine/Engine/Inc/CaeQualityLevels.h
camappengine/Engine/Inc/CaeSdKeys.h
camappengine/Engine/Inc/CaeStillBurst.h
camappengine/Engine/Inc/CaeStillQualityLevels.h
camappengine/Engine/Inc/CaeStillStatesActive.h
camappengine/Engine/Inc/CaeVideoQualityLevels.h
camappengine/Engine/Inc/CaeVideoTimes.h
camappengine/Engine/Src/CaeCallbackActive.cpp
camappengine/Engine/Src/CaeDbgUtilities.cpp
camappengine/Engine/Src/CaeEngineImpInfo.cpp
camappengine/Engine/Src/CaeEngineImpStillAndVf.cpp
camappengine/Engine/Src/CaeEngineImpTestErrors.cpp
camappengine/Engine/Src/CaeEngineImpVideoName.cpp
camappengine/Engine/Src/CaeEngineImpVideoNameCustom.cpp
camappengine/Engine/Src/CaeEngineImpVideoRecording.cpp
camappengine/Engine/Src/CaeExtension.cpp
camappengine/Engine/Src/CaeImageItem.cpp
camappengine/Engine/Src/CaeImageItemExtPro.cpp
camappengine/Engine/Src/CaeImageQueueExtPro.cpp
camappengine/Engine/Src/CaeQualityLevels.cpp
camappengine/Engine/Src/CaeQualityLevelsNoSd.cpp
camappengine/Engine/Src/CaeStillBurst.cpp
camappengine/Engine/Src/CaeStillQualityLevels.cpp
camappengine/Engine/Src/CaeStillQualityLevelsNoSd.cpp
camappengine/Engine/Src/CaeStillStatesActive.cpp
camappengine/Engine/Src/CaeStillStatesActiveBurst.cpp
camappengine/Engine/Src/CaeStillStatesActiveNoBurst.cpp
camappengine/Engine/Src/CaeVideoQualityLevels.cpp
camappengine/Engine/Src/CaeVideoQualityLevelsNoSd.cpp
camappengine/Engine/Src/CaeVideoTimes.cpp
camappengine/Engine/traces/CamAppEngineTraceDefinitions.h
camappengine/Engine/traces/OstTraceDefinitions.h
camappengine/StillConverter/Bmarm/CAESTILLCONVERTERU.DEF
camappengine/StillConverter/Bwins/CAESTILLCONVERTERU.DEF
camappengine/StillConverter/Bwinscw/CAESTILLCONVERTERU.DEF
camappengine/StillConverter/Eabi/CaeStillConverterU.DEF
camappengine/StillConverter/Group/CaeStillConverter.mmp
camappengine/StillConverter/Group/CaeStillConverterTestVersion.mmp
camappengine/StillConverter/Group/bld.inf
camappengine/StillConverter/Inc/CaeStillCommon.h
camappengine/StillConverter/Inc/CaeStillConverter.h
camappengine/StillConverter/Inc/CaeStillConverterTestErrors.h
camappengine/StillConverter/Inc/CaeStillDecoder.h
camappengine/StillConverter/Inc/CaeStillEncoder.h
camappengine/StillConverter/Src/CaeStillConverter.cpp
camappengine/StillConverter/Src/CaeStillConverterTestErrors.cpp
camappengine/StillConverter/Src/CaeStillDecoder.cpp
camappengine/StillConverter/Src/CaeStillEncoder.cpp
camappengine/asynchfilesavequeue/bwinscw/AsynchFSQu.def
camappengine/asynchfilesavequeue/eabi/AsynchFSQu.def
camappengine/asynchfilesavequeue/group/asynchfsq.mmp
camappengine/asynchfilesavequeue/group/bld.inf
camappengine/asynchfilesavequeue/inc/asynchatom.h
camappengine/asynchfilesavequeue/src/asynchatom.cpp
camappengine/asynchfilesavequeue/src/asynchfsq.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/Bwinscw/STIFAFSQTestu.def
camappengine/asynchfilesavequeue/tsrc/public/basic/Eabi/STIFAFSQTestu.def
camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles.jpg
camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles2.jpg
camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles3.jpg
camappengine/asynchfilesavequeue/tsrc/public/basic/group/StifAFSQTest.mmp
camappengine/asynchfilesavequeue/tsrc/public/basic/group/bld.inf
camappengine/asynchfilesavequeue/tsrc/public/basic/group/testcollector.mk
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestAsynchSave.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestTop.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/STIFAFSQTest.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/StifFSQTestTop.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/AssertFailure.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/TestResult.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/test.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCaller.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCase.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testSuite.h
camappengine/asynchfilesavequeue/tsrc/public/basic/sis/STIFAFSQTest.pkg
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAdd.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAsynchSave.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestDelete.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestRename.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/STIFAFSQTestBlocks.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/StifFSQTestTop.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/AssertFailure.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/TestSuite.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/testCase.cpp
camappengine/rom/CamAppEngine.iby
camappengine/rom/CamAppEngineStub.SIS
camappengine/rom/CamAppEngineStub.pkg
camcordermmfplugin/Build/bld.inf
camcordermmfplugin/controller/Group/CamCController.mmp
camcordermmfplugin/controller/Group/bld.inf
camcordermmfplugin/controller/Inc/CamCController.h
camcordermmfplugin/controller/Inc/CamCImplementationUIDs.hrh
camcordermmfplugin/controller/Src/101F8502.rss
camcordermmfplugin/controller/Src/CamCController.cpp
camcordermmfplugin/controller/Src/CamCControllerFactory.cpp
camcordermmfplugin/filecomposer/Bmarm/CAMC3GPSINKU.DEF
camcordermmfplugin/filecomposer/Bwins/CAMC3GPSINKU.DEF
camcordermmfplugin/filecomposer/EABI/camc3gpsinkU.DEF
camcordermmfplugin/filecomposer/Group/bld.inf
camcordermmfplugin/filecomposer/Group/camc3GPDataSink.mmp
camcordermmfplugin/filecomposer/Group/camc3GPDataSinkLib.mmp
camcordermmfplugin/filecomposer/Inc/CamC3GPDataSinkImp.h
camcordermmfplugin/filecomposer/Src/CamC3GPDataSinkImp.cpp
camcordermmfplugin/mediarecorder/Bmarm/CAMCMEDIARECORDERU.DEF
camcordermmfplugin/mediarecorder/Bwins/CAMCMEDIARECORDERU.DEF
camcordermmfplugin/mediarecorder/EABI/CamcMediaRecorderU.DEF
camcordermmfplugin/mediarecorder/Group/bld.inf
camcordermmfplugin/mediarecorder/Group/mediarecorder.mmp
camcordermmfplugin/mediarecorder/Group/mediarecorderLib.mmp
camcordermmfplugin/mediarecorder/Inc/CCMRAMRNBCodecData.h
camcordermmfplugin/mediarecorder/Inc/CCMRAacCodecData.h
camcordermmfplugin/mediarecorder/Inc/CCMRActiveOutput.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioCodecData.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioCodecs.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioInput.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioInputHW.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioInputSW.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioRecorder.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioThreadProxy.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioThreadProxyServer.h
camcordermmfplugin/mediarecorder/Inc/CCMRAudioThreadProxySession.h
camcordermmfplugin/mediarecorder/Inc/CCMRConfigManager.h
camcordermmfplugin/mediarecorder/Inc/CCMRFifo.h
camcordermmfplugin/mediarecorder/Inc/CCMRFrameBuffer.h
camcordermmfplugin/mediarecorder/Inc/CCMRMediaRecorderImp.h
camcordermmfplugin/mediarecorder/Inc/CCMRMediaSource.h
camcordermmfplugin/mediarecorder/Inc/CCMRPerfMonitor.h
camcordermmfplugin/mediarecorder/Inc/CCMRRecorderBase.h
camcordermmfplugin/mediarecorder/Inc/CCMRSubThread.h
camcordermmfplugin/mediarecorder/Inc/CCMRSupportedCodecs.h
camcordermmfplugin/mediarecorder/Inc/CCMRThreadPriorities.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoCameraSource.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecData.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecDataH263.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecDataH264AVC.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecDataMPEG4.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecs.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoHWParams.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoRecorder.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoRecorderClient.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoSettings.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoSource.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoThreadProxy.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoThreadProxyServer.h
camcordermmfplugin/mediarecorder/Inc/CCMRVideoThreadProxySession.h
camcordermmfplugin/mediarecorder/Src/CCMRAMRNBCodecData.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAacCodecData.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAacCodecDataStub.cpp
camcordermmfplugin/mediarecorder/Src/CCMRActiveOutput.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioCodecs.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioInputHW.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioInputSW.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioRecorder.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioThreadProxy.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioThreadProxyServer.cpp
camcordermmfplugin/mediarecorder/Src/CCMRAudioThreadProxySession.cpp
camcordermmfplugin/mediarecorder/Src/CCMRConfigManager.cpp
camcordermmfplugin/mediarecorder/Src/CCMRFifo.cpp
camcordermmfplugin/mediarecorder/Src/CCMRFrameBuffer.cpp
camcordermmfplugin/mediarecorder/Src/CCMRMDFVideoRecorder.cpp
camcordermmfplugin/mediarecorder/Src/CCMRMediaRecorderImp.cpp
camcordermmfplugin/mediarecorder/Src/CCMRPerfMonitor.cpp
camcordermmfplugin/mediarecorder/Src/CCMRSubThread.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoCameraSource.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecDataH263.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecDataH264AVC.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecDataMPEG4.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecsBasic.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecsMPEG4.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoRecorderClient.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoThreadProxy.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoThreadProxyServer.cpp
camcordermmfplugin/mediarecorder/Src/CCMRVideoThreadProxySession.cpp
camcordermmfplugin/mediarecorder/traces/CCMRMDFVideoRecorderTraces.h
camcordermmfplugin/mediarecorder/traces/OstTraceDefinitions.h
camcordermmfplugin/rom/CamcorderMMFPlugin.iby
camcordermmfplugin/rom/CamcorderMMFPluginStub.SIS
camcordermmfplugin/rom/CamcorderMMFPluginStub.pkg
camcordermmfplugin/tsrc/public/basic/BWINS/CPPUNITCAMCTESTU.DEF
camcordermmfplugin/tsrc/public/basic/BWINS/StifCamcTestU.DEF
camcordermmfplugin/tsrc/public/basic/EABI/StifCamcTestU.DEF
camcordermmfplugin/tsrc/public/basic/Group/StifCamcTest.mmp
camcordermmfplugin/tsrc/public/basic/Group/bld.inf
camcordermmfplugin/tsrc/public/basic/Group/testcollector.mk
camcordermmfplugin/tsrc/public/basic/inc/StifCamcTestTop.h
camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/AssertFailure.h
camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/TestResult.h
camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/test.h
camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/testCaller.h
camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/testCase.h
camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/testSuite.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest.h
camcordermmfplugin/tsrc/public/basic/inc/camcTestTop.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_1.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_2.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_3.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_4.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_5.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_6.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_7.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_8.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_9.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_visualcheck.h
camcordermmfplugin/tsrc/public/basic/inc/camcTest_visualcheckdsp.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_1.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_2.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_3.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_4.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_5.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_6.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_7.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_8.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_9.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_visualcheck.h
camcordermmfplugin/tsrc/public/basic/inc/camctestclient_visualcheckdsp.h
camcordermmfplugin/tsrc/public/basic/sis/STIFCamctest.pkg
camcordermmfplugin/tsrc/public/basic/src/StifCamcTestTop.cpp
camcordermmfplugin/tsrc/public/basic/src/TestFrameWork/AssertFailure.cpp
camcordermmfplugin/tsrc/public/basic/src/TestFrameWork/TestCase.cpp
camcordermmfplugin/tsrc/public/basic/src/TestFrameWork/TestSuite.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_1.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_2.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_3.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_4.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_5.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_6.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_7.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_8.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_9.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_visualcheck.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestClient_visualcheckdsp.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTestTop.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_1.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_2.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_3.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_4.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_5.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_6.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_7.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_8.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_9.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_visualcheck.cpp
camcordermmfplugin/tsrc/public/basic/src/camcTest_visualcheckdsp.cpp
camerasrv_plat/3gp_file_composer_api/3gp_file_composer_api.metaxml
camerasrv_plat/3gp_file_composer_api/group/bld.inf
camerasrv_plat/3gp_file_composer_api/inc/CamC3GPDataSink.h
camerasrv_plat/3gp_file_composer_api/inc/CamC3GPDataSinkObserver.h
camerasrv_plat/asynchronous_file_saving_queue_api/asynchronous_file_saving_queue_api.metaxml
camerasrv_plat/asynchronous_file_saving_queue_api/group/bld.inf
camerasrv_plat/asynchronous_file_saving_queue_api/inc/asynchfsq.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Bwinscw/STIFAFSQTestu.def
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Eabi/STIFAFSQTestu.def
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles.jpg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles2.jpg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles3.jpg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.mmp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.pkg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/bld.inf
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestAsynchSave.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestTop.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/STIFAFSQTest.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/StifFSQTestTop.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/AssertFailure.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/TestResult.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/test.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCaller.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCase.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testSuite.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAdd.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAsynchSave.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestDelete.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestRename.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/STIFAFSQTestBlocks.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/StifFSQTestTop.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/AssertFailure.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/TestSuite.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/testCase.cpp
camerasrv_plat/cae_extentension_api/cae_extentension_api.metaxml
camerasrv_plat/cae_extentension_api/group/bld.inf
camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.h
camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.hrh
camerasrv_plat/camera_application_engine_api/camera_application_engine_api.metaxml
camerasrv_plat/camera_application_engine_api/group/bld.inf
camerasrv_plat/camera_application_engine_api/inc/CaeEngine.h
camerasrv_plat/camera_application_engine_api/tsrc/EABI/STIFCaeTestU.DEF
camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.mmp
camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.pkg
camerasrv_plat/camera_application_engine_api/tsrc/group/bld.inf
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestClient.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestRelease.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestSettingsClient.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStatesClient.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillSettings.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillStates.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestTop.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVariation.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoSettings.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoStates.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/StifCaeTestTop.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/AssertFailure.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/TestResult.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/test.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCaller.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCase.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testSuite.h
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestClient.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestRelease.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestSettingsClient.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStatesClient.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillSettings.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillStates.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestTop.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoSettings.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoStates.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/StifCaeTestTop.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/AssertFailure.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestCase.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestSuite.cpp
camerasrv_plat/custom_onboard_camera_api/custom_onboard_camera_api.metaxml
camerasrv_plat/custom_onboard_camera_api/group/bld.inf
camerasrv_plat/custom_onboard_camera_api/inc/ECamColorToneCustomInterface.h
camerasrv_plat/group/bld.inf
camerasrv_plat/imaging_configuration_manager_api/group/bld.inf
camerasrv_plat/imaging_configuration_manager_api/imaging_configuration_manager_api.metaxml
camerasrv_plat/imaging_configuration_manager_api/inc/imagingconfigmanager.h
camerasrv_plat/imaging_configuration_manager_api/tsrc/Bmarm/ICMSTIFU.DEF
camerasrv_plat/imaging_configuration_manager_api/tsrc/Bwins/ICMSTIFU.DEF
camerasrv_plat/imaging_configuration_manager_api/tsrc/EABI/ICMSTIFU.def
camerasrv_plat/imaging_configuration_manager_api/tsrc/group/ICMSTIF.mmp
camerasrv_plat/imaging_configuration_manager_api/tsrc/group/ICMSTIF.pkg
camerasrv_plat/imaging_configuration_manager_api/tsrc/group/bld.inf
camerasrv_plat/imaging_configuration_manager_api/tsrc/inc/ICMSTIF.h
camerasrv_plat/imaging_configuration_manager_api/tsrc/src/ICMSTIF.cpp
camerasrv_plat/media_recorder_api/group/bld.inf
camerasrv_plat/media_recorder_api/inc/CCMRMediaRecorder.h
camerasrv_plat/media_recorder_api/inc/CCMRMediaRecorderObserver.h
camerasrv_plat/media_recorder_api/media_recorder_api.metaxml
camerasrv_plat/media_recorder_api/tsrc/BWINS/CPPUNITCAMCTESTU.DEF
camerasrv_plat/media_recorder_api/tsrc/BWINS/StifCamcTestU.DEF
camerasrv_plat/media_recorder_api/tsrc/EABI/StifCamcTestU.DEF
camerasrv_plat/media_recorder_api/tsrc/group/StifCamcTest.mmp
camerasrv_plat/media_recorder_api/tsrc/group/StifCamcTest.pkg
camerasrv_plat/media_recorder_api/tsrc/group/bld.inf
camerasrv_plat/media_recorder_api/tsrc/inc/StifCamcTestTop.h
camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/AssertFailure.h
camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/TestResult.h
camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/test.h
camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/testCaller.h
camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/testCase.h
camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/testSuite.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTestTop.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_1.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_2.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_3.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_4.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_5.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_6.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_7.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_8.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_9.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_visualcheck.h
camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_visualcheckdsp.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_1.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_2.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_3.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_4.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_5.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_6.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_7.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_8.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_9.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_visualcheck.h
camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_visualcheckdsp.h
camerasrv_plat/media_recorder_api/tsrc/src/StifCamcTestTop.cpp
camerasrv_plat/media_recorder_api/tsrc/src/TestFrameWork/AssertFailure.cpp
camerasrv_plat/media_recorder_api/tsrc/src/TestFrameWork/TestCase.cpp
camerasrv_plat/media_recorder_api/tsrc/src/TestFrameWork/TestSuite.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_1.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_2.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_3.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_4.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_5.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_6.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_7.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_8.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_9.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_visualcheck.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_visualcheckdsp.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTestTop.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_1.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_2.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_3.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_4.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_5.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_6.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_7.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_8.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_9.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_visualcheck.cpp
camerasrv_plat/media_recorder_api/tsrc/src/camcTest_visualcheckdsp.cpp
camerasrv_plat/media_recorder_sink_api/group/bld.inf
camerasrv_plat/media_recorder_sink_api/inc/CCMRMediaSink.h
camerasrv_plat/media_recorder_sink_api/media_recorder_sink_api.metaxml
configmanagers/group/bld.inf
configmanagers/imagingconfigmanager/Bwins/imagingconfigmanagerU.DEF
configmanagers/imagingconfigmanager/EABI/imagingconfigmanagerU.DEF
configmanagers/imagingconfigmanager/cenrep/keys_imagingconfigmanager.xls
configmanagers/imagingconfigmanager/conf/imagingconfigmanager.confml
configmanagers/imagingconfigmanager/conf/imagingconfigmanager_10282EDC.crml
configmanagers/imagingconfigmanager/group/bld.inf
configmanagers/imagingconfigmanager/group/imagingconfigmanager.mmp
configmanagers/imagingconfigmanager/inc/icmcenrepkeys.h
configmanagers/imagingconfigmanager/rom/imagingconfigmanager.iby
configmanagers/imagingconfigmanager/rom/imagingconfigmanagerstub.SIS
configmanagers/imagingconfigmanager/rom/imagingconfigmanagerstub.pkg
configmanagers/imagingconfigmanager/src/imagingconfigmanager.cpp
configmanagers/imagingconfigmanager/tsrc/public/basic/Bmarm/ICMSTIFU.DEF
configmanagers/imagingconfigmanager/tsrc/public/basic/Bwins/ICMSTIFU.DEF
configmanagers/imagingconfigmanager/tsrc/public/basic/EABI/ICMSTIFU.def
configmanagers/imagingconfigmanager/tsrc/public/basic/group/ICMSTIF.mmp
configmanagers/imagingconfigmanager/tsrc/public/basic/group/bld.inf
configmanagers/imagingconfigmanager/tsrc/public/basic/group/testcollector.mk
configmanagers/imagingconfigmanager/tsrc/public/basic/inc/ICMSTIF.h
configmanagers/imagingconfigmanager/tsrc/public/basic/src/ICMSTIF.cpp
group/bld.inf
inc/CamCControllerCustomCommands.h
layers.sysdef.50.xml
layers.sysdef.xml
package_definition.xml
sysdef_1_4_0.dtd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Build/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common build information file to build all CamAppEngine subsystems
+*
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../asynchfilesavequeue/group/bld.inf"
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+
+
+// Exported headers
+
+
+PRJ_EXPORTS
+
+../rom/CamAppEngineStub.SIS /epoc32/data/z/system/install/CamAppEngineStub.sis
+
+../rom/CamAppEngine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(CamAppEngine.iby)
+
+// ROM build files
+
+
+
+PRJ_MMPFILES
+
+../StillConverter/Group/CaeStillConverter.mmp
+
+../Engine/Group/CaeEngine.mmp
+
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Bmarm/CAEENGINEU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	NewL__10CCaeEngine @ 1 NONAME R3UNUSED ; CCaeEngine::NewL(void)
+	NewL__10CCaeEnginei @ 2 NONAME R3UNUSED ; CCaeEngine::NewL(int)
+	CamerasAvailable__10CCaeEngine @ 3 NONAME R3UNUSED ; CCaeEngine::CamerasAvailable(void)
+	NewL__10CCaeEngineii @ 4 NONAME R3UNUSED ; CCaeEngine::NewL(int, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Bwins/CAEENGINEU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	?NewL@CCaeEngine@@SAPAV1@XZ @ 1 NONAME ; public: static class CCaeEngine * __cdecl CCaeEngine::NewL(void)
+	?NewL@CCaeEngine@@SAPAV1@H@Z @ 2 NONAME ; public: static class CCaeEngine * __cdecl CCaeEngine::NewL(int)
+	?CamerasAvailable@CCaeEngine@@SAHXZ @ 3 NONAME ; public: static int __cdecl CCaeEngine::CamerasAvailable(void)
+	?NewL@CCaeEngine@@SAPAV1@HH@Z @ 4 NONAME ; public: static class CCaeEngine * __cdecl CCaeEngine::NewL(int,int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Bwinscw/CAEENGINEU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	?NewL@CCaeEngine@@SAPAV1@XZ @ 1 NONAME ; class CCaeEngine * CCaeEngine::NewL(void)
+	?NewL@CCaeEngine@@SAPAV1@H@Z @ 2 NONAME ; class CCaeEngine * CCaeEngine::NewL(int)
+	?CamerasAvailable@CCaeEngine@@SAHXZ @ 3 NONAME ; int CCaeEngine::CamerasAvailable(void)
+	?NewL@CCaeEngine@@SAPAV1@HH@Z @ 4 NONAME ; class CCaeEngine * CCaeEngine::NewL(int, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Eabi/CaeEngineU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN10CCaeEngine16CamerasAvailableEv @ 1 NONAME
+	_ZN10CCaeEngine4NewLEi @ 2 NONAME
+	_ZN10CCaeEngine4NewLEii @ 3 NONAME
+	_ZN10CCaeEngine4NewLEv @ 4 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Group/CaeEngine.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      CaeEngine.dll
+TARGETTYPE  dll
+
+UID         0x1000008d 0x101F8569
+
+CAPABILITY  CAP_GENERAL_DLL
+VENDORID    VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH  ../Src
+
+SOURCE      CaeEngineImpStillAndVf.cpp
+SOURCE      CaeEngineImpVideoRecording.cpp
+SOURCE      CaeEngineImpInfo.cpp
+SOURCE      CaeQualityLevels.cpp
+SOURCE      CaeStillQualityLevels.cpp
+SOURCE      CaeVideoQualityLevels.cpp
+SOURCE      CaeVideoTimes.cpp
+SOURCE      CaeCallbackActive.cpp
+SOURCE      CaeStillStatesActive.cpp
+SOURCE      CaeExtension.cpp
+
+// Possible definition in features.hrh
+#ifdef __CAE_VR_CUSTOM_COMMANDS
+SOURCE      CaeEngineImpVideoNameCustom.cpp
+#else
+SOURCE      CaeEngineImpVideoName.cpp
+#endif
+
+// Can be removed from here when available in platform.
+// #define     __CAMERA_BURST_MODE
+// #undef      __CAMERA_BURST_MODE
+
+#ifdef __CAMERA_BURST_MODE
+SOURCE      CaeImageItem.cpp
+SOURCE      CaeStillBurst.cpp
+SOURCE      CaeStillStatesActiveBurst.cpp
+#else
+SOURCE      CaeStillStatesActiveNoBurst.cpp
+#endif
+
+SOURCE      CaeImageItemExtPro.cpp
+SOURCE      CaeImageQueueExtPro.cpp
+
+SOURCE      CaeQualityLevelsNoSd.cpp
+SOURCE      CaeStillQualityLevelsNoSd.cpp
+SOURCE      CaeVideoQualityLevelsNoSd.cpp
+
+SOURCE      CaeDbgUtilities.cpp
+
+USERINCLUDE     ../Inc
+USERINCLUDE     ../../StillConverter/Inc
+USERINCLUDE     ../../../inc       // MW level inc dir
+USERINCLUDE     ../traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY     fbscli.lib
+LIBRARY		hal.lib
+LIBRARY     ECom.lib
+LIBRARY     ECAM.lib
+LIBRARY     MMFControllerFramework.lib
+LIBRARY     mediaclientvideo.lib
+LIBRARY     CaeStillConverter.lib
+LIBRARY     ExifLib.lib
+LIBRARY     efsrv.lib
+LIBRARY     imageconversion.lib
+
+// LIBRARY flogger.lib // Enable if USE_FILE_LOGGER is defined
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Group/CaeEngineTestVersion.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine (TEST VERSION!)
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      CaeEngine.dll
+TARGETTYPE  dll
+
+UID         0x1000008d 0x101F8569
+
+CAPABILITY  CAP_GENERAL_DLL
+VENDORID    VID_DEFAULT
+
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+// To compile error simulations in.
+MACRO       CAE_TEST_VERSION 
+#define     CAE_TEST_VERSION
+
+SOURCEPATH  ../Src       
+
+SOURCE      CaeEngineImpStillAndVf.cpp
+SOURCE      CaeEngineImpVideoRecording.cpp
+SOURCE      CaeEngineImpInfo.cpp
+SOURCE      CaeQualityLevels.cpp
+SOURCE      CaeStillQualityLevels.cpp
+SOURCE      CaeVideoQualityLevels.cpp
+SOURCE      CaeVideoTimes.cpp
+SOURCE      CaeCallbackActive.cpp
+SOURCE      CaeStillStatesActive.cpp
+SOURCE      CaeExtension.cpp
+
+// Possible definition in features.hrh
+#ifdef __CAE_VR_CUSTOM_COMMANDS
+SOURCE      CaeEngineImpVideoNameCustom.cpp
+#else
+SOURCE      CaeEngineImpVideoName.cpp
+#endif
+
+// Can be removed from here when available in platform.
+// #define     __CAMERA_BURST_MODE
+
+#ifdef __CAMERA_BURST_MODE
+SOURCE      CaeImageItem.cpp
+SOURCE      CaeStillBurst.cpp
+SOURCE      CaeEngineImpStillBurstSupport.cpp
+#else
+SOURCE      CaeEngineImpNoStillBurst.cpp
+#endif
+
+SOURCE      CaeQualityLevelsNoSd.cpp
+SOURCE      CaeStillQualityLevelsNoSd.cpp
+SOURCE      CaeVideoQualityLevelsNoSd.cpp
+
+SOURCE      CaeDbgUtilities.cpp
+
+#ifdef CAE_TEST_VERSION
+SOURCE      CaeEngineImpTestErrors.cpp
+#endif
+
+USERINCLUDE ../Inc
+USERINCLUDE ../../StillConverter/Inc
+USERINCLUDE	../../../inc      // MW level inc dir
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY     fbscli.lib
+LIBRARY	    hal.lib
+LIBRARY     ECAM.lib
+LIBRARY     MMFControllerFramework.lib
+LIBRARY     mediaclientvideo.lib
+LIBRARY     CaeStillConverter.lib
+LIBRARY     ExifLib.lib
+LIBRARY     efsrv.lib
+LIBRARY     imageconversion.lib
+
+#ifdef EABI
+library ECOM.LIB
+#endif
+
+// LIBRARY flogger.lib // Enable if USE_FILE_LOGGER is defined
+
+EXPORTUNFROZEN
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+CaeEngine.mmp
+
+PRJ_TESTMMPFILES
+CaeEngineTestVersion.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeCallbackActive.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2003,2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active object for calling Camera Application Engine methods 
+*                indirectly from callbacks
+*
+*/
+
+
+
+#ifndef CAECALLBACKACTIVE_H
+#define CAECALLBACKACTIVE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class CCaeEngineImp;
+
+
+// CLASS DECLARATION
+
+/**
+* CCaeCallbackActive
+* Active object for calling Camera Application Engine methods 
+* indirectly from callbacks 
+*/
+NONSHARABLE_CLASS( CCaeCallbackActive ) : public CActive
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS two-phased constructor.
+        * @since 2.1
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        static CCaeCallbackActive* NewLC( 
+            CCaeEngineImp& aCamAppEngine );
+
+        /**
+        * Symbian OS two-phased constructor.
+        * @since 2.1
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        static CCaeCallbackActive* NewL( 
+            CCaeEngineImp& aCamAppEngine );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeCallbackActive();
+
+    protected: // Constructors and destructor
+        
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+        /**
+        * C++ constructor.
+        * @since 2.1
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        CCaeCallbackActive( 
+            CCaeEngineImp& aCamAppEngine );
+
+    public: // New methods
+
+        /**
+        * Switches camera module power on.
+        * @since 2.1
+        * @return void
+        */
+        void PowerOn();
+
+    public: // Methods from CActive (was protected)
+        
+        /**
+        * Calls Camera Application Engine operation.
+        * @return void
+        */
+        void RunL();
+
+    protected: // Methods from CActive
+
+        /**
+        * Cancels request.
+        * @return void
+        */
+        void DoCancel();
+
+    private:
+
+        // Timer to implement delayed operation calls.
+        RTimer iTimer;
+
+        // Reference to Camera Application Engine.
+        CCaeEngineImp& iCamAppEngine;
+
+        // Requests available.
+        enum TRequest
+            {
+            /** Default */
+            ERequestDefault,
+            /** Switch camera power on */
+            ERequestPowerOn,
+            };
+
+        // Request.
+        TRequest iRequest;
+
+    };
+
+#endif // CAECALLBACKACTIVE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeCommon.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common definitions
+*
+*/
+
+
+
+#ifndef CAECOMMON_H
+#define CAECOMMON_H
+
+//  INCLUDES
+
+#include <e32std.h>
+
+// CONSTANTS
+
+enum TCaeExtensionInterfaceIndexes
+	{
+	KCaeExtProcessImageInterfaceIndex = 0,
+	KCaeExtSettingsInterfaceIndex = 1
+	};
+
+// Supported extension interfaces
+// The order of this array must match to TCaeExtensionInterfaceIndexes.
+const TUid KCaeSupportedExtensionInterfaceUids[] = 
+	{
+		{ KCaeExtProcessImageInterfaceUidValue },
+		{ KCaeExtSettingsInterfaceUidValue } ,
+		{ NULL } // End mark
+	};
+
+// Supported callback interfaces
+const TUid KCaeSupportedCallbackInterfaceUids[] = 
+	{
+		{ KCaeExtEngineInfoCallbackInterfaceUidValue },
+		{ NULL } // End mark
+	};
+
+// Extension list granularity
+const TInt TCaeExtensionInterfaceImplItemGranularity = 10;
+
+// CLASS DECLARATIONS
+
+/**
+* Struct for the extension interface implementation array item.
+*/
+
+struct TCaeExtensionInterfaceImplItem
+	{
+    // Priority of the specific implementation
+    TInt iInitialPriority;
+
+    // Uid of the specific implementation
+	TUid iImplUid;
+
+    // Pointer to the specific implementation
+	TAny* iImplPtr;
+
+    // Set to ETrue when image processing is enabled
+	TBool iIsActive;
+	};
+
+/**
+* Struct for the extension interface implementation array item.
+*/
+
+struct TCaeExtensionInterfaceImplListItem
+	{
+	// Uid of the interface 
+	TUid iInterfaceUid;
+
+	// List of implementations
+	RArray<TCaeExtensionInterfaceImplItem>* iImplementations;
+	};
+
+/**
+* Struct for the custom interface implementation array item.
+*/
+
+struct TCaeCustomInterfaceImplItem
+	{
+    // Uid of the custom interface that is implemented by the extension 
+	TUid iInterfaceUid;
+
+    // Pointer to the implementation
+	TAny* iImplPtr;
+	};
+
+
+
+#endif // CAECOMMON_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeDbgUtilities.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utilities for Camera Application Engine. 
+*
+*/
+
+
+#ifndef CAEDBGUTILITIES_H
+#define CAEDBGUTILITIES_H
+
+// MACROS
+
+// Logging support
+// Serial port logging is enabled in _DEBUG builds by default
+// USE_FILE_LOGGER or USE_SERIAL_LOGGER can also be explicitely defined e.g. in MMP file.
+//
+
+// #define USE_FILE_LOGGER
+
+#if defined (_DEBUG) && !defined(USE_FILE_LOGGER)                   
+    #define USE_SERIAL_LOGGER 
+#endif
+                                    
+#if defined (USE_FILE_LOGGER)
+    #include <flogger.h>
+    _LIT(KLogFile,"cae.txt");
+    _LIT(KLogFolder,"cae");
+    #define LOGTEXT(AAA)                RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA)
+    #define LOGTEXT2(AAA,BBB)           RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) RFileLogger::HexDump(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA,BBB,CC,DDD)    
+#elif defined (USE_SERIAL_LOGGER) 
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RDebug::Print(AAA,BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) 
+#endif                              
+
+// Memory info logging.
+#ifdef _DEBUG
+    #define MEM() PrintMemoryInfo()
+#else
+    #define MEM()
+#endif
+
+// Define assert to include file & line number
+#define CAE_ASSERT_FILE__(s) _LIT(KPanicFileName,s)
+#define CAE_ASSERT_PANIC__(l) User::Panic(KPanicFileName().Right(12),l) // Note: RVCT compiler puts the full path in __LINE__ 
+#define CAE_ASSERT_DEBUG_PANIC__(c,l) if (!(c)) {LOGTEXT3(_L("Error panic! Assert failed in file: %S, line: %d"), &KPanicFileName, l);User::Panic(KPanicFileName().Right(12),l);}
+
+#ifdef _DEBUG
+#define CAE_ASSERT_DEBUG(x)  { CAE_ASSERT_FILE__(__FILE__); CAE_ASSERT_DEBUG_PANIC__(x,__LINE__);}
+#define CAE_ASSERT_ALWAYS(x) CAE_ASSERT_DEBUG(x)
+#else
+#define CAE_ASSERT_DEBUG(x)
+#define CAE_ASSERT_ALWAYS(x) { CAE_ASSERT_FILE__("CamAppEngine"); __ASSERT_ALWAYS(x, CAE_ASSERT_PANIC__(__LINE__) ); }
+#endif
+
+
+// FUNCTION PROTOTYPES
+
+#ifdef _DEBUG
+    void PrintMemoryInfo();
+#endif
+
+
+#endif // CAEDBGUTILITIES_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeEngineImp.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,837 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation class
+*
+*/
+
+
+
+#ifndef CAEENGINEIMP_H
+#define CAEENGINEIMP_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <videorecorder.h>
+#include "CamCControllerCustomCommands.h"
+#include "CaeEngine.h"
+#include "CaeEngineExtInterface.h"
+#include "CaeCommon.h"
+#include "CaeStillEncoder.h"
+#include "CaeStillDecoder.h"
+#include "CaeCallbackActive.h"              // For making method calls from callbacks.
+#include "CaeDbgUtilities.h"                // For debugging.
+
+#include <e32std.h>
+
+// CONSTANTS
+const TInt KVideoTimesIntervalDefault = 1000000; // Default time interval for Video Recording times call-back.
+
+const TInt KVideoTimesDelay = 100000; // Delay in starting to generate video times, in microseconds.
+
+const TInt KCameraPriority = -1; // Relative priority (-100...100) of camera HW
+
+const TUid KUidBurstModeVFOptimization = {0x4A758866}; // Custom command interface UID used by some products
+
+// FORWARD DECLARATIONS
+class CVideoRecorderUtility;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class CFbsBitmap;
+class CCaeStillQualityLevelsCont;
+class CCaeVideoQualityLevelsCont;
+class CCaeVideoTimes;
+class CCaeStillBurst;
+class CCaeStillStatesActive;
+
+
+// CLASS DECLARATIONS
+
+/**
+* Camera application engine implementation class.
+*/
+
+NONSHARABLE_CLASS( CCaeEngineImp ): public CCaeEngine, 
+                                    public MCameraObserver,
+                                    public MExtensionCallbackInterface,
+					                public MCaeExtEngineInfoCallbackInterface,
+                                    public MVideoRecorderUtilityObserver,
+                                    public MCameraObserver2
+    {
+
+    friend void CCaeCallbackActive::RunL();
+	friend void CCaeCallbackActive::DoCancel();
+
+    public: // Construction and destruction
+
+        static CCaeEngineImp* NewL();
+
+        virtual ~CCaeEngineImp();
+
+    
+    public: // General methods / CCaeEngine.h
+
+        void SetCamAppEngineObserver( 
+            MCamAppEngineObserver& aObserver );
+
+        void GetInfo( 
+            TCamAppEngineInfo& aInfo ) const;
+
+        void InitL( 
+            TBool aCreateSnapImage = ETrue );
+
+        void InitL( 
+            TUid  aSdUidStillQltyLevels, 
+            TBool aCreateSnapImage = ETrue );
+
+        void InitVideoRecorderL();
+        
+        void InitVideoRecorderL( 
+            TUid aSdUidVideoQltyLevels );
+
+        void Reserve();
+
+        void Release();
+
+        void PowerOn();
+
+        void PowerOff();
+
+    
+    public: // Camera settings / CCaeEngine.h
+
+        void SetZoomModeL( 
+            TZoomMode aZoomMode = EZoomModeDigital );
+
+        TZoomMode ZoomMode() const;
+
+        void SetZoomValueL( 
+            TInt aZoomValue = 0 );
+
+        TInt ZoomValue() const;
+
+        void SetBrightnessL( 
+            TInt aBrightness = 0 );
+
+        TInt Brightness() const;
+
+        void SetContrastL( 
+            TInt aContrast = 0 );
+
+        TInt Contrast() const;
+
+        void SetExposureModeL( 
+            CCamera::TExposure aExposureMode = CCamera::EExposureAuto );
+
+        CCamera::TExposure ExposureMode() const;
+
+        void SetWhiteBalanceModeL( 
+            CCamera::TWhiteBalance aWhiteBalanceMode = CCamera::EWBAuto );
+
+        CCamera::TWhiteBalance WhiteBalanceMode() const;
+
+        void SetFlashModeL( 
+            CCamera::TFlash aFlashMode = CCamera::EFlashNone );
+
+        CCamera::TFlash FlashMode() const;
+
+        void ResetToDefaultsL();
+    
+    
+    public: // View Finder / CCaeEngine.h
+
+        void SetViewFinderMirrorL( 
+            TBool aMirror );
+
+        TBool ViewFinderMirror() const;
+
+        void StartViewFinderBitmapsL( 
+            TSize& aVfFrameSize );
+
+        void StartViewFinderBitmapsL( 
+            TSize& aVfFrameSize, 
+            TRect& aCropRect );
+        
+        void StartViewFinderDirectL( 
+            RWsSession&      aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase&     aWindow, 
+            TRect&           aScreenRect );
+
+        void StartViewFinderDirectL( 
+            RWsSession&      aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase&     aWindow, 
+            TRect&           aScreenRect, 
+            TRect&           aCropRect );
+        
+        void StopViewFinder();
+
+        TBool IsViewFinding() const;
+
+        void GetViewFinderSize( 
+            TSize& aVfFrameSize );
+
+    
+    public: // Still image capturing / CCaeEngine.h
+
+        void PrepareStillCaptureL( 
+            TInt aStillQualityIndex );
+        
+        void PrepareStillCaptureL( 
+            TInt         aStillQualityIndex, 
+            const TRect& aCropRect );
+
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat,
+            TInt             aCompressionQuality );
+
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat, 
+            TInt             aCompressionQuality, 
+            const TRect&     aCropRect );
+
+        TInt StillQualityIndex() const;
+
+        void GetStillFrameSize( 
+            TInt   aStillQualityIndex, 
+            TSize& aSize ) const;
+
+        TInt EstimatedStillSizeInBytes( 
+            TInt aStillQualityIndex ) const;
+
+        void CaptureStill(); 
+        
+        void CancelCaptureStill();
+
+    
+    public: // Video recording / CCaeEngine.h
+    
+        void SetVideoRecordingFileNameL( 
+            const TDesC& aVideoClipFileName );
+
+        void PrepareVideoRecordingL( 
+            TInt aVideoQualityIndex );
+
+        void PrepareVideoRecordingL( 
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType = KNullDesC8, 
+            const TDesC8& aAudioType = KNullDesC8 );
+
+        void CloseVideoRecording();
+
+        TInt VideoQualityIndex() const;
+
+        void GetVideoFrameSize( 
+            TInt   aVideoQualityIndex, 
+            TSize& aSize ) const;
+
+        TReal32 VideoFrameRate( 
+            TInt aVideoQualityIndex ) const;
+
+        TInt EstimatedVideoRecordingBitRateL( 
+            TInt aVideoQualityIndex ) const;
+
+        void SetVideoClipMaxSizeL( 
+            TInt aMaxClipSizeInBytes = 0 );
+
+        TInt VideoClipMaxSize() const;
+
+        void SetVideoAudioL( 
+            TBool aAudioEnabled );
+
+        TBool VideoAudio() const;
+
+        void SetVideoTimesIntervalL( 
+            TTimeIntervalMicroSeconds aInterval );
+
+        TTimeIntervalMicroSeconds VideoTimesInterval() const;
+
+        void StartVideoRecording();
+
+        void StopVideoRecording();
+
+        void PauseVideoRecording();
+
+        void ResumeVideoRecording();
+
+        TTimeIntervalMicroSeconds RemainingVideoRecordingTime() const;
+
+        TBool IsVideoRecording() const;
+
+    public: // New overloading method for preparing video recording / CCaeEngine.h
+    
+        void PrepareVideoRecordingL( 
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            TInt          aAudioBitRate, 
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType, 
+            const TDesC8& aAudioType );
+
+    public: // Still image burst capturing interface methods / CCaeEngine.h
+
+        void SetCaeStillBurstObserver( 
+            MCaeStillBurstObserver& aObserver );
+
+        TInt SetStillCaptureImageCountL( 
+            TInt aImageCount );
+
+        TInt StillCaptureImageCount() const;
+
+        void SetStillBurstCaptureIntervalL( 
+            TTimeIntervalMicroSeconds aInterval );
+
+        TTimeIntervalMicroSeconds StillBurstCaptureInterval() const;
+
+        void StopStillBurstCapture();
+
+        void PrepareStillCaptureL( 
+            TInt         aStillQualityIndex, 
+            TSize&       aSnapSize );
+
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat,  
+            TInt             aCompressionQuality, 
+            const TRect&     aCropRect,
+            TSize&           aSnapSize );
+
+        void SetEvCompensationL( 
+            TInt aEvIndex = 0 );
+
+        TInt EvCompensation() const;
+        
+    public: // Method for switching snap-image creation on/off. / CCaeEngine.h
+    
+        void SetSnapImageCreation( 
+            TBool aCreateSnapImage = ETrue );
+
+    public: // New methods since 2.6 and 2.8 / CCaeEngine.h
+
+    	static CCaeEngineImp* NewL(
+    	    TInt aCameraIndex, TInt aDisplayIndex );
+
+    	void EnumerateStillCaptureSizes(
+    	    TSize& aSize,
+    	    TInt aSizeIndex,
+    	    CCamera::TFormat aFormat ) const;
+
+    	void SetJpegQuality(
+    	    TInt aQuality );
+
+    	TInt JpegQuality() const;
+
+        TAny* CustomInterface(
+			TUid aInterface );
+
+        void SetSnapImageSizeL(
+            TSize& aSize );
+
+        void SetSnapImageColorMode(
+            TDisplayMode aMode );
+
+        void GetOrderL( 
+			RCaeOrderedFeatureList& aOrderedFeatureList );
+
+        void SetOrderL( 
+			const RCaeOrderedFeatureList& aOrderedFeatureList );
+
+        void SetSnapImageSourceL(
+            TSnapImageSource aSnapImageSource );
+
+        void SetImageCodecsL( 
+        	TUid aDecoderUid, TUid aEncoderUid );
+
+        TInt EnumerateVideoFrameSizeL(const TSize& aSize);
+        
+        TInt CCameraHandle() const;
+        	
+        void SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage );
+
+        void ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame );
+
+        void ProcessExtSnapImageL( CFbsBitmap& aSnapImage );
+
+        void ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage );
+        
+        void ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage );
+        
+        void ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage );
+
+        void ProcessExtCancel();
+
+        void SkippedExtensionListL( RCaeOrderedFeatureList& aDisabledExtensions );
+
+        void SetSkippedExtensionList( RCaeOrderedFeatureList& aDisabledExtensions );
+
+        void EnableVideoRecording();
+        
+        void DisableVideoRecording();
+
+        TInt SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled );
+
+    public: // New public methods
+
+        /**
+        * Checks if still image burst capture should be completed.
+        * @since 2.6
+        * @return Boolean indicating if the burst should be completed.
+        */
+        TBool CheckForStillBurstCompletion();
+        
+    private: // From Camera Observer / ECam.h
+
+        void ReserveComplete( 
+            TInt aError );
+
+        void PowerOnComplete( 
+            TInt aError );
+
+        void ViewFinderFrameReady( 
+            CFbsBitmap& aFrame );
+
+        void ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aData, 
+            TInt        aError );
+
+        void FrameBufferReady( 
+            MFrameBuffer* /*aFrameBuffer*/, 
+            TInt          /*aError*/ ) {}; // Empty default because not in use.
+   
+    private: // From Video Recorder Utility Observer / VideoRecorder.h
+
+        void MvruoOpenComplete( 
+            TInt aError );
+
+        void MvruoPrepareComplete( 
+            TInt aError );
+
+        void MvruoRecordComplete( 
+            TInt aError );
+
+        void MvruoEvent( 
+            const TMMFEvent& aEvent );
+
+    
+    private: // Private member methods
+
+        /**
+        * C++ constructor.
+        */
+        CCaeEngineImp();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        * @param aCameraIndex Index from 0 to CamerasAvailable()-1 inclusive 
+        * specifying the camera device to use.
+        * @param aDisplayIndex Display index specifying the display to use.
+        * @return void
+        */
+        void ConstructL( TInt aCameraIndex, TInt aDisplayIndex );
+
+        /**
+        * Finds all extension dlls and populates the extension arrays.
+        * @since 2.8
+        * @return void
+        */
+		void PopulateExtensionArrayL();
+
+    //// General and settings related private methods. ////
+
+        /**
+        * Initializes the info class ("structure").
+        * @since 2.1
+        * @param aCamera Camera object.
+        * @return void
+        */
+        void InitializeInfo( 
+            const CCamera& aCamera );
+
+        /**
+        * Checks that power is on. If not, then leaves.
+        * @since 2.1
+        * @return void
+        */
+        void CheckPowerL();
+
+        /**
+        * Cancels view finder, still capturing, and video recording.
+        * @since 2.1
+        * @return void
+        */
+        void CancelAllActivities();
+
+        /**
+        * Re-sets settings to the previous values (before releasing camera).
+        * @since 2.1
+        * @return void
+        */
+        void ResetToPreviousSettingsL();
+
+    //// Video recording related private methods. ////
+
+        /**
+        * Cancels video recording.
+        * @since 2.1
+        * @return void
+        */
+        void CancelVideoRecording();
+
+        /**
+        * Prepares video recording settings.
+        * @since 2.1
+        * @return void
+        */
+        void PrepareVideoSettingsL();
+
+        /**
+        * Changes video clip file name.
+        * @since 2.1
+        * @return void
+        */
+        void ChangeVideoFileNameL();
+
+        /**
+        * Finds video type and format UIDs using ECOM.
+        * @since 2.1
+        * @param aMimeType MIME type.
+        * @param aPreferredSupplier Preferred supplier of video encoder.
+        * @return void
+        */
+        void FindVideoUidsL(
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier );
+
+        /**
+        * Convert audio type from TDesC8 to TFourCC.
+        * @since 2.1
+        * @param aAudioType Audio type.
+        * @return Audio type TFourCC code
+        */
+        TFourCC ConvertAndSetVideoAudioTypeL(
+            const TDesC8& aAudioType );
+
+        /**
+        * Generates video recording times via
+        * MCamAppEngineObserver::McaeoVideoRecordingTimes implemented by client.
+        * @since 2.1
+        * @param aEngineImp Camera Application Engine implementation object (this) 
+        * @return ETrue
+        */
+        static TInt VideoRecordingTimesCallback( 
+            TAny* aEngineImp );
+
+    //// Still image burst capturing related private methods. ////
+
+        /**
+        * Gets option flag for still burst support.
+        * @since 2.1
+        * @return Option flag for still burst support
+        */
+        TCamAppEngineInfo::TOptions StillBurstSupport();
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool MatchEqualImplUid( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool MatchEqualImplPtr( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool MatchSmallerInitialPriorityAndImplUid( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool Match( const TCaeOrderedFeatureListItem& aFirst, const TCaeOrderedFeatureListItem& aSecond );
+
+        /**
+        * Updates item order in the internal array or checks aOrderedFeatureArray validity.
+        * @since 2.8
+        * @param aOrderedFeatureArray Feature array sorted by the wanted calling order in an interface.
+        * @param iUpdate Whether to update the internal raays or just to check validity of aOrderedFeatureArray.
+        * @return void.
+        */
+		void DoSetOrderL( const RCaeOrderedFeatureList& aOrderedFeatureList, TBool iUpdate );
+
+	private: // From MCaeEngineExtensionInterface
+
+		TBool IsInterfaceSupported( TUid aInterfaceUid );
+
+		TInt AddExtensionInterface( TUid aInterfaceUid, TUid aExtensionUid, TAny* aImplementationPtr, TInt aInitialPriority = 0 );
+
+		TInt RemoveExtensionInterface( TUid aInterfaceUid, TAny* aImplementationPtr );
+
+		TInt AddCustomInterface( TUid aInterfaceUid, TAny* aImplementationPtr );
+
+		TAny* GetCallbackInterface( TUid aInterfaceUid );
+
+        void RegisterFlags( TUint32 aFlags );
+
+        void DeregisterFlags( TUint32 aFlags );
+
+	private: // From MCaeExtEngineInfoCallbackInterface
+
+		TSize McaeExtStillImageSize();
+
+		TSize McaeExtSnapImageSize();
+
+		TSize McaeExtViewFinderSize();
+
+		void McaeExtCheckPowerL();
+
+		TInt McaeExtDisplayIndex();
+
+    private: // From Camera Observer2 / ECam.h
+
+        void HandleEvent(const TECAMEvent& aEvent);
+
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    private: // Data
+    
+    //// Pointers. ////
+
+        // Camera API implementation object.
+        CCamera* iCamera;
+
+        // State machine for still capturing.
+        CCaeStillStatesActive* iStillStatesActive; 
+
+		// All CAE Extension modules
+		RPointerArray<MExtension> iExtension;
+
+		// All extension interface implementations.
+		RArray<TCaeExtensionInterfaceImplListItem> iExtInterfaceImplementationLists;
+
+		// All custom interface implementations.
+		RArray<TCaeCustomInterfaceImplItem> iExtCustomInterfaceImplementations;
+
+        // Video Recorder API implementation object.
+        CVideoRecorderUtility* iVideoRecorder;
+
+        // Camera Application Engine observer.
+        MCamAppEngineObserver* iCaeObserver;
+
+        // Camera Application Engine info object.
+        TCamAppEngineInfo* iInfo;
+
+        // Still image capturing quality levels container.
+        CCaeStillQualityLevelsCont* iStillQualityLevelsCont;
+
+        // Video recording quality levels container.
+        CCaeVideoQualityLevelsCont* iVideoQualityLevelsCont;
+
+        // Active object for calling Camera Application Engine methods 
+        // indirectly from callbacks.
+        CCaeCallbackActive* iCallbackActive;
+
+        // Video recording frame size.
+        // This is ptr because video recorder is not necessarily initialized.
+        TSize* iVideoFrameSize;
+
+        // Video recording frame size (to be prepared).
+        // This is ptr because video recorder is not necessarily initialized.
+        TSize* iVideoFrameSizePrep;
+
+        // Video recording times generator.
+        CCaeVideoTimes *iVideoTimes;
+
+        // Video recording times callback.
+        TCallBack* iVideoTimesCallback;
+
+        // Video clip file name.
+        HBufC* iVideoClipFileName;
+        
+        // Video Recorder video type.
+        HBufC8* iVideoType;
+
+    //// Booleans (mostly reporting state). ////
+
+        // Boolean indicating if camera module is reserved for the engine.
+        TBool iReserved;
+
+        // Boolean indicating if camera module power is on.
+        TBool iPowerOn;
+
+        // Boolean indicating if video recording is initialized.
+        TBool iVideoInitialized;
+
+        // Boolean indicating if still image capture is prepared.
+        TBool iStillPrepared;
+
+        // Boolean indicating if video recording is opened.
+        TBool iVideoOpened;
+
+        // Boolean indicating if video recording is prepared.
+        TBool iVideoPrepared;
+
+        // Boolean indicating if view finder is currently running.
+        TBool iViewFinderRunning;
+
+        // Boolean indicating if video recording is currently running.
+        TBool iVideoRecordingRunning;
+
+        // Boolean indicating if video recording is currently paused.
+        TBool iVideoRecordingPaused;
+
+        // Boolean indicating if the engine should reset its basic settings 
+        // to the previous ones when re-reserving.
+        TBool iResetToPreviousSettings;
+
+    //// Camera module settings related variables. ////
+
+        // Current zoom mode.
+        TZoomMode iZoomMode;
+
+        // Current zoom value.
+        TInt iZoomValue;
+
+        // Current brightness value.
+        TInt iBrightness;
+
+        // Current contrast value.
+        TInt iContrast;
+
+        // Camera exposure mode.
+        CCamera::TExposure iExposureMode;
+
+        // Camera white balance mode.
+        CCamera::TWhiteBalance iWhiteBalanceMode;
+
+        // Camera flash mode.
+        CCamera::TFlash iFlashMode;
+
+    //// View finder related variables. ////
+
+        // View finder size when viewfinder has been started.
+        TSize iTrueViewFinderSize;
+
+    //// Still capturing related variables. ////
+
+        // Still image capture quality level index currently prepared.
+        TInt iStillQualityIndex; 
+
+        // Display index
+        TInt iDisplayIndex;
+
+      //// Video recording related variables. ////
+
+        // Video recording quality level index currently prepared.
+        TInt iVideoQualityIndex;
+
+        // Handle to the camera used.
+        TInt iCameraHandle;
+
+        // Video Recorder controller UID.
+        TUid iVideoControllerUid;
+
+        // Video Recorder format UID.
+        TUid iVideoFormatUid;
+
+        // Video Recorder audio type.
+        TFourCC iVideoAudioType;
+
+        // Interval for calling McaeoVideoRecordingTimes.
+        TTimeIntervalMicroSeconds32 iVideoTimesInterval;
+
+		// Previous valid elapsed time value
+    	TTimeIntervalMicroSeconds iPrevTimeElapsed;
+    	
+		// Previous valid remaining time value
+    	TTimeIntervalMicroSeconds iPrevTimeRemaining;
+    	
+    //// Video recording parameters prepared. ////
+        
+        // Video recording frame rate.
+        TReal32 iVideoFrameRate;
+
+        // Video recording bit rate.
+        TInt iVideoBitRate;
+
+        // Boolean indicating if audio is enabled with video recording.
+        TBool iVideoAudioEnabled;
+
+        // Video recording audio bit rate.
+        TInt iVideoAudioBitRate;
+
+        // Video recording maximum clip size in bytes.
+        TInt iMaxClipSizeInBytes;
+
+    //// Video recording parameters to be prepared. ////
+
+        // Video recording frame rate (to be prepared).
+        TReal32 iVideoFrameRatePrep;
+
+        // Video recording bit rate (to be prepared).
+        TInt iVideoBitRatePrep;
+
+        // Boolean indicating if audio is enabled with video recording (to be prepared).
+        TBool iVideoAudioEnabledPrep;
+
+        // Video recording audio bit rate (to be prepared).
+        TInt iVideoAudioBitRatePrep;
+
+        // Video recording maximum clip size in bytes (to be prepared).
+        TInt iMaxClipSizeInBytesPrep;
+
+        // Boolean indicating if parameters are/were prepared in video recording preparation..
+        TBool iPrepPars;
+
+        // Boolean indicating if video audio bit rate should be prepared.
+        TBool iPrepareVideoAudioBitRate;
+        
+        // Boolean indicating if video stopping should be asynchronously or synchronously (default).
+        TBool iAsyncVideoStopEnabled;
+    };
+
+
+#endif // CAEENGINEIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeEngineImpTestErrors.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine error simulation global functions  
+*                for testing (CAE_TEST_VERSION only).
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+#ifndef CAEENGINEIMPTESTERRORS_H
+#define CAEENGINEIMPTESTERRORS_H
+
+IMPORT_C void CaeSetMcaeseoHBufC8ImageReadyError( TInt aError );
+
+IMPORT_C void CaeMcaeseoHBufC8ImageReadyError( TInt& aError );
+
+IMPORT_C void CaeSetMcaesdoCFbsBitmapImageReadyError( TInt aError );
+
+IMPORT_C void CaeMcaesdoCFbsBitmapImageReadyError( TInt& aError );
+
+IMPORT_C void CaeSetPowerOnCompleteError( TInt aError );
+
+IMPORT_C void CaePowerOnCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetReserveCompleteError( TInt aError );
+
+IMPORT_C void CaeReserveCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetImageReadyError( TInt aError );
+
+IMPORT_C void CaeImageReadyError( TInt& aError );
+
+IMPORT_C void CaeSetMvruoOpenCompleteError( TInt aError );
+
+IMPORT_C void CaeMvruoOpenCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetMvruoPrepareCompleteError( TInt aError );
+
+IMPORT_C void CaeMvruoPrepareCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetMvruoRecordCompleteError( TInt aError );
+
+IMPORT_C void CaeMvruoRecordCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetPrepareVideoSettingsError( TInt aError );
+
+IMPORT_C void CaePrepareVideoSettingsErrorL();
+
+IMPORT_C void CaeSetCreateAndDeliverSnapImageError( TInt aError );
+
+IMPORT_C void CaeCreateAndDeliverSnapImageError( TInt& aError );
+
+IMPORT_C void CaeSetCreateAndDeliverStillImageError( TInt aError );
+
+IMPORT_C void CaeCreateAndDeliverStillImageError( TInt& aError );
+
+#endif // CAEENGINEIMPTESTERRORS_H
+
+#endif // #ifdef CAE_TEST_VERSION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeImageItem.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAEIMAGEITEM_H
+#define CAEIMAGEITEM_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+// An image item class. Can be used in image queues.
+NONSHARABLE_CLASS( CCaeImageItem ) : public CBase
+    {
+    
+    public:
+        /**
+        * Default constructor.
+        */
+        CCaeImageItem( RHeap& aImageHeap );
+         
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeImageItem();
+        
+    public:
+        // Bitmap pointer.
+        CFbsBitmap* iBitmap;
+        // Image pointer (not in bitmap format).
+        TAny* iImageData;
+        // Size of iImageData
+        TInt iImageDataSize;
+		// Heap for iImageData
+		RHeap& iImageHeap; 
+        // Possible error related to the image (from capturing).
+        TInt iError;
+        
+    };
+
+
+
+#endif // CAEIMAGEITEM_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeImageItemExtPro.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item for Camera Application Engine for extension processing
+*
+*/
+
+
+
+#ifndef CAEIMAGEITEMEXTPRO_H
+#define CAEIMAGEITEMEXTPRO_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+// An image item class. Can be used in image queues.
+NONSHARABLE_CLASS( CCaeImageItemExtPro ) : public CBase
+    {
+    
+    public:
+        /**
+        * Default constructor.
+        */
+        CCaeImageItemExtPro();
+         
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeImageItemExtPro();
+        
+    public:
+        // Bitmap pointer for snap or captured image.
+        CFbsBitmap* iBitmap;
+        
+        // Image pointer for main captured image.
+        HBufC8* iImageData;
+
+        // Flag for last burst image
+        TBool iLastImage;
+
+        // Flag for indicating if the iBitmap is snap or captured image
+        TBool iSnapImage;
+    };
+
+
+
+#endif // CAEIMAGEITEMEXTPRO_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeImageQueueExtPro.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image queue for extension processing
+*
+*/
+
+
+
+#ifndef CAEIMAGEQUEUEEXTPRO_H
+#define CAEIMAGEQUEUEEXTPRO_H
+
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+class CCaeImageItemExtPro;
+template <class T> class RPointerArray;
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine still image queue for extension processing class.
+*
+*/
+
+NONSHARABLE_CLASS( CCaeImageQueueExtPro ) : public CBase
+    {
+
+    public: // Construction and destruction
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeImageQueueExtPro* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeImageQueueExtPro();
+
+    public:
+
+        /**
+        * Appends an image item into the image queue.
+        * @since 3.2
+        * @param aBitmap Symbian OS bitmap snap image or captured bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @param aSnapImage Set when aBitmap is snap image.
+        * @return Error code KErrNone, if the insertion is successful, 
+        * otherwise one of the system wide error codes.
+        */
+        TInt AppendImage( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aImageData,
+            TBool       aLastImage,
+            TBool       aSnapImage );
+
+        /**
+        * Gets the count of image items in the image queue.
+        * @since 3.2
+        * @return The count of image items in the image queue
+        */
+        TInt ImageCount() const;
+            
+        /**
+        * Gets the next image from image queue.
+        * @since 3.2
+        * @param aBitmap Symbian OS bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @param aSnapImage Set when aBitmap is snap image.
+        * @return Error code KErrNone, if the operation is successful, 
+        * otherwise KErrUnderflow (= no images in the queue).
+        */
+        TInt GetNextImage( 
+            CFbsBitmap*& aBitmap, 
+            HBufC8*&     aImageData,
+            TBool&       aLastImage,
+            TBool&       aSnapImage );
+
+        /**
+        * Resets and destroys image items from the image queue.
+        * @since 3.2
+        * @return void
+        */
+        void ResetAndDestroyImages();
+
+    private: // Private member methods
+
+        /**
+        * C++ constructor.
+        */
+        CCaeImageQueueExtPro();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Image queue for the images captured in burst.
+        RPointerArray<CCaeImageItemExtPro>* iImageQueue;
+
+    };
+
+
+#endif // CAEIMAGEQUEUEEXTPRO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeQualityLevels.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine imaging quality level and container
+*
+*/
+
+
+
+#ifndef CAEQUALITYLEVELS_H
+#define CAEQUALITYLEVELS_H
+
+// INCLUDES
+#include <ecam.h>
+#include <e32base.h>
+#include <e32std.h>
+
+// CONSTANTS
+const TInt KCaeDefaultQltyLevelCount = 3;
+const TInt KCaeMaxSdKeyLength = 10;
+const TInt KCaeMaxQltyLevelStringLength = 256;
+
+// FORWARD DECLARATIONS
+class CQualityLevel;
+class RSharedDataClient;
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine image/video quality levels container.
+*
+*/
+NONSHARABLE_CLASS( CCaeQualityLevelsCont ) : public CBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeQualityLevelsCont();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeQualityLevelsCont* NewL();
+
+        /**
+        * Initialize quality levels from Shared Data ini-file.
+        * @since 2.1
+        * @param aSdUidQltyLevels Shared Data ini-file UID
+        * @return Count of quality levels initialized
+        */
+        TInt InitFromSdL( 
+            const TUid&  aSdUidQltyLevels );
+
+        /**
+        * Initializes quality levels to hardcoded default values.
+        * @since 2.1
+        * @return Count of quality levels initialized
+        */
+        virtual TInt InitDefaultsL() = 0;
+        
+        /**
+        * Gets the quality level count.
+        * @since 2.1
+        * @return Quality level count
+        */
+        virtual TInt Count() const = 0;
+
+        /**
+        * Get the specified quality level Shared Data key.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Quality level Shared Data key
+        */
+        virtual const TDes& Key( 
+            TInt aIndex ) const = 0;
+
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CCaeQualityLevelsCont();
+
+    private: // Private methods.
+
+        /**
+        * Fetches namebase setting from SharedData Camera ini file.
+        * @since 2.1
+        * @param aSdUidQltyLevels Shared Data ini-file UID
+        * @param aIndex Quality level index
+        * @return void
+        */
+        void FetchQualityLevelL(
+            RSharedDataClient& aSharedData, 
+            const TUid&        aSdUidQltyLevels, 
+            TInt               aIndex );
+
+    private: // Private pure virtual methods.
+
+        /**
+        * Resizes quality level array.
+        * @since 2.1
+        * @param aQualityLevelCount Quality level count for the new array
+        * @return void
+        */
+        virtual void ResizeL( 
+            TInt aQualityLevelCount ) = 0;
+
+        /**
+        * Gets the quality level count Shared Data key.
+        * @since 2.1
+        * @return Quality level count Shared Data key
+        */
+        virtual const TDesC& QltyLevelCountSdKey() const = 0;
+
+        /**
+        * Creates quality level string for SharedData Camera ini file.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @param aDefaultQualityLevel Output quality level string
+        * @return void
+        */
+        virtual void CreateQualityLevelString( 
+            TInt  aIndex, 
+            TDes& aDefaultQualityLevel ) = 0;
+
+        /**
+        * Parses quality level string to quality level object data.
+        * @since 2.1
+        * @param aQualityLevelString Quality level string to parse
+        * @param aIndex Quality level index
+        * @return void
+        */
+        virtual void ParseQualityLevelFromStringL( 
+            const TDesC& qualityLevelString, 
+            TInt         aIndex ) = 0;
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine image/video quality level.
+*
+*/
+NONSHARABLE_CLASS( CQualityLevel ) : public CBase
+    {
+    public:
+        
+        /**
+        * Constructor.
+        */
+        CQualityLevel();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CQualityLevel();
+
+    public:
+
+        // Shared Data ini-file key.
+        TBuf<KCaeMaxSdKeyLength> iKey;
+
+    };
+
+#endif // CAEQUALITYLEVELS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeSdKeys.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Shared Data UID and keys
+*
+*/
+
+
+
+#ifndef CAESDKEYS_H
+#define CAESDKEYS_H
+
+
+// CONSTANTS
+
+// -----------------------------------------------------------------------------
+// Camera Application Engine 0x101f8569
+// -----------------------------------------------------------------------------
+
+const TUid KSDUidCamAppEngine = {0x101f8569};
+
+/**
+* Count of still image capturing quality levels, integer value
+*
+* Default value: 3
+*/
+_LIT( KCaeStillQltyLevelCount, "StillQltyC" );
+
+/**
+* Still image capturing quality level 0, multiparameter string
+*
+* String format: width height format quality imagesize
+* width: frame/image width in pixels
+* height: frame/image height in pixels
+* format: Camera API CCamera::TFormat code (e.g. EFormatJpeg = 0x0010 ==> value 10 here)
+* quality: compression quality 0...100 
+* 0 corresponds to worst image quality (highest compression), 
+* 100 corresponds to best image quality (lowest compression)
+* bytesize: estimated storage size of an image in bytes (if 0 then no estimate is given)
+*
+* Default value: 640 480 10 90 0
+*/
+_LIT( KCaeStillQltyLevel0, "StillQlty0" );
+
+/**
+* Still image capturing quality level 1, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 640 480 10 50 0 
+*/
+_LIT( KCaeStillQltyLevel1, "StillQlty1" );
+
+/**
+* Still image capturing quality level 2, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 640 480 10 50 0 
+*/
+_LIT( KCaeStillQltyLevel2, "StillQlty2" );
+
+/**
+* Still image capturing quality level 3, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeStillQltyLevel3, "StillQlty3" );
+
+/**
+* Still image capturing quality level 4, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeStillQltyLevel4, "StillQlty4" );
+
+/**
+* Still image capturing quality level 5, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeStillQltyLevel5, "StillQlty5" );
+
+/**
+* Count of video recording quality levels, integer value
+*
+* Default value: 3
+*/
+_LIT( KCaeVideoQltyLevelCount, "VideoQltyC" );
+
+/**
+* Video recording quality level 0, multiparameter string
+*
+* String format: width height framerate bitrate audio mimetype supplier videotype audiotype byterate 
+* width: frame/image width in pixels
+* height: frame/image height in pixels
+* framerate: encoded video frame rate (frames per second, fps)  
+* bitrate: encoded video bit rate (bits per second, bps) 
+* audio: is audio enabled? (0 = no, 1 = yes) 
+* mimetype: video MIME type 
+* supplier: supplier of video controller  
+* videotype: video type
+* audiotype: audio type (four character code)
+* storagerate: estimated bit rate to storaged (bits per second, bps) (if 0 then no estimate is given)
+*
+* Default value: 176 144 10 50000 1 12200 video/3gpp Nokia video/H263-2000  AMR 0
+*/
+_LIT( KCaeVideoQltyLevel0, "VideoQlty0" );
+
+/**
+* Video image capturing quality level 1, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 128 96 10 30000 1 12200 video/3gpp Nokia video/H263-2000  AMR 0
+*/
+_LIT( KCaeVideoQltyLevel1, "VideoQlty1" );
+
+/**
+* Video image capturing quality level 2, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 128 96 5 15000 0 12200 video/3gpp Nokia video/H263-2000  AMR 0
+*/
+_LIT( KCaeVideoQltyLevel2, "VideoQlty2" );
+
+/**
+* Video image capturing quality level 3, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeVideoQltyLevel3, "VideoQlty3" );
+
+/**
+* Video image capturing quality level 4, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeVideoQltyLevel4, "VideoQlty4" );
+
+/**
+* Video image capturing quality level 5, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeVideoQltyLevel5, "VideoQlty5" );
+
+
+#endif // CAESDKEYS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeStillBurst.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image burst class
+*
+*/
+
+
+
+#ifndef CAESTILLBURST_H
+#define CAESTILLBURST_H
+
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+class CCaeImageItem;
+template <class T> class RPointerArray;
+
+// CLASS DECLARATION
+
+/**
+* Camera application engine still image burst capturing class.
+*
+*/
+
+NONSHARABLE_CLASS( CCaeStillBurst ) : public CBase
+    {
+
+    public: // Construction and destruction
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeStillBurst* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeStillBurst();
+
+    public: // Settings
+
+        /**
+        * Sets the desired length of the burst. That many captures should be done in the burst.
+        * Note that the final burst length really captured may be different if 
+        * there has been memory allocation problems or if the burst has been stopped.
+        * @since 2.1
+        * @param aLength The desired length of the burst
+        * @return void
+        */
+        void SetLengthL( 
+            TInt aLength );
+
+        /**
+        * Gets the length of the burst. That many captures will be done in the burst.
+        * Note that the final burst length really captured may be different if 
+        * there has been memory allocation problems or if the burst has been stopped.
+        * @since 2.1
+        * @return The desired length of the burst
+        */
+        TInt Length() const;
+
+    public: // Burst handling
+
+        /**
+        * Appends an image item into the image queue.
+        * @since 2.1
+        * @param aBitmap Symbian OS bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aError Error code related to the image.
+        * @return Error code KErrNone, if the insertion is successful, 
+        * otherwise one of the system wide error codes.
+        */
+        TInt AppendImage( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aImageData, 
+            TInt        aError );
+
+        /**
+        * Gets the count of image captures.
+        * @since 2.1
+        * @return The count of image captures
+        */
+        TInt CaptureCount() const;
+
+        /**
+        * Gets the count of image items in the image queue.
+        * @since 2.1
+        * @return The count of image items in the image queue
+        */
+        TInt ImageCount() const;
+            
+        /**
+        * Gets the next image from image queue.
+        * @since 2.1
+        * @param aBitmap Symbian OS bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aError Error code related to the image.
+        * @return Error code KErrNone, if the operation is successful, 
+        * otherwise KErrUnderflow (= no images in the queue).
+        */
+        TInt GetNextImage( 
+            CFbsBitmap*& aBitmap, 
+            HBufC8*&     aImageData, 
+            TInt&        aError );
+
+        /**
+        * Returns Boolean indicating if the burst is fully captured or not.
+        * @since 2.1
+        * @return Boolean indicating if the burst is fully captured or not
+        */
+        TBool IsBurstCaptured() const;
+
+        /**
+        * Resets and destroys image items from the image queue.
+        * @since 2.1
+        * @return void
+        */
+        void ResetAndDestroyImages();
+
+    private: // Private member methods
+
+        /**
+        * C++ constructor.
+        */
+        CCaeStillBurst();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Image queue for the images captured in burst.
+        RPointerArray<CCaeImageItem>* iImageQueue;
+
+		// Heap for image data in iImageQueue
+		RHeap* iImageHeap; 
+
+        // Desired burst length (number of images).
+        TInt iDesiredLength;
+
+        // That many (successfull) captures have been made.
+        TInt iCountOfBurstAppends;
+
+        // Additional delay between separate captures.
+        TTimeIntervalMicroSeconds iCaptureInterval;
+    };
+
+
+#endif // CAESTILLBURST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeStillQualityLevels.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image quality level and container
+*
+*/
+
+
+
+#ifndef CAESTILLQUALITYLEVELS_H
+#define CAESTILLQUALITYLEVELS_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <e32base.h>
+#include <e32std.h>
+#include "CaeSdKeys.h"
+#include "CaeQualityLevels.h"
+
+// CONSTANTS
+
+const TInt KCaeMaxStillQltyLevelCount = 6;
+
+const TInt KCaeImgWidthQQVGA    = 160; 
+const TInt KCaeImgHeightQQVGA   = 120; 
+
+const TInt KCaeImgWidthVGA      = 640; 
+const TInt KCaeImgHeightVGA     = 480; 
+
+
+// FORWARD DECLARATIONS
+class CStillQualityLevel;
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine still image quality levels container.
+*
+*/
+NONSHARABLE_CLASS( CCaeStillQualityLevelsCont ) : public CCaeQualityLevelsCont
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeStillQualityLevelsCont();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeStillQualityLevelsCont* NewL();
+
+        /**
+        * Initializes quality levels to hardcoded default values.
+        * @since 2.1
+        * @return The count of quality levels initialized
+        */
+        TInt InitDefaultsL();
+        
+        /**
+        * Gets the quality level count.
+        * @since 2.1
+        * @return Quality level count
+        */
+        TInt Count() const;
+
+        /**
+        * Gets the specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Still quality level
+        */
+        CStillQualityLevel& At( 
+            TInt aIndex ) const;
+
+        /**
+        * Gets the Shared Data key of specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Shared Data key
+        */
+        const TDes& Key( 
+            TInt aIndex ) const;
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CCaeStillQualityLevelsCont();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Resizes quality level array.
+        * @since 2.1
+        * @param aQualityLevelCount Quality level count for the new array
+        * @return void
+        */
+        void ResizeL( 
+            TInt aQualityLevelCount );
+
+        /**
+        * Gets the quality level count Shared Data key.
+        * @since 2.1
+        * @return Quality level count Shared Data key
+        */
+        const TDesC& QltyLevelCountSdKey() const;
+
+    private: // For Shared Data support.
+
+        /**
+        * Creates quality level string for SharedData Camera ini file.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @param aDefaultQualityLevel Output quality level string
+        * @return void
+        */
+        void CreateQualityLevelString( 
+            TInt  aIndex, 
+            TDes& aDefaultQualityLevel );
+
+        /**
+        * Parses quality level string to quality level object data.
+        * @since 2.1
+        * @param aQualityLevelString Quality level string to parse
+        * @param aIndex Quality level index
+        * @return void
+        */
+        void ParseQualityLevelFromStringL( 
+            const TDesC& qualityLevelString, 
+            TInt         aIndex );
+
+    private:
+        
+        // Supported still capture quality levels.
+        CArrayFixFlat<CStillQualityLevel>* iQualityLevels;
+    
+        // Quality level count Shared Data key.
+        const TDesC& iQltyLevelCountSdKey;    
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine still image quality level.
+*
+*/
+NONSHARABLE_CLASS( CStillQualityLevel ) : public CQualityLevel
+    {
+    public:
+        
+        /**
+        * Constructor.
+        */
+        CStillQualityLevel();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CStillQualityLevel();
+
+    public:
+
+        // Still image frame size.
+        TSize iFrameSize;
+
+        // Still image output format.
+        CCamera::TFormat iOutputFormat;
+
+        // Still image compression quality.
+        TInt iCompressionQuality;
+
+        // Estimated size of an image in bytes.
+        TInt iByteSize;
+    };
+
+#endif // CAESTILLQUALITYLEVELS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeStillStatesActive.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,828 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still capture state machine implementation class
+*
+*/
+
+
+
+#ifndef CAESTILLSTATESACTIVE_H
+#define CAESTILLSTATESACTIVE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <s32file.h>
+#include <fbs.h>
+#include <ecam.h>
+#include "CaeEngineExtInterface.h"
+#include "CaeCommon.h"
+#include "CaeEngine.h"
+#include "CaeStillEncoder.h"
+#include "CaeStillDecoder.h"
+#include "CaeDbgUtilities.h"                // For debugging.
+
+
+// CONSTANTS
+
+#ifdef _DEBUG
+const TInt KOneSecond = 1000000; // This many microseconds in a second
+#endif
+
+// Optimal snap bitmap size concerning memory usage and snap image quality
+const TInt KCaeDefaultSnapWidth = 640;
+const TInt KCaeDefaultSnapHeight = 480;
+
+_LIT(KCaePanicText, "CamAppEngine");
+enum TCaePanic
+    {
+    ECaePanicInvalidState = 1   
+    };
+
+const TInt KCaeDefaultCompressionQuality = 90;
+const CCamera::TFormat KBaseStillInputFormat1 = CCamera::EFormatFbsBitmapColor16M;
+const CCamera::TFormat KBaseStillInputFormat2 = CCamera::EFormatFbsBitmapColor64K;
+const TDisplayMode KCaeDefaultDisplayMode = EColor64K; // The default display mode for the snap image
+
+
+// FORWARD DECLARATIONS
+class CCaeEngineImp;
+class CCaeStillBurst;
+class CCaeImageQueueExtPro;
+
+// CLASS DECLARATION
+
+/**
+* Still capure state machine implementation class
+*/
+
+NONSHARABLE_CLASS( CCaeStillStatesActive ) : public CActive,
+                                             public MCaeStillEncoderObserver, 
+                                             public MCaeStillDecoderObserver
+    {
+    public: // Enums
+
+        /**
+        * Events for the state machine
+        */
+        enum TCaeEvent
+            {
+            // External event
+            ECaeEventNone							= 0,
+
+            // Start 
+            ECaeEventStartStillCapture				= 1,
+
+            // Capturing 
+            ECaeEventImageCaptureReady				= 100,
+            ECaeEventBurstImageCaptureReady			= 101,
+            ECaeEventBurstCaptureReady				= 102,
+            ECaeEventAppendCapturedBurstImageReady	= 103,        
+            ECaeEventViewFinderForBurstReady		= 104, 
+           
+            // Processing
+            ECaeEventBurstImageFetchReady			= 200,
+            ECaeEventDecodeToBitmapReady			= 201,
+            ECaeEventExtractExifMetaDataReady		= 202,
+            ECaeEventProcessCapturedImageStepReady	= 203,
+            ECaeEventProcessCapturedImageAllReady	= 204,
+            ECaeEventProcessSnapImageStepReady		= 205,
+            ECaeEventProcessSnapImageAllReady		= 206,
+            ECaeEventDeliverSnapImageReady			= 207,  
+            ECaeEventProcessStillImageStepReady		= 208,
+            ECaeEventProcessStillImageAllReady		= 209,
+            ECaeEventEncodeToJpegReady				= 210,
+            ECaeEventDeliverStillBurstImageReady	= 211,  
+            ECaeEventDeliverStillImageReady			= 212,  
+           
+            // Processing
+            ECaeEventImageQueueExtPro               = 300,
+
+            // End of process    
+            ECaeEventEnd							= 900
+            };
+   
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS two-phased constructor.
+        * @since 2.8
+        * @param aCamera Reference to Camera API.
+        * @param aInfo Reference to the engine info struct
+        * @param aProcessImageImplList Reference to list of the extensions implementing MCaeExtProcessImageInterface.
+        * @return instance of the object
+        */
+        static CCaeStillStatesActive* NewL( 
+            CCamera& aCamera,
+            const TCamAppEngineInfo& aInfo,
+            RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList );
+
+        /**
+        * Destructor.
+        * @since 2.8
+        */
+        virtual ~CCaeStillStatesActive();
+
+    public: // Delegated from CCaeEngine class method calls
+
+        void SetCamAppEngineObserver( 
+            MCamAppEngineObserver& aObserver );
+
+        void SetSnapImageCreation( 
+            TBool aCreateSnapImage = ETrue );
+
+        void SetSnapImageSourceL(
+            CCaeEngine::TSnapImageSource aSnapImageSource );
+
+        void SetSnapImageSizeL(
+            TSize& aSize );
+
+        void SetSnapImageColorMode(
+            TDisplayMode aMode );
+
+     	void SetJpegQuality(
+    	    TInt aQuality );
+
+    	TInt JpegQuality() const;
+
+        void SetImageCodecsL( 
+        	TUid aDecoderUid, TUid aEncoderUid );
+
+        void SetCaeStillBurstObserver( 
+            MCaeStillBurstObserver& aObserver );
+
+        TInt SetStillCaptureImageCountL( 
+            TInt aImageCount );
+
+        TInt StillCaptureImageCount() const;
+
+        void SetStillBurstCaptureIntervalL( 
+            TTimeIntervalMicroSeconds aInterval );
+
+        TTimeIntervalMicroSeconds StillBurstCaptureInterval() const;
+
+        void StopStillBurstCapture();
+
+        void CancelCaptureStill();
+
+    public: // New methods
+
+        /**
+        * Called asynchronously when the captured image is ready. 
+        * @since 2.8
+        * @param aBitmap A pointer to an image held in CFbsBitmap form
+        * @param aData A pointer to an image held in HBufC8 in previously specified format.
+        * @param aError SymbianOS standard error code.
+        * @return void.
+        */
+        void ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aData, 
+            TInt        aError );
+
+        /**
+        * Called asynchronously when the view finder frame is ready. 
+        * @since 2.8
+        * @return void
+        */
+        void ViewFinderFrameReady();
+
+        /**
+        * Get current still image size. 
+        * @since 2.8
+        * @return Still image size in pixels.
+        */
+        TSize StillImageSize() const;
+
+        /**
+        * Get current snap image size. 
+        * @since 2.8
+        * @return Snap image size in pixels.
+        */
+        TSize SnapImageSize() const;
+
+        /**
+        * Set view finder mode enabled or disabled.
+        * @since 2.8
+        * @param aIsEnabled Tell if the view finder is enabled.
+        * @return void.
+        */
+     	void SetViewFinderMode(
+    	    TBool aIsEnabled );
+
+        /**
+        * Check if the state machine has been started. 
+        * @since 2.8
+        * @return State of the state machine.
+        */
+        TBool IsRunning() const;
+
+        /** 
+        * Register flags which affect general extension handling in the engine. 
+        * @since 2.8
+        * @param aFlags Flags to register.
+        * @return void.
+        */
+        void RegisterFlags( TUint32 aFlags );
+
+        /** 
+        * Deregister flags which have been registered before.
+        * @since 2.8
+        * @param aFlags Flags to deregister.
+        * @return void.
+        */
+        void DeregisterFlags( TUint32 aFlags );
+
+        /**
+        * Prepare the state machine for still image capture . 
+        * The returned snap image size is always equal or bigger in both 
+        * dimensions than the given size. The returned size is stepwise 
+        * downscaled  from the captured image size. The parameter aSnapSize 
+        * is ignored if that is not supported for the image format used.
+        * @since 2.8
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCropRect Desired cropping/clipping rectangle. The size (0,0) means that this parameter is ignored.
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat,  
+            const TRect&     aCropRect,
+            TSize&           aSnapSize );
+
+        /**
+        * Send event to the state machine. Usually only ECaeEventStartStillCapture
+        * event is send outside the class. 
+        * @since 2.8
+        * @param aEvent Event to the state machine.
+        * @param aDelay The delay that the event will occur after.
+        * @return void.
+        */
+		void Event( TCaeEvent aEvent, TTimeIntervalMicroSeconds32 aDelay = 0 );
+    
+        /**
+        * Recover and handle error cases. This could mean also ending of 
+        * the state machine, but not always (e.g. in burst mode ). 
+        * @since 2.8
+        * @param aError Error code.
+        * @return void.
+        */
+        void ErrorRecovery( TInt aError );
+        
+        /**
+        * Start capturing without active object delay.
+        * @since 3.2
+        * @return void.
+        */
+        void StartQuickCapture();
+
+        /**
+        * Gets the extension mode status.
+        * @since 3.2
+        * @return ETrue if extension mode is avtive.
+        */
+        TBool ExtModeActive();
+
+        /**
+        * Sets the extension mode on/off.
+        * @since 3.2
+        * @return void.
+        */
+        void SetExtModeActiveL( TBool aExtModeActive );
+
+        /**
+        * Do the extension processing for snap image.
+        * @since 3.2
+        * @return error code.
+        */
+        TInt ProcessExtSnapImage( CFbsBitmap* aSnapImage );
+
+
+        /**
+        * Do the extension processing for captured image.
+        * @since 3.2
+        * @return error code.
+        */
+        TInt ProcessExtCapturedImage( HBufC8* aImageData, TBool aLastImage  );
+
+        /**
+        * Do the extension processing for captured bitmap image.
+        * @since 3.2
+        * @return error code.
+        */
+        TInt ProcessExtCapturedImage( CFbsBitmap* aImageBitmapData, TBool aLastImage  );
+
+        /**
+        * Set the burst mode optimization mode  
+        * @since 3.2
+        * @return void.
+        */
+        void SetBurstModeVFOptimization( TBool aBurstModeVFOptimization );
+
+    private: // Enums
+
+        /**
+        * States of the state machine
+        */
+		enum TCaeState
+			{
+			ECaeStateNone                               = 0,
+
+            // Capturing 
+            ECaeStateCapturing                          = 100,
+            ECaeStateCapturingBurst                     = 101,
+            ECaeStateAppendingBurstImage                = 102,
+            ECaeStateBurstWaitingForViewFinder          = 103,
+
+            // Processing
+            ECaeStateFetchingNextBurstImage				= 200,
+            ECaeStateDecodingCapturedImageToBitmap      = 201,
+            ECaeStateExtractingExifMetaData             = 202,
+            ECaeStateExtensionsProcessingCapturedImage  = 203,
+            ECaeStateDecodingToSnapImage                = 204,
+            ECaeStateExtensionsProcessingSnapImage      = 205,
+            ECaeStateDeliveringSnapImage                = 206,
+            ECaeStateExtensionsProcessingStillImage     = 207,
+            ECaeStateEncodingToJpeg                     = 208,
+            ECaeStateDeliveringStillImage               = 209,
+            ECaeStateDeliveringStillBurstImage          = 210,
+            ECaeStateCompletingStillBurst               = 211
+			};
+        
+    private: // Constructors
+        
+        /**
+        * C++ constructor.
+        * @since 2.8
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        CCaeStillStatesActive( 
+            CCamera& aCamera,
+            const TCamAppEngineInfo& aInfo,
+            RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList );
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        * @since 2.8
+        * @return void
+        */
+        void ConstructL();
+
+    private: // Methods from CActive 
+        
+        void RunL();
+
+        void DoCancel();
+
+        void Cancel();
+
+    private: // From Still Encoder Observer / CaeStillConverter.h
+
+        void McaeseoHBufC8ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aImageData, 
+            TInt        aError,
+            TInt        aImageSize );
+        
+    private: // From Still Decoder Observer / CaeStillConverter.h
+
+       void McaesdoCFbsBitmapImageReady( 
+            HBufC8*     aImageData, 
+            CFbsBitmap* aBitmap, 
+            TInt        aError,
+            TInt        aImageSize );
+        
+    private: // Event handlers for state transitions
+
+        /**
+        * Handle errors from extenal processing, e.g. from the extensions. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleExternalError();
+
+        /**
+        * Handle events from extenal processing, e.g. from the extensions. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleExternalEvent(); 
+
+        /**
+        * Handle start event. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleStart();
+
+        /**
+        * Handle event when an image has been captured. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleImageCaptureReady();
+
+        /**
+        * Handle event when a burst image has been appended to the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleAppendCapturedBurstImageReady();
+
+        /**
+        * Handle event when a burst image has been fetched from the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleBurstImageFetchReady();
+
+        /**
+        * Handle event when a bitmap has been decoded. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleDecodeToBitmapReady();
+
+        /**
+        * Handle event when all the extensions have been processed the captured image. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleProcessCapturedImageAllReady();
+
+        /**
+        * Handle event all extensions have been processed the still image.
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleProcessStillImageAllReady();
+
+        /**
+        * Handle event when a still bitmap has been encoded to Jpeg.
+        * @since 2.8
+        * @return void. 
+        */
+       void HandleEncodeToJpegReady();
+
+        /**
+        * Handle event when the still burst image has been delivered to the client. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleDeliverStillBurstImageReady();
+        
+        /**
+        * Handle event when there are images in extension processing queue
+        * @since 3.2
+        * @return void. 
+        */
+        void HandleImageQueueExtPro();
+
+    private: // Action functions for states
+
+        /**
+        * Start still (single) image capturing. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCaptureStill();
+
+        /**
+        * Start still burst image capturing. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCaptureStillBurst();
+
+        /**
+        * Start still burst capturing for one image. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCaptureStillBurstImage();
+
+        /**
+        * Start appending captured burst image to the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoAppendCapturedBurstImageToArray();
+
+        /**
+        * Start fetching the next burst image from the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoFetchNextBurstImage();
+
+        /**
+        * Start decoding the captured image to the bitmap. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDecodeCapturedImageToBitmap();
+
+        /**
+        * Start processing the captured image in the extensions.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoExtensionsProcessCapturedImage();
+
+        /**
+        * Start processing the snap image in the extensions.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoExtensionsProcessSnapImage();
+
+        /**
+        * Start delivering the snap image to the client.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDeliverSnapImage();
+
+        /**
+        * Start processing the still image in the extensions.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoExtensionsProcessStillImage();
+
+        /**
+        * Start encoding to Jpeg image.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoEncodeStillImageToJpeg();
+
+        /**
+        * Start delivering the still burst image to the client.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDeliverStillBurstImage();
+
+        /**
+        * Start delivering the still image to the client.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDeliverStillImage();
+
+        /**
+        * Start completing the still burst.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCompleteStillBurst();
+
+    private: // Helper methods
+
+        /**
+        * Get the current display mode from the system.
+        * @since 2.8
+        * @param aDisplayMode Returned display mode.
+        * @return TBool Whether the display mode was found.
+        */
+        TBool GetSystemDisplayMode( TDisplayMode& aDisplayMode );
+
+        /**
+        * If needed, calculates the stepwise downscaled size for the snap bitmap.
+        * @since 2.8
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        void CalcDownscaledSnapSize(
+            TSize& aSnapSize ) const;
+
+        /**
+        * Gets the thumbnal from an Exif image.
+        * @since 2.8
+        * @return  
+        */
+        void GetThumbnailL( 
+            HBufC8*& aReadThumbnail, 
+            TSize&   aThumbnailSize );
+            
+        /**
+        * The output image type for the client.
+        * @since 2.8
+        * @return Tell if the output format is bitmap. 
+        */
+        TBool IsBitmapOutput();
+
+        /**
+        * Retrieves/fetches still image size index from Camera API.
+        * @since 2.8
+        * @param aSize Still image frame size
+        * @param aStillDataFormat Still image data format
+        * @return Still image size index
+        */
+        TInt RetrieveStillSizeIndex( 
+            const TSize&     aSize, 
+            CCamera::TFormat aStillDataFormat ) const;
+
+        /**
+        * Cancel the state machine actions and release and cancel internal objects.  
+        * @since 2.8
+        * @return void. 
+        */
+        void CancelAndCleanup();
+
+        /**
+        * Check for still burst completion.
+        * @since 2.8
+        * @return Return whether the still burst should be completed.
+        */
+        TBool CheckForStillBurstCompletion();
+
+        /**
+        * Delete images and continue burst. Ignore error for an individual image.
+        * @since 2.8
+        * @param aError Error code.
+        * @return void.
+        */
+        void BurstErrorRecovery( TInt aError );
+
+        /**
+        * Complete still image burst capture but do not delete still burst object. 
+        * @since 2.8
+        * @return void. 
+        */
+        void CompleteStillBurst();
+
+        /**
+        * Delete still burst object.
+        * @since 2.8
+        * @return void. 
+        */
+        void DeleteStillBurst();
+
+    private:
+
+    //// Objects ////
+
+        // Timer used for delayed calls.
+        RTimer iDelayedCallTimer; 
+
+        // File server handle for file operations.
+        RFs iFs;
+        
+        // Camera API reference.
+        CCamera& iCamera; 
+
+        // Engine info reference.
+        const TCamAppEngineInfo& iInfo;
+
+        // Camera Application Engine observer.
+        MCamAppEngineObserver* iCaeObserver;
+
+        // Still image encoder object.
+        CCaeStillEncoder* iStillEncoder; 
+
+        // Still image decoder object.
+        CCaeStillDecoder* iStillDecoder;
+
+        // Still burst observer.
+        MCaeStillBurstObserver* iCaeStillBurstObserver;
+
+        // Still image burst object, contains all the images captured in a burst.
+        CCaeStillBurst* iStillBurst; 
+
+        // Still image queue object for extension handling (used only when extension mode is active),
+        // contains all the images that are waiting for extension handling and delivery to UI.
+        CCaeImageQueueExtPro* iImageQueueExtPro; 
+
+
+    //// Data ////
+
+		// All extension interface implementations for image processing.
+		RArray<TCaeExtensionInterfaceImplItem>& iProcessImageImplList; 
+
+		// Image data in image format structure.
+		HBufC8* iImageData; 
+
+		// Image data in bitmap.
+		CFbsBitmap* iBitmap;
+		
+		// Snap image.
+		CFbsBitmap* iSnapBitmap; 
+
+		// Exif header.
+		HBufC8* iImageHeaderData; 
+
+        // Empty Snap image.
+        CFbsBitmap* iEmptySnapImage;
+
+        // Snap image source (input for decoding).
+        CCaeEngine::TSnapImageSource iSnapImageSource;
+
+         // Snap image size.
+        TSize iSnapImageSize; 
+
+         // Optimal snap image size.
+        TSize iOptimalSnapImageSize; 
+
+         // Snap image color mode.
+        TDisplayMode iSnapImageColorMode; 
+
+        // Still image capturing frame size.
+        TSize iStillFrameSize;
+
+        // Still image capture input format from Camera API.
+        CCamera::TFormat iStillInputFormat;
+        
+        // Still image capture output format for client.
+        CCamera::TFormat iStillOutputFormat;
+
+        // Still image compression quality value.
+        TInt iStillCompressionQuality;
+
+        // Time delay to be inserted between captures in a burst.
+        TTimeIntervalMicroSeconds32 iStillBurstCaptureInterval;
+
+        // Count of processed (encoded/decoded) burst images.
+        TInt iCountOfProcessedBurstImages;
+
+        // Count of delivered burst images (delivered to the client).
+        TInt iCountOfDeliveredBurstImages;
+
+
+    //// State information ////
+
+		// Current state
+		TCaeState iCurrentState;
+
+        // The first error detected during the burst.
+        TInt iFirstStillBurstError;
+
+		// Current Extension array index 
+		TInt iCurrentExtensionIndex;
+
+        // Delayed event id
+        TCaeEvent iDelayedEvent;
+
+
+    //// Flags ////
+
+        // Boolean indicating if the engine should create the snap image (for client's display purposes).
+        TBool iCreateSnapImage;
+
+        // Boolean indicating if still image capturing is currently cancelled.
+        TBool iStillCancelled;
+
+        // Boolean indicating if delivering burst images has started.
+        TBool iStillBurstDeliveryStarted;
+
+        // Boolean indicating if still burst is stopped.
+        TBool iStillBurstStopped;
+
+        // Boolean indicating if a view finder frame has been received.
+        TBool iViewFinderFrameReceived;
+
+        // Boolean indicating if the view finder has been enabled.
+        TBool iIsViewFinderEnabled;
+
+        // Boolean indicating if the extension mode is selected
+        TBool iExtModeActive;
+      
+        // Boolean indicating if this is the last burst image for extension processing
+        TBool iLastImageExtPro;
+      
+        // Boolean indicating if still image capture is prepared.
+        TBool iStillPrepared;
+
+    //// Flags using reference count ////
+
+        // Boolean indicating if full color snap image is required for extensions.
+        TInt32 iRequireFullColorSnapInputImageRefCount;
+
+        // Boolean indicating if the VF burst optimization is used
+        TBool iBurstModeVFOptimization;
+
+#ifdef _DEBUG
+        // Performance debugging variables
+        TTime iCaptureStartTime;
+        TTime iImageReadyTime;
+        TTime iFinalImageReadyTime;
+#endif
+    };
+
+#endif // CAESTILLSTATESACTIVE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeVideoQualityLevels.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video quality level and container
+*
+*/
+
+
+
+#ifndef CAEVIDEOQUALITYLEVELS_H
+#define CAEVIDEOQUALITYLEVELS_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <e32base.h>
+#include <e32std.h>
+#include "CaeSdKeys.h"
+#include "CaeQualityLevels.h"
+
+// CONSTANTS
+
+const TInt KCaeMaxVideoStringParLength = 32;
+const TInt KCaeMaxAudioTypeStringParLength = 4;
+
+const TInt KCaeMaxVideoQltyLevelCount = 6;
+
+const TInt KImgWidthSubQCIF  = 128; 
+const TInt KImgHeightSubQCIF = 96; 
+
+const TInt KImgWidthQCIF     = 176; 
+const TInt KImgHeightQCIF    = 144; 
+
+const TInt KImgWidthCIF      = 352; 
+const TInt KImgHeightCIF     = 288; 
+
+_LIT8(KVideoMimeType, "video/3gpp");
+
+_LIT(KPreferredSupplier, "Nokia");
+
+_LIT8(KVideoType, "video/H263-2000");
+
+_LIT8(KAudioType, " AMR");
+
+
+// FORWARD DECLARATIONS
+class CVideoQualityLevel;
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine video recording quality levels container.
+*
+*/
+NONSHARABLE_CLASS( CCaeVideoQualityLevelsCont ) : public CCaeQualityLevelsCont
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeVideoQualityLevelsCont();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeVideoQualityLevelsCont* NewL();
+
+        /**
+        * Initializes quality levels to hardcoded default values.
+        * @since 2.1
+        * @return The count of quality levels initialized
+        */
+        TInt InitDefaultsL();
+        
+        /**
+        * Gets the quality level count.
+        * @since 2.1
+        * @return Quality level count
+        */
+        TInt Count() const;
+
+        /**
+        * Gets the specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Video quality level
+        */
+        CVideoQualityLevel& At( 
+            TInt aIndex ) const;
+
+        /**
+        * Gets the Shared Data key of specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Shared Data key
+        */
+        const TDes& Key( 
+            TInt aIndex ) const;
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CCaeVideoQualityLevelsCont();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Resizes quality level array.
+        * @since 2.1
+        * @param aQualityLevelCount Quality level count for the new array
+        * @return void
+        */
+        void ResizeL( 
+            TInt aQualityLevelCount );
+
+        /**
+        * Gets the quality level count Shared Data key.
+        * @since 2.1
+        * @return Quality level count Shared Data key
+        */
+        const TDesC& QltyLevelCountSdKey() const;
+
+    private: // For Shared Data support.
+
+        /**
+        * Creates quality level string for SharedData Camera ini file.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @param aDefaultQualityLevel Output quality level string
+        * @return void
+        */
+        void CreateQualityLevelString( 
+            TInt  aIndex, 
+            TDes& aDefaultQualityLevel );
+
+        /**
+        * Parses quality level string to quality level object data.
+        * @since 2.1
+        * @param aQualityLevelString Quality level string to parse
+        * @param aIndex Quality level index
+        * @return void
+        */
+        void ParseQualityLevelFromStringL( 
+            const TDesC& aQualityLevelString, 
+            TInt         aIndex );
+
+    private:
+    
+        // Supported video recording quality levels.
+        CArrayFixFlat<CVideoQualityLevel>* iQualityLevels;
+
+        // Quality level count Shared Data key.
+        const TDesC& iQltyLevelCountSdKey;    
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine video recording quality level.
+*
+*/
+NONSHARABLE_CLASS( CVideoQualityLevel ) : public CQualityLevel
+    {
+    public:
+        
+        /**
+        * Constructor.
+        */
+        CVideoQualityLevel();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVideoQualityLevel();
+
+    public:
+
+        // The video recording frame size.
+        TSize iFrameSize;
+
+        // The video recording frame rate.
+        TReal32 iFrameRate;
+
+        // The video recording bit rate.
+        TInt iBitRate;
+
+        // A Boolean indicating if video recording audio is enabled or not.
+        TBool iAudioEnabled;
+
+        // The video recording audio bit rate.
+        TInt iAudioBitRate;
+
+        // The video MIME type (e.g. "video/3gpp").
+        TBuf8<KCaeMaxVideoStringParLength> iMimeType;
+
+        // The preferred supplier of video controller (e.g. "Company X").
+        TBuf<KCaeMaxVideoStringParLength> iPreferredSupplier;
+
+        // The video type (e.g. "video/H263-2000").
+        TBuf8<KCaeMaxVideoStringParLength> iVideoType;
+
+        // The audio type expressed with four characters (e.g. " AMR").
+        TBuf8<KCaeMaxAudioTypeStringParLength> iAudioType;
+
+        // The estimated video recording bit rate to storage (bits per second).
+        TInt iStorageRate;
+    };
+
+
+#endif // CAEVIDEOQUALITYLEVELS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeVideoTimes.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video times provider class
+*
+*/
+
+
+
+#ifndef CAEVIDEOTIMES_H
+#define CAEVIDEOTIMES_H
+
+// INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+* Video recording times generator class.
+* Generates elapsed and remaining recording time info periodically.
+*/
+NONSHARABLE_CLASS( CCaeVideoTimes ) : public CPeriodic
+    {
+
+    public:  // Constructors and destructor    
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeVideoTimes* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeVideoTimes();
+
+    private: // From CPeriodic base class CActive.
+
+        /**
+        * From CActive, called if CCaeVideoTimes function RunL() leaves.
+        * @param aError Standard Symbian OS error code
+        * @return Error code KErrNone
+        */
+        TInt RunError( 
+            TInt aError );
+
+    private: // Private methods.
+        
+        /**
+        * C++ constructor.
+        */
+        CCaeVideoTimes();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    };
+
+#endif // CAEVIDEOTIMES_H   
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeCallbackActive.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2003,2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active object for calling Camera Application Engine methods 
+*                indirectly from callbacks
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeCallbackActive.h"
+#include "CaeEngineImp.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::CCaeCallbackActive()
+// C++ constructor.
+// Adds the object to the Active Scheduler.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive::CCaeCallbackActive( 
+    CCaeEngineImp& aCamAppEngine )
+: CActive( EPriorityStandard ), iCamAppEngine( aCamAppEngine )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::CCaeCallbackActive()
+// Destructor. 
+// Cancels operation and closes the timer.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive::~CCaeCallbackActive()
+    {
+    Cancel();
+    iTimer.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::NewLC()
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive* CCaeCallbackActive::NewLC( 
+    CCaeEngineImp& aCamAppEngine )
+    {
+    CCaeCallbackActive* self = new( ELeave ) CCaeCallbackActive( aCamAppEngine );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::NewL()
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive* CCaeCallbackActive::NewL( 
+    CCaeEngineImp& aCamAppEngine )
+    {
+    CCaeCallbackActive* self = NewLC( aCamAppEngine );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::ConstructL()
+// Symbian OS 2nd phase constructor that can leave.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::ConstructL()
+    {
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::PowerOn()
+// Switches camera power on.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::PowerOn()
+    {
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::PowerOn() entering" ) );
+
+    _LIT( KPowerOnPanic, "CCaeCallbackActive::PowerOn");
+    __ASSERT_ALWAYS( !IsActive(), User::Panic( KPowerOnPanic, 1 ) );
+
+    iRequest = CCaeCallbackActive::ERequestPowerOn;
+
+    SetActive();
+    TRequestStatus* statusPtr = &iStatus;
+    User::RequestComplete( statusPtr, KErrNone );
+
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::PowerOn() returning" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::RunL()
+// Calls Camera Application Engine operation.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::RunL()
+    {
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::RunL() entering" ) );
+
+    switch ( iRequest ) 
+        {
+        case CCaeCallbackActive::ERequestPowerOn:
+            // Call Camera Application Engine to switch camera power on.
+            iCamAppEngine.PowerOn();
+            break;
+        default:
+            break;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::RunL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::DoCancel()
+// Cancels request.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::DoCancel()
+    {
+    iTimer.Cancel();
+    iRequest = CCaeCallbackActive::ERequestDefault;
+    }
+
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeDbgUtilities.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utilities for Camera Application Engine.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include "CaeDbgUtilities.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+#ifdef _DEBUG
+
+// ---------------------------------------------------------------------------
+// PrintMemoryInfo()
+// Print memory info. 
+// Output format: free heap (biggest block), free RAM
+// ---------------------------------------------------------------------------
+//
+void PrintMemoryInfo()
+    {
+    // Print memory info
+    TInt biggestBlock = 0;
+    TInt available = User::Available( biggestBlock );
+
+    TMemoryInfoV1Buf membuf;
+    UserHal::MemoryInfo( membuf );
+    TMemoryInfoV1 minfo = membuf();
+
+    TBuf<256> text;
+    text.Format( _L( "free heap:%d(%d) Kb, free ram: %d Kb" ), 
+        available / 1024, biggestBlock / 1024, minfo.iFreeRamInBytes / 1024 );
+
+    LOGTEXT(text);
+    }
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpInfo.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation information getting method
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitializeInfo
+// Initialize Camera Application Engine information class.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitializeInfo( 
+    const CCamera& aCamera )
+    {
+
+    // Initialise Camera (API) info.
+
+    TCameraInfo cameraInfo;
+    aCamera.CameraInfo( cameraInfo );
+
+    iInfo->iCaeOptionsSupported = 0;
+
+    iInfo->iHardwareVersion = cameraInfo.iHardwareVersion;
+    iInfo->iSoftwareVersion = cameraInfo.iSoftwareVersion;
+
+    iInfo->iOrientation = cameraInfo.iOrientation;
+
+    iInfo->iOptionsSupported = cameraInfo.iOptionsSupported;
+    
+    iInfo->iFlashModesSupported = cameraInfo.iFlashModesSupported;
+
+    iInfo->iExposureModesSupported = cameraInfo.iExposureModesSupported;
+
+    iInfo->iWhiteBalanceModesSupported = cameraInfo.iWhiteBalanceModesSupported;
+
+    iInfo->iMinZoom = cameraInfo.iMinZoom;
+    iInfo->iMaxZoom = cameraInfo.iMaxZoom;
+    iInfo->iMaxDigitalZoom = cameraInfo.iMaxDigitalZoom;
+
+    iInfo->iMinZoomFactor = cameraInfo.iMinZoomFactor;
+    iInfo->iMaxZoomFactor = cameraInfo.iMaxZoomFactor;
+    iInfo->iMaxDigitalZoomFactor = cameraInfo.iMaxDigitalZoomFactor;
+
+    iInfo->iNumImageSizesSupported = cameraInfo.iNumImageSizesSupported;
+    iInfo->iImageFormatsSupported = cameraInfo.iImageFormatsSupported;
+
+    // Initialize EV compensation info (no supported in this version)
+    iInfo->iMinEvCompensation = 0;
+    iInfo->iMaxEvCompensation = 0;
+    iInfo->iMinEvCompensationValue = 0;
+    iInfo->iMaxEvCompensationValue = 0;
+
+    // Initialize engine info.
+
+    iInfo->iNumStillQualityLevelsSupported = 0; // Quality levels are initialized separately.
+    iInfo->iNumVideoQualityLevelsSupported = 0; // Quality levels are initialized separately.
+
+    iInfo->iCaeOptionsSupported |= StillBurstSupport();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpStillAndVf.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,3029 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation still capturing, 
+*                settings, and view finder methods
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <fbs.h>                            // For CFbsBitmap
+
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeStillQualityLevels.h"          // For still capturing quality levels.
+#include "CaeVideoQualityLevels.h"          // Needed just in destructor.
+#include "CaeVideoTimes.h"                  // Needed just in destructor.
+#include "CaeStillStatesActive.h"                
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
+#endif
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CaeEngineImpStillAndVfTraces.h"
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::NewL
+// Two-phased constructor. Calls CCaeEngineImp's NewL().
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCaeEngine* CCaeEngine::NewL()
+    {
+    return CCaeEngineImp::NewL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CCaeEngineImp
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp::CCaeEngineImp(): 
+    iZoomMode( EZoomModeDigital ), 
+    iExposureMode( CCamera::EExposureAuto ),
+    iWhiteBalanceMode( CCamera::EWBAuto ), 
+    iFlashMode( CCamera::EFlashNone ),
+    iVideoTimesInterval( KVideoTimesIntervalDefault ), 
+    iMaxClipSizeInBytes( KMMFNoMaxClipSize ), 
+    iMaxClipSizeInBytesPrep( KMMFNoMaxClipSize )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::~CCaeEngineImp
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp::~CCaeEngineImp()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::~CCaeEngineImp() entering" ) );
+
+    // Cancels/closes/stops still capturing, video recording, and view finding.
+    CancelAllActivities();
+
+    // Delete extension implementations
+	iExtension.ResetAndDestroy();
+
+    // Delete the state machine
+    // Note: This must be done after destroying extensions because there is some
+    // validity checking in the iStillStatesActive destructor.
+    delete( iStillStatesActive );
+
+    // Delete interface implementation lists. 
+	// Close for each iImplementations before closing 
+	// iExtInterfaceImplementationLists.
+	for ( TInt i = 0; i < iExtInterfaceImplementationLists.Count(); i++ )
+		{
+		iExtInterfaceImplementationLists[i].iImplementations->Close();
+		delete( iExtInterfaceImplementationLists[i].iImplementations );
+		}
+	iExtInterfaceImplementationLists.Close();
+
+    // Delete custom interface list items
+	iExtCustomInterfaceImplementations.Close();
+
+    delete iVideoType;
+    delete iVideoClipFileName;
+
+    // Turn camera power off first, then release camera.
+    if ( iCamera ) 
+        {
+        if ( iReserved ) 
+            {
+            if ( iPowerOn ) 
+                {
+                iCamera->PowerOff();
+                }
+            iCamera->Release();
+            }
+        }
+
+    delete iVideoFrameSizePrep;
+    delete iVideoFrameSize;
+
+    delete iVideoTimes;
+    delete iVideoTimesCallback;
+    delete iVideoRecorder;
+
+    delete iVideoQualityLevelsCont;
+    delete iStillQualityLevelsCont;
+    
+    delete iCallbackActive;
+
+    delete iInfo;
+
+    delete iCamera;
+
+	REComSession::FinalClose();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::~CCaeEngineImp() returning" ) );
+
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ConstructL( TInt aCameraIndex, TInt aDisplayIndex )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::ConstructL() entering with camera index %d" ), 
+    	aCameraIndex );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CONSTRUCTL, "e_CAM_ENG_INIT 1" );   //CAE_ENGINE_INIT_START
+        
+    if ( ( aCameraIndex < 0 ) || 
+         ( aCameraIndex >= CCamera::CamerasAvailable() ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ConstructL leaving KErrHardwareNotAvailable, aCameraIndex=%d" ), aCameraIndex );
+        User::Leave( KErrHardwareNotAvailable );
+        }
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), aCameraIndex, KCameraPriority ) );
+    if ( err )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ConstructL() CCamera::New2L return code=%d" ), err ); 
+
+        // Create old Camera API implementation object.
+        iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), aCameraIndex );
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ConstructL() using MCameraObserver" )); 
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ConstructL() using MCameraObserver2" )); 
+        }
+
+
+    // Get camera handle.
+    iCameraHandle = iCamera->Handle();
+
+    // Set display index
+    iDisplayIndex = aDisplayIndex;
+
+    // Create and initialize info object.
+    iInfo = new( ELeave ) TCamAppEngineInfo;
+    InitializeInfo( *iCamera );
+
+    // Create active object for calling methods from callbacks.
+    iCallbackActive = CCaeCallbackActive::NewL( *this );
+
+    // Create still quality levels container object.
+    iStillQualityLevelsCont = CCaeStillQualityLevelsCont::NewL();
+
+    // Set default value for video recording stopping 
+    iAsyncVideoStopEnabled = EFalse;
+    
+	// Create interface lists. 
+	// The order of interface lists in iExtInterfaceImplementationLists
+	// should not be changed later as the order must always match to 
+	// TCaeExtensionInterfaceIndexes enum.
+	for ( TInt i = 0; KCaeSupportedExtensionInterfaceUids[i].iUid != NULL; i++ )
+		{
+		TCaeExtensionInterfaceImplListItem listItem;
+
+		RArray<TCaeExtensionInterfaceImplItem>* emptyImplementationArray = 
+			new(ELeave) RArray<TCaeExtensionInterfaceImplItem>(
+			TCaeExtensionInterfaceImplItemGranularity );
+
+		listItem.iInterfaceUid = KCaeSupportedExtensionInterfaceUids[i];
+		listItem.iImplementations = emptyImplementationArray; 
+		
+		// Copy the list item to the end of the list.Give ownership of 
+        // emptyImplementationArray.
+        CleanupStack::PushL( emptyImplementationArray );
+		iExtInterfaceImplementationLists.AppendL( listItem ); 
+        CleanupStack::Pop( emptyImplementationArray );
+		}
+
+    // Create the state machine for still capturing
+    iStillStatesActive = CCaeStillStatesActive::NewL( *iCamera, *iInfo,
+        *( iExtInterfaceImplementationLists[KCaeExtProcessImageInterfaceIndex].iImplementations  ) );
+
+	// Create extensions and populate the extension array 
+	PopulateExtensionArrayL();
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CONSTRUCTL, "e_CAM_ENG_INIT 0" );  //CAE_ENGINE_INIT_END
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ConstructL() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp* CCaeEngineImp::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::NewL() entering" ) );
+
+    CCaeEngineImp* self = new( ELeave ) CCaeEngineImp();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( 0, 0 ); // Construct with default camera index 0 and display index 0
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PopulateExtensionArrayL
+// Get a list of extension implementations via ECom, construct the extensions and 
+// add those the the array.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PopulateExtensionArrayL()
+	{
+	LOGTEXT( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL() entering" ) );
+
+	// Get a list of all extensions from ECom
+	TEComResolverParams resolverParams;
+	resolverParams.SetDataType ( KExtensionTypeStringDesc );
+	resolverParams.SetWildcardMatch ( EFalse );
+	RImplInfoPtrArray implInfoArray;
+	REComSession::ListImplementationsL( KExtensionInterfaceUid, resolverParams, 
+		implInfoArray );
+	// This should be called only after ListImplementationsL
+	CleanupResetAndDestroyPushL( implInfoArray ); 
+    
+	LOGTEXT2( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL: extension count: %d" ),
+		implInfoArray.Count());
+	
+	// Create each extension via ECom and add it to the list 
+	for ( TInt i = 0; i < implInfoArray.Count(); i++ )
+		{		
+		MExtension* extension = NULL;
+		
+		// Trap the construction as if one extension fails to construct it 
+		// should not stop others from constructing
+    	LOGTEXT2( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL: load extension uid=%x" ),
+	    	implInfoArray[i]->ImplementationUid().iUid);
+		
+		TRAPD( error, extension = MExtension::NewExtensionL( 
+			implInfoArray[i]->ImplementationUid(), 
+			(MExtensionCallbackInterface*) this ));
+
+		if ( error || !extension)
+			{
+			// If one extension is failing we skip that.
+			#ifdef _DEBUG
+			TBuf<256> text;
+			text.Format(_L( "Cae: CCaeEngineImp::PopulateExtensionArrayL: NewExtensionL leaved, uid=%x, error=%d, extension=%x" ),
+				implInfoArray[i]->ImplementationUid().iUid, error, extension );
+			LOGTEXT( text );
+			#endif
+
+			delete( extension );
+			}
+		else
+			{
+			iExtension.AppendL( extension );
+			}
+		}
+
+	CleanupStack::PopAndDestroy( &implInfoArray );
+
+	LOGTEXT( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL() returning" ) );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetCamAppEngineObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetCamAppEngineObserver( MCamAppEngineObserver& aObserver )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetCamAppEngineObserver()" ) );
+
+    iCaeObserver = &aObserver;
+    iStillStatesActive->SetCamAppEngineObserver( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetInfo
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetInfo( TCamAppEngineInfo& aInfo ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetInfo()" ) );
+ 
+    aInfo = *iInfo;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitL
+// Initialise the engine for still image capturing using default parameters.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitL( TBool aCreateSnapImage )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitL() entering" ) );
+
+    iStillStatesActive->SetSnapImageCreation( aCreateSnapImage );
+
+    // To allow re-initialization, release the camera (first cancels possible 
+    // activities and turns camera power off).
+    Release();
+
+    // Init to default quality levels.
+    iInfo->iNumStillQualityLevelsSupported = 
+        iStillQualityLevelsCont->InitDefaultsL();
+
+    // Reserve camera (and after succesfull reserve, camera power will be 
+    // turned on).
+
+    iResetToPreviousSettings = ETrue; // This requests here to set the camera
+                                      // to default settings after power is on.
+    iCamera->Reserve();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitL
+// Initialise the engine for still image capturing either using default 
+// parameters or parameters from ini-file.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitL( 
+    TUid aSdUidStillQltyLevels, 
+    TBool aCreateSnapImage )
+    {
+    if( aSdUidStillQltyLevels == KNullUid )
+        {
+        InitL( aCreateSnapImage );
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::InitL(aSdUidStillQltyLevels): NOT SUPPORTED, leaving" ) );
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Reserve
+// Calls Camera API Reserve().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::Reserve()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Reserve() entering" ) );
+
+    if ( !iReserved ) 
+        {
+        iResetToPreviousSettings = ETrue;
+        iCamera->Reserve();
+        }
+    else if ( !iPowerOn ) // in case previous reserve ok, but poweron failed
+        {
+        PowerOn();
+        }
+
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Reserve() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Release
+// Calls Camera API Release().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::Release()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Release() entering" ) );
+
+    if ( iReserved ) 
+        {
+        PowerOff();         // Cancel all activities (if any) and turn power off.
+        iCamera->Release(); // Release Camera HW.
+        iReserved = EFalse;
+        iStillPrepared = EFalse;
+        iVideoPrepared = EFalse;
+        iVideoOpened = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Release() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOn
+// Calls Camera API PowerOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PowerOn()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOn() entering" ) );
+
+    if ( iReserved && !iPowerOn ) 
+        {
+        iCamera->PowerOn();
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOn() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOff
+// Calls Camera API PowerOff().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PowerOff()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOff() entering" ) );
+
+    if ( iPowerOn ) 
+        {
+        CancelAllActivities();
+        iCamera->PowerOff();
+        iPowerOn = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOff() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetZoomModeL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetZoomModeL( 
+    TZoomMode aZoomMode )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomModeL() entering" ) );
+
+    // Currently supporting digital and optical zooms, not EZoomModeOpticalDigital.
+    if ( ( aZoomMode != EZoomModeDigital ) && ( aZoomMode != EZoomModeOptical ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomModeL leaving KErrNotSupported, aZoomMode=%d" ), aZoomMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    iZoomMode = aZoomMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ZoomMode
+// -----------------------------------------------------------------------------
+//
+CCaeEngine::TZoomMode CCaeEngineImp::ZoomMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ZoomMode()" ) );
+
+    return iZoomMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetZoomValueL
+// Calls Camera API SetDigitalZoomFactorL() or SetZoomFactorL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetZoomValueL( 
+    TInt aZoomValue )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomValueL() entering" ) );
+
+    CheckPowerL();
+
+    switch ( iZoomMode )
+        {
+        case EZoomModeDigital:
+            // Leave if zoom factor is out of range.
+            if ( ( aZoomValue < 0 ) || 
+                 ( aZoomValue > iInfo->iMaxDigitalZoom ) )
+                {
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomValueL leaving KErrArgument, aZoomValue=%d" ), aZoomValue );
+                User::Leave( KErrArgument );
+                }
+            // Set DIGITAL zoom value.
+            iCamera->SetDigitalZoomFactorL( aZoomValue );
+            iZoomValue = aZoomValue;
+            break;
+        case EZoomModeOptical:
+            // Leave if zoom factor is out of range.
+            if ( ( aZoomValue < iInfo->iMinZoom ) || 
+                 ( aZoomValue > iInfo->iMaxZoom ) )
+                {
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomValueL leaving KErrArgument, aZoomValue=%d" ), aZoomValue );
+                User::Leave( KErrArgument );
+                }
+            // Set OPTICAL zoom value.
+            iCamera->SetZoomFactorL( aZoomValue );
+            iZoomValue = aZoomValue;
+            break;
+        default:
+            // EZoomModeOpticalDigital not supported
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomValueL leaving KErrNotSupported, iZoomMode=%d" ), iZoomMode );
+            User::Leave( KErrNotSupported );
+            break;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomValueL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ZoomValue
+// Calls Camera API DigitalZoomFactor() or ZoomFactor().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::ZoomValue() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ZoomValue()" ) );
+
+    TInt zoomValue( 0 );
+    if ( iPowerOn )
+        {
+        switch ( iZoomMode )
+            {
+            case EZoomModeDigital:
+                zoomValue = iCamera->DigitalZoomFactor();
+                break;
+            case EZoomModeOptical:
+                zoomValue = iCamera->ZoomFactor();
+                break;
+            default:
+                // EZoomModeOpticalDigital not supported
+                break;
+            }
+        }
+    return zoomValue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetBrightnessL
+// Calls Camera API SetBrightnessL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetBrightnessL( 
+    TInt aBrightness )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetBrightnessL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetBrightnessL leaving KErrNotSupported, aBrightness=%d" ), aBrightness );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetBrightnessL( aBrightness );
+    iBrightness = aBrightness;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetBrightnessL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Brightness
+// Calls Camera API Brightness().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::Brightness() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Brightness()" ) );
+
+    TInt brightness( 0 );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+        {
+        brightness = iCamera->Brightness();
+        }
+    return brightness;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetContrastL
+// Calls Camera API SetContrastL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetContrastL( 
+    TInt aContrast )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetContrastL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetContrastL leaving KErrNotSupported, aContrast=%d" ), aContrast );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetContrastL( aContrast );
+    iContrast = aContrast;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetContrastL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Contrast
+// Calls Camera API Contrast().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::Contrast() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Contrast()" ) );
+
+    TInt contrast( 0 );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+        {
+        contrast = iCamera->Contrast();
+        }
+    return contrast;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetExposureModeL
+// Calls Camera API SetExposureModeL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetExposureModeL( 
+    CCamera::TExposure aExposureMode )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetExposureModeL() entering" ) );
+
+    // Leave is requested exposure mode is not supported, 
+    // EExposureAuto should be always supported.
+    if ( ( ( aExposureMode != CCamera::EExposureAuto ) && 
+          !( aExposureMode & iInfo->iExposureModesSupported ) ) ||
+           ( aExposureMode < 0 ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetExposureModeL leaving KErrNotSupported, aExposureMode=%d" ), aExposureMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetExposureL( aExposureMode );
+    iExposureMode = aExposureMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetExposureModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ExposureMode
+// Calls Camera API Exposure().
+// -----------------------------------------------------------------------------
+//
+CCamera::TExposure CCaeEngineImp::ExposureMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ExposureMode()" ) );
+
+    CCamera::TExposure exposureMode( CCamera::EExposureAuto );
+    if ( iPowerOn )
+        {
+        exposureMode = iCamera->Exposure();
+        }
+    return exposureMode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetEvCompensationL
+// If the interface exists, calls Camera API SetEvCompensationL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetEvCompensationL( 
+    TInt /*aEvIndex*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetEvCompensationL() (not supported) leaving" ) );
+
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EvCompensation
+// If the interface exists, calls Camera API EvCompensation().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::EvCompensation() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EvCompensation() (not supported!)" ) );
+
+    return( 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetWhiteBalanceModeL
+// Calls Camera API SetWhiteBalanceL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetWhiteBalanceModeL( 
+    CCamera::TWhiteBalance aWhiteBalanceMode )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetWhiteBalanceModeL() entering" ) );
+
+    // Leave is requested WB mode is not supported. 
+    // EWBAuto is always supported.
+    if ( ( ( aWhiteBalanceMode != CCamera::EWBAuto ) && 
+          !( aWhiteBalanceMode & iInfo->iWhiteBalanceModesSupported ) ) ||
+           ( aWhiteBalanceMode < 0 ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetWhiteBalanceModeL leaving KErrNotSupported, aWhiteBalanceMode=%d" ), aWhiteBalanceMode );
+        User::Leave( KErrNotSupported );
+        }
+    
+    CheckPowerL();
+
+    iCamera->SetWhiteBalanceL( aWhiteBalanceMode );
+    iWhiteBalanceMode = aWhiteBalanceMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetWhiteBalanceModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::WhiteBalanceMode
+// Calls Camera API WhiteBalance().
+// -----------------------------------------------------------------------------
+//
+CCamera::TWhiteBalance CCaeEngineImp::WhiteBalanceMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::WhiteBalanceMode()" ) );
+
+    CCamera::TWhiteBalance whiteBalanceMode( CCamera::EWBAuto );
+    if ( iPowerOn )
+        {
+        whiteBalanceMode = iCamera->WhiteBalance();
+        }
+    return whiteBalanceMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetFlashModeL
+// Calls Camera API SetFlashL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetFlashModeL( 
+    CCamera::TFlash aFlashMode )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetFlashModeL() entering, mode=%d" ), aFlashMode );
+
+    // Leave is requested flash mode is not supported. 
+    // EFlashNone is always supported.
+    if ( ( ( aFlashMode != CCamera::EFlashNone ) && 
+          !( aFlashMode & iInfo->iFlashModesSupported ) ) || 
+           ( aFlashMode < 0 ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetFlashModeL leaving KErrNotSupported, aFlashMode=%d" ), aFlashMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetFlashL( aFlashMode );
+    iFlashMode = aFlashMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetFlashModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::FlashMode
+// Calls Camera API Flash().
+// -----------------------------------------------------------------------------
+//
+CCamera::TFlash CCaeEngineImp::FlashMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::FlashMode()" ) );
+
+    CCamera::TFlash flashMode( CCamera::EFlashNone );
+    if ( iPowerOn )
+        {
+        flashMode = iCamera->Flash();
+        }
+    return flashMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ResetToDefaultsL
+// Resets the following settings: exposure mode, white balance mode, 
+// zoom mode, zoom value, flash mode, brightness, and contrast.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ResetToDefaultsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToDefaultsL() entering" ) );
+
+    SetExposureModeL();
+    SetWhiteBalanceModeL();
+    SetZoomModeL();
+    SetZoomValueL();
+    SetFlashModeL();
+
+    // Reset this setting only if it is supported by Camera API.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported )
+        {
+        SetBrightnessL();
+        }
+
+    // Reset this setting only if it is supported by Camera API.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported )
+        {
+        SetContrastL();
+        }
+
+ 	// Process extensions
+	RArray<TCaeExtensionInterfaceImplItem>* settingsImplementationList = 
+		iExtInterfaceImplementationLists[KCaeExtSettingsInterfaceIndex].iImplementations;
+
+	for ( TInt i = 0; i < settingsImplementationList->Count(); i++ )
+		{
+		TRAPD(err, STATIC_CAST( MCaeExtSettingsInterface*, 
+		(*settingsImplementationList)[i].iImplPtr )->ResetToDefaultsL() );
+
+	    #ifdef _DEBUG
+		if ( err )
+		    {
+			LOGTEXT3(_L("Cae: CCaeEngineImp::ResetToDefaultsL(). Error %d in ResetToDefaultsL() for Extension %x"),
+			    err, (*settingsImplementationList)[i].iImplUid.iUid );
+			}
+		#endif
+		
+		User::LeaveIfError( err ); 
+		}
+
+   LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToDefaultsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetViewFinderMirrorL
+// Calls Camera API SetViewFinderMirrorL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetViewFinderMirrorL( 
+    TBool aMirror )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetViewFinderMirrorL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderMirrorSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetViewFinderMirrorL leaving KErrNotSupported, aMirror=%d" ), aMirror );
+        User::Leave( KErrNotSupported );
+        }
+        
+    CheckPowerL();
+
+    iCamera->SetViewFinderMirrorL( aMirror );    
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetViewFinderMirrorL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ViewFinderMirror
+// Calls Camera API ViewFinderMirror().
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::ViewFinderMirror() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ViewFinderMirror()" ) );
+
+    // If supported, query the setting from Camera API.
+    TBool viewFinderMirror( EFalse );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EViewFinderMirrorSupported ) )
+        {
+        viewFinderMirror = iCamera->ViewFinderMirror();
+        }
+    return viewFinderMirror;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderBitmapsL
+// Calls Camera API StartViewFinderBitmapsL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderBitmapsL( 
+    TSize& aVfFrameSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() entering aVfFrameSize wxh=%dx%d" ),
+            aVfFrameSize.iWidth, aVfFrameSize.iHeight );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL leaving KErrNotSupported" ));
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn ) 
+        {
+        if ( !iCamera->ViewFinderActive() ) 
+            {
+            iTrueViewFinderSize = aVfFrameSize;
+            iCamera->StartViewFinderBitmapsL( iTrueViewFinderSize );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL leaving KErrNotReady (iViewFinderRunning)" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderBitmapsL
+// Cropped version.
+// Calls Camera API StartViewFinderBitmapsL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderBitmapsL( 
+    TSize& aVfFrameSize, 
+    TRect& aCropRect )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() entering aVfFrameSize wxh=%dx%d" ),
+            aVfFrameSize.iWidth, aVfFrameSize.iHeight );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported ) || 
+         !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderClippingSupported )  )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL (cropped) leaving KErrNotSupported" ));
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn ) 
+        {
+        if ( !iCamera->ViewFinderActive() ) 
+            {
+            iTrueViewFinderSize = aVfFrameSize;
+            iCamera->StartViewFinderBitmapsL( iTrueViewFinderSize, aCropRect );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL (cropped) leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderDirectL
+// Calls Camera API StartViewFinderDirectL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderDirectL( 
+    RWsSession& aWs, 
+    CWsScreenDevice& aScreenDevice, 
+    RWindowBase& aWindow, 
+    TRect& aScreenRect )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderDirectSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL leaving KErrNotSupported, iOptionsSupported=0x%x" ), iInfo->iOptionsSupported );
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn )
+        {
+        if ( !iCamera->ViewFinderActive() )
+            {
+            iCamera->StartViewFinderDirectL( aWs, aScreenDevice, aWindow, aScreenRect );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+    
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderDirectL
+// Cropped version.
+// Calls Camera API StartViewFinderDirectL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderDirectL( 
+    RWsSession& aWs,
+    CWsScreenDevice& aScreenDevice,
+    RWindowBase& aWindow,
+    TRect& aScreenRect,
+    TRect& aCropRect )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderDirectSupported ) || 
+         !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderClippingSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL (cropped) leaving KErrNotSupported, iOptionsSupported=0x%x" ), iInfo->iOptionsSupported );
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn )
+        {
+        if ( !iCamera->ViewFinderActive() )
+            {
+            iCamera->StartViewFinderDirectL( aWs, aScreenDevice, aWindow, aScreenRect, aCropRect );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+           }
+        }
+
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL (cropped) leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StopViewFinder
+// Calls Camera API ViewFinderActive() and StopViewFinder().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StopViewFinder()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopViewFinder() entering" ) );
+
+    if ( iPowerOn )
+        {
+        if ( iCamera->ViewFinderActive() )
+            {
+            iCamera->StopViewFinder();
+            iViewFinderRunning = EFalse;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopViewFinder() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::IsViewFinding
+// Calls Camera API ViewFinderActive().
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::IsViewFinding() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::IsViewFinding()" ) );
+
+    TBool isViewFinding( EFalse );
+    if ( iPowerOn ) 
+        {
+        isViewFinding = iCamera->ViewFinderActive();
+        }
+    return isViewFinding;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetViewFinderSize
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetViewFinderSize( 
+    TSize& aVfFrameSize )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetViewFinderSize()" ) );
+
+    aVfFrameSize = iTrueViewFinderSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetCaeStillBurstObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetCaeStillBurstObserver( 
+    MCaeStillBurstObserver& aObserver )
+    {
+    iStillStatesActive->SetCaeStillBurstObserver( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetStillCaptureImageCountL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::SetStillCaptureImageCountL( 
+    TInt aImageCount )
+    {
+    return ( iStillStatesActive->SetStillCaptureImageCountL( aImageCount ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillCaptureImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::StillCaptureImageCount() const
+    {
+    return ( iStillStatesActive->StillCaptureImageCount() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetStillBurstCaptureIntervalL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetStillBurstCaptureIntervalL( 
+    TTimeIntervalMicroSeconds aInterval )
+    {
+    iStillStatesActive->SetStillBurstCaptureIntervalL( aInterval );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillBurstCaptureInterval
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeEngineImp::StillBurstCaptureInterval() const 
+    {
+    return ( iStillStatesActive->StillBurstCaptureInterval() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StopStillBurstCapture
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StopStillBurstCapture()
+    {
+    iStillStatesActive->StopStillBurstCapture();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillBurstSupport()
+// Return option flag for still burst support.
+// -----------------------------------------------------------------------------
+//
+TCamAppEngineInfo::TOptions CCaeEngineImp::StillBurstSupport()
+    {
+    return TCamAppEngineInfo::EStillBurstSupported;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Retrieves parameters for the specified quality level and calls 
+// overloading PrepareStillCaptureL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    TInt aStillQualityIndex )
+    {
+    TSize size = iStillStatesActive->SnapImageSize();
+    PrepareStillCaptureL( aStillQualityIndex, size);
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Retrieves parameters for the specified quality level and calls 
+// overloading PrepareStillCaptureL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    TInt         aStillQualityIndex, 
+    TSize&       aSnapSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() entering aSnapSize wxh=%dx%d" ),
+            aSnapSize.iWidth, aSnapSize.iHeight );
+
+    if ( aStillQualityIndex < 0 || 
+         aStillQualityIndex >= iStillQualityLevelsCont->Count() ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL leaving KErrArgument, aStillQualityIndex=%d" ), aStillQualityIndex );
+        User::Leave( KErrArgument );
+        }
+
+    TSize frameSize         = iStillQualityLevelsCont->At( aStillQualityIndex ).iFrameSize;
+    CCamera::TFormat format = iStillQualityLevelsCont->At( aStillQualityIndex ).iOutputFormat;
+    TInt compressionQuality = iStillQualityLevelsCont->At( aStillQualityIndex ).iCompressionQuality;
+    TRect fullRect( frameSize );
+    
+    PrepareStillCaptureL( frameSize, format, compressionQuality, fullRect, aSnapSize );
+    
+    iStillQualityIndex = aStillQualityIndex;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Cropped version.
+// Not supported.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    TInt /*aStillQualityIndex*/, 
+    const TRect& /*aCropRect*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() cropped leaving KErrNotSupported" ) );
+
+    User::Leave( KErrNotSupported );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    const TSize&      aFrameSize,
+    CCamera::TFormat  aFormat,  
+    TInt              aCompressionQuality )
+    {    
+    TRect fullRect( aFrameSize );
+    PrepareStillCaptureL( aFrameSize, aFormat, aCompressionQuality, fullRect );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Cropped version. Using cropping only if supported by Camera API impl.
+// Calls RetrieveStillSizeIndex() that calls Camera API EnumerateCaptureSizes().
+// Calls Camera API PrepareImageCaptureL().
+// Optionally calls Camera API SetJpegQuality().
+// Finally calls McaeoStillPrepareComplete call-back.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    const TSize&      aFrameSize, 
+    CCamera::TFormat  aFormat, 
+    TInt              aCompressionQuality, 
+    const TRect&      aCropRect )
+    {
+    TSize snapSize = iStillStatesActive->SnapImageSize();
+    PrepareStillCaptureL(aFrameSize, aFormat, aCompressionQuality, aCropRect, snapSize );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Cropped version. Using cropping only if supported by Camera API impl.
+// Calls RetrieveStillSizeIndex() that calls Camera API EnumerateCaptureSizes().
+// Calls Camera API PrepareImageCaptureL().
+// Optionally calls Camera API SetJpegQuality().
+// Finally calls McaeoStillPrepareComplete call-back.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    const TSize&      aFrameSize, 
+    CCamera::TFormat  aFormat, 
+    TInt              aCompressionQuality, 
+    const TRect&      aCropRect,
+    TSize&            aSnapSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() entering aFrameSize wxh=%dx%d" ),
+            aFrameSize.iWidth, aFrameSize.iHeight );
+
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPARESTILLCAPTUREL, "e_CAM_ENG_STILL_INIT 1" );   //CAE_ENGINE_STILL_INIT_START
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EImageCaptureSupported ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() leaving KErrNotSupported (EImageCaptureSupported)" ) );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    // Leave if still capturing or video recording is running.
+    if ( iStillStatesActive->IsRunning() || iVideoRecordingRunning ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() leaving KErrNotReady (IsRunning)" ) );
+        User::Leave( KErrNotReady );
+        }
+
+    if ( ( aFormat == CCamera::EFormatJpeg ) || ( aFormat == CCamera::EFormatExif ) ) 
+        {
+    	SetJpegQuality( aCompressionQuality ); 
+        }
+    
+    iStillStatesActive->PrepareStillCaptureL( aFrameSize, aFormat, aCropRect, aSnapSize );
+
+    // Prepare ready now.
+    iStillPrepared = ETrue;
+
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPARESTILLCAPTUREL, "e_CAM_ENG_STILL_INIT 0" );  //CAE_ENGINE_STILL_INIT_END
+
+    // Inform client about the success.
+    iCaeObserver->McaeoStillPrepareComplete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillQualityIndex
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::StillQualityIndex() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StillQualityIndex()" ) );    
+
+    TInt qualityIndex( -1 );
+    if ( iStillPrepared )
+        {
+        qualityIndex = iStillQualityIndex;
+        }
+    return qualityIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetStillFrameSize
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetStillFrameSize( 
+    TInt aStillQualityIndex, 
+    TSize& aFrameSize ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetStillFrameSize()" ) );
+    
+    if ( aStillQualityIndex >= 0 &&  
+         aStillQualityIndex < iStillQualityLevelsCont->Count() )
+        {
+        aFrameSize = iStillQualityLevelsCont->At( aStillQualityIndex ).iFrameSize;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EstimatedStillSizeInBytes
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::EstimatedStillSizeInBytes( 
+    TInt aStillQualityIndex ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EstimatedStillSizeInBytes()" ) );
+
+    TInt byteSize( 0 );
+    if ( aStillQualityIndex >= 0 &&  
+         aStillQualityIndex < iStillQualityLevelsCont->Count() )
+        {
+        byteSize = iStillQualityLevelsCont->At( aStillQualityIndex ).iByteSize;
+        }
+    return byteSize;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CaptureStill
+// Starts still capturing.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CaptureStill() entering" ) );
+
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CAPTURESTILL, "e_CAM_ENG_SHOT_TO_STILL 1" );    //CAE_ENGINE_SHOT_TO_STILL_START
+
+    if ( !iStillStatesActive->IsRunning() ) 
+        {
+        if ( iStillPrepared && iPowerOn && !iVideoRecordingRunning ) 
+            {
+                // Call CAPI without active object delay (for perf reasons)
+                iStillStatesActive->StartQuickCapture();
+
+            }
+        else
+            {
+            // Handle error
+            iStillStatesActive->ErrorRecovery( KErrNotReady );
+            }    
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CaptureStill() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CancelCaptureStill
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CancelCaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelCaptureStill() entering" ) );
+
+    if ( iStillStatesActive ) 
+        {
+        iStillStatesActive->CancelCaptureStill();
+        }
+
+    if ( iCallbackActive ) 
+        {
+        iCallbackActive->Cancel();
+        }
+
+    if ( iCamera ) 
+        {
+        iCamera->CancelCaptureImage();
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelCaptureStill() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageCreation
+// Sets snap image creation on/off.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageCreation( 
+    TBool aCreateSnapImage )
+    {
+    iStillStatesActive->SetSnapImageCreation( aCreateSnapImage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageSource
+// Sets snap image source.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageSourceL( 
+    CCaeEngine::TSnapImageSource aSnapImageSource )
+    {
+    iStillStatesActive->SetSnapImageSourceL( aSnapImageSource );
+    }
+
+
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageSizeL
+// Sets the size of the snap image.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageSizeL( 
+    TSize& aSize )
+    {
+    iStillStatesActive->SetSnapImageSizeL( aSize );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageColorMode
+// Sets the color mode of the snap image.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageColorMode( 
+    TDisplayMode aMode )
+    {
+    iStillStatesActive->SetSnapImageColorMode( aMode );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::NewL
+// Two-phased constructor. Calls CCaeEngineImp's NewL() with camera index and
+// default display index 0.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCaeEngine* CCaeEngine::NewL( 
+    TInt aCameraIndex )
+    {
+    return CCaeEngineImp::NewL( aCameraIndex, 0 );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::NewL
+// Two-phased constructor. Calls CCaeEngineImp's NewL() with camera index.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCaeEngine* CCaeEngine::NewL( 
+    TInt aCameraIndex, TInt aDisplayIndex )
+    {
+    return CCaeEngineImp::NewL( aCameraIndex, aDisplayIndex );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::CamerasAvailable
+// Determines the number of cameras on the device.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CCaeEngine::CamerasAvailable()
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngine::CamerasAvailable(): %d" ), CCamera::CamerasAvailable() );
+    return CCamera::CamerasAvailable();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::NewL
+// Two-phased constructor. Inputs camera index.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp* CCaeEngineImp::NewL( 
+    TInt aCameraIndex, TInt aDisplayIndex )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::NewL() entering with camera index %d" ), aCameraIndex );
+
+    CCaeEngineImp* self = new( ELeave ) CCaeEngineImp();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aCameraIndex, aDisplayIndex );
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::NewL() returning" ) );
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EnumerateStillCaptureSizes
+// Enumerates through the available image capture sizes.
+// Calls Camera API EnumerateCaptureSizes().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::EnumerateStillCaptureSizes( 
+    TSize& aSize, 
+    TInt aSizeIndex, 
+    CCamera::TFormat aFormat ) const
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::EnumerateStillCaptureSizes() entering aSizeIndex=%d" ), aSizeIndex );
+    iCamera->EnumerateCaptureSizes( aSize, aSizeIndex, aFormat );
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::EnumerateStillCaptureSizes() returning aSize wxh=%dx%d" ),
+           aSize.iWidth, aSize.iHeight );
+   }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetJpegQuality
+// Sets the compression quality value to use with JPEG and Exif image formats.
+// Calls Camera API SetJpegQuality() and the still state machine SetJpegQuality().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetJpegQuality( 
+    TInt aCompressionQuality )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetJpegQuality() entering with %d" ), aCompressionQuality );
+    // Clamp and memorize the image compression quality.
+    if ( aCompressionQuality < 1 )
+        {
+        aCompressionQuality = 1;
+        }
+    if ( aCompressionQuality > 100 ) 
+        {
+        aCompressionQuality = 100;
+        }
+
+    // Set JPEG quality on Camera API.
+    iCamera->SetJpegQuality( aCompressionQuality );
+
+    // Set JPEG quality on the state machine
+    iStillStatesActive->SetJpegQuality( aCompressionQuality );
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetJpegQuality() returning, memorized %d" ), aCompressionQuality );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::JpegQuality
+// Gets the current compression quality value setting for 
+// JPEG and Exif image formats.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::JpegQuality() const
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::JpegQuality(): %d" ), iStillStatesActive->JpegQuality() );
+    // Memorized image compression quality, set in  
+    // SetJpegQuality() or PrepareStillCaptureL().
+    return( iStillStatesActive->JpegQuality() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetImageCodecsL
+// Sets the specific image codec implementation to be used in decoding and 
+// encoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetImageCodecsL( 
+	TUid aDecoderUid, TUid aEncoderUid )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::SetImageCodecsL(): %x, %x" ), aDecoderUid, aEncoderUid );
+    iStillStatesActive->SetImageCodecsL( aDecoderUid, aEncoderUid );
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ReserveComplete
+// Camera reservation is complete. 
+// Called asynchronously when CCamera::Reserve() completes.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ReserveComplete(                                 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::ReserveComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeReserveCompleteError( aError );
+    #endif    
+
+    if ( aError == KErrNone )
+        {
+        iReserved = ETrue;
+        // Call the active object to switch the power on indirectly.
+        iCallbackActive->PowerOn();
+        }
+    else
+        {
+        iCaeObserver->McaeoInitComplete( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ReserveComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOnComplete
+// Indicates camera power on is complete.
+// Called on completion of CCamera:PowerOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PowerOnComplete( 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PowerOnComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaePowerOnCompleteError( aError );
+    #endif    
+
+    if ( aError == KErrNone ) 
+        {
+        iPowerOn = ETrue;
+        if ( iResetToPreviousSettings )
+            {
+            iResetToPreviousSettings = EFalse;
+            TRAP( aError, ResetToPreviousSettingsL() );
+            }
+        }
+    
+    iCaeObserver->McaeoInitComplete( aError );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOnComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ViewFinderFrameReady
+// Transfers the current view finder image from the camera. The frame is 
+// first delivered to the extensions and then to the client.
+// Called periodically in response to the use of 
+// CCamera::StartViewFinderBitmapsL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ViewFinderFrameReady( 
+    CFbsBitmap& aFrame )
+    {
+    //LOGTEXT( _L( "Cae: CCaeEngineImp::ViewFinderFrameReady() entering" ) );
+
+	// Process extensions
+	RArray<TCaeExtensionInterfaceImplItem>* processImageImplList = 
+		iExtInterfaceImplementationLists[KCaeExtProcessImageInterfaceIndex].iImplementations;
+
+	TInt extError = KErrNone;
+	for ( TInt i = 0; i < processImageImplList->Count() && !extError; i++ )
+		{
+		if ( (*processImageImplList)[i].iIsActive )
+		    {
+    		STATIC_CAST( MCaeExtProcessImageInterface*, 
+	    	(*processImageImplList)[i].iImplPtr )->ProcessViewFinderFrame( aFrame, extError );
+		    }
+		else
+		    {
+			// LOGTEXT2(_L("Cae: CCaeEngineImp::ViewFinderFrameReady(). Skipped extension %x"), (*processImageImplList)[i].iImplUid.iUid );
+		    }
+		
+	    #ifdef _DEBUG
+		if ( extError )
+		    {
+			LOGTEXT3(_L("Cae: CCaeEngineImp::ViewFinderFrameReady(). Error %d in extension processing for Extension %x"),
+			    extError, (*processImageImplList)[i].iImplUid.iUid );
+			}
+		#endif
+		}
+
+    iCaeObserver->McaeoViewFinderFrameReady( aFrame, extError );
+
+    iStillStatesActive->ViewFinderFrameReady();
+
+    //LOGTEXT( _L( "Cae: CCaeEngineImp::ViewFinderFrameReady() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ImageReady
+// Transfers the current image from the camera. 
+// Called asynchronously when CCamera::CaptureImage() completes.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError )
+    {
+    iStillStatesActive->ImageReady( aBitmap, aImageData, aError );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CheckPowerL
+// Leaves with KErrNotReady if power is off.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CheckPowerL()
+    {
+    if ( !iPowerOn ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::CheckPowerL() leaving KErrNotReady (iPowerOn)" ) );
+        User::Leave( KErrNotReady );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CancelAllActivities()
+// Cancels/closes/stops still capturing, video recording, and view finding.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CancelAllActivities()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelAllActivities() entering" ) );
+
+    CancelCaptureStill();
+ 
+    CloseVideoRecording();
+
+    StopViewFinder();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelAllActivities() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ResetToPreviousSettingsL
+// Resets the following settings to the previous values: 
+// exposure mode, white balance mode, 
+// zoom mode, zoom value, flash mode, brightness, and contrast.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ResetToPreviousSettingsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToPreviousSettingsL() entering" ) );
+
+    SetExposureModeL( iExposureMode );
+    SetWhiteBalanceModeL( iWhiteBalanceMode );
+    SetZoomModeL( iZoomMode );
+    SetZoomValueL( iZoomValue );
+    SetFlashModeL( iFlashMode );
+
+    // Try to reset this setting only if it is supported by Camera API.
+    // Otherwise this could cause error when re-reserving camera.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported )
+        {
+        SetBrightnessL( iBrightness );
+        }
+
+    // Try to reset this setting only if it is supported by Camera API.
+    // Otherwise this could cause error when re-reserving camera.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported )
+        {
+        SetContrastL( iContrast );
+        }
+
+ 	// Process extensions
+	RArray<TCaeExtensionInterfaceImplItem>* settingsImplementationList = 
+		iExtInterfaceImplementationLists[KCaeExtSettingsInterfaceIndex].iImplementations;
+
+	for ( TInt i = 0; i < settingsImplementationList->Count(); i++ )
+		{
+		TRAPD( err,STATIC_CAST( MCaeExtSettingsInterface*, 
+		    (*settingsImplementationList)[i].iImplPtr )->ResetToPreviousSettingsL() );
+		    
+	    #ifdef _DEBUG
+		if ( err )
+		    {
+			LOGTEXT3(_L("Cae: CCaeEngineImp::ResetToDefaultsL(). Error %d in ResetToDefaultsL() for Extension %x"),
+			    err, (*settingsImplementationList)[i].iImplUid.iUid );
+			}
+		#endif
+		
+		User::LeaveIfError( err );
+		}
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToPreviousSettingsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CustomInterface
+// Returns a custom interface  that matches to the given UID.
+// -----------------------------------------------------------------------------
+//
+TAny* CCaeEngineImp::CustomInterface( TUid aInterface )
+    {
+	LOGTEXT2(_L("Cae: CCaeEngineImp::CustomInterface() entering, aIterface=%x"),aInterface.iUid );
+	TAny* interfaceImp = NULL;
+
+	// At first, try to find the interface in CAE extesions
+	TCaeCustomInterfaceImplItem item;
+	item.iInterfaceUid = aInterface;
+	item.iImplPtr = NULL; // This is not used by FindInUnsignedKeyOrder()
+	TInt index = iExtCustomInterfaceImplementations.FindInUnsignedKeyOrder( item ); 
+	if ( index >= 0 )
+		{
+		interfaceImp = iExtCustomInterfaceImplementations[ index ].iImplPtr;
+		}
+
+	if ( !interfaceImp )
+		{
+		// Then, try to find the interface in Camera API
+        interfaceImp = iCamera->CustomInterface( aInterface );
+		}
+
+    // Check if View Finder is stopped during burst sequency to optimize speed of burst
+    // Detection of this feature is based to the fact that the CI UID (KUidBurstModeVFOptimization)
+    // is asked and found from the CAPI.
+    if ( aInterface == KUidBurstModeVFOptimization && interfaceImp )
+        {
+        iStillStatesActive->SetBurstModeVFOptimization( ETrue );
+        }
+        
+	LOGTEXT2(_L("Cae: CCaeEngineImp::CustomInterface() returning, interfaceImp=%x"),interfaceImp );
+    return interfaceImp;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetOrder
+// Populate feature array
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetOrderL( RCaeOrderedFeatureList& aOrderedFeatureList )
+    {
+    TCaeOrderedFeatureListItem tmpItem;
+    aOrderedFeatureList.Reset();
+    
+	// For all interface implementation lists
+    for ( TInt implListIndex = 0; 
+           implListIndex < iExtInterfaceImplementationLists.Count(); 
+          implListIndex++ )
+        {
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		// For all implementations
+		for ( TInt implIndex = 0; implIndex < implementations.Count(); implIndex++ )
+			{
+
+			// Add to item to the feature array
+			tmpItem.iServiceUid = implListItem->iInterfaceUid;
+			tmpItem.iFeatureUid = implementations[implIndex].iImplUid;
+			aOrderedFeatureList.AppendL( tmpItem );
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetOrderL
+// The user must first call GetOrder() to get array. After that the user can 
+// change the order of items and call this function. The user shall not remove 
+// items or add new items to the array. 
+//
+// E.g. Typically the user finds two items from the array and switches
+// the positions of these items to get desired effect.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetOrderL( const RCaeOrderedFeatureList& aOrderedFeatureList )
+    {
+	TInt status = KErrNone;
+
+	// Check that aOrderedFeatureList is valid
+	DoSetOrderL( aOrderedFeatureList, EFalse );
+	
+	// Check counts
+	
+	TInt totalImplCount = 0;
+
+	// For all interface implementation lists
+	for ( TInt implListIndex = 0; 
+	      implListIndex < iExtInterfaceImplementationLists.Count(); 
+	      implListIndex++ )
+		{
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		totalImplCount += implementations.Count();
+		}
+
+	if ( totalImplCount != aOrderedFeatureList.Count() )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+		// Check duplicates
+		status = KErrNone;
+		for ( TInt i =  aOrderedFeatureList.Count() - 1; 
+		      ( i >= 0 ) && ( !status ); 
+		      i-- )
+			{
+			// Find always starts at index 0
+			TInt index = aOrderedFeatureList.Find( 
+				aOrderedFeatureList[i], CCaeEngineImp::Match ); 
+			if (index != i)
+				{
+				status = KErrAlreadyExists;
+				}
+			}
+		
+		// Finally, update internal array
+		if ( !status )
+			{
+			DoSetOrderL( aOrderedFeatureList, ETrue );
+			}
+		}
+
+	User::LeaveIfError( status );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DoSetOrderL
+//
+// For each item the old item is removed and the new appended to the end of 
+// iExtInterfaceImplementationLists[i].iImplementations.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::DoSetOrderL( 
+	const RCaeOrderedFeatureList& aOrderedFeatureList, 
+	TBool iUpdate )
+    {
+	TInt status = KErrNone;
+
+	// For all items in given array
+    for (TInt i = 0; i < aOrderedFeatureList.Count() && !status; i++ )
+        {
+        TUid interfaceUid = aOrderedFeatureList[i].iServiceUid;
+        TUid itemImplUid = aOrderedFeatureList[i].iFeatureUid;
+
+		// Find correct interface list
+
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = interfaceUid;
+		listItem.iImplementations =  NULL;
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+		if ( index < 0 )
+			{
+			status = index; // Invalid interface uid
+			}
+		else
+			{
+			
+			// Find implementation by uid
+
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = 0;
+			item.iImplUid.iUid = itemImplUid.iUid;
+			item.iImplPtr = 0;
+			item.iIsActive = ETrue;
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplUid );
+			if ( itemIndex < 0 ) 
+				{
+				status = itemIndex; // Invalid feature/implementation uid
+				}
+			else
+				{
+				if ( iUpdate )
+					{
+					// Remove current item and add new implementation item to 
+					// end of the array
+
+					item = implementations[itemIndex];
+
+					implementations.Remove( itemIndex );
+
+					status = implementations.Append( item );
+					}
+				}
+			}
+        }
+
+    User::LeaveIfError( status );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MatchEqualImplUid 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::MatchEqualImplUid( 
+    const TCaeExtensionInterfaceImplItem& aFirst, 
+    const TCaeExtensionInterfaceImplItem& aSecond )
+    {
+	return ( aFirst.iImplUid.iUid == aSecond.iImplUid.iUid ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MatchEqualImplPtr 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::MatchEqualImplPtr( 
+    const TCaeExtensionInterfaceImplItem& aFirst, 
+    const TCaeExtensionInterfaceImplItem& aSecond )
+    {
+	return ( aFirst.iImplPtr == aSecond.iImplPtr ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MatchSmallerInitialPriorityAndImplUid 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::MatchSmallerInitialPriorityAndImplUid( 
+    const TCaeExtensionInterfaceImplItem& aFirst, 
+    const TCaeExtensionInterfaceImplItem& aSecond )
+    {
+	if (  ( aSecond.iInitialPriority == aFirst.iInitialPriority )
+		  && ( aSecond.iImplUid.iUid < aFirst.iImplUid.iUid ) )
+		{
+		return ETrue;
+		}
+
+	else if ( aSecond.iInitialPriority < aFirst.iInitialPriority )
+		{
+		return ETrue;
+		}
+
+	else
+		{
+		return EFalse;
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Match 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::Match( 
+    const TCaeOrderedFeatureListItem& aFirst, 
+    const TCaeOrderedFeatureListItem& aSecond )
+    {
+	return ( ( aFirst.iServiceUid == aSecond.iServiceUid ) 
+		     && ( aFirst.iFeatureUid == aSecond.iFeatureUid ) ); 
+    }
+
+
+// From MCaeExtEngineInfoCallbackInterface
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtStillImageSize
+// Returns current still image size.
+// -----------------------------------------------------------------------------
+//
+TSize CCaeEngineImp::McaeExtStillImageSize()
+	{
+	return( iStillStatesActive->StillImageSize() );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtSnapImageSize
+// Returns current snap image size.
+// -----------------------------------------------------------------------------
+//
+TSize CCaeEngineImp::McaeExtSnapImageSize()
+	{
+	return( iStillStatesActive->SnapImageSize() );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtViewFinderSize
+// Returns current view finder size.
+// -----------------------------------------------------------------------------
+//
+TSize CCaeEngineImp::McaeExtViewFinderSize()
+	{
+	return( iTrueViewFinderSize );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtCheckPowerL
+// Check camera power.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::McaeExtCheckPowerL()
+	{
+	CheckPowerL();
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtDisplayIndex
+// Returns display index.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::McaeExtDisplayIndex()
+	{
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::McaeExtDisplayIndex() iDisplayIndex=%d" ), iDisplayIndex );
+	return( iDisplayIndex );
+	}
+
+// From MExtensionCallbackInterface
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::IsInterfaceSupported
+// Check that the interface is supported. 
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::IsInterfaceSupported( TUid aInterfaceUid )
+	{
+	TBool found = EFalse;
+	TInt i = 0;
+
+	TCaeExtensionInterfaceImplListItem listItem;
+	listItem.iInterfaceUid = aInterfaceUid;
+	listItem.iImplementations =  NULL;
+
+	// Check extension interface uids
+	if ( iExtInterfaceImplementationLists.Find( listItem ) >= 0 )
+		{
+		found = ETrue;
+		}
+
+	// Check callback interface uids
+	for ( i = 0; (KCaeSupportedCallbackInterfaceUids[i].iUid != NULL) && !found; i++ )
+		{
+		if ( KCaeSupportedCallbackInterfaceUids[i] == aInterfaceUid )
+			{
+			found = ETrue;
+			}
+		}
+
+	return found;
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::AddExtensionInterface
+// Add an extension implemented interface to the list.
+// Note: Returns KErrNotFound if the interface is not supported.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::AddExtensionInterface( 
+	TUid aInterfaceUid, 
+	TUid aExtensionUid, 
+	TAny* aImplementationPtr, 
+	TInt aInitialPriority )
+	{
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::AddExtensionInterface() entering: ifUid=%x, exUid=%x" ), aInterfaceUid.iUid, aExtensionUid.iUid );
+
+	TInt status = KErrNone;
+
+	// Check for invalid pointer
+	if ( !aImplementationPtr )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+
+		// Add implementation to the list
+
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = aInterfaceUid;
+		listItem.iImplementations =  NULL;
+
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+		if ( index < 0 )
+			{
+			status = index; // Error code
+			}
+		else
+			{
+
+			// Add new implementation item to the array
+
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = aInitialPriority;
+			item.iImplUid  = aExtensionUid;
+			item.iImplPtr  = aImplementationPtr;
+			item.iIsActive = ETrue;
+
+			// Check for duplicates
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplUid );
+			if ( itemIndex >= 0 ) 
+				{
+				status = KErrAlreadyExists; // Error code
+				}
+			else
+				{
+				itemIndex = implementations.Find( 
+				    item, CCaeEngineImp::MatchSmallerInitialPriorityAndImplUid );
+				if ( itemIndex < 0 ) 
+					{
+					// All have bigger or equal priority. Add to the end of list.
+					itemIndex = implementations.Count();
+					}
+
+				// Finally, add item to the list
+				status =  implementations.Insert( item, itemIndex ); 
+				}
+			}
+		}
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::AddExtensionInterface() returning: status=%d" ), status );
+
+	return( status );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RemoveExtensionInterface
+// Remove an extension implemented interface from the list.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::RemoveExtensionInterface( 
+	TUid aInterfaceUid, 
+	TAny* aImplementationPtr )
+	{
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::RemoveExtensionInterface() entering: ifUid=%x, ptr=%d" ), aInterfaceUid.iUid, aImplementationPtr );
+	TInt status = KErrNone;
+
+	// Check for invalid pointer
+	if ( !aImplementationPtr )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+		// Remove implementation to the list
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = aInterfaceUid;
+		listItem.iImplementations =  NULL;
+
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+
+		if ( index < 0 )
+			{
+			status = index; // Error code
+			}
+		else
+			{
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = 0;
+			item.iImplUid.iUid = 0;
+			item.iImplPtr = aImplementationPtr;
+			item.iIsActive = ETrue;
+			
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplPtr );
+
+			if ( itemIndex < 0 ) 
+				{
+				status = itemIndex; // Return error
+				}
+			else
+				{
+				implementations.Remove( itemIndex );
+				}
+			}
+		}
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::RemoveExtensionInterface() returning: status=%d" ), status );
+
+	return( status );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::AddCustomInterface
+// Add an extension implemented custom interface to the list.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::AddCustomInterface( 
+    TUid aInterfaceUid, 
+    TAny* aImplementationPtr )
+	{
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::AddCustomInterface() entering: ifUid=%x, ptr=%d" ), aInterfaceUid.iUid, aImplementationPtr );
+
+	TInt status = KErrNone;
+
+	if ( !aImplementationPtr )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+		TCaeCustomInterfaceImplItem item;
+		item.iInterfaceUid = aInterfaceUid;
+		item.iImplPtr = aImplementationPtr;
+		
+	    // Do not allow duplicate uid's
+		status = iExtCustomInterfaceImplementations.InsertInUnsignedKeyOrder( item ); 	
+		}
+	
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::AddCustomInterface() returning: status=%d" ), status );
+
+	return ( status );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetCallbackInterface
+// Return an engine implemented callback interface.
+// -----------------------------------------------------------------------------
+//
+TAny* CCaeEngineImp::GetCallbackInterface( TUid aInterfaceUid )
+	{
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::GetCallbackInterface() entering: ifUid=%x" ), aInterfaceUid.iUid );
+	TAny* callbackInterface =  NULL;
+
+	if ( aInterfaceUid == KCaeExtEngineInfoCallbackInterfaceUid )
+		{
+		callbackInterface = (MCaeExtEngineInfoCallbackInterface*) this;
+		}
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::GetCallbackInterface() returning: callbackInterface=%d" ), callbackInterface );
+	return ( callbackInterface );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RegisterFlags
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::RegisterFlags( TUint32 aFlags )
+	{
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::RegisterFlags() aFlags=%x" ), aFlags );
+    iStillStatesActive->RegisterFlags( aFlags );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DeregisterFlags
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::DeregisterFlags( TUint32 aFlags )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::DeregisterFlags() aFlags=%x" ), aFlags );
+    iStillStatesActive->DeregisterFlags( aFlags );    
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CCameraHandle
+// Gets handle of camera object owned by the CCaeEngine.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::CCameraHandle() const
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::CCameraHandle(): %d" ), iCameraHandle );
+    return ( iCameraHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetCaeExtensionModeL
+// Sets CAE to Extension mode
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::SetCaeExtensionModeL(): %d, %d" ), aExtModeActive, aCreateSnapImage );
+
+    iStillStatesActive->SetExtModeActiveL( aExtModeActive );
+    iStillStatesActive->SetSnapImageCreation( aCreateSnapImage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtViewFinderFrameReadyL
+// Process extension for view finder
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtViewFinderFrameReadyL()" ));
+
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtViewFinderFrameReadyL() leaving KErrPermissionDenied" ) );
+        User::Leave( KErrPermissionDenied );
+        }
+
+    ViewFinderFrameReady( aFrame );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtSnapImageL
+// Process extension for snap image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtSnapImageL( CFbsBitmap& aSnapImage )
+    {
+    TSize sizeEmpty;
+    CFbsBitmap* bitmapSave = NULL;
+    TSize snapSize = aSnapImage.SizeInPixels();
+    
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL() size wxh=%dx%d" ),
+            snapSize.iWidth, snapSize.iHeight );
+        
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL() leaving KErrPermissionDenied" ) );
+        User::Leave( KErrPermissionDenied );
+        }
+
+    // Create a duplicate bitmap
+    if ( snapSize != sizeEmpty ) 
+        {
+        bitmapSave = new CFbsBitmap;
+        if ( bitmapSave )
+            {
+            TInt err = bitmapSave->Duplicate( aSnapImage.Handle() );
+            if ( err ) 
+                {
+                    LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): Duplicate error:%d, leaving" ), err);
+                    delete bitmapSave;
+                    bitmapSave = NULL;
+                    User::Leave( err );
+                 }
+            }
+        else
+            {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): new CFbsBitmap failed, leaving KErrNoMemory" ));
+            User::Leave( KErrNoMemory );
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): got empty bitmap, ignore" ));
+        }
+        
+    if ( bitmapSave )
+        {
+        // Send bitmap for extension handling
+        TInt result = iStillStatesActive->ProcessExtSnapImage( bitmapSave );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): ProcessExtSnapImage failed %d, leaving" ), result);
+            delete bitmapSave;
+            bitmapSave = NULL;
+            User::Leave( result );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCapturedImageL
+// Process extension for captured image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage )
+    {
+    TSize sizeEmpty;
+    CFbsBitmap* bitmapSave = NULL;
+    TSize bitmapSize = aBitmap.SizeInPixels();
+    
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() CFbsBitmap ExtMode=%d, last=%d" ), iStillStatesActive->ExtModeActive(), aLastImage);
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() bitmap size WxH=%dx%d" ), bitmapSize.iWidth, bitmapSize.iHeight );
+        
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL leaving KErrPermissionDenied" ));
+        User::Leave( KErrPermissionDenied );
+        }
+
+    // Create a duplicate bitmap
+    if ( bitmapSize != sizeEmpty )
+        {
+        bitmapSave = new CFbsBitmap;
+        if ( bitmapSave )
+            {
+            TInt err = bitmapSave->Duplicate( aBitmap.Handle() );
+            if ( err ) 
+                {
+                    LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): Duplicate error:%d, leaving" ), err);
+                    delete bitmapSave;
+                    bitmapSave = NULL;
+                    User::Leave( err );
+                 }
+            }
+        else
+            {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): new CFbsBitmap failed, leaving KErrNoMemory" ));
+            User::Leave( KErrNoMemory );
+            }
+
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): got empty bitmap, ignore" ));
+        }
+        
+    if ( bitmapSave )
+        {
+        // Send bitmap for extension handling
+        TInt result = iStillStatesActive->ProcessExtCapturedImage( bitmapSave, aLastImage );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): ProcessExtCapturedImage failed %d, leaving" ), result);
+            delete bitmapSave;
+            bitmapSave = NULL;
+            User::Leave( result );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCapturedImageL
+// Process extension for captured image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() HBufC8 ExtMode=%d, last=%d" ), iStillStatesActive->ExtModeActive(), aLastImage);
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL leaving KErrPermissionDenied" ));
+        User::Leave( KErrPermissionDenied );
+        }
+    if ( aImageData )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() processing HBufC8 size=%d" ), aImageData->Size() );
+        TInt result = iStillStatesActive->ProcessExtCapturedImage( aImageData, aLastImage );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): ProcessExtCapturedImage failed %d, leaving" ), result);
+            delete aImageData;
+            aImageData = NULL;
+            User::Leave( result );
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): got empty HBufC8, ignore" ));
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCapturedImageL
+// Process extension for captured image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() TDesC8 ExtMode=%d, last=%d" ), iStillStatesActive->ExtModeActive(), aLastImage);
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL leaving KErrPermissionDenied" ));
+        User::Leave( KErrPermissionDenied );
+        }
+    // TDesC8 is used with C-API V2 features
+    if ( aImageDataDes.Size() )
+        {
+        // Make a new HBufC8 copy from the TDesC8
+        HBufC8* tempImageData = aImageDataDes.AllocL();
+        // Do not delete aImageDataDes, it is part of the class MCameraBuffer
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() New HBufC8 created, size=%d" ), tempImageData->Size() );
+        
+        TInt result = iStillStatesActive->ProcessExtCapturedImage( tempImageData, aLastImage );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): ProcessExtCapturedImage failed %d, leaving" ), result);
+            delete tempImageData;
+            tempImageData = NULL;
+            User::Leave( result );
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): got empty TDesC8, ignore" ));
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCancel
+// Cancels processing
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCancel()
+    {
+    CancelCaptureStill();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SkippedExtensionListL
+// Get list of skipped extensions. Application may define which extensions are
+// skipped during image processing. Only installed and skipped are listed.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SkippedExtensionListL( RCaeOrderedFeatureList& aDisabledExtensions )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SkippedExtensionListL() entering" ) );
+    TCaeOrderedFeatureListItem tmpItem;
+    aDisabledExtensions.Reset();
+    
+	// For all interface implementation lists
+    for ( TInt implListIndex = 0; 
+           implListIndex < iExtInterfaceImplementationLists.Count(); 
+          implListIndex++ )
+        {
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		// For all implementations
+		for ( TInt implIndex = 0; implIndex < implementations.Count(); implIndex++ )
+			{
+			// Add the item to the skipped array if it is not active
+			if ( !implementations[implIndex].iIsActive )
+			    {
+			    tmpItem.iServiceUid = implListItem->iInterfaceUid;
+			    tmpItem.iFeatureUid = implementations[implIndex].iImplUid;
+			    aDisabledExtensions.AppendL( tmpItem );
+                LOGTEXT3( _L( "Cae: CCaeEngineImp::SkippedExtensionListL(), serviceUid %x, featureUid %x" ),
+                    tmpItem.iServiceUid.iUid, tmpItem.iFeatureUid.iUid  );
+			    }
+			}
+        }
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SkippedExtensionListL() returning, count %d" ), aDisabledExtensions.Count() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSkippedExtensionList
+// Set list of skipped extensions. Application may define which extensions are
+// skipped during image processing.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSkippedExtensionList( RCaeOrderedFeatureList& aDisabledExtensions )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetSkippedExtensionList() entering Count %d" ), aDisabledExtensions.Count() );
+
+	// Set all extensions first active
+
+	// For all interfaces
+    for ( TInt implListIndex = 0; 
+           implListIndex < iExtInterfaceImplementationLists.Count(); 
+          implListIndex++ )
+        {
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		// For all implementations
+		for ( TInt implIndex = 0; implIndex < implementations.Count(); implIndex++ )
+			{
+			implementations[implIndex].iIsActive = ETrue;
+			}
+        }
+
+    // Disable wanted extensions
+    
+	// For all items in given array
+    for (TInt i = 0; i < aDisabledExtensions.Count(); i++ )
+        {
+        TUid interfaceUid = aDisabledExtensions[i].iServiceUid;
+        TUid itemImplUid = aDisabledExtensions[i].iFeatureUid;
+
+		// Find correct interface list
+
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = interfaceUid;
+		listItem.iImplementations =  NULL;
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+		if ( index >= 0 ) // Interface was found
+			{
+			// Find implementation by uid
+
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = 0;
+			item.iImplUid.iUid = itemImplUid.iUid;
+			item.iImplPtr = 0;
+			item.iIsActive = ETrue;
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplUid );
+			if ( itemIndex >= 0 ) 
+				{
+				implementations[itemIndex].iIsActive = EFalse;
+                LOGTEXT3( _L( "Cae: CCaeEngineImp::SetSkippedExtensionList(), serviceUid %x, featureUid %x" ),
+                    interfaceUid.iUid, itemImplUid.iUid  );
+				}
+			}
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetSkippedExtensionList() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EnableVideoRecording
+// Set CAE internal camera status flags.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::EnableVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EnableVideoRecording() entering" ) );
+
+    // Set the flags to enable the video usage without InitL() call
+    iReserved = ETrue;
+    iPowerOn = ETrue;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EnableVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DisableVideoRecording
+// Set CAE internal camera status flags.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::DisableVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::DisableVideoRecording() entering" ) );
+
+    if ( iReserved ) 
+        {
+        if ( iPowerOn ) 
+            {
+            CancelAllActivities();
+            iPowerOn = EFalse;
+            }
+        iReserved = EFalse;
+        iStillPrepared = EFalse;
+        iVideoPrepared = EFalse;
+        iVideoOpened = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::DisableVideoRecording() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::HandleEvent( const TECAMEvent& aEvent)
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode );
+
+    if ( iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() Extension mode active, skipping event handling" ) );
+        }
+    else
+        {
+        // Cae is in use when capturing images
+        if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+            {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() KUidECamEventCameraNoLongerReserved" ) );
+            CancelAllActivities();
+            iPowerOn = EFalse;
+            iReserved = EFalse;
+            iStillPrepared = EFalse;
+            iVideoPrepared = EFalse;
+            iVideoOpened = EFalse;
+            iCaeObserver->McaeoInitComplete( KErrInUse ); // Tell the client that other application has taken the camera
+            }
+        else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+    	    {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() KUidECamEventPowerOnComplete" ) );
+            PowerOnComplete( aEvent.iErrorCode );
+	        }
+    	else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+    	    {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() KUidECamEventReserveComplete" ) );
+            ReserveComplete( aEvent.iErrorCode );
+    	    }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ViewFinderReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() );
+
+    if ( !aError )
+        {
+        if ( aCameraBuffer.NumFrames() > 0 )
+	        {
+            CFbsBitmap* bitmap = NULL;
+	        TRAPD( err, bitmap = &aCameraBuffer.BitmapL( 0 ) );
+	        if ( !err )
+	            {
+	            ViewFinderFrameReady( *bitmap );
+	            }
+	        else
+	            {
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::ViewFinderReady() BitmapL failed err=%d" ), err );
+	            }
+	        }
+	    aCameraBuffer.Release();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ImageBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() );
+	
+    if ( !aError )
+        {
+        TDesC8* data = NULL;
+        TRAPD( err, data = aCameraBuffer.DataL( 0 ) );
+        if ( err == KErrNotSupported )
+            {
+            // Got the image as a CFbsBitmap
+            CFbsBitmap* bitmap = NULL;
+
+            TRAP( err, bitmap = &aCameraBuffer.BitmapL( 0 ) );
+
+            if ( !err )
+                {
+                // Create a duplicate bitmap
+                CFbsBitmap* bitmapSave = NULL;
+                bitmapSave = new CFbsBitmap;
+                if ( bitmapSave )
+                    {
+                    err = bitmapSave->Duplicate( bitmap->Handle() );
+                    if ( !err ) 
+                        {
+                        // All OK, send duplicated bitmap to old observer interface
+                        ImageReady( bitmapSave, NULL, aError );
+                        }
+                    else
+                        {
+                        LOGTEXT2( _L( "Cae: CCaeEngineImp::ImageBufferReady(): Duplicate error:%d" ), err);
+                        delete bitmapSave;
+                        bitmapSave = NULL;
+                        ImageReady( NULL, NULL, err );
+                        }
+                    }
+                else
+                    {
+                    LOGTEXT( _L( "Cae: CCaeEngineImp::ImageBufferReady(): new CFbsBitmap failed" ));
+                    ImageReady( NULL, NULL, KErrNoMemory );
+                    }
+
+                }
+            else
+                {
+                LOGTEXT( _L( "Cae: CCaeEngineImp::ImageBufferReady(): BitmapL failed" ));
+                ImageReady( NULL, NULL, err );
+                }
+            }
+        else if ( !err )
+            {
+            // Got the image as a descriptor
+            // Make a new HBufC8 copy from the TDesC8
+            HBufC8* tempImageData = NULL;
+            tempImageData = data->Alloc();
+            
+            if ( tempImageData )
+                {
+                // All OK, send buffer to old observer interface
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::ImageBufferReady() New HBufC8 created, size=%d" ), tempImageData->Size() );
+                ImageReady( NULL, tempImageData, aError );
+                }
+            else
+                {
+                LOGTEXT( _L( "Cae: CCaeEngineImp::ImageBufferReady() Alloc of HBufC8 failed" ) );
+                ImageReady( NULL, NULL, KErrNoMemory );
+                }
+            
+            
+            }
+        else
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ImageBufferReady() DataL returned error code=%d" ), err );
+            ImageReady( NULL, NULL, err );
+            }
+
+        // Release buffer only when no error
+	    aCameraBuffer.Release();
+        }
+    else
+        {
+        ImageReady( NULL, NULL, aError );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::VideoBufferReady() entering, err=%d" ), aError );
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpTestErrors.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,276 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine error simulations (CAE_TEST_VERSION only)
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+//  INCLUDES
+#include <e32base.h>
+#include "CaeEngineImpTestErrors.h"
+
+
+// Error simulation variables.
+TInt CaeMcaeseoHBufC8ImageReadyErrorValue( 0 );
+TInt CaeCaeMcaesdoCFbsBitmapImageReadyErrorValue( 0 );
+TInt CaePowerOnCompleteErrorValue( 0 );
+TInt CaeReserveCompleteErrorValue( 0 );
+TInt CaeImageReadyErrorValue( 0 );
+TInt CaeMvruoOpenCompleteErrorValue( 0 );
+TInt CaeMvruoPrepareCompleteErrorValue( 0 );
+TInt CaeMvruoRecordCompleteErrorValue( 0 );
+TInt CaePrepareVideoSettingsErrorValue( 0 );
+TInt CaeCreateAndDeliverSnapImageErrorValue( 0 );
+TInt CaeCreateAndDeliverStillImageErrorValue( 0 );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CaeSetMcaeseoHBufC8ImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMcaeseoHBufC8ImageReadyError( TInt aError )
+    {
+    CaeMcaeseoHBufC8ImageReadyErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMcaeseoHBufC8ImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMcaeseoHBufC8ImageReadyError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMcaeseoHBufC8ImageReadyErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMcaesdoCFbsBitmapImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMcaesdoCFbsBitmapImageReadyError( TInt aError )
+    {
+    CaeCaeMcaesdoCFbsBitmapImageReadyErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMcaesdoCFbsBitmapImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMcaesdoCFbsBitmapImageReadyError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeCaeMcaesdoCFbsBitmapImageReadyErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetPowerOnCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetPowerOnCompleteError( TInt aError )
+    {
+    CaePowerOnCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaePowerOnCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaePowerOnCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaePowerOnCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetReserveCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetReserveCompleteError( TInt aError )
+    {
+    CaeReserveCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeReserveCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeReserveCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeReserveCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetImageReadyError( TInt aError )
+    {
+    CaeImageReadyErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeImageReadyError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeImageReadyErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMvruoOpenCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMvruoOpenCompleteError( TInt aError )
+    {
+    CaeMvruoOpenCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMvruoOpenCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMvruoOpenCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMvruoOpenCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMvruoPrepareCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMvruoPrepareCompleteError( TInt aError )
+    {
+    CaeMvruoPrepareCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMvruoPrepareCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMvruoPrepareCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMvruoPrepareCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMvruoRecordCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMvruoRecordCompleteError( TInt aError )
+    {
+    CaeMvruoRecordCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMvruoRecordCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMvruoRecordCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMvruoRecordCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetPrepareVideoSettingsError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetPrepareVideoSettingsError( TInt aError )
+    {
+    CaePrepareVideoSettingsErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaePrepareVideoSettingsErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaePrepareVideoSettingsErrorL()
+    {
+    if ( CaePrepareVideoSettingsErrorValue != KErrNone )
+        {
+        User::Leave( CaePrepareVideoSettingsErrorValue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetCreateAndDeliverSnapImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetCreateAndDeliverSnapImageError( TInt aError )
+    {
+    CaeCreateAndDeliverSnapImageErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeCreateAndDeliverSnapImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeCreateAndDeliverSnapImageError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeCreateAndDeliverSnapImageErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetCreateAndDeliverStillImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetCreateAndDeliverStillImageError( TInt aError )
+    {
+    CaeCreateAndDeliverStillImageErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeCreateAndDeliverStillImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeCreateAndDeliverStillImageError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeCreateAndDeliverStillImageErrorValue;
+        }
+    }
+
+#endif // CAE_TEST_VERSION
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpVideoName.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation for changing 
+*                video file name.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CaeEngineImp.h"   // For Camera Application Engine implementation.
+#include <mmf/server/mmffile.h>        // For MMF definitions (as TMMFFileConfig)
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ChangeVideoFileNameL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ChangeVideoFileNameL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() entering" ) );
+
+    // Close if previously prepared.
+    CloseVideoRecording();
+    // Open video recorder.
+    iVideoOpened = ETrue; // This is always set to ETrue when 
+                          // OpenFileL has been called to allow 
+                          // freeing resources by CloseVideoRecording().
+    iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                               iCameraHandle,
+                               iVideoControllerUid,
+                               iVideoFormatUid, 
+                               iVideoType->Des(),  
+                               iVideoAudioType );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() returning" ) );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpVideoNameCustom.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation for changing 
+*                video file name using MMF Video Recorder custom command interface
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CaeEngineImp.h" // For Camera Application Engine implementation.
+#include "CamCControllerCustomCommands.h" // For Camcorder plug-in custom commands and UId.
+#include <mmf/server/mmffile.h> // For MMF definitions (as TMMFFileConfig)
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ChangeVideoFileNameL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ChangeVideoFileNameL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() entering" ) );
+
+    if ( iVideoControllerUid == KCamCControllerImplementationUid ) 
+        {
+        // Use custom command interface of Video Recorder to change the file name.
+        // We know that the custom command is available with this specific implementation.
+        TMMFFileConfig pckg;
+        pckg().iPath = iVideoClipFileName->Des();
+        TInt err = iVideoRecorder->CustomCommandSync( TMMFMessageDestination( iVideoControllerUid, 
+                                                                   KMMFObjectHandleController ), 
+                                           ECamCControllerCCNewFilename, 
+                                           pckg, 
+                                           KNullDesC8 );
+        if (err)
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() CustomCommandSync failed err=%d, leaving" ), err );
+            User::Leave(err);
+            }
+        iPrepPars = EFalse;
+        iVideoRecorder->Prepare();
+        }
+    else 
+        {
+        // With 3rd party video controllers we need to re-open video recording because
+        // we can not rely on using custom command for changing the file name.
+        CloseVideoRecording();
+        // Open video recorder.
+        iVideoOpened = ETrue; // This is always set to ETrue when 
+                              // OpenFileL has been called to allow 
+                              // freeing resources by CloseVideoRecording().
+        iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                                   iCameraHandle,
+                                   iVideoControllerUid,
+                                   iVideoFormatUid, 
+                                   iVideoType->Des(),  
+                                   iVideoAudioType );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() returning" ) );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpVideoRecording.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1302 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation video recording methods
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <mmf/server/mmffile.h>                        // For MMF definitions (as TMMFFileConfig)
+#include <AudioPreference.h>                // For MMF audio preference definitions.
+
+
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeVideoQualityLevels.h"          // For video recording quality levels.
+#include "CaeVideoTimes.h"                  // For generating video recording time estimates.
+#include "CaeStillStatesActive.h"                
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitVideoRecorderL
+// Initialise the engine for video recording using default parameters.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitVideoRecorderL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() entering" ) );
+
+    iVideoInitialized = EFalse;
+
+    // Close video recording if previously opened/prepared.
+    CloseVideoRecording();
+
+    // (Re-)initialize these.
+    iVideoTimesInterval = KVideoTimesIntervalDefault; 
+    iMaxClipSizeInBytes = KMMFNoMaxClipSize; 
+    iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+
+    // Create video quality levels container object.
+    delete iVideoQualityLevelsCont;
+    iVideoQualityLevelsCont = NULL;
+    iVideoQualityLevelsCont = CCaeVideoQualityLevelsCont::NewL();
+
+    // Destroy possible video clip file name. (Its allocated elsewhere when file name is set.)
+    delete iVideoClipFileName;
+    iVideoClipFileName = NULL;
+
+    // Create video recorder.
+    delete iVideoRecorder;
+    iVideoRecorder = NULL;
+    iVideoRecorder = CVideoRecorderUtility::NewL( *this , KAudioPriorityVideoRecording,
+    	TMdaPriorityPreference( KAudioPrefVideoRecording ) );
+
+    delete iVideoFrameSize;
+    iVideoFrameSize = NULL;
+    iVideoFrameSize = new( ELeave ) TSize();
+    
+    delete iVideoFrameSizePrep;
+    iVideoFrameSizePrep = NULL;
+    iVideoFrameSizePrep = new( ELeave ) TSize();
+
+    // Create video times generator object.
+    delete iVideoTimes;
+    iVideoTimes = NULL;
+    iVideoTimes = CCaeVideoTimes::NewL();
+
+    // Create call-back function for video times generation.
+    delete iVideoTimesCallback;
+    iVideoTimesCallback = NULL;
+    iVideoTimesCallback = new( ELeave ) TCallBack( VideoRecordingTimesCallback, this );
+
+    // Initialize default video recording quality levels.
+    iInfo->iNumVideoQualityLevelsSupported = 
+        iVideoQualityLevelsCont->InitDefaultsL();
+
+    iVideoInitialized = ETrue;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitVideoRecorderL
+// Initialise the engine for video recording using either using default 
+// parameters or parameters from ini-file.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitVideoRecorderL( 
+    TUid aSdUidVideoQltyLevels )
+    {
+    if( aSdUidVideoQltyLevels == KNullUid )
+        {
+        InitVideoRecorderL();
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL(aSdUidVideoQltyLevels): NOT SUPPORTED, leaving" ) );
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoRecordingFileNameL
+// If video recording is not prepared then just memorizes the file name.
+// If video recording is prepared, then calls variated ChangeVideoFileNameL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoRecordingFileNameL( 
+    const TDesC& aVideoClipFileName )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL() entering" ) );
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( aVideoClipFileName.Length() > 0 )
+        {
+        // Memorize the video clip file name.
+        delete iVideoClipFileName;
+        iVideoClipFileName = NULL;
+        iVideoClipFileName = aVideoClipFileName.AllocL();
+        }
+    else 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL leaving KErrArgument (aVideoClipFileName)" ));
+        User::Leave( KErrArgument );
+        }
+
+    if ( iVideoPrepared ) 
+        {
+        // Does the actual change of file name, only if video is prepared.
+        // Note: Variated implementation
+        ChangeVideoFileNameL();
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoRecordingL
+// Retrieves video recording parameters from the specified quality level and
+// calls overloading PrepareVideoRecordingL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoRecordingL( 
+    TInt aVideoQualityIndex )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering" ) );
+
+    if ( ( aVideoQualityIndex < 0 ) || 
+         ( aVideoQualityIndex >= iVideoQualityLevelsCont->Count() ) ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() leaving KErrArgument" ) );
+        User::Leave( KErrArgument );
+        }
+    
+    PrepareVideoRecordingL( iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameSize, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameRate, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iBitRate, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioEnabled,
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioBitRate, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iMimeType, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iPreferredSupplier, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iVideoType,    
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioType );
+    
+    iVideoQualityIndex = aVideoQualityIndex;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoRecordingL
+// Finds first the UIDs needed for opening a video recording, uses ECOM.
+// Then gets camera handle from Camera API.
+// Finally calls Video Recorder API OpenFileL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoRecordingL( 
+    const TSize&  aFrameSize, 
+    TReal32       aFrameRate, 
+    TInt          aBitRate, 
+    TBool         aAudioEnabled,
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier, 
+    const TDesC8& aVideoType, 
+    const TDesC8& aAudioType )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering aFrameSize wxh=%dx%d" ),
+            aFrameSize.iWidth, aFrameSize.iHeight );
+
+    // Leave if not initialized properly or busy doing something else.
+    if ( !iVideoInitialized || 
+         !iVideoClipFileName || 
+         iStillStatesActive->IsRunning() || 
+         iVideoRecordingRunning   ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized );
+        User::Leave( KErrNotReady );
+        }
+
+    CheckPowerL();
+
+    // Leave if video clip file name is not set properly.
+    if ( iVideoClipFileName->Length() == 0 )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() leaving KErrArgument (iVideoClipFileName)" ) );
+        User::Leave( KErrArgument );
+        }
+
+    // Close if previously opened/prepared.
+    CloseVideoRecording();
+
+    // Find values for iVideoControllerUid and iVideoFormatUid.
+    // Those are also needed if clip file name is changed when prepared.
+    FindVideoUidsL( aMimeType, aPreferredSupplier );
+
+    // Memorize video type.
+    delete iVideoType;
+    iVideoType = NULL;
+    iVideoType = aVideoType.AllocL();
+
+    // Convert audio type from TDesC8 to TFourCC.
+    iVideoAudioType = ConvertAndSetVideoAudioTypeL( aAudioType );
+
+    // Memorize the parameters to be prepared.
+    *iVideoFrameSizePrep   = aFrameSize;
+    iVideoFrameRatePrep    = aFrameRate;
+    iVideoBitRatePrep      = aBitRate;
+    iVideoAudioEnabledPrep = aAudioEnabled;
+
+    // Open video recorder.
+    iVideoOpened = ETrue; // This is always set to ETrue when 
+                          // OpenFileL has been called to allow 
+                          // freeing resources by CloseVideoRecording().
+    iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                               iCameraHandle,
+                               iVideoControllerUid,
+                               iVideoFormatUid, 
+                               iVideoType->Des(),  
+                               iVideoAudioType );
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CloseVideoRecording
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CloseVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() entering" ) );
+
+    if ( iVideoPrepared ) 
+        {
+        CancelVideoRecording();
+        iVideoPrepared = EFalse;
+        }
+
+    if ( iVideoOpened )
+        {
+        iVideoRecorder->Close();
+        iVideoOpened = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoQualityIndex
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::VideoQualityIndex() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoQualityIndex()" ) );
+
+    TInt qualityIndex( -1 );
+    if ( iVideoPrepared )
+        {
+        qualityIndex = iVideoQualityIndex;
+        }
+    return qualityIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetVideoFrameSize
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetVideoFrameSize( 
+    TInt aVideoQualityIndex, 
+    TSize& aFrameSize ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetVideoFrameSize()" ) );
+    
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevelsCont->Count() )
+        {
+        aFrameSize = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameSize;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoFrameRate
+// -----------------------------------------------------------------------------
+//
+TReal32 CCaeEngineImp::VideoFrameRate( 
+    TInt aVideoQualityIndex ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoFrameRate()" ) );
+
+    TReal32 frameRate( 0.0 );
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevelsCont->Count() )
+        {
+        frameRate = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameRate;
+        }
+    return frameRate;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EstimatedVideoRecordingBitRateL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::EstimatedVideoRecordingBitRateL( 
+    TInt aVideoQualityIndex ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EstimatedVideoRecordingBitRateL()" ) );
+
+    TInt storageRate( 0 );
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevelsCont->Count() )
+        {
+        storageRate = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iStorageRate;
+        }
+    return storageRate;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoClipMaxSizeL
+// If video recording is not prepared then just memorizes the clip max size.
+// If video recording is prepared, then calls Video Recorder API 
+// SetMaxClipSizeL() and Prepare().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoClipMaxSizeL( 
+    TInt aMaxClipSizeInBytes )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() entering" ) );
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized );
+        User::Leave( KErrNotReady );
+        }
+
+    if ( aMaxClipSizeInBytes > 0 ) 
+        {
+        iMaxClipSizeInBytesPrep = aMaxClipSizeInBytes;
+        }
+    else 
+        {
+        iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+        }
+
+    if ( iVideoPrepared )
+        {
+        iPrepPars = ETrue;
+        iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+        iVideoRecorder->Prepare();
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoClipMaxSize
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::VideoClipMaxSize() const 
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoClipMaxSize()" ) );
+
+    TInt maxClipSizeInBytes( 0 );
+    if ( iMaxClipSizeInBytes != KMMFNoMaxClipSize ) 
+        {
+        maxClipSizeInBytes = iMaxClipSizeInBytes;
+        }
+
+    return maxClipSizeInBytes;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoAudioL
+// Calls Video Recorder API SetAudioEnabledL() and Prepare().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoAudioL( 
+    TBool aAudioEnabled )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() entering" ) );
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoAudioL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized );
+        User::Leave( KErrNotReady );
+        }
+
+    iVideoAudioEnabledPrep = aAudioEnabled;
+    iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+    iPrepPars = ETrue;
+    iVideoRecorder->Prepare();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoAudio
+// Calls Video Recorder API AudioEnabledL().
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::VideoAudio() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoAudio()" ) );
+
+    TBool audioEnabled( EFalse );
+    if ( iVideoRecorder )
+        {
+        TRAPD( error, { audioEnabled = iVideoRecorder->AudioEnabledL(); } );
+        if ( error != KErrNone ) 
+            {
+            audioEnabled = EFalse;
+            }
+        }
+    return audioEnabled;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoTimesIntervalL
+// Converts from TTimeIntervalMicroSeconds used in the interface to 
+// TTimeIntervalMicroSeconds32 used internally.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoTimesIntervalL( 
+    TTimeIntervalMicroSeconds aInterval )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL()" ) );
+
+    if ( iVideoRecordingRunning ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL leaving KErrNotReady, iVideoRecordingRunning=%d" ), iVideoRecordingRunning );
+        User::Leave( KErrNotReady );
+        }
+
+    // Note: KMaxTInt32 in microseconds is about 35 minutes
+    if ( aInterval < TTimeIntervalMicroSeconds( 0 ) || 
+         aInterval > TTimeIntervalMicroSeconds( KMaxTInt32 ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL leaving KErrArgument" ));
+        User::Leave( KErrArgument );
+        }
+
+    iVideoTimesInterval = I64INT( aInterval.Int64() );
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoTimesInterval
+// Converts to TTimeIntervalMicroSeconds used in the interface from  
+// TTimeIntervalMicroSeconds32 used internally.
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeEngineImp::VideoTimesInterval() const 
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoTimesInterval()" ) );
+    
+    TInt64 intInterval = iVideoTimesInterval.Int();
+
+    TTimeIntervalMicroSeconds interval( intInterval );
+
+    return interval;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartVideoRecording
+// Calls Video Recorder API Record().
+// Starts generating video recording time information for the client.
+// Finally calls McaeoVideoRecordingOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() entering" ) );
+
+    TInt error( KErrNone );
+
+    if ( iVideoPrepared && !iVideoRecordingRunning ) 
+        {
+        iVideoRecordingRunning = ETrue;
+        iVideoRecordingPaused = EFalse;
+        
+ 		// Reset previous time information
+    	iPrevTimeElapsed = 0;
+    	iPrevTimeRemaining = 0;
+    	
+       // Start video recording.
+        iVideoRecorder->Record();
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Start generating video recording time information for the client.
+            iVideoTimes->Start( KVideoTimesDelay,       // delay
+                                iVideoTimesInterval,    // interval
+                                *iVideoTimesCallback ); // callback
+            }
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+
+    iCaeObserver->McaeoVideoRecordingOn( error );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StopVideoRecording
+// Calls Video Recorder API Record(), DurationL(), and RecordTimeAvailable().
+// Stops generating video recording time information for the client.
+// Delivers video recording time info to the client once right after stopping, 
+// by calling McaeoVideoRecordingTimes().
+// Finally calls McaeoVideoRecordingComplete().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StopVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() entering" ) );
+        
+    TInt stoppingError( KErrNone );
+    TInt asyncStopErr( KErrNone );
+    
+    if ( iVideoRecordingRunning ) 
+        {
+        TInt timesError( KErrNone );
+        TTimeIntervalMicroSeconds timeElapsed( 0 );
+                
+        iVideoRecordingRunning = EFalse;
+        
+        // Stop generating video recording time information for the client. 
+        iVideoTimes->Cancel();
+        
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Query elapsed time before stop (it is set to zero after stop).
+            TRAP( timesError, { timeElapsed = iVideoRecorder->DurationL(); } );
+            // Possible error is ignored locally because not so crucial. Error code is delivered by call-back.
+            }
+                    
+        // Stop video recording.
+        if ( iAsyncVideoStopEnabled )
+            {
+       		LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording(). using custom command ECamCControllerCCVideoStopAsync" )); 
+            asyncStopErr = iVideoRecorder->CustomCommandSync( TMMFMessageDestination( iVideoControllerUid, KMMFObjectHandleController ), 
+                                                        ECamCControllerCCVideoStopAsync, 
+                                                        KNullDesC8, 
+                                                        KNullDesC8 );
+       		if ( asyncStopErr ) // async stop was not supported, use sync stop
+       		    {
+           		LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). async stop err=%d, using sync stop" ), asyncStopErr); 
+                stoppingError = iVideoRecorder->Stop();
+                iCaeObserver->McaeoVideoRecordingStopped();
+       		    }
+            }
+        else
+            {
+            // Synchronous, quaranteed that video recording is stopped when returning.
+            stoppingError = iVideoRecorder->Stop();
+            }
+        
+        // Can't be paused anymore.
+        iVideoRecordingPaused = EFalse;
+
+        /*
+        #ifdef CAE_TEST_VERSION
+        // For simulating errors when compiled as special "test version".
+        CaeStopVideoRecordingError( stoppingError );
+        #endif
+        */
+        
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {    
+            // Query remaining time after stop.
+            TTimeIntervalMicroSeconds timeRemaining = iVideoRecorder->RecordTimeAvailable();
+            
+        	// The elapsed time could have been reseted to zero by the video recorder 
+        	// if there is stopping ongoing in video recorder, even if we do 
+        	// not have had the notification yet. In that case McaeoVideoRecordingTimes
+        	// should be called with previous valid values.
+        	if ( ( timeElapsed == 0 ) && ( iPrevTimeElapsed != 0 ) )
+        		{
+        		// Invalid time. Use previous time information
+       			LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). Got invalid elapsed time from the video recorder: %f s." ), 
+       				I64LOW( timeElapsed.Int64() ) * 1.0 / KOneSecond);
+       			LOGTEXT3( _L( "Cae: CCaeEngineImp::StopVideoRecording(). Use previous valid elapsed time %f s. and remaining time %f s." ), 
+       				I64LOW( iPrevTimeElapsed.Int64() ) * 1.0 / KOneSecond,  
+       				I64LOW( iPrevTimeRemaining.Int64() ) * 1.0 / KOneSecond );
+        		timeElapsed = iPrevTimeElapsed;
+        		timeRemaining =iPrevTimeRemaining;
+        		}
+       
+            // Deliver video times (elapsed, remaining) information.
+            iCaeObserver->McaeoVideoRecordingTimes( timeElapsed, timeRemaining, timesError );
+            }
+        }
+    else 
+        {
+        stoppingError = KErrNotReady;
+        }
+
+	// Reset previous time information
+    iPrevTimeElapsed = 0;
+    iPrevTimeRemaining = 0;
+
+    if ( !iAsyncVideoStopEnabled || asyncStopErr )
+        {
+        iCaeObserver->McaeoVideoRecordingComplete( stoppingError );
+        }
+
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PauseVideoRecording
+// Stops generating video recording time info for the client.
+// Calls Video Recorder API PauseL().
+// Delivers video recording time info to the client once right after pausing
+// by calling VideoRecordingTimesCallback() that calls Video Recorder API 
+// DurationL() and RecordTimeAvailable(), and then McaeoVideoRecordingTimes().
+// Finally calls McaeoVideoRecordingPaused().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PauseVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PauseVideoRecording() entering" ) );
+
+    TInt error( KErrNone );
+
+    if ( iVideoRecordingRunning && !iVideoRecordingPaused ) 
+        {
+        // Stop generating video recording time info for the client.
+        iVideoTimes->Cancel();
+        // Pause video recording.
+        TRAP( error, iVideoRecorder->PauseL() );
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Deliver video recording times (elapsed, remaining) info once.
+            VideoRecordingTimesCallback( this );
+            }
+        // Intentionally setting iVideoRecordingPaused after (possibly) calling VideoRecordingTimesCallback().
+        if ( error == KErrNone ) 
+            {
+            iVideoRecordingPaused = ETrue;
+            }
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+    iCaeObserver->McaeoVideoRecordingPaused( error );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PauseVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ResumeVideoRecording
+// Calls Video Recorder API Record().
+// Starts generating video recording time information for the client.
+// Finally calls McaeoVideoRecordingOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ResumeVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResumeVideoRecording() entering" ) );
+
+    TInt error( KErrNone );
+
+    if ( iVideoRecordingRunning && iVideoRecordingPaused ) 
+        {
+        // Start video recording.
+        iVideoRecorder->Record();
+        iVideoRecordingPaused = EFalse;
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Start generating video recording time information for the client.
+            iVideoTimes->Start( KVideoTimesDelay,       // delay
+                                iVideoTimesInterval,    // interval
+                                *iVideoTimesCallback ); // callback
+            }
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+    iCaeObserver->McaeoVideoRecordingOn( error );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResumeVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RemainingVideoRecordingTime
+// Calls Video Recorder API RecordTimeAvailable().
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeEngineImp::RemainingVideoRecordingTime() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::RemainingVideoRecordingTime()" ) );
+    
+    TTimeIntervalMicroSeconds remaining( 0 );
+    if ( iVideoRecorder )
+        {
+        remaining = iVideoRecorder->RecordTimeAvailable();
+        }
+    return remaining;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::IsVideoRecording
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::IsVideoRecording() const
+    {
+    return iVideoRecordingRunning;    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoRecordingL
+// Overloading version with audio bit rate argument.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoRecordingL( 
+    const TSize&  aFrameSize, 
+    TReal32       aFrameRate, 
+    TInt          aBitRate, 
+    TBool         aAudioEnabled,
+    TInt          aAudioBitRate, 
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier, 
+    const TDesC8& aVideoType, 
+    const TDesC8& aAudioType )
+    {
+    // Memorize video audio bit rate value to be prepared.
+    iVideoAudioBitRatePrep = aAudioBitRate;
+    // Force audio bit rate preparation.
+    iPrepareVideoAudioBitRate = ETrue;
+
+    // Call the version without audio bit rate argument.
+    // This is possible because the separate PrepareVideoSettingsL() is doing
+    // settings after succesfull opening of video recording.
+    PrepareVideoRecordingL( aFrameSize, 
+                            aFrameRate, 
+                            aBitRate, 
+                            aAudioEnabled, 
+                            aMimeType, 
+                            aPreferredSupplier, 
+                            aVideoType, 
+                            aAudioType );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoOpenComplete
+// The status of the video recorder after initialisation.
+// This is either KErrNone if the open has completed successfully,
+// or one of the system wide error codes
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::MvruoOpenComplete( 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMvruoOpenCompleteError( aError );
+    #endif    
+
+    if ( aError == KErrNone )
+        {
+        // To get default video audio bit rate.
+        TRAP( aError, { iVideoAudioBitRate = iVideoRecorder->AudioBitRateL(); } );
+        // (ignore possible error)
+        // Prepare settings only if no errors in opening.
+        TRAP( aError, PrepareVideoSettingsL() );
+        if ( aError != KErrNone ) 
+            {
+            iCaeObserver->McaeoVideoPrepareComplete( aError );
+            }
+        }
+    else
+        {
+        iCaeObserver->McaeoVideoPrepareComplete( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoPrepareComplete
+// Notification that video recorder is ready to begin recording. This callback
+// is generated in response to a call to VR's Prepare.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::MvruoPrepareComplete( 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMvruoPrepareCompleteError( aError );
+    #endif    
+
+    if ( iVideoOpened && ( aError == KErrNone ) )
+        {
+        iVideoPrepared = ETrue; // Later errors with settings after 
+                                // do not change the value.
+        }
+
+    if ( iPrepPars )
+        {
+        iPrepPars = EFalse;
+        // If no error, then fresh parameters are valid.
+        // Otherwise, old parameters are kept.
+        if ( aError == KErrNone )
+            {
+            *iVideoFrameSize    = *iVideoFrameSizePrep;
+            iVideoFrameRate     = iVideoFrameRatePrep;
+            iVideoBitRate       = iVideoBitRatePrep;
+            iVideoAudioEnabled  = iVideoAudioEnabledPrep;
+            iVideoAudioBitRate  = iVideoAudioBitRatePrep;
+            iMaxClipSizeInBytes = iMaxClipSizeInBytesPrep;
+            }
+        else 
+            {
+            *iVideoFrameSizePrep    = *iVideoFrameSize;
+            iVideoFrameRatePrep     = iVideoFrameRate;
+            iVideoBitRatePrep       = iVideoBitRate;
+            iVideoAudioEnabledPrep  = iVideoAudioEnabled;
+            iVideoAudioBitRatePrep  = iVideoAudioBitRate;
+            iMaxClipSizeInBytesPrep = iMaxClipSizeInBytes;
+            }
+        }
+
+    iCaeObserver->McaeoVideoPrepareComplete( aError );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoRecordComplete
+// Notification that video recording has completed. This is not called if 
+// recording is explicitly stopped by calling Stop.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::MvruoRecordComplete( 
+    TInt aError )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() entering, aError=%d, iVideoRecordingRunning=%d" ), aError, iVideoRecordingRunning );
+    
+    // Stop generating video recording time information for the client. 
+    iVideoTimes->Cancel();
+    // Recording stopped: can't be paused anymore.
+    iVideoRecordingPaused = EFalse; 
+        
+ 	// Reset previous time information
+    iPrevTimeElapsed = 0;
+    iPrevTimeRemaining = 0;
+    	
+    if ( iVideoRecordingRunning || iAsyncVideoStopEnabled ) // To ensure that McaeoVideoRecordingComplete 
+        {                                                   // gets called just once per recording.
+        iVideoRecordingRunning = EFalse;
+        
+        #ifdef CAE_TEST_VERSION
+        // For simulating errors when compiled as special "test version".
+        CaeMvruoRecordCompleteError( aError );
+        #endif
+        
+        // Close video recording always in error case. Otherwise the camcorder plugin would
+        // be in indeterminated state. 
+        // The code KErrCompletion means that video reocording has been completed by timer
+        if ( aError && aError != KErrCompletion && aError != KErrDiskFull ) 
+        	{ 
+        	CloseVideoRecording();
+        	}
+        	
+        // In async stop mode call also the other call-back to play stop sound
+        if ( iAsyncVideoStopEnabled )
+            {
+            iCaeObserver->McaeoVideoRecordingStopped();
+            }
+        iCaeObserver->McaeoVideoRecordingComplete( aError );
+        }
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoEvent
+// Event Notification from controller 
+// -----------------------------------------------------------------------------
+//
+
+void CCaeEngineImp::MvruoEvent( 
+    const TMMFEvent& aEvent )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoEvent() entering, uid=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode );
+    
+    if ( aEvent.iEventType.iUid == KCamCControllerCCVideoRecordStopped.iUid )
+        {
+        iCaeObserver->McaeoVideoRecordingStopped();
+        }
+    else if ( aEvent.iEventType.iUid == KCamCControllerCCVideoFileComposed.iUid )
+        {
+        iCaeObserver->McaeoVideoRecordingComplete( aEvent.iErrorCode );
+        }
+    else
+        {
+        // Send others events as error to UI 
+        iVideoPrepared = EFalse;    // mark that re-preparation is needed 
+        iCaeObserver->McaeoVideoPrepareComplete( aEvent.iErrorCode );
+        }
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoEvent() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CancelVideoRecording
+// Calls Video Recorder API Stop().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CancelVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() entering" ) );
+    
+    if ( iVideoRecordingRunning ) 
+        {
+        // This also prevents McaeoVideoRecordingComplete() call from MvruoRecordComplete()  
+        // and McaeoVideoRecordingTimes() call from VideoRecordingTimesCallback().
+        iVideoRecordingRunning = EFalse;
+        // Stop generating video recording time information for the client. 
+        iVideoTimes->Cancel();
+        
+ 		// Reset previous time information
+    	iPrevTimeElapsed = 0;
+    	iPrevTimeRemaining = 0;
+    	
+        // Stop video recording. Do not call McaeoVideoRecordingComplete()
+        (void) iVideoRecorder->Stop();
+        iVideoRecordingPaused = EFalse;
+        }
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoSettingsL
+// Calls Video Recorder API setting methods to set video recording paramaters.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoSettingsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() entering" ) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaePrepareVideoSettingsErrorL();
+    #endif    
+
+    iVideoRecorder->SetVideoFrameSizeL( *iVideoFrameSizePrep );
+    iVideoRecorder->SetVideoFrameRateL( iVideoFrameRatePrep );
+    iVideoRecorder->SetVideoBitRateL( iVideoBitRatePrep );
+    iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+    if ( iPrepareVideoAudioBitRate )
+        {
+        iVideoRecorder->SetAudioBitRateL( iVideoAudioBitRatePrep );
+        iPrepareVideoAudioBitRate = EFalse;
+        }
+    iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+
+    // Set the recording gain to the maximum
+    TInt gain = iVideoRecorder->GainL();
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL was %d" ), gain );
+    gain = iVideoRecorder->MaxGainL();
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() MaxGainL is %d" ), gain );
+    iVideoRecorder->SetGainL( gain );
+    gain = iVideoRecorder->GainL();
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL set to %d" ), gain );
+
+    iPrepPars = ETrue;
+    iVideoRecorder->Prepare();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::FindVideoUidsL
+// Finds UIDs for opening video recording. Uses ECOM.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::FindVideoUidsL(
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() entering" ) );
+
+    iVideoControllerUid.iUid = 0;
+    iVideoFormatUid.iUid = 0; 
+
+    // Retrieve a list of possible controllers from ECOM.
+    //
+    // Controller must support recording the requested mime type.
+    // Controller must be provided by preferred supplier.
+
+    CMMFControllerPluginSelectionParameters* cSelect = 
+        CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters* fSelect = 
+        CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL( aMimeType );
+    cSelect->SetRequiredRecordFormatSupportL( *fSelect );
+    cSelect->SetPreferredSupplierL( aPreferredSupplier,
+       CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned );
+
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL( controllers );
+    cSelect->ListImplementationsL( controllers );
+
+    if ( controllers.Count() < 1 )
+        {
+        // No appropriate controllers found.
+        LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() leaving KErrNotSupported (no controllers found)" ) );
+        User::Leave( KErrNotSupported );
+        }
+
+    // Get the controller UID.
+    iVideoControllerUid = controllers[0]->Uid();
+
+    // Inquires the controller about supported formats.
+    // We use the first controller found having index 0.
+    RMMFFormatImplInfoArray formats;
+    formats = controllers[0]->RecordFormats();
+
+    // Get the first format that supports our mime type.
+    
+    TBool found( EFalse );
+
+    for ( TInt i = 0; i < formats.Count(); i++ )
+        {
+        if ( formats[i]->SupportsMimeType( aMimeType ) )
+            {
+            iVideoFormatUid = formats[i]->Uid(); // set the UID
+            found = ETrue;
+            break;
+            }
+        }
+    if ( !found )
+        {
+        // No appropriate video format found.
+        LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() leaving KErrNotSupported (no video format found)" ) );
+        User::Leave( KErrNotSupported );
+        }
+
+    CleanupStack::PopAndDestroy( 3, cSelect ); // cselect, fselect, controllers
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ConvertAndSetVideoAudioTypeL
+// Convert audio type from TDesC8 to TFourCC, set to iVideoAudioType.
+// -----------------------------------------------------------------------------
+//
+TFourCC CCaeEngineImp::ConvertAndSetVideoAudioTypeL(
+    const TDesC8& aAudioType )
+    {
+    if ( aAudioType == KNullDesC8 )
+        {
+        return KMMFFourCCCodeNULL;
+        }
+    else
+        {
+        if ( aAudioType.Length() != 4 ) 
+            {
+            User::Leave( KErrArgument );
+            }
+        return TFourCC( aAudioType[0], aAudioType[1], aAudioType[2], aAudioType[3] );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoRecordingTimesCallback
+// Calls Video Recorder API DurationL() and RecordTimeAvailable().
+// Finally calls McaeoVideoRecordingTimes().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::VideoRecordingTimesCallback( 
+    TAny* aEngineImp )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback() entering" ) );
+
+    CCaeEngineImp* thisEngineImp = static_cast<CCaeEngineImp*>( aEngineImp );
+
+    if ( thisEngineImp->iVideoRecordingRunning && !thisEngineImp->iVideoRecordingPaused )
+        {
+        // Query elapsed recording time.
+        TTimeIntervalMicroSeconds timeElapsed( 0 );
+        TRAPD( error, { timeElapsed = thisEngineImp->iVideoRecorder->DurationL(); } );
+        
+        // Query remaining recording time.
+        TTimeIntervalMicroSeconds timeRemaining = thisEngineImp->iVideoRecorder->RecordTimeAvailable();
+        	
+        // The elapsed time could have been reseted to zero by the video recorder 
+        // if there is stopping ongoing in video recorder, even if we do 
+        // not have had the notification yet. In that case McaeoVideoRecordingTimes
+        // should be called with previous valid values.
+        if ( ( timeElapsed == 0 ) && ( thisEngineImp->iPrevTimeElapsed != 0 ) )
+        	{
+        	// Invalid time. Use previous time information
+   			LOGTEXT2( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback(). Got invalid elapsed time from the video recorder: %f s." ), 
+   				I64LOW( timeElapsed.Int64() ) * 1.0 / KOneSecond);
+   			LOGTEXT3( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback(). Use previous valid elapsed time %f s. and remaining time %f s." ), 
+   				I64LOW( thisEngineImp->iPrevTimeElapsed.Int64() ) * 1.0 / KOneSecond,  
+   				I64LOW( thisEngineImp->iPrevTimeRemaining.Int64() ) * 1.0 / KOneSecond );
+        	timeElapsed = thisEngineImp->iPrevTimeElapsed;
+        	timeRemaining = thisEngineImp->iPrevTimeRemaining;
+        	}
+        else
+         	{
+         	// Store current time information
+        	thisEngineImp->iPrevTimeElapsed = timeElapsed;
+        	thisEngineImp->iPrevTimeRemaining = timeRemaining;
+        	}
+       
+       	// Deliver video recording times information.
+       	thisEngineImp->iCaeObserver->McaeoVideoRecordingTimes( timeElapsed, timeRemaining, error );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback() returning" ) );
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------
+// CCaeEngineImp::EnumerateVideoFrameSizeL
+// Checks that camera HW supports given framesize
+// ---------------------------------------------------------
+//
+TInt CCaeEngineImp::EnumerateVideoFrameSizeL(const TSize& aSize)
+    {
+
+    LOGTEXT3( _L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), In, size: %dx%d"), aSize.iWidth, aSize.iHeight );
+
+    TCameraInfo cameraInfo;
+    iCamera->CameraInfo( cameraInfo );
+    
+    TSize size;
+    TInt i = 0;
+    TInt j = 0;
+    TInt sizeIndex = -1;
+
+    if ( cameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+        {
+        // check YUV420 planar
+        for ( i = 0; i < cameraInfo.iNumVideoFrameSizesSupported; i++ )
+            {
+            iCamera->EnumerateVideoFrameSizes(size, i, CCamera::EFormatYUV420Planar);
+			LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV420Planar %d x %d found from camera"), size.iWidth, size.iHeight ); 
+        
+            if ( size == aSize )
+                {
+				LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV420Planar %d x %d Matched."), size.iWidth, size.iHeight ); 
+                sizeIndex = i;
+                break;
+                }
+            }
+        }
+    else
+    	{
+		LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera doesn't support EFormatYUV420Planar"));
+    	}
+
+    if ( cameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV422 )
+        {
+        // check YUV422 interleaved
+        for ( j = 0; j < cameraInfo.iNumVideoFrameSizesSupported; j++ )
+            {
+            iCamera->EnumerateVideoFrameSizes(size, j, CCamera::EFormatYUV422 );
+			LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV422 %d x %d found from camera"), size.iWidth, size.iHeight );
+        
+            if ( size == aSize )
+                {
+                LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV422 %d x %d Matched."), size.iWidth, size.iHeight );
+                sizeIndex = j;
+                break;
+                }
+            }
+        }
+    else
+    	{
+		LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera doesn't support EFormatYUV422"));	
+    	}
+
+    if ( sizeIndex == -1 )
+        {
+        LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), Camera does not support this resolution"));
+        }
+
+
+    LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), Out"));
+    return ( sizeIndex );
+    }
+
+// ---------------------------------------------------------
+// CCaeEngineImp::SetAsyncVideoStopMode
+// Enables/disables async stopping
+// ---------------------------------------------------------
+//
+TInt CCaeEngineImp::SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled )
+    {
+    LOGTEXT2( _L("Cae: CCaeEngineImp::SetAsyncVideoStop(%d) entering"), aAsyncVideoStopEnabled );
+    TInt err;
+
+    // Check if async stopping is supported
+    if ( iVideoControllerUid == KCamCControllerImplementationUid ) 
+        {
+        iAsyncVideoStopEnabled = aAsyncVideoStopEnabled; 
+        err = KErrNone;
+        }
+    else
+        {
+        err = KErrNotSupported;
+        }
+
+    LOGTEXT2(_L("Cae: CCaeEngineImp::SetAsyncVideoStop() err=%d, returning"), err);
+    return ( err );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeExtension.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Extension creation proxy
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineExtInterface.h"                   // Engine implementation header.
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// class MExtension
+
+// -----------------------------------------------------------------------------
+// MExtension::NewExtensionL
+// Create and construct the extension object via ECom.
+// -----------------------------------------------------------------------------
+// 
+MExtension* MExtension::NewExtensionL( TUid aImplementationUid, MExtensionCallbackInterface* aEngine  )
+	{
+	TAny* extInterface = REComSession::CreateImplementationL( 
+		aImplementationUid, _FOFF (MExtension, iDtor_ID_Key), (TAny*) aEngine);
+	return reinterpret_cast <MExtension*> (extInterface);
+	}
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeImageItem.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item for Camera Application Engine
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeImageItem.h"                   // Still image item class.
+#include <fbs.h>                            // For CFbsBitmap
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItem::CCaeImageItem
+// -----------------------------------------------------------------------------
+//
+CCaeImageItem::CCaeImageItem( RHeap& aImageHeap ) 
+	: iImageHeap( aImageHeap ) 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItem::~CCaeImageItem
+// Destroys image queue.
+// -----------------------------------------------------------------------------
+//
+CCaeImageItem::~CCaeImageItem()
+    {
+    delete iBitmap;
+    iImageHeap.Free(iImageData);
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeImageItemExtPro.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item Extension Processing for Camera Application Engine
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeImageItemExtPro.h"             // Still image item class.
+#include <fbs.h>                            // For CFbsBitmap
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItemExtPro::CCaeImageItemExtPro
+// -----------------------------------------------------------------------------
+//
+CCaeImageItemExtPro::CCaeImageItemExtPro() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItemExtPro::CCaeImageItemExtPro
+// Destroys image data.
+// -----------------------------------------------------------------------------
+//
+CCaeImageItemExtPro::~CCaeImageItemExtPro()
+    {
+    delete iBitmap;
+    delete iImageData;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeImageQueueExtPro.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine image queue extension processing class
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"                   // For LOGTEXT
+#include <fbs.h>                            // For CFbsBitmap
+
+#include "CaeImageQueueExtPro.h"            // Still image burst capturing class.
+#include "CaeImageItemExtPro.h"             // Still image item class.
+
+
+// CONSTANTS
+const TInt KCaeStillBurstImageQueueGranularity = 6; // optimized count of burst images
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::NewL
+// -----------------------------------------------------------------------------
+//
+CCaeImageQueueExtPro* CCaeImageQueueExtPro::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::NewL() entering" ) );
+
+    CCaeImageQueueExtPro* self = new( ELeave ) CCaeImageQueueExtPro;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::CCaeImageQueueExtPro
+// Destroys image queue.
+// -----------------------------------------------------------------------------
+//
+CCaeImageQueueExtPro::~CCaeImageQueueExtPro()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::CaeImageQueueExtPro() entering" ) );
+
+    ResetAndDestroyImages();
+    delete iImageQueue;
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::CaeImageQueueExtPro() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::CaeImageQueueExtPro
+// -----------------------------------------------------------------------------
+//
+CCaeImageQueueExtPro::CCaeImageQueueExtPro() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::ConstructL
+// Allocates image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeImageQueueExtPro::ConstructL()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::ConstructL() entering" ) );
+
+    iImageQueue = new( ELeave ) RPointerArray<CCaeImageItemExtPro>( 
+        KCaeStillBurstImageQueueGranularity );
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::ConstructL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::AppendImage
+// Appends an image item object to image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeImageQueueExtPro::AppendImage( 
+    CFbsBitmap*  aBitmap, 
+    HBufC8*      aImageData,
+    TBool        aLastImage,
+    TBool        aSnapImage )
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::AppendImage() entering" ) );
+
+    TInt result( KErrNone );
+
+    CCaeImageItemExtPro* imageItem = new CCaeImageItemExtPro();
+    if ( imageItem ) 
+        {
+        // Move image data to image item
+        imageItem->iImageData = aImageData;
+        imageItem->iBitmap = aBitmap;
+        imageItem->iLastImage = aLastImage;
+        imageItem->iSnapImage = aSnapImage;
+
+        // Add image to the queue.
+        result = iImageQueue->Append( imageItem );
+        if ( result != KErrNone ) 
+            {
+            // In case of error, delete only imageItem, not the actual data
+            imageItem->iBitmap = NULL;
+            imageItem->iImageData = NULL;
+            delete imageItem;
+            imageItem = NULL;
+            }
+        }
+    else 
+        {
+        result = KErrNoMemory;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::AppendImage() returning" ) );
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::ImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeImageQueueExtPro::ImageCount() const
+    {
+    // Return the count of image items.
+    return iImageQueue->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::GetNextImage
+// Fetches and deletes the next image from image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeImageQueueExtPro::GetNextImage( 
+    CFbsBitmap*&   aBitmap,     // output
+    HBufC8*&       aImageData,  // output
+    TBool&         aLastImage,  // output
+    TBool&         aSnapImage ) // output
+    {
+    LOGTEXT2( _L( "Cae: CCaeImageQueueExtPro::GetNextImage() entering, %d images in queue" ), iImageQueue->Count() );
+
+    TInt error( KErrNone );
+
+    if ( iImageQueue->Count() > 0 )
+        {
+        // Get image data and bitmap pointer from the queue image item.
+        aImageData = (*iImageQueue)[0]->iImageData;
+        aBitmap    = (*iImageQueue)[0]->iBitmap;
+        aLastImage = (*iImageQueue)[0]->iLastImage;
+        aSnapImage = (*iImageQueue)[0]->iSnapImage;
+
+        // Do not delete the data. Delete the image item and remove from queue.
+        (*iImageQueue)[0]->iBitmap = NULL;
+        (*iImageQueue)[0]->iImageData = NULL;
+        delete (*iImageQueue)[0];
+        iImageQueue->Remove( 0 );
+        }
+    else 
+        {
+        aBitmap = NULL;
+        aImageData = NULL;
+        aLastImage = EFalse;
+        aSnapImage = EFalse;
+        error = KErrUnderflow;
+        }
+
+    LOGTEXT2( _L( "Cae: CCaeImageQueueExtPro::GetNextImage() returning: %d" ), error );
+
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::ResetAndDestroyImages()
+// Reset and destroy image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeImageQueueExtPro::ResetAndDestroyImages()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::ResetAndDestroyImages()" ) );
+
+    if ( iImageQueue ) 
+        {
+        // Reset and destroy the image items from queue.
+        iImageQueue->ResetAndDestroy();
+        }
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeQualityLevels.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine imaging quality level and container
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeQualityLevels.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeQualityLevelsCont::CCaeQualityLevelsCont
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeQualityLevelsCont::CCaeQualityLevelsCont()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeQualityLevelsCont::~CCaeQualityLevelsCont
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeQualityLevelsCont::~CCaeQualityLevelsCont()
+    {
+    }
+
+
+/////////////////////////////
+// CQualityLevel methods 
+/////////////////////////////
+
+
+// -----------------------------------------------------------------------------
+// CQualityLevel::CQualityLevel
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CQualityLevel::CQualityLevel()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CQualityLevel::~CQualityLevel
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CQualityLevel::~CQualityLevel()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeQualityLevelsNoSd.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine imaging quality levels container 
+*                methods without Shared Data ini-file support.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeQualityLevels.h"
+
+#include "CaeEngineImp.h"       // For LOGTEXT
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeQualityLevelsCont::InitFromSdL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeQualityLevelsCont::InitFromSdL( 
+    const TUid&  /*aSdUidQltyLevels*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeQualityLevelsCont::InitFromSdL(): NOT SUPPORTED, leaving" ) );
+
+    User::Leave( KErrNotSupported );
+
+    return 0;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeQualityLevelsCont::FetchQualityLevelL
+// ---------------------------------------------------------------------------
+//
+void CCaeQualityLevelsCont::FetchQualityLevelL( 
+    RSharedDataClient& /*aSharedData*/, 
+    const TUid&        /*aSdUidQltyLevels*/, 
+    TInt               /*aIndex*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeQualityLevelsCont::FetchQualityLevelL(): NOT SUPPORTED, leaving" ) );
+
+    User::Leave( KErrNotSupported );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillBurst.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,353 @@
+/*
+* Copyright (c) 2003,2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image burst class
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"                   // For LOGTEXT
+#include <fbs.h>                            // For CFbsBitmap
+#include <hal.h>                            // For HAL
+
+#include "CaeStillBurst.h"                  // Still image burst capturing class.
+#include "CaeImageItem.h"                   // Still image item class.
+
+
+// CONSTANTS
+const TInt KCaeStillBurstImageQueueGranularity = 6;
+const TInt KCaeMinImageHeapSize = 0; 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::NewL
+// -----------------------------------------------------------------------------
+//
+CCaeStillBurst* CCaeStillBurst::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillBurst::NewL() entering" ) );
+
+    CCaeStillBurst* self = new( ELeave ) CCaeStillBurst;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::~CCaeStillBurst
+// Destroys image queue.
+// -----------------------------------------------------------------------------
+//
+CCaeStillBurst::~CCaeStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillBurst::~CCaeStillBurst() entering" ) );
+
+    ResetAndDestroyImages();
+
+    if ( iImageHeap )
+        {
+        iImageHeap->Close();
+        }
+
+    delete iImageQueue;
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::~CCaeStillBurst() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::CCaeStillBurst
+// -----------------------------------------------------------------------------
+//
+CCaeStillBurst::CCaeStillBurst() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::ConstructL
+// Allocates image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillBurst::ConstructL()
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::ConstructL() entering, min heap: %d" ), KCaeMinImageHeapSize );
+
+    iImageQueue = new( ELeave ) RPointerArray<CCaeImageItem>( 
+        KCaeStillBurstImageQueueGranularity );
+
+    TInt maxMem;
+    User::LeaveIfError( HAL::Get( HAL::EMemoryRAM, maxMem ) );
+    #if (defined (__WINS__) || defined (__WINSCW__))
+    maxMem /= 2; // Fix emulator -4 error
+    #endif
+
+    iImageHeap = User::ChunkHeap( NULL, KCaeMinImageHeapSize, maxMem );
+
+    #ifdef _DEBUG
+    if ( !iImageHeap )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillBurst::ConstructL() Error: Cannot create iImageHeap !" ) );
+        }
+    #endif
+
+    User::LeaveIfNull( iImageHeap );
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::ConstructL() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::SetLengthL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillBurst::SetLengthL( 
+    TInt aLength )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::SetLengthL(): length: %d" ), aLength );
+
+    // Leave if not supported.
+    if ( aLength < 1 )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillBurst::SetLengthL(): leaving KErrArgument" ));
+        User::Leave( KErrArgument );
+        }
+
+    iDesiredLength = aLength;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::Length
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::Length() const
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::Length(): length: %d" ), iDesiredLength );
+
+    return iDesiredLength;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::AppendImage
+// Appends an image item object to image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::AppendImage( 
+    CFbsBitmap*  aBitmap, 
+    HBufC8*      aImageData, 
+    TInt         aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::AppendImage() entering: %d" ), aError );
+
+    TInt result( KErrNone );
+
+    CCaeImageItem* imageItem = new CCaeImageItem( *iImageHeap );
+    if ( imageItem ) 
+        {
+        if (aImageData)
+            {
+            // Copy image data from HBufC8 to image heap
+            imageItem->iImageData = iImageHeap->Alloc( aImageData->Size() );
+            if ( imageItem->iImageData )
+                {
+                imageItem->iImageDataSize = aImageData->Size();
+                Mem::Copy( imageItem->iImageData, aImageData->Ptr(), 
+                    imageItem->iImageDataSize );
+                }
+            else
+                {
+                result = KErrNoMemory;
+                }
+            }
+        if ( result == KErrNone ) 
+            {
+            imageItem->iBitmap = aBitmap;
+            imageItem->iError  = aError;
+            // Add image to the queue.
+            result = iImageQueue->Append( imageItem );
+            }
+        if ( result == KErrNone ) 
+            {
+            iCountOfBurstAppends++;
+            LOGTEXT2( _L( "Cae: CCaeStillBurst::AppendImage(): count of burst appends = %d" ), iCountOfBurstAppends );
+
+            // Given aImageData can be deleted now as it has successfully 
+            // been copied to imageItem->iImageData
+            delete aImageData;
+            }
+        else
+            {
+            // Do not delete the bitmap if error, delete just imageItem 
+            // which deletes also iImageData.
+            imageItem->iBitmap = NULL;
+            delete imageItem;
+            imageItem = NULL;
+            }
+        }
+    else 
+        {
+        result = KErrNoMemory;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::AppendImage() returning" ) );
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::CaptureCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::CaptureCount() const
+    {
+    // Return the count of appends (captures) made.
+    return iCountOfBurstAppends;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::ImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::ImageCount() const
+    {
+    // Return the count of image items.
+    return iImageQueue->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::GetNextImage
+// Fetches and deletes the next image from image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::GetNextImage( 
+    CFbsBitmap*&   aBitmap,     // output
+    HBufC8*&       aImageData,  // output
+    TInt&          aError )     // output
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::GetNextImage() entering, %d images in queue" ), iImageQueue->Count() );
+
+    TInt error( KErrNone );
+
+    if ( iImageQueue->Count() > 0 )
+        {
+
+        if ( (*iImageQueue)[0]->iImageData )
+            {
+            // Copy image data from queue image item.
+            aImageData = HBufC8::New( (*iImageQueue)[0]->iImageDataSize );
+            if ( aImageData )
+                {
+                aImageData->Des().Copy( (TUint8*)(*iImageQueue)[0]->iImageData, 
+                    (*iImageQueue)[0]->iImageDataSize );
+                }
+            else
+                {
+                error = KErrNoMemory;
+                }
+            }
+
+        if ( error == KErrNone )
+            {
+            // Get bitmap pointer and image error value from the queue image item.
+            aBitmap     = (*iImageQueue)[0]->iBitmap;
+            aError      = (*iImageQueue)[0]->iError;
+
+            #ifdef _DEBUG
+            if ( aError )
+                {
+                LOGTEXT2( _L( "Cae: CCaeStillBurst::GetNextImage(): This image has error: %d" ), aError );
+                }
+            #endif
+
+            // Do not delete the bitmap. Delete the image item which deletes iImageData also.
+            (*iImageQueue)[0]->iBitmap = NULL;
+            delete (*iImageQueue)[0];
+            iImageQueue->Remove( 0 );
+            }
+
+        if ( ( iImageQueue->Count() == 0 ) || error ) 
+            {
+            // Give free memory to system from the top of heap.
+            iImageHeap->Compress(); 
+            LOGTEXT( _L( "Cae: CCaeStillBurst::GetNextImage(): last image fetched, compressed the heap" ) );
+            MEM();
+            }
+        }
+    else 
+        {
+        aBitmap = NULL;
+        aImageData = NULL;
+        error = KErrUnderflow;
+        }
+
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::GetNextImage() returning: %d" ), error );
+
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::IsBurstCaptured
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillBurst::IsBurstCaptured() const
+    {
+    TBool isComplete( EFalse );
+    if ( iCountOfBurstAppends >= iDesiredLength )
+        {
+        isComplete = ETrue;
+        }    
+    return isComplete;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::ResetAndDestroyImages()
+// Reset and destroy image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillBurst::ResetAndDestroyImages()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillBurst::ResetAndDestroyImages()" ) );
+
+    if ( iImageQueue ) 
+        {
+        // Reset and destroy the image items from queue.
+        iImageQueue->ResetAndDestroy();
+        }
+    if ( iImageHeap )
+        {
+        iImageHeap->Compress(); // Give free memory to system from the top of heap
+        }
+    iCountOfBurstAppends = 0;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillQualityLevels.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image quality level and container
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeStillQualityLevels.h"
+
+#include "CaeEngineImp.h"       // For LOGTEXT
+
+
+// CONSTANTS
+const TInt KQualityLevelArrayGranularity = 3;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::CCaeStillQualityLevelsCont
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeStillQualityLevelsCont::CCaeStillQualityLevelsCont()
+: iQltyLevelCountSdKey( KCaeStillQltyLevelCount )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::~CCaeStillQualityLevelsCont
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeStillQualityLevelsCont::~CCaeStillQualityLevelsCont()
+    {
+    delete iQualityLevels;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::ConstructL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::ConstructL() entering" ) );
+
+    iQualityLevels = new( ELeave ) CArrayFixFlat<CStillQualityLevel>( KQualityLevelArrayGranularity );
+
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::ConstructL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeStillQualityLevelsCont* CCaeStillQualityLevelsCont::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::NewL() entering" ) );
+
+    CCaeStillQualityLevelsCont* self = new( ELeave ) CCaeStillQualityLevelsCont;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::InitDefaultsL
+// Sets hardcoded default parameters for default still quality levels that 
+// are created.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillQualityLevelsCont::InitDefaultsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::InitDefaultsL() entering" ) );
+
+    // Delete all elements from the array and 
+    // free the memory allocated to the array buffer.
+    iQualityLevels->Reset();
+
+    // Initialize hardcoded default quality levels.
+
+    TSize size;
+
+    CStillQualityLevel* stillQualityLevel = new( ELeave ) CStillQualityLevel;
+    CleanupStack::PushL( stillQualityLevel );
+
+    // Level 0:
+    size.SetSize( KCaeImgWidthVGA, KCaeImgHeightVGA );
+    stillQualityLevel->iFrameSize = size;
+    stillQualityLevel->iOutputFormat = CCamera::EFormatJpeg;
+    stillQualityLevel->iCompressionQuality = 90; // From range [0,100] [worst,best]
+    stillQualityLevel->iByteSize = 90000; // Estimate only for a typical size in bytes.
+    stillQualityLevel->iKey = KCaeStillQltyLevel0;
+    iQualityLevels->AppendL( *stillQualityLevel );
+
+    // Level 1:
+    size.SetSize( KCaeImgWidthVGA, KCaeImgHeightVGA );
+    stillQualityLevel->iFrameSize = size;
+    stillQualityLevel->iOutputFormat = CCamera::EFormatJpeg;
+    stillQualityLevel->iCompressionQuality = 50; // From range [0,100] [worst,best]
+    stillQualityLevel->iByteSize = 35000; // Estimate only for a typical size in bytes.
+    stillQualityLevel->iKey = KCaeStillQltyLevel1;
+    iQualityLevels->AppendL( *stillQualityLevel );
+
+    // Level 2:
+    size.SetSize( KCaeImgWidthQQVGA, KCaeImgHeightQQVGA );
+    stillQualityLevel->iFrameSize = size;
+    stillQualityLevel->iOutputFormat = CCamera::EFormatJpeg;
+    stillQualityLevel->iCompressionQuality = 90; // From range [0,100] [worst,best]
+    stillQualityLevel->iByteSize = 12000; // Estimate only for a typical size in bytes.
+    stillQualityLevel->iKey = KCaeStillQltyLevel2;
+    iQualityLevels->AppendL( *stillQualityLevel );
+
+    CleanupStack::PopAndDestroy( stillQualityLevel );
+    
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::InitDefaultsL() returning" ) );
+
+    return iQualityLevels->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::Count
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillQualityLevelsCont::Count() const
+    {
+    return iQualityLevels->Count();
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::At
+// -----------------------------------------------------------------------------
+//
+CStillQualityLevel& CCaeStillQualityLevelsCont::At( 
+    TInt aIndex ) const 
+    {
+    return iQualityLevels->At( aIndex );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::Key
+// -----------------------------------------------------------------------------
+//
+const TDes& CCaeStillQualityLevelsCont::Key( 
+    TInt aIndex ) const
+    {
+    return iQualityLevels->At( aIndex ).iKey;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::ResizeL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::ResizeL( 
+    TInt aQualityLevelCount )
+    {
+    iQualityLevels->ResizeL( aQualityLevelCount );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::QltyLevelCountSdKey
+// -----------------------------------------------------------------------------
+//
+const TDesC& CCaeStillQualityLevelsCont::QltyLevelCountSdKey() const
+    {
+    return iQltyLevelCountSdKey;
+    }
+
+
+/////////////////////////////
+// CStillQualityLevel methods 
+/////////////////////////////
+
+
+// -----------------------------------------------------------------------------
+// CStillQualityLevel::CStillQualityLevel
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CStillQualityLevel::CStillQualityLevel()
+:CQualityLevel()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CStillQualityLevel::~CStillQualityLevel
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CStillQualityLevel::~CStillQualityLevel()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillQualityLevelsNoSd.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image quality levels container
+*                without Shared Data API support.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeStillQualityLevels.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::CreateQualityLevelString
+// Creates quality level string for SharedData Camera ini file.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::CreateQualityLevelString( 
+    TInt  /*aIndex*/,
+    TDes& /*aDefaultQualityLevel*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::ParseQualityLevelFromStringL
+// Parses quality level string to quality level object data.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::ParseQualityLevelFromStringL( 
+    const TDesC& /*aQualityLevelString*/, 
+    TInt         /*aIndex*/ )
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillStatesActive.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,2144 @@
+/*
+* Copyright (c) 2005 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still capture state machine implementation class
+*
+*/
+
+
+// INCLUDE FILES
+#include <hal.h>                    // For getting the display mode
+#include <ExifRead.h>
+#include "CaeStillStatesActive.h"
+#include "CaeImageQueueExtPro.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h" // For TEST_VERSION compilation only
+#endif
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CaeStillStatesActiveTraces.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::CCaeStillStatesActive()
+// C++ constructor.
+// Adds the object to the Active Scheduler.
+// ---------------------------------------------------------------------------
+//
+CCaeStillStatesActive::CCaeStillStatesActive( 
+    CCamera& aCamera,
+    const TCamAppEngineInfo& aInfo,
+    RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList )
+    : CActive( EPriorityStandard ), 
+      iCamera( aCamera ),
+      iInfo( aInfo ),
+      iProcessImageImplList( aProcessImageImplList ),
+      iStillInputFormat( CCamera::EFormatFbsBitmapColor16M ), 
+      iStillOutputFormat( CCamera::EFormatFbsBitmapColor16M ), 
+      iStillCompressionQuality( KCaeDefaultCompressionQuality ),
+      iCurrentExtensionIndex( -1 )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::~CCaeStillStatesActive()
+// Destructor. 
+// Cancels operation and closes the timer.
+// ---------------------------------------------------------------------------
+//
+CCaeStillStatesActive::~CCaeStillStatesActive()
+    {
+    Cancel();
+
+    iDelayedCallTimer.Close();
+    
+    DeleteStillBurst(); // Using this removes dependency to still burst class
+
+    CancelAndCleanup();
+
+    // Check that extensions handle flag registration properly
+    CAE_ASSERT_DEBUG( iRequireFullColorSnapInputImageRefCount == 0 );
+
+    delete iEmptySnapImage;
+
+    delete iStillDecoder;
+    delete iStillEncoder;
+
+	delete iSnapBitmap;
+	delete iBitmap;
+	delete iImageData;
+	delete iImageHeaderData;
+    delete iImageQueueExtPro;
+    iFs.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::NewL()
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCaeStillStatesActive* CCaeStillStatesActive::NewL( 
+    CCamera& aCamera,
+    const TCamAppEngineInfo& aInfo,
+    RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList )
+    {
+    CCaeStillStatesActive* self = new( ELeave ) CCaeStillStatesActive( aCamera, aInfo, 
+        aProcessImageImplList );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::ConstructL()
+// Symbian OS 2nd phase constructor that can leave.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ConstructL()
+    {
+    // Get native screen mode. This can be used as default mode for the snap bitmap.
+    iSnapImageColorMode = KCaeDefaultDisplayMode;
+    (void)GetSystemDisplayMode( iSnapImageColorMode );
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ConstructL(). Use display mode %d for the snap image" ), iSnapImageColorMode );
+
+    // Create still image encoder object, e.g. for JPEG encoding.
+    iStillEncoder = CCaeStillEncoder::NewL();
+    iStillEncoder->SetObserver( this );
+
+    // Create still image decoder object, e.g. for JPEG decoding.
+    iStillDecoder = CCaeStillDecoder::NewL();
+    iStillDecoder->SetObserver( this );
+
+    // This empty snap image is currently used just for error cases.
+    iEmptySnapImage = new( ELeave ) CFbsBitmap;
+
+    // Create timer 
+    iDelayedCallTimer.CreateLocal();
+    
+    // Connect to file server.
+    User::LeaveIfError( iFs.Connect() );
+
+    // Start in normal mode    
+  	iExtModeActive = EFalse;
+    iStillPrepared = EFalse;
+    
+    // Burst mode VF stopping optimization is not used as default
+    iBurstModeVFOptimization = EFalse;
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::GetSystemDisplayMode()
+// In some devices Hal:Get(HAL::EDisplayMode) returns directly TDisplayMode, 
+// in other devices it returns a display mode index.
+// ---------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::GetSystemDisplayMode( TDisplayMode& aDisplayMode )
+    {
+    TBool found = EFalse;
+    TInt halInOut = 0;
+    TInt err = HAL::Get( HAL::EDisplayMode, halInOut );
+    if (  err == KErrNone )
+        {       
+        if ( halInOut >= EColor256)
+            {
+            // halInOut contains TDisplayMode
+            aDisplayMode = (TDisplayMode) halInOut;
+            found = ETrue;
+            LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). HAL returned a display mode." ) );
+            }
+        else
+            {
+             // halInOut contains index
+           LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). HAL returned index." ) );
+            err = HAL::Get( HAL::EDisplayBitsPerPixel, halInOut );
+            
+            // Get the color mode. Note: grayscale modes are not supported. 
+            if (  err == KErrNone )
+                {
+				switch (halInOut)
+					{
+				    case 4:
+					    aDisplayMode = EColor16;
+                        found = ETrue;
+                        break;
+			    	case 8:
+					    aDisplayMode = EColor256;
+                        found = ETrue;
+                        break;
+				    case 12:
+				    	aDisplayMode = EColor4K;
+                        found = ETrue;
+                        break;
+				    case 16:
+					    aDisplayMode = EColor64K;
+                        found = ETrue;
+                        break;
+				    case 24:
+					    aDisplayMode = EColor16M;
+                        found = ETrue;
+                        break;
+			    	case 32:
+					    aDisplayMode = EColor16MU;
+                        found = ETrue;
+                        break;
+				    default:
+					    break;
+					}
+                }
+            }
+        } 
+
+    #ifdef _DEBUG
+    if ( err || !found )
+        {
+        TBuf<256> text;
+        text.Format(_L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). Cannot get the display mode from HW. Err:%d, found:%d" ), err, found );
+        LOGTEXT( text );        
+        }
+    else
+        {   
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). Found the display mode:%d" ), aDisplayMode );
+        }
+    #endif
+
+    if ( found && !err && aDisplayMode == EColor16MA )
+        {
+        aDisplayMode = EColor16MU;
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). Display mode EColor16MA changed to EColor16MU (%d)" ), aDisplayMode );
+        }
+
+    return found;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::SetCamAppEngineObserver()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetCamAppEngineObserver( MCamAppEngineObserver& aObserver )
+    {
+    iCaeObserver = &aObserver;    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageCreation()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageCreation( 
+    TBool aCreateSnapImage )
+    {
+    iCreateSnapImage = aCreateSnapImage;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageSourceL()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageSourceL( 
+    CCaeEngine::TSnapImageSource aSnapImageSource )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::SetSnapImageSourceL(). aSnapImageSource=%d" ), aSnapImageSource );
+    if ( ( aSnapImageSource < 0 ) || 
+         ( aSnapImageSource > CCaeEngine::ESnapImageSourceThumbnail ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetSnapImageSourceL(). leaving KErrNotSupported" ));
+        User::Leave( KErrNotSupported );
+        }
+
+    iSnapImageSource = aSnapImageSource;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageSizeL()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageSizeL( 
+    TSize& aSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeStillStatesActive::SetSnapImageSizeL(). iWidth=%d, iHeight=%d" ), aSize.iWidth, aSize.iHeight );
+	// Calc downscaled size.
+    // Use always the default snap size for the snap image. It is the best compromise 
+    // between memory usage and image quality.
+    TSize stepwiseScaledOptimalSize( KCaeDefaultSnapWidth, KCaeDefaultSnapHeight);
+    CalcDownscaledSnapSize( stepwiseScaledOptimalSize ); 
+
+    // Empty calculated size means that PrepareStillCapture() has not been called.
+    if ( stepwiseScaledOptimalSize == TSize() ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetSnapImageSizeL(). leaving KErrNotReady (no prepare)" ));
+		User::Leave( KErrNotReady ); 
+        }
+    else
+        {
+        iOptimalSnapImageSize = stepwiseScaledOptimalSize;
+        // If empty, use the still image size
+        if ( aSize == TSize() )
+            {
+            aSize = iStillFrameSize;
+            }
+        iSnapImageSize = aSize;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SnapImageSize
+// -----------------------------------------------------------------------------
+TSize CCaeStillStatesActive::SnapImageSize() const
+    {
+    return( iSnapImageSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillImageSize
+// -----------------------------------------------------------------------------
+TSize CCaeStillStatesActive::StillImageSize() const
+    {
+    return( iStillFrameSize );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageColorMode
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageColorMode( 
+    TDisplayMode aMode )
+    {
+    iSnapImageColorMode = aMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetJpegQuality
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetJpegQuality(
+    TInt aQuality )
+    {
+    iStillCompressionQuality = aQuality;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::JpegQuality
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::JpegQuality() const
+    {
+    return( iStillCompressionQuality );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetImageCodecsL
+// Sets the specific image codec implementation to be used in decoding and 
+// encoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetImageCodecsL( 
+	TUid aDecoderUid, TUid aEncoderUid )
+    {
+    iStillEncoder->SetImageCodecL( aEncoderUid );
+    iStillDecoder->SetImageCodecL( aDecoderUid );
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetViewFinderMode
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetViewFinderMode(
+    TBool aIsEnabled )
+    {
+    iIsViewFinderEnabled = aIsEnabled;
+
+    // Issue event, if the view finder is stopped, and the state machine is 
+    // waiting for it. Do not issue the same event twice (it will panic).
+    if ( !iIsViewFinderEnabled 
+         && ( iCurrentState == CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder ) 
+         && !( IsActive() && ( iStatus == CCaeStillStatesActive::ECaeEventViewFinderForBurstReady ) ) )
+        {
+        Event( CCaeStillStatesActive::ECaeEventViewFinderForBurstReady );        
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::IsRunning
+// Check if the state is other than ECaeStateNone.
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::IsRunning() const
+    {
+    return( iCurrentState != CCaeStillStatesActive::ECaeStateNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RegisterFlags
+// Increment reference counters.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::RegisterFlags( TUint32 aFlags )
+	{
+    if ( aFlags & ECaeExtFlagRequireFullColorSnapInputImage )
+        { 
+        CAE_ASSERT_DEBUG( iRequireFullColorSnapInputImageRefCount < KMaxTInt32 );
+        if ( iRequireFullColorSnapInputImageRefCount < KMaxTInt32 )
+            {
+            iRequireFullColorSnapInputImageRefCount++;
+            }
+        }
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DeregisterFlags
+// Decrement reference counters.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DeregisterFlags( TUint32 aFlags )
+    {
+    if ( aFlags & ECaeExtFlagRequireFullColorSnapInputImage )
+        {
+        CAE_ASSERT_DEBUG( iRequireFullColorSnapInputImageRefCount > 0 );
+        if ( iRequireFullColorSnapInputImageRefCount > 0 )
+            {
+            iRequireFullColorSnapInputImageRefCount--;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::PrepareStillCaptureL
+// Using cropping only if supported by Camera API impl.
+// Calls RetrieveStillSizeIndex() that calls Camera API EnumerateCaptureSizes().
+// Calls Camera API PrepareImageCaptureL().
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::PrepareStillCaptureL( 
+    const TSize&      aFrameSize, 
+    CCamera::TFormat  aFormat, 
+    const TRect&      aCropRect,
+    TSize&            aSnapSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() entering aFrameSize=(w=%d,h=%d)" ), aFrameSize.iWidth, aFrameSize.iHeight );
+
+    // Handle empty crop rect
+    TRect cropRect( aCropRect );
+    if ( cropRect.IsEmpty() )
+        cropRect = TRect(TPoint(0, 0 ), aFrameSize);
+
+    CCamera::TFormat stillOutputFormat = aFormat;
+    CCamera::TFormat stillInputFormat = aFormat;
+
+    // Try if this size and format is supported by the Camera API.
+    TInt sizeIndex = RetrieveStillSizeIndex( aFrameSize, aFormat );
+    if ( sizeIndex != -1 )
+        {
+        stillInputFormat = aFormat;
+        }
+    // If the application requires Jpeg we can encode it from bitmap
+    else if ( aFormat == CCamera::EFormatJpeg )
+        {
+        // Try if this size and format KBaseStillInputFormat1 
+        // is supported by the Camera API.
+        stillInputFormat = KBaseStillInputFormat1;
+        sizeIndex = RetrieveStillSizeIndex( aFrameSize, stillInputFormat );
+        if ( sizeIndex == -1 )
+            {
+            // Try if this size and format KBaseStillInputFormat2 
+            // is supported by the Camera API.
+            stillInputFormat = KBaseStillInputFormat2;
+            sizeIndex = RetrieveStillSizeIndex( aFrameSize, stillInputFormat );
+            if ( sizeIndex == -1 )
+                {
+                LOGTEXT2( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() leaving KErrNotSupported, stillInputFormat=%d" ), stillInputFormat );
+                User::Leave( KErrNotSupported );
+                }
+            }
+        }
+    else 
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() leaving KErrNotSupported, aFormat=%d" ), aFormat );
+        User::Leave( KErrNotSupported );
+        }
+
+    // Prepare still image capturing on Camera API.
+    if ( !( iInfo.iOptionsSupported & TCameraInfo::EImageClippingSupported ) ) 
+        {
+        iCamera.PrepareImageCaptureL( stillInputFormat, sizeIndex );
+        }
+    else 
+        {
+        iCamera.PrepareImageCaptureL( stillInputFormat, sizeIndex, cropRect );
+        }
+
+    // Store values 
+    iStillFrameSize = aFrameSize;
+    iStillInputFormat = stillInputFormat;
+    iStillOutputFormat = stillOutputFormat;
+
+    // Calc downscaled size if needed
+    SetSnapImageSizeL( aSnapSize );     
+    
+    // Prepare done
+    iStillPrepared = ETrue;
+    
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() returning" ) );    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::RetrieveStillSizeIndex
+// Retrieves/fetches still image size index from Camera API.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::RetrieveStillSizeIndex( 
+    const TSize& aFrameSize, 
+    CCamera::TFormat aStillDataFormat ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::RetrieveStillSizeIndex() entering" ) );
+
+    TInt index( -1 );
+    TInt i( 0 );
+    TSize size;
+    while ( ( i < iInfo.iNumImageSizesSupported ) && ( index == -1 ) )
+        {
+        iCamera.EnumerateCaptureSizes ( size, i, aStillDataFormat );
+        if ( size == aFrameSize )
+            {
+            index = i;
+            }
+        i++;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::RetrieveStillSizeIndex() returning" ) );
+
+    return index;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CalcDownscaledSnapSize
+// Calc suitable downscaled snap size. Assumed that integer arithmetic is used 
+// also in CImageDecoder class for calculating image scaling to 1/2, 1/4 or 1/8 
+// of size (i.e. no rounding). The scaled snap size is not allowed to be smaller
+// than given snap size in any dimension. Do not do downscaling if aSnapSize is 
+// empty.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CalcDownscaledSnapSize(
+    TSize& aSnapSize) const
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CalcDownscaledSnapSize() entering" ) );    
+
+    // The new snap image size is equal to frame size by default
+    TSize newSnapSize = iStillFrameSize;
+
+    // Calculate downscaled snap size
+    if ( aSnapSize != TSize( 0, 0 ) 
+        && ( ( iStillInputFormat == CCamera::EFormatExif ) || 
+             ( iStillInputFormat == CCamera::EFormatJpeg )   ) )
+        {
+        // Try scaling to 1/8, 1/4 and 1/2
+        for  ( TInt divider = 8; divider >= 2;  divider /= 2 ) 
+            {
+            TInt scaledWidth = iStillFrameSize.iWidth / divider;
+            TInt scaledHeight = iStillFrameSize.iHeight / divider;
+            if ( scaledHeight >= aSnapSize.iHeight && scaledWidth >= aSnapSize.iWidth ) 
+                {
+                newSnapSize = TSize( scaledWidth, scaledHeight );
+                divider = -1; // exit loop
+                }
+            }
+        }
+
+    // Return new size
+    aSnapSize = newSnapSize;
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CalcDownscaledSnapSize() returning" ) );    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::GetThumbnailL()
+// Extracts thumbnail image and its size from Exif image.
+// Uses Exif reader to extract the thumbnail and 
+// ICL decoder to extract the size.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::GetThumbnailL( 
+    HBufC8*& aReadThumbnail, 
+    TSize&   aThumbnailSize )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetThumbnailL()" ) );    
+
+    if ( iImageData && ( iStillOutputFormat == CCamera::EFormatExif ) )
+        {
+        // Instantiate exif reader.
+        CExifRead* read = NULL;
+        read = CExifRead::NewL( *iImageData );
+        CleanupStack::PushL( read );
+        
+        // Get thumbnail.
+        aReadThumbnail = read->GetThumbnailL();
+        CleanupStack::PopAndDestroy( read );
+        
+        // Find out thumbnail size by using ICL decoder.
+        // Check first that the size is valid.
+        CImageDecoder* decoder = CImageDecoder::DataNewL( iFs, *aReadThumbnail ); 
+        TFrameInfo frameInfo = decoder->FrameInfo();
+        delete decoder;
+
+        if ( frameInfo.iOverallSizeInPixels.iWidth > 0 && 
+             frameInfo.iOverallSizeInPixels.iHeight > 0 )
+            {
+            aThumbnailSize = frameInfo.iOverallSizeInPixels;
+            LOGTEXT3( _L( "Cae: CCaeStillStatesActive::GetThumbnailL(): extracted %dx%d thumbnail" ), 
+                aThumbnailSize.iWidth, aThumbnailSize.iHeight );
+            }
+        else
+            {
+            LOGTEXT3(_L("Cae: CCaeStillStatesActive::GetThumbnailL(): leaving KErrCorrupt due invalid thumbnail size=(w=%d,h=%d)"), 
+                frameInfo.iOverallSizeInPixels.iWidth, frameInfo.iOverallSizeInPixels.iHeight );
+            delete aReadThumbnail;
+            aReadThumbnail = NULL;
+            aThumbnailSize = TSize( 0, 0 );
+            User::Leave( KErrCorrupt );
+            }
+        }
+    else if ( iImageData && ( iStillOutputFormat != CCamera::EFormatExif ) )
+        {
+        // we can't get the thumbnail from exif header if the exif header doesn't exist
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetThumbnailL() leaving because iStillOutputFormat is not EFormatExif" ) );
+        User::Leave( KErrNotFound );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::IsBitmapOutput()
+// ---------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::IsBitmapOutput()
+    {
+    return ( !( ( iStillOutputFormat == CCamera::EFormatJpeg ) 
+              || ( iStillOutputFormat == CCamera::EFormatExif ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::Event()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::Event( TCaeEvent aEvent, TTimeIntervalMicroSeconds32 aDelay )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::Event(). aEvent=%d" ), aEvent );
+    CAE_ASSERT_ALWAYS( !IsActive() );
+
+    iDelayedEvent = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( aEvent != CCaeStillStatesActive::ECaeEventEnd )
+        {
+        if ( aDelay == TTimeIntervalMicroSeconds32( 0 ) )
+            {
+            // Issue request
+            TRequestStatus* statusPtr = &iStatus;
+            User::RequestComplete( statusPtr, aEvent );
+            }
+        else
+            {
+            // Use delayed request
+            iDelayedCallTimer.After( iStatus, aDelay );
+            iDelayedEvent = aEvent;
+            }
+    	SetActive();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateNone; // The end
+        if ( ExtModeActive() )
+            {
+            // If there are no images in the queue, then extension processing is ended
+            TInt count = iImageQueueExtPro->ImageCount();
+            if ( count > 0 )
+                {  // Continue and read next image from the queue
+                Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::CancelCaptureStill()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CancelCaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CancelCaptureStill()" ) );
+
+    if ( !ExtModeActive() ) // in extension mode capture/cancelling is not possible
+        {
+        iStillCancelled = ETrue;
+        Cancel();
+        CancelAndCleanup();
+        }
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::Cancel()
+// Calls the base class Cancel().
+// As calling this is not allowed outside this class, this is a private method
+// and it overrides CActive::Cancel(). 
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::Cancel()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::Cancel()" ) );
+    CActive::Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCancel()
+// Cancel all pending actions. This does not cancel actions that use callback
+// for signaling for completion, e.g. image encoding and decoding.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCancel()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCancel()" ) );
+    if ( iStatus == KRequestPending )
+        {
+        if ( ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage )
+             || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage ) 
+             || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage ) )
+            {
+            // Cancel extension processing            
+            CAE_ASSERT_ALWAYS( iCurrentExtensionIndex != -1 );
+            TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+	        STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->CaeExtensionCancel();   
+            }
+        else if ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+            {
+            // Cancel timer
+            iDelayedCallTimer.Cancel();
+            iDelayedEvent = CCaeStillStatesActive::ECaeEventNone;
+            }
+        else
+            {
+            User::Panic( KCaePanicText, ECaePanicInvalidState );
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ErrorRecovery
+//
+// For still capture recovery: Delete images, cancel and cleanup. Client 
+// callbacks should be called also in error cases, except when user has 
+// cancelled the action. 
+//
+// Burst case is handled differently in BurstErrorRecovery().
+//
+// Note: If ownership is transferred, the image pointers should be NULLed before
+// calling the observer method. That is because the observer method can call back
+// CancelStill() which tries to delete images. That is no allowed if an image 
+// should be owned by the observer.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ErrorRecovery( TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ErrorRecovery(): %d" ), aError );
+
+    // Check if snap image callback should be called. Do not call it twice.
+
+    if ( ( iCurrentState <= CCaeStillStatesActive::ECaeStateDeliveringSnapImage ) // Callback not yet called
+         && !iStillCancelled 
+         && iCreateSnapImage ) 
+        {
+        if ( iCurrentState == CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap ) 
+            {
+            // Give decoded image to the client even if there is decoding error
+            iCaeObserver->McaeoSnapImageReady( *iBitmap, aError );
+
+            // Not needed any more. Delete now to free memory.
+            delete iBitmap;
+            iBitmap = NULL;
+            }
+        else
+            {
+            // Give empty snap image to the client
+            iCaeObserver->McaeoSnapImageReady( *iEmptySnapImage, aError );
+            }
+        }
+
+    // Check if still image callback should be called. Do not call it twice.
+
+    if ( ( iCurrentState <= CCaeStillStatesActive::ECaeStateDeliveringStillImage ) // Callback not yet called
+         && !iStillCancelled )
+        {
+        if ( iCurrentState == CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap ) 
+            {
+            // Give original image to the client even if there is decoding error.
+            HBufC8* tmpImageData = iImageData;   
+            iImageData = NULL; 
+            iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, aError );
+            }
+        else if ( iCurrentState == CCaeStillStatesActive::ECaeStateEncodingToJpeg )
+            {
+            // Give original image to the client even if there is encoding error
+            HBufC8* tmpImageData = iImageData;   
+            iImageData = NULL; // Ownership tranferred
+            iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, aError );            
+            }
+        else
+            {
+            // Give error to the client
+            iCaeObserver->McaeoStillImageReady( NULL, NULL, aError );
+            }
+
+        // In burst case, increment delivery counter. 
+        if ( iStillBurst )
+            {
+            iCountOfDeliveredBurstImages++;
+            }
+        }
+
+    if ( !iStillCancelled )
+        {
+        // Handle still burst
+        if ( iStillBurst )
+            {
+            BurstErrorRecovery( aError );
+            }
+        else
+            {
+            Cancel();
+            CancelAndCleanup();
+            }  
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CancelAndCleanup
+// Cancel all actions and free resources.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CancelAndCleanup()
+    {
+    iDelayedEvent = CCaeStillStatesActive::ECaeEventNone;
+
+    CompleteStillBurst();
+
+    if ( iStillEncoder )
+        {
+        iStillEncoder->Cancel();
+        iStillEncoder->Cleanup(); 
+        }
+
+    if ( iStillDecoder )
+        {
+        iStillDecoder->Cancel();
+        iStillDecoder->Cleanup();
+        }    
+
+    // Delete all that is not NULL already. 
+    delete iSnapBitmap;
+    iSnapBitmap = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iImageData;
+    iImageData = NULL;
+    delete iImageHeaderData;
+    iImageHeaderData = NULL;
+    if ( iImageQueueExtPro )
+        {
+        iImageQueueExtPro->ResetAndDestroyImages();
+        }    
+
+    iCurrentState = CCaeStillStatesActive::ECaeStateNone;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::RunL()
+// The main function that receives all events. Simple events are also handled 
+// here. For more complex events, specific handler functions are called.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::RunL()
+    {
+    LOGTEXT3( _L( "Cae: CCaeStillStatesActive::RunL() entering, iStatus=%d, iCurrentState=%d" ), iStatus.Int(), iCurrentState );
+
+    // Handle external errors 
+
+    if ( iStatus.Int() < 0 )
+        {
+        HandleExternalError();
+        return;
+        }
+
+    // Handle all state transitions
+
+    switch( iStatus.Int() )
+        {
+        case CCaeStillStatesActive::ECaeEventNone:
+            HandleExternalEvent();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventStartStillCapture:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateNone );
+            HandleStart();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventImageCaptureReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateCapturing );
+            HandleImageCaptureReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventBurstImageCaptureReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateCapturingBurst );
+            iCurrentState = CCaeStillStatesActive::ECaeStateAppendingBurstImage;            
+            DoAppendCapturedBurstImageToArray();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateAppendingBurstImage );
+            HandleAppendCapturedBurstImageReady();            
+            break;
+
+        case CCaeStillStatesActive::ECaeEventViewFinderForBurstReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder );
+            iCurrentState = CCaeStillStatesActive::ECaeStateCapturingBurst;            
+            DoCaptureStillBurstImage();            
+            break;
+
+        case CCaeStillStatesActive::ECaeEventBurstCaptureReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateCapturingBurst );
+            iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage;    
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoFetchNextBurstImage();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventBurstImageFetchReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateFetchingNextBurstImage );
+            HandleBurstImageFetchReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventDecodeToBitmapReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap );
+            HandleDecodeToBitmapReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventExtractExifMetaDataReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtractingExifMetaData );
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;         
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessCapturedImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessCapturedImageStepReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage );
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessCapturedImage();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessCapturedImageAllReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage );
+            HandleProcessCapturedImageAllReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessSnapImageStepReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage );
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessSnapImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessSnapImageAllReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage );
+            iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringSnapImage;         
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoDeliverSnapImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventDeliverSnapImageReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateDeliveringSnapImage );
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage;         
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessStillImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessStillImageStepReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage );
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessStillImage();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessStillImageAllReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage );
+            HandleProcessStillImageAllReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventEncodeToJpegReady:
+             CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateEncodingToJpeg );
+            HandleEncodeToJpegReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady:
+            // We can end up here from any state, if there occurs an error
+            HandleDeliverStillBurstImageReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventImageQueueExtPro:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateNone );
+            HandleImageQueueExtPro();
+            break;
+
+        default:
+            CAE_ASSERT_DEBUG( iCurrentState != iCurrentState ); // Always false
+            break;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::RunL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// EVENT HANDLERS
+//
+// Event handlers should decide what is the next state and next action after the 
+// current event. Modes and flags are checked here leaving the actual action 
+// functions as simple as possible. 
+// ---------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleExternalError
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleExternalError() 
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleExternalError()" ));
+
+    CAE_ASSERT_DEBUG( ( ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage ) ) ); 
+         
+    // Cancelling delayed event timer is not considered as error, but early completion              
+    if ( (iStatus.Int() == KErrCancel ) && ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone ) )
+        {
+    	LOGTEXT2( _L( "Cae: CCaeStillStatesActive::HandleExternalError(). Delayed event %d completed early." ), iDelayedEvent);
+    	HandleExternalEvent();
+        }
+    else
+    	{
+    	ErrorRecovery( iStatus.Int() );                        		
+    	}    
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleExternalEvent
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleExternalEvent() 
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleExternalEvent()" ));
+    CAE_ASSERT_DEBUG( ( ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage ) ) ); 
+
+        
+    if ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+        {
+        // Timer has finished, issue delayed event now
+        Event( iDelayedEvent );
+        }
+    else          
+        {
+        switch ( iCurrentState )
+            {
+            case ECaeStateExtensionsProcessingCapturedImage:
+                Event( CCaeStillStatesActive::ECaeEventProcessCapturedImageStepReady );
+                break;
+
+            case ECaeStateExtensionsProcessingSnapImage:
+                Event( CCaeStillStatesActive::ECaeEventProcessSnapImageStepReady );
+                break;
+
+            case ECaeStateExtensionsProcessingStillImage:
+                Event( CCaeStillStatesActive::ECaeEventProcessStillImageStepReady );
+                break;
+
+            default:
+                CAE_ASSERT_DEBUG( iCurrentState !=  iCurrentState ); // Always false
+                break;
+
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleStart()
+// Start either single or burst image capture.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleStart()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleStart()" ));
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData == NULL ) && ( iImageHeaderData == NULL ) );
+    
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( iStillBurst )
+        {               
+        iCurrentState = CCaeStillStatesActive::ECaeStateCapturingBurst;            
+        DoCaptureStillBurst();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateCapturing;            
+        DoCaptureStill();
+        }   
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleImageCaptureReady()
+// Decode the captured image, extract Exif metadata, or process the 
+// image by the extensions.  
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleImageCaptureReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageCaptureReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( !iBitmap                   // Does not already exist
+         && ( iCreateSnapImage ) )    // Snap bitmap required by UI
+            /* Not yet implemented
+            || iRequireStillImageAsBitmapRefCount ) ) // Still bitmap required by any extensions
+            */
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap;            
+        DoDecodeCapturedImageToBitmap();
+        }
+    else
+        {
+        /* Not yet implemented
+        if ( iRequireImageFormatHeaderRefCount )
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtractingExifMetaData;            
+            DoExtractExifMetaData();
+           }
+        else
+        */
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;            
+            DoExtensionsProcessCapturedImage();    
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleDecodeToBitmapReady()
+// Extract Exif metadata, or process the captured image by the 
+// extensions.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleDecodeToBitmapReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleDecodeToBitmapReady()" ));
+    CAE_ASSERT_ALWAYS( ( iBitmap != NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData != NULL ) && ( iImageHeaderData == NULL ) );
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( iCreateSnapImage )    // Snap bitmap required by UI
+        /* Not yet implemented
+       && !iRequireStillImageAsBitmapRefCount ) // Still bitmap not required by any extensions
+       */
+        {
+        // Decoded bitmap is used for the snap bitmap only
+        iSnapBitmap = iBitmap;
+        iBitmap = NULL;
+        }    
+
+     /* Not yet implemented
+    if ( iRequireImageFormatHeaderRefCount )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtractingExifMetaData;            
+        DoExtractExifMetaData();
+        }
+    else
+    */
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;            
+        DoExtensionsProcessCapturedImage();    
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleProcessCapturedImageAllReady()
+// Process the snap image or the still image by the extensions.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleProcessCapturedImageAllReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleProcessCapturedImageAllReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( iCreateSnapImage )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage;            
+        DoExtensionsProcessSnapImage();    
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage;            
+        DoExtensionsProcessStillImage();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleProcessStillImageAllReady()
+// Encode the still bitmap to Jpeg, or deliver the 
+// still image to the client.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleProcessStillImageAllReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleProcessStillImageAllReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    // Encode to Jpeg if there is a separate (Exif) header or bitmap to 
+    // Jpeg coversion is needed for client.
+    if ( iImageHeaderData 
+         || ( ( iStillOutputFormat == CCamera::EFormatJpeg ) && !iImageData ) )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateEncodingToJpeg;            
+        DoEncodeStillImageToJpeg();
+        }
+   else
+        {
+        if ( iStillBurst )
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillBurstImage;            
+            DoDeliverStillBurstImage();
+            }
+        else
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillImage;            
+            DoDeliverStillImage();
+            }
+        }
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleEncodeToJpegReady()
+// Deliver the still image to the client.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleEncodeToJpegReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleEncodeToJpegReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( iStillBurst )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillBurstImage;            
+        DoDeliverStillBurstImage();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillImage;            
+        DoDeliverStillImage();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleImageQueueExtPro()
+// Deliver the still image to the client.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleImageQueueExtPro()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro()" ));
+
+    CFbsBitmap* bitmap = NULL;
+    HBufC8*     imagedata = NULL;
+    TBool       lastimage = EFalse;
+    TBool       snapimage = EFalse;
+
+    // Get next snap or main image from image queue
+    if ( iImageQueueExtPro )
+        {
+        TInt result = iImageQueueExtPro->GetNextImage( bitmap, imagedata, lastimage, snapimage );
+
+        // If prepare has not been done then format has default value
+        if ( !iStillPrepared )
+            {
+            iStillOutputFormat = CCamera::EFormatExif; // Only exif/jpeg is supported
+            }
+        if ( result == KErrNone )
+            {
+            iLastImageExtPro = lastimage;
+            if ( bitmap && snapimage ) // Snap image
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() Snap bitmap" ));
+                iStatus = CCaeStillStatesActive::ECaeEventNone;
+                iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage;            
+                iSnapBitmap = bitmap;
+                Event( CCaeStillStatesActive::ECaeEventProcessSnapImageStepReady );
+                }
+            else if ( imagedata && !snapimage) // Main captured image (jpeg)
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() JPG imagedata" ));
+                iStatus = CCaeStillStatesActive::ECaeEventNone;
+                iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage;            
+                iImageData = imagedata;
+                Event( CCaeStillStatesActive::ECaeEventProcessStillImageStepReady );
+                }
+            else if ( bitmap && !snapimage) // Main captured image (bitmap)
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() bitmap imagedata" ));
+                iStatus = CCaeStillStatesActive::ECaeEventNone;
+                iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringSnapImage;            
+                iBitmap = bitmap;
+                Event( CCaeStillStatesActive::ECaeEventDeliverSnapImageReady );
+                }
+            else 
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() iImageQueueExtPro return empty image" ));
+                }
+            }
+        else
+            {
+            LOGTEXT2( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() iImageQueueExtPro error %d" ), result);
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() iImageQueueExtPro not found" ));
+        }
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// EXTERNAL CALLBACKS
+//
+// Callbacks from external objects are mapped to the internal events.
+// ---------------------------------------------------------------------------
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ImageReady
+// Store the captured image and send event to the state machine.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ImageReady() entering, aError=%d" ), aError );
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData == NULL ) && ( iImageHeaderData == NULL ) );
+    
+    #ifdef _DEBUG
+    // Performance debugging
+    iImageReadyTime.HomeTime();
+    TTimeIntervalMicroSeconds convertInterval =
+        iImageReadyTime.MicroSecondsFrom( iCaptureStartTime );
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ImageReady(): Captured image ready %f seconds after capture" ),
+                   I64LOW( convertInterval.Int64() ) * 1.0 / KOneSecond );
+    #endif
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeImageReadyError( aError );
+    #endif    
+
+    // Get ownership and store pointers
+    iBitmap = aBitmap;
+    iImageData = aImageData;
+
+    if ( iStillBurst )
+        {
+        iFirstStillBurstError =  iFirstStillBurstError ? iFirstStillBurstError : aError;
+        Event( CCaeStillStatesActive::ECaeEventBurstImageCaptureReady );
+        }
+
+    // Single image capture
+    else if ( !aError )
+        {
+        Event( CCaeStillStatesActive::ECaeEventImageCaptureReady );
+        }
+    else
+        {
+        // Handle error
+        ErrorRecovery( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ImageReady() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::McaesdoCFbsBitmapImageReady
+// Store original and decoded images and send event to the state machine.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::McaesdoCFbsBitmapImageReady( 
+    HBufC8*     aImageData, 
+    CFbsBitmap* aBitmap, 
+    TInt        aError,
+    TInt        /*aImageSize*/ ) // Not yet used
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaesdoCFbsBitmapImageReady() entering" ) );
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( iImageHeaderData == NULL );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+
+   #ifdef _DEBUG
+    // Performance debugging
+    iFinalImageReadyTime.HomeTime();
+    TTimeIntervalMicroSeconds convertInterval =
+        iFinalImageReadyTime.MicroSecondsFrom( iCaptureStartTime );
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::McaesdoCFbsBitmapImageReady(): Final decoded image ready %f seconds after capture" ),
+                   I64LOW( convertInterval.Int64() ) * 1.0 / KOneSecond );
+    #endif
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMcaesdoCFbsBitmapImageReadyError( aError );
+    #endif
+    
+    // Get ownership and store pointers
+    iBitmap = aBitmap;
+
+    // Delete image data if not the original (extracted thumbnail was used as decoder input).
+    if ( iImageData != NULL )
+        {
+        delete ( aImageData ); // Delete (exif) thumbnail source image
+        }
+    else
+        {
+        iImageData = aImageData; // Store original still image
+        }
+
+    if ( !aError )
+        {
+        Event( CCaeStillStatesActive::ECaeEventDecodeToBitmapReady );
+        }
+    else
+        {
+        // Handle error
+        ErrorRecovery( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaesdoCFbsBitmapImageReady() returning" ) );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::McaeseoHBufC8ImageReady
+// Store original and encoded images and send event to the state machine.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::McaeseoHBufC8ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError,
+    TInt        /*aImageSize*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaeseoHBufC8ImageReady() entering" ) );
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData == NULL ) && ( iImageHeaderData == NULL ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+    
+    #ifdef _DEBUG
+    // Performance debugging
+    iFinalImageReadyTime.HomeTime();
+    TTimeIntervalMicroSeconds convertInterval =
+        iFinalImageReadyTime.MicroSecondsFrom( iCaptureStartTime );
+    LOGTEXT2(_L( "Cae: CCaeStillStatesActive::McaeseoHBufC8ImageReady(): Final encoded image ready %f seconds after capture" ), 
+        I64LOW( convertInterval.Int64() ) * 1.0 / KOneSecond);
+    #endif
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMcaeseoHBufC8ImageReadyError( aError );
+    #endif
+    
+    // Get ownership and store pointers
+    iBitmap = aBitmap;
+    iImageData = aImageData;
+
+    if ( !aError )
+        {
+        Event( CCaeStillStatesActive::ECaeEventEncodeToJpegReady );
+        }
+    else 
+        {
+        // Handle error
+        ErrorRecovery( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaeseoHBufC8ImageReady() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ViewFinderFrameReady
+// Send event if the state machine is waiting for the view finder. 
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ViewFinderFrameReady()
+    {
+	iViewFinderFrameReceived = ETrue;
+
+    if ( iCurrentState == CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder 
+         && !IsActive() ) // To make sure the previous ECaeEventViewFinderForBurstReady has been handled
+        {
+        Event( CCaeStillStatesActive::ECaeEventViewFinderForBurstReady );        
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// ACTION FUNCTIONS FOR STATES
+//
+// To keep it simple, action functions should do only one task each if 
+// possible. If there is a lot of conditions, make several action functions 
+// and call them from event handlers. 
+// ---------------------------------------------------------------------------
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStill
+// Start image capturing in Camera API.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStill() entering" ) );
+
+    #ifdef _DEBUG
+    // Performance debugging
+    iCaptureStartTime.HomeTime();
+    #endif
+
+    iViewFinderFrameReceived = EFalse;
+    iStillCancelled = EFalse;
+
+    iCamera.CaptureImage(); // Start capture
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStill() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDecodeCapturedImageToBitmap
+//
+// Decode to bitmap. CCaeStillDecoder calls McaesdoCFbsBitmapImageReady 
+// callback when decoding is ready.
+// Decodes Exif thumbnail to bitmap if requested (by iSnapImageSource).
+// Note that the callback can be called synchronously by iStillDecoder, if 
+// an error occurs in the still decoder. In that case also  ErrorRecovery() 
+// has been called in McaesdoCFbsBitmapImageReady() *before* the method 
+// below returns.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDecodeCapturedImageToBitmap()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDecodeCapturedImageToBitmap()" ) );
+    HBufC8* tmpImageData = NULL;
+    TSize   tmpSnapImageSize( 0, 0 );
+    TInt    error( KErrNone );
+    
+    // Use thumbnail for snap image basis if requested to use it.
+    if ( iSnapImageSource == CCaeEngine::ESnapImageSourceThumbnail ) 
+        {
+        TRAP( error, GetThumbnailL( tmpImageData, tmpSnapImageSize ) );
+        if ( error )
+            {
+            LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDecodeCapturedImageToBitmap(): Thumbnail extraction failed" ) );
+            delete( tmpImageData );
+            tmpImageData = iImageData;
+            tmpSnapImageSize = iOptimalSnapImageSize;
+	        iImageData = NULL; 
+            }
+        }
+    else // Use the captured image for snap image basis.
+        {
+        tmpImageData = iImageData;
+        tmpSnapImageSize = iOptimalSnapImageSize;
+	    iImageData = NULL; 
+        }
+
+    // Ownership will be transferred. Null the pointer already before the method
+    // call because it can call McaesdoCFbsBitmapImageReady() callback synchronously 
+    // inside the method.
+    // Always decode and scale to the correct size if free scaling is supported.
+    TDisplayMode displayMode = iRequireFullColorSnapInputImageRefCount ? 
+        EColor16M : iSnapImageColorMode;
+    TRAP( error, iStillDecoder->ConvertHBufC8ToCFbsBitmapL( 
+            tmpImageData, displayMode, tmpSnapImageSize, iSnapImageSize) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeCreateAndDeliverSnapImageError( error );
+    #endif
+
+    if ( error )
+        {
+        // Handle error.
+        ErrorRecovery( error );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoExtensionsProcessCapturedImage
+//
+// Call the extensions for processing the captured image. Subsequent synchronous
+// methods are called inside a loop. After an asynchronous method, the extension
+// signals the state machine which calls this function again for the next 
+// extension.  
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoExtensionsProcessCapturedImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoExtensionsProcessCapturedImage()" ) );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSCAPTUREDIMAGE, "e_CAM_CAE_OPERATIONS 1" );   //CAE_ENGINE_OPERATIONS_START
+        
+	TBool isAsyncOperation = EFalse;
+
+	// Execute synchronous operations in loop. Exit the loop if there is an 
+	// asynchronous function or a syncronous function has returned error status.  		
+	while ( iStatus == KErrNone  
+            && !iStillCancelled
+		    && !isAsyncOperation 
+		    && ( ++iCurrentExtensionIndex <  iProcessImageImplList.Count() ) )
+		{
+
+        TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+
+        // Call extensions. Note that references to image pointers are given as
+        // parameters. The engine has shared the ownership with the extensions,
+        // which can also delete and create new images.
+        if ( iProcessImageImplList[iCurrentExtensionIndex].iIsActive )
+            {
+    		isAsyncOperation = STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->ProcessCapturedImage(
+                iStatus, iBitmap, iImageData, iImageHeaderData );
+            }
+        else
+            {
+	        LOGTEXT2(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessCapturedImage().Skipping extension %x"),
+	            iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+            }
+	    
+	    #ifdef _DEBUG
+	    if ( ( iStatus != KErrNone ) && ( iStatus != KRequestPending ) )
+	        {
+	        LOGTEXT3(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessCapturedImage().Error: %d in ProcessCapturedImage() for Extension %x"),
+	            iStatus.Int(), iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+	        }
+	    #endif
+		}
+
+    if (!iStillCancelled)
+        {
+	    // Note: For an asynchronous operation the status can be KErrNone 
+	    //       if the operation has already finished and this thread has 
+	    //       been signaled. 
+		if ( ( iStatus == KErrNone || iStatus == KRequestPending ) && isAsyncOperation )
+			{
+			// Come back after an asynchronous operation has finished
+			SetActive();
+			}
+		else
+			{
+            iCurrentExtensionIndex = -1;
+            if ( iStatus == KErrNone )
+                {
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSCAPTUREDIMAGE, "e_CAM_CAE_OPERATIONS 0" );  //CAE_ENGINE_OPERATIONS_END
+                Event( CCaeStillStatesActive::ECaeEventProcessCapturedImageAllReady );            
+                }
+            else
+                {
+                // Note: negative status values are handled as "external errors"
+                // in RunL(). Check that the received iStatus is negative, extension can return any value
+                
+                if ( iStatus.Int() <= 0 )
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent)iStatus.Int() );    
+                    }
+                else
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent) KErrGeneral );    
+                    }
+                }
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoExtensionsProcessSnapImage
+//
+// Call the extensions for processing the snap image. Subsequent synchronous
+// methods are called inside a loop. After an asynchronous method, the extension
+// signals the state machine which calls this function again for the next 
+// extension.  
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoExtensionsProcessSnapImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoExtensionsProcessSnapImage()" ) );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSNAPIMAGE, "e_CAM_CAE_OPERATIONS 1" );   //CAE_ENGINE_OPERATIONS_START
+        
+	TBool isAsyncOperation = EFalse;
+
+	// Execute synchronous operations in loop. Exit the loop if there is an 
+	// asynchronous function or a syncronous function has returned error status.  
+	
+	while ( iStatus == KErrNone  
+            && !iStillCancelled
+		    && !isAsyncOperation 
+		    && ( ++iCurrentExtensionIndex <  iProcessImageImplList.Count() ) )
+		{
+
+        TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+
+        // Call extensions. Note that references to image pointers are given as
+        // parameters. The engine has shared the ownership with the extensions,
+        // which can also delete and create new images.
+        if ( iProcessImageImplList[iCurrentExtensionIndex].iIsActive )
+            {
+    		isAsyncOperation = STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->ProcessSnapImage(
+                iStatus, iBitmap, iSnapBitmap );
+            }
+        else
+            {
+	        LOGTEXT2(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessSnapImage(). Skipping Extension %x"),
+	            iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid );
+            }
+	    
+	    #ifdef _DEBUG
+	    if ( ( iStatus != KErrNone ) && ( iStatus != KRequestPending ) )
+	        {
+	        LOGTEXT3(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessSnapImage(). Error %d in ProcessSnapImage() for Extension %x"),
+	            iStatus.Int(), iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid );
+	        }
+	    #endif
+		}
+
+    if (!iStillCancelled)
+        {
+		// Note: For an asynchronous operation the status can be KErrNone 
+		//       if the operation has already finished and this thread has 
+		//       been signaled. 
+		if ( ( iStatus == KErrNone || iStatus == KRequestPending ) && isAsyncOperation )
+			{
+			// Come back after an asynchronous operation has finished
+			SetActive();
+			}
+		else
+			{
+            iCurrentExtensionIndex = -1;
+            if ( iStatus == KErrNone )
+                {
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSNAPIMAGE, "CamAppEngine_Perf:e_CAM_CAE_OPERATIONS 0" );    //CAE_ENGINE_OPERATIONS_END
+                Event( CCaeStillStatesActive::ECaeEventProcessSnapImageAllReady );            
+                }
+            else
+                {
+                // Note: negative status values are handled as "external errors"
+                // in RunL().
+                if ( iStatus.Int() <= 0 )
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent)iStatus.Int() );    
+                    }
+                else
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent) KErrGeneral );    
+                    }
+                }
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverSnapImage
+// Deliver the snap image to the client.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverSnapImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDeliverSnapImage()" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+
+    if ( iSnapBitmap )
+        {
+        iCaeObserver->McaeoSnapImageReady( *iSnapBitmap, KErrNone );  
+        delete( iSnapBitmap );
+        iSnapBitmap = NULL;   
+        }
+    else
+        {
+        iCaeObserver->McaeoSnapImageReady( *iBitmap, KErrNone );  
+        }
+   
+    if ( !iStillCancelled )
+        {
+        if ( ExtModeActive() )
+            {
+            Event( CCaeStillStatesActive::ECaeEventEnd ); // extension mode operation is completed
+            }
+        else
+            {
+            Event( CCaeStillStatesActive::ECaeEventDeliverSnapImageReady );
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoExtensionsProcessStillImage
+//
+// Call the extensions for processing the still image. Subsequent synchronous
+// methods are called inside a loop. After an asynchronous method, the extension
+// signals the state machine which calls this function again for the next 
+// extension.  
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoExtensionsProcessStillImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoExtensionsProcessStillImage()" ) );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSTILLIMAGE, "e_CAM_CAE_OPERATIONS 1" );  //CAE_ENGINE_OPERATIONS_START
+        
+	TBool isAsyncOperation = EFalse;
+
+	// Execute synchronous operations in loop. Exit the loop if there is an 
+	// asynchronous function or a syncronous function has returned error status.  
+	
+	while ( iStatus == KErrNone  
+            && !iStillCancelled
+		    && !isAsyncOperation 
+		    && ( ++iCurrentExtensionIndex <  iProcessImageImplList.Count() ) )
+		{
+
+        TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+
+        // Call extensions. Note that references to image pointers are given as
+        // parameters. The engine has shared the ownership with the extensions,
+        // which can also delete and create new images.
+        if ( iProcessImageImplList[iCurrentExtensionIndex].iIsActive )
+            {
+    		isAsyncOperation = STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->ProcessStillImage(
+                iStatus, iBitmap, iImageData, iImageHeaderData );
+            }
+        else
+            {
+	        LOGTEXT2(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessStillImage(). Skipping extension %x"),
+	            iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+            }
+	    
+	    #ifdef _DEBUG
+	    if ( ( iStatus != KErrNone ) && ( iStatus != KRequestPending ) )
+	        {
+	        LOGTEXT3(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessStillImage(). Error %d in ProcessStillImage() for Extension %x"),
+	            iStatus.Int(), iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+	        }
+	    #endif
+		}
+
+    if (!iStillCancelled)
+        {
+		// Note: For an asynchronous operation the status can be KErrNone 
+		//       if the operation has already finished and this thread has 
+		//       been signaled. 
+		if ( ( iStatus == KErrNone || iStatus == KRequestPending ) && isAsyncOperation )
+			{
+			// Come back after an asynchronous operation has finished
+			SetActive();
+			}
+		else
+			{
+            iCurrentExtensionIndex = -1;
+            if ( iStatus == KErrNone )
+                {
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSTILLIMAGE, "e_CAM_CAE_OPERATIONS 0" ); //CAE_ENGINE_OPERATIONS_END
+                Event( CCaeStillStatesActive::ECaeEventProcessStillImageAllReady );            
+                }
+            else
+                {
+                // Note: negative status values are handled as "external errors"
+                // in RunL().
+                if ( iStatus.Int() <= 0 )
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent)iStatus.Int() );    
+                    }
+                else
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent) KErrGeneral );    
+                    }
+                }
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoEncodeStillImageToJpeg
+//
+// Encode bitmap to the Jpeg image. CCaeStillEncoder calls 
+// McaeseoHBufC8ImageReady callback when encoding is ready.
+// Note that the callback can be called synchronously by , iStillEncoder
+// if an error occurs in the still encoder. In that case also
+// ErrorRecovery() has been called in McaeseoHBufC8ImageReady() *before* 
+// the method below returns.
+//
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoEncodeStillImageToJpeg()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoEncodeStillImageToJpeg()" ) );
+    // Ownership will be transferred. Null the pointer already before the method
+    // call because it can call McaesdoCFbsBitmapImageReady() callback synchronously 
+    // inside the method.
+    CFbsBitmap* tmpBitmap = iBitmap;   
+	iBitmap = NULL; 
+	iStillEncoder->SetCompressionQuality( iStillCompressionQuality );
+	TRAPD( error, iStillEncoder->ConvertCFbsBitmapToHBufC8L( tmpBitmap ) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeCreateAndDeliverStillImageError( error );
+    #endif
+
+    if ( error )
+        {
+        // Handle error
+        ErrorRecovery( error );
+        }
+   }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverStillImage
+// 
+// Deliver the still image to the client and delete internal images after that.
+// Note: If ownership is transferred, the image pointers should be NULLed before
+// calling the observer method. That is because the observer method can call back
+// CancelStill() which tries to delete images. That is no allowed as images 
+// should be owned by the observer.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverStillImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDeliverStillImage()" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled && ( iSnapBitmap == NULL ) );
+
+    // Deliver the still image to the client.
+    if ( IsBitmapOutput() )
+        {
+        CFbsBitmap* tmpBitmap = iBitmap;
+        iBitmap = NULL; // ownership is transferred      
+        OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DODELIVERSTILLIMAGE, "e_CAM_ENG_SHOT_TO_STILL 0" ); //CAE_ENGINE_SHOT_TO_STILL_END
+        iCaeObserver->McaeoStillImageReady( tmpBitmap, NULL, KErrNone );
+        }
+    else
+        {
+        HBufC8* tmpImageData = iImageData;   
+        iImageData = NULL; // Ownership is tranferred
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DODELIVERSTILLIMAGE, "e_CAM_ENG_SHOT_TO_STILL 0" );    //CAE_ENGINE_SHOT_TO_STILL_END
+        iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, KErrNone );
+        }
+ 
+    // Delete all that is not NULL already. 
+    delete iImageData;
+    iImageData = NULL;
+    delete iImageHeaderData;
+    iImageHeaderData = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+
+    Event( CCaeStillStatesActive::ECaeEventEnd ); // The end. Actuall does no issue any event. 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StartQuickCapture()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::StartQuickCapture()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StartQuickCapture()" ) );
+    CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateNone );
+    HandleStart();
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ExtModeActive()
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::ExtModeActive()
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ExtModeActive() %d" ), iExtModeActive );
+    return( iExtModeActive );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetExtModeActiveL()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetExtModeActiveL( TBool aExtModeActive )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::SetExtModeActiveL() %d" ), aExtModeActive );
+    iExtModeActive = aExtModeActive;
+    iStillCancelled = EFalse;           // clear previous cancel request of still capture
+
+    // Create new instance of still image queue object.
+    if ( aExtModeActive && !iImageQueueExtPro )
+        {
+        iImageQueueExtPro = CCaeImageQueueExtPro::NewL();
+        }
+    else if ( !aExtModeActive )
+        {
+        delete iImageQueueExtPro;
+        iImageQueueExtPro = 0;
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ProcessExtSnapImage
+// Process extension for snap image
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::ProcessExtSnapImage( CFbsBitmap* aSnapImage )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ProcessExtSnapImage()" ));
+    
+    TInt result = iImageQueueExtPro->AppendImage( aSnapImage, NULL, EFalse, ETrue );
+    if ( result == KErrNone &&                                      // image was saved ok
+        iCurrentState == CCaeStillStatesActive::ECaeStateNone &&    // state machine is idle
+        iImageQueueExtPro->ImageCount() < 2 )                       // queue was empty
+        {
+        // Send event to start processing, state machine will stop when queue is empty
+        // and return then back to ECaeStateNone state
+        Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+        }
+    return ( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ProcessExtCapturedImage
+// Process extension for captured jpg image
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::ProcessExtCapturedImage( HBufC8* aImageData, TBool aLastImage  )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ProcessExtCapturedImage() jpg" ));
+
+    TInt result = KErrNone;
+    result = iImageQueueExtPro->AppendImage( NULL, aImageData, aLastImage, EFalse );
+
+    if ( result == KErrNone &&                                      // image was saved ok
+        iCurrentState == CCaeStillStatesActive::ECaeStateNone &&    // state machine is idle
+        iImageQueueExtPro->ImageCount() < 2 )                       // queue was empty
+        {
+        // Send event to start processing, state machine will stop when queue is empty
+        // and return then back to ECaeStateNone state
+        Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+        }
+
+    return ( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ProcessExtCapturedImage
+// Process extension for captured bitmap image
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::ProcessExtCapturedImage( CFbsBitmap* aImageBitmapData, TBool aLastImage  )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ProcessExtCapturedImage() bitmap" ));
+
+    TInt result = KErrNone;
+    result = iImageQueueExtPro->AppendImage( aImageBitmapData, NULL, aLastImage, EFalse );
+
+    if ( result == KErrNone &&                                      // image was saved ok
+        iCurrentState == CCaeStillStatesActive::ECaeStateNone &&    // state machine is idle
+        iImageQueueExtPro->ImageCount() < 2 )                       // queue was empty
+        {
+        // Send event to start processing, state machine will stop when queue is empty
+        // and return then back to ECaeStateNone state
+        Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+        }
+
+    return ( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetBurstModeVFOptimization()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetBurstModeVFOptimization(
+    TBool aBurstModeVFOptimization )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::SetBurstModeVFOptimization(%d)" ), aBurstModeVFOptimization);
+    iBurstModeVFOptimization = aBurstModeVFOptimization;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillStatesActiveBurst.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,628 @@
+/*
+* Copyright (c) 2005 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image burst capturing 
+*                interface implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeStillBurst.h"                  // Still capturing burst mode class.
+#include "CaeStillStatesActive.h"           // Still capturing burst mode class.
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetCaeStillBurstObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetCaeStillBurstObserver( 
+    MCaeStillBurstObserver& aObserver )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetCaeStillBurstObserver()" ) );
+    iCaeStillBurstObserver = &aObserver;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillCaptureImageCountL
+// Delete old instance and create a new burst object if required. 
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::SetStillCaptureImageCountL( 
+    TInt aImageCount )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() entering" ) );
+
+    // Leave if still capturing is running.
+    if ( IsRunning() ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() leaving KErrNotReady (IsRunning)" ) );
+        User::Leave( KErrNotReady );
+        }
+    
+    // Leave if the image count requested is invalid.
+    if ( aImageCount <= 0 ) 
+        {
+        LOGTEXT2( _L( "Cae: invalid input argument aImageCount = %d, leaving KErrArgument" ), aImageCount );
+        User::Leave( KErrArgument );
+        }
+
+    // Delete possible old still burst instance.
+    DeleteStillBurst();
+
+    // Prepare for burst capturing if requested image count more than 1.
+    // Otherwise iStillBurst stays NULL.
+    if ( aImageCount > 1 )
+        {
+        // Create new instance of still image burst object.
+        iStillBurst = CCaeStillBurst::NewL();
+
+        // Set parameter(s).
+        iStillBurst->SetLengthL( aImageCount );
+
+        LOGTEXT2( _L( "Cae: image count set successfully = %d" ), aImageCount );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() returning" ) );    
+
+    return aImageCount;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillCaptureImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::StillCaptureImageCount() const
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StillCaptureImageCount() entering" ) );
+    
+    // Nonexistence of still burst object implies image count of 1 
+    // (= normal single still capture).
+    TInt imageCount( 1 );
+    if ( iStillBurst ) 
+        {
+        imageCount = iStillBurst->Length();
+        }
+        
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::StillCaptureImageCount() returning: %d" ), imageCount );
+    
+    return imageCount;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillBurstCaptureIntervalL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetStillBurstCaptureIntervalL( 
+    TTimeIntervalMicroSeconds aInterval )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL()" ) );
+
+    if ( IsRunning() ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL(), leaving KErrNotReady" ) );
+        User::Leave( KErrNotReady );
+        }
+        
+    // Note: KMaxTInt32 in microseconds is about 35 minutes
+    if ( aInterval < TTimeIntervalMicroSeconds( 0 ) || 
+         aInterval > TTimeIntervalMicroSeconds( KMaxTInt32 ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL(), leaving KErrArgument" ) );
+        User::Leave( KErrArgument );
+        }
+
+    iStillBurstCaptureInterval = I64INT( aInterval.Int64() );
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillBurstCaptureInterval
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeStillStatesActive::StillBurstCaptureInterval() const 
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StillBurstCaptureInterval()" ) );
+    
+    TInt64 intInterval = iStillBurstCaptureInterval.Int();
+
+    TTimeIntervalMicroSeconds interval( intInterval );
+
+    return interval;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StopStillBurstCapture
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::StopStillBurstCapture()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StopStillBurstCapture()" ) );
+
+    iStillBurstStopped = ETrue;
+    
+    // Complete early any pending delayed event 
+	if ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+    	{
+        iDelayedCallTimer.Cancel();
+        }
+    }
+
+
+// ==================== PRIVATE MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+// Fetch the first burst image from the array, or continue burst capturing.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( iStillBurst->IsBurstCaptured() || iStillBurstStopped )
+        {
+        // Fetch the first burst image from the array
+
+        iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage;
+        iStillBurstDeliveryStarted = ETrue;            
+        DoFetchNextBurstImage();
+        }
+    else
+        {         
+        // Continue burst capturing.
+        // If view finder is enabled, at least one view finder image 
+        // should be received before the next capture.
+        // Otherwise, start directly the next capture.
+
+         // wait alway next iViewFinderFrameReceived if optimization is not used
+         // with optimization old VF updates are acccepted
+        if ( iIsViewFinderEnabled &&
+             !(iBurstModeVFOptimization && iViewFinderFrameReceived ) )
+            {
+            LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleAppendCapturedBurstImageReady(). Waiting for the view finder." ) );
+            iCurrentState = CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder;            
+            }
+        else        
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateCapturingBurst;            
+            DoCaptureStillBurstImage();
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleBurstImageFetchReady()
+// Decode the captured image, extract Exif metadata, or process the 
+// image by the extensions.  
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleBurstImageFetchReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleBurstImageFetchReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( !iBitmap                   // Does not already exist
+         && ( iCreateSnapImage ) )   // Snap bitmap required by UI
+        {
+        // Need to decode first.
+        iCurrentState = CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap;            
+        DoDecodeCapturedImageToBitmap();
+        }
+    else
+        {
+        // No need to decode.
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;            
+            DoExtensionsProcessCapturedImage();    
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+// Complete still burst or fetch the next image.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleDeliverStillBurstImageReady()" ));
+    CAE_ASSERT_ALWAYS( iStillBurst && ( iBitmap == NULL ) && ( iImageData == NULL ) && ( iSnapBitmap == NULL ) );
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( CheckForStillBurstCompletion() )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateCompletingStillBurst;            
+        DoCompleteStillBurst();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage;            
+        DoFetchNextBurstImage();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurst
+// Start the burst and capture the first burst image.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurst() entering" ) );
+    MEM();
+ 
+    iFirstStillBurstError = KErrNone;
+    iStillBurstDeliveryStarted = EFalse;
+        
+    // Do not wait for the view finder for the first capture
+    iViewFinderFrameReceived = ETrue; 
+    iStillCancelled = EFalse;
+
+    // Capture the first image in the burst.
+    DoCaptureStillBurstImage();
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurst() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurstImage
+// Capture one image for the burst.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurstImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() entering" ) );
+    MEM();
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+
+    // Notify client about capturing moment.
+    if ( !iStillBurstStopped )
+        {
+        iCaeStillBurstObserver->McaesboStillBurstCaptureMoment( KErrNone );       
+        }
+
+    // Note: If still burst is cancelled in the callback, the state 
+    // machine has already been reseted. Any member data is not allowed
+    // to be changed any more. Just return from this function. 
+
+    if ( !iStillCancelled && !iStillBurstStopped ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() capture next image" ) );
+        iViewFinderFrameReceived = EFalse;
+        iCamera.CaptureImage();
+        }
+
+    // Separate "if" (instead of "else if") due 
+    // the possibility of stopping or cancelling in callback above.
+    if ( !iStillCancelled ) // Return immediately, if cancelled
+        {
+        if ( iStillBurstStopped )
+            {
+            // Deliver the images to the client if the burst was stopped.
+            // This call delivers the first image in the burst.
+            if ( !iStillBurstDeliveryStarted )
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage(): burst stopped, starting delivery" ) );
+                iStillBurstDeliveryStarted = ETrue;
+                Event( CCaeStillStatesActive::ECaeEventBurstCaptureReady );
+                }
+        
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoAppendCapturedBurstImageToArray
+// Append the captured image to the still burst array.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoAppendCapturedBurstImageToArray()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray() entering" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+    MEM();
+
+    TInt error = iFirstStillBurstError; // We may have had error during previous capture phase
+
+    if ( !error ) 
+        {
+        // Put the image into buffer.
+        // All appended images will have KErrNone code.
+        // AppendImage does not delete the image if unable to append (error is returned).
+        error = iStillBurst->AppendImage( iBitmap, iImageData, KErrNone ); 
+        }
+
+    if ( !error ) 
+        {
+        // Ownership transferred
+        iBitmap = NULL;
+        iImageData = NULL;
+        }
+    else
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray(): error detected: %d" ), error );
+    	    
+        // Delete images
+        delete( iBitmap );
+        iBitmap = NULL;
+	    delete( iImageData );
+        iImageData = NULL;
+
+        iFirstStillBurstError =  iFirstStillBurstError ? iFirstStillBurstError : error;
+        iStillBurstStopped = ETrue; // Stop burst if an error was detected.    
+        }
+
+    if ( !iStillBurstStopped && !iStillBurst->IsBurstCaptured() ) 
+        {
+        // Activate (delayed) capturing of new image if burst is not complete yet.
+        Event( CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady, iStillBurstCaptureInterval );
+        }
+    else  
+        {
+        // Start delivering immediately
+        Event( CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoFetchNextBurstImage
+// Get the next image from the burst array.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoFetchNextBurstImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage() entering" ) );
+    MEM();
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iImageData == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+    CAE_ASSERT_ALWAYS( iStillBurst );
+
+    if ( ExtModeActive() ) // Extension processing mode
+        {
+            Event( CCaeStillStatesActive::ECaeEventEnd ); // extension mode operation is completed when queue is empty
+        }
+    else  // Normal mode
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage(): count of burst images in queue = %d" ), iStillBurst->ImageCount() );
+
+        // Get next image from the array
+
+        CFbsBitmap* bitmap = NULL; 
+        HBufC8* imageData = NULL;
+        TInt imageError( KErrNone );
+
+        TInt error = iStillBurst->GetNextImage( bitmap, imageData, imageError );
+
+        // If there is no items in the array, return the first error
+        if ( (error == KErrUnderflow) && iFirstStillBurstError)
+            {
+            error = iFirstStillBurstError;
+            }
+
+        error = error ? error : imageError;
+        iImageData = imageData;
+        iBitmap = bitmap;
+
+        if ( error )
+            {
+            // Handle error
+            ErrorRecovery( error );                    
+            }
+        else
+            {
+            Event( CCaeStillStatesActive::ECaeEventBurstImageFetchReady );
+            }
+        }
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CheckForStillBurstCompletion
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::CheckForStillBurstCompletion()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CheckForStillBurstCompletion()" ) );
+    MEM();
+    
+    TBool burstShouldBeCompleted( EFalse );
+
+    if ( iStillBurst )
+        {
+        if ( ExtModeActive() )  // In extension mode client knows when completed
+            {
+            burstShouldBeCompleted = iLastImageExtPro;
+            }
+        else if ( iCountOfProcessedBurstImages >= iStillBurst->CaptureCount() ) // Normal mode
+            {
+            // All captures have now been processed, ready to complete the burst.
+            LOGTEXT2( _L( "Cae: CCaeStillStatesActive::CheckForStillBurstCompletion(): Burst complete, count of images = %d" ), iCountOfProcessedBurstImages );
+            burstShouldBeCompleted = ETrue;
+            }
+        }
+
+    return( burstShouldBeCompleted );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::BurstErrorRecovery
+// Recover from burst errors.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::BurstErrorRecovery( TInt aError )
+    {
+    // Handle burst image mode errors   
+    
+    // Store error code
+    iFirstStillBurstError =  iFirstStillBurstError ? iFirstStillBurstError : aError;
+
+    iCountOfProcessedBurstImages++;
+
+    // Delete all images which are not deleted already. 
+    delete iSnapBitmap;
+    iSnapBitmap = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iImageData;
+    iImageData = NULL;
+
+    // Ignore error and continue processing
+    Event( CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady );       
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCompleteStillBurst
+// Complete still image burst capture. 
+// Calls the observer method McaesboStillBurstComplete if capturing was not 
+// cancelled.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCompleteStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst() entering" ) );
+
+    if ( !iStillCancelled && IsRunning() )
+        {
+        // Notify client about completing the burst.
+        iCaeStillBurstObserver->McaesboStillBurstComplete( iCountOfDeliveredBurstImages, iFirstStillBurstError );
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst(): Count of delivered burst images = %d" ), iCountOfDeliveredBurstImages );
+        }
+    iFirstStillBurstError = KErrNone;
+    CompleteStillBurst();
+    Event( CCaeStillStatesActive::ECaeEventEnd ); // The end. Actuall does not issue any event. 
+
+    MEM();
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverStillBurstImage
+//
+// Deliver the still burst image to the client and delete internal images after that.
+// Note: If ownership is transferred, the image pointers should be NULLed before
+// calling the observer method. That is because the observer method can call back
+// CancelStill() which tries to delete images. That is no allowed as images 
+// should be owned by the observer.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverStillBurstImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDeliverStillBurstImage()" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled && ( iSnapBitmap == NULL ) );
+
+    // Deliver the still burst image to the client.
+    if ( IsBitmapOutput() )
+        {
+        // Give original image to the client even if there is decoding error.
+        CFbsBitmap* tmpBitmap = iBitmap;
+        iBitmap = NULL; // ownership is transferred      
+        iCaeObserver->McaeoStillImageReady( tmpBitmap, NULL, KErrNone );
+        }
+    else
+        {
+        // Give original image to the client even if there is encoding error
+        HBufC8* tmpImageData = iImageData;   
+        iImageData = NULL; // Ownership is tranferred
+        iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, KErrNone );
+        }
+
+    iCountOfDeliveredBurstImages++;
+    iCountOfProcessedBurstImages++;
+
+    // Delete all that is not NULL already. 
+    delete iImageData;
+    iImageData = NULL;
+    delete iImageHeaderData;
+    iImageHeaderData = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+
+    Event( CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CompleteStillBurst()
+// Complete still image burst capture but do not delete still burst object. 
+// Calls the observer method McaesboStillBurstComplete if capturing was not 
+// cancelled.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CompleteStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CompleteStillBurst() entering" ) );
+    MEM();
+    if ( iStillBurst )
+        {
+        iStillBurst->ResetAndDestroyImages();
+        }
+  
+    iCountOfProcessedBurstImages = 0;
+    iCountOfDeliveredBurstImages = 0;
+    iStillBurstStopped = EFalse;
+    MEM();
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CompleteStillBurst() returning" ) );
+   }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DeleteStillBurst
+// Delete still burst object and reset burst related variables.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DeleteStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DeleteStillBurst() entering" ) );
+
+    delete iStillBurst;
+    iStillBurst = NULL;
+
+    iCountOfProcessedBurstImages = 0;
+    iCountOfDeliveredBurstImages = 0;
+
+    iStillBurstStopped = EFalse;
+
+    MEM();
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DeleteStillBurst() returning" ) );    
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillStatesActiveNoBurst.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still burst 
+*                interface implementation when NOT SUPPORTED
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeStillStatesActive.h"                
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetCaeStillBurstObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetCaeStillBurstObserver( 
+    MCaeStillBurstObserver& /*aObserver*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillCaptureImageCountL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::SetStillCaptureImageCountL( 
+    TInt /*aImageCount*/ )
+    {
+    return 1; // Always one without burst support
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillCaptureImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::StillCaptureImageCount() const
+    {
+    return 1; // Always one without burst support
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillBurstCaptureIntervalL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetStillBurstCaptureIntervalL( 
+    TTimeIntervalMicroSeconds /*aInterval*/ )
+    {
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillBurstCaptureInterval
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeStillStatesActive::StillBurstCaptureInterval() const 
+    {
+    return 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StopStillBurstCapture
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::StopStillBurstCapture()
+    {
+    }
+
+
+// ==================== PRIVATE MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleBurstImageFetchReady()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleBurstImageFetchReady()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurst
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurst()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurstImage
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurstImage()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoAppendCapturedBurstImageToArray
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoAppendCapturedBurstImageToArray()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoFetchNextBurstImage
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoFetchNextBurstImage()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CheckForStillBurstCompletion
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::CheckForStillBurstCompletion()
+    {
+    return( ETrue );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::BurstErrorRecovery
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::BurstErrorRecovery( TInt /*aError*/)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCompleteStillBurst
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCompleteStillBurst()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverStillBurstImage
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverStillBurstImage()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CompleteStillBurst()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CompleteStillBurst()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DeleteStillBurst
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DeleteStillBurst()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeVideoQualityLevels.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video quality level and container
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeVideoQualityLevels.h"
+
+#include "CaeEngineImp.h"       // For LOGTEXT
+
+// CONSTANTS
+const TInt KQualityLevelArrayGranularity = 3;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::CCaeVideoQualityLevelsCont
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoQualityLevelsCont::CCaeVideoQualityLevelsCont()
+: iQltyLevelCountSdKey( KCaeVideoQltyLevelCount )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::~CCaeVideoQualityLevelsCont
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoQualityLevelsCont::~CCaeVideoQualityLevelsCont()
+    {
+    delete iQualityLevels;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::ConstructL()
+    {
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::ConstructL() entering" ) );
+
+    iQualityLevels = new( ELeave ) CArrayFixFlat<CVideoQualityLevel>( KQualityLevelArrayGranularity );
+
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::ConstructL() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoQualityLevelsCont* CCaeVideoQualityLevelsCont::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::NewL() entering" ) );
+
+    CCaeVideoQualityLevelsCont* self = new( ELeave ) CCaeVideoQualityLevelsCont;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::NewL() returning" ) );
+
+    return self;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::InitDefaultsL
+// Sets hardcoded default parameters for default video quality levels that 
+// are created.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeVideoQualityLevelsCont::InitDefaultsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::InitL() entering" ) );
+
+    // Delete all elements from the array and 
+    // free the memory allocated to the array buffer.
+    iQualityLevels->Reset();
+
+    // Initialize hardcoded default quality levels.
+
+    TSize size;
+
+    CVideoQualityLevel* videoQualityLevel = new( ELeave ) CVideoQualityLevel;
+    CleanupStack::PushL( videoQualityLevel );
+    
+    // Level 0:
+    size.SetSize( KImgWidthQCIF, KImgHeightQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 64000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 12200; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 78000;  // That many bits per second to store. Estimate only
+    videoQualityLevel->iKey = KCaeVideoQltyLevel0;
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    // Level 1:
+    size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 60000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 6700;  // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 68000;  // That many bits per second to store. Estimate only
+    videoQualityLevel->iKey = KCaeVideoQltyLevel1;
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    // Level 2:
+    size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 5.0;   // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 40000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 5150;  // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 47000;  // That many bits per second to store. Estimate only
+    videoQualityLevel->iKey = KCaeVideoQltyLevel2;
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    CleanupStack::PopAndDestroy( videoQualityLevel );
+
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::InitL() returning" ) );
+
+    return iQualityLevels->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::Count
+// -----------------------------------------------------------------------------
+//
+TInt CCaeVideoQualityLevelsCont::Count() const
+    {
+    return iQualityLevels->Count();
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::At
+// -----------------------------------------------------------------------------
+//
+CVideoQualityLevel& CCaeVideoQualityLevelsCont::At( 
+    TInt aIndex ) const
+    {
+    return iQualityLevels->At( aIndex );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::Key
+// -----------------------------------------------------------------------------
+//
+const TDes& CCaeVideoQualityLevelsCont::Key( 
+    TInt aIndex ) const
+    {
+    return iQualityLevels->At( aIndex ).iKey;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::ResizeL
+// -----------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::ResizeL( 
+    TInt aQualityLevelCount )
+    {
+    iQualityLevels->ResizeL( aQualityLevelCount );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::QltyLevelCountSdKey
+// -----------------------------------------------------------------------------
+//
+const TDesC& CCaeVideoQualityLevelsCont::QltyLevelCountSdKey() const
+    {
+    return iQltyLevelCountSdKey;
+    }
+
+
+/////////////////////////////
+// CVideoQualityLevel methods 
+/////////////////////////////
+
+
+// -----------------------------------------------------------------------------
+// CVideoQualityLevel::CVideoQualityLevel
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CVideoQualityLevel::CVideoQualityLevel()
+:CQualityLevel()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVideoQualityLevel::~CVideoQualityLevel
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVideoQualityLevel::~CVideoQualityLevel()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeVideoQualityLevelsNoSd.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video quality levels container
+*                with Shared Data API support.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeVideoQualityLevels.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::CreateQualityLevelString()
+// Create quality level string for SharedData Camera ini file.
+// ---------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::CreateQualityLevelString( 
+    TInt  /*aIndex*/,
+    TDes& /*aDefaultQualityLevel*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::ParseQualityLevelFromStringL
+// Parse quality level string to quality level object data.
+// ---------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::ParseQualityLevelFromStringL( 
+    const TDesC& /*aQualityLevelString*/, 
+    TInt         /*aIndex*/ )
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeVideoTimes.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video times provider class 
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeVideoTimes.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::CCaeVideoTimes
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoTimes::CCaeVideoTimes() : 
+    CPeriodic( CActive::EPriorityStandard - 1 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::~CCaeVideoTimes
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoTimes::~CCaeVideoTimes()
+    {
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeVideoTimes::ConstructL()
+    {
+    CPeriodic::ConstructL();
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoTimes* CCaeVideoTimes::NewL()
+    {
+    CCaeVideoTimes* self = new( ELeave ) CCaeVideoTimes;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::RunError
+// Called if CCaeVideoTimes function RunL() leaves.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeVideoTimes::RunError( 
+    TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/traces/CamAppEngineTraceDefinitions.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Trace Definitions
+*
+*/
+
+
+// Created by TraceBuilder.Autogen 0.20.1
+// DO NOT EDIT, CHANGES WILL BE LOST
+
+#ifndef __CAMAPPENGINETRACEDEFINITIONS_H__
+#define __CAMAPPENGINETRACEDEFINITIONS_H__
+
+#include <autogen_symbian_trace_config.h>
+// Empty macro for TraceBuilder data definitions
+#define TB_DATA(x)
+
+#undef CAMAPPENGINE_ERROR
+#define CAMAPPENGINE_ERROR 0xe1
+#undef CAMAPPENGINE_API
+#define CAMAPPENGINE_API 0xe2
+#undef CAMAPPENGINE_FLOW
+#define CAMAPPENGINE_FLOW 0xe3
+#undef CAMAPPENGINE_PERFORMANCE
+#define CAMAPPENGINE_PERFORMANCE 0xe4
+
+RES_BEGIN( RESOURCE_TRC_SYMBIAN, AUTOGEN_NO_RESOURCE_ID, CAMAPPENGINE_TRACE, "CAMAPPENGINE", "", FALSE )
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_ERROR, "CamAppEngine_Error:", ON )
+	
+	TRACE_GROUP_END()
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_API, "CamAppEngine_API:", ON )
+	
+	TRACE_GROUP_END()
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_FLOW, "CamAppEngine_Flow:", ON )
+	
+	TRACE_GROUP_END()
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_PERFORMANCE, "CamAppEngine_Perf:", ON )
+		
+		TRACE_BEGIN( CAE_ENGINE_INIT_START, "e_CAM_ENG_INIT 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_INIT_END, "e_CAM_ENG_INIT 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_STILL_INIT_START, "e_CAM_ENG_STILL_INIT 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_STILL_INIT_END, "e_CAM_ENG_STILL_INIT 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_SHOT_TO_STILL_START, "e_CAM_ENG_SHOT_TO_STILL 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_SHOT_TO_STILL_END, "e_CAM_ENG_SHOT_TO_STILL 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_OPERATIONS_START, "e_CAM_CAE_OPERATIONS 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_OPERATIONS_END, "e_CAM_CAE_OPERATIONS 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+	
+	TRACE_GROUP_END()
+
+RES_END
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/traces/OstTraceDefinitions.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OstTraceDefinitions.h
+*
+*/
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Bmarm/CAESTILLCONVERTERU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+	"_._16CCaeStillEncoder" @ 1 NONAME R3UNUSED ; CCaeStillEncoder::~CCaeStillEncoder(void)
+	Cleanup__16CCaeStillEncoder @ 2 NONAME R3UNUSED ; CCaeStillEncoder::Cleanup(void)
+	CompressionQuality__C16CCaeStillEncoder @ 3 NONAME R3UNUSED ; CCaeStillEncoder::CompressionQuality(void) const
+	ConvertCFbsBitmapToHBufC8L__16CCaeStillEncoderP10CFbsBitmapQ216CCaeStillEncoder13TTargetFormat @ 4 NONAME R3UNUSED ; CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L(CFbsBitmap *, CCaeStillEncoder::TTargetFormat)
+	ConvertHBufC8ToCFbsBitmapL__16CCaeStillDecoderP6HBufC812TDisplayModeRC5TSizeT3 @ 5 NONAME ; CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL(HBufC8 *, TDisplayMode, TSize const &, TSize const &)
+	NewL__16CCaeStillDecoder @ 6 NONAME R3UNUSED ; CCaeStillDecoder::NewL(void)
+	NewL__16CCaeStillEncoder @ 7 NONAME R3UNUSED ; CCaeStillEncoder::NewL(void)
+	SetCompressionQuality__16CCaeStillEncoderi @ 8 NONAME R3UNUSED ; CCaeStillEncoder::SetCompressionQuality(int)
+	SetObserver__16CCaeStillDecoderP24MCaeStillDecoderObserver @ 9 NONAME R3UNUSED ; CCaeStillDecoder::SetObserver(MCaeStillDecoderObserver *)
+	SetObserver__16CCaeStillEncoderP24MCaeStillEncoderObserver @ 10 NONAME R3UNUSED ; CCaeStillEncoder::SetObserver(MCaeStillEncoderObserver *)
+	"_._16CCaeStillDecoder" @ 11 NONAME R3UNUSED ; CCaeStillDecoder::~CCaeStillDecoder(void)
+	Cleanup__16CCaeStillDecoder @ 12 NONAME R3UNUSED ; CCaeStillDecoder::Cleanup(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Bwins/CAESTILLCONVERTERU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+	??1CCaeStillDecoder@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CCaeStillDecoder::~CCaeStillDecoder(void)
+	??1CCaeStillEncoder@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CCaeStillEncoder::~CCaeStillEncoder(void)
+	?Cleanup@CCaeStillDecoder@@QAEXXZ @ 3 NONAME ; public: void __thiscall CCaeStillDecoder::Cleanup(void)
+	?Cleanup@CCaeStillEncoder@@QAEXXZ @ 4 NONAME ; public: void __thiscall CCaeStillEncoder::Cleanup(void)
+	?CompressionQuality@CCaeStillEncoder@@QBEHXZ @ 5 NONAME ; public: int __thiscall CCaeStillEncoder::CompressionQuality(void)const 
+	?ConvertCFbsBitmapToHBufC8L@CCaeStillEncoder@@QAEXPAVCFbsBitmap@@W4TTargetFormat@1@@Z @ 6 NONAME ; public: void __thiscall CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L(class CFbsBitmap *,enum CCaeStillEncoder::TTargetFormat)
+	?ConvertHBufC8ToCFbsBitmapL@CCaeStillDecoder@@QAEXPAVHBufC8@@W4TDisplayMode@@ABVTSize@@2@Z @ 7 NONAME ; public: void __thiscall CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL(class HBufC8 *,enum TDisplayMode,class TSize const &,class TSize const &)
+	?NewL@CCaeStillDecoder@@SAPAV1@XZ @ 8 NONAME ; public: static class CCaeStillDecoder * __cdecl CCaeStillDecoder::NewL(void)
+	?NewL@CCaeStillEncoder@@SAPAV1@XZ @ 9 NONAME ; public: static class CCaeStillEncoder * __cdecl CCaeStillEncoder::NewL(void)
+	?SetCompressionQuality@CCaeStillEncoder@@QAEXH@Z @ 10 NONAME ; public: void __thiscall CCaeStillEncoder::SetCompressionQuality(int)
+	?SetObserver@CCaeStillDecoder@@QAEXPAVMCaeStillDecoderObserver@@@Z @ 11 NONAME ; public: void __thiscall CCaeStillDecoder::SetObserver(class MCaeStillDecoderObserver *)
+	?SetObserver@CCaeStillEncoder@@QAEXPAVMCaeStillEncoderObserver@@@Z @ 12 NONAME ; public: void __thiscall CCaeStillEncoder::SetObserver(class MCaeStillEncoderObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Bwinscw/CAESTILLCONVERTERU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+	??1CCaeStillDecoder@@UAE@XZ @ 1 NONAME ; CCaeStillDecoder::~CCaeStillDecoder(void)
+	??1CCaeStillEncoder@@UAE@XZ @ 2 NONAME ; CCaeStillEncoder::~CCaeStillEncoder(void)
+	?Cleanup@CCaeStillDecoder@@QAEXXZ @ 3 NONAME ; void CCaeStillDecoder::Cleanup(void)
+	?Cleanup@CCaeStillEncoder@@QAEXXZ @ 4 NONAME ; void CCaeStillEncoder::Cleanup(void)
+	?CompressionQuality@CCaeStillEncoder@@QBEHXZ @ 5 NONAME ; int CCaeStillEncoder::CompressionQuality(void) const
+	?ConvertCFbsBitmapToHBufC8L@CCaeStillEncoder@@QAEXPAVCFbsBitmap@@W4TTargetFormat@1@@Z @ 6 NONAME ; void CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L(class CFbsBitmap *, enum CCaeStillEncoder::TTargetFormat)
+	?ConvertHBufC8ToCFbsBitmapL@CCaeStillDecoder@@QAEXPAVHBufC8@@W4TDisplayMode@@ABVTSize@@2@Z @ 7 NONAME ; void CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL(class HBufC8 *, enum TDisplayMode, class TSize const &, class TSize const &)
+	?NewL@CCaeStillDecoder@@SAPAV1@XZ @ 8 NONAME ; class CCaeStillDecoder * CCaeStillDecoder::NewL(void)
+	?NewL@CCaeStillEncoder@@SAPAV1@XZ @ 9 NONAME ; class CCaeStillEncoder * CCaeStillEncoder::NewL(void)
+	?SetCompressionQuality@CCaeStillEncoder@@QAEXH@Z @ 10 NONAME ; void CCaeStillEncoder::SetCompressionQuality(int)
+	?SetObserver@CCaeStillDecoder@@QAEXPAVMCaeStillDecoderObserver@@@Z @ 11 NONAME ; void CCaeStillDecoder::SetObserver(class MCaeStillDecoderObserver *)
+	?SetObserver@CCaeStillEncoder@@QAEXPAVMCaeStillEncoderObserver@@@Z @ 12 NONAME ; void CCaeStillEncoder::SetObserver(class MCaeStillEncoderObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Eabi/CaeStillConverterU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,18 @@
+EXPORTS
+	_ZN16CCaeStillDecoder11SetObserverEP24MCaeStillDecoderObserver @ 1 NONAME
+	_ZN16CCaeStillDecoder26ConvertHBufC8ToCFbsBitmapLEP6HBufC812TDisplayModeRK5TSizeS5_ @ 2 NONAME
+	_ZN16CCaeStillDecoder4NewLEv @ 3 NONAME
+	_ZN16CCaeStillDecoder7CleanupEv @ 4 NONAME
+	_ZN16CCaeStillDecoderD0Ev @ 5 NONAME
+	_ZN16CCaeStillDecoderD1Ev @ 6 NONAME
+	_ZN16CCaeStillDecoderD2Ev @ 7 NONAME
+	_ZN16CCaeStillEncoder11SetObserverEP24MCaeStillEncoderObserver @ 8 NONAME
+	_ZN16CCaeStillEncoder21SetCompressionQualityEi @ 9 NONAME
+	_ZN16CCaeStillEncoder26ConvertCFbsBitmapToHBufC8LEP10CFbsBitmapNS_13TTargetFormatE @ 10 NONAME
+	_ZN16CCaeStillEncoder4NewLEv @ 11 NONAME
+	_ZN16CCaeStillEncoder7CleanupEv @ 12 NONAME
+	_ZN16CCaeStillEncoderD0Ev @ 13 NONAME
+	_ZN16CCaeStillEncoderD1Ev @ 14 NONAME
+	_ZN16CCaeStillEncoderD2Ev @ 15 NONAME
+	_ZNK16CCaeStillEncoder18CompressionQualityEv @ 16 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Group/CaeStillConverter.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Image Converter
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          CaeStillConverter.dll
+TARGETTYPE      dll
+
+UID             0x1000008d 0x101F856A
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH      ../Src
+
+SOURCE          CaeStillConverter.cpp
+SOURCE          CaeStillEncoder.cpp
+SOURCE          CaeStillDecoder.cpp
+
+USERINCLUDE     ../Inc
+USERINCLUDE     ../../../inc       // MW level inc dir
+USERINCLUDE     ../../Engine/traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         imageconversion.lib
+
+LIBRARY         efsrv.lib
+LIBRARY         fbscli.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Group/CaeStillConverterTestVersion.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Image Converter 
+*                (TEST VERSION! For developers only.)
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET 		CaeStillConverter.dll
+TARGETTYPE      dll
+
+UID           	0x1000008d 0x101F856A
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+MACRO           CAE_TEST_VERSION
+#define     	CAE_TEST_VERSION
+
+SOURCEPATH    	../Src
+
+SOURCE          CaeStillConverter.cpp
+SOURCE          CaeStillEncoder.cpp
+SOURCE          CaeStillDecoder.cpp
+
+#ifdef CAE_TEST_VERSION
+SOURCE          CaeStillConverterTestErrors.cpp
+#endif
+
+USERINCLUDE   	../Inc
+USERINCLUDE	    ../../../inc      // MW level inc dir
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY        	euser.lib
+LIBRARY         imageconversion.lib
+
+LIBRARY         efsrv.lib
+LIBRARY         fbscli.lib
+
+EXPORTUNFROZEN
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Image Converter
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+CaeStillConverter.mmp
+
+PRJ_TESTMMPFILES
+CaeStillConverterTestVersion.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillCommon.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Converter Common
+*
+*/
+
+
+
+#ifndef CAESTILLCOMMON_H
+#define CAESTILLCOMMON_H
+
+// INCLUDES
+
+// CONSTANTS
+
+// Logging support
+// Serial port logging is enabled in _DEBUG builds by default
+// USE_FILE_LOGGER or USE_SERIAL_LOGGER can also be explicitely defined e.g. in MMP file.
+//
+#if defined (_DEBUG) && !defined(USE_FILE_LOGGER)                   
+    #define USE_SERIAL_LOGGER 
+#endif
+                                    
+#if defined (USE_FILE_LOGGER)
+    #include <flogger.h>
+    _LIT(KLogFile,"cae.txt");
+    _LIT(KLogFolder,"cae");
+    #define LOGTEXT(AAA)                RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA)
+    #define LOGTEXT2(AAA,BBB)           RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) RFileLogger::HexDump(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA,BBB,CC,DDD)    
+#elif defined (USE_SERIAL_LOGGER) 
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RDebug::Print(AAA,BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) 
+#endif                              
+
+
+// CLASS DECLARATION
+
+
+
+#endif // CAESTILLCOMMON_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillConverter.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Converter base class for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAESTILLCONVERTER_H
+#define CAESTILLCONVERTER_H
+
+// INCLUDES
+#include <imageconversion.h>
+
+// CONSTANTS
+
+const TUid KUidSpecialFreeScalingDecoder = { 0x101FF555 }; // This decoder supports free scaling
+
+// CLASS DECLARATION
+
+/**
+* Still Converter class.
+* Base class for still image conversions by the Camera Application Engine.
+*/
+NONSHARABLE_CLASS( CCaeStillConverter ) : public CActive
+    {
+    
+    public: 
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeStillConverter();
+
+    protected:
+
+        /**
+        * Internal state.
+        */
+        enum 
+            {
+            EIdle,
+            EConvert
+            };
+
+    protected:  // Functions from base classes
+        /**
+        * From CActive, handles an active object’s request completion event.
+        * @return void
+        */
+        void RunL();
+
+        /**
+        * From CActive, called if CCaeStillConverter function RunL() leaves.
+        * @param aError Standard Symbian OS error code
+        * @return Error code KErrNone
+        */
+        TInt RunError( 
+            TInt aError );
+
+    protected:
+        /**
+        * C++ constructor.
+        */
+        CCaeStillConverter();
+
+        /**
+        * Symbian 2nd phase constructor that can leave.
+        * This is intended to be called from derived class ConstructL().
+        */
+        void ConstructL();
+
+    protected:
+        /**
+        * Returns the engine state.
+        * @return Boolean indicating if Still Converter is busy
+        */
+        TBool IsBusy() const;
+
+    protected: // To be implemented in a derived class.
+        /**
+        * Converts (encodes or decodes) the image.
+        * @return void
+        */
+        virtual void ConvertL() = 0;
+   
+        /**
+        * Perfoms necessary cleanup and delivers the result to the client.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code
+        * @return void
+        */
+        virtual void ConversionComplete( 
+            TInt aError ) = 0;
+
+        /** 
+        * Sets the specific image codec implementation to be used in decoding and encoding.
+        * @since 3.1
+        * @param aCodecUid The UID of the specific image codec to be used.
+        * @return void
+        */
+        virtual void SetImageCodecL( 
+        	TUid aCodecUid ) = 0;
+        	
+    protected:  // Data
+
+        // Class for image data.
+        class CImageItem: public CBase
+            {
+            public:
+                CImageItem() {};
+                virtual ~CImageItem() 
+                    {
+                    delete iBitmap;
+                    delete iImageBuffer;
+                    delete iFrameImageData;
+                    };
+            public:
+                // Bitmap.
+                CFbsBitmap* iBitmap;
+                // Bitmap target size.
+                TSize iBitmapSize;
+                // Bitmap target size for free scaling.
+                TSize iFullyScaledBitmapSize;
+               // Bitmap display mode.
+                TDisplayMode iBitmapDisplayMode;
+                // Image in some common image file format (like Jpeg)
+                HBufC8* iImageBuffer;
+                 // Info for encoder
+                CFrameImageData* iFrameImageData;
+                // UID of conversion target image type.
+                TUid iImageTypeUid;
+            };
+
+        // Specific image codec UID.
+        TUid iImageCodecUid;
+
+        // Pointer to array of CImageItem.
+        RPointerArray<CImageItem>* iImageQueue;
+
+        // Still Converter state.
+        TInt iState;
+        
+    };
+
+
+#endif // CAESTILLCONVERTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillConverterTestErrors.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Converter error simulation 
+*                global functions for testing (CAE_TEST_VERSION only)
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+#ifndef CAESTILLCONVERTERTESTERRORS_H
+#define CAESTILLCONVERTERTESTERRORS_H
+
+IMPORT_C void CaeSetConvertCFbsBitmapToHBufC8Error( TInt aError );
+
+IMPORT_C void CaeConvertCFbsBitmapToHBufC8ErrorL();
+
+IMPORT_C void CaeSetConvertHBufC8ToCFbsBitmapError( TInt aError );
+
+IMPORT_C void CaeConvertHBufC8ToCFbsBitmapErrorL();
+
+IMPORT_C void CaeSetStillConvertError( TInt aError );
+
+IMPORT_C void CaeStillConvertErrorL();
+
+#endif // CAESTILLCONVERTERTESTERRORS_H
+
+#endif // CAE_TEST_VERSION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillDecoder.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Decoder for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAESTILLDECODER_H
+#define CAESTILLDECODER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32file.h>
+#include <imageconversion.h>
+#include <ecam.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Still decoder observer class.
+*  User of CCaeStillDecoder class must derive from this interface.
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+class MCaeStillDecoderObserver
+    {
+    public:
+        /**
+        * Called back by CCaeStillDecoder when it completes conversion (decoding) to CFbsBitmap image.
+        * @since 2.1
+        * @param aImageData Source image (as JPEG)
+        * @param aBitmap Converted Symbian OS bitmap image
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code
+        * @param aImageSize Decoded image size
+        * @return void
+        */
+        virtual void McaesdoCFbsBitmapImageReady( 
+            HBufC8* aImageData, 
+            CFbsBitmap* aBitmap, 
+            TInt aError,
+            TInt aImageSize ) = 0;
+    };
+
+
+// CLASS DECLARATION
+
+/**
+* Still Decoder class.
+* Implements still image decoding for Camera Application Engine 
+* using Symbian Image Conversion Library (ICL)
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+NONSHARABLE_CLASS( CCaeStillDecoder ) : public CCaeStillConverter
+    {
+    public:  // Constructor and destructor    
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CCaeStillDecoder* NewL();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CCaeStillDecoder();
+
+    public: // From CCaeStillConverter:
+
+        void SetImageCodecL( 
+        	TUid aCodecUid );
+        	
+    public: // New functions
+        /**
+        * Sets Still Decoder observer.
+        * @since 2.1
+        * @param aObserver Still Decoder observer
+        * @return void
+        */
+        IMPORT_C void SetObserver( 
+            MCaeStillDecoderObserver* aObserver );
+
+        /** 
+        * Creates the CImageItem object, places it in the internal queue and 
+        * starts the memory image conversion where the memory image (e.g. JPEG) 
+        * is converted to bitmap. 
+        * @param aImageBuffer Memory image to convert. Ownership is given.
+        * @param aTargetBitmapMode Target/destination bitmap color mode
+        * @param aTargetBitmapSize Target/destination bitmap size without free scaling decoder
+        * @param aFullyScaledTargetBitmapSize Target/destination bitmap size with free scaling decoder
+        * @return void
+        */
+        IMPORT_C void ConvertHBufC8ToCFbsBitmapL( 
+            HBufC8* aImageBuffer,
+            TDisplayMode aTargetBitmapMode,
+            const TSize& aTargetBitmapSize,
+            const TSize& aFullyScaledTargetBitmapSize = TSize( 0, 0 ) );
+
+        /**
+        * Destroys all allocations for decoding, as the images from the queue.
+        * @return void
+        */
+        IMPORT_C void Cleanup();
+
+    protected: // Constructors
+        /**
+        * C++ constructor.
+        */
+        CCaeStillDecoder();
+
+        /**
+        * Symbian 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private: // From CCaeStillConverter:
+        
+        /**
+        * From CActive, implements cancellation of an outstanding request.
+        * @return void
+        */
+        void DoCancel();
+
+    protected: // From CCaeStillConverter
+        
+        void ConvertL();
+   
+        void ConversionComplete( 
+            TInt aError );
+
+    private: // Data
+
+        // Still Decoder observer.
+        MCaeStillDecoderObserver* iObserver;
+
+        // Pointer to ICL decoder object.
+        CImageDecoder* iDecoder;
+
+        // Pointer to decoded image.
+        CFbsBitmap* iDecodedImage;
+
+        // Class wide file server handle for file operations
+        RFs iFs;
+    };
+
+
+#endif // CAESTILLDECODER_H   
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillEncoder.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Encoder for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAESTILLENCODER_H
+#define CAESTILLENCODER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32file.h>
+#include <imageconversion.h>
+#include "CaeStillConverter.h"
+
+// CONSTANTS
+const TInt KJpegQualityMin = 0;
+const TInt KJpegQualityMax = 100;
+
+const TJpegImageData::TColorSampling KCaeJpegColorSampling = TJpegImageData::EColor420;
+
+
+// CLASS DECLARATION
+
+/**
+*  Still encoder observer class.
+*  User of CCaeStillEncoder class must derive from this interface.
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+class MCaeStillEncoderObserver
+    {
+    public:
+        /**
+        * Called back by CCaeStillEncoder when it completes conversion (encoding) to HBufC8 image data (as JPEG).
+        * single media item during media items enumeration.
+        * @since 2.1
+        * @param aBitmap Source Symbian OS bitmap image
+        * @param aImageData Converted image (as JPEG)
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code
+        * @param aImageSize Encoded image size
+        * @return void
+        */
+        virtual void McaeseoHBufC8ImageReady(
+            CFbsBitmap* aBitmap,
+            HBufC8* aImageData, 
+            TInt aError,
+            TInt aImageSize ) = 0;
+    };
+
+
+// CLASS DECLARATION
+
+/**
+* Still Encoder class. Derived from CaeStillConverter. 
+* Implements still image encoding for Camera Application Engine 
+* using Symbian Image Conversion Library (ICL).
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+NONSHARABLE_CLASS( CCaeStillEncoder ) : public CCaeStillConverter
+    {
+    public: // Conversion target image type.
+
+        enum TTargetFormat
+            {
+            ETargetFormatJPEG
+            };
+
+    public: // Constructor and destructor    
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CCaeStillEncoder* NewL();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CCaeStillEncoder();
+
+    public: // From CCaeStillConverter:
+
+        void SetImageCodecL( 
+        	TUid aCodecUid );
+        	
+    public: // New functions
+        /**
+        * Sets Still Encoder observer.
+        * @since 2.1
+        * @param aObserver Still Encoder observer
+        * @return void
+        */
+        IMPORT_C void SetObserver( 
+            MCaeStillEncoderObserver* aObserver );
+
+        /**
+        * Sets compression quality.
+        * @since 2.1
+        * @param aQuality Compression quality
+        * @return void
+        */
+        IMPORT_C void SetCompressionQuality( 
+            TInt aQuality );
+
+        /**
+        * Gets compression quality.
+        * @since 2.1
+        * @return Compression quality
+        */
+        IMPORT_C TInt CompressionQuality() const;
+
+        /** 
+        * Creates the CImageItem object, places it in the internal queue and 
+        * starts the memory image conversion where the memory bitmap is 
+        * converted to another format (e.g. JPEG). 
+        * @since 2.1
+        * @param aBitmap Bitmap to convert
+        * @param aTargetFormat Target/destination image format (JPEG by default)
+        * @return void
+        */
+        IMPORT_C void ConvertCFbsBitmapToHBufC8L( 
+            CFbsBitmap* aBitmap,
+            TTargetFormat aTargetFormat = ETargetFormatJPEG );
+
+        /**
+        * Destroys all allocations for encoding, as the images from the queue.
+        * @return void
+        */
+        IMPORT_C void Cleanup();
+
+    private: // Constructors
+        /**
+        * C++ constructor.
+        */
+        CCaeStillEncoder();
+
+        /**
+        * Symbian 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+    
+    private: // From CCaeStillConverter:
+        
+        /**
+        * From CActive, implements cancellation of an outstanding request.
+        * @return void
+        */
+        void DoCancel();
+
+    private: // From CCaeStillConverter:
+        
+        void ConvertL();
+   
+        void ConversionComplete( 
+            TInt aError );
+
+    private: // Data
+
+        // Still Encoder observer.
+        MCaeStillEncoderObserver* iObserver;
+
+        // Pointer to ICL encoder object.
+        CImageEncoder* iEncoder;
+
+        // Pointer to encoded image.
+        HBufC8* iEncodedImage;
+
+        // Quality factor for JPEG images.
+        TInt iJpegQuality;
+    };
+
+
+#endif // CAESTILLENCODER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillConverter.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Converter base class for Camera Application Engine
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+
+#include "CaeStillConverter.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+// CONSTANTS
+const TInt KImageQueueGranularity = 6;
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::~CCaeStillConverter
+// Destructor.
+// ---------------------------------------------------------
+//
+CCaeStillConverter::~CCaeStillConverter()
+    {
+    if ( iImageQueue )
+        {
+        iImageQueue->ResetAndDestroy();
+        delete iImageQueue;
+        }
+
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::RunL
+// Handles an active object’s request completion event.
+// ---------------------------------------------------------
+//
+void CCaeStillConverter::RunL()
+    {
+    switch ( iState )
+        {
+        case EIdle:
+            break;
+
+        case EConvert:
+            {
+            ConversionComplete( iStatus.Int() );
+
+            // Start the next image conversion
+            if ( iImageQueue->Count() > 0 )
+                {
+                TRAPD( error, ConvertL() );
+                if ( error != KErrNone )
+                    {
+                    ConversionComplete( error );
+                    }
+                }
+            }
+            break;
+
+        default:
+            break;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::RunError
+// From CActive, handles the leaving RunL().
+// ---------------------------------------------------------
+//
+TInt CCaeStillConverter::RunError( TInt aError )
+    {
+    ConversionComplete( aError );
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::CCaeStillConverter
+// Default constructor. 
+// This can NOT leave.
+// ---------------------------------------------------------
+//
+CCaeStillConverter::CCaeStillConverter() :
+CActive( EPriorityStandard ),
+iState( EIdle )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// ---------------------------------------------------------
+//
+void CCaeStillConverter::ConstructL()
+    {
+    iImageQueue = new( ELeave ) RPointerArray<CImageItem>( KImageQueueGranularity );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::IsBusy
+// Returns ETrue if Still Converter is busy.
+// ---------------------------------------------------------
+//
+TBool CCaeStillConverter::IsBusy() const
+    {
+    return ( iState != EIdle );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillConverterTestErrors.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Converter error simulations 
+*                (CAE_TEST_VERSION only).
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+//  INCLUDES
+#include <e32base.h>
+
+
+// Error simulation variables.
+TInt CaeConvertCFbsBitmapToHBufC8ErrorValue( 0 );
+TInt CaeConvertHBufC8ToCFbsBitmapErrorValue( 0 );
+TInt CaeStillConvertErrorValue( 0 );
+
+
+// ============================ GLOBAL FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CaeSetConvertCFbsBitmapToHBufC8Error
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetConvertCFbsBitmapToHBufC8Error( TInt aError )
+    {
+    CaeConvertCFbsBitmapToHBufC8ErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeConvertCFbsBitmapToHBufC8ErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeConvertCFbsBitmapToHBufC8ErrorL()
+    {
+    if ( CaeConvertCFbsBitmapToHBufC8ErrorValue != KErrNone )
+        {
+        User::Leave( CaeConvertCFbsBitmapToHBufC8ErrorValue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetConvertHBufC8ToCFbsBitmapError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetConvertHBufC8ToCFbsBitmapError( TInt aError )
+    {
+    CaeConvertHBufC8ToCFbsBitmapErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeConvertHBufC8ToCFbsBitmapErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeConvertHBufC8ToCFbsBitmapErrorL()
+    {
+    if ( CaeConvertHBufC8ToCFbsBitmapErrorValue != KErrNone )
+        {
+        User::Leave( CaeConvertHBufC8ToCFbsBitmapErrorValue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetStillConvertError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetStillConvertError( TInt aError )
+    {
+    CaeStillConvertErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeStillConvertErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeStillConvertErrorL()
+    {
+    if ( CaeStillConvertErrorValue != KErrNone )
+        {
+        User::Leave( CaeStillConvertErrorValue );
+        }
+    }
+
+
+#endif // CAE_TEST_VERSION
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillDecoder.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Decoder for Camera Application Engine
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+
+#include "CaeStillConverter.h"
+#include "CaeStillDecoder.h"
+#include "CaeStillCommon.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillDecoder* CCaeStillDecoder::NewL()
+    {
+    CCaeStillDecoder* self = new( ELeave ) CCaeStillDecoder;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::~CCaeStillDecoder
+// Destructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillDecoder::~CCaeStillDecoder()
+    {
+    delete iDecoder;
+    delete iDecodedImage;
+    iFs.Close(); 
+
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::SetObserver
+// Sets Still Decoder observer.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillDecoder::SetObserver( 
+    MCaeStillDecoderObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillDecoder::SetImageCodecL
+// Sets the specific image codec implementation to be used in decoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillDecoder::SetImageCodecL( 
+	TUid aCodecUid )
+    {
+    iImageCodecUid = aCodecUid;
+    }
+
+        
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL
+// Creates CImageItem object, places it in the internal 
+// queue and starts memory image to bitmap conversion.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL( 
+    HBufC8* aImageBuffer,
+    TDisplayMode aTargetBitmapMode,
+    const TSize& aTargetBitmapSize,
+    const TSize& aFullyScaledTargetBitmapSize )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL() entering" ) );
+
+    CleanupStack::PushL( aImageBuffer );
+
+    // Create image item and set up image data.
+
+    CImageItem* imageItem = new( ELeave ) CImageItem;
+    imageItem->iBitmapDisplayMode = aTargetBitmapMode;
+    imageItem->iImageBuffer = aImageBuffer;
+    imageItem->iBitmapSize = aTargetBitmapSize;
+    imageItem->iFullyScaledBitmapSize = aFullyScaledTargetBitmapSize;
+    CleanupStack::Pop( aImageBuffer );
+    CleanupStack::PushL( imageItem ); 
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeConvertHBufC8ToCFbsBitmapErrorL();
+    #endif    
+
+    // Add image to the queue.
+    User::LeaveIfError ( iImageQueue->Append( imageItem ) );
+
+    CleanupStack::Pop( imageItem );
+
+    // Start image conversion if not busy. Busy means that e.g. conversion is currently running. 
+    if ( !IsBusy() )
+        {
+        TRAPD( error, ConvertL() );
+        if ( error != KErrNone )
+            {
+            ConversionComplete( error );
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::Cleanup
+// Destroy all allocations.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillDecoder::Cleanup()
+    {
+    if ( iDecoder )
+        {
+        iDecoder->Cancel();
+        delete iDecoder;
+        iDecoder = NULL;
+        }
+
+    if ( iState != EIdle )
+        {
+        delete iDecodedImage;
+        iDecodedImage = NULL;
+        }
+    
+    if ( iImageQueue )
+        {
+        iImageQueue->ResetAndDestroy();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::CCaeStillDecoder
+// Default constructor. 
+// This can NOT leave.
+// ---------------------------------------------------------
+//
+CCaeStillDecoder::CCaeStillDecoder()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::ConstructL()
+    {
+    CCaeStillConverter::ConstructL();
+    User::LeaveIfError( iFs.Connect() );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::DoCancel
+// From CActive, implements cancellation of an outstanding request.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::DoCancel()
+    {
+    Cleanup();
+    iState = EIdle;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConvertL
+// Converts bitmap to memory JPEG image.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::ConvertL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertL() entering" ) );
+
+    iState = EConvert;
+    
+    // Use the default codec or the specific codec
+    iDecoder = CImageDecoder::DataNewL( iFs, *(*iImageQueue)[0]->iImageBuffer, 
+    	CImageDecoder::EOptionNone, KNullUid, KNullUid, iImageCodecUid );
+    
+    iDecodedImage = NULL;
+    iDecodedImage = new( ELeave ) CFbsBitmap;
+
+    // Set target bitmap size
+    TSize targetBitmapSize = (*iImageQueue)[0]->iBitmapSize;
+
+    const TFrameInfo& frameInfo = iDecoder->FrameInfo( 0 );
+    TUid impUid = iDecoder->ImplementationUid();
+    LOGTEXT3( _L( "Cae: CCaeStillDecoder::ConvertL() Requested decoder: %x, Found decoder: %x" ), iImageCodecUid.iUid, impUid.iUid );
+    LOGTEXT2( _L( "Cae: CCaeStillDecoder::ConvertL() Free scaling support: %d" ), frameInfo.iFlags & TFrameInfo::EFullyScaleable );
+
+    //
+    // Use free scaling always with special decoder or with any decoder that supports it
+    //
+    if ( (( impUid == KUidSpecialFreeScalingDecoder ) || ( frameInfo.iFlags & TFrameInfo::EFullyScaleable ))  
+         && ( (*iImageQueue)[0]->iFullyScaledBitmapSize != TSize( 0, 0 ) ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertL(). Use free scaling in decoding" ) );
+        targetBitmapSize = (*iImageQueue)[0]->iFullyScaledBitmapSize;
+        }
+
+    User::LeaveIfError( iDecodedImage->Create(
+        targetBitmapSize, 
+        (*iImageQueue)[0]->iBitmapDisplayMode ) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeStillConvertErrorL();
+    #endif    
+
+    iState = EConvert;
+    iStatus = KRequestPending;
+    iDecoder->Convert( &iStatus, *iDecodedImage );
+    SetActive();
+
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConversionComplete
+// Perfoms necessary cleanup and delivers result to the client.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::ConversionComplete( 
+    TInt aError )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConversionComplete() entering" ) );
+    #ifdef _DEBUG
+    if ( aError ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillDecoder::ConversionComplete(): error detected" ) );
+        }
+    #endif
+
+    // Delete the decoder object and image queue item
+    if ( iDecoder )
+        {
+        iDecoder->Cancel();
+        delete iDecoder;
+        iDecoder = NULL;
+        }
+
+    // To be outputted via call-back.
+    HBufC8* imageBuffer = NULL;
+
+    if ( iImageQueue->Count() > 0 )
+        {
+        imageBuffer = (*iImageQueue)[0]->iImageBuffer;
+
+        (*iImageQueue)[0]->iImageBuffer = NULL; // Prevent deletion of source image.
+        delete ( *iImageQueue )[0];
+
+        // Remove item pointer from the queue and compress the queue.
+        iImageQueue->Remove( 0 ); // Remove item pointer from the queue and compress the queue.
+        }
+
+    iState = EIdle;
+
+    const TInt KZeroImageSize = 0; // Image size argument currently not in use.
+
+    // Call back the client to deliver the result image. Gives away the ownership of the imageBuffer
+    // and iDecodedImage.
+    iObserver->McaesdoCFbsBitmapImageReady( imageBuffer, iDecodedImage, aError, KZeroImageSize );
+    iDecodedImage = NULL; // Ownership has been given away
+
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConversionComplete() returning" ) );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillEncoder.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,336 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Encoder for Camera Application Engine
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+
+#include "CaeStillConverter.h"
+#include "CaeStillEncoder.h"
+#include "CaeStillCommon.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillEncoder* CCaeStillEncoder::NewL()
+    {
+    CCaeStillEncoder* self = new( ELeave ) CCaeStillEncoder;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::~CCaeStillEncoder
+// Destructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillEncoder::~CCaeStillEncoder()
+    {
+    Cancel();
+    Cleanup();
+    
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::SetObserver
+// Sets Still encoder observer.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::SetObserver( 
+    MCaeStillEncoderObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillEncoder::SetImageCodecL
+// Sets the specific image codec implementation to be used in encoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillEncoder::SetImageCodecL( 
+	TUid aCodecUid )
+    {
+    iImageCodecUid = aCodecUid;
+    }
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::SetCompressionQuality
+// Sets compression quality.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::SetCompressionQuality( 
+    TInt aQuality )
+    {
+    iJpegQuality = Min( KJpegQualityMax, Max( KJpegQualityMin, aQuality ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::CompressionQuality
+// Gets compression quality.
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CCaeStillEncoder::CompressionQuality() const
+    {
+    return iJpegQuality;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L
+// Creates CImageItem object, places it in the internal 
+// queue and starts bitmap to memory image conversion.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L( 
+    CFbsBitmap* aBitmap,  
+    TTargetFormat aTargetFormat )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L() entering" ) );
+
+    CleanupStack::PushL( aBitmap );
+
+    // Create image item and set up image data.
+
+    CImageItem* imageItem = new( ELeave ) CImageItem;
+
+    imageItem->iBitmap = aBitmap;
+
+    CleanupStack::Pop( aBitmap );
+    CleanupStack::PushL( imageItem );
+
+    switch ( aTargetFormat )
+        {
+        case ETargetFormatJPEG:
+        default:
+            {
+            imageItem->iImageTypeUid = KImageTypeJPGUid;
+
+            imageItem->iFrameImageData = CFrameImageData::NewL(); 
+            // ( do not push member variable to cleanup stack )
+
+            TJpegImageData* imagedata = new( ELeave ) TJpegImageData;
+            CleanupStack::PushL( imagedata );
+
+            imagedata->iSampleScheme = KCaeJpegColorSampling;
+            imagedata->iQualityFactor = iJpegQuality;
+
+            User::LeaveIfError ( imageItem->iFrameImageData->AppendImageData( imagedata ) );
+
+            CleanupStack::Pop( imagedata );
+            break;
+            }
+        }
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeConvertCFbsBitmapToHBufC8ErrorL();
+    #endif    
+
+    // Append image to the queue.
+    User::LeaveIfError ( iImageQueue->Append( imageItem ) );
+
+    CleanupStack::Pop( imageItem );
+
+    // Start image conversion if not busy.
+    if ( !IsBusy() )
+        {
+        TRAPD( error, ConvertL() );
+        if ( error != KErrNone )
+            {
+            ConversionComplete( error );
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::Cleanup
+// Destroy all allocations.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::Cleanup()
+    {
+    if ( iEncoder )
+        {
+        iEncoder->Cancel();
+        delete iEncoder;
+        iEncoder = NULL;
+        }
+
+    if ( iState != EIdle )
+        {
+        delete iEncodedImage;
+        iEncodedImage = NULL;
+        }
+    
+    if ( iImageQueue )
+        {
+        iImageQueue->ResetAndDestroy();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::CCaeStillEncoder
+// Default constructor. 
+// This can NOT leave.
+// ---------------------------------------------------------
+//
+CCaeStillEncoder::CCaeStillEncoder() :
+iJpegQuality( KJpegQualityMax )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::ConstructL()
+    {
+    CCaeStillConverter::ConstructL();
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::DoCancel
+// From CActive, implements cancellation of an outstanding request.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::DoCancel()
+    {
+    Cleanup();
+    iState = EIdle;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConvertL
+// Converts bitmap to memory JPEG image.
+// Allocates Image Conversion Library (ICL) encoder and 
+// starts conversion.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::ConvertL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertL() entering" ) );
+
+    // Do not delete the encoded image here, just set to NULL.
+    iEncodedImage = NULL;
+
+    // Allocate new ICL encoder.
+    delete iEncoder;
+    iEncoder = NULL;
+    
+    // Use the default codec or the specific codec
+    iEncoder = CImageEncoder::DataNewL( iEncodedImage, 
+    	CImageEncoder::EOptionNone, (*iImageQueue)[0]->iImageTypeUid, 
+    	KNullUid, iImageCodecUid ); 
+
+    LOGTEXT3( _L( "Cae: CCaeStillEncoder::ConvertL(). Requested encoder: %x, Found encoder: %x" ), iImageCodecUid.iUid, iEncoder->ImplementationUid().iUid );
+    
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeStillConvertErrorL();
+    #endif    
+
+    iState = EConvert;
+    iStatus = KRequestPending;
+    iEncoder->Convert( &iStatus, 
+                       *(*iImageQueue)[0]->iBitmap, 
+                       (*iImageQueue)[0]->iFrameImageData );
+    SetActive();
+
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConversionComplete
+// Perfoms necessary cleanup and delivers result 
+// to the client.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::ConversionComplete( 
+    TInt aError )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConversionComplete() entering" ) );
+    #ifdef _DEBUG
+    if ( aError ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillEncoder::ConversionComplete(): error detected: %d" ), aError );
+        }
+    #endif
+
+    if ( iEncoder )
+        {
+        iEncoder->Cancel();
+        delete iEncoder;
+        iEncoder = NULL;
+        }
+
+    // To be outputted via call-back.
+    CFbsBitmap* bitmap = NULL;
+    
+    if ( iImageQueue->Count() > 0 )
+        {
+        bitmap = (*iImageQueue)[0]->iBitmap;
+
+        (*iImageQueue)[0]->iBitmap = NULL; // Prevent deletion of source image.
+        delete ( *iImageQueue )[0];
+
+        // Remove item pointer from the queue and compress the queue.
+        iImageQueue->Remove( 0 );
+        }
+
+    iState = EIdle;
+
+    const TInt KZeroImageSize = 0; // Image size argument currently not in use.
+
+    // Call back the client to deliver the result image. Gives away the ownership of the bitmap 
+    // and iEncodedImage.
+    iObserver->McaeseoHBufC8ImageReady( bitmap, iEncodedImage, aError, KZeroImageSize );
+    iEncodedImage = NULL; // Ownership has been given away
+
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConversionComplete() returning" ) );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/bwinscw/AsynchFSQu.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+	?ActionsLeft@CAsynchFSQ@@QAEHXZ @ 1 NONAME ; int CAsynchFSQ::ActionsLeft(void)
+	?Delete@CAsynchFSQ@@QAEHABVTDesC16@@@Z @ 2 NONAME ; int CAsynchFSQ::Delete(class TDesC16 const &)
+	?Go@CAsynchFSQ@@QAEHXZ @ 3 NONAME ; int CAsynchFSQ::Go(void)
+	?NewL@CAsynchFSQ@@SAPAV1@XZ @ 4 NONAME ; class CAsynchFSQ * CAsynchFSQ::NewL(void)
+	?Rename@CAsynchFSQ@@QAEHABVTDesC16@@0@Z @ 5 NONAME ; int CAsynchFSQ::Rename(class TDesC16 const &, class TDesC16 const &)
+	?SaveAndDestroy@CAsynchFSQ@@QAEHAAVTDesC8@@ABVTDesC16@@H@Z @ 6 NONAME ; int CAsynchFSQ::SaveAndDestroy(class TDesC8 &, class TDesC16 const &, int)
+	?SetCallback@CAsynchFSQ@@QAEXPAVMAsynchFSQObserver@@@Z @ 7 NONAME ; void CAsynchFSQ::SetCallback(class MAsynchFSQObserver *)
+	?SetManualStart@CAsynchFSQ@@QAEXH@Z @ 8 NONAME ; void CAsynchFSQ::SetManualStart(int)
+	?SetPriority@CAsynchFSQ@@QAEXH@Z @ 9 NONAME ; void CAsynchFSQ::SetPriority(int)
+	?Cancel@CAsynchFSQ@@QAEXXZ @ 10 NONAME ; void CAsynchFSQ::Cancel(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/eabi/AsynchFSQu.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,16 @@
+EXPORTS
+	_ZN10CAsynchFSQ11ActionsLeftEv @ 1 NONAME
+	_ZN10CAsynchFSQ11SetCallbackEP18MAsynchFSQObserver @ 2 NONAME
+	_ZN10CAsynchFSQ14SaveAndDestroyER6TDesC8RK7TDesC16i @ 3 NONAME
+	_ZN10CAsynchFSQ11SetPriorityEi @ 4 NONAME
+	_ZN10CAsynchFSQ14SetManualStartEi @ 5 NONAME
+	_ZN10CAsynchFSQ2GoEv @ 6 NONAME
+	_ZN10CAsynchFSQ4NewLEv @ 7 NONAME
+	_ZN10CAsynchFSQ6DeleteERK7TDesC16 @ 8 NONAME
+	_ZN10CAsynchFSQ6RenameERK7TDesC16S2_ @ 9 NONAME
+	_ZTI10CAsynchFSQ @ 10 NONAME ; #<TI>#
+	_ZTI14CAsynchFSQAtom @ 11 NONAME ; #<TI>#
+	_ZTV10CAsynchFSQ @ 12 NONAME ; #<VT>#
+	_ZTV14CAsynchFSQAtom @ 13 NONAME ; #<VT>#
+	_ZN10CAsynchFSQ6CancelEv @ 14 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/group/asynchfsq.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          AsynchFSQ.dll
+TARGETTYPE      dll
+
+UID             0x1000008d 0x2000b00b
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined( WINSCW )
+deffile ../bwinscw/ 
+#elif defined( WINS )
+deffile ../bwins/ 
+#else
+deffile ../bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          asynchfsq.cpp
+SOURCE          asynchatom.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../Engine/traces
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         sysutil.lib
+LIBRARY         bafl.lib
+LIBRARY         efsrv.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+asynchfsq.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/inc/asynchatom.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous FSQ Atom Class
+*
+*/
+
+
+
+#ifndef ASYNCHATOM_H
+#define ASYNCHATOM_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32base.h>
+
+
+//   FOR DEBUGGING
+#if defined (_DEBUG)
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)        RDebug::Print(AAA,BBB,CC)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+#endif           
+
+
+// CONSTANTS
+
+enum TFSQAtomState
+    {
+    EPending,
+    ESaving,
+    ESavePending,
+    EUploading,
+    EUploadPending,
+    EComplete
+    };
+
+// FORWARD DECLARATIONS
+class CAsynchFSQ;
+
+// CLASS DECLARATIONS
+
+/**
+* Asynchronous file manager queue and related operations.
+*
+* @since 3.2
+*/
+class CAsynchFSQAtom : public CActive
+    {
+    
+    public: // Constructor and Descructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CAsynchFSQAtom* NewL(  CAsynchFSQ* aOwner, 
+                                      TInt aPriority,
+                                      TFSQActionType aActionType,  
+                                      TDesC8& aData, 
+                                      const TDesC& aPath, 
+                                      const TDesC& aURL, 
+                                      TFSQSchemaType aSchema, 
+                                      const TDesC& aUserName, 
+                                      const TDesC& aPassword  );
+    
+        /**
+        * Two-phased constructor.
+        */
+        virtual ~CAsynchFSQAtom();            
+                
+    public: // Data
+                
+
+        
+    public: // Public member functions
+    
+        /**
+        * C++ default constructor.
+        */
+        CAsynchFSQAtom();
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(  CAsynchFSQ* aOwner, 
+                          TInt aPriority,
+                          TFSQActionType aActionType,  
+                          TDesC8& aData, 
+                          const TDesC& aPath, 
+                          const TDesC& aURL, 
+                          TFSQSchemaType aSchema, 
+                          const TDesC& aUserName, 
+                          const TDesC& aPassword  );
+        
+        /**
+        * 
+        */
+        TInt Go();
+        
+        /**
+        * 
+        */
+        TInt ActionsLeft();
+        
+        /**
+        *
+        */
+        TFSQAtomState GetState();
+        
+        /**
+        *
+        */
+        TBool DoesLocalSave();
+        
+        /**
+        *
+        */
+        const TDesC& GetPath() const;
+        
+        /**
+        *
+        */
+        TInt DeleteLocal();
+        
+        /**
+        *
+        */
+        TInt RenameLocal( const TDesC& aNew );
+        
+    private: // Private member functions
+    
+        /**
+        * From CActive
+        */
+        void RunL();
+
+        /** 
+        * From CActive
+        */
+        void DoCancel();        
+
+        /** 
+        * From CActive
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * 
+        */
+        void SaveL();
+        
+        /**
+        * 
+        */
+        void SaveCleanupL();
+        
+        /**
+        * 
+        */
+        void UploadL();
+        
+        /**
+        * 
+        */
+        void UploadCleanupL();
+        
+    private: // Private data members
+    
+        // Activity specific items
+        TFSQActionType iActionType;
+        TDesC8* iData;
+        HBufC* iPath;           // EFileSave only
+        HBufC* iURL;            // EWebUpload only
+        TFSQSchemaType iSchema; // EWebUpload only
+        HBufC* iUserName;       // EWebUpload only
+        HBufC* iPassword;       // EWebUpload only
+        
+        // Variables specifics to owning class
+        CAsynchFSQ* iOwner;
+        TInt iError;
+        TBool iOverwrite;
+        
+        // State machine variable
+        TFSQAtomState iState;
+        
+        // Helper variables
+        RFile iFile;
+        RFs iFs;
+        TBool iDelayedLocalDelete;
+        TBool iDelayedLocalRename;
+        HBufC* iDelayedFileName;
+        
+    };
+
+#endif // CAsynchATOM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/src/asynchatom.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,718 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous FSQ Atom
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <asynchfsq.h>
+#include <sysutil.h> // for disk space query
+#include <bautils.h> // for deleting files
+#include "asynchatom.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::CAsynchFSQAtom
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQAtom::CAsynchFSQAtom() : CActive( EPriorityNormal )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::CAsynchFSQAtom() entering" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::ConstructL( CAsynchFSQ* aOwner, 
+                                 TInt aPriority,
+                                 TFSQActionType aActionType,  
+                                 TDesC8& aData, 
+                                 const TDesC& aPath, 
+                                 const TDesC& aURL, 
+                                 TFSQSchemaType aSchema, 
+                                 const TDesC& aUserName, 
+                                 const TDesC& aPassword )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::ConstructL() entering" ) );
+    iOwner = aOwner;
+    iState = EPending;
+    iDelayedFileName = NULL;
+    SetPriority(aPriority);
+    iSchema = aSchema;
+    
+    // prep to copy
+    iData = NULL;
+    iPath = NULL;
+    iURL = NULL;
+    iUserName = NULL;
+    iPassword = NULL;
+    
+    // copy
+    iActionType = aActionType;
+    
+    iData = &aData;  
+    if ( aPath != KNullDesC ) 
+        {
+        iPath = HBufC::NewL( aPath.Length() ); 
+        iPath->Des().Append( aPath ); 
+        }
+    if ( aURL != KNullDesC )
+        {
+        iURL = HBufC::NewL( aURL.Length() ); 
+        iURL->Des().Append( aURL ); 
+        }
+    if ( aUserName != KNullDesC )
+        {
+        iUserName = HBufC::NewL( aUserName.Length() ); 
+        iUserName->Des().Append( aUserName ); 
+        }
+    if ( aPassword != KNullDesC )
+        {
+        iPassword = HBufC::NewL( aPassword.Length() ); 
+        iPassword->Des().Append( aPassword ); 
+        }
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::ConstructL() adding AO" ) );
+    CActiveScheduler::Add( this );
+    LOGTEXT( _L( "CAsynchFSQAtom::ConstructL() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQAtom* CAsynchFSQAtom::NewL( CAsynchFSQ* aOwner, 
+                                      TInt aPriority,
+                                      TFSQActionType aActionType,  
+                                      TDesC8& aData, 
+                                      const TDesC& aPath, 
+                                      const TDesC& aURL, 
+                                      TFSQSchemaType aSchema, 
+                                      const TDesC& aUserName, 
+                                      const TDesC& aPassword )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::NewL() entering" ) );
+    CAsynchFSQAtom* self = new( ELeave ) CAsynchFSQAtom();   
+    CleanupStack::PushL( self );
+    self->ConstructL(  aOwner, 
+                       aPriority,
+                       aActionType,  
+                       aData, 
+                       aPath, 
+                       aURL, 
+                       aSchema, 
+                       aUserName, 
+                       aPassword  );
+                       
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::~CAsynchFSQAtom   
+// Destructor for the atom class
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQAtom::~CAsynchFSQAtom()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() entering" ) );
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() canceling" ) );
+    Cancel();
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() canceled" ) );
+    
+    // Close file
+    iFile.Close(); 
+    
+    // Close file system
+    iFs.Close();
+    
+    // Free leftover data
+    if( iData )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iData" ) );
+        delete iData;
+        iData = NULL;
+        }
+
+    if( iPath )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iPath" ) );
+        delete iPath;
+        iPath = NULL;
+        }
+        
+    if( iURL )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iURL" ) );
+        delete iURL;
+        iURL = NULL;
+        }
+        
+    if( iUserName )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iUserName" ) );
+        delete iUserName;
+        iUserName = NULL;
+        }
+        
+    if( iPassword )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iPassword" ) );
+        delete iPassword;
+        iPassword = NULL;
+        }                
+        
+    if( iDelayedFileName )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iDelayedFileName" ) );
+        delete iDelayedFileName;
+        iPassword = NULL;
+        }      
+        
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::Go
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::Go()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::Go() entering" ) );
+    TInt err = KErrNone;
+    
+    if (( iState != EPending )||( IsActive() ))
+        {
+        err = KErrInUse;
+        }
+    else
+        {
+        // set new state
+        switch ( iActionType )
+	        {
+    	    case EFileSave:
+            case EFileSaveAndWebUpload:
+    	        {
+    	        LOGTEXT( _L( "CAsynchFSQAtom::Go() iState => ESaving" ) );
+    	        iState = ESaving;
+    	        break;	        
+    	        }
+    	    case EWebUpload:
+    	        {
+    	        LOGTEXT( _L( "CAsynchFSQAtom::Go() iState => EUploading" ) );
+    	        iState = EUploading;
+    	        break;	        
+    	        }
+    	    default:
+    	        {
+       	        LOGTEXT( _L( "CAsynchFSQAtom::Go() undefined activity requested" ) );
+                err = KErrNotSupported;
+    	        break;
+    	        }
+	        }	        
+    
+        // initiate AO activity
+        LOGTEXT( _L( "CAsynchFSQAtom::Go() setting active" ) );
+        SetActive();
+        TRequestStatus* statusPtr = &iStatus;
+        User::RequestComplete( statusPtr, KErrNone );
+        LOGTEXT( _L( "CAsynchFSQAtom::Go() request completed" ) );
+        }
+        
+    LOGTEXT( _L( "CAsynchFSQAtom::Go() returning" ) );
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::GetState
+// -----------------------------------------------------------------------------
+//
+TFSQAtomState CAsynchFSQAtom::GetState()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::GetState() entering & returning" ) );
+    return iState;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::DoesLocalSave
+// -----------------------------------------------------------------------------
+//
+TBool CAsynchFSQAtom::DoesLocalSave()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::DoesLocalSave() entering" ) );
+    TBool ret = EFalse;
+    if (( iActionType == EFileSave )||( iActionType == EFileSaveAndWebUpload ))
+        {
+        ret = ETrue;
+        }
+    LOGTEXT2( _L( "CAsynchFSQAtom::DoesLocalSave() returning, ret=%d" ),ret );
+    return ret;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::GetPath
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAsynchFSQAtom::GetPath() const
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::GetPath() entering & returning" ) );
+    return *iPath;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::DeleteLocal
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::DeleteLocal()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::DeleteLocal() entering" ) );
+    TInt err = KErrNone;
+    
+    // delete or delayed delete
+    if (( iState == EPending ) || ( iState == ESaving )||( iState == ESavePending ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::DeleteLocal() delayed delete" ) );
+        // we are currently saving, so we have to delete later
+        iDelayedLocalDelete = ETrue;
+        }
+    else
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::DeleteLocal() deleting now" ) );
+        // delete now
+        err = KErrNotFound;
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, *iPath ) )
+            {
+            err = KErrNone;
+            ba.DeleteFile( fs, *iPath );
+            }
+        fs.Close();
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::DeleteLocal() returning, err=%d" ),err );
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::RenameLocal
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::RenameLocal( const TDesC& aNew )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::RenameLocal() entering" ) );
+    TInt err = KErrNone;
+    
+    // delete or delayed delete
+    if (( iState == EPending ) || ( iState == ESaving )||( iState == ESavePending ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::RenameLocal() delayed rename" ) );
+        // we are currently saving, so we have to delete later
+        iDelayedLocalRename = ETrue;
+        TRAP( err,
+            iDelayedFileName = HBufC::NewL( aNew.Length() );
+            iDelayedFileName->Des().Append( aNew );
+            );
+        }
+    else
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::RenameLocal() renaming now" ) );
+        err = KErrNotFound;
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, *iPath ) )
+            {
+            err = KErrNone;
+            ba.RenameFile( fs, *iPath, aNew );
+            }
+        fs.Close();
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::RenameLocal() returning, err=%d" ),err );
+    return err;
+    }    
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::SaveL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::SaveL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveL() entering" ) );
+    iError = KErrNone;
+    
+    if ( iState != ESaving )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+
+    // Init
+    iError = iFs.Connect();
+    LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() fsSession.Connect iError=%d" ),iError );
+    
+    // Get drive number
+    TInt drive = 0;
+    if( !iError )
+        {
+        iError = RFs::CharToDrive( iPath->Des()[0], drive );
+        LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() CharToDrive iError=%d" ),iError );
+        }
+
+    // Check disk space
+    if ( !iError )
+        {
+        TBool fullDisk = EFalse;
+        TRAPD( utilErr,
+               fullDisk = SysUtil::DiskSpaceBelowCriticalLevelL( 
+                          &iFs, iData->Length(), drive ) );
+        if( utilErr )
+            {
+            LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() SysUtil iError=%d" ),iError );
+            iError = utilErr;
+            }
+        else if( fullDisk )
+            {
+            iError = KErrDiskFull;
+            }
+        }
+   
+    // Attempt to create the file
+    if( !iError )
+        {    
+        if ( iOverwrite )
+            {
+            iError = iFile.Replace( iFs, iPath->Des(), EFileWrite );
+            LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() file.Replace iError=%d" ),iError );
+            }
+        else
+            {
+            iError = iFile.Create( iFs, iPath->Des(), EFileWrite );
+            LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() file.Open iError=%d" ),iError );
+            }
+        }
+        
+    // Write the file
+    if( !iError )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveL() about to write" ) );
+        SetActive();
+        iFile.Write( *iData, iStatus );
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveL() write requested" ) );
+        }
+    
+    // Update state
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveL() iState => ESavePending" ) );
+    iState = ESavePending;
+    
+    // leave if error
+    if ( iError )
+        {
+        LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() Leaving with iError=%d" ),iError );
+        User::Leave( iError );
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() exiting, iError=%d" ), iError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::SaveCleanupL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::SaveCleanupL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() entering" ) );
+        
+    if ( iState != ESavePending )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+        
+    // Flush file.
+    if( !iError )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() flushing" ) );
+        iError = iFile.Flush();
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() flushed" ) );
+        }
+        
+    // Close file
+    iFile.Close(); 
+        
+    // Delayed rename, if needed
+    if (( !iError ) && ( iDelayedLocalRename ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() doing delayed rename" ) );
+        BaflUtils ba;
+        if( ba.FileExists( iFs, *iPath ) )
+            {
+            iError = KErrNone;
+            TPtrC newPath = *iDelayedFileName;
+            ba.RenameFile( iFs, *iPath, newPath );
+            }
+        iDelayedLocalRename = EFalse;
+        }
+        
+    // Delayed delete, if needed
+    if (( !iError ) && ( iDelayedLocalDelete ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() doing delayed delete" ) );
+        iError = KErrNotFound;
+        BaflUtils ba;
+        if( ba.FileExists( iFs, *iPath ) )
+            {
+            iError = KErrNone;
+            ba.DeleteFile( iFs, *iPath );
+            }
+        iDelayedLocalDelete = EFalse;
+        LOGTEXT2( _L( "CAsynchFSQAtom::SaveCleanupL() delete done, iError=%d" ), iError );
+        }
+        
+    // Close file system
+    iFs.Close();
+        
+    // Update state
+    switch ( iActionType )
+	    {
+	    case EFileSave:
+	        {
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() iState => EComplete" ) );
+            iState = EComplete;            
+	        break;	        
+	        }
+	    case EFileSaveAndWebUpload:
+	        {
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() iState => EUploading" ) );
+            iState = EUploading;            
+            
+            // re-initiate AO activity
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() setting active" ) );
+            SetActive();
+            TRequestStatus* statusPtr = &iStatus;
+            User::RequestComplete( statusPtr, KErrNone );
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() request completed" ) );
+	        break;	        
+	        }     	        
+	    default:
+	        {
+	        // the state machine is lost
+	        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() bad action, leaving" ) );
+	        User::Leave( KErrGeneral );
+	        break;        
+	        }	        
+	    }	
+    
+    // report completion
+    LOGTEXT2( _L( "CAsynchFSQAtom::SaveCleanupL() notifying, iError=%d" ), iError );
+    iOwner->Notify( iError );
+        
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() exiting" ));
+    }    
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::UploadL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::UploadL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() entering" ) );
+    iError = KErrNone;
+        
+    if ( iState != EUploading )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::UploadL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+    
+    // This activity is not yet supported, so just feign completion
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() iState => EComplete" ) );
+    iState = EUploadPending;
+    
+    // re-initiate AO activity
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() setting active" ) );
+    SetActive();
+    TRequestStatus* statusPtr = &iStatus;
+    User::RequestComplete( statusPtr, KErrNone );
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() request completed" ) );
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::UploadCleanup
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::UploadCleanupL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() entering" ) );
+    
+    if ( iState != ESaving )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+    
+    // This activity is not yet supported, so just feign completion
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() iState => EComplete" ) );
+    iState = EComplete;
+    
+    // report completion
+    LOGTEXT2( _L( "CAsynchFSQAtom::UploadCleanupL() notifying, iError=%d" ), iError );
+    iOwner->Notify( iError );
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::ActionsLeft
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::ActionsLeft()
+    {
+    TInt actionsLeft = 0;
+    
+    // logically, this section is liable to change if more
+    // action types are added to the class
+    switch ( iState )
+	    {
+	    case EPending:
+	        {
+	        if ( iActionType == EFileSaveAndWebUpload )
+	            {
+	            actionsLeft = 2;
+	            }
+	        else
+	            {
+	            actionsLeft = 1;
+	            }
+	        break;
+	        }
+	    case ESaving:
+	    case ESavePending:
+	        {
+	        if ( iActionType == EFileSave )
+	            {
+	            actionsLeft = 1;
+	            }
+	        else
+	            {
+	            actionsLeft = 2;
+	            }
+	        break;	        
+	        }
+	    case EUploading:
+	    case EUploadPending:
+	        {
+	        actionsLeft = 1;
+	        break;
+	        }	        	        
+	    case EComplete:
+	        {
+	        actionsLeft = 0;
+	        break;
+	        }	        	        
+	    }	
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::ActionsLeft() returning, actionsLeft=%d" ), actionsLeft );
+    return actionsLeft;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::RunL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::RunL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::RunL() entering" ) );
+
+    switch ( iState )
+	    {
+	    case ESaving:
+	        {
+	        SaveL();
+	        break;	        
+	        }
+	    case ESavePending:
+	        {
+	        SaveCleanupL();
+	        break;	        
+	        }
+	    case EUploading:
+	        {
+	        UploadL();
+	        break;	        
+	        }	        	        
+	    case EUploadPending:
+	        {
+	        UploadCleanupL();
+	        break;
+	        }	        	        
+	    default:
+	        {
+	        // the state machine is lost
+	        LOGTEXT( _L( "CAsynchFSQAtom::RunL() bad state, leaving..." ) );
+	        User::Leave( KErrGeneral );
+	        break;        
+	        }	        
+	    }	
+
+    LOGTEXT( _L( "CAsynchFSQAtom::RunL() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::RunError( TInt aError )
+    {
+    LOGTEXT2( _L( "CAsynchFSQAtom::RunError() entering, aError=%d" ), aError );
+    // notify and wait for teardown
+    iState = EComplete;
+    iOwner->Notify( aError );
+    LOGTEXT( _L( "CAsynchFSQAtom::RunError() returning" ) );
+    return KErrNone;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::DoCancel()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::DoCancel() entering" ) );
+
+    LOGTEXT( _L( "CAsynchFSQAtom::DoCancel() exit" ) );
+    }
+    
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/src/asynchfsq.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,369 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <asynchfsq.h>
+#include <bautils.h> // for deleting files
+#include "asynchatom.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::CAsynchFSQ
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQ::CAsynchFSQ()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::CAsynchFSQ() entering" ) );
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQ::ConstructL()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::ConstructL() entering" ) );
+    iPriority = EPriorityNormal;
+    iManualStart = EFalse;
+    LOGTEXT( _L( "CAsynchFSQ::ConstructL() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CAsynchFSQ* CAsynchFSQ::NewL()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::NewL() entering" ) );
+    CAsynchFSQ* self = new( ELeave ) CAsynchFSQ();   
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::~CAsynchFSQ   
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQ::~CAsynchFSQ()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::~CAsynchFSQ() entering" ) );
+
+    // clean up queues
+    iQueue.ResetAndDestroy();
+    
+    LOGTEXT( _L( "CAsynchFSQ::~CAsynchFSQ() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SaveAndDestroy
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::SaveAndDestroy( TDesC8& aData, const TDesC& aPath, TBool aOverwrite )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::SaveAndDestroy() entering" ) );
+    
+    TInt err = KErrNone;
+    
+    // return if NULL descriptor.
+    if( !&aData )
+        {
+        return KErrArgument;
+        }
+    
+    iOverwrite = aOverwrite;
+    
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() iQueue.Count()=%d" ), iQueue.Count() );
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() ActionsLeft()=%d" ), ActionsLeft() );
+    
+    // add data to our queue
+    err = Enqueue( EFileSave, aData, aPath, KNullDesC, ENullSchemaType, KNullDesC, KNullDesC );
+    
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() iManualStart=%d" ), iManualStart );
+
+    if ( !err && !iManualStart )
+        {
+        err = Go();	
+        }
+        
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() returning err=%d" ), err );
+    return err;
+    }
+        
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Go
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::Go()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Go() entering" ) );
+    TInt err = KErrNone;
+    
+    // make sure the queue has at least one object
+    if( iQueue.Count() == 0 )
+        {
+        err = KErrNotReady;	
+        }
+    
+    // activate AO's
+    
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if(( !err )&&( iQueue[i]->GetState() == EPending ))
+            {
+            err = iQueue[i]->Go();
+            }
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQ::Go() returning err=%d" ), err );
+    return err;
+    }
+        
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SetManualStart
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::SetManualStart( TBool aManualStart )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::ManualStart() entering" ) );
+    iManualStart = aManualStart;
+    LOGTEXT( _L( "CAsynchFSQ::ManualStart() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Delete
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::Delete( const TDesC& aPath )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Delete() entering" ) );
+	TInt err = KErrNotFound;
+
+    // search for path name and delete if found
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if ( iQueue[i]->DoesLocalSave() )
+            {
+            if ( (iQueue[i]->GetPath()).Compare( aPath ) == 0 )
+                {
+                LOGTEXT( _L( "CAsynchFSQ::Delete() file found, deleting" ) );
+                err = iQueue[i]->DeleteLocal();
+                }
+            }
+        }
+        
+    // if still not found,
+    // attempt to delete from file system
+    if ( err == KErrNotFound )
+        {
+        LOGTEXT( _L( "CAsynchFSQ::Delete() not in queues, trying file system" ) );
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, aPath ) )
+            {
+            LOGTEXT( _L( "CAsynchFSQ::Delete() exists, deleting from file system" ) );
+            err = KErrNone;
+            ba.DeleteFile( fs, aPath );
+            }
+        fs.Close();
+        }
+       
+    LOGTEXT2( _L( "CAsynchFSQ::Delete() returning err=%d" ), err );
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Rename
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::Rename( const TDesC& aOld, const TDesC& aNew )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Rename() entering" ) );
+  
+	TInt err = KErrNotFound;
+
+    // search for path name and delete if found
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if ( iQueue[i]->DoesLocalSave() )
+            {
+            if ( (iQueue[i]->GetPath()).Compare( aOld ) == 0 )
+                {
+                LOGTEXT( _L( "CAsynchFSQ::Delete() file found, renaming" ) );
+                err = iQueue[i]->RenameLocal( aNew );
+                }
+            }
+        }       
+    
+    // if still not found,
+    // attempt to rename from file system
+    if ( err == KErrNotFound )
+        {
+        LOGTEXT( _L( "CAsynchFSQ::Rename() not in queues, trying file system" ) );
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, aOld ) )
+            {
+            LOGTEXT( _L( "CAsynchFSQ::Rename() exists, renaming in file system" ) );
+            err = KErrNone;
+            ba.RenameFile( fs, aOld, aNew );
+            }
+        fs.Close();
+        }
+
+    LOGTEXT2( _L( "CAsynchFSQ::Rename() returning err=%d" ), err );
+    return err;
+    }
+
+
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SetThreadPriority
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::SetPriority( TInt aPriority ) 
+    {
+    LOGTEXT2( _L( "CAsynchFSQ::SetThreadPriority() entering aPriority=%d" ), aPriority );
+    iPriority = aPriority;
+    LOGTEXT( _L( "CAsynchFSQ::SetThreadPriority() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SetCallback
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::SetCallback( MAsynchFSQObserver* aCallback )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::SetCallback() entering" ) );
+    iCallback = aCallback;
+    LOGTEXT( _L( "CAsynchFSQ::SetCallback() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::ActionsLeft
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::ActionsLeft()
+    {
+    TInt actionsLeft = 0;
+    
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        actionsLeft += iQueue[i]->ActionsLeft();
+        }
+        
+    LOGTEXT2( _L( "CAsynchFSQ::ActionsLeft() actionsLeft=%d" ), actionsLeft );
+    return actionsLeft;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Cancel
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::Cancel()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Cancel() entering" ) );
+    
+    while( iQueue.Count() )
+        {
+        delete iQueue[0];
+        iQueue[0] = NULL;
+        iQueue.Remove( 0 ); // Data MUST be deleted first
+        }
+        
+    LOGTEXT( _L( "CAsynchFSQ::Cancel() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Notify
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQ::Notify( TInt aError )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Notify() entering" ) );
+    iCallback->MAsynchFSQEvent( aError );
+    
+    // Scan and delete completed atoms
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if( iQueue[i]->ActionsLeft() == 0 )
+            {
+            delete iQueue[i];
+            iQueue[i] = NULL;
+            iQueue.Remove( i ); // Data MUST be deleted first
+            i--;
+            }
+        }
+        
+    LOGTEXT( _L( "CAsynchFSQ::Notify() exiting" ) );
+    }
+        
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Enqueue
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQ::Enqueue( TFSQActionType aActionType, TDesC8& aData, 
+                          const TDesC& aPath, const TDesC& aURL, 
+                          TFSQSchemaType aSchema, const TDesC& aUserName, 
+                          const TDesC& aPassword )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Enqueue() entering" ) );
+    
+    TInt err = KErrNone;
+    
+    TInt queueError = KErrNone; 
+    TRAP( err,
+        // create atom
+        CAsynchFSQAtom* atom = 
+            CAsynchFSQAtom::NewL( this, 
+                                  iPriority,
+                                  aActionType,
+                                  aData,
+                                  aPath,
+                                  aURL,
+                                  aSchema,
+                                  aUserName,
+                                  aPassword );
+        
+        //append to queue
+        iQueue.Append( atom );
+        );
+
+    if ( !err && queueError )
+        {
+        err = queueError;
+        }
+
+    LOGTEXT2( _L( "CAsynchFSQ::Enqueue() returning err=%d" ), err );
+    return err;
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/Bwinscw/STIFAFSQTestu.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModule@@XZ @ 1 NONAME ; class CTestModule * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/Eabi/STIFAFSQTestu.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CAFSQTestAsynchSaveE @ 4 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 5 NONAME ; #<TI>#
+	_ZTI19CAFSQTestAsynchSave @ 6 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 7 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 8 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CAFSQTestAsynchSaveE @ 9 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 10 NONAME ; #<VT>#
+	_ZTV19CAFSQTestAsynchSave @ 11 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 12 NONAME ; #<VT>#
+
Binary file camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles.jpg has changed
Binary file camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles2.jpg has changed
Binary file camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles3.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/group/StifAFSQTest.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET        STIFAFSQTest.dll
+TARGETTYPE    dll
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY    CAP_GENERAL_DLL
+VENDORID      VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          StifFSQTestTop.cpp
+SOURCE          AFSQTestAsynchSave.cpp
+SOURCE          AFSQTestAdd.cpp
+SOURCE          AFSQTestDelete.cpp
+SOURCE          AFSQTestRename.cpp
+
+// STIF TFW files
+SOURCEPATH    ../src/TestFramework
+SOURCE        testcase.cpp
+SOURCE        assertFailure.cpp
+SOURCE        testSuite.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/TestFramework
+USERINCLUDE     ../../../../Inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         sysutil.lib
+LIBRARY         fbscli.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         AsynchFSQ.lib
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// ROM build files
+
+PRJ_MMPFILES
+STIFAFSQTest.mmp     
+
+// Makefile for ATS manual runs
+//GNUMAKEFILE FSQTests_CreateATSTestDrop.make
+
+// Makefile for ATS automated scripts
+gnumakefile testcollector.mk
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/group/testcollector.mk	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  GNU Makefile that updates the ATS3 drop for a test set.
+#
+TESTTYPE=STIF
+DLLS=STIFAFSQTest.dll
+DLLDIR=..\$(TESTTYPE)_temp
+
+
+BUILD_DIR=\epoc32\RELEASE\$(PLATFORM)\$(CFG)
+
+UPDATE_BINARIES := $(foreach DLL, $(DLLS), \
+                   & xcopy /Q /Y /F "$(BUILD_DIR)\$(DLL)" "$(DLLDIR)")
+UPDATE_BINARIES := $(wordlist 2, 1000, $(UPDATE_BINARIES))
+
+
+
+# For these targets we shall not do anything.
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES FINAL SAVESPACE:
+
+# BLD target of this Makefile is executed after Symbian BLD target
+# so the binaries are ready.
+BLD: 
+	echo Preparing Test collection...
+	-mkdir "$(DLLDIR)" 2> NUL
+	$(UPDATE_BINARIES)
+
+# Clean the copied binaries from the ATS drop.
+CLEAN:
+	echo Cleaning Test collection...
+	-rd /s /q "$(DLLDIR)" 2> NUL
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestAsynchSave.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AsynchFSQTest test module.
+*
+*/
+
+
+#ifndef AFSQ_TEST_ASYNCH_SAVE_H
+#define AFSQ_TEST_ASYNCH_SAVE_H
+
+
+// INCLUDES
+
+#include <e32base.h>
+#include "ASynchFSQ.h"
+#include "TestFramework/test.h"
+#include "TestFramework/TestCase.h"
+#include "TestFramework/TestCaller.h"
+#include "TestFramework/TestSuite.h"
+
+// CONSTANTS
+
+enum TTestCaseNumber
+    {
+    ECONSTRUCT001p1,
+    EDESTRUCT001p1,
+    EPRIORITY001p1,
+    EADD001p1,
+    EADD002p1,
+    EADD003p1,
+    EADD004p1,
+    EADD005p1,
+    EADD006p1,
+    EADD007p1,
+    EDEL001p1,
+    EDEL002p1,
+    EDEL003p1,
+    EDEL004p1,
+    EDEL005p1,
+    EDEL006p1,
+    EREN001p1,
+    EREN002p1,
+    EREN003p1,
+    EREN004p1,
+    EREN005p1,
+    EREN006p1,
+    ECANCEL001p1
+    };
+
+
+// MACROS
+
+#define KNibbles TFileName(_L("E:\\testing\\data\\StifAFSQTest\\Nibbles.jpg"));
+#define KNibbles2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\Nibbles2.jpg"));
+#define KNibbles3 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\Nibbles3.jpg"));
+
+#define KNibblesCANCEL001 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+
+#define KNibblesADD001 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+#define KNibblesADD002 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD002.jpg"));
+#define KNibblesADD003 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD003.jpg"));
+#define KNibblesADD004A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD004A.jpg"));
+#define KNibblesADD004B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD004B.jpg"));
+#define KNibblesADD005A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD005A.jpg"));
+#define KNibblesADD005B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD005B.jpg"));
+#define KNibblesADD006 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD006.jpg"));
+#define KNibblesADD007 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD007.jpg"));
+
+#define KNibblesDEL001 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL001.jpg"));
+#define KNibblesDEL002 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL002.jpg"));
+#define KNibblesDEL003A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL003A.jpg"));
+#define KNibblesDEL003B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL003B.jpg"));
+#define KNibblesDEL003C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL003C.jpg"));
+#define KNibblesDEL004A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL004A.jpg"));
+#define KNibblesDEL004B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL004B.jpg"));
+#define KNibblesDEL004C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL004C.jpg"));
+#define KNibblesDEL005A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL005A.jpg"));
+#define KNibblesDEL005B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL005B.jpg"));
+#define KNibblesDEL005C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL005C.jpg"));
+#define KNibblesDEL006A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL006A.jpg"));
+#define KNibblesDEL006B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL006B.jpg"));
+#define KNibblesDEL006C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL006C.jpg"));
+
+#define KNibblesREN001A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN001A.jpg"));
+#define KNibblesREN001B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN001B.jpg"));
+#define KNibblesREN002A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN002A.jpg"));
+#define KNibblesREN002B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN002B.jpg"));
+#define KNibblesREN003A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003A.jpg"));
+#define KNibblesREN003B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003B.jpg"));
+#define KNibblesREN003C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003C.jpg"));
+#define KNibblesREN003A2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003A2.jpg"));
+#define KNibblesREN004A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004A.jpg"));
+#define KNibblesREN004B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004B.jpg"));
+#define KNibblesREN004C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004C.jpg"));
+#define KNibblesREN004A2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004A2.jpg"));
+#define KNibblesREN005A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005A.jpg"));
+#define KNibblesREN005B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005B.jpg"));
+#define KNibblesREN005C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005C.jpg"));
+#define KNibblesREN005A2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005A2.jpg"));
+#define KNibblesREN006A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006A.jpg"));
+#define KNibblesREN006B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006B.jpg"));
+#define KNibblesREN006C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006C.jpg"));
+#define KNibblesREN006B2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006B2.jpg"));
+#define KNibblesREN006C2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006C2.jpg"));
+
+
+// CLASS DECLARATION
+
+class CAFSQTestAsynchSave : public CTestCase,
+                            public MAsynchFSQObserver
+    {
+    public:
+
+        CAFSQTestAsynchSave ();
+        ~CAFSQTestAsynchSave ();
+
+        // Allocate the resources for one test function
+        void setUpL ();
+
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+
+    protected:
+    
+        // stalling function
+        void WaitForAsynchCompleteL();
+
+        // Own test functions that use assertions and may leave:
+        
+        //constructor
+        void TestFileManNewLReturnsNotNullL();   
+    
+        //add
+        void TestAddEmptyObjectToQueueL();
+        void TestAddObjectToEmptyQueueL();
+        void TestAddObjectToEmptyQueueWillSaveL();
+        void TestAddObjectToNonEmptyQueueL();
+        void TestAddObjectToNonEmptyQueueWillSaveL();
+        void TestAddObjectThatExistsAlreadyL();
+        void TestAddObjectToEmptyQueueLManualStart();
+    
+        //delete
+        void TestDeleteFromEmptyNotExistL();
+        void TestDeleteFromEmptyExistsL();
+        void TestDeleteNonEmptyExistsButNotInQueueL();
+        void TestDeleteNonEmptyNotExistAndNotInQueueL();
+        void TestDeleteInQueueNotActiveL();
+        void TestDeleteInQueueActiveL();
+    
+        //destructor
+        void TestDestructorL();
+        
+        //priority
+        void TestSetPriorityL();
+        
+        //cancel
+        void TestCancelL();
+        
+        //rename
+        void TestRenameFromEmptyNotExistL();
+        void TestRenameFromEmptyExistsL();
+        void TestRenameNonEmptyExistsButNotInQueueL();
+        void TestRenameNonEmptyNotExistAndNotInQueueL();
+        void TestRenameInQueueNotActiveL();
+        void TestRenameInQueueActiveL();
+    
+    protected:  // from MAsynchFSQObserver
+    
+        void MAsynchFSQEvent( TInt aError );
+    
+    private:
+    
+        CAsynchFSQ* iFSQ;
+        CActiveScheduler* iScheduler;
+        TTestCaseNumber currentTest;
+        TBool delayedBool;
+        TBool wait;
+        // Needed for synchronization
+        RMutex iMutex;
+        TInt assertion;
+        TInt numSaved;
+        TInt numToSave;
+        
+    };
+
+#endif // AFSQ_TEST_ASYNCH_SAVE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef AFSQ_TEST_TOP_H
+#define AFSQ_TEST_TOP_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+#include "TestFramework/TestCase.h"
+#include "TestFramework/TestCaller.h"
+#include "TestFramework/TestSuite.h"
+
+EXPORT_C  MTest* CreateTopFct();
+
+class CAFSQTestTop : public CTestSuite
+    {
+    public:
+	    CAFSQTestTop();
+        ~CAFSQTestTop();
+
+	    // A function to collect and return a suite of tests
+	    static MTest* suiteL();
+
+    protected:
+
+    private:
+
+    };
+
+#endif // AFSQ_TEST_TOP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/STIFAFSQTest.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef STIFAFSQTEST_H
+#define STIFAFSQTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+// CONSTANTS
+
+// MACROS
+
+// Logging path
+_LIT( KSTIFAFSQTestLogPath, "\\logs\\testframework\\STIFAFSQTest\\" ); 
+// Log file
+_LIT( KSTIFAFSQTestLogFile, "STIFAFSQTest.txt" ); 
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CSTIFAFSQTest;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+/**
+*  CSTIFAFSQTest test class for STIF Test Framework TestScripter.
+*  This STIF test module provides basic FSQ tests 
+*
+*  @lib STIFAFSQTest.dll
+*  @since Series60_31
+*/
+NONSHARABLE_CLASS(CSTIFAFSQTest) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static STIFAFSQTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~STIFAFSQTest();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line 
+        * @since Series60_31
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWLANTests( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since Series60_31
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+        virtual TInt SearchNetworkL( CStifItemParser& aItem );
+        
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+       
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+       
+    protected:  // Friend classes
+       
+    private:    // Friend classes
+       
+    };
+
+#endif      // STIFAFSQTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/StifFSQTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFramework/testsuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS( CTestModule ) 
+        :public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+        void AllocFailureSimulation ( TBool aSwitchedOn );
+
+        void RunTestCaseInOOMLoopL( const TInt aCaseNumber, TTestResult& aResult );
+            
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+       RHeap::TAllocFail iAllocFailureType;
+       TInt iAllocFailureRate;    	    	  	
+       TInt iCurrentAllocFailureRate;    	    	  	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/AssertFailure.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/TestResult.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/test.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCaller.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFrameWork/testCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCase.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testSuite.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/sis/STIFAFSQTest.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,66 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: STIFAFSQTest.pkg
+;
+;
+;
+
+; Languages
+&EN
+
+; Package header
+#{"STIFAFSQTEST"},(0x101F8818),0,0,0,TYPE=SA
+
+; Localised Vendor name
+%{"Nokia EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+
+"\epoc32\release\armv5\udeb\STIFAFSQTest.dll"   -   "!:\Sys\Bin\STIFAFSQTest.dll"
+  
+"\epoc32\winscw\c\TestFramework\TestFramework.ini"-"C:\TestFramework\TestFramework_FSQ.ini"
+
+"\s60\mw\cameraengines\CamAppEngine\asynchfilesavequeue\tsrc\public\basic\data\STIFAFSQTest\Nibbles.jpg"-"E:\testing\data\STIFAFSQTest\Nibbles.jpg"
+
+"\s60\mw\cameraengines\CamAppEngine\asynchfilesavequeue\tsrc\public\basic\data\STIFAFSQTest\Nibbles2.jpg"-"E:\testing\data\STIFAFSQTest\Nibbles2.jpg"
+
+"\s60\mw\cameraengines\CamAppEngine\asynchfilesavequeue\tsrc\public\basic\data\STIFAFSQTest\Nibbles3.jpg"-"E:\testing\data\STIFAFSQTest\Nibbles3.jpg"
+
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAdd.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,530 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.001
+    // 
+    // Action : Test that adding an null object to the queue will return an error.
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD001p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    HBufC8 * myData = HBufC8::NewL(1000);
+    delete myData;
+    myData = NULL;
+    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        TFileName add001 = KNibblesADD001;
+        error = iFSQ->SaveAndDestroy( *myData, add001);
+        );
+    TRAPD( err2,
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL isKErrArgument=%d notErr=%d notErr2=%d"), (error == KErrArgument), !err, !err2 );
+    
+    //do not delay assert because queue should not be active
+    assertL( (error == KErrArgument) && !err && !err2);
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.002
+    // 
+    // Action : Test that adding an object to an empty queue will at least start OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD002p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add002 = KNibblesADD002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add002, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add002);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add002 );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.003
+    // 
+    // Action : Test that adding an object to an empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.    
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL in") );
+
+    currentTest = EADD003p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add003 = KNibblesADD003;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add003, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add003);
+        }
+    aFs.Close();
+    
+    TRAP_IGNORE(  
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add003 );
+        buf = NULL; // transfer ownership
+        );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.004
+    // 
+    // Action : Test that adding an object to a non empty queue will at least start OK.
+    //      
+    // Output : An error code.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+   
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add004A = KNibblesADD004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004A);
+        }
+
+    // Delete the file if it exists
+    TFileName add004B = KNibblesADD004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add004A );
+        buf = NULL; // transfer ownership
+        error2 = iFSQ->SaveAndDestroy( *buf2, add004B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL isKErrNone=%d is2KErrNone=%d notErr=%d"), (error == KErrNone), (error2 == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && (!err) );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.005
+    // 
+    // Action : Test that adding an object to a non empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL in") );
+
+    //TInt error = KErrNone;
+    currentTest = EADD005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add005A = KNibblesADD005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005A);
+        }
+
+    // Delete the file if it exists
+    TFileName add005B = KNibblesADD005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add005A );
+        buf = NULL; // transfer ownership
+        iFSQ->SaveAndDestroy( *buf2, add005B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL notErr=%d"), !err );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.006
+    // 
+    // Action : Test that adding an object to an empty queue which exists int the file
+    //          system will report KErrAlreadyExists.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlready in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD006p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName add006 = KNibblesADD006;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add006, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add006);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, add006, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	
+    // Reuse the file name, to write where it exists.
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add006, EFalse );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL out") );
+    }
+
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.007
+    // 
+    // Action : Test that adding an object to an empty manual queue will be OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD007p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add007 = KNibblesADD007;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add007, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add007);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SetManualStart( ETrue );
+        error = iFSQ->SaveAndDestroy( *buf, add007 );
+        buf = NULL; // transfer ownership 
+        error2 = iFSQ->Go();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart isKErrNone=%d notErr=%d"), ((error == KErrNone) && (error2 == KErrNone)), !err );
+   
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart out") );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAsynchSave.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,636 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+CAFSQTestAsynchSave::CAFSQTestAsynchSave()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave in") );
+    
+    // Create a mutex for synchronization purpose
+    iMutex.CreateLocal();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave out") );
+    }
+
+CAFSQTestAsynchSave::~CAFSQTestAsynchSave()
+    {
+    // Nothing to do
+    }
+
+void CAFSQTestAsynchSave::setUpL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::setUpL in") );
+    }
+
+void CAFSQTestAsynchSave::tearDown()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::tearDown in") );
+    }
+
+void CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001
+    // 
+    // Action : Test that cfileman::newl returns a value.
+    //      
+    // Output : A handle to the requested object.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL in") );
+
+    currentTest = ECONSTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL isNotNull=%d notErr=%d"), (iFSQ!=NULL), !err);
+    assertL( (iFSQ != NULL) && !err );
+    delete iFSQ;
+    iFSQ = NULL;
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDestructorL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDESTRUCTOR.001
+    // 
+    // Action : Test that delete works
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL in") );
+
+    currentTest = EDESTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL out") );
+    }
+    
+void CAFSQTestAsynchSave::TestSetPriorityL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTSETPRIORITY.001
+    // 
+    // Action : Test that setting the priority doesn't fail
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL in") );
+
+    currentTest = EPRIORITY001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetPriority( EPriorityMore );
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL out") );
+    }   
+    
+void CAFSQTestAsynchSave::TestCancelL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTCANCEL.001
+    // 
+    // Action : Test that canceling will....
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL in") );
+
+    TInt error = KErrNone;
+    currentTest = ECANCEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName cancel001 = KNibblesCANCEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, cancel001, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, cancel001);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, cancel001 );
+        buf = NULL; // transfer ownership 
+        iFSQ->Cancel();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    // do not wait for callback to assert, since we have canceled
+    delayedBool = ( (error == KErrNone) && !err );
+    assertL( delayedBool );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL out") );
+    }
+    
+void CAFSQTestAsynchSave::WaitForAsynchCompleteL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL in") );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL starting AS now") );
+    CActiveScheduler::Start();
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL closing") );
+    //close up and assert
+    User::After( TTimeIntervalMicroSeconds32(1000000) );
+    if( iFSQ )
+        {
+        delete iFSQ;
+        iFSQ = NULL; 
+        }
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL we are asserting the following: %d"), assertion );
+        
+    assertL( assertion );
+       
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL out") );
+    }
+
+void CAFSQTestAsynchSave::MAsynchFSQEvent( TInt aError )
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, waiting"));
+    User::After( TTimeIntervalMicroSeconds32(2000000) );
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, done waiting"));
+
+    numSaved++;
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, numToSave=%d"),numToSave);
+
+    switch( currentTest )
+        {
+        case EADD002p1:
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            
+        case EADD003p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            
+            //check that the file exists
+            RFs fsSession;
+            TInt connectErr = fsSession.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) connectErr=%d"), connectErr );
+            RFile file;
+            TFileName add003 = KNibblesADD003;
+            TInt fileErr = file.Open(fsSession, add003, EFileRead);
+            file.Close();
+            fsSession.Close();
+
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) aErrorIsKErrNone=%d !fileErr=%d"), (aError == KErrNone), !fileErr );
+            assertion = ( (aError == KErrNone) && !fileErr);
+            break;        
+            }           
+        case EADD004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add004A = KNibblesADD004A;
+                TFileName add004B = KNibblesADD004B;
+                TInt fileErr1 = file1.Open(fsSession, add004A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add004B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) delayedBool=%d !aError=%d !fileErr1=%d !fileErr2=%d"), delayedBool, !aError, !fileErr1, !fileErr2 );
+                assertion = ( delayedBool && !aError && !fileErr1 && !fileErr2);
+                }
+            break;
+            }
+        case EADD005p1:
+            {        
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add005A = KNibblesADD005A;
+                TFileName add005B = KNibblesADD005B;
+                TInt fileErr1 = file1.Open(fsSession, add005A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add005B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+                    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) isaErrorKErrNone=%d"), (aError==KErrNone) );
+                assertion = ( aError == KErrNone );
+                }
+            break;
+            }        
+        case EADD007p1:
+            {        
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            }                
+        case EDEL003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del003A = KNibblesDEL003A;
+                TInt fileError = file3.Open(fsSession2, del003A, EFileRead);
+                file3.Close();
+                fsSession2.Close();
+    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) delayedBool=%d !aError=%d fileError=%d"), delayedBool, !aError, !(!fileError) );
+                assertion = ( delayedBool && !aError && !(!fileError) );
+                }
+            break;
+            }    
+        case EDEL004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EDEL005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del005A = KNibblesDEL005A;
+                TInt fileError = file3.Open(fsSession2, del005A, EFileRead);
+                file3.Close();
+            
+                //check that file was saved
+                RFile file4;
+                TFileName del005B = KNibblesDEL005B;
+                TInt fileError2 = file4.Open(fsSession2, del005B, EFileRead);
+                file4.Close();
+                
+                //check that file was saved
+                RFile file5;
+                TFileName del005C = KNibblesDEL005C;
+                TInt fileError3 = file5.Open(fsSession2, del005C, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) delayedBool=%d !aError=%d fileError=%d !fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !fileError2, !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !fileError2 && !fileError3 );
+                }
+            break;
+            }    
+        case EDEL006p1:
+            {
+            //check that file was saved
+            RFs fsSession2;
+            TInt connectErr = fsSession2.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) connectErr=%d"), connectErr );
+            RFile file5;
+            TFileName del006A = KNibblesDEL006A;
+            TInt fileError3 = file5.Open(fsSession2, del006A, EFileRead);
+            file5.Close();
+            
+            if( iFSQ->ActionsLeft() == 0 )
+                {
+                //we should be done with the rest...
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                
+                //check that file was deleted
+                RFile file3;
+                TFileName del006C = KNibblesDEL006C;
+                TInt fileError = file3.Open(fsSession2, del006C, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName del006B = KNibblesDEL006B;
+                TInt fileError2 = file4.Open(fsSession2, del006B, EFileRead);
+                file4.Close();
+                
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) delayedBool=%d !aError=%d fileError=%d fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !(!fileError2), !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !(!fileError2) && !fileError3 );
+                }
+                
+            fsSession2.Close();
+            break;
+            }    
+        case EREN003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren003A2 = KNibblesREN003A2;
+                TInt fileError = file3.Open(fsSession2, ren003A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren003B = KNibblesREN003B;
+                TInt fileError2 = file4.Open(fsSession2, ren003B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren003A = KNibblesREN003A;
+                TInt fileError3 = file5.Open(fsSession2, ren003A, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) );
+                }
+            break;
+            }    
+        case EREN004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EREN005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren005A2 = KNibblesREN005A2;
+                TInt fileError = file3.Open(fsSession2, ren005A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren005B = KNibblesREN005B;
+                TInt fileError2 = file4.Open(fsSession2, ren005B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren005A = KNibblesREN005A;
+                TInt fileError3 = file5.Open(fsSession2, ren005A, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren005C = KNibblesREN005C;
+                TInt fileError4 = file6.Open(fsSession2, ren005C, EFileRead);
+                file6.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4 );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 );
+                }
+            break;
+            }    
+        case EREN006p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren006C2 = KNibblesREN006C2;
+                TInt fileError = file3.Open(fsSession2, ren006C2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren006B2 = KNibblesREN006B2;
+                TInt fileError2 = file4.Open(fsSession2, ren006B2, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren006B = KNibblesREN006B;
+                TInt fileError3 = file5.Open(fsSession2, ren006B, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren006A = KNibblesREN006A;
+                TInt fileError4 = file6.Open(fsSession2, ren006A, EFileRead);
+                file6.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file7;
+                TFileName ren006C = KNibblesREN006C;
+                TInt fileError5 = file7.Open(fsSession2, ren006C, EFileRead);
+                file7.Close();
+                
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d !!fileError5=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4, !(!fileError5) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 && !(!fileError5) );
+                }
+            break;
+            }
+        case EADD006p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            assertion = ( delayedBool && ( aError == KErrAlreadyExists ));
+            break;
+            }
+        case ECANCEL001p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            // do nothing, we are waiting for cancel
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1)"));
+            break;
+            }
+        default:
+            break;
+        }
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent out") );
+    }
+
+MTest* CAFSQTestAsynchSave::suiteL ()
+    {
+    // An own static function to collect the test functions into one 
+    // suite of tests. The framework will run the tests and free the
+    // memory allocated for the test suite.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL in") );
+    
+    // Always use NewL (Do not use NewLC here)
+    CTestSuite *suite = CTestSuite::NewL( _L8("CAFSQTestAsynchSave") );
+
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001"), &TestFileManNewLReturnsNotNullL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDESTRUCTOR.001"), &TestDestructorL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTSETPRIORITY.001"), &TestSetPriorityL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTCANCEL.001"), &TestCancelL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.001"), &TestAddEmptyObjectToQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.002"), &TestAddObjectToEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.003"), &TestAddObjectToEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.004"), &TestAddObjectToNonEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.005"), &TestAddObjectToNonEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.006"), &TestAddObjectThatExistsAlreadyL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.007"), &TestAddObjectToEmptyQueueLManualStart ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.001"), &TestDeleteFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.002"), &TestDeleteFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.003"), &TestDeleteNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.004"), &TestDeleteNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.005"), &TestDeleteInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.006"), &TestDeleteInQueueActiveL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.001"), &TestRenameFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.002"), &TestRenameFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.003"), &TestRenameNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.004"), &TestRenameNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.005"), &TestRenameInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.006"), &TestRenameInQueueActiveL ) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL returning") );
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestDelete.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,692 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.001
+    // 
+    // Action : Test that cfileman::delete returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL in") );
+	
+    currentTest = EDEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName del001 = KNibblesDEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del001, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del001);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del001 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.002
+    // 
+    // Action : Test that delete works if file exists and queue empty
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL in") );
+
+    currentTest = EDEL002p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName del002 = KNibblesDEL002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del002, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del002);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del002, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del002 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL fsConnectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, del002, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+    
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL errorIsKErrNone=%d notErr=%d isFileError=%d"), (error == KErrNone), !err, !(!(fileError )) );
+    
+    assertL( (error == KErrNone) && !err && (fileError!=KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.003
+    // 
+    // Action : Test that delete will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EDEL003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2, EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3, EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del003A = KNibblesDEL003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003A);
+        }
+
+    // Delete the file if it exists
+    TFileName del003B = KNibblesDEL003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del003C = KNibblesDEL003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003C);
+        }
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	aFs.Close();
+	delete buf;
+	buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del003C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del003A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.004
+    // 
+    // Action : Test that delete will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL in") );
+
+    currentTest = EDEL004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del004A = KNibblesDEL004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004A);
+        }
+
+    // Delete the file if it exists
+    TFileName del004B = KNibblesDEL004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del004C = KNibblesDEL004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del004C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004C);
+        }
+
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del004C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del004A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.005
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL in") );
+	
+    currentTest = EDEL005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del005A = KNibblesDEL005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005A);
+        }
+
+    // Delete the file if it exists
+    TFileName del005B = KNibblesDEL005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del005C = KNibblesDEL005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005C);
+        }
+
+    aFs.Close();
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del005A );
+        buf = NULL;
+        error = iFSQ->Delete( del005A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.006
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL in") );
+	
+    currentTest = EDEL006p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del006A = KNibblesDEL006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006A);
+        }
+
+    // Delete the file if it exists
+    TFileName del006B = KNibblesDEL006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del006C = KNibblesDEL006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006C);
+        }
+
+    aFs.Close();
+	    
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del006A );
+        buf = NULL;
+        errorA = iFSQ->Delete( del006B );
+        errorB = iFSQ->Delete( del006C );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL out") );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestRename.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,746 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.001
+    // 
+    // Action : Test that cfileman::rename returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL in") );
+	
+    currentTest = EREN001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName ren001A = KNibblesREN001A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren001A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren001A);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren001B = KNibblesREN001B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren001A, ren001B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.002
+    // 
+    // Action : Test that rename works if file exists and queue empty
+    //      
+    // Output : A KErrNone.  
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL in") );
+	 
+    currentTest = EREN002p1;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName ren002A = KNibblesREN002A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren002A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren002A);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren002A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete file
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren002B = KNibblesREN002B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren002A, ren002B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL connectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, ren002B, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL errorIsKErrNone=%d notErr=%d !fileError=%d"), (error == KErrNone), !err, !(fileError ) );
+    
+    assertL( (error == KErrNone) && !err && (fileError==KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL out") );   
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.003
+    // 
+    // Action : Test that rename will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EREN003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren003A = KNibblesREN003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003B = KNibblesREN003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003C = KNibblesREN003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren003A2 = KNibblesREN003A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren003A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A2);
+        }    
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren003C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren003A, ren003A2);
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.004
+    // 
+    // Action : Test that rename will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL in") );
+	
+    currentTest = EREN004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    TInt connectError = User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren004A = KNibblesREN004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004B = KNibblesREN004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004C = KNibblesREN004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren004C,EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004C);
+        }
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TFileName ren004A2 = KNibblesREN004A2;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren004C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren004A, ren004A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.005
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL in") );
+	
+    currentTest = EREN005p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren005A = KNibblesREN005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005B = KNibblesREN005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005C = KNibblesREN005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005C);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005A2 = KNibblesREN005A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren005A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A2);
+        }    
+
+    aFs.Close();
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren005A );
+        buf = NULL;
+        error = iFSQ->Rename( ren005A, ren005A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueActiveL()
+{
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.006
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence?
+    //          This case checks that the file ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL in") );
+	
+    currentTest = EREN006p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren006A = KNibblesREN006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren006B = KNibblesREN006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C = KNibblesREN006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006B2 = KNibblesREN006B2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren006B2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B2);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C2 = KNibblesREN006C2;
+    RFile deleter5;
+    TInt isDeleted5 = deleter5.Open(aFs, ren006C2, EFileRead);
+    deleter5.Close();
+    if ( isDeleted5 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 5th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C2);
+        }                
+
+    aFs.Close();
+
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren006A );
+        buf = NULL;
+        errorA = iFSQ->Rename( ren006B, ren006B2 );
+        errorB = iFSQ->Rename( ren006C, ren006C2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL out") );
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/STIFAFSQTestBlocks.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: STIFAFSQTestBlocks.cpp
+*
+*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/StifFSQTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "../inc/StifFSQTestTop.h"
+#include "../inc/TestFramework/testsuite.h"
+#include "../inc/AFSQTestTop.h"
+#include "../inc/AFSQTestAsynchSave.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+    
+    TRAP_IGNORE(
+        CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+        
+    	// Stack size
+    	param->iTestThreadStackSize= 2*16384; // 2*16K stack
+
+    	// Heap sizes
+    	param->iTestThreadMinHeap = 4096;   // 4K heap min
+    	param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    	aTestModuleParam = param;
+	);
+	
+    return KErrNone;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL( CAFSQTestAsynchSave::suiteL() );    
+    
+
+    
+    // SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+
+    /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+    // Next is a temporary solution for Stif memory leak error
+    //TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksMem);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksRequests);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles);
+
+    if ( iAllocFailureType != RHeap::ENone )
+        {
+        RunTestCaseInOOMLoopL( aCaseNumber, aResult );
+        }
+    else
+        {
+        iTestSuite->ExecuteTestL( aResult, aCaseNumber );
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return KErrNone; 
+    }
+
+
+/*
+*/    
+
+void CTestModule::RunTestCaseInOOMLoopL( const TInt aCaseNumber,
+                                        TTestResult& aResult )
+    {
+
+    // 
+    TInt error = KErrNone; 
+    aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+
+    for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+        {      
+        // Switches on alloc failure simulation if the parameters are set for it
+        AllocFailureSimulation( ETrue ); 
+        RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+        TRAP( error, iTestSuite->ExecuteTestL( aResult, aCaseNumber ) );
+        if ( error == KErrNoMemory )
+            {
+            error = KErrNone;
+            }
+        }
+    
+    //
+    AllocFailureSimulation( EFalse );
+    User::LeaveIfError( error ); 
+    }
+
+
+/*
+*/    
+
+void CTestModule::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CTestModule::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+#ifndef EKA2
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/AssertFailure.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "TestFramework/AssertFailure.h"
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+                                      TInt aLineNumber,
+                                      const TDesC8& aFileName)
+    {
+    CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+                                       TInt aLineNumber,
+                                       const TDesC8& aFileName)
+
+    {
+    CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+    CleanupStack::PushL(self);
+    self->ConstructL(aMessage, aFileName);
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self=NewLC(aAssertFailure);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self = new(ELeave)CAssertFailure;
+    CleanupStack::PushL(self);
+    self->ConstructL(aAssertFailure);
+    return self;
+    }
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+                                 const TDesC8& aFileName)
+    {
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+    }
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+    {
+    iLineNumber = aAssertFailure.iLineNumber;
+    iMessage = aAssertFailure.iMessage->AllocL();
+    iFileName = aAssertFailure.iFileName->AllocL();
+    }
+
+CAssertFailure::CAssertFailure ()
+    {
+    }
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+    {
+    }
+
+CAssertFailure::~CAssertFailure () 
+    {
+    delete iFileName;
+    delete iMessage;
+    }
+
+const TDesC8& CAssertFailure::What() const
+    {
+    return *iMessage;
+    }
+
+TInt CAssertFailure::LineNumber()  const
+    {
+    return iLineNumber;
+    }
+
+const TDesC8& CAssertFailure::FileName()  const
+    {
+    return *iFileName;
+    }
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+    {
+    iMyHeapCellCount = aHeapCellCount;
+    }
+
+TInt CAssertFailure::MyHeapCellCount ()
+    {
+    return iMyHeapCellCount;
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/TestSuite.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/TestFramework/TestSuite.h"
+#include <StifTestModule.h>
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/testCase.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include <utf.h>
+
+#include "../inc/TestFramework/testCase.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "../inc/TestFramework/TestCase.h"
+#include "../inc/TestFramework/TestResult.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include "../inc/TestFramework/CppUnitLog.h"
+#endif
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/rom/CamAppEngine.iby	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY for Camera Application Engine. 
+*
+*/
+
+
+#ifndef __CAMAPPENGINE_IBY__
+#define __CAMAPPENGINE_IBY__
+
+file=ABI_DIR\BUILD_DIR\CAEENGINE.DLL            SHARED_LIB_DIR\CAEENGINE.DLL
+file=ABI_DIR\BUILD_DIR\ASYNCHFSQ.DLL            SHARED_LIB_DIR\ASYNCHFSQ.DLL
+file=ABI_DIR\BUILD_DIR\CAESTILLCONVERTER.DLL    SHARED_LIB_DIR\CAESTILLCONVERTER.DLL
+
+//data=ZSYSTEM\install\camappenginestub.sis       system\install\camappenginestub.sis
+
+#endif
Binary file camappengine/rom/CamAppEngineStub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/rom/CamAppEngineStub.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: CamAppEngineStub.pkg
+;
+; Languages
+&EN
+
+; Header
+#{"CamAppEngine"}, (0x101F8569), 1, 0, 0
+
+;Supports Series 60 v 3.0
+;[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\CaeEngine.dll"
+""-"z:\sys\bin\AsynchFSQ.dll"
+""-"z:\sys\bin\CaeStillConverter.dll"
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/Build/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common build information file to build all Camcorder subsystems
+*
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Exported headers
+
+PRJ_EXPORTS
+../rom/CamcorderMMFPluginStub.SIS /epoc32/data/z/system/install/CamcorderMMFPluginStub.sis
+../rom/CamcorderMMFPlugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(CamcorderMMFPlugin.iby)
+
+PRJ_MMPFILES
+../mediarecorder/Group/mediarecorder.mmp
+../filecomposer/Group/camc3GPDataSink.mmp
+../controller/Group/CamCController.mmp
+
+// Separate MMP files for creating *.LIBs
+../mediarecorder/Group/mediarecorderLib.mmp
+../filecomposer/Group/camc3GPDataSinkLib.mmp
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/controller/Group/CamCController.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin project specification
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          CAMCCONTROLLER.DLL
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101F8502
+
+CAPABILITY 	    CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../Src
+SOURCE          CamCController.cpp
+SOURCE          CamCControllerFactory.cpp
+
+START RESOURCE 101F8502.rss
+TARGET 		    CAMCCONTROLLER.rsc
+END
+
+// Default system include paths for application layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../Inc
+USERINCLUDE	    ../../../inc   // ADo level inc dir
+USERINCLUDE     ../../mediarecorder/Inc
+
+LIBRARY		euser.lib 
+LIBRARY		mmfcontrollerframework.lib
+LIBRARY		mmfstandardcustomcommands.lib
+LIBRARY		camcmediarecorder.lib
+LIBRARY		camc3gpsink.lib
+LIBRARY		bafl.lib	
+LIBRARY		efsrv.lib //TParse
+
+#ifdef EABI
+library ECOM.LIB
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/controller/Group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin build info
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+./CamCController.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/controller/Inc/CamCController.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,606 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin
+*
+*/
+
+
+
+#ifndef CAMCCONTROLLER_H
+#define CAMCCONTROLLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include <mmf/common/mmfcontroller.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "CamC3GPDataSinkObserver.h"
+#include "CCMRMediaRecorder.h"
+#include "CamC3GPDataSink.h"
+
+// FORWARD DECLARATION
+class CDesC8ArrayFlat;
+class CMMFFile;
+
+// CLASS DECLARATION
+
+/**
+*  Camcorder controller plugin
+*
+*  @lib camccontroller.lib
+*  @since 2.1
+*/
+class CCamCController : public CMMFController, 
+                        public MCMRMediaRecorderObserver,
+                        public M3GPDataSinkObserver,
+                        public MMMFVideoControllerCustomCommandImplementor, 
+                        public MMMFVideoRecordControllerCustomCommandImplementor, 
+                        public MMMFAudioRecordDeviceCustomCommandImplementor
+    {
+    public:
+
+        /**
+        * Controller internal states
+        */
+        enum TCamCControllerState
+            {
+            EStateNone = 0, 
+            EStateOpen,
+            EStatePrepared,
+            EStateRecording,
+            EStatePaused,
+            EStateStopping
+            };
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCamCController* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCamCController();
+
+    private:
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CMMFController Add data source to controller.
+        * @since 2.1
+        * @param aDataSource A reference to the data source.
+        * @return void
+        */
+        void AddDataSourceL(MDataSource& aDataSource);
+    
+        /**
+        * From CMMFController Add data sink to controller.
+        * @since 2.1
+        * @param aDataSink A reference to the data sink.
+        * @return void
+        */
+        void AddDataSinkL(MDataSink& aDataSink);
+
+        /**
+        * From CMMFController Remove data source from controller.
+        * @since 2.1
+        * @param  aDataSource A reference to the data source.
+        * @return void
+        */
+        void RemoveDataSourceL(MDataSource& aDataSource);
+
+        /**
+        * From CMMFController Remove data sink from controller.
+        * @since 2.1
+        * @param aDataSink A reference to the data sink.
+        * @return void
+        */
+        void RemoveDataSinkL(MDataSink& aDataSink);
+
+        /**
+        * From CMMFController Reset controller.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void ResetL();
+
+        /**
+        * From CMMFController  Primes controller.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void PrimeL();
+
+        /**
+        * From CMMFController Start recording.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void PlayL();
+
+        /**
+        * From CMMFController Pause recording.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void PauseL();
+
+        /**
+        * From CMMFController Stop recording.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void StopL();
+
+        /**
+        * From CMMFController Returns current recording position. Not supported
+        * DurationL() used instead.
+        * @since 2.1
+        * @param void
+        * @return Current position of recording.
+        */
+        TTimeIntervalMicroSeconds PositionL() const;
+
+        /**
+        * From CMMFController Sets current recording position. Not supported.
+        * @since 2.1
+        * @param aPosition Reference to wanted position.
+        * @return void
+        */
+        void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
+
+        /**
+        * From CMMFController Returns current duration of recording.
+        * @since 2.1
+        * @param void 
+        * @return Current duration of recording.
+        */
+        TTimeIntervalMicroSeconds DurationL() const;
+
+        /**
+        * From CMMFController Set camcorder priority settings.
+        * @since 2.1
+        * @param aPrioritySettings Wanted priority.
+        * @return void
+        */
+        void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
+
+        /**
+        * From CMMFController Handle custom commands to controller.
+        * @since 2.1
+        * @param aMessage Message to controller.
+        * @return void
+        */
+        void CustomCommand(TMMFMessage& aMessage);
+
+        /**
+        * From CMMFController Get number of metadata entries.
+        * @since 2.1
+        * @param aNumberOfEntries Reference used to return metadata count.
+        * @return void
+        */
+        void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries);
+
+        /**
+        * From CMMFController Returns metadata entry.
+        * @since 2.1
+        * @param aIndex Index to metadata entry.
+        * @return Metadata entry
+        */
+        CMMFMetaDataEntry* GetMetaDataEntryL(TInt aIndex);
+
+    public: // from MCMRMediaRecorderObserver
+
+        /**
+        * From MCMRMediaRecorderObserver Mediarecorder has completed prepare.
+        * @since 2.1
+        * @param aError Error code from mediarecorder.
+        * @return void
+        */      
+        void MmroPrepareComplete(TInt aError);    
+
+        /**
+        * From MCMRMediaRecorderObserver  Mediarecorder has changed state.
+        * @since 2.1
+        * @param aState Current mediarecorder state.
+        * @param aError Error code from mediarecorder.
+        * @return void
+        */      
+        void MmroStateChange(TInt aState, TInt aError);
+
+        /**
+        * From MCMRMediaRecorderObserver Temporary error in mediarecorder.
+        * @since 2.1
+        * @param aError Error code from mediarecorder.
+        * @return void
+        */      
+        void MmroTemporaryError(TInt aError);
+
+        /**
+        * From MCMRMediaRecorderObserver Fatal error in mediarecorder.
+        * @since 2.1
+        * @param aError Error code from mediarecorder.
+        * @return void
+        */
+        void MmroFatalError(TInt aError);
+
+    public: // from M3GPDataSinkObserver
+
+        /**
+        * From M3GPDataSinkObserver Filecomposer has run out of disk space.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void MfcoDiskFullL();
+
+        /**
+        * From M3GPDataSinkObserver Filecomposer has met maximum file size.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void MfcoSizeLimitReachedL();
+
+    public: // from MMMFVideoControllerCustomCommandImplementor
+
+        /**
+        * From MMMFVideoControllerCustomCommandImplementor Get video frame size.
+        * @since 2.1
+        * @param aVideoFrameSize Reference to return video frame size.
+        * @return void
+        */
+        void MvcGetVideoFrameSizeL(TSize& aVideoFrameSize);
+
+        /**
+        * From MMMFVideoControllerCustomCommandImplementor Get audio codec.
+        * @since 2.1
+        * @param aCodec Reference to return audio codec.
+        * @return void
+        */
+        void MvcGetAudioCodecL(TFourCC& aCodec);
+
+        /**
+        * From MMMFVideoControllerCustomCommandImplementor Get video bit rate.
+        * @since 2.1
+        * @param aBitRate Reference to return video bit rate.
+        * @return void
+        */
+        void MvcGetVideoBitRateL(TInt& aBitRate);
+
+        /**
+        * From MMMFVideoControllerCustomCommandImplementor Get audio bit rate.
+        * @since 2.1
+        * @param aBitRate Reference to return audio bit rate.
+        * @return void
+        */
+        void MvcGetAudioBitRateL(TInt& aBitRate);
+
+        /**
+        * From MMMFVideoControllerCustomCommandImplementor Set video frame rate.
+        * @since 2.1
+        * @param aFramesPerSecond Video frame rate.
+        * @return void
+        */
+        void MvcSetFrameRateL(TReal32 aFramesPerSecond);
+
+        /**
+        * From MMMFVideoControllerCustomCommandImplementor Get video frame rate.
+        * @since 2.1
+        * @param aFramesPerSecond Reference to return video frame rate.
+        * @return void
+        */
+        void MvcGetFrameRateL(TReal32& aFramesPerSecond);
+
+        /**
+        * From MMMFVideoControllerCustomCommandImplementor 
+        * @since 2.1
+        * @param Get video mime type.
+        * @return void
+        */
+        void MvcGetVideoMimeTypeL(TDes8& aMimeType);
+
+    public: // from MMMFVideoRecordControllerCustomCommandImplementor
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set video format.
+        * @since 2.1
+        * @param aVideoFormatUid Video format.
+        * @return void
+        */
+        void MvrcSetVideoFormatL(TUid aVideoFormatUid);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set video codec.
+        * @since 2.1
+        * @param aVideoCodec Video codec.
+        * @return void
+        */
+        void MvrcSetVideoCodecL(const TDesC8& aVideoCodec);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set audio codec.
+        * @since 2.1
+        * @param aAudioCodec Audio codec.
+        * @return void
+        */
+        void MvrcSetAudioCodecL(TFourCC aAudioCodec);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set video bit rate.
+        * @since 2.1
+        * @param aBitRate Video bit rate.
+        * @return void
+        */
+        void MvrcSetVideoBitRateL(TInt& aBitRate);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set audio bit rate.
+        * @since 2.1
+        * @param aBitRate Audio bit rate.
+        * @return void
+        */
+        void MvrcSetAudioBitRateL(TInt& aBitRate);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Add metadata entry.
+        * @since 2.1
+        * @param aNewEntry Metadata entry.
+        * @return void
+        */
+        void MvrcAddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Remove metadata entry.
+        * @since 2.1
+        * @param aIndex Index to metadata.
+        * @return void
+        */
+        void MvrcRemoveMetaDataEntryL(TInt aIndex);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Replace metadata entry.
+        * @since 2.1
+        * @param aIndex Index to metadata.
+        * @param aNewEntry Metadata entry.
+        * @return void
+        */
+        void MvrcReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set maximum file size.
+        * @since 2.1
+        * @param aMaxFileSize Maximum file size.
+        * @return void
+        */
+        void MvrcSetMaxFileSizeL(TInt aMaxFileSize);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor  Set audio enabled/disabled.
+        * @since 2.1
+        * @param aEnable Boolean to enable/disable audio. ETrue to enable.
+        * @return void
+        */
+        void MvrcSetAudioEnabledL(TBool aEnable);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set video frame size.
+        * @since 2.1
+        * @param aFrameSize Video frame size.
+        * @return void
+        */
+        void MvrcSetVideoFrameSizeL(TSize aFrameSize);
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Prepare camcorder for recording.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void MvrcPrepareL();
+        
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Set camera handle.
+        * @since 2.1
+        * @param aCameraHandle Camera handle.
+        * @return void
+        */
+        void MvrcSetCameraHandleL(TInt aCameraHandle);
+
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Returns available recording time.
+        * @since 2.1
+        * @param aTime Available record time
+        * @return void
+        */
+        void MvrcGetRecordTimeAvailableL(TTimeIntervalMicroSeconds& aTime);
+
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Get supported audio sink types.
+        * @since 2.1
+        * @param aDataTypes Reference to return supported audio sink types.
+        * @return void
+        */
+        void MvrcGetSupportedSinkAudioTypesL(RArray<TFourCC>& aDataTypes);
+
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Get supported video sink types.
+        * @since 2.1
+        * @param aDataTypes Reference to return supported video sink types.
+        * @return void
+        */
+        void MvrcGetSupportedSinkVideoTypesL(CDesC8Array& aDataTypes);
+
+        /**
+        * From MMMFVideoRecordControllerCustomCommandImplementor Get audio enabled
+        * @since 2.1
+        * @param aDataTypes Reference to return whether audio is enabled.
+        * @return void
+        */
+        void MvrcGetAudioEnabledL(TBool& aEnabled);
+
+
+    public: //from MMMFAudioRecordDeviceCustomCommandImplementor
+
+        /**
+        * From MMMFAudioRecordDeviceCustomCommandImplementor Set gain.
+        * @since 2.1
+        * @param aGain Gain value.
+        * @return void
+        */
+        void MardSetGainL(TInt aGain);
+
+        /**
+        * From MMMFAudioRecordDeviceCustomCommandImplementor Get maximum gain.
+        * @since 2.1
+        * @param aMaxGain Maximum gain value.
+        * @return void
+        */
+        void MardGetMaxGainL(TInt& aMaxGain);
+
+        /**
+        * From MMMFAudioRecordDeviceCustomCommandImplementor Get gain.
+        * @since 2.1
+        * @param aGain Reference to return gain.
+        * @return void
+        */
+        void MardGetGainL(TInt& aGain);
+
+        /**
+        * From MMMFAudioRecordDeviceCustomCommandImplementor Set balance. Not supported.
+        * @since 2.1
+        * @param aBalance Balance value.
+        * @return void
+        */
+        void MardSetBalanceL(TInt aBalance);
+
+        /**
+        * From MMMFAudioRecordDeviceCustomCommandImplementor Get balance. Not supported.
+        * @since 2.1
+        * @param aBalance Reference to return balance.
+        * @return void
+        */
+        void MardGetBalanceL(TInt& aBalance);
+
+    private:
+        
+        /**
+        * Set new filename from custom command.
+        * @since 2.1
+        * @param aMessage Message to controller.
+        * @return void
+        */
+        void NewFilenameL( TMMFMessage& aMessage );
+
+        /**
+        * Check if controller is ready to open mediarecorder and filecomposer.
+        * @since 2.1
+        * @param void
+        * @return ETrue if ready, EFalse if not.
+        */
+        TBool ReadyToOpenSource();
+
+        /**
+        * Open mediarecorder adn filecomposer.
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        void OpenSourceL();
+        
+    private:
+    
+        static TInt IdleStop( TAny* aCont ); 
+
+    public: 
+
+        void DoIdleStop();  
+
+
+    private: // Data
+        // Supported Video codecs
+        CDesC8ArrayFlat* iSupportedVideoTypes;
+
+        // Supported Audio codecs
+        RArray<TFourCC> iSupportedAudioTypes;
+
+        // Controller internal state
+        TCamCControllerState iState;
+
+        // Video codec
+        HBufC8* iVideoCodec;
+
+        // Audio codec
+        TFourCC iAudioCodec;
+
+        // Video file format
+        CCamC3GPDataSink::TCamCSinkFileFormat iVideoFormat;
+
+        // Camera handle
+        TInt iCameraHandle;
+
+        // Saved error code in case of internal stop.
+        TInt iSavedStopError;
+        
+        // Whether current stop is asynchronous.
+        TBool iAsyncStop;
+
+        // Recorder file name
+        TFileName iFileName;
+        
+        // MMF file sink
+        CMMFFile* iMMFFile;
+        
+        // Whether Data Sink is performed via RFiles or Descriptors
+        TBool iForceDataSinkFileName;
+
+        // Whether composer is ready to receive buffers (OpenFileL called)
+        TBool iFileComposerReady;
+        
+        // Whether mediarecorder complete message has arrived and preparecomplete event is sent to client.
+        // Used for parallel preparing of filecomposer and mediarecorder.
+        TBool  iMRPrepareCompleteSent;
+
+        TMMFPrioritySettings iPrioritySettings;
+
+        MDataSource* iAudioSource;
+
+        // Mediarecorder
+        CCMRMediaRecorder* iMediaRecorder;  // Data source
+
+        // Filecomposer
+        CCamC3GPDataSink* iFileComposer;
+        
+        CIdle* iIdleStop;
+
+    };
+
+#endif      // CAMCCONTROLLER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/controller/Inc/CamCImplementationUIDs.hrh	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin implementation UIDs
+*
+*/
+
+
+#ifndef __CAMCIMPLEMENTATIONUIDS_HRH__
+#define __CAMCIMPLEMENTATIONUIDS_HRH__
+
+// DATA TYPES
+// These are the ECOM Implementation UIDs for the controller
+
+#define KCamCUidControllerImplementation 0x101F8503
+
+#define KCamCUidRecordFormatImplementation 0x101F8504
+#define KCamCUid3GPP2FileFormatImplementation 0x101F86D6
+#define KCamCUidMP4FileFormatImplementation 0x101F873D
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/controller/Src/101F8502.rss	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin ECOM registration
+*
+*/
+
+
+
+//  INCLUDES
+#include "ecom/registryinfo.rh"
+#include "CamCImplementationUIDs.hrh"
+#include <mmf/plugin/mmfplugininterfaceuids.hrh>
+#include <bldvariant.hrh>
+
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// Camcorder controller plugin ECOM registration
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x101F8502;
+	interfaces = 
+		{
+		INTERFACE_INFO // Controller Plugin Description
+			{
+			interface_uid = KMmfUidPluginInterfaceController;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KCamCUidControllerImplementation;
+					version_no = 1;
+					display_name = "Camcorder controller";
+					default_data = "?";
+					opaque_data = "<s>Nokia<i>0x101F5D08<r>0x101F850D<a>0x500000";
+					}
+				};
+			},
+		INTERFACE_INFO // Record Format Description
+			{
+			interface_uid = 0x101F850D;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KCamCUidRecordFormatImplementation;
+					version_no = 1;
+					display_name = "3GPP File Format";
+					default_data = "?";
+					opaque_data = "<s>Nokia<i>0x101F5D08<e>.3gp<h>????ftyp<m>video/3gpp";
+					}
+                ,
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KCamCUid3GPP2FileFormatImplementation;
+					version_no = 1;
+					display_name = "3GPP2 File Format";
+					default_data = "?";
+					opaque_data = "<s>Nokia<i>0x101F5D08<e>.3g2<h>????ftyp<m>video/3gpp2";
+					}
+#if (defined(__MPEG4_VIDEO_ENCODING) && defined(__MPEG4_AAC_ENCODING))
+                ,
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KCamCUidMP4FileFormatImplementation;
+					version_no = 1;
+					display_name = "MPEG-4 File Format";
+					default_data = "?";
+					opaque_data = "<s>Nokia<i>0x101F5D08<e>.mp4<h>????ftyp<m>video/mp4";
+					}
+#endif
+				};
+			}
+		};
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/controller/Src/CamCController.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1526 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <mmf/common/mmfcontroller.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include <mmf/server/mmffile.h>
+#include <badesca.h>    // CDesC8ArrayFlat
+#include <AudioPreference.h>                // For MMF audio preference definitions.
+#include "CamC3GPDataSink.h"
+#include "CCMRMediaRecorder.h"
+#include "CamC3GPDataSinkObserver.h"
+#include "CamCController.h"
+#include "CCMRSupportedCodecs.h"
+#include "CamCImplementationUIDs.hrh"
+#include "CamCControllerCustomCommands.h"
+
+// LOCAL CONSTANTS AND MACROS
+// Debug print macro
+#if defined _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCamCController::NewL
+// Two-phased constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCamCController* CCamCController::NewL()
+    {
+    PRINT((_L("CCamCController::NewL() in ")));
+
+    CCamCController* self = new(ELeave) CCamCController();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    PRINT((_L("CCamCController::NewL() out ")));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::~CCamCController
+// Destructor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCamCController::~CCamCController()
+    {
+    PRINT((_L("CCamCController::~CCamCController enter      ")));
+
+    delete iMediaRecorder;
+    iMediaRecorder = NULL;
+
+    PRINT((_L("CCamCController::~CCamCController mediarecorder deleted      ")));
+
+    delete iFileComposer;
+    iFileComposer = NULL;
+
+    PRINT((_L("CCamCController::~CCamCController filecomposer deleted      ")));
+
+    delete iVideoCodec;
+    iVideoCodec = NULL;
+
+    if ( iSupportedVideoTypes )
+        {
+        iSupportedVideoTypes->Reset();
+        delete iSupportedVideoTypes;
+        iSupportedVideoTypes = NULL;
+        }
+
+    iSupportedAudioTypes.Close();
+    delete iIdleStop;
+
+    PRINT((_L("CCamCController::~CCamCController exit      ")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::ConstructL
+// Symbian 2nd phase constructor can leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCamCController::ConstructL()
+    {
+    PRINT((_L("CCamCController::ConstructL() in")));
+
+    iMediaRecorder = NULL;
+    iFileComposer = NULL;
+    iState = EStateNone;
+    iVideoCodec = 0;
+    iAudioCodec = 0;
+    iCameraHandle = -1;
+    iVideoFormat = CCamC3GPDataSink::E3GPP;
+    iFileComposerReady = EFalse;
+    iMRPrepareCompleteSent = EFalse;
+    iForceDataSinkFileName = EFalse;
+    iSavedStopError = KErrNone;
+    iAsyncStop = EFalse;
+    iPrioritySettings.iPriority = KAudioPriorityVideoRecording;
+    iPrioritySettings.iPref =  TMdaPriorityPreference( KAudioPrefVideoRecording );
+
+    iSupportedVideoTypes = new(ELeave) CDesC8ArrayFlat( 2 ); // 2 is the granularity of the array
+    iSupportedVideoTypes->Reset();
+    iSupportedAudioTypes.Reset();
+
+    //custom command parsers
+    CMMFVideoControllerCustomCommandParser* vidConPaser =
+                                        CMMFVideoControllerCustomCommandParser::NewL(*this);
+    CleanupStack::PushL(vidConPaser);
+    AddCustomCommandParserL(*vidConPaser); //parser now owned by controller framework
+    CleanupStack::Pop(vidConPaser);
+
+    CMMFVideoRecordControllerCustomCommandParser* vidRecParser =
+                                        CMMFVideoRecordControllerCustomCommandParser::NewL(*this);
+    CleanupStack::PushL(vidRecParser);
+    AddCustomCommandParserL(*vidRecParser); //parser now owned by controller framework
+    CleanupStack::Pop(vidRecParser);
+
+    CMMFAudioRecordDeviceCustomCommandParser* audRecParser =
+                                        CMMFAudioRecordDeviceCustomCommandParser::NewL(*this);
+    CleanupStack::PushL(audRecParser);
+    AddCustomCommandParserL(*audRecParser); //parser now owned by controller framework
+    CleanupStack::Pop(audRecParser);
+
+    // Idle priority Active object for async video stop operation
+    iIdleStop = CIdle::NewL( CActive::EPriorityIdle );
+
+    PRINT((_L("CCamCController::ConstructL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::AddDataSourceL
+// Add data source to controller.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCamCController::AddDataSourceL(MDataSource& aDataSource)
+    {
+    PRINT((_L("CCamCController::AddDataSourceL() in")));
+
+    if( iState != EStateNone )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    if (!iMediaRecorder)
+        {
+        iMediaRecorder = CCMRMediaRecorder::NewL();
+        }
+
+    if (aDataSource.DataSourceType()==KUidMmfAudioInput)
+        {
+        iAudioSource = &aDataSource;
+        }
+
+    if ( ReadyToOpenSource() )
+        {
+        OpenSourceL();
+        }
+
+    PRINT((_L("CCamCController::AddDataSourceL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::AddDataSinkL
+// Add data sink to controller.
+// (other items were commented in a header).
+//
+void CCamCController::AddDataSinkL(MDataSink& aDataSink)
+    {
+    PRINT((_L("CCamCController::AddDataSinkL() in")));
+
+    if( iState != EStateNone )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    if (aDataSink.DataSinkType()==KUidMmfFileSink)
+        {
+        iMMFFile = STATIC_CAST(CMMFFile*, &aDataSink);
+        iFileName = iMMFFile->FullName();
+        iForceDataSinkFileName = EFalse;
+
+        if (!iFileComposer)
+            {
+            iFileComposer = CCamC3GPDataSink::NewL(this);
+            }
+
+        if ( ReadyToOpenSource() )
+            {
+            OpenSourceL();
+            }
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    PRINT((_L("CCamCController::AddDataSinkL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::RemoveDataSourceL
+// Remove data source from controller.
+// (other items were commented in a header).
+//
+void CCamCController::RemoveDataSourceL(MDataSource& /*aDataSource*/)
+    {
+    // Not called from Video Recorder client API
+    PRINT((_L("CCamCController::RemoveDataSourceL() Not Supported - leaving")));
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::RemoveDataSinkL
+// Remove data sink from controller.
+// (other items were commented in a header).
+//
+void CCamCController::RemoveDataSinkL(MDataSink& /*aDataSink*/)
+    {
+    // Not called from Video Recorder client API
+    PRINT((_L("CCamCController::RemoveDataSinkL() Not Supported - leaving")));
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::ResetL
+// Reset controller
+// (other items were commented in a header).
+//
+void CCamCController::ResetL()
+    {
+    // Not called from Video Recorder client API
+    PRINT((_L("CCamCController::ResetL() Not Supported - leaving")));
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::PrimeL
+// Primes controller.
+// (other items were commented in a header).
+//
+void CCamCController::PrimeL()
+    {
+    // Preparing to record is handled by MvrcPrepareL
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::PlayL
+// Start recording.
+// (other items were commented in a header).
+//
+void CCamCController::PlayL()
+    {
+    PRINT((_L("CCamCController::PlayL() in")));
+
+    if ( iState == EStateRecording )
+        {
+        return;
+        }
+
+    if ( ( iState != EStatePrepared ) && ( iState != EStatePaused ) )
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    iSavedStopError = KErrNone;
+
+    if ( iState == EStatePrepared )
+        {
+        if ( iFileComposerReady == EFalse ) // to handle record, stop, record (without prepare)
+            {
+            if ( iMediaRecorder->AudioEnabledL() )
+                {
+                iMediaRecorder->GetAudioCodecL(iAudioCodec);
+                }
+            else
+                {
+                iAudioCodec = KFourCCNULL;
+                }
+
+            TInt error = KErrNone;
+            if( iForceDataSinkFileName )
+                {
+                TRAP( error, iFileComposer->OpenFileL( iFileName, iAudioCodec, *iVideoCodec, iVideoFormat ) );
+                }
+            else
+                {
+                TRAP( error, iFileComposer->OpenFileL( iMMFFile, iAudioCodec, *iVideoCodec, iVideoFormat ) );
+                }
+            if ( error != KErrNone )
+                {
+                DoSendEventToClient(TMMFEvent(KMMFEventCategoryPlaybackComplete, error));
+                return;
+                }
+            else
+                {
+                iFileComposerReady = ETrue;
+                }
+            }
+        iMediaRecorder->RecordL();
+        }
+    else
+        {
+        iMediaRecorder->ResumeL();
+        }
+    iState = EStateRecording;
+    PRINT((_L("CCamCController::PlayL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::PauseL
+// Pause recording.
+// (other items were commented in a header).
+//
+void CCamCController::PauseL()
+    {
+    PRINT((_L("CCamCController::PauseL() in")));
+
+    if ( iState != EStateRecording )
+        {
+        User::Leave(KErrNotReady);
+        }
+    iMediaRecorder->PauseL();
+    iState = EStatePaused;
+    PRINT((_L("CCamCController::PauseL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::StopL
+// Stop recording.
+// (other items were commented in a header).
+//
+void CCamCController::StopL()
+    {
+    PRINT((_L("CCamCController::StopL() in")));
+
+    if ( ( iState != EStateRecording ) && ( iState != EStatePaused ) )
+        {
+        PRINT((_L("CCamCController::StopL() out - not recording")));
+        if ( iSavedStopError != KErrNone )
+            {
+            User::Leave( iSavedStopError );
+            }
+        else
+            {
+            return;
+            }
+        }
+
+    iState = EStateStopping;
+    TInt error = KErrNone;
+    TRAP( error, iMediaRecorder->StopL() );
+    if ( error != KErrNone )
+        {
+        PRINT((_L("CCamCController::StopL() MediaRecorderStop error= %d      "), error));
+        iState = EStatePrepared;
+        iFileComposerReady = EFalse;
+        TRAPD( ignored, iFileComposer->SinkStopL() );
+        ignored++; // to remove compile warning. There has already been error, further errors are ignored.
+        if ( !iAsyncStop )
+	        {
+    	    User::Leave( error );
+        	}
+        }
+
+    PRINT((_L("CCamCController::StopL() iAsyncStop=%d      "), iAsyncStop));
+	if ( iAsyncStop )
+		{
+        PRINT((_L("CCamCController::StopL() sending event KCamCControllerCCVideoStoppedUid, error=%d      "), error));
+		DoSendEventToClient(TMMFEvent(KCamCControllerCCVideoRecordStopped, error));
+
+        if ( !iIdleStop->IsActive() )
+            {
+            iIdleStop->Start( TCallBack( IdleStop, this ) );
+            }
+
+		}
+    else // Sync stop
+        {
+        error = KErrNone;
+        TRAP( error, iFileComposer->SinkStopL() );
+        if ( error != KErrNone )
+            {
+            PRINT((_L("CCamCController::StopL() FileComposerStop error= %d      "), error));
+            iState = EStatePrepared;
+            iFileComposerReady = EFalse;
+      	    User::Leave( error );
+            }
+
+    	if ( (iSavedStopError == KErrDiskFull) || (iSavedStopError == KErrCompletion ) || (iSavedStopError == KErrNone) )
+	    	{
+    	    iState = EStatePrepared;
+    		}
+	    else
+		    {
+    		// Fatal error happened, need to prepare again.
+	    	iState = EStateOpen;
+		    }
+        iFileComposerReady = EFalse;
+        }
+
+    PRINT((_L("CCamCController::StopL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::PositionL
+// Returns current recording position.
+// (other items were commented in a header).
+//
+TTimeIntervalMicroSeconds CCamCController::PositionL() const
+    {
+     // Not called from Video Recorder client API
+    return TTimeIntervalMicroSeconds(0);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::SetPositionL
+// Not supported.
+// (other items were commented in a header).
+//
+void CCamCController::SetPositionL(const TTimeIntervalMicroSeconds& /*aPosition*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::DurationL
+// Current duration of recording.
+// (other items were commented in a header).
+//
+TTimeIntervalMicroSeconds CCamCController::DurationL() const
+    {
+    if ( iFileComposer )
+        {
+        return iFileComposer->GetElapsedTime();
+        }
+    else
+        {
+        return TTimeIntervalMicroSeconds(0);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::SetPrioritySettings
+// Set camcorder priority settings.
+// (other items were commented in a header).
+//
+void CCamCController::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
+    {
+    PRINT((_L("CCamCController::SetPrioritySettings() in")));
+    TInt error = KErrNone;
+    iPrioritySettings = aPrioritySettings;
+
+    if ( iState == EStatePrepared )
+        {
+            iState = EStateOpen;
+        }
+
+    if ( iMediaRecorder )
+        {
+        if ( iState != EStateOpen )
+            {
+            error = KErrNotReady;
+            }
+        else
+            {
+            TRAP(error, iMediaRecorder->SetAudioPriorityL( iPrioritySettings ));
+            }
+        }
+
+    if ( error != KErrNone )
+        {
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoRecorderGeneralError, error));
+        }
+
+    PRINT((_L("CCamCController::SetPrioritySettings() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::CustomCommand
+// Handle custom commands to controller.
+// (other items were commented in a header).
+//
+void CCamCController::CustomCommand( TMMFMessage& aMessage )
+    {
+    PRINT((_L("CCamCController::CustomCommand() in")));
+    if ( aMessage.Destination().InterfaceId().iUid != KCamCUidControllerImplementation )
+        {
+        aMessage.Complete(KErrNotSupported);
+        PRINT((_L("CCamCController::CustomCommand() KErrNotSupported out")));
+        return;
+        }
+
+    TInt error = KErrNone;
+    switch ( aMessage.Function() )
+        {
+        case ECamCControllerCCNewFilename:
+            {
+            PRINT((_L("CCamCController::CustomCommand() ECamCControllerCCNewFilename")));
+            TRAP( error, NewFilenameL( aMessage ) );
+            aMessage.Complete(error);
+            break;
+            }
+
+        case ECamCControllerCCVideoStopAsync :
+            {
+            PRINT((_L("CCamCController::CustomCommand() ECamCControllerCCVideoStopAsync")));
+            aMessage.Complete(KErrNone);
+            iAsyncStop = ETrue;
+            TRAPD( ignored, StopL() );
+            ignored++; // to remove compile warning. There has already been error, further errors are ignored.
+            break;
+            }
+        default:
+            {
+            PRINT((_L("CCamCController::CustomCommand() invalid command")));
+            error = KErrNotSupported;
+            aMessage.Complete(error);
+            break;
+            }
+        }
+    PRINT((_L("CCamCController::CustomCommand() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::GetNumberOfMetaDataEntriesL
+// Get number of metadata entries.
+// (other items were commented in a header).
+//
+void CCamCController::GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries)
+    {
+    aNumberOfEntries = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::GetMetaDataEntryL
+// Returns metadata entry.
+// (other items were commented in a header).
+//
+CMMFMetaDataEntry* CCamCController::GetMetaDataEntryL(TInt /*aIndex*/)
+    {
+    User::Leave( KErrNotSupported );
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MmroPrepareComplete
+// Called when mediarecorder has completed prepare command.
+// (other items were commented in a header).
+//
+void CCamCController::MmroPrepareComplete(TInt aError)
+    {
+    PRINT((_L("CCamCController::MmroPrepareComplete() error= %d      "), aError));
+
+    if ( aError == KErrNone )
+        {
+        iState = EStatePrepared;
+        }
+	if ( iFileComposerReady && !iMRPrepareCompleteSent )
+		{
+	    iMRPrepareCompleteSent = ETrue;
+	    DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, aError));
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MmroStateChange
+// Called when mediarecorder has changed state.
+// (other items were commented in a header).
+//
+void CCamCController::MmroStateChange(TInt aState, TInt /*aError*/)
+    {
+    PRINT((_L("CCamCController::MmroStateChange()       ")));
+
+    if ( ( aState == CCMRMediaRecorder::EStateOpen ) &&
+         ( iState == EStatePrepared ) )
+        {
+        iState = EStateOpen;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MmroTemporaryError
+// Called when temporary error happens in mediarecorder.
+// (other items were commented in a header).
+//
+void CCamCController::MmroTemporaryError(TInt /*aError*/)
+    {
+    PRINT((_L("CCamCController::MmroTemporaryError()        ")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MmroFatalError
+// Called when fatal error happens in mediarecorder.
+// (other items were commented in a header).
+//
+void CCamCController::MmroFatalError(TInt aError)
+    {
+    PRINT((_L("CCamCController::MmroFatalError() error=%d       "), aError));
+
+    if ( ( iState == EStateRecording ) || ( iState == EStatePaused ) )
+        {
+        iSavedStopError = aError;
+        TInt error;
+        TRAP( error, StopL() );
+        PRINT(_L("CCamCController::MmroFatalError() Reporting PlaybackComplete"));
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryPlaybackComplete, aError));
+        }
+    else if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        PRINT(_L("CCamCController::MmroFatalError() Reporting VR GeneralError"));
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoRecorderGeneralError, aError));
+        }
+    else
+        {
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MfcoDiskFullL
+// Called when filecomposer runs out of disk space.
+// (other items were commented in a header).
+//
+void CCamCController::MfcoDiskFullL()
+    {
+    PRINT((_L("CCamCController::DiskFullL() in")));
+    if ( ( iState == EStateRecording ) || ( iState == EStatePaused ) )
+        {
+        iSavedStopError = KErrDiskFull;
+        TInt error;
+        TRAP( error, StopL() );
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryPlaybackComplete, KErrDiskFull));
+        }
+    PRINT((_L("CCamCController::DiskFullL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MfcoSizeLimitReachedL
+// Called when filecomposer meets maximum file size.
+// (other items were commented in a header).
+//
+void CCamCController::MfcoSizeLimitReachedL()
+    {
+    PRINT((_L("CCamCController::SizeLimitReachedL() in")));
+    if ( iState != EStateStopping )
+        {
+        iSavedStopError = KErrCompletion;
+        TInt error;
+        TRAP( error, StopL() );
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryPlaybackComplete, KErrCompletion));
+        }
+    PRINT((_L("CCamCController::SizeLimitReachedL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvcGetVideoFrameSizeL
+// Get video frame size.
+// (other items were commented in a header).
+//
+void CCamCController::MvcGetVideoFrameSizeL(TSize& aVideoFrameSize)
+    {
+    if ( iMediaRecorder )
+        {
+        iMediaRecorder->GetVideoFrameSizeL(aVideoFrameSize);
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvcGetAudioCodecL
+// Get audio codec.
+// (other items were commented in a header).
+//
+void CCamCController::MvcGetAudioCodecL(TFourCC& aCodec)
+    {
+    if ( iMediaRecorder )
+        {
+        iMediaRecorder->GetAudioCodecL( aCodec );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvcGetVideoBitRateL
+// Get video bit rate.
+// (other items were commented in a header).
+//
+void CCamCController::MvcGetVideoBitRateL(TInt& aBitRate)
+    {
+    if ( iMediaRecorder )
+        {
+        aBitRate = iMediaRecorder->VideoBitRateL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvcGetAudioBitRateL
+// Get audio bit rate.
+// (other items were commented in a header).
+//
+void CCamCController::MvcGetAudioBitRateL(TInt& aBitRate)
+    {
+    if ( iMediaRecorder )
+        {
+        aBitRate = iMediaRecorder->AudioBitRateL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvcSetFrameRateL
+// Set video frame rate.
+// (other items were commented in a header).
+//
+void CCamCController::MvcSetFrameRateL(TReal32 aFramesPerSecond)
+    {
+    if ( iMediaRecorder )
+        {
+        iMediaRecorder->SetVideoFrameRateL(aFramesPerSecond);
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvcGetFrameRateL
+// Get video frame rate.
+// (other items were commented in a header).
+//
+void CCamCController::MvcGetFrameRateL(TReal32& aFramesPerSecond)
+    {
+    if ( iMediaRecorder )
+        {
+        aFramesPerSecond = iMediaRecorder->VideoFrameRateL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcGetSupportedSinkAudioTypesL
+// Get supported audio sink types.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcGetSupportedSinkAudioTypesL(RArray<TFourCC>& aDataTypes)
+    {
+    if ( iMediaRecorder )
+        {
+        aDataTypes.Reset();
+        iMediaRecorder->GetSupportedAudioCodecsL( aDataTypes );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcGetSupportedSinkVideoTypesL
+// Get supported video sink types.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcGetSupportedSinkVideoTypesL(CDesC8Array& aDataTypes)
+    {
+    if ( iMediaRecorder )
+        {
+        aDataTypes.Reset();
+        iMediaRecorder->GetSupportedVideoCodecsL( aDataTypes );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvcGetVideoMimeTypeL
+// Get video mime type.
+// (other items were commented in a header).
+//
+void CCamCController::MvcGetVideoMimeTypeL(TDes8& aMimeType)
+    {
+    if ( iMediaRecorder )
+        {
+        iMediaRecorder->GetVideoCodecL( aMimeType );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetVideoFormatL
+// Set video format.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetVideoFormatL(TUid aVideoFormatUid)
+    {
+    PRINT((_L("CCamCController::MvrcSetVideoFormatL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( ( aVideoFormatUid.iUid == KCamCUidRecordFormatImplementation ) ||
+         ( aVideoFormatUid == KNullUid ) )
+        {
+        iVideoFormat = CCamC3GPDataSink::E3GPP;
+        }
+    else if ( aVideoFormatUid.iUid == KCamCUid3GPP2FileFormatImplementation )
+        {
+        iVideoFormat = CCamC3GPDataSink::E3GPP2;
+        }
+    else if ( aVideoFormatUid.iUid == KCamCUidMP4FileFormatImplementation )
+        {
+        iVideoFormat = CCamC3GPDataSink::EMPEG4;
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( ReadyToOpenSource() )
+        {
+        OpenSourceL();
+        }
+
+    PRINT((_L("CCamCController::MvrcSetVideoFormatL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetVideoCodecL
+// Set video codec.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetVideoCodecL(const TDesC8& aVideoCodec)
+    {
+    PRINT((_L("CCamCController::MvrcSetVideoCodecL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( ( iState != EStateOpen ) && ( iState != EStateNone ) )
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    if ( iMediaRecorder )
+        {
+        iSupportedVideoTypes->Reset();
+        iMediaRecorder->GetSupportedVideoCodecsL( *iSupportedVideoTypes );
+        }
+    else
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    TBool found = EFalse;
+    if ( aVideoCodec == KNullDesC8 )
+        {
+        iVideoCodec = aVideoCodec.AllocL();
+        found = ETrue;
+        }
+    else
+        {
+        for( TInt i = 0; i < iSupportedVideoTypes->Count(); i++ )
+            {
+            if ( iSupportedVideoTypes->MdcaPoint(i) == aVideoCodec )
+                {
+                if ( iVideoCodec )
+                    {
+                    delete iVideoCodec;
+                    iVideoCodec = NULL;
+                    }
+                iVideoCodec = aVideoCodec.AllocL();
+                found = ETrue;
+                }
+            }
+        }
+
+    if ( !found )
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    if ( iState == EStateOpen )
+        {
+        iMediaRecorder->SetVideoCodecL( *iVideoCodec );
+        }
+    else if ( iState == EStateNone )
+        {
+        if ( ReadyToOpenSource() )
+            {
+            OpenSourceL();
+            }
+        }
+    else
+        {
+        }
+    PRINT((_L("CCamCController::MvrcSetVideoCodecL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetAudioCodecL
+// Set audio codec.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetAudioCodecL(TFourCC aAudioCodec)
+    {
+    PRINT((_L("CCamCController::MvrcSetAudioCodecL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( ( iState != EStateOpen ) && ( iState != EStateNone ) )
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    if ( iMediaRecorder )
+        {
+        iSupportedAudioTypes.Reset();
+        iMediaRecorder->GetSupportedAudioCodecsL( iSupportedAudioTypes );
+        }
+    else
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    TBool found = EFalse;
+    if ( aAudioCodec == KFourCCNULL )
+        {
+        iAudioCodec = aAudioCodec;
+        found = ETrue;
+        }
+    else
+        {
+        for( TInt i = 0; i < iSupportedAudioTypes.Count(); i++ )
+            {
+            if ( iSupportedAudioTypes[i] == aAudioCodec )
+                {
+                iAudioCodec = aAudioCodec;
+                found = ETrue;
+                }
+            }
+        }
+
+    if ( !found )
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    if ( iState == EStateOpen )
+        {
+        iMediaRecorder->SetAudioCodecL( iAudioCodec );
+        }
+    else if ( iState == EStateNone )
+        {
+        if ( ReadyToOpenSource() )
+            {
+            OpenSourceL();
+            }
+        }
+    else
+        {
+        }
+    PRINT((_L("CCamCController::MvrcSetAudioCodecL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetVideoBitRateL
+// Set video bit rate.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetVideoBitRateL(TInt& aBitRate)
+    {
+    PRINT((_L("CCamCController::MvrcSetVideoBitRateL() in")));
+
+    if ( iMediaRecorder )
+        {
+        iMediaRecorder->SetVideoBitRateL(aBitRate);
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    PRINT((_L("CCamCController::MvrcSetVideoBitRateL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetAudioBitRateL
+// Set audio bit rate.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetAudioBitRateL(TInt& aBitRate)
+    {
+    PRINT((_L("CCamCController::MvrcSetAudioBitRateL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( iMediaRecorder )
+        {
+        if ( iState != EStateOpen )
+            {
+            User::Leave(KErrNotReady);
+            }
+        iMediaRecorder->SetAudioBitRateL(aBitRate);
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    PRINT((_L("CCamCController::MvrcSetAudioBitRateL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcAddMetaDataEntryL
+// Add metadata entry.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcAddMetaDataEntryL(const CMMFMetaDataEntry& /*aNewEntry*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcRemoveMetaDataEntryL
+// Remove metadata entry.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcRemoveMetaDataEntryL(TInt /*aIndex*/)
+    {
+    User::Leave(KErrArgument);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcReplaceMetaDataEntryL
+// Replace metadata entry.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcReplaceMetaDataEntryL(TInt /*aIndex*/, const CMMFMetaDataEntry& /*aNewEntry*/)
+    {
+    User::Leave(KErrArgument);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetMaxFileSizeL
+// Set maximum file size.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetMaxFileSizeL(TInt aMaxFileSize )
+    {
+    PRINT((_L("CCamCController::MvrcSetMaxFileSizeL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( iFileComposer )
+        {
+        if ( iState != EStateOpen )
+            {
+            User::Leave(KErrNotReady);
+            }
+
+        // change sizelimit value to follow filecomposer internal handling of maximum file size
+        if ( aMaxFileSize == KMMFNoMaxClipSize )
+            {
+            iFileComposer->SetSizeLimit(0);
+            }
+        else if ( aMaxFileSize < -1 )
+            {
+            User::Leave(KErrArgument);
+            }
+        else
+            {
+            iFileComposer->SetSizeLimit(aMaxFileSize);
+            }
+        }
+    PRINT((_L("CCamCController::MvrcSetMaxFileSizeL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetAudioEnabledL
+// Set audio enabled/disabled.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetAudioEnabledL(TBool aEnable)
+    {
+    PRINT((_L("CCamCController::MvrcSetAudioEnabledL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( iMediaRecorder )
+        {
+        if ( iState != EStateOpen )
+            {
+            User::Leave(KErrNotReady);
+            }
+        iMediaRecorder->SetAudioEnabledL(aEnable);
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    PRINT((_L("CCamCController::MvrcSetAudioEnabledL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetVideoFrameSizeL
+// Set video frame size.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetVideoFrameSizeL(TSize aFrameSize)
+    {
+    PRINT((_L("CCamCController::MvrcSetVideoFrameSizeL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( iMediaRecorder )
+        {
+        if ( iState != EStateOpen )
+            {
+            User::Leave(KErrNotReady);
+            }
+        iMediaRecorder->SetVideoFrameSizeL(aFrameSize);
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    PRINT((_L("CCamCController::MvrcSetVideoFrameSizeL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcPrepareL
+// Prepare camcorder for recording.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcPrepareL()
+    {
+    PRINT((_L("CCamCController::MvrcPrepareL() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, KErrNone));
+        return;
+        }
+
+    if ( iState != EStateOpen )
+        {
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, KErrNotReady));
+        PRINT((_L("CCamCController::MvrcPrepareL() out, not ready")));
+        return;
+        }
+	iFileComposerReady = EFalse;
+    iFileComposer->SinkStopL();
+
+    if ( iMediaRecorder->AudioEnabledL() )
+        {
+        iMediaRecorder->GetAudioCodecL(iAudioCodec);
+        }
+    else
+        {
+        iAudioCodec = KFourCCNULL;
+        }
+
+    TInt error = KErrNone;
+    iMRPrepareCompleteSent = EFalse;
+    TRAP( error, iMediaRecorder->PrepareL() );
+    if ( error != KErrNone )
+        {
+        iMRPrepareCompleteSent = ETrue;
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, error));
+        PRINT((_L("CCamCController::MvrcPrepareL() Mediarecorder error=%d"), error));
+        return;
+        }
+
+    error = KErrNone;
+    if( iForceDataSinkFileName )
+        {
+        TRAP( error, iFileComposer->OpenFileL( iFileName, iAudioCodec, *iVideoCodec, iVideoFormat ) );
+        }
+    else
+        {
+        TRAP( error, iFileComposer->OpenFileL( iMMFFile, iAudioCodec, *iVideoCodec, iVideoFormat ) );
+        }
+    if ( error != KErrNone )
+        {
+        iMRPrepareCompleteSent = ETrue;
+        DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, error));
+        PRINT((_L("CCamCController::MvrcPrepareL() Filecomposer error=%d"), error));
+        return;
+        }
+    else
+        {
+        iFileComposerReady = ETrue;
+        }
+
+    PRINT((_L("CCamCController::MvrcPrepareL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcSetCameraHandleL
+// Set camera handle.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcSetCameraHandleL(TInt aCameraHandle)
+    {
+    PRINT((_L("CCamCController::MvrcSetCameraHandleL() handle=%d        "), aCameraHandle));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    iCameraHandle = aCameraHandle;
+    if ( ReadyToOpenSource() )
+        {
+            OpenSourceL();
+        }
+
+    PRINT((_L("CCamCController::MvrcSetCameraHandleL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcGetRecordTimeAvailableL
+// Returns available recording time.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcGetRecordTimeAvailableL(TTimeIntervalMicroSeconds& aTime)
+    {
+    if ( iFileComposer )
+        {
+        aTime =  iFileComposer->GetRemainingTimeL();
+        }
+    else
+        {
+        aTime = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MvrcGetAudioEnabledL
+// Returns whether audio is enabled.
+// (other items were commented in a header).
+//
+void CCamCController::MvrcGetAudioEnabledL(TBool& aEnabled)
+    {
+    PRINT((_L("CCamCController::MvrcGetAudioEnabledL() in")));
+
+    if (iMediaRecorder)
+        {
+        aEnabled = iMediaRecorder->AudioEnabledL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    PRINT((_L("CCamCController::MvrcGetAudioEnabledL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MardSetGainL
+// Set gain.
+// (other items were commented in a header).
+//
+void CCamCController::MardSetGainL(TInt aGain)
+    {
+    PRINT((_L("CCamCController::MardSetGainL() in")));
+
+    if ( iMediaRecorder )
+        {
+        iMediaRecorder->SetGainL(aGain);
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    PRINT((_L("CCamCController::MardSetGainL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MardGetMaxGainL
+// Get maximum gain.
+// (other items were commented in a header).
+//
+void CCamCController::MardGetMaxGainL(TInt& aMaxGain)
+    {
+    if ( iMediaRecorder )
+        {
+        aMaxGain = iMediaRecorder->MaxGainL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MardGetGainL
+// Get gain.
+// (other items were commented in a header).
+//
+void CCamCController::MardGetGainL(TInt& aGain)
+    {
+    if (iMediaRecorder)
+        {
+        aGain = iMediaRecorder->GainL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MardSetBalanceL
+// Set balance. Not supported.
+// (other items were commented in a header).
+//
+void CCamCController::MardSetBalanceL(TInt /*aBalance*/)
+    {
+    // Not called from Video Recorder client API
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::MardGetBalanceL
+// Get balance. Not supported.
+// (other items were commented in a header).
+//
+void CCamCController::MardGetBalanceL(TInt& /*aBalance*/)
+    {
+    // Not called from Video Recorder client API
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::NewFilename
+// Handle custom commands NewFilename to controller.
+// (other items were commented in a header).
+//
+void CCamCController::NewFilenameL( TMMFMessage& aMessage )
+    {
+    PRINT((_L("CCamCController::NewFilename() in")));
+
+    if ( iState == EStatePrepared )
+        {
+        iState = EStateOpen;
+        }
+
+    if ( ( iState != EStateOpen ) && ( iState != EStateNone ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    // Get the size of the init data and create a buffer to hold it
+    TInt desLength = aMessage.SizeOfData1FromClient();
+    HBufC8* buf = HBufC8::NewLC(desLength);
+    TPtr8 ptr = buf->Des();
+    aMessage.ReadData1FromClientL(ptr);
+
+    TMMFFileParams params;
+    TPckgC<TMMFFileParams> config(params);
+    config.Set(*buf);
+    params = config();
+
+    TParse parser ;
+    User::LeaveIfError(parser.Set(params.iPath, NULL, NULL));
+    CleanupStack::PopAndDestroy(buf);//buf
+
+    iFileName.Copy( parser.FullName() );
+    iForceDataSinkFileName = ETrue;
+
+    PRINT((_L("CCamCController::NewFilename() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::ReadyToOpenSource
+// Check if controller is ready to open mediarecorder and filecomposer
+// (other items were commented in a header).
+//
+TBool CCamCController::ReadyToOpenSource()
+    {
+    PRINT((_L("CCamCController::ReadyToOpenSource() in")));
+
+    if ( ( iState == EStateNone ) &&
+         ( iVideoCodec != 0 ) &&
+         ( iAudioCodec != 0 ) &&
+         ( iCameraHandle >= 0 ) &&
+         ( iMediaRecorder ) &&
+         ( iFileComposer ) )
+        {
+        PRINT((_L("CCamCController::ReadyToOpenSource() out, ready")));
+        return ETrue;
+        }
+    PRINT((_L("CCamCController::ReadyToOpenSource() out, not ready")));
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCController::OpenSourceL
+// Open mediarecorder adn filecomposer.
+// (other items were commented in a header).
+//
+void CCamCController::OpenSourceL()
+    {
+    PRINT((_L("CCamCController::OpenSourceL() in")));
+
+    TInt error = KErrNone;
+    TRAP( error, iMediaRecorder->OpenL(this, iAudioSource, STATIC_CAST(MCMRMediaSink* , iFileComposer), iCameraHandle, *iVideoCodec, iAudioCodec ) );
+    if ( error == KErrNone )
+        {
+        iState = EStateOpen;
+        TRAP( error, iMediaRecorder->SetAudioPriorityL( iPrioritySettings ) );
+        }
+    DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoOpenComplete, error));
+    PRINT((_L("CCamCController::OpenSourceL() out")));
+    }
+
+// ---------------------------------------------------------------------------
+// CCamCController::IdleStop
+// ---------------------------------------------------------------------------
+//
+TInt CCamCController::IdleStop( TAny* aCont )
+    {
+    CCamCController* appCont = static_cast<CCamCController*>( aCont );
+    appCont->DoIdleStop();
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCamCController::DoIdleStop
+// ---------------------------------------------------------------------------
+//
+void CCamCController::DoIdleStop()
+    {
+    PRINT((_L("CCamCController::DoIdleStop() in")));
+    TInt error = KErrNone;
+
+    TRAP( error, iFileComposer->SinkStopL() );
+    if ( error != KErrNone )
+        {
+        PRINT((_L("CCamCController::DoIdleStop() FileComposerStop error= %d      "), error));
+        iState = EStatePrepared;
+        iFileComposerReady = EFalse;
+        }
+
+    PRINT((_L("CCamCController::DoIdleStop() sending event KCamCControllerCCVideoCompletedUid, error=%d      "), error));
+    DoSendEventToClient(TMMFEvent(KCamCControllerCCVideoFileComposed, error));
+
+	if ( (iSavedStopError == KErrDiskFull) || (iSavedStopError == KErrCompletion ) || (iSavedStopError == KErrNone) )
+		{
+    	iState = EStatePrepared;
+		}
+	else
+		{
+		// Fatal error happened, need to prepare again.
+		iState = EStateOpen;
+		}
+    iFileComposerReady = EFalse;
+    iAsyncStop = EFalse;
+    PRINT((_L("CCamCController::DoIdleStop() out")));
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/controller/Src/CamCControllerFactory.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin DLL entry point and implementation table
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamCImplementationUIDs.hrh"
+#include "CamCController.h"
+
+// CONSTANTS
+// -----------------------------------------------------------------------------
+// ImplementationTable
+// Exported proxy for instantiation method resolution.
+// -----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    	IMPLEMENTATION_PROXY_ENTRY(KCamCUidControllerImplementation, CCamCController::NewL)
+    };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy 
+// Returns implementation table and count to ECOM
+// Returns: ImplementationTable: pointer to implementation table
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount)  // reference used to return implementation count
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/Bmarm/CAMC3GPSINKU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	NewL__16CCamC3GPDataSinkP20M3GPDataSinkObserver @ 1 NONAME R3UNUSED ; CCamC3GPDataSink::NewL(M3GPDataSinkObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/Bwins/CAMC3GPSINKU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CCamC3GPDataSink@@SAPAV1@PAVM3GPDataSinkObserver@@@Z @ 1 NONAME ; class CCamC3GPDataSink * CCamC3GPDataSink::NewL(class M3GPDataSinkObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/EABI/camc3gpsinkU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,2 @@
+EXPORTS
+	_ZN16CCamC3GPDataSink4NewLEP20M3GPDataSinkObserver @ 1 NONAME
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/Group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CamcorderMMFPlugin Filecomposer build info
+*
+*/
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables. Note that you should specify any .mmp files for test
+// programs further down the file.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released to the rest of the company
+// specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+
+./CamC3GPDataSink.mmp
+
+// Separate MMP files for creating *.LIBs
+./CamC3GPDataSinkLib.mmp
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/Group/camc3GPDataSink.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  3GP file composer MMP file
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+NOEXPORTLIBRARY
+
+TARGET          camc3gpsink.dll
+TARGETTYPE      DLL
+UID             0x1000008d 0x101F8505	//KSharedLibraryUid
+
+VENDORID        VID_DEFAULT
+CAPABILITY 		CAP_GENERAL_DLL
+
+SOURCEPATH      ../Src
+SOURCE          CamC3GPDataSinkImp.cpp
+
+USERINCLUDE     ../Inc
+USERINCLUDE     ../../mediarecorder/Inc
+USERINCLUDE	    ../../../inc   // ADo level inc dir
+
+// Default system include paths for application layer modules.
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE	/epoc32/include/libc
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         estlib.lib
+LIBRARY         3GPMP4Lib.lib
+LIBRARY	        centralrepository.lib
+LIBRARY         mmfcontrollerframework.lib
+LIBRARY	        ecom.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/Group/camc3GPDataSinkLib.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  3GP file composer MMP file
+*
+*/
+
+
+TARGET          camc3gpsink.lib
+TARGETTYPE      IMPLIB
+UID             0x1000008d 0x101F8505	//KSharedLibraryUid
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/Inc/CamC3GPDataSinkImp.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,404 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  3GP data sink implementation class
+*
+*/
+
+
+#ifndef __CAMC3GPDATASINKIMP_H__
+#define __CAMC3GPDATASINKIMP_H__
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32std.h>
+#include <f32file.h>
+#include <3gplibrary/mp4lib.h>
+#include <mmf/common/mmffourcc.h>
+
+#include "CCMRMediaSink.h"
+#include "CamC3GPDataSink.h"
+
+// FORWARD DECLARATIONS
+class CMMFFile;
+
+// CLASS DECLARATION
+
+/**
+*  CCamC3GPDataSinkImp class.
+*  This class implements the 3GP data sink methods.
+*
+*  @lib camc3gpsink
+*  @since 2.1
+*/
+class CCamC3GPDataSinkImp : public CCamC3GPDataSink, public M3GPMP4LibAsyncTempFileRemoverObserver
+    {
+    public: // Methods called internally or by the controller
+
+        /**
+        * Default constructor.
+        */
+        CCamC3GPDataSinkImp() : CCamC3GPDataSink() {};
+
+        /**
+        * Destructor.
+        */
+		~CCamC3GPDataSinkImp(void);
+
+        /**
+        * Constructor.
+        */
+    	void ConstructL(M3GPDataSinkObserver *aObserver);
+
+        /**
+        * Open a file for writing.
+        * @since 2.1
+        * @param aFileName File name
+        * @param aAudioCodecType Four CC code of the used audio codec
+        * @param aVideoCodecType Four CC code of the used video codec
+        * @param aFileFormat Used file format TCamCSinkFileFormat
+        * @return No return value
+        */
+        void OpenFileL(TFileName aFileName, TFourCC aAudioCodecType, const TDesC8& aVideoCodecType, TCamCSinkFileFormat aFileFormat );
+
+        /**
+        * Open a 3GP file for writing.
+        * @since 3.2
+        * @param aMMFFile CMMFFile from MMF
+        * @param aAudioCodecType Four CC code of the used audio codec
+        * @param aVideoCodecType Four CC code of the used video codec
+        * @param aFileFormat Used file format TCamCSinkFileFormat
+        * @return No return value
+        */
+        void OpenFileL(CMMFFile* aMMFFile, TFourCC aAudioCodecType, const TDesC8& aVideoCodecType, TCamCSinkFileFormat aFileFormat );
+
+        /**
+        * Order the sink to finalize and close the current 3GP file.
+        * @since 2.1
+        * @param None
+        * @return No return value
+        */
+        void SinkStopL();
+
+        /**
+        * Set size limit of the 3GP file to be recorded in bytes.
+        * @since 2.1
+        * @param aSize Limit
+        * @return No return value
+        */
+        void SetSizeLimit(TUint aSize);
+
+        /**
+        * Return the amount of time recording has been on in microseconds.
+        * @since 2.1
+        * @param None
+        * @return Elapsed time
+        */
+        TTimeIntervalMicroSeconds GetElapsedTime();
+
+        /**
+        * Return the estimated remaining time for the recording in microseconds.
+        * @since 2.1
+        * @param None
+        * @return Remaining time
+        */
+        TTimeIntervalMicroSeconds GetRemainingTimeL();
+
+
+    public: // Methods called from MCMRMediaSink
+
+        /**
+        * Give video frame size to sink.
+        * @since 2.1
+        * @param aSize Frame size
+        * @return Error code
+        */
+        TInt SetVideoFrameSize(TSize aSize);
+
+        /**
+        * Give average video bitrate to sink.
+        * @since 2.1
+        * @param aBitRate Average bitrate
+        * @return Error code
+        */
+        TInt SetAverageVideoBitRate(TInt aBitRate);
+
+        /**
+        * Give maximum video bitrate to sink.
+        * @since 2.1
+        * @param aBitRate Maximum bitrate
+        * @return Error code
+        */
+        TInt SetMaxVideoBitRate(TInt aBitRate);
+
+        /**
+        * Give average audio bitrate to sink.
+        * @since 2.1
+        * @param aBitRate Average bitrate
+        * @return Error code
+        */
+        TInt SetAverageAudioBitRate(TInt aBitRate);
+
+        /**
+        * Write an audio/video buffer to the sink.
+        * @since 2.1
+        * @param aBuffer Buffer containing audio/video data
+        * @return Errorcode
+        */
+        void WriteBufferL(CCMRMediaBuffer* aBuffer);
+
+
+    public: // Methods from M3GPMP4LibAsyncTempFileRemoverObserver
+        void M3GPMP4LibDeleteTempFileName( MP4FileName tempFileName );
+
+    private: // Private methods
+
+        /**
+        * Estimate current file size
+        * @since 2.1
+        * @param None
+        * @return File size
+        */
+        TUint CurrentFileSize() const;
+
+        /**
+        * Estimate current metadata size
+        * @since 2.1
+        * @param None
+        * @return File size
+        */
+        TUint CurrentMetadataSize() const;
+
+        /**
+        * Calculate free space on a drive in bytes.
+        * @since 2.1
+        * @param None
+        * @return File size
+        */
+        TInt64 DriveFreeSpaceL();
+
+        /**
+        * Determines AAC audio frame duration.
+        * @since 2.8
+        * @param Incoming buffer with audio dec spec info
+        * @return None
+        */
+        void DetermineAACFrameDurationL(CCMRMediaBuffer* aBuffer);
+
+        /**
+        * Convert AVC specific decoder config info from NAL (GenericPayload) encapsulation to
+        * AVC Decoder Configuration Record -format
+        * @since 3.2
+        * @param Source buffer with AVC specific decoder config info.
+        * @param Destination buffer to write AVC Decoder Configuration Record.
+        * @return None
+        */
+        void ConvertAVCHeaderNALL( CCMRMediaBuffer* aBuffer, TDes8& aDstBuf );
+
+        /**
+        * Convert AVC specific decoder config info from Bytestream (ElementaryStream) encapsulation to
+        * AVC Decoder Configuration Record -format
+        * @since 3.2
+        * @param Source buffer with AVC specific decoder config info.
+        * @param Destination buffer to write AVC Decoder Configuration Record.
+        * @return None
+        */
+        void ConvertAVCHeaderByteStreamL( CCMRMediaBuffer* aBuffer, TDes8& aDstBuf );
+
+        /**
+        * Converts AVC frame from Bytestream (ElementaryStream) encapsulation to
+        * file format AVC sample structure by replacing bytestream headers with NAL unit sizes.
+        * @since 5.0
+        * @param Source buffer with one or more bytestream header seperated NAL units.
+        * @return None
+        */
+        void ConvertBytestreamHeadersToNALSizes( CCMRMediaBuffer* aBuffer );
+
+        /**
+        * Converts AVC frame from NAL (EGenericPayload) encapsulation to
+        * file format AVC sample structure by replacing NAL encapsulation with NAL unit sizes.
+        * @since 5.0
+        * @param Source buffer with one or more NAL header seperated NAL units.
+        * @param Destination buffer to write NAL units with length information.
+        * @param Destination buffer size.
+        * @return None
+        */
+        void ConvertNALEncapsulationToNALSizes( CCMRMediaBuffer* aBuffer );
+
+    private:
+
+        static TInt IdleDelete( TAny* aCont );
+
+    public:
+
+        TInt DoIdleDelete();
+
+    private:
+
+        // Observer to inform controller
+        M3GPDataSinkObserver *iObserver;
+
+        // 3GP library handle
+        MP4Handle   iMP4Handle;
+
+        // Number of bytes received from media recorder
+        TUint       iBytesReceived;
+
+        // Number of bytes of metadata currently accumulated
+        TUint       iBytesOfMetadata;
+
+        // Horizontal resolution of video
+        TInt        iVideoXResolution;
+
+        // Vertical resolution of video
+        TInt        iVideoYResolution;
+
+        // Average bitrate of video
+        TInt        iVideoAverageBitRate;
+
+        // Maximum bitrate of video
+        TInt        iVideoMaxBitRate;
+
+        // Average bitrate of audio
+        TInt        iAudioAverageBitRate;
+
+        // Type of buffer coming from media recorder
+        CCMRMediaBuffer::TBufferType iBufferType;
+
+        // Size of buffer coming from media recorder
+        TInt        iBufferSize;
+
+        // Types of codecs used in the output file
+        TUint       iFileCodecType;
+
+        // Timestamp of video frame coming from media recorder
+        TTimeIntervalMicroSeconds   iVideoTimestamp;
+
+        // Timestamp of video frame buffered in the sink
+        TTimeIntervalMicroSeconds   iVideoBufferTimestamp;
+
+        // Timestamp of the first video frame
+        TTimeIntervalMicroSeconds   iFirstVideoFrameTimestamp;
+
+        // Duration of the video frame buffered in the sink
+        TUint       iVideoFrameDuration;
+
+        // Is current video frame a random access point
+        TBool       iVideoRandomAccessPoint;
+
+        // Is the buffered video frame a random access point
+        TBool       iVideoBufferRandomAccessPoint;
+
+        // Sink buffers one video frame in this buffer
+        TUint8*     iVideoBuffer;
+
+        // Size of buffered video frame
+        TUint       iVideoBufferFrameSize;
+
+        // Size of video buffer
+        TUint       iVideoBufferSize;
+
+        // Number of video frames
+        TUint       iVideoFrameNumber;
+
+        // Number of intra video frames
+        TUint       iVideoIntraFrameNumber;
+
+        // Video decoder specific info size
+        TInt        iVideoDecSpecInfoSize;
+
+        // Audio decoder specific info size
+        TInt        iAudioDecSpecInfoSize;
+
+        // Sink buffers audio frames in this buffer
+        TUint8*     iAudioBuffer;
+
+        // Size of buffered audio frames
+        TUint       iAudioBufferFrameSize;
+
+        // Size of audio buffer
+        TUint       iAudioBufferSize;
+
+        // Number of audio frames
+        TUint       iAudioFrameNumber;
+
+        // Number of audio frames in the buffer
+        TUint       iAudioFramesInBuffer;
+
+        // Size limit of the file in bytes
+        TInt64       iSizeLimit;
+
+        // Has file size limit bee reached?
+        TBool       iFileSizeLimitReached;
+
+        // File server session handle
+        RFs*        iFS;
+
+        // Drive number of the output file
+        TInt        iDriveNumber;
+
+        // Has the disk been filled to the safety limit?
+        TBool       iDiskFull;
+
+        // Output filename
+        TFileName   iFileName;
+
+        // Temporary filename
+        TFileName   iTmpFileName;
+
+        // MMF resource to acquire file handle
+        CMMFFile* iMMFFile;
+
+        // File handle from MMF
+        RFile * iFile;
+
+        // Used to determine whether file handles or descriptors are used
+        TBool iFileHandleExists;
+
+        // Amount of remaining recording time
+        TTimeIntervalMicroSeconds   iRemainingTime;
+
+        // Remaining free disk space
+        TInt64      iFreeDiskSpace;
+
+        // Counter to check the real free disk space
+        TInt        iFreeDiskSpaceCounter;
+
+        // Available space on disk at start of recording
+        TInt64  iAvailableSpaceAtStart;
+
+        // Avarage of end time
+        TTimeIntervalMicroSeconds  iAvarageEndTime;
+
+        // Duration of AAC frame
+        TInt iAudioAACFrameDuration;
+
+        // AAC Audio Samplerate
+        TInt iAudioAACSamplerate;
+
+        // AVC video level id
+        TInt iAVCOutputLevel;
+
+        // Critical level for current target disk
+        TInt iCriticalDiskVal;
+
+        // File name queue for the temporary meta data files to be deleted.
+        RPointerArray<MP4FileName>* iDeleteFileQueue;
+
+        // Async file deletion on background
+        CIdle* iIdleDelete;
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/filecomposer/Src/CamC3GPDataSinkImp.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,2301 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  3GP file composer
+*
+*/
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <mmf/server/mmffile.h>
+#include <sysutildomaincrkeys.h>	// for critical disk level CentralRepository keys
+#include <3gplibrary/mp4lib.h>
+#include "CamC3GPDataSink.h"
+#include "CamC3GPDataSinkImp.h"
+#include "CCMRMediaSink.h"
+#include "CCMRSupportedCodecs.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/unistd.h>
+
+// MACROS
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// CONSTANTS
+const TUint   KVideoAverageBitRate   = 48000;     // Default average bitrate for video
+const TUint   KVideoMaxBitRate       = 64000;     // Default maximum bitrate for video
+const TUint   KVideoXResolution      = 176;       // Default width of video
+const TUint   KVideoYResolution      = 144;       // Default height of video
+const TUint   KVideoBufferSize       = 8192;      // Maximum video frame size
+const TUint   KAudioMaxFrameSize     = 32;        // Maximum AMR audio frame size
+const TUint   KAudioBufferNumber     = 10;        // Number of audio frames to be buffered
+const TUint   KVideoTimeScale        = 30000;     // Video timescale in the output file; use 30000 since it corresponds roughly to ~30 fps.
+                                                  // 29970 would be exact for H.263, but it may not be exactly camera's baseframerate. And it may be harder for some players than 30000
+                                                  // The most important is now that this value is in the same scale as used in MediaRecorder for Camera API framerate.
+                                                  // If that is 15, then this should be 30000. But some other, e.g. 14.985 fps is used there, then it is better to change this one too.
+const TUint   KAudioTimeScale        = 8000;      // Audio timescale in the output file, safer to use the same value as sampling rate although makes the times more difficult to understand
+const TUint   KAudioFrameDuration    = 8*20;      // AMR frame is 20 ms, but timescale is 8000 => duration is 160 / 8000 s
+const TUint8  KAMRAudioFramesPerSample  = 10;     // Number of AMR audio frames per sample in the output file
+const TUint8  KAACAudioFramesPerSample  = 1;      // Number of AAC audio frames per sample in the output file
+const TUint   KAACDefaultSampleRate  = 16000;     // Default samplerate for AAC that is used as audio track timescale in case we get no audiobuffers, but audio codec is selected.
+const TUint16 KAudioModeSet          = 0x81ff;    // AMR modeset: all modes possible
+const TUint   KDiskSafetyLimit       = 400000;    // Amount of free disk space to leave unused
+const TReal   KMetaDataCoeff         = 1.03;      // Coefficient to estimate metadata amount
+const TInt    KFreeDiskSpaceCounter  = 10;        // Interval when to find out real free disk space
+const TUint   KFTYPSize              = 24;        // Size of FTYP box in bytes in 3GP files
+const TUint   KCamCMaxClipDurationInSecs = 5400;  // Maximun video clip duration in seconds
+const TInt    KLimitForLargeFileBuffers = 100000; // Bitrate limit to toggle to larger output file buffers in composer.
+const TInt    KDelayUseBitrates      = 3000000;   // Delay used in GetRemainingTime until function uses real file sizes instead of avarage bitrates.
+const TInt    KCamC3GPDeleteFileQueueGranularity  = 10; // Optimal value is the number of temporary files
+const TUint32 KCamC3GPMaximumFileSize = 4294967295UL; // max size for RFile
+
+_LIT(KTmpFileName, "\\system\\Temp\\CamcorderTMP");               // Temporary output file name
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSink::NewL
+//
+// Sink constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCamC3GPDataSink* CCamC3GPDataSink::NewL(M3GPDataSinkObserver *aObserver)
+    {
+	CCamC3GPDataSinkImp* self = new (ELeave) CCamC3GPDataSinkImp();
+	CleanupStack::PushL(self);
+	self->ConstructL(aObserver);
+	CleanupStack::Pop();
+	return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::~CCamC3GPDataSinkImp
+//
+// Sink destructor.
+// -----------------------------------------------------------------------------
+//
+CCamC3GPDataSinkImp::~CCamC3GPDataSinkImp(void)
+    {
+    PRINT(_L("CCamC3GPDataSinkImp::~CCamC3GPDataSinkImp enter"));
+    delete [] iVideoBuffer;
+    delete [] iAudioBuffer;
+
+    if ( iFileName != KNullDesC )
+        {
+        // we need to try to stop sink
+        TInt error = KErrNone;
+        TRAP(error, SinkStopL());
+        iFileName = KNullDesC;
+        }
+
+    if (iMP4Handle)
+        {
+        MP4ComposeClose(iMP4Handle);
+        iMP4Handle = NULL;
+        }
+
+    if (iFS)
+        {
+        iFS->Delete(iTmpFileName);
+        iFS->Close();
+        delete iFS;
+        iFS = NULL;
+        }
+
+    iObserver = NULL;
+    iMMFFile = NULL; // not owned
+    iFile = NULL; // not owned
+
+    // Delete the CIdle async file remover object
+    delete iIdleDelete;
+    iIdleDelete = 0;
+
+    // Do async temp file deletion for rest of files
+    if ( iDeleteFileQueue )
+        {
+        // Reset and destroy the file name pointers from queue (if any left).
+        iDeleteFileQueue->ResetAndDestroy();
+        }
+    delete iDeleteFileQueue;
+    iDeleteFileQueue = 0;
+    PRINT(_L("CCamC3GPDataSinkImp::~CCamC3GPDataSinkImp exit"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::ConstructL
+//
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::ConstructL(M3GPDataSinkObserver *aObserver)
+	{
+    PRINT(_L("CCamC3GPDataSinkImp::ConstructL enter"));
+    iObserver = aObserver;
+
+    iVideoBuffer = new (ELeave) TUint8[KVideoBufferSize];
+    iVideoBufferSize = KVideoBufferSize;
+
+    iAudioBuffer = new (ELeave) TUint8[KAudioMaxFrameSize * KAudioBufferNumber];
+    iAudioBufferSize = KAudioMaxFrameSize * KAudioBufferNumber;
+
+    iMP4Handle = NULL;
+    iMMFFile = NULL;
+
+    iFileName = KNullDesC;
+
+    iBytesReceived = 0;
+    iBytesOfMetadata = 0;
+
+    iVideoXResolution = 0;
+    iVideoYResolution = 0;
+    iVideoAverageBitRate = -1;
+    iVideoMaxBitRate = -1;
+    iAudioAverageBitRate = -1;
+
+    iBufferSize = 0;
+    iFileCodecType = MP4_TYPE_NONE;
+    iVideoTimestamp = 0;
+    iVideoBufferTimestamp = -1;
+    iFirstVideoFrameTimestamp = 0;
+    iVideoRandomAccessPoint = EFalse;
+    iVideoBufferRandomAccessPoint = EFalse;
+    iVideoFrameDuration = 0;
+    iVideoBufferFrameSize = 0;
+    iVideoFrameNumber = 0;
+    iVideoIntraFrameNumber = 0;
+    iVideoDecSpecInfoSize = 0;
+    iAudioDecSpecInfoSize = 0;
+    iAudioBufferFrameSize = 0;
+    iAudioFrameNumber = 0;
+    iAudioFramesInBuffer = 0;
+    iFreeDiskSpace = 0;
+    iFreeDiskSpaceCounter = 0;
+    iAvailableSpaceAtStart = 0;
+    iAvarageEndTime = -1;
+    iAudioAACFrameDuration = 0;
+    iAudioAACSamplerate = 0;
+    iAVCOutputLevel = 10;
+    iCriticalDiskVal = 0;
+
+    iSizeLimit = KCamC3GPMaximumFileSize; // max size for RFile
+    iFileSizeLimitReached = EFalse;
+    iDiskFull = EFalse;
+    iFS = NULL;
+
+    iDeleteFileQueue = new( ELeave ) RPointerArray<MP4FileName>( KCamC3GPDeleteFileQueueGranularity );
+
+    // Idle priority Active object for async video temp file deletion
+    iIdleDelete = CIdle::NewL( CActive::EPriorityIdle );
+
+    PRINT(_L("CCamC3GPDataSinkImp::ConstructL exit"));
+	}
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::OpenFileL
+//
+// Opens a 3GP file for writing.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::OpenFileL(CMMFFile* aMMFFile, TFourCC aAudioCodecType, const TDesC8& aVideoCodecType, TCamCSinkFileFormat aFileFormat )
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL CMMFFile enter")));
+
+    TFileName aFileName;
+    iMMFFile = aMMFFile;
+    aFileName = iMMFFile->FullName();
+
+    OpenFileL(aFileName, aAudioCodecType, aVideoCodecType, aFileFormat);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::OpenFileL
+//
+// Opens a 3GP file for writing.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::OpenFileL(TFileName aFileName, TFourCC aAudioCodecType, const TDesC8& aVideoCodecType, TCamCSinkFileFormat aFileFormat)
+    {
+    MP4Err    error;
+
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL TFileName enter")));
+
+    if (iMP4Handle)
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iVideoBufferTimestamp = -1;     // reset duration information for new file
+    iFirstVideoFrameTimestamp = 0;
+    iAvailableSpaceAtStart = 0;
+    iAvarageEndTime = -1;
+    iVideoFrameNumber = 0;
+    iVideoIntraFrameNumber = 0;
+    iBytesReceived = 0;
+    iAudioAACFrameDuration = 0;
+    iAudioAACSamplerate = 0;
+    iFileHandleExists = EFalse;
+
+    iDiskFull = EFalse;
+    iTmpFileName = KTmpFileName;
+    iFileName = aFileName;
+    TInt errorcode;
+
+    if (!iFS) // Don't allocate new file server, if there is one already
+        {
+        iFS = new (ELeave) RFs;
+
+        errorcode = iFS->Connect();
+        if ( errorcode != KErrNone)
+            {
+            delete(iFS);
+            iFS = NULL;
+            User::Leave( errorcode );
+            }
+        }
+
+    TParse fp;
+    User::LeaveIfError(iFS->Parse(iFileName, fp));
+    TPtrC driveletter = fp.Drive();
+    TChar drl = driveletter[0];
+    User::LeaveIfError(iFS->CharToDrive(drl, iDriveNumber));
+
+    // Get critical level for this drive type
+    TDriveInfo driveInfo;
+    iFS->Drive(driveInfo, iDriveNumber);
+
+    iCriticalDiskVal = 0;
+	if ( driveInfo.iType == EMediaRam ) // RAM drives have different critical levent than others
+		{
+		PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Asking disk critical level, memtype: EMediaRam")));
+		CRepository* repository = CRepository::NewLC( KCRUidDiskLevel );
+		User::LeaveIfError( repository->Get( KRamDiskCriticalLevel, iCriticalDiskVal ) );
+		PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Got disk critical level: %d"),iCriticalDiskVal ));
+		CleanupStack::PopAndDestroy( repository );
+		}
+	else // Some other media type
+		{
+		PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Asking disk critical level, memtype: other")));
+		CRepository* repository = CRepository::NewLC( KCRUidDiskLevel );
+		User::LeaveIfError( repository->Get( KDiskCriticalThreshold, iCriticalDiskVal ) );
+		PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Got disk critical level: %d"),iCriticalDiskVal ));
+		CleanupStack::PopAndDestroy( repository );
+		}
+
+    errorcode = iFS->MkDirAll(fp.DriveAndPath());
+    if ( (errorcode != KErrAlreadyExists ) && ( errorcode != KErrNone ) )
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Error creating output path: '%s', error: %d"), fp.DriveAndPath().Ptr(), errorcode ));
+        User::Leave(errorcode);
+        }
+
+    errorcode = iFS->SetAtt( iFileName, KEntryAttNormal, KEntryAttReadOnly );
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Deleting File: '%s'"), iFileName.Ptr()));
+    errorcode = iFS->Delete(iFileName);
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Deleting File Error: %d"), errorcode));
+
+    if ( errorcode == KErrInUse && iMMFFile )
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL using rfiles")));
+        iMMFFile->SinkPrimeL();
+        iFile = &(iMMFFile->FileL());
+        iFileHandleExists = ETrue;
+        }
+    else if ( ( errorcode != KErrNone ) && ( errorcode != KErrNotFound ) && ( errorcode != KErrPathNotFound ) )
+        {
+        User::Leave(errorcode);
+        }
+
+    iTmpFileName.Insert(0, fp.Drive());
+    errorcode = iFS->SetAtt( iTmpFileName, KEntryAttNormal, KEntryAttReadOnly );
+    errorcode = iFS->Delete(iTmpFileName);
+    if ( ( errorcode != KErrNone ) && ( errorcode != KErrNotFound ) && ( errorcode != KErrPathNotFound ) )
+    	{
+        if ( errorcode == KErrInUse )
+        	{
+        	// use actual output filename incase other instance still running with temporary file.
+            PRINT((_L("CCamC3GPDataSinkImp::OpenFileL temporary output file in use (-14). Using actual output filename instead.")));
+        	iTmpFileName = aFileName;
+            errorcode = iFS->SetAtt( iTmpFileName, KEntryAttNormal, KEntryAttReadOnly );
+            errorcode = iFS->Delete(iTmpFileName);
+            if ( ( errorcode != KErrNone ) && ( errorcode != KErrNotFound ) && ( errorcode != KErrPathNotFound ) )
+            	{
+            	User::Leave(errorcode);
+            	}
+        	}
+        else
+        	{
+        	User::Leave(errorcode);
+        	}
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Temp files cleared")));
+
+    // Find used audio codec
+    if ( ( aAudioCodecType == TFourCC(KCMRFourCCIdAMRNB) ) ) // AMR-NB
+        {
+        iFileCodecType |= MP4_TYPE_AMR_NB;
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Audio codec: AMR-NB")));
+        }
+    else if ( aAudioCodecType == TFourCC(KCMRFourCCIdMPEG4AAC) ) // AAC
+        {
+        iFileCodecType |= MP4_TYPE_MPEG4_AUDIO;
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Audio codec: AAC")));
+        }
+    else
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Audio codec: none")));
+        // if audio codec is null we don't generate audiotrack to composed file.
+        }
+
+    // Find used video codec
+    mp4_u8 videoLevel = 10;
+
+    if ( aVideoCodecType == KNullDesC8 ) // No video codec set.
+        {
+        // filecomposer will always create videotrack, whether we get video frames or not.
+        iFileCodecType |= MP4_TYPE_H263_PROFILE_0;
+        }
+    else
+        {
+        TBuf8<256> matchstring;
+        matchstring = KCMRMimeTypeH263;
+        matchstring += _L8( "*" );
+
+        if ( ( aVideoCodecType.MatchF( matchstring ) != KErrNotFound ) ) // H.263
+            {
+            matchstring = KCMRMimeTypeH263Profile3;
+            matchstring += _L8( "*" );
+
+            if ( aVideoCodecType.MatchF( matchstring ) != KErrNotFound )
+                {
+                iFileCodecType |= MP4_TYPE_H263_PROFILE_3;   // H.263 profile 3
+                PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 profile 3")));
+                }
+            else
+                {
+                iFileCodecType |= MP4_TYPE_H263_PROFILE_0;   // H.263 profile 0
+                PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 profile 0")));
+                }
+            // check if level is indicated too
+            matchstring = _L8("*level=*");
+            if (aVideoCodecType.MatchF( matchstring ) != KErrNotFound )
+                {
+                // yes, there is, check what it is
+                if ( aVideoCodecType.MatchF( _L8("*level=10*") ) != KErrNotFound )
+                    {
+                    videoLevel = 10;
+                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 level 10")));
+                    }
+                else if ( aVideoCodecType.MatchF( _L8("*level=20*") ) != KErrNotFound )
+                    {
+                    videoLevel = 20;
+                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 level 20")));
+                    }
+                else if ( aVideoCodecType.MatchF( _L8("*level=30*") ) != KErrNotFound )
+                    {
+                    videoLevel = 30;
+                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 level 30")));
+                    }
+                else if ( aVideoCodecType.MatchF( _L8("*level=40*") ) != KErrNotFound )
+                    {
+                    videoLevel = 40;
+                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 level 40")));
+                    }
+                else if ( aVideoCodecType.MatchF( _L8("*level=45*") ) != KErrNotFound )
+                    {
+                    videoLevel = 45;
+                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 level 45")));
+                    }
+                else if ( aVideoCodecType.MatchF( _L8("*level=50*") ) != KErrNotFound )
+                    {
+                    videoLevel = 50;
+                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 level 50")));
+                    }
+                else
+                    {
+                    // assume 10
+                    videoLevel = 10;
+                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Video codec: H.263 level 10")));
+                    }
+                }
+            }
+        else // MPEG-4
+            {
+            matchstring = KCMRMimeTypeMPEG4V;
+            matchstring += _L8( "*" );
+
+            if ( aVideoCodecType.MatchF(matchstring) != KErrNotFound )
+                {
+                iFileCodecType |= MP4_TYPE_MPEG4_VIDEO;     // MPEG-4
+                }
+            else // H.264 AVC
+	            {
+	            matchstring = KCMRMimeTypeH264AVC;
+	            matchstring += _L8( "*" );
+
+	            if ( aVideoCodecType.MatchF(matchstring) != KErrNotFound )
+	                {
+                    iAVCOutputLevel = 10;
+		            // check if profile & level is indicated too
+		            matchstring = _L8("*profile-level-id=*");
+		            if (aVideoCodecType.MatchF( matchstring ) != KErrNotFound )
+		                {
+		                // yes, there is, check what it is
+	                    // Determine if other AVC profile is used:
+                        matchstring = _L8( "*profile-level-id=42*" ); // Main Profile 
+                        if (aVideoCodecType.MatchF( matchstring ) != KErrNotFound)
+                            {
+                            iFileCodecType |= MP4_TYPE_AVC_PROFILE_BASELINE;     // H.264 AVC Baseline profile found 
+                            }
+	                    matchstring = _L8( "*profile-level-id=4D*" ); // Main Profile 
+	                    if (aVideoCodecType.MatchF( matchstring ) != KErrNotFound)
+	                        {
+	                        iFileCodecType |= MP4_TYPE_AVC_PROFILE_MAIN;     // H.264 AVC Main profile found 
+	                        }
+	                    matchstring = _L8( "*profile-level-id=64*" ); // High Profile 
+	                    if (aVideoCodecType.MatchF( matchstring ) != KErrNotFound)
+	                        {
+	                        iFileCodecType |= MP4_TYPE_AVC_PROFILE_HIGH;     // H.264 AVC Baseline profile found 
+	                        }
+		                
+	                    // Determine if other AVC level is used:
+		                if ( aVideoCodecType.MatchF( _L8("*00A*") ) != KErrNotFound )
+		                    {
+		                    iAVCOutputLevel = 10; 	// Level 1
+		                    }
+		                else if ( (aVideoCodecType.MatchF( _L8("*profile-level-id=42900B*") ) != KErrNotFound) ||
+                                  (aVideoCodecType.MatchF( _L8("*profile-level-id=4D500B*") ) != KErrNotFound) || 
+                                  (aVideoCodecType.MatchF( _L8("*profile-level-id=644009*") ) != KErrNotFound) )
+		                    {
+		                    iAVCOutputLevel = 101; 	// Level 1b
+		                    }
+                        else if ( (aVideoCodecType.MatchF( _L8("*profile-level-id=42800B*") ) != KErrNotFound) ||
+                                  (aVideoCodecType.MatchF( _L8("*profile-level-id=4D400B*") ) != KErrNotFound) || 
+                                  (aVideoCodecType.MatchF( _L8("*profile-level-id=64400B*") ) != KErrNotFound) )
+		                    {
+		                    iAVCOutputLevel = 11;	// Level 1.1
+		                    }
+		                else if ( aVideoCodecType.MatchF( _L8("*00C*") ) != KErrNotFound )
+		                    {
+		                    iAVCOutputLevel = 12;	// Level 1.2
+		                    }
+		                else if ( aVideoCodecType.MatchF( _L8("*00D*") ) != KErrNotFound )
+		                    {
+		                    iAVCOutputLevel = 13;	// Level 1.3
+		                    }
+		                else if ( aVideoCodecType.MatchF( _L8("*014*") ) != KErrNotFound )
+		                    {
+		                    iAVCOutputLevel = 20;	// Level 2
+		                    }
+                        else if ( aVideoCodecType.MatchF( _L8("*015*") ) != KErrNotFound )
+                            {
+                            iAVCOutputLevel = 21;   // Level 2.1
+                            }
+                        else if ( aVideoCodecType.MatchF( _L8("*016*") ) != KErrNotFound )
+                            {
+                            iAVCOutputLevel = 22;   // Level 2.2
+                            }
+                        else if ( aVideoCodecType.MatchF( _L8("*01E*") ) != KErrNotFound )
+                            {
+                            iAVCOutputLevel = 30;   // Level 3
+                            }
+                        else if ( aVideoCodecType.MatchF( _L8("*01F*") ) != KErrNotFound )
+                            {
+                            iAVCOutputLevel = 31;   // Level 3.1
+                            }
+                        else if ( aVideoCodecType.MatchF( _L8("*020*") ) != KErrNotFound )
+                            {
+                            iAVCOutputLevel = 32;   // Level 3.2
+                            }
+                        else if ( aVideoCodecType.MatchF( _L8("*028*") ) != KErrNotFound )
+                            {
+                            iAVCOutputLevel = 4;   // Level 4
+                            }
+		                else
+		                    {
+		                    // assume level 1
+		                    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Warning unknown video codec type - defaulting level 1.0")));
+		                    iAVCOutputLevel = 10;
+		                    }
+		                }
+	                }
+	            else
+		            {
+    				PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Unsupported video codec type")));
+		            User::Leave(KErrArgument);
+		            }
+	            }
+            }
+        }
+
+    if ( iFileHandleExists )
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL using rfile to open mp4handle")));
+        error = MP4ComposeOpenFileHandle(&iMP4Handle, iFile, (TDriveNumber)iDriveNumber, iFileCodecType);
+        }
+    else
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL using descriptors to open mp4handle")));
+        error = MP4ComposeOpen(&iMP4Handle, (MP4FileName)iTmpFileName.Ptr(), iFileCodecType);
+        }
+
+    if ( error == MP4_OUT_OF_MEMORY )
+    	{
+    	PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeOpen, error=%d"), error));
+    	User::Leave(KErrNoMemory);
+    	}
+    else if (error != MP4_OK)
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeOpen, error=%d"), error));
+        TInt64 currentdiskspace = DriveFreeSpaceL();
+        iFileName = KNullDesC;
+
+        if ( currentdiskspace < ((TInt64)KDiskSafetyLimit+iCriticalDiskVal+CurrentMetadataSize()) )
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::OpenFileL disk full, available: %d"), I64INT(currentdiskspace)));
+            iDiskFull = ETrue;
+            User::Leave(KErrDiskFull);
+            }
+        else
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Compose and Open failed, error=%d"), error));
+            iFileName = KNullDesC;
+            User::Leave(KErrGeneral);
+            }
+        }
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Compose and Open done")));
+
+    mp4_u32 composeFlags = 0;
+    if ( aFileFormat == E3GPP2 )
+        {
+        composeFlags |= ( MP4_FLAG_METADATALAST | MP4_FLAG_LONGCLIP | MP4_FLAG_GENERATE_3G2);
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Fileformat: 3G2")));
+        }
+    else if ( aFileFormat == EMPEG4 )
+        {
+        composeFlags |= ( MP4_FLAG_METADATALAST | MP4_FLAG_LONGCLIP | MP4_FLAG_GENERATE_MP4);
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Fileformat: MP4")));
+        }
+    else // E3GPP
+        {
+        composeFlags |= ( MP4_FLAG_METADATALAST | MP4_FLAG_LONGCLIP );
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Fileformat: 3GP")));
+        }
+
+    if ( ( iVideoMaxBitRate + iAudioAverageBitRate ) >= KLimitForLargeFileBuffers )
+        {
+        composeFlags |= MP4_FLAG_LARGEFILEBUFFER;
+        }
+
+    error = MP4ComposeSetFlags(iMP4Handle, composeFlags );
+    if ( error == MP4_OUT_OF_MEMORY )
+    	{
+    	PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeSetFlags, error=%d"), error));
+    	User::Leave(KErrNoMemory);
+    	}
+    else if (error != MP4_OK)
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeSetFlags, error=%d"), error));
+        TInt64 currentdiskspace2 = DriveFreeSpaceL();
+
+        if ( currentdiskspace2 < ((TInt64)KDiskSafetyLimit+iCriticalDiskVal+CurrentMetadataSize()) )
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::OpenFileL disk full, available: %d"), I64INT(currentdiskspace2)));
+            iDiskFull = ETrue;
+            User::Leave(KErrDiskFull);
+            }
+        else
+            {
+            User::Leave(KErrGeneral);
+            }
+        }
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Compose flags set")));
+
+    if ((iFileCodecType & MP4_TYPE_H263_PROFILE_0) ||
+        (iFileCodecType & MP4_TYPE_H263_PROFILE_3) ||
+        (iFileCodecType & MP4_TYPE_MPEG4_VIDEO)    ||
+        (iFileCodecType & MP4_TYPE_AVC_PROFILE_BASELINE) ||
+        (iFileCodecType & MP4_TYPE_AVC_PROFILE_MAIN) ||
+        (iFileCodecType & MP4_TYPE_AVC_PROFILE_HIGH))
+        {
+        // Set default values for video parameters if they are not set
+        if (iVideoAverageBitRate < 0)
+            {
+            iVideoAverageBitRate = KVideoAverageBitRate;
+            }
+        if (iVideoMaxBitRate < 0)
+            {
+            iVideoMaxBitRate = KVideoMaxBitRate;
+            }
+        if (iVideoXResolution == 0)
+            {
+            iVideoXResolution = KVideoXResolution;
+            }
+        if (iVideoYResolution == 0)
+            {
+            iVideoYResolution = KVideoYResolution;
+            }
+
+        error = MP4ComposeAddVideoDescription(iMP4Handle,
+                                              (mp4_u32)KVideoTimeScale,
+                                              (mp4_u16)iVideoXResolution,
+                                              (mp4_u16)iVideoYResolution,
+                                              (mp4_u32)iVideoMaxBitRate,
+                                              (mp4_u32)iVideoAverageBitRate);
+
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeAddVideoDescription, error=%d"), error));
+        if (error != MP4_OK)
+            {
+            User::Leave(KErrGeneral);
+            }
+        if ( (iFileCodecType & (MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_H263_PROFILE_3))
+            && ( videoLevel != 10) )
+            {
+            // H.263 level should be given to 3gp library like this
+            error = MP4ComposeWriteVideoDecoderSpecificInfo(iMP4Handle,
+                                                            (mp4_u8*)&videoLevel,
+                                                            (mp4_u32)1);
+            if ( error != MP4_OK )
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeWriteVideoDecoderSpecificInfo, error=%d"), error));
+                User::Leave(KErrGeneral);
+                }
+            }
+        }
+
+    if (iFileCodecType & MP4_TYPE_AMR_NB)
+        {
+        error = MP4ComposeAddAudioDescription(iMP4Handle,
+                                              (mp4_u32)KAudioTimeScale,
+                                              (mp4_u8)KAMRAudioFramesPerSample,
+                                              (mp4_u16)KAudioModeSet);
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeAddAudioDescription, AMR-NB error=%d"), error));
+        if (error != MP4_OK)
+            {
+            User::Leave(KErrGeneral);
+            }
+        }
+
+    if ( iFileCodecType & MP4_TYPE_MPEG4_AUDIO)
+        {
+        // To make sure we always write proper timescale to output file (even in case when we get no audio
+        // buffers) the default samplerate is passed to 3GP library here.
+        // When we get audio decoder specific information in WriteBuffer() the MP4ComposeAddAudioDescription()
+        // will be called again with correct samplerate.
+        error = MP4ComposeAddAudioDescription(iMP4Handle,
+                                              (mp4_u32)KAACDefaultSampleRate,
+                                              (mp4_u8)KAACAudioFramesPerSample,
+                                              (mp4_u16)KAudioModeSet);
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL MP4ComposeAddAudioDescription, AAC error=%d"), error));
+        if (error != MP4_OK)
+            {
+            User::Leave(KErrGeneral);
+            }
+        }
+
+    if ( iAvailableSpaceAtStart == 0 )
+        {
+        TVolumeInfo volumeinfo;
+        User::LeaveIfError(iFS->Volume(volumeinfo, iDriveNumber));
+        iAvailableSpaceAtStart = volumeinfo.iFree - (TInt64)(KDiskSafetyLimit+iCriticalDiskVal);
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Setting async file remover handler")));
+    error = MP4ComposeSetTempFileRemoverObserver(&iMP4Handle, this);
+    if (error != MP4_OK)
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Setting async file remover handler FAILED")));
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::OpenFileL exit")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::SetSizeLimit
+//
+// Set size limit of the 3GP file to be recorded in bytes. The limit must be
+// set before the recording starts.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::SetSizeLimit(TUint aSize)
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::SetSizeLimit enter, requested limit: %u"), aSize));
+    if (iBytesReceived)
+        {
+        PRINT(_L("CCamC3GPDataSinkImp::SetSizeLimit NOT set, recording"));
+        return;
+        }
+
+    TInt64 rfileMaxSize = KCamC3GPMaximumFileSize; 
+    if ( aSize == 0 || aSize > rfileMaxSize )
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::SetSizeLimit 0 or over RFile max size, using internal max instead.")));
+        iSizeLimit = rfileMaxSize; //max size for RFile
+        }
+    else
+        {
+        iSizeLimit = aSize;
+        }
+    PRINT((_L("CCamC3GPDataSinkImp::SetSizeLimit set to: high:%u low:%u"), I64HIGH(iSizeLimit), I64LOW(iSizeLimit)));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::GetElapsedTime
+//
+// Return the amount of time recording has been on in microseconds.
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCamC3GPDataSinkImp::GetElapsedTime()
+    {
+    PRINT(_L("CCamC3GPDataSinkImp::GetElapsedTime in"));
+    TTimeIntervalMicroSeconds elapsed;
+    if (iVideoBufferTimestamp < TTimeIntervalMicroSeconds(0))
+        {
+        elapsed = 0;
+        }
+    else
+        {
+        elapsed = iVideoBufferTimestamp.Int64() - iFirstVideoFrameTimestamp.Int64();
+        }
+    PRINT((_L("CCamC3GPDataSinkImp::GetElapsedTime out, elapsed=%d"), I64INT(elapsed.Int64()) ));
+    return elapsed;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::GetRemainingTime
+//
+// Return the estimated remaining time for the recording in microseconds.
+// This method takes into account the file size and disk full restrictions.
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCamC3GPDataSinkImp::GetRemainingTimeL()
+    {
+    TTimeIntervalMicroSeconds  elapsed;
+    TTimeIntervalMicroSeconds  remaining;
+    TTimeIntervalMicroSeconds  endtime;
+    TInt64 availableSpace;
+    TInt64 usedSpace;
+    TInt64 metaDataSize;
+    TBool remainingFromSizeLimit = EFalse;
+
+    PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL in")));
+
+    if ( iAvailableSpaceAtStart == 0 )
+        {
+        TVolumeInfo volumeinfo;
+        User::LeaveIfError(iFS->Volume(volumeinfo, iDriveNumber));
+        iAvailableSpaceAtStart = volumeinfo.iFree - (TInt64)(KDiskSafetyLimit+iCriticalDiskVal);
+        }
+
+    if (iSizeLimit && ( iSizeLimit < iAvailableSpaceAtStart ) )
+        {
+        // use sizelimit as available space.
+        PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL Limiting remainingtime by sizelimit: %d."), I64INT(iSizeLimit)));
+        remainingFromSizeLimit = ETrue;
+        }
+    else
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL Limiting remainingtime by available space at start: %d "), I64INT(iAvailableSpaceAtStart) ));
+        }
+
+    if ( iVideoBufferTimestamp < TTimeIntervalMicroSeconds(0) )
+        {
+        elapsed = 0;
+        }
+    else
+        {
+        elapsed = iVideoBufferTimestamp.Int64() - iFirstVideoFrameTimestamp.Int64();
+        PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL elapsed with first=%d current=%d elapsed=%d"), I64INT(iFirstVideoFrameTimestamp.Int64()), I64INT(iVideoBufferTimestamp.Int64()), I64INT(elapsed.Int64()) ));
+        }
+
+    if (elapsed < (TTimeIntervalMicroSeconds)((TInt64)KDelayUseBitrates) )
+        {
+        // Use average audio/video bitrates to estimate remaining time
+        TUint  averageBitRate;
+        TUint  averageByteRate;
+
+        PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL: BitRates Video: %d , Audio: %d"), iVideoAverageBitRate, iAudioAverageBitRate ));
+
+        averageBitRate = (TUint)((iVideoAverageBitRate + iAudioAverageBitRate) * KMetaDataCoeff);
+        averageByteRate = averageBitRate / 8;
+
+        PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL: avaragebitrate: %d , avaragebyterate: %d"), averageBitRate, averageByteRate ));
+
+        usedSpace = elapsed.Int64() * averageByteRate / 1000000; // 1000000 is for conversion between microseconds and seconds
+
+        PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL: elapsed: %d, usedspace: %d"), I64INT(elapsed.Int64()), usedSpace ));
+
+        metaDataSize = 2*CurrentMetadataSize();
+        if (remainingFromSizeLimit)
+            {
+            availableSpace = iSizeLimit - usedSpace - metaDataSize;
+            }
+        else
+            {
+            availableSpace = iAvailableSpaceAtStart - usedSpace - metaDataSize;
+            }
+
+        if (availableSpace <= 0 || averageByteRate == 0)
+            {
+            remaining = 0;
+            }
+        else
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL: availablespace: %d, atStart: %d "), I64INT(elapsed.Int64()), I64INT(iAvailableSpaceAtStart) ));
+
+            remaining = availableSpace * 1000000 / averageByteRate; // 1000000 is for conversion between microseconds and seconds
+
+            if ( (remaining.Int64() + elapsed.Int64()) > (TInt64(KCamCMaxClipDurationInSecs)*1000000) )
+                {
+                remaining = (TInt64(KCamCMaxClipDurationInSecs)*1000000) - elapsed.Int64();
+                }
+
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL: remaining: %d "), I64INT(remaining.Int64()) ));
+            }
+
+        // update also iAvarageEndTime to smooth jump at KDelayUseBitrates sec point.
+        iAvarageEndTime = elapsed.Int64()+ remaining.Int64();
+        }
+    else // use real filesize estimates.
+        {
+        // used space is mediadata + 2x metadata (metadata in temp-files written and additionaö reserved space for stop copying it to output file.
+        usedSpace = CurrentFileSize()+ 2*CurrentMetadataSize();
+        if (remainingFromSizeLimit)
+            {
+            availableSpace = iSizeLimit - usedSpace;
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL availableSpace from sizelimit: %d "), I64INT(iAvailableSpaceAtStart) ));
+            }
+        else
+            {
+            availableSpace = iAvailableSpaceAtStart - usedSpace;
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL availableSpace from availablespaceAtStart: %d "), I64INT(iAvailableSpaceAtStart) ));
+            }
+
+        if (availableSpace <= 0)
+            {
+            remaining = 0;
+            }
+        else
+            {
+            // preserve integer precision by scaling the first dividend up in calculation
+            if (remainingFromSizeLimit)
+                {
+                // divide the greater of iSizeLimit and elapsed with usedSpace first to prevent overflow
+                if ( iSizeLimit  > elapsed.Int64() )
+                    {
+                    PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL iSizeLimit > elapsed: %d vs. %d"), I64INT(iSizeLimit), I64INT(elapsed.Int64()) ));
+                    endtime = (((iSizeLimit * 1000) / usedSpace ) * elapsed.Int64() ) / 1000;
+                    }
+                else
+                    {
+                    PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL iSizeLimit < elapsed: %d vs. %d"), I64INT(iSizeLimit), I64INT(elapsed.Int64()) ));
+                    endtime = ( iSizeLimit  * ( (elapsed.Int64() * 1000) / usedSpace )) / 1000;
+                    }
+                }
+            else
+                {
+                // divide the greater of iAvailableSpaceAtStart and elapsed with usedSpace first to prevent overflow
+                if (iAvailableSpaceAtStart > elapsed.Int64() )
+                    {
+                    PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL iAvailableSpaceAtStart > elapsed: %d vs. %d"), I64INT(iAvailableSpaceAtStart), I64INT(elapsed.Int64()) ));
+                    endtime = (( (iAvailableSpaceAtStart * 1000) / usedSpace ) * elapsed.Int64() ) / 1000;
+                    }
+                else
+                    {
+                    PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL iAvailableSpaceAtStart < elapsed: %d vs. %d"), I64INT(iAvailableSpaceAtStart), I64INT(elapsed.Int64()) ));
+                    endtime = ( iAvailableSpaceAtStart * ( (elapsed.Int64() * 1000) / usedSpace )) / 1000;
+                    }
+                }
+
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL Endtime: %d"), I64INT(endtime.Int64()) ));
+            if ( iAvarageEndTime.Int64() == -1 )
+                {
+                iAvarageEndTime = endtime;
+                }
+            else
+                {
+                iAvarageEndTime = (( iAvarageEndTime.Int64() * 7 ) + endtime.Int64() ) / 8;
+                }
+
+            if ( iAvarageEndTime.Int64() > (TInt64(KCamCMaxClipDurationInSecs)*1000000) )
+                {
+                iAvarageEndTime = (TInt64(KCamCMaxClipDurationInSecs)*1000000);
+                }
+
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL elapsed: %d , usedspace: %d"), I64INT(elapsed.Int64()), I64INT(usedSpace) ));
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL available: %d, atStart: %d"), I64INT(availableSpace), iAvailableSpaceAtStart));
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL AvgEndtime: %d"), I64INT(iAvarageEndTime.Int64()) ));
+            remaining = iAvarageEndTime.Int64() - elapsed.Int64();
+            PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL remaining: %d"), I64INT(remaining.Int64()) ));
+            }
+        }
+
+    // Check if remaining time has reached 0 and we need to stop right away
+    if ( remaining <= TInt64(0) )
+        {
+        if ( elapsed >= TInt64(0) ) // we are recording.
+            {
+            if ( remainingFromSizeLimit || (elapsed >= (TInt64(KCamCMaxClipDurationInSecs)*1000000)) )
+                {
+                // Size limit has been set and we reach wanted size -> remaining time is 0
+                iFileSizeLimitReached = ETrue;
+                iObserver->MfcoSizeLimitReachedL();
+                }
+            else
+                {
+                // Diskfull
+                iDiskFull = ETrue;
+                iObserver->MfcoDiskFullL();
+                }
+            }
+        remaining = 0;
+        }
+    PRINT((_L("CCamC3GPDataSinkImp::GetRemainingTimeL out")));
+    return remaining;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::SinkStopL
+//
+// Order the sink to finalize and close the current 3GP file.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::SinkStopL()
+    {
+    MP4Err  error;
+
+    PRINT((_L("CCamC3GPDataSinkImp::SinkStopL enter")));
+
+    if (!iMP4Handle)
+        {
+        return;
+        }
+
+    if (iVideoFrameDuration) // Write remaining video frame to disk
+        {
+        error = MP4ComposeWriteVideoFrame(iMP4Handle,
+                                          (mp4_u8 *)iVideoBuffer,
+                                          (mp4_u32)iVideoBufferFrameSize,
+                                          (mp4_u32)iVideoFrameDuration,
+                                          (mp4_bool)iVideoBufferRandomAccessPoint);
+        if (error != MP4_OK)
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::SinkStopL MP4ComposeWriteVideoFrame, error=%d"), error));
+            User::Leave(KErrGeneral);
+            }
+        }
+
+
+    PRINT((_L("CCamC3GPDataSinkImp::SinkStopL video frames written")));
+
+
+    if (iAudioFramesInBuffer) // Write remaining audio frames to disk
+        {
+        error = MP4ComposeWriteAudioFrames(iMP4Handle,
+                                           (mp4_u8 *)iAudioBuffer,
+                                           (mp4_u32)iAudioBufferFrameSize,
+                                           (mp4_u32)iAudioFramesInBuffer,
+                                           (mp4_u32)iAudioFramesInBuffer * KAudioFrameDuration);
+        if (error != MP4_OK)
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::SinkStopL MP4ComposeWriteAudioFrames, error=%d"), error));
+            User::Leave(KErrGeneral);
+            }
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::SinkStopL audio frames written")));
+
+
+    error = MP4ComposeClose(iMP4Handle);
+    iMP4Handle = NULL;
+    if (error != MP4_OK)
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::SinkStopL MP4ComposeClose, error=%d"), error));
+        TInt64 currentdiskspace = DriveFreeSpaceL();
+
+        if ( currentdiskspace < ((TInt64)KDiskSafetyLimit+iCriticalDiskVal+CurrentMetadataSize()) )
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::SinkStopL disk full, available: %d"), I64INT(currentdiskspace)));
+            iDiskFull = ETrue;
+            User::Leave(KErrDiskFull);
+            }
+        else
+            {
+            User::Leave(KErrGeneral);
+            }
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::SinkStopL file composed and closed")));
+
+    if ( iFileHandleExists )
+        {
+        iMMFFile->SinkStopL();
+        iMMFFile = NULL; // not owned
+        }
+    else
+        {
+        if (!iBytesReceived)
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::SinkStopL No data written, iTmpFileName left: '%s'"), iTmpFileName.Ptr()));
+            }
+        else
+            {
+            iFS->SetEntry(iTmpFileName, TTime(0), NULL, KEntryAttHidden);
+            PRINT((_L("CCamC3GPDataSinkImp::SinkStopL Renaming temp file to: '%s'"), iFileName.Ptr()));
+            User::LeaveIfError(iFS->Rename(iTmpFileName, iFileName));
+            }
+        }
+
+    iFileName = KNullDesC;
+
+    iBytesOfMetadata = 0;
+    iBufferSize = 0;
+    iFileCodecType = MP4_TYPE_NONE;
+    iVideoTimestamp = 0;
+    iVideoBufferTimestamp = -1;
+    iVideoRandomAccessPoint = EFalse;
+    iVideoBufferRandomAccessPoint = EFalse;
+    iVideoFrameDuration = 0;
+    iVideoBufferFrameSize = 0;
+    iVideoDecSpecInfoSize = 0;
+    iAudioDecSpecInfoSize = 0;
+    iAudioBufferFrameSize = 0;
+    iAudioFrameNumber = 0;
+    iAudioFramesInBuffer = 0;
+    iFileSizeLimitReached = EFalse;
+    iDiskFull = EFalse;
+    iFreeDiskSpace = 0;
+    iFreeDiskSpaceCounter = 0;
+    iAudioAACFrameDuration = 0;
+    iAudioAACSamplerate = 0;
+
+    PRINT((_L("CCamC3GPDataSinkImp::SinkStopL() updating available diskspace - in")));
+    TVolumeInfo volumeinfo;
+    if ( iFS && iFS->Volume(volumeinfo, iDriveNumber) == KErrNone )
+        {
+        iAvailableSpaceAtStart = volumeinfo.iFree - (TInt64)(KDiskSafetyLimit+iCriticalDiskVal);
+        PRINT((_L("CCamC3GPDataSinkImp::SinkStopL() updating available diskspace - done")));
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::SinkStopL exit")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::WriteBuffer
+//
+// Write an audio/video buffer to the sink. The sink copies the given buffer
+// and writes it to the file.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::WriteBufferL(CCMRMediaBuffer* aBuffer)
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL enter")));
+    TInt64  videoduration = 0;
+    TUint8* tmpaudiobuffer = 0;
+    TInt64 currentfilesize;
+    MP4Err  error = MP4_OK;
+
+
+    if (!iMP4Handle)
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL No MP4Handle, returning.")));
+        return;
+        }
+
+    if (iFileSizeLimitReached || iDiskFull)
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL sizelimit reached or disk full returning")));
+        return;
+        }
+
+    iBufferType = aBuffer->Type();
+    iBufferSize = aBuffer->BufferSize();
+
+    TTimeIntervalMicroSeconds elapsed;
+    if (iVideoBufferTimestamp < TTimeIntervalMicroSeconds(0))
+        {
+        elapsed = 0;
+        }
+    else
+        {
+        elapsed = iVideoBufferTimestamp.Int64() - iFirstVideoFrameTimestamp.Int64();
+        }
+
+    currentfilesize = CurrentFileSize() + CurrentMetadataSize();
+    if ( ( iSizeLimit && ((currentfilesize + (TUint)iBufferSize) > iSizeLimit) ) ||
+         (elapsed.Int64() >= (TInt64(KCamCMaxClipDurationInSecs)*1000000)) )
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL sizelimit reached, filesize: %d"), I64INT(currentfilesize)));
+        PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL sizelimit is set to: high:%u low:%u"), I64HIGH(iSizeLimit), I64LOW(iSizeLimit)));
+        PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL elapsed time: high:%u low:%u"), I64HIGH(elapsed.Int64()), I64LOW(elapsed.Int64())));        
+        iFileSizeLimitReached = ETrue;
+        iObserver->MfcoSizeLimitReachedL();
+        return;
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL, filesize: %d, bufsize: %d")
+            , I64INT(currentfilesize), iBufferSize));
+
+    currentfilesize += CurrentMetadataSize(); // extra reserve for stop (copy metadata from temp files to end of output file.
+    if ( currentfilesize >= iAvailableSpaceAtStart )
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL disk full, calc size: %d"), I64INT(currentfilesize)));
+        iDiskFull = ETrue;
+        iObserver->MfcoDiskFullL();
+        return;
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL, available: %d")
+            , I64INT(iAvailableSpaceAtStart-currentfilesize)));
+
+    iBytesReceived += (TUint)iBufferSize;
+    switch (iBufferType)
+        {
+        case CCMRMediaBuffer::EAudioAMRNB:
+            {
+            iAudioFrameNumber++;
+
+            if ( ( (TUint)iBufferSize + iAudioBufferFrameSize ) > iAudioBufferSize) // Incoming buffer doesn't fit into allocated buffer
+                {
+                tmpaudiobuffer = new (ELeave) TUint8[(TUint)iBufferSize + iAudioBufferFrameSize];
+                Mem::Copy(tmpaudiobuffer, iAudioBuffer, (TInt)iAudioBufferFrameSize);
+                delete [] iAudioBuffer;
+                iAudioBuffer = tmpaudiobuffer;
+                iAudioBufferSize = (TUint)iBufferSize + iAudioBufferFrameSize;
+                }
+
+            Mem::Copy(iAudioBuffer + iAudioBufferFrameSize, aBuffer->Data().Ptr(), iBufferSize);
+            iAudioBufferFrameSize += (TUint)iBufferSize;
+            iAudioFramesInBuffer++;
+
+            if (iAudioFramesInBuffer == KAMRAudioFramesPerSample) // Buffer several audio frames before writing to disk
+                {
+                error = MP4ComposeWriteAudioFrames(iMP4Handle,
+                                                   (mp4_u8 *)iAudioBuffer,
+                                                   (mp4_u32)iAudioBufferFrameSize,
+                                                   (mp4_u32)iAudioFramesInBuffer,
+                                                   (mp4_u32)iAudioFramesInBuffer * KAudioFrameDuration);
+                PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL AMR-NB MP4ComposeWriteAudioFrames, error=%d"), error));
+                if (error != MP4_OK)
+                    {
+                    User::Leave(KErrGeneral);
+                    }
+
+                iAudioFramesInBuffer = 0;
+                iAudioBufferFrameSize = 0;
+                }
+
+            break;
+            }
+        case CCMRMediaBuffer::EAudioMPEG4AAC:
+            {
+            if ( !iAudioAACFrameDuration )
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL AAC Audio frameduration not set! Error= -18"), error));
+                User::Leave ( KErrNotReady );
+                }
+
+            iAudioFrameNumber++;
+            error = MP4ComposeWriteAudioFrames(iMP4Handle,
+                                               (mp4_u8 *)aBuffer->Data().Ptr(),
+                                               (mp4_u32)aBuffer->BufferSize(),
+                                               (mp4_u32)KAACAudioFramesPerSample,
+                                               (mp4_u32)KAACAudioFramesPerSample * iAudioAACFrameDuration);
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL AAC MP4ComposeWriteAudioFrames, error=%d"), error));
+            if (error != MP4_OK)
+                {
+                User::Leave(KErrGeneral);
+                }
+            break;
+            }
+        case CCMRMediaBuffer::EAudioAMRWB:
+            {
+            break;
+            }
+        case CCMRMediaBuffer::EVideoH263:
+        case CCMRMediaBuffer::EVideoMPEG4:
+            {
+            iVideoTimestamp = aBuffer->TimeStamp();
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL EVideoH263/EVideoMPEG4 Timestamp of the buffer is %d"), I64INT(iVideoTimestamp.Int64())));
+            iVideoRandomAccessPoint = aBuffer->RandomAccessPoint();
+            iVideoFrameNumber++;
+            if (iVideoRandomAccessPoint)
+                {
+                iVideoIntraFrameNumber++;
+                }
+
+            if (iVideoBufferTimestamp < TTimeIntervalMicroSeconds(0)) // First frame
+                {
+                iFirstVideoFrameTimestamp = iVideoTimestamp;
+                iVideoBufferTimestamp = iVideoTimestamp;
+                iVideoBufferRandomAccessPoint = iVideoRandomAccessPoint;
+
+                if ((TUint)iBufferSize > iVideoBufferSize)
+                    {
+                    delete [] iVideoBuffer;
+                    iVideoBuffer = new (ELeave) TUint8[(TUint)iBufferSize];
+                    iVideoBufferSize = (TUint)iBufferSize;
+                    }
+
+                Mem::Copy(iVideoBuffer, aBuffer->Data().Ptr(), iBufferSize);
+                iVideoBufferFrameSize = (TUint)iBufferSize;
+
+                break;
+                }
+
+            videoduration = iVideoTimestamp.Int64() - iVideoBufferTimestamp.Int64(); // Duration in microseconds
+            videoduration = TInt64((videoduration * KVideoTimeScale) / 1E6 + 0.5); // Duration scaled to KVideoTimeScale
+            iVideoFrameDuration = (TUint)I64INT(videoduration);
+
+            error = MP4ComposeWriteVideoFrame(iMP4Handle,
+                                              (mp4_u8 *)iVideoBuffer,
+                                              (mp4_u32)iVideoBufferFrameSize,
+                                              (mp4_u32)iVideoFrameDuration,
+                                              (mp4_bool)iVideoBufferRandomAccessPoint);
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteVideoFrame, error=%d"), error));
+            if (error != MP4_OK)
+                {
+                User::Leave(KErrGeneral);
+                }
+
+            if ((TUint)iBufferSize > iVideoBufferSize)
+                {
+                delete [] iVideoBuffer;
+                iVideoBuffer = new (ELeave) TUint8[(TUint)iBufferSize];
+                iVideoBufferSize = (TUint)iBufferSize;
+                }
+
+            Mem::Copy(iVideoBuffer, aBuffer->Data().Ptr(), iBufferSize);
+            iVideoBufferFrameSize = (TUint)iBufferSize;
+            iVideoBufferTimestamp = iVideoTimestamp;
+            iVideoBufferRandomAccessPoint = iVideoRandomAccessPoint;
+
+            break;
+            }
+        case CCMRMediaBuffer::EVideoMPEG4DecSpecInfo:
+            {
+            iVideoDecSpecInfoSize = iBufferSize;
+
+            error = MP4ComposeWriteVideoDecoderSpecificInfo(iMP4Handle,
+                                                            (mp4_u8 *)aBuffer->Data().Ptr(),
+                                                            (mp4_u32)iBufferSize);
+            if (error != MP4_OK)
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteVideoDecoderSpecificInfo, error=%d"), error));
+                User::Leave(KErrGeneral);
+                }
+
+            break;
+            }
+        case CCMRMediaBuffer::EVideoH264NAL:
+            {
+            iVideoTimestamp = aBuffer->TimeStamp();
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL EVideoH264NAL Timestamp of the buffer is %d"), I64INT(iVideoTimestamp.Int64())));
+            iVideoRandomAccessPoint = aBuffer->RandomAccessPoint();
+            iVideoFrameNumber++;
+            if (iVideoRandomAccessPoint)
+                {
+                iVideoIntraFrameNumber++;
+                }
+
+            if (iVideoBufferTimestamp < TTimeIntervalMicroSeconds(0)) // First frame
+                {
+                iFirstVideoFrameTimestamp = iVideoTimestamp;
+                iVideoBufferTimestamp = iVideoTimestamp;
+                iVideoBufferRandomAccessPoint = iVideoRandomAccessPoint;
+
+                if ((TUint)(iBufferSize) > iVideoBufferSize)
+                    {
+                    delete [] iVideoBuffer;
+                    iVideoBuffer = new (ELeave) TUint8[(TUint)iBufferSize];
+                    iVideoBufferSize = (TUint)iBufferSize;
+                    }
+
+                ConvertNALEncapsulationToNALSizes( aBuffer );
+                break;
+                }
+
+            videoduration = iVideoTimestamp.Int64() - iVideoBufferTimestamp.Int64(); // Duration in microseconds
+            videoduration = TInt64((videoduration * KVideoTimeScale) / 1E6 + 0.5); // Duration scaled to KVideoTimeScale
+            iVideoFrameDuration = (TUint)I64INT(videoduration);
+
+            error = MP4ComposeWriteVideoFrame(iMP4Handle,
+                                              (mp4_u8 *)iVideoBuffer,
+                                              (mp4_u32)iVideoBufferFrameSize,
+                                              (mp4_u32)iVideoFrameDuration,
+                                              (mp4_bool)iVideoBufferRandomAccessPoint);
+            if (error != MP4_OK)
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteVideoFrame, error=%d"), error));
+                User::Leave(KErrGeneral);
+                }
+
+            if ((TUint)(iBufferSize) > iVideoBufferSize)
+                {
+                delete [] iVideoBuffer;
+                iVideoBuffer = new (ELeave) TUint8[(TUint)iBufferSize];
+                iVideoBufferSize = (TUint)iBufferSize;
+                }
+
+            ConvertNALEncapsulationToNALSizes( aBuffer );
+
+            iVideoBufferTimestamp = iVideoTimestamp;
+            iVideoBufferRandomAccessPoint = iVideoRandomAccessPoint;
+            break;
+            }
+        case CCMRMediaBuffer::EVideoH264Bytestream:
+            {
+            // need to add NAL header to end on bytestream buffer
+            iVideoTimestamp = aBuffer->TimeStamp();
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL EVideoH264Bytestream Timestamp of the buffer is %d"), I64INT(iVideoTimestamp.Int64())));
+            iVideoRandomAccessPoint = aBuffer->RandomAccessPoint();
+            iVideoFrameNumber++;
+            if (iVideoRandomAccessPoint)
+                {
+                iVideoIntraFrameNumber++;
+                }
+
+            if (iVideoBufferTimestamp < TTimeIntervalMicroSeconds(0)) // First frame
+                {
+                iFirstVideoFrameTimestamp = iVideoTimestamp;
+                iVideoBufferTimestamp = iVideoTimestamp;
+                iVideoBufferRandomAccessPoint = iVideoRandomAccessPoint;
+
+                if ((TUint)(iBufferSize) > iVideoBufferSize)
+                    {
+                    delete [] iVideoBuffer;
+                    iVideoBuffer = new (ELeave) TUint8[(TUint)iBufferSize];
+                    iVideoBufferSize = (TUint)iBufferSize;
+                    }
+
+                ConvertBytestreamHeadersToNALSizes(aBuffer);
+                Mem::Copy(iVideoBuffer, aBuffer->Data().Ptr(), iBufferSize);
+                iVideoBufferFrameSize = iBufferSize;
+                break;
+                }
+
+            videoduration = iVideoTimestamp.Int64() - iVideoBufferTimestamp.Int64(); // Duration in microseconds
+            videoduration = TInt64((videoduration * KVideoTimeScale) / 1E6 + 0.5); // Duration scaled to KVideoTimeScale
+            iVideoFrameDuration = (TUint)I64INT(videoduration);
+
+            error = MP4ComposeWriteVideoFrame(iMP4Handle,
+                                              (mp4_u8 *)iVideoBuffer,
+                                              (mp4_u32)iVideoBufferFrameSize,
+                                              (mp4_u32)iVideoFrameDuration,
+                                              (mp4_bool)iVideoBufferRandomAccessPoint);
+            if (error != MP4_OK)
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteVideoFrame, error=%d"), error));
+                User::Leave(KErrGeneral);
+                }
+
+            if ((TUint)(iBufferSize) > iVideoBufferSize)
+                {
+                delete [] iVideoBuffer;
+                iVideoBuffer = new (ELeave) TUint8[(TUint)iBufferSize];
+                iVideoBufferSize = (TUint)iBufferSize;
+                }
+
+            ConvertBytestreamHeadersToNALSizes(aBuffer);
+            Mem::Copy(iVideoBuffer, aBuffer->Data().Ptr(), iBufferSize);
+
+            iVideoBufferFrameSize = (TUint)iBufferSize;
+            iVideoBufferTimestamp = iVideoTimestamp;
+            iVideoBufferRandomAccessPoint = iVideoRandomAccessPoint;
+            break;
+            }
+        case CCMRMediaBuffer::EVideoH264NALDecSpecInfo:
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL EVideoH264NALDecSpecInfo")));            
+            HBufC8* outputAVCHeader = 0;
+            outputAVCHeader = (HBufC8*) HBufC8::NewLC(16384);
+            TPtr8 destptr = outputAVCHeader->Des();
+
+	        // parse header & convert it to AVCDecoderConfigurationRecord -format
+	        ConvertAVCHeaderNALL(aBuffer, destptr);
+            iVideoDecSpecInfoSize = destptr.Length();
+
+            error = MP4ComposeWriteVideoDecoderSpecificInfo(iMP4Handle,
+                                                            (mp4_u8 *)destptr.Ptr(),
+                                                            (mp4_u32)iVideoDecSpecInfoSize);
+
+			CleanupStack::PopAndDestroy( outputAVCHeader );
+            if (error != MP4_OK)
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteVideoDecoderSpecificInfo, error=%d"), error));
+                User::Leave(KErrGeneral);
+                }
+            break;
+            }
+        case CCMRMediaBuffer::EVideoH264BytestreamDecSpecInfo:
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL EVideoH264BytestreamDecSpecInfo")));            
+            HBufC8* outputAVCHeader = 0;
+            outputAVCHeader = (HBufC8*) HBufC8::NewLC(16384);
+            TPtr8 destptr = outputAVCHeader->Des();
+
+	        // parse header & convert it to AVCDecoderConfigurationRecord -format
+	        ConvertAVCHeaderByteStreamL(aBuffer, destptr);
+            iVideoDecSpecInfoSize = destptr.Length();
+
+            error = MP4ComposeWriteVideoDecoderSpecificInfo(iMP4Handle,
+                                                            (mp4_u8 *)destptr.Ptr(),
+                                                            (mp4_u32)iVideoDecSpecInfoSize);
+
+			CleanupStack::PopAndDestroy( outputAVCHeader );
+            if (error != MP4_OK)
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteVideoDecoderSpecificInfo, error=%d"), error));
+                User::Leave(KErrGeneral);
+                }
+            break;
+            }
+        case CCMRMediaBuffer::EAudioDecSpecInfo:
+            {
+			PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteAudioDecoderSpecificInfo in"), error));
+            iAudioDecSpecInfoSize = iBufferSize;
+
+            error = MP4ComposeWriteAudioDecoderSpecificInfo(iMP4Handle,
+                                                            (mp4_u8 *)aBuffer->Data().Ptr(),
+                                                            (mp4_u32)iBufferSize);
+            PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteAudioDecoderSpecificInfo, error=%d"), error));
+            if (error != MP4_OK)
+                {
+                User::Leave(KErrGeneral);
+                }
+
+			PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteAudioDecoderSpecificInfo - flags: iFileCodecType=%d Frameduration=%d"), iFileCodecType, iAudioAACFrameDuration));
+            if ( (iFileCodecType & MP4_TYPE_MPEG4_AUDIO) && !iAudioAACFrameDuration )
+                {
+				PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteAudioDecoderSpecificInfo determining new AAC samplerate."), error));
+                DetermineAACFrameDurationL( aBuffer );
+                // done here because timescale is dependent of samplerate.
+                error = MP4ComposeAddAudioDescription(iMP4Handle,
+                                                     (mp4_u32)iAudioAACSamplerate,
+                                                     (mp4_u8)KAACAudioFramesPerSample,
+                                                     (mp4_u16)KAudioModeSet);
+                if (error != MP4_OK)
+                    {
+                    PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeAddAudioDescription, error=%d"), error));
+                    User::Leave(KErrGeneral);
+                    }
+                }
+			PRINT((_L("CCamC3GPDataSinkImp::WriteBufferL MP4ComposeWriteAudioDecoderSpecificInfo out"), error));
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::SetVideoFrameSize
+//
+// Give video frame size to sink.
+// -----------------------------------------------------------------------------
+//
+TInt CCamC3GPDataSinkImp::SetVideoFrameSize(TSize aSize)
+    {
+    if (aSize.iWidth < 0)
+        {
+        return KErrArgument;
+        }
+    if (aSize.iHeight < 0)
+        {
+        return KErrArgument;
+        }
+
+    if (iBytesReceived)
+        {
+        return KErrNotReady;
+        }
+
+    iVideoXResolution = aSize.iWidth;
+    iVideoYResolution = aSize.iHeight;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::SetAverageVideoBitRate
+//
+// Give average video bitrate to sink.
+// -----------------------------------------------------------------------------
+//
+TInt CCamC3GPDataSinkImp::SetAverageVideoBitRate(TInt aBitRate)
+    {
+    if (aBitRate < 0)
+        {
+        return KErrArgument;
+        }
+
+    iVideoAverageBitRate = aBitRate;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::SetMaxVideoBitRate
+//
+// Give maximum video bitrate to sink.
+// -----------------------------------------------------------------------------
+//
+TInt CCamC3GPDataSinkImp::SetMaxVideoBitRate(TInt aBitRate)
+    {
+    if (aBitRate < 0)
+        {
+        return KErrArgument;
+        }
+
+    iVideoMaxBitRate = aBitRate;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::SetAverageAudioBitRate
+//
+// Give average audio bitrate to sink.
+// -----------------------------------------------------------------------------
+//
+TInt CCamC3GPDataSinkImp::SetAverageAudioBitRate(TInt aBitRate)
+    {
+    if (aBitRate < 0)
+        {
+        return KErrArgument;
+        }
+
+    iAudioAverageBitRate = aBitRate;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::CurrentFileSize
+//
+// Estimate current output file size.
+// Total file size = metadata size + media data size
+// -----------------------------------------------------------------------------
+//
+TUint CCamC3GPDataSinkImp::CurrentFileSize() const
+    {
+    TUint filesize = 0;
+
+    // Media data
+    filesize += 8; // mdat box type and size
+    filesize += iBytesReceived; // Data received from media recorder
+
+    return filesize;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::CurrentMetadataSize
+//
+// Calculates current metadata size.
+// -----------------------------------------------------------------------------
+//
+TUint CCamC3GPDataSinkImp::CurrentMetadataSize() const
+    {
+    TBool haveAudio;
+    TBool haveVideo;
+    TUint metadatasize = 0;
+
+    haveAudio = EFalse;
+    haveVideo = EFalse;
+
+
+    // Metadata
+
+    metadatasize += KFTYPSize; // FTYP
+
+    if ((iFileCodecType & MP4_TYPE_H263_PROFILE_0) ||
+        (iFileCodecType & MP4_TYPE_H263_PROFILE_3)) // H.263
+        {
+        haveVideo = ETrue;
+        metadatasize += 574; // Constant size H.263 metadata
+        metadatasize += (iVideoFrameNumber * 16 + iVideoIntraFrameNumber * 4); // Content dependent H.263 metadata
+        }
+
+    if (iFileCodecType & MP4_TYPE_MPEG4_VIDEO) // MPEG-4 video
+        {
+        haveVideo = ETrue;
+        metadatasize += 596; // Constant size MPEG-4 video metadata
+        metadatasize += (iVideoFrameNumber * 16 + iVideoIntraFrameNumber * 4 + (TUint)iVideoDecSpecInfoSize); // Content dependent MPEG-4 video metadata
+        }
+
+    if ( iFileCodecType & MP4_TYPE_AMR_NB ) // AMR-NB
+        {
+        haveAudio = ETrue;
+        metadatasize += 514; // Constant size AMR metadata
+        metadatasize += ((iAudioFrameNumber + KAMRAudioFramesPerSample - 1) / KAMRAudioFramesPerSample) * 16;
+        }
+
+    if ( iFileCodecType & MP4_TYPE_MPEG4_AUDIO ) // MPEG-4 AAC-LC
+        {
+        haveAudio = ETrue;
+        metadatasize += 514; // Constant size metadata
+        metadatasize += (iAudioFrameNumber * 16) + (TUint)iAudioDecSpecInfoSize;
+        }
+
+    if (haveAudio && haveVideo)
+        metadatasize -= 116; // There is only one moov and mvhd in a file
+
+    return metadatasize;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::DriveFreeSpaceL
+//
+// Calculate free space on a drive in bytes.
+// -----------------------------------------------------------------------------
+//
+TInt64 CCamC3GPDataSinkImp::DriveFreeSpaceL()
+    {
+    TVolumeInfo volumeinfo;
+
+    if (iFreeDiskSpaceCounter % KFreeDiskSpaceCounter == 0)
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::DriveFreeSpaceL Asking Disk Free space")));
+        User::LeaveIfError(iFS->Volume(volumeinfo, iDriveNumber));
+        iFreeDiskSpace = volumeinfo.iFree;
+        PRINT((_L("CCamC3GPDataSinkImp::DriveFreeSpaceL Received Disk Free space info")));
+        }
+
+    iFreeDiskSpaceCounter++;
+    return iFreeDiskSpace;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::DetermineAACFrameDuration
+//
+// Determines AAC audio frame duration.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::DetermineAACFrameDurationL( CCMRMediaBuffer* aBuffer )
+    {
+    TInt sampleRate = 0;
+    TUint8 sampleRateIndex = *aBuffer->Data().Mid(0).Ptr();
+    sampleRateIndex <<= 5;
+    sampleRateIndex >>= 4;
+    sampleRateIndex |= ((TUint8)*aBuffer->Data().Mid(1).Ptr())>>7;
+
+    switch ( sampleRateIndex )
+        {
+        case 0x3:
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::DetermineAACFrameDurationL AAC Samplerate reset to 48000")));
+            sampleRate = 48000;
+            break;
+            }
+        case 0x5:
+            {
+			PRINT((_L("CCamC3GPDataSinkImp::DetermineAACFrameDurationL AAC Samplerate reset to 32000")));
+            sampleRate = 32000;
+            break;
+            }
+        case 0x6:
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::DetermineAACFrameDurationL AAC Samplerate reset to 24000")));
+            sampleRate = 24000;
+            break;
+            }
+        case 0x8:
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::DetermineAACFrameDurationL AAC Samplerate reset to 16000")));
+            sampleRate = 16000;
+            break;
+            }
+        case 0xb:
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::DetermineAACFrameDurationL AAC Samplerate reset to 8000")));
+            sampleRate = 8000;
+            break;
+            }
+        default:
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::DetermineAACFrameDurationL unsupported AAC Samplerate - leaving -6")));
+            User::Leave( KErrArgument );
+            break;
+            }
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::DetermineAACFrameDurationL AAC Samplerate reset from %d to %d"), iAudioAACSamplerate, sampleRate));
+    iAudioAACSamplerate = sampleRate;
+    // formula to calculate frameduration from samplerate is: frameduration = (1024/samplerate)*1000
+    // and in movie timescale: frameDurationInMovieTimescale = frameduration*samplerate/1000
+    // thus with equal samplerate = timescale frameDurationInMovieTimescale for AAC is always 1024
+    iAudioAACFrameDuration = 1024;
+}
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::ConvertAVCHeaderL
+//
+// Convert AVC specific decoder config info to
+// AVC Decoder Configuration Record -format
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::ConvertAVCHeaderNALL( CCMRMediaBuffer* aBuffer, TDes8& aDstBuf )
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderNALL in Buffer length: %d"), aBuffer->Data().Length() ));    
+	TUint8* inputPtr = (TUint8*)(aBuffer->Data().Ptr());
+    TUint8* outputPtr = (TUint8*)(aDstBuf.Ptr());
+    TUint8* spsPtr;
+    TUint8* ppsPtr;
+
+    TUint numSPS = 0;
+    TUint numPPS = 0;
+
+    TUint totalSPSLength = 0;
+    TUint totalPPSLength = 0;
+
+    TUint headerLength = aBuffer->Data().Length();
+    TUint endIndex = headerLength;
+
+   	TInt nalType = 0;
+   	TUint nalLength;
+   	TUint nalIndex;
+    TUint nalOffset;
+
+   	// Allocate memory for the temporary buffers
+   	HBufC8* temp1 = (HBufC8*) HBufC8::NewLC(1000);
+   	HBufC8* temp2 = (HBufC8*) HBufC8::NewLC(5000);
+
+    spsPtr = const_cast<TUint8*>( temp1->Des().Ptr() );
+    ppsPtr = const_cast<TUint8*>( temp2->Des().Ptr() );
+
+    TUint numNalUnits = inputPtr[endIndex-4] + (inputPtr[endIndex-3]<<8) + (inputPtr[endIndex-2]<<16) + (inputPtr[endIndex-1]<<24);
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderNALL Nal Unit count: %d"), numNalUnits));    
+    
+	// Move endIndex to point to the first NAL unit's offset information
+    endIndex = headerLength - numNalUnits*8 - 4;
+	nalIndex = 0;
+
+	while (nalIndex < numNalUnits)
+        {
+    	nalIndex++;
+
+    	TInt tmp1 = inputPtr[endIndex++];
+        TInt tmp2 = inputPtr[endIndex++]<<8;
+        TInt tmp3 = inputPtr[endIndex++]<<16;
+        TInt tmp4 = inputPtr[endIndex++]<<24;
+
+    	nalOffset = tmp1 + tmp2 + tmp3 + tmp4;
+        PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderNALL Nal Unit start offset: %d"), nalOffset));    	
+
+    	tmp1 = inputPtr[endIndex++];
+        tmp2 = inputPtr[endIndex++]<<8;
+        tmp3 = inputPtr[endIndex++]<<16;
+        tmp4 = inputPtr[endIndex++]<<24;
+
+    	nalLength = tmp1 + tmp2 + tmp3 + tmp4;
+        PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderNALL Nal Unit length: %d"), nalLength));    	
+
+	   	nalType = inputPtr[nalOffset] & 0x1F;
+        PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderNALL Nal Unit type: %d"), nalType));
+        
+	   	if(nalType == 7)
+		    {
+	   		numSPS++;
+
+		    // First store the SPS unit length with two bytes
+   			spsPtr[totalSPSLength] = (nalLength >> 8) & 0xFF;
+    		spsPtr[totalSPSLength+1] = nalLength & 0xFF;
+
+			// Copy the SPS unit to the buffer
+			Mem::Copy(&spsPtr[totalSPSLength+2], inputPtr+nalOffset , nalLength);
+	        PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderNALL stored SPS from offset: %d size: %d"), inputPtr+nalOffset, nalLength));			
+			totalSPSLength += nalLength + 2;	// Two more for the size
+		    }
+  		else if(nalType == 8)
+   		    {
+			numPPS++;
+
+		    // First store the SPS unit length with two bytes
+   			ppsPtr[totalPPSLength] = (nalLength >> 8) & 0xFF;
+    		ppsPtr[totalPPSLength+1] = nalLength & 0xFF;
+
+			// Copy the SPS unit to the buffer
+			Mem::Copy(&ppsPtr[totalPPSLength+2], inputPtr+nalOffset , nalLength);
+            PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderNALL stored PPS from offset: %d size: %d"), inputPtr+nalOffset, nalLength));			
+			totalPPSLength += nalLength + 2;	// Two more for the size
+	   	    }
+		else
+   		    {
+   		    }
+        }
+
+	// When the header has been parsed, form the AVC Decoder Configuration Record
+	outputPtr[0] = 0x01;	// configurationVersion
+	// AVCProfileIndication contains the profile code as defined in the AVC specification
+    if (iFileCodecType & MP4_TYPE_AVC_PROFILE_BASELINE)
+        {
+        outputPtr[1] = 0x42;
+        outputPtr[2] = 0x80;    // Bitstream obeys all Baseline profile constraints.
+        // Profile compatibility, i.e. all 4 constrain set flags + reserved 4 zero bits
+        if ( iAVCOutputLevel == 101 )
+            {
+            outputPtr[2] |= 0x10; // For level 1b, the 4th bit shall be == 1, otherwise it must be zero
+            }
+        // AVCLevelIndication contains the level code as defined in the AVC specification
+        outputPtr[3] = (iAVCOutputLevel == 101) ? 0x0B : iAVCOutputLevel;
+        }
+    else if (iFileCodecType & MP4_TYPE_AVC_PROFILE_MAIN)
+        {
+        outputPtr[1] = 0x4D;
+        outputPtr[2] = 0x40;    // Bitstream obeys all main profile constraints.
+        if ( iAVCOutputLevel == 101 )
+            {
+            outputPtr[2] |= 0x10; // For level 1b, the 4th bit shall be == 1, otherwise it must be zero
+            }
+        // AVCLevelIndication contains the level code as defined in the AVC specification
+        outputPtr[3] = (iAVCOutputLevel == 101) ? 0x0B : iAVCOutputLevel;
+        }
+    else if (iFileCodecType & MP4_TYPE_AVC_PROFILE_HIGH)
+        {
+        outputPtr[1] = 0x64;
+        outputPtr[2] = 0x40;    // Bitstream obeys all Baseline profile constraints.
+        outputPtr[3] = (iAVCOutputLevel == 101) ? 0x09 : iAVCOutputLevel;
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+	// lengthSizeMinusOne indicates the length in bytes of the NALUnitLength field minus one.
+	outputPtr[4] = 0x03; // 4 bytes
+	outputPtr[4] |= 0x0FC; // 6 reserved bits (all 1)
+	// numOfSequenceParameterSets indicates the number of sequence parameter sets
+	outputPtr[5] = numSPS;
+	outputPtr[5] |= 0xE0;  // 3 reserved bits (all 1)
+
+	TInt len = 6;
+	// Copy the SPS unit(s) to the buffer
+	Mem::Copy(&outputPtr[6], spsPtr , totalSPSLength);
+	len += totalSPSLength;
+	outputPtr[6+totalSPSLength] = numPPS;
+	len += 1;
+
+	// Copy the PPS unit(s) to the buffer
+	Mem::Copy(&outputPtr[6+totalSPSLength+1], ppsPtr , totalPPSLength);
+	len += totalPPSLength;
+	aDstBuf.SetLength(len);
+
+	CleanupStack::PopAndDestroy(temp2);
+	CleanupStack::PopAndDestroy(temp1);
+}
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL
+//
+// Convert AVC specific decoder config info  from Bytestream (ElementaryStream) encapsulation to
+// AVC Decoder Configuration Record -format
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL( CCMRMediaBuffer* aBuffer, TDes8& aDstBuf )
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL in")));
+	TUint8* inputPtr = (TUint8*)(aBuffer->Data().Ptr());
+    TUint8* outputPtr = (TUint8*)(aDstBuf.Ptr());
+    TUint8* spsPtr;
+    TUint8* ppsPtr;
+
+    TUint numSPS = 0;
+    TUint numPPS = 0;
+
+    TUint totalSPSLength = 0;
+    TUint totalPPSLength = 0;
+
+    TUint headerLength = aBuffer->Data().Length();
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL buffer length: %d"), headerLength));
+
+   	TInt nalType = 0;
+
+   	// Allocate memory for the temporary buffers
+   	HBufC8* temp1 = (HBufC8*) HBufC8::NewLC(1000);
+   	HBufC8* temp2 = (HBufC8*) HBufC8::NewLC(5000);
+
+    spsPtr = const_cast<TUint8*>( temp1->Des().Ptr() );
+    ppsPtr = const_cast<TUint8*>( temp2->Des().Ptr() );
+
+    // scan from beginning of buffer to end for SPS and PSP
+    TInt i = 0;
+    TInt j = 0;
+    for (i=0; i<headerLength; i++)
+    	{
+    	if ( inputPtr[i] == 0 &&
+    		 inputPtr[i+1] == 0 &&
+    		 inputPtr[i+2] == 0 &&
+    		 inputPtr[i+3] == 1 )
+    		{ // found bytestream header [00 00 00 01]
+    	    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL found header at: %d"), i));
+    	   	nalType = inputPtr[i+4] & 0x1F;
+            PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL NAL type: %d"), nalType));
+    	   	if(nalType == 7) // SPS
+    	   		{
+    	   		numSPS++;
+    	   		// find length of SPS
+    	   		TInt j;
+    	   		for (j=4; i+j+3<headerLength; j++)
+    	   			{
+    	   	    	if ( inputPtr[i+j] == 0 &&
+    	   	    		 inputPtr[i+j+1] == 0 &&
+    	   	    		 inputPtr[i+j+2] == 0 &&
+    	   	    		 inputPtr[i+j+3] == 1 )
+    	   	    		{
+    	   	    		totalSPSLength = j-i-4;
+    	   	            PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL SPS length: %d, count: %d"), totalSPSLength, numSPS));
+    	   	    		break;
+    	   	    		}
+    	   			}
+    	   		// if we didn't find next bytestream header then this is last buffer
+    	   		if ( totalSPSLength == 0 )
+    	   			{
+    	   			totalSPSLength = headerLength - i - 4;
+                    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL SPS length: %d (last), count: %d"), totalSPSLength, numSPS));
+    	   			}
+
+    		    // First store the SPS unit length with two bytes
+       			spsPtr[0] = (totalSPSLength >> 8) & 0xFF;
+        		spsPtr[1] = totalSPSLength & 0xFF;
+
+        		// Copy the SPS unit to the buffer
+    			Mem::Copy(&spsPtr[2], &inputPtr[i+4] , totalSPSLength);
+    			totalSPSLength +=2;
+    	   		}
+    	   	else if ( nalType == 8 ) // PPS)
+    	   		{
+    	   		numPPS++;
+    	   		// find length of PPS
+    	   		for (j=4; i+j+3<headerLength; j++)
+    	   			{
+    	   	    	if ( inputPtr[i+j] == 0 &&
+    	   	    		 inputPtr[i+j+1] == 0 &&
+    	   	    		 inputPtr[i+j+2] == 0 &&
+    	   	    		 inputPtr[i+j+3] == 1 )
+    	   	    		{
+    	   	    		totalPPSLength = j-i-4;
+                        PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL PPS length: %d, count: %d"), totalPPSLength, numPPS));
+    	   	    		break;
+    	   	    		}
+    	   			}
+    	   		// if we didn't find next bytestream header then this is last buffer
+    	   		if ( totalPPSLength == 0 )
+    	   			{
+    	   			totalPPSLength = headerLength - i - 4;
+                    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL PPS length: %d (last), count: %d"), totalPPSLength, numPPS));
+    	   			}
+
+    		    // First store the SPS unit length with two bytes
+    	   		ppsPtr[0] = (totalPPSLength >> 8) & 0xFF;
+    	   		ppsPtr[1] = totalPPSLength & 0xFF;
+
+    			// Copy the SPS unit to the buffer
+    			Mem::Copy(&ppsPtr[2], &inputPtr[i+4], totalPPSLength);
+    	   		totalPPSLength +=2;
+    	   		}
+    		}
+    	}
+
+	// When the header has been parsed, form the AVC Decoder Configuration Record
+	outputPtr[0] = 0x01;	// configurationVersion
+    // AVCProfileIndication contains the profile code as defined in the AVC specification
+    if (iFileCodecType & MP4_TYPE_AVC_PROFILE_BASELINE)
+        {
+        outputPtr[1] = 0x42;
+        outputPtr[2] = 0x80;    // Bitstream obeys all Baseline profile constraints.
+        // Profile compatibility, i.e. all 4 constrain set flags + reserved 4 zero bits
+        if ( iAVCOutputLevel == 101 )
+            {
+            outputPtr[2] |= 0x10; // For level 1b, the 4th bit shall be == 1, otherwise it must be zero
+            }
+        // AVCLevelIndication contains the level code as defined in the AVC specification
+        outputPtr[3] = (iAVCOutputLevel == 101) ? 0x0B : iAVCOutputLevel;
+        }
+    else if (iFileCodecType & MP4_TYPE_AVC_PROFILE_MAIN)
+        {
+        outputPtr[1] = 0x4D;
+        outputPtr[2] = 0x40;    // Bitstream obeys all main profile constraints.
+        if ( iAVCOutputLevel == 101 )
+            {
+            outputPtr[2] |= 0x10; // For level 1b, the 4th bit shall be == 1, otherwise it must be zero
+            }
+        // AVCLevelIndication contains the level code as defined in the AVC specification
+        outputPtr[3] = (iAVCOutputLevel == 101) ? 0x0B : iAVCOutputLevel;
+        }
+    else if (iFileCodecType & MP4_TYPE_AVC_PROFILE_HIGH)
+        {
+        outputPtr[1] = 0x64;
+        outputPtr[2] = 0x40;    // Bitstream obeys all Baseline profile constraints.
+        outputPtr[3] = (iAVCOutputLevel == 101) ? 0x09 : iAVCOutputLevel;
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+	// lengthSizeMinusOne indicates the length in bytes of the NALUnitLength field minus one.
+	outputPtr[4] = 0x03; // 4 bytes
+	outputPtr[4] |= 0x0FC; // 6 reserved bits (all 1)
+	// numOfSequenceParameterSets indicates the number of sequence parameter sets
+	outputPtr[5] = numSPS;
+	outputPtr[5] |= 0xE0;  // 3 reserved bits (all 1)
+
+	TInt len = 6;
+
+	// Copy the SPS unit(s) to the buffer
+	Mem::Copy(&outputPtr[6], spsPtr , totalSPSLength);
+	len += totalSPSLength;
+	outputPtr[6+totalSPSLength] = numPPS;
+	len += 1;
+
+	// Copy the PPS unit(s) to the buffer
+	Mem::Copy(&outputPtr[6+totalSPSLength+1], ppsPtr , totalPPSLength);
+	len += totalPPSLength;
+	aDstBuf.SetLength(len);
+
+	CleanupStack::PopAndDestroy(temp2);
+	CleanupStack::PopAndDestroy(temp1);
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertAVCHeaderByteStreamL out")));
+}
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL
+//
+// Converts AVC frame from Bytestream (ElementaryStream) encapsulation to
+// file format AVC sample structure by replacing bytestream headers with NAL unit sizes.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizes( CCMRMediaBuffer* aBuffer )
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL in")));
+    TUint8* inputPtr = (TUint8*)(aBuffer->Data().Ptr());
+    TUint headerLength = aBuffer->Data().Length();
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL buffer length: %d"), headerLength));
+
+    TInt nalLength = 0;
+    TBool moreThanOneNAL = EFalse;
+    TInt i = 0;
+    TInt j = 0;
+    for (i=0; i<headerLength; i++)
+        {
+        if ( inputPtr[i] == 0 &&
+             inputPtr[i+1] == 0 &&
+             inputPtr[i+2] == 0 &&
+             inputPtr[i+3] == 1 )
+            { // found bytestream header [00 00 00 01]
+            PRINT((_L("CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL found header at: %d"), i));
+            PRINT((_L("CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL NAL type: %d"), TInt(inputPtr[i+4] & 0x1F) ));
+            if (moreThanOneNAL)
+                {// we found start of next NAL unit in memory buffer so update previous size
+                nalLength = i-j-4; // 4 is the bytestream header
+                PRINT((_L("CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL NAL length: %d"), nalLength));
+                inputPtr[j] = TUint8((nalLength >> 24) & 0xff);
+                inputPtr[j+1] = TUint8((nalLength >> 16) & 0xff);
+                inputPtr[j+2] = TUint8((nalLength >> 8) & 0xff);
+                inputPtr[j+3] = TUint8(nalLength & 0xff);
+                }
+            moreThanOneNAL = ETrue;
+            j=i;
+            }
+        }
+    // and update last (or if only 1 NAL size:
+    nalLength = headerLength-j-4; // 4 is the bytestream header
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL last NAL length: %d"), nalLength));
+    inputPtr[j] = TUint8((nalLength >> 24) & 0xff);
+    inputPtr[j+1] = TUint8((nalLength >> 16) & 0xff);
+    inputPtr[j+2] = TUint8((nalLength >> 8) & 0xff);
+    inputPtr[j+3] = TUint8(nalLength & 0xff);
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertBytestreamHeadersToNALSizesL out")));
+}
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes
+//
+// Converts AVC frame from NAL (EGenericPayload) encapsulation to
+// file format AVC sample structure by replacing NAL encapsulation with NAL unit sizes.
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes( CCMRMediaBuffer* aBuffer )
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes in")));
+    TUint8* inputPtr = (TUint8*)(aBuffer->Data().Ptr());
+    TUint bufferLength = aBuffer->Data().Length();
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes buffer length: %d"), bufferLength));
+
+    // Offset to the end and get NAL unit count
+    TInt offset = bufferLength-4; //last 4 bytes are the NAL unit count
+    TInt nalCount = TInt(inputPtr[offset]) +
+                   (TInt(inputPtr[offset + 1]) << 8) +
+                   (TInt(inputPtr[offset + 2]) << 16) +
+                   (TInt(inputPtr[offset + 3]) << 24);
+
+    TInt frameStart = 0;
+    TInt frameSize = 0;
+    TInt outputOffset = 0;
+    for(TInt i=0; i<nalCount; i++)
+        {//go through all NAL units in buffer
+        // Offset to the start of NAL Unit infos
+        offset = bufferLength-4-(8*nalCount); // 4 is the NAL unit count at end of buffer, 8 bytes used per NAL Unit for FrameStartOffset and FrameSize.
+
+        // Get frame start offset
+        offset += 8*i;
+        frameStart = TInt(inputPtr[offset]) +
+                    (TInt(inputPtr[offset + 1]) << 8) +
+                    (TInt(inputPtr[offset + 2]) << 16) +
+                    (TInt(inputPtr[offset + 3]) << 24);
+
+        PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes() NAL unit %d frame start: %d "), i, frameStart ));
+
+        // Get frame size
+        offset += 4;
+        frameSize = TInt(inputPtr[offset]) +
+                   (TInt(inputPtr[offset + 1]) << 8) +
+                   (TInt(inputPtr[offset + 2]) << 16) +
+                   (TInt(inputPtr[offset + 3]) << 24);
+
+       PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes() NAL unit %d frame size: %d "), i, frameSize ));
+       PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes() NAL unit %d type: %d "), i, TInt(inputPtr[frameStart] & 0x1F) ));
+
+       iVideoBuffer[outputOffset] = TUint8((frameSize >> 24) & 0xff);
+       iVideoBuffer[outputOffset+1] = TUint8((frameSize >> 16) & 0xff);
+       iVideoBuffer[outputOffset+2] = TUint8((frameSize >> 8) & 0xff);
+       iVideoBuffer[outputOffset+3] = TUint8(frameSize & 0xff);
+
+       Mem::Copy(iVideoBuffer+outputOffset+4, inputPtr+frameStart, frameSize);
+       outputOffset += 4 + frameSize; // 4 bytes for length information.
+       }
+    iVideoBufferFrameSize = outputOffset;
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes() new video buffer size: %d "), iVideoBufferFrameSize ));
+    PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName( MP4FileName tempFileName )
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName entering, tempFileName=%x, file count=%d"),tempFileName, iDeleteFileQueue->Count()));
+    MP4FileName* tempFileNamePtr = NULL;
+    TInt result = KErrNoMemory;
+
+    // Add image to the queue.
+    tempFileNamePtr = new MP4FileName;
+    PRINT((_L("CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName tempFileName=%x, tempFileNamePtr=%x"), tempFileName, tempFileNamePtr));
+    if ( tempFileNamePtr && iDeleteFileQueue )
+        {
+        *tempFileNamePtr = tempFileName;
+        result = iDeleteFileQueue->Append( tempFileNamePtr );
+        }
+    if ( result != KErrNone ) // Append failed -> do sync remove
+        {
+        TInt err = wremove( tempFileName );
+        PRINT((_L("CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName wremove sync err=%d, tempFileName=%x"), err, tempFileName));
+        free(tempFileName);
+        tempFileName = 0;
+        if ( tempFileNamePtr )
+            {
+            delete tempFileNamePtr;
+            tempFileNamePtr = 0;
+            }
+        }
+    else  // Append OK, start async delete if not running already
+        {
+        if (iDeleteFileQueue->Count())
+            {
+
+            if ( !iIdleDelete->IsActive() )
+                {
+                PRINT((_L("CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName() Start IdleDelete, file count=%d"), iDeleteFileQueue->Count()));
+                iIdleDelete->Start( TCallBack( IdleDelete, this ) );
+                }
+            }
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName exiting")));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::IdleDelete
+// ---------------------------------------------------------------------------
+//
+TInt CCamC3GPDataSinkImp::IdleDelete( TAny* aCont )
+    {
+    CCamC3GPDataSinkImp* appCont = static_cast<CCamC3GPDataSinkImp*>( aCont );
+    return ( appCont->DoIdleDelete() );
+    }
+
+// ---------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::DoIdleDelete
+// ---------------------------------------------------------------------------
+//
+TInt CCamC3GPDataSinkImp::DoIdleDelete()
+    {
+    PRINT((_L("CCamC3GPDataSinkImp::DoIdleDelete() in, file count=%d"), iDeleteFileQueue->Count()));
+    TInt err = KErrNone;
+    MP4FileName tempFileName;
+    TInt filesLeft = EFalse;
+
+    // Delete one file from queue
+    if ( iDeleteFileQueue )
+        {
+        if ( iDeleteFileQueue->Count() )
+            {
+            tempFileName = *(*iDeleteFileQueue)[0];
+            PRINT((_L("CCamC3GPDataSinkImp::DoIdleDelete index 0:tempFileName=%x %s"), tempFileName, tempFileName));
+            delete (*iDeleteFileQueue)[0];
+            iDeleteFileQueue->Remove( 0 );
+            err = wremove( tempFileName );
+            PRINT((_L("CCamC3GPDataSinkImp::DoIdleDelete wremove async err=%d, tempFileName=%x %s"), err, tempFileName, tempFileName));
+            err++; // remove compiler warning
+            free(tempFileName);
+            tempFileName = 0;
+            }
+
+        // Start next deletion if queue is not empty
+        if ( iDeleteFileQueue->Count() )
+            {
+            PRINT((_L("CCamC3GPDataSinkImp::DoIdleDelete() continue, file count=%d"), iDeleteFileQueue->Count()));
+            filesLeft = ETrue;
+            }
+        }
+
+    PRINT((_L("CCamC3GPDataSinkImp::DoIdleDelete() out")));
+    return ( filesLeft );
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Bmarm/CAMCMEDIARECORDERU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	NewL__17CCMRMediaRecorder @ 1 NONAME R3UNUSED ; CCMRMediaRecorder::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Bwins/CAMCMEDIARECORDERU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CCMRMediaRecorder@@SAPAV1@XZ @ 1 NONAME ; class CCMRMediaRecorder * CCMRMediaRecorder::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/EABI/CamcMediaRecorderU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,2 @@
+EXPORTS
+	_ZN17CCMRMediaRecorder4NewLEv @ 1 NONAME
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: mediarecorder bld.inf
+*
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_MMPFILES
+MediaRecorder.mmp
+
+// Separate MMP files for creating *.LIBs
+MediaRecorderLib.mmp
+
+PRJ_EXPORTS
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Group/mediarecorder.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*    The media recorder DLL project definition file
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+NOEXPORTLIBRARY
+
+TARGET          CamcMediaRecorder.dll
+TARGETTYPE      dll
+
+UID             0x1000008d 0x101F8507   //KSharedLibraryUid
+VENDORID        VID_DEFAULT
+CAPABILITY 		CAP_GENERAL_DLL
+
+SOURCEPATH      ../Src
+USERINCLUDE     ../Inc
+USERINCLUDE	    ../../../inc   // ADo level inc dir
+USERINCLUDE     ../traces      // OST traces
+
+// Default system include paths for application layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+
+// Testing options
+
+// read input frames from a file (epoc32/wins/c/testin.raw)
+//MACRO           VIDEO_FILE_INPUT
+//#define         VIDEO_FILE_INPUT
+
+// Write captured frames to a file (epoc32/wins/c/vidrec_out.bin)
+//MACRO           VIDEO_FILE_OUTPUT
+//#define         VIDEO_FILE_OUTPUT
+
+// Write video bitstream to a file (epoc32/wins/c/vidrec_out.bin)
+//MACRO           VIDEO_BS_FILE_OUTPUT
+//#define         VIDEO_BS_FILE_OUTPUT
+
+// NOTE: Only one of the above two options can be set on at a time..
+
+// Write audio (bitstream) to a file (epoc32/wins/c/audiorec_out.bin)
+//MACRO           AUDIO_FILE_OUTPUT
+//#define         AUDIO_FILE_OUTPUT
+
+
+// Symbian OS libraries
+LIBRARY     euser.lib 
+LIBRARY     ecam.lib 
+LIBRARY     ecom.lib
+LIBRARY     mmfserverbaseclasses.lib
+LIBRARY     mmfcontrollerframework.lib
+LIBRARY     mmfdevsound.lib 
+LIBRARY     bafl.lib
+LIBRARY     devvideo.lib
+LIBRARY     SpeechEncoderConfig.lib
+LIBRARY		imagingconfigmanager.lib
+LIBRARY		AudioInputRouting.lib
+
+
+#if defined VIDEO_FILE_INPUT || defined VIDEO_FILE_OUTPUT || defined VIDEO_BS_FILE_OUTPUT || defined AUDIO_FILE_OUTPUT
+LIBRARY         efsrv.lib 
+#endif
+
+// The media recorder components
+SOURCE CCMRMediaRecorderImp.cpp
+SOURCE CCMRMDFVideoRecorder.cpp
+SOURCE CCMRFifo.cpp
+
+#ifndef VIDEO_FILE_INPUT
+SOURCE CCMRVideoCameraSource.cpp
+#else
+SOURCE CCMRVideoFileSource.cpp
+#endif
+
+SOURCE CCMRFrameBuffer.cpp
+SOURCE CCMRAudioRecorder.cpp
+SOURCE CCMRAudioCodecs.cpp
+#ifdef __MPEG4_AAC_ENCODING
+SOURCE CCMRAacCodecData.cpp
+#else
+SOURCE CCMRAacCodecDataStub.cpp
+#endif
+// AMR audio classes
+SOURCE CCMRAMRNBCodecData.cpp
+SOURCE CCMRAudioInput.cpp
+SOURCE CCMRAudioInputSW.cpp
+SOURCE CCMRAudioInputHW.cpp
+
+SOURCE CCMRActiveOutput.cpp
+
+SOURCE CCMRSubThread.cpp
+SOURCE CCMRAudioThreadProxy.cpp
+SOURCE CCMRAudioThreadProxyServer.cpp
+SOURCE CCMRAudioThreadProxySession.cpp
+
+SOURCE CCMRVideoRecorderClient.cpp
+SOURCE CCMRVideoThreadProxy.cpp
+SOURCE CCMRVideoThreadProxyServer.cpp
+SOURCE CCMRVideoThreadProxySession.cpp
+
+#ifdef __MPEG4_VIDEO_ENCODING
+SOURCE CCMRVideoCodecsMPEG4.cpp
+#else
+SOURCE CCMRVideoCodecsBasic.cpp
+#endif
+
+SOURCE CCMRVideoCodecDataH263.cpp
+SOURCE CCMRVideoCodecDataMPEG4.cpp
+SOURCE CCMRVideoCodecDataH264AVC.cpp
+
+SOURCE CCMRPerfMonitor.cpp
+SOURCE CCMRConfigManager.cpp
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Group/mediarecorderLib.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*    The media recorder DLL project definition file
+*
+*/
+
+
+TARGET          CamcMediaRecorder.lib
+TARGETTYPE      IMPLIB
+UID             0x1000008d 0x101F8507   //KSharedLibraryUid
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAMRNBCodecData.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for AMR audio codec data class
+*
+*/
+
+
+#ifndef CCMRAMRNBCODECDATA_H
+#define CCMRAMRNBCODECDATA_H
+
+// INCLUDES
+#include "CCMRAudioCodecData.h"
+
+
+// CONSTANTS
+// this is the max buffer size that the corresponding HW codec implementation will output, so it is not necessarily == 1 * AMR framelength
+const TInt KCMRMaxAMRNBBufferLength = 32;
+
+// Uid of the AMRNB CMMFCodec
+const TUid KCMRAMRSWCodecUid = {0x101FAF68};    //KAdvancedUidCodecPCM16ToAMR
+
+// FORWARD DECLARATIONS
+class TCMRAudioEncParams;
+// CLASS DECLARATION
+
+
+
+
+/**
+*  Base class for audio codec data
+*
+*  @lib
+*  @since 2.6
+*/
+class CCMRAMRNBCodecData : public CCMRAudioCodecData
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CCMRAMRNBCodecData(TCMRCodecType aType);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRAMRNBCodecData();
+
+    public: // functions from baseclass
+
+        /**
+        * From CCMRAudioCodecData Check if the codec is supported in this configuration
+        * @return TBool ETrue if supported
+        */
+        TBool Supported();
+
+        /**
+        * Return preferred duration of PCM capture in microseconds, relevant only for CMMFCodecs
+        * @return TReal duration in milliseconds
+        */
+        TReal GetPCMCaptureDurationMs() const;
+
+        /**
+        * From CCMRAudioCodecData Set bitrate for the codec
+        * @param aBitRate in bps
+        * @return void
+        */
+        void SetBitRateL(TInt aBitRate);
+
+        /**
+        * From CCMRAudioCodecData Get the current bitrate
+        * @return TInt bitrate in bps
+        */
+        TInt GetBitRateL() const;
+
+        /**
+        * From CCMRAudioCodecData Get the configuration parameters for the codec
+        * @param aDataSource    MMF audio input
+        * @return TDes8* configuration parameter structure
+        */
+        TDes8* GetCodecConfigParamL(MDataSource* aDataSource);
+
+        /**
+        * From CCMRAudioCodecData Reads the framelength from the header of the given buffer
+        * @param const TUint8* aBuf
+        * @param TInt aDataLen
+        * @return TInt frame length in bytes
+        */
+        TInt FrameLength( const TUint8* aBuf, TInt aDataLen  ) const;
+
+        /**
+        * From CCMRAudioCodecData Get the max frame length (single coded frame)
+        * @return TInt framelength in bytes
+        */
+        TInt MaxFrameLengthL() const;
+
+        /**
+        * From CCMRAudioCodecData Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+        * @return TInt Max frame length in bytes
+        */
+        TInt inline MaxBufferLength() const { return KCMRMaxAMRNBBufferLength; };
+
+        /**
+        * From CCMRAudioCodecData Configures sample DevSound HW device
+        * @return TInt error code
+        */
+        TInt AudioHWConfigL(MDataSource* aDataSource, const TDesC8& aParams );
+
+        /**
+        * From CCMRAudioCodecData Configures sample DevSound HW device
+        * @return TUid Uid
+        */
+        inline TUid SWCodecUid() {return KCMRAMRSWCodecUid;} ;
+
+        /**
+        * From CCMRAudioCodecData Preferred samplecount per inputbuffer.
+        * @return TInt samplecount.
+        */
+        TInt PreferredSampleCountPerInputBuffer();
+
+        /**
+        * Get the preferred framecount per PCM inputbuffer.
+        * @return TInt samplecount.
+        */
+        TInt PreferredFrameCountPerInputBuffer();
+    };
+
+#endif      // CCMRAMRNBCODECDATA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAacCodecData.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for AMR audio codec data class
+*
+*/
+
+
+#ifndef CCMRAACCODECDATA_H
+#define CCMRAACCODECDATA_H
+
+// INCLUDES
+#include "CCMRAudioCodecData.h"
+#include "CCMRSupportedCodecs.h"
+
+
+// CONSTANTS
+// this is the max buffer size that the corresponding HW codec implementation will output, so it is not necessarily == 1 framelength
+const TInt KCMRMaxAACBufferLength = 240;
+
+// UId of the AAC CMMFCodec
+const TUid KCMRAACSWCodecUid = {0x1020382F};    //KAdvancedUidCodecPCM16ToAAC
+
+
+// CLASS DECLARATION
+
+
+/**
+*  Base class for audio codec data
+*
+*  @lib
+*  @since 2.6
+*/
+class CCMRAACCodecData : public CCMRAudioCodecData
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CCMRAACCodecData(TCMRCodecType aType);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRAACCodecData();
+
+    public: // functions from baseclass
+
+        /**
+        * From CCMRAudioCodecData Check if the codec is supported in this configuration
+        * @return TBool ETrue if supported
+        */
+        TBool Supported();
+
+        /**
+        * Return frame duration in microseconds
+        * @return TReal duration in microseconds
+        */
+        TReal GetFrameDurationUs() const;
+
+        /**
+        * Return preferred duration of PCM capture in microseconds, relevant only for CMMFCodecs
+        * @return TReal duration in milliseconds
+        */
+        TReal GetPCMCaptureDurationMs() const;
+
+        /**
+        * From CCMRAudioCodecData Set bitrate for the codec
+        * @param aBitRate in bps
+        * @return void
+        */
+        void SetBitRateL(TInt aBitRate);
+
+        /**
+        * From CCMRAudioCodecData Get the current bitrate
+        * @return TInt bitrate in bps
+        */
+        TInt GetBitRateL() const;
+
+        /**
+        * Set sample rate for the codec, leaves by default, but can be overridden, then leaves if not supported
+        */
+        void SetSampleRateL(TUint aSampleRate);
+
+        /**
+        * Return the supported sample rate for the codec
+        * @return TUint sample rate (Hz)
+        */
+        TUint GetSampleRate() const;
+
+        /**
+        * Set channel mode for the codec, leaves by default.
+        */
+        void SetChannelModeL(TUint aChannelMode);
+
+        /**
+        * From CCMRAudioCodecData Get the max frame length (single coded frame)
+        * @return TInt framelength in bytes
+        */
+        TInt MaxFrameLengthL() const;
+
+        /**
+        * From CCMRAudioCodecData Get the configuration parameters for the codec
+        * @param aDataSource    MMF audio input
+        * @return TDes8* configuration parameter structure
+        */
+        TDes8* GetCodecConfigParamL(MDataSource* aDataSource);
+
+        /**
+        * From CCMRAudioCodecData Reads the framelength from the header of the given buffer
+        * @param const TUint8* aBuf
+        * @return TInt frame length in bytes
+        */
+        TInt FrameLength( const TUint8* aBuf, TInt aDataLen ) const;
+
+        /**
+        * From CCMRAudioCodecData Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+        * @return TInt Max frame length in bytes
+        */
+        TInt inline MaxBufferLength() const { return KCMRMaxAACBufferLength; };
+
+        /**
+        * From CCMRAudioCodecData Configures sample DevSound HW device
+        * @since 2.1
+        * @return TInt error code
+        */
+        TInt AudioHWConfigL(MDataSource* aDataSource, const TDesC8& aParams );
+
+        /**
+        * From CCMRAudioCodecData Get the decoder configuration info
+        * @return HBufC8* info structure
+        */
+        HBufC8* GetDecoderConfigInfoLC();
+
+        /**
+        * From CCMRAudioCodecData Configures sample DevSound HW device
+        * @return TUid Uid
+        */
+        inline TUid SWCodecUid() {return KCMRAACSWCodecUid;} ;
+
+        /**
+        * From CCMRAudioCodecData Preferred samplecount per inputbuffer.
+        * @return TInt samplecount.
+        */
+        TInt PreferredSampleCountPerInputBuffer();
+
+        /**
+        * Get the preferred framecount per PCM inputbuffer.
+        * @return TInt samplecount.
+        */
+        TInt PreferredFrameCountPerInputBuffer();
+
+    private:
+
+        // AAC codec interprets the input as array of TInts, not as a class like other codecs
+    	RArray<TInt> iAACConfigData;
+
+        // In AAC, the max allowed bitrate is variable, depends on sampling rate etc. Hence we need member variable instead of const
+        TInt iMaxBitRate;
+
+    };
+
+#endif      // CCMRAMRNBCODECDATA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRActiveOutput.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definitions for an active object outputting data
+*
+*/
+
+
+#ifndef CCMRACTIVEOUTPUT_H
+#define CCMRACTIVEOUTPUT_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CCMRMediaSink.h"
+#include "CCMRMediaSource.h"
+
+
+
+// CLASS DECLARATION
+/**
+*  Observer for active output class. This can't be 
+*  MCMRMediaSource, since CCMRAudioFormatSink is one source and 
+*  it doesn't have any error signalling capabilities
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class MCMRActiveOutputObserver
+    {
+    public:
+        /**
+        * Informs error in the active object
+        * @since 2.1
+        * @param aError Error code
+        */
+        virtual void MaooError(TInt aError) = 0;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Active output class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRActiveOutput : public CActive
+    {
+        
+    public:
+
+        static CCMRActiveOutput* NewL(MCMRMediaSink* aSink, MCMRActiveOutputObserver* aObserver);
+
+        ~CCMRActiveOutput();
+
+    public: // New functions
+
+        /**
+        * Register source (audio or video) for this active object
+        * @since 2.1
+        * @param aSource  source object
+        */
+        virtual void RegisterSourceL(MCMRMediaSource* aSource);
+
+        /**
+        * Start output by giving the first request to registered source
+        * @since 2.1
+        */
+        virtual void Start();
+
+        /**
+        * Stops output, flushes buffer queue
+        * @since 2.1
+        */
+        virtual void Stop();
+
+        /**
+        * Pass video frame size to mediasink
+        * @since 2.1
+        * @param aSize Size
+        * @return TInt Error code
+        */
+        virtual TInt SetVideoFrameSize(TSize aSize);
+
+        /**
+        * Pass average video bitrate to mediasink
+        * @since 2.1
+        * @param aBitRate bitrate
+        * @return TInt Error code
+        */
+        virtual TInt SetAverageVideoBitRate(TInt aBitRate);
+
+        /**
+        * Pass maximum video bitrate to mediasink
+        * @since 2.1
+        * @param aBitRate bitrate
+        * @return TInt Error code
+        */
+        virtual TInt SetMaxVideoBitRate(TInt aBitRate);
+
+        /**
+        * Pass average audio bitrate to mediasink
+        * @since 2.1
+        * @param aBitRate bitrate
+        * @return TInt Error code
+        */
+        virtual TInt SetAverageAudioBitRate(TInt aBitRate);
+
+        /**
+        * Flush all buffers from source to sink. This could be done by an external
+        * object if it notifies that there is a queue in the source, 
+        * or the destructor of this class
+        * @since 2.1
+        * @return void
+        */
+        virtual void Flush();
+
+        /**
+        * Return the number of buffers waiting in the input of the active object
+        * @since 2.1
+        * @return TInt Number of buffers waiting
+        */
+        virtual TInt NumBuffersInQueueL();
+
+        /**
+        * Return the latest time stamp from the input stream
+        * @since 2.1
+        * @param TTimeIntervalMicroSeconds& aTimeStamp
+        */
+        virtual void LatestTimeStampL(TTimeIntervalMicroSeconds& aTimeStamp) const;
+
+        /**
+        * Return the duration of the recording
+        * @since 2.6
+        * @param TTimeIntervalMicroSeconds& aDuration
+        */
+        virtual void DurationL(TTimeIntervalMicroSeconds& aDuration) const;
+
+    protected: // From CActive
+
+        /**
+        * From CActive Writes buffers from source to sink
+        */
+        void RunL();
+
+        /**
+        * From CActive
+        */
+        void DoCancel();
+
+        /**
+        * From CActive
+        */
+        TInt RunError(TInt aError);
+
+    private: // Constructors
+
+        /**
+        * C++ default constructor.
+        */
+        CCMRActiveOutput();
+
+        /**
+        * By default EPOC constructor is private.
+        */
+        void ConstructL(MCMRMediaSink* aSink, MCMRActiveOutputObserver* aObserver);
+
+	private: // State related
+		enum TState
+			{
+			EStateIdle = 0,
+			EStateTimerPause,
+			EStateRequestingNewData
+			};
+		
+		void SetState( TState aState );
+		void RequestTimerPause();
+		void RequestNewData();
+
+    private: // Data
+
+        // Media sink where to write data
+        MCMRMediaSink* iSink;
+
+        // Media source where data comes from
+        MCMRMediaSource* iMediaSource;
+
+        // Observer for error callback
+        MCMRActiveOutputObserver* iObserver;
+
+        // ETrue if Start was called
+        TBool iRunning;
+
+    	// Mutex used to use variables safely in case of use from other thread
+        RMutex      iMutexObj; 
+
+        // Buffer that is in use
+        CCMRMediaBuffer* iBuffer;
+        
+        // State
+        TState iState;
+        
+        // Timer for pausing
+        RTimer iTimer;
+    };
+
+
+#endif // CCMRMEDIASINK_H
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioCodecData.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for audio codec data class which is specific to each codec type
+*
+*/
+
+
+#ifndef CCMRAUDIOCODECDATA_H
+#define CCMRAUDIOCODECDATA_H
+
+// INCLUDES
+#include "CCMRMediaSink.h"
+
+#include <e32base.h>
+#include <mmf/common/mmffourcc.h>
+
+
+/**
+* Audio codec type (SW/HW)
+*/
+enum TCMRCodecType
+    {
+        ECodecTypeSW,
+        ECodecTypeHW,
+        ECodecTypeNA
+    };
+
+
+// FORWARD DECLARATIONS
+class MDataSource;
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for audio codec data
+*
+*  @lib
+*  @since 2.6
+*/
+class CCMRAudioCodecData : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRAudioCodecData(TFourCC aFourCC, TInt aBitRate, CCMRMediaBuffer::TBufferType aBufferType, TCMRCodecType aType)
+            : iFourCC(aFourCC), iBitRate(aBitRate), iSampleRate( 8000 ), iChannels( 1 ),
+              iBufferType(aBufferType), iConfigData(NULL), iCodecSWHWType(aType) {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRAudioCodecData();
+
+    public: // New functions
+
+        /**
+        * Check if the codec is supported in this configuration
+        * @return TBool ETrue if supported
+        */
+        virtual TBool Supported() = 0;
+
+        /**
+        * Set channel mode for the codec, leaves by default.
+        */
+        virtual inline void SetChannelModeL(TUint /*aChannelMode*/) { User::Leave(KErrNotSupported); };
+
+        /**
+        * Return the number of channels supported
+        * @return TUint number of channels (1/2)
+        */
+        virtual inline TUint GetNumChannels() const { return iChannels; };
+
+        /**
+        * Set sample rate for the codec, leaves by default, but can be overridden, then leaves if not supported
+        */
+        virtual inline void SetSampleRateL(TUint /*aSampleRate*/) { User::Leave(KErrNotSupported); };
+        /**
+        * Return the supported sample rate for the codec
+        * @return TUint sample rate (Hz)
+        */
+        virtual inline TUint GetSampleRate() const { return iSampleRate; };
+        /**
+        * Get codec's type/location: SW for CMMFCodecs and HW for HW Devices
+        * @return ECodecTypeSW/ECodecTypeHW/ECodecTypeNA
+        */
+        inline TCMRCodecType GetCodecSWHWTypeL() { return iCodecSWHWType; };
+        /**
+        * Return frame duration in microseconds
+        * @return TReal duration in microseconds
+        */
+        virtual inline TReal GetFrameDurationUs() const { return 20000; };
+
+        /**
+        * Return preferred duration of PCM capture in microseconds, relevant only for CMMFCodecs
+        * @return TReal duration in milliseconds
+        */
+        virtual TReal GetPCMCaptureDurationMs() const = 0;
+
+        /**
+        * Set bitrate for the codec
+        * @param aBitRate in bps
+        * @return void
+        */
+        virtual void SetBitRateL(TInt aBitRate) = 0;
+        /**
+        * Get the current bitrate
+        * @return TInt bitrate in bps
+        */
+        virtual TInt GetBitRateL() const = 0;
+
+        /**
+        * Get the configuration parameters for the codec
+        * @param aDataSource    MMF audio input
+        * @return TDes8* configuration parameter structure
+        */
+        virtual TDes8* GetCodecConfigParamL(MDataSource* aDataSource) = 0;
+
+        /**
+        * Get the FourCC of the codec
+        * @return TFourCC
+        */
+        virtual TFourCC GetCodecFourCCL() const;
+
+        /**
+        * Reads the framelength from the header of the given buffer
+        * @param const TUint8* aBuf
+        * @return TInt frame length in bytes
+        */
+        virtual TInt FrameLength( const TUint8* aBuf, TInt aDataLen  ) const = 0;
+
+        /**
+        * Returns max coded frame length for the codec. Client can then e.g. allocate buffers based on it
+        * @return TInt Max frame length in bytes
+        */
+        virtual TInt MaxFrameLengthL() const = 0;
+
+        /**
+        * Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+        * @return TInt Max frame length in bytes
+        */
+        virtual TInt MaxBufferLength() const = 0;
+
+        /**
+        * Returns the CCMRMediaSink/CCMRMediaBuffer compatible type of the codec buffer
+        * @return CCMRMediaBuffer::TBufferType buffer type
+        */
+        virtual CCMRMediaBuffer::TBufferType BufferType() const;
+
+        /**
+        * Configures sample DevSound HW device
+        * @since 2.1
+        * @return TInt error code
+        */
+        virtual TInt AudioHWConfigL(MDataSource* aDataSource, const TDesC8& aParams ) = 0;
+
+        /**
+        * Get the decoder configuration info
+        * @return HBufC8* info structure
+        */
+        virtual HBufC8* GetDecoderConfigInfoLC();
+
+        /**
+        * Get the Uid of the SW codec we support
+        * @return TUid Uid
+        */
+        virtual TUid SWCodecUid() = 0;
+
+        /**
+        * Get the preferred samplecount per PCM inputbuffer.
+        * @return TInt samplecount.
+        */
+        virtual TInt PreferredSampleCountPerInputBuffer() = 0;
+
+        /**
+        * Get the preferred framecount per PCM inputbuffer.
+        * @return TInt samplecount.
+        */
+        virtual TInt PreferredFrameCountPerInputBuffer() = 0;
+
+    protected: // member data
+        // FourCC of the codec
+        TFourCC iFourCC;
+
+        // The selected bitrate of the codec
+        TInt iBitRate;
+
+        // The selected samplerate of the codec
+        TInt iSampleRate;
+
+        // The selected channel mode of the codec
+        TInt iChannels;
+
+        // CCMRMediaSink/CCMRMediaBuffer compatible type of the codec buffer
+        CCMRMediaBuffer::TBufferType iBufferType;
+
+        // Configuration data structure
+        TDes8* iConfigData;
+
+    private:
+
+        // type/location of the codec: HW or SW
+        TCMRCodecType iCodecSWHWType;
+
+    };
+
+
+
+#endif      // CCMRAUDIOCODECDATA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioCodecs.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for audio codecs class which keeps information 
+*                about audio codec types and their location (SW/HW)
+*
+*/
+
+
+#ifndef CCMRAUDIOCODECS_H
+#define CCMRAUDIOCODECS_H
+
+// INCLUDES
+#include "CCMRAudioCodecData.h"
+#include <e32base.h>
+#include <mmf/common/mmffourcc.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  A helper class to find out the supported audio codecs
+*
+*  @lib 
+*  @since 2.6
+*/
+class CCMRAudioCodecs : public CBase
+                          
+
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRAudioCodecs();
+
+        /**
+        * Two-phased constructor.
+        * @return CCMRAudioCodecs* Pointer to constructed audiocodecs
+        */
+        static CCMRAudioCodecs* NewL();
+
+        
+    public: // New functions
+        
+        /**
+        * Get list of supported & installed audio codecs.
+        * @since 2.6
+        * @param  aAudioTypes   List of supported & installed audio codecs as FourCC type
+        * @return void
+        */
+        virtual void GetSupportedAudioCodecsL( RArray<TFourCC>& aAudioTypes );
+
+        /**
+        * Get codec's type: SW (CMMFCodec) or HW (HW Device)
+        * @since 2.7
+        * @param  aCodec    FourCC codec in question
+        * @return ECodecTypeSW/ECodecTypeHW/ECodecTypeNA
+        */
+        TCMRCodecType GetCodecSWHWTypeL( const TFourCC& aCodec );
+
+        /**
+        * Check if we support the given codec
+        * @since 2.7
+        * @param  aCodec    FourCC codec in question
+        * @return ETrue if supported
+        */
+        TBool CheckIfSupportedL( const TFourCC& aAudioCodec );
+
+        /**
+        * Set used audio codec
+        * @since 2.7
+        * @param  aCodec    FourCC codec in question
+        */
+        virtual void SetAudioCodecL( const TFourCC& aAudioCodec );
+
+        /**
+        * Get codecdata-object for the selected codec
+        * @since 2.7
+        * @return CCMRAudioCodecData*
+        */
+        virtual CCMRAudioCodecData* GetCodecDataL();
+
+    protected:
+
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL();
+
+        /**
+        * Internal helper function to check if given codec FourCC is supported in the system, either HW or SW
+        */
+        TBool CheckIfInstalledL( const TFourCC& aFourCC, const TInt aUidMmfPluginInterfaceCodec, const TUid& aCodecUid );
+        
+        /**
+        * Internal helper function to check if given codec FourCC is supported in devsound HW
+        */
+        TBool CheckIfHWInstalledL( const TFourCC& aFourCC );
+
+    private :
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRAudioCodecs() {};
+
+    protected: // member data
+      
+        // List of supported & installed SW audio codecs (CMMFCodec)
+        RArray<TFourCC> iAudioTypesSW;
+
+        // List of supported & installed HW audio codecs (HW device)
+        RArray<TFourCC> iAudioTypesHW;
+
+        // Data for the selected audio codec
+        CCMRAudioCodecData* iAudioCodec;
+    };  
+    
+#endif      // CCMRAUDIOCODECS_H
+    
+// End of File
+    
+    
+    
+    
+    
+
+    
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioInput.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio input class for handling audio data and giving it to CCMRActiveOutput
+*
+*/
+
+#ifndef CCMRAUDIOINPUT_H
+#define CCMRAUDIOINPUT_H
+
+// INCLUDES
+#include "CCMRMediaSource.h"
+#include <mmf/server/mmfdatasink.h>
+#include <mmf/server/sounddevice.h>
+
+
+// FORWARD DECLARATIONS
+class CCMRFifo;
+class CCMRActiveOutput;
+class CCMRAudioCodecData;
+class CMMFDevSound;
+class CCMRConfigManager;
+
+// CLASS DECLARATIONS
+
+
+/**
+*  Audio input base class. This contains common interface and some common functionality 
+*  for CCMRHWAudioInput and CCMRSWAudioInput classes. This class cannot be instantiated directly.
+*  It is inherited from CTimer since CCMRSWAudioInput of it needs CTimer and 
+*  inheriting this one from CBase would mean multiple inheritance; 
+*  CCMRHWAudioInput needs CActive, but CTimer is inherited from CActive so CTimer is the common one.
+*  Routines for CTimer are implemented in inherited classes
+*
+*  @lib camcmediarecorder.lib
+*  @since 2.1
+*/
+class CCMRAudioInput : public CTimer, public MDataSink, public MCMRMediaSource, public MDevSoundObserver
+    {
+
+    public: // Constants
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10020
+            };
+    
+        // States
+        enum TInputState
+            {
+                EStateRecording,
+                EStateStopping,
+                EStateLastReceived,
+                EStateStopped
+            };
+
+    public:  // Constructor and destructor
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRAudioInput();
+
+    public: // new functions
+
+        /**
+        * Send an event (error) to client
+        * @param TMMFEvent& aEvent
+        */
+        virtual void SendEventToClient(const TMMFEvent& aEvent);
+
+        /**
+        * Primes source
+        */
+        virtual void SourcePrimeL();
+
+        /**
+        * Starts recording
+        */
+        virtual void SourceRecordL();
+
+        /**
+        * Pauses playing (recording)
+        */
+        virtual void SourcePauseL();
+
+        /**
+        * Stops playing (recording)
+        */
+        virtual void SourceStopL();
+
+        /**
+        * Sets priority settings
+        * @param const TMMFPrioritySettings& aPrioritySettings
+        */
+        virtual void SetSourcePrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
+
+        /**
+        * Get DevSound handle
+        * @return CMMFDevSound& handle
+        */
+        virtual CMMFDevSound& SoundDevice();
+
+        /**
+        * Ask MMFAudioInput to fill next buffer
+        * @param CMMFBuffer* aBuffer
+        */
+        virtual void FillBufferL();
+
+        /**
+        * Inform output about a new buffer
+        * @param CMMFBuffer* aBuffer
+        */
+        virtual void NewBufferL(CMMFBuffer* aBuffer);
+
+        /**
+        * Set codecdata object for the audioinput
+        * @param CCMRAudioCodecData* aCodecData
+        */
+        virtual void SetCodecL( CCMRAudioCodecData* aCodecData );
+
+        /**                     
+        * Configure codec
+        */
+        virtual void ConfigureCodecL() = 0;
+
+        /**                     
+        * Reset timestamp, used after a real stop (pause is also handled as stop internally)
+        */
+        virtual void ResetTimeStamp();
+
+    public: // from base classes
+
+        /**
+        * From MDataSink, not supported
+        */
+        void ConstructSinkL( const TDesC8& /*aInitData*/ ) { User::Leave(KErrNotSupported); };
+
+        /**
+        * From MDataSink, check data type code, not called by MMFAudioInput and hence returns dummy
+        */
+        inline TFourCC SinkDataTypeCode(TMediaId /*aMediaId*/) {return KFourCCNULL;};
+
+        /**
+        * From MDataSink, asks to empty the given buffer, not called by MMFAudioInput and hence returns dummy
+        */
+        inline void EmptyBufferL(CMMFBuffer* /*aBuffer*/, MDataSource* /*aSupplier*/, TMediaId /*aMediaId*/) {};
+
+        /**
+        * From MDataSink, informs that the given buffer is filled, called by MMFAudioInput
+        */
+        void BufferFilledL(CMMFBuffer* aBuffer) = 0;
+
+        /**
+        * From MDataSink, asks if we can create a buffer, not called by MMFAudioInput and hence returns EFalse
+        */
+        inline TBool CanCreateSinkBuffer() {return EFalse;};
+
+        /**
+        * From MDataSink, asks to create a buffer, not called by MMFAudioInput and hence returns dummy
+        */
+        inline CMMFBuffer* CreateSinkBufferL(TMediaId /*aMediaId*/, TBool& /*aReference*/) {return NULL;};
+
+        /**
+        * From MCMRMediaSource Sink (output active object) is ready to accept new data
+        */
+        void RequestNewData(TRequestStatus& aStatus);
+
+        /**
+        * From MCMRMediaSource Sink (output active object) wants to cancel new data request
+        */
+        void RequestNewDataCancel(TRequestStatus& aStatus);
+
+        /**
+        * From MCMRMediaSource Get the next output buffer
+        */
+        CCMRMediaBuffer* GetNextBuffer();
+
+        /**
+        * From MCMRMediaSource Get the number of output buffers waiting in the source
+        */
+        TInt NumBuffersWaiting();
+
+        /**
+        * From MCMRMediaSource Return the latest time stamp from the input stream
+        */
+        void LatestTimeStampL(TTimeIntervalMicroSeconds& aTimeStamp) const;
+
+        /**
+        * From MCMRMediaSource Return the duration of the recording
+        */
+        void DurationL(TTimeIntervalMicroSeconds& aDuration) const;
+
+        /**
+        * From MCMRMediaSource Return a previously given buffer back to the source
+        */
+        void ReturnBuffer(CCMRMediaBuffer* aBuffer);
+
+    public:
+        /**
+        * From MDevSoundObserver Handles initialization completion event.
+        */        
+        void InitializeComplete(TInt aError);
+        
+        /**
+        * From MDevSoundObserver Handles tone play completion event.
+        */        
+        void ToneFinished(TInt aError);
+        
+        /**
+        * From MDevSoundObserver Handles CMMFDevSound object's data request event.
+        */        
+        void BufferToBeFilled(CMMFBuffer* aBuffer);
+        
+        /**
+        * From MDevSoundObserver Handles play completion or cancel event.
+        */        
+        void PlayError(TInt aError); 
+        
+        /**
+        * From MDevSoundObserver Handles CMMFDevSound object's data request event.
+        */        
+        void BufferToBeEmptied(CMMFBuffer* aBuffer); 
+        
+        /**
+        * From MDevSoundObserver Handles record completion or cancel event.
+        */        
+        void RecordError(TInt aError); 
+        
+        /**
+        * From MDevSoundObserver Handles conversion completion or cancel event.
+        */        
+        void ConvertError(TInt aError);
+        
+        /**
+        * From MDevSoundObserver Handles device event.
+        */        
+        void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
+
+    protected:
+
+        /**
+        * C++ default constructor
+        * @param MDataSource* aDataSource
+        * @param TMediaId aMediaId
+        */
+        CCMRAudioInput(MDataSource* aDataSource, MAsyncEventHandler& aEventHandler) : 
+            CTimer(EPriorityNormal), MDataSink(KUidMmfDataPath), iMMFDataSource(aDataSource), iEventHandler(aEventHandler) {};
+
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL(CCMRActiveOutput* aOutput, TUint aThreadId, CCMRConfigManager* aConfig );
+
+
+        /**
+        * Internal function to get DevSound capabilities and configure DevSound appropriately.
+        */
+        virtual void ConfigDevSoundL();
+        
+        virtual void UpdateTimeL();
+        
+    private:
+        virtual void AllocateInputBuffersL() = 0;
+
+    protected: // data shared with inherited classes
+
+        // Handle to MMFAudioInput
+        MDataSource* iMMFDataSource;
+
+        // Consumer
+        CCMRActiveOutput* iConsumer;
+
+        // ETrue if first buffer for the session has not been received
+        TBool iFirstTime;
+
+        // size of buffers allocated & managed in this class
+        TUint iInputBufferSize;
+
+        // State of the class
+        TInputState iState;
+
+        // ETrue if MMFDataPath has a buffer under processing
+        TBool iUnderProcessing;
+
+        TBool iFirstBufferRequested;
+        
+        // Counter for the number of received buffers
+        TInt iCurrentSourceFrameNumber;
+        // Counter for the number of stored bytes
+        TInt iNumBytesStored;
+
+
+        // Fifo for empty buffers that are available for storing data from MMFAudioInput/DevSound
+        CCMRFifo* iInputEmpty;
+        // Fifo is for buffers that are storing data from MMFAudioInput/DevSound (PCM or coded, depending on use case)
+        CCMRFifo* iInputFilled;
+        // Fifo for buffers that contain encoded data and are waiting for sink to retrieve
+        CCMRFifo* iOutputFilled;
+        // Fifo for buffers that sink has read and are available for reuse in iOutputFilled;
+        // bufs can't go directly to iInputEmpty since this is always for coded frames, input bufs may be for PCM16. 
+        // Depending on the derivative, this is either a temporary storage for buffers (HW) until audio thread moves them 
+        // to iInputEmpty, or "permanent" meaning that the buffers are circulated only between iOutputEmptied and iOutputFilled
+        CCMRFifo* iOutputEmptied;
+
+        // Event handler
+        MAsyncEventHandler& iEventHandler;
+
+        // Handle to the buffer from MMFAudioInput
+        CMMFBuffer* iDevSoundBuffer;
+
+        // ETrue if we have just ref to buf, EFalse if we own it => we must also delete it
+        TBool iSrcBufRef;
+
+    	// Mutex used to use variables safely in case of use from other thread
+        RMutex      iMutexObj; 
+        TBool       iMutexCreated;
+
+        // Audio codec-specific data is available from this object
+        CCMRAudioCodecData* iCodecData;
+
+        // Time stamp when paused; pause resets the original ones since it is actually stop
+        TTimeIntervalMicroSeconds iTimeStampWhenPaused;
+        // Number of audio frames received
+        TInt iNumFramesReceived;
+        // Number of audio frames stored in the queue and waiting for output to mediasink
+        TInt iNumFramesWaiting;
+
+        // Counter for sent buffers, used also in SW-variant to evaluate timeout for next buffer (are we ahead or late)
+        TInt iSendBufCount;
+
+    	TMMFPrioritySettings iPrioritySettings;
+
+        // Reference to the buffer under processing
+        CMMFDataBuffer* iProcessingBuffer;
+
+    private: // data internal for this base class
+
+        // Index of the next unread byte in iSrcBuffer (data=origin+index)
+        TInt iProcessingIndex;
+        // Number of unread bytes in iSrcBuffer
+        TInt iSrcNumUnreadBytes;
+        // Status info for output active object
+        TRequestStatus* iSinkRequestStatus;
+
+        // Buffer for data output to iOutput
+        CCMRMediaBuffer* iMediaSinkBuffer;
+        // CamcorderMMFPlugin config manager
+        CCMRConfigManager* iConfig;
+        // ETrue if iOutputBuffer is in use (supports only 1 output buffer at a time)
+        TBool iOutputBufferInUse;
+
+        // thread handle for output active object
+        RThread iOutputThreadHandle;
+
+        // Decoder configuration information for some codecs
+        HBufC8* iDecConfigInfo;
+        // EFalse until 1st buffer has been read by active output; is used to check if we need to provide decoder config info first
+        TBool iDecConfigInfoChecked;
+
+        TBool iSamplesUpdatedAfterStart;
+        TTime iTimeWhenSamplesUpdated;
+        TTimeIntervalMicroSeconds iLatestTimeStamp;
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioInputHW.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio input class to handle compressed audio input from codec 
+*                HW devices located under DevSound
+*
+*/
+
+#ifndef CCMRAUDIOINPUTHW_H
+#define CCMRAUDIOINPUTHW_H
+
+// INCLUDES
+#include "CCMRAudioInput.h"
+
+// FORWARD DECLARATIONS
+class CCMRFifo;
+
+
+// CLASS DECLARATIONS
+
+
+/**
+*  Audio input class to be used with HW device audio codecs
+*/
+class CCMRHWAudioInput : public CCMRAudioInput
+    {
+
+    public:  // Constructor and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param MDataSource *aMMFAudioInput
+        * @param TMediaId aMediaId 
+        * @return CCMRAudioInput* Pointer to constructed audioinput
+        */
+        static CCMRAudioInput* NewL(MDataSource *aMMFAudioInput, CCMRActiveOutput* aOutput, TUint aThreadId, MAsyncEventHandler& aEventHandler, CCMRConfigManager* aConfig );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRHWAudioInput();
+
+    public: // from base classes
+
+        /**
+        * From CCMRAudioInput, informs that the given buffer is filled, called by MMFAudioInput
+        */
+        void BufferFilledL(CMMFBuffer* aBuffer);
+
+        /**
+        * From CCMRAudioInput, requests to fill the buffer
+        */
+        void FillBufferL(CMMFBuffer* aBuffer);
+
+        /**
+        * From CCMRAudioInput, stops recording
+        */
+        void SourceStopL();
+
+        /**
+        * From CCMRAudioInput, starts recording
+        */
+        void SourceRecordL();
+
+        /**
+        * From CCMRAudioInput, set codecdata-object
+        */
+        void SetCodecL( CCMRAudioCodecData* aCodecData );
+
+        /**
+        * From CCMRAudioInput, configures the codec
+        */
+        void ConfigureCodecL();
+
+    protected: // from base classes
+
+        /**
+        * From CActive, moves buffer to wait for retrieval from output active object
+        */
+        void RunL();
+
+        /**
+        * From CActive, handles errors in RunL
+        */
+        TInt RunError(TInt aError);
+
+        /**
+        * From CActive, cancels the AO
+        */
+        void DoCancel();
+
+
+    private: // constructors
+
+        /**
+        * C++ default constructor
+        * @param MDataSource* aDataSource
+        * @param TMediaId aMediaId
+        */
+        CCMRHWAudioInput(MDataSource* aDataSource, MAsyncEventHandler& aEventHandler) : 
+            CCMRAudioInput(aDataSource, aEventHandler) {};
+
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL(CCMRActiveOutput* aOutput, TUint aThreadId, CCMRConfigManager* aConfig);
+
+        /**
+        * Handles allocation of input buffers after audioinput has completed initialization.
+        */        
+        void AllocateInputBuffersL();
+
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioInputSW.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio input class to handle uncompressed audio input from DevSound
+*                and compress it using CMMFCodecs
+*
+*/
+
+#ifndef CCMRAUDIOINPUTSW_H
+#define CCMRAUDIOINPUTSW_H
+
+// INCLUDES
+#include "CCMRAudioInput.h"
+#include <mmf/server/mmfcodec.h>
+
+// FORWARD DECLARATIONS
+class CCMRFifo;
+
+
+
+// CLASS DECLARATIONS
+
+
+/**
+*  Audio input class to be used with CMMFCodec audio codecs
+*/
+class CCMRSWAudioInput : public CCMRAudioInput
+    {
+
+
+    public:  // Constructor and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param MDataSource *aMMFAudioInput
+        * @param TMediaId aMediaId 
+        * @return CCMRAudioInput* Pointer to constructed audioinput
+        */
+        static CCMRAudioInput* NewL(MDataSource *aMMFAudioInput, CCMRActiveOutput* aOutput, TUint aThreadId, MAsyncEventHandler& aEventHandler, CCMRConfigManager* aConfig);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRSWAudioInput();
+
+    public: // from base classes
+
+        /**
+        * From CCMRAudioInput, informs that the given buffer is filled, called by MMFAudioInput
+        */
+        void BufferFilledL(CMMFBuffer* aBuffer);
+
+        /**
+        * From CCMRAudioInput, requests to fill the buffer
+        */
+        void FillBufferL(CMMFBuffer* aBuffer);
+
+        /**
+        * From CCMRAudioInput, stops recording
+        */
+        void SourceStopL();
+        /**
+        * From CCMRAudioInput, starts recording
+        */
+        void SourceRecordL();
+
+        /**
+        * From CCMRAudioInput, primes source
+        */
+        void SourcePrimeL();
+
+        /**
+        * From CCMRAudioInput, set codecdata-object
+        */
+        void SetCodecL( CCMRAudioCodecData* aCodecData );
+
+        /**
+        * From CCMRAudioInput, configures the codec
+        */
+        void ConfigureCodecL();
+
+    protected: // new functions
+
+        /**
+        *  Encode the given PCM buffer, using EncodeL. This generates 0 or 1 output buffer and may need to be called 
+        *  again to completely consume the input
+        *  @return TBool ETrue if completed with the input, EFalse if must be called again
+        */
+        virtual TBool EncodeBufferL(CMMFDataBuffer* aInBuffer);
+
+        /**
+        *  Encode the given buffer from PCM to selected format, using CMMFCodec
+        *  @return TCodecProcessResult::TCodecProcessResultStatus
+        */
+        virtual TCodecProcessResult::TCodecProcessResultStatus EncodeL(CMMFDataBuffer* aInBuffer, CMMFDataBuffer* aOutBuffer);
+
+    protected: // from base classes
+
+        /**
+        * From CActive/CTimer, encodes buffer to wait for retrieval from output active object
+        */
+        void RunL();
+
+        /**
+        * From CActive, handles errors in RunL
+        */
+        TInt RunError(TInt aError);
+
+        /**
+        * From CActive, cancels the AO
+        */
+        void DoCancel();
+
+
+    private:
+
+        /**
+        * C++ default constructor
+        * @param MDataSource* aDataSource
+        * @param TMediaId aMediaId
+        */
+        CCMRSWAudioInput(MDataSource* aDataSource, MAsyncEventHandler& aEventHandler) : 
+            CCMRAudioInput(aDataSource, aEventHandler) {};
+
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL(CCMRActiveOutput* aOutput, TUint aThreadId, CCMRConfigManager* aConfig);
+
+        /**
+        * Handles allocation of input buffers after audioinput has completed initialization.
+        */                
+        void AllocateInputBuffersL();
+
+    private: // data
+
+        // Whether or not AllocateInputBuffersL needs to clear buffers (happens if audiocodec is reset).
+        TBool iDeleteOld;
+
+        // if the last input buffer didn't fill the last splitted buffer completely, we need to copy more data next time 
+        // to stay in sync with timer. This tells how much data
+        TUint iRemainder;
+        
+        // Time when we got our first buffer from MMF audio input => sending of next ones is based on this
+        TTime iStartTime;
+
+        // Duration of output buffer in time => timeout. By default it is KCMRMaxAudioBufferTime*1000
+        TUint iBufferDuration;
+
+        // Encoder used to encode from PCM to given format
+        CMMFCodec* iCodec;
+
+        // Max length of coded buffer, specific to each codec
+        TInt iCodedBufferLength;
+
+        // Minimum size for PCM buffer
+        TUint iMinPCMBufferSize;
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioRecorder.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,293 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio recorder implementation
+*
+*/
+
+#ifndef CCMRAUDIORECORDER_H
+#define CCMRAUDIORECORDER_H
+
+// INCLUDES
+
+#include <mmf/server/mmfdatapathproxy.h>
+#include <mmf/server/mmfdatasource.h>
+
+#include "CCMRRecorderBase.h"
+#include "CCMRAudioThreadProxy.h"
+
+
+// FORWARD DECLARATIONS
+class CCMRAudioCodecs;
+class CCMRActiveOutput;
+
+
+//CLASS DECLARATIONS
+
+/**
+* Audio recorder observer
+*
+* @since 2.1
+*/
+class MCMRAudioRecorderObserver
+    {
+    public:
+        /**
+        * Informs that audio recorded has changed its state
+        * @param aState     new state
+        */
+        virtual void MaroStateChange(CCMRRecorderBase::TRecorderState aState) = 0;
+
+        /**
+        * Informs about error in audio recorder
+        * @param aState     error code
+        */
+        virtual void MaroError(TInt aError) = 0;
+    };
+
+
+
+/**
+* Audio recorder class
+*
+* @since 2.1
+*/
+class CCMRAudioRecorder : public CCMRRecorderBase,
+                            public MCMRSubThreadEventMonitorObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRAudioRecorder* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRAudioRecorder();
+
+    public: // Constants
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10010,
+            };
+
+    public: // New functions
+        
+        /**
+        * Open audio recorder
+        * @since 2.1
+        * @param aObserver      observer for audio recorder
+        * @param aSource        audio source (handle to MMF audio input)
+        * @param aOutputAO      output active object
+        * @param aAudioType     audio fourCC code
+        */
+        void OpenL(MCMRAudioRecorderObserver *aObserver, MDataSource *aSource, 
+                        CCMRActiveOutput* aOutputAO, const TFourCC& aAudioType, CCMRConfigManager* aConfig );
+
+        /**
+        * Set audio codec to be used (overrides the one given in OpenL)
+        * @since 2.1
+        * @param  aFourCC           audio FourCC
+        * @return void
+        */
+        void SetAudioCodecL( const TFourCC& aAudioType );
+
+        /**
+        * Get the currently used audio codec
+        * @since 2.1
+        * @param  aFourCC           Used codec as FourCC
+        * @return void
+        */
+        void GetAudioCodecL( TFourCC& aAudioType ) const;
+
+        /**
+        * Get supported & installed audio codecs
+        * @since 2.1
+        * @since 2.1
+        * @param  aAudioTypes   List of supported & installed audio codecs
+        * @return void
+        */
+        void GetSupportedAudioCodecsL( RArray<TFourCC>& aAudioTypes ) const;
+
+       /**
+        * Set bitrate for audio codec. If we use AMR-NB, the given bitrate
+        * is interpreted proprietarily: bitrates that are not exactly AMR bitrates 
+        * mean that voice activity detection is used and the actual AMR bitrate is 
+        * the given bitrate rounded upwards to the next AMR bitrate
+        * E.g. aBitRate = 5500 means the AMR bit-rate is 5900 and VAD is enabled
+        * @since 2.1
+        * @param aBitRate   bitrate for audio
+        * @return void
+        */
+        void SetTargetBitRateL(TInt aBitRate);
+
+       /**
+        * Set samplerate for audio codec. AAC only
+        * @since 3.1u
+        * @param aSampleRate   samplerate for audio
+        * @return void
+        */
+        void SetTargetSampleRateL(TInt aSampleRate);
+
+       /**
+        * Set channel mode for audio codec. AAC only
+        * @since 3.1u
+        * @param aChannelMode   channel mode for audio
+        * @return void
+        */
+        void SetChannelModeL(TInt aChannelMode);
+
+        /**
+        * Get the used recording gain
+        * @since 2.1
+        * @return gain
+        */
+        TInt GainL();
+
+        /**
+        * Get the max recording gain
+        * @since 2.1
+        * @return max gain
+        */
+        TInt MaxGainL();
+
+        /**
+        * Set the recording gain. Can be used before and during recording
+        * @since 2.1
+        * @param aGain  gain
+        */
+        void SetGainL(TInt aGain);
+
+        /**
+        * Set priority settings
+        * @since 2.1
+        * @param  aPrioritySettings audio priority settings
+        * @return error code
+        */
+        void SetPriorityL(const TMMFPrioritySettings& aPrioritySettings);
+
+        /**
+        * Wait until audio thread has stopped
+        * @since 2.1
+        */
+        void WaitUntilStoppedL();
+
+        /**
+        * Get default AV sync adjustment for start of recording, depending on codec type
+        * @since 2.8
+        * @return AV sync adjustment value for starting of recording
+        */
+        TInt AVSyncAdjustmentStart();
+        /**
+        * Get default AV sync adjustment for resume of recording, depending on codec type
+        * @since 2.8
+        * @return AV sync adjustment value for resuming recording
+        */
+        TInt AVSyncAdjustmentResume();
+
+        /**                     
+        * Get audio thread priority
+        * @return TThreadPriority aThreadPriority
+        */
+        TThreadPriority GetThreadPriority() const;
+
+    public: // Functions from base classes
+
+        /**
+        * From CCMRRecorderBase Prepares/primes for recording
+        */
+        void PrepareL();
+
+        /**
+        * From CCMRRecorderBase Starts recording
+        */
+        void RecordL();
+
+        /**
+        * From CCMRRecorderBase Stops recording (async => must wait for state change)
+        */
+        void StopL();
+
+        /**
+        * From CCMRRecorderBase Pauses recording (async => must wait for state change)
+        */
+        void PauseL();
+
+        /**
+        * From CCMRRecorderBase Resumes recording
+        */
+        void ResumeL();
+
+        /**
+        * From MMMFDataPathEventMonitorObserver Handles event from datapathproxy
+        */
+	    void HandleEvent(const TMMFEvent& aEvent);
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCMRAudioRecorder();
+
+        /**
+        * By default EPOC constructor is private.
+        */
+        void ConstructL();
+
+
+    private:    // Data
+
+      
+        // Audio priority settings
+        TMMFPrioritySettings iPrioritySettings;
+
+        // Observer
+        MCMRAudioRecorderObserver* iObserver;
+
+        // Requested audio codec fourCC
+        TFourCC iAudioCodecFourCC;
+        // MMF datapath
+        RCMRAudioThreadProxy iThreadProxy;
+
+        // ETrue if iDataPathProxy was opened => can be closed
+        TBool iThreadCreated;
+
+        // Datapath event monitor
+        CCMRSubThreadEventMonitor *iThreadEventMonitor;
+
+        // MMF audio input
+        MDataSource* iDataSource;
+
+        // Active object for outputting data & accessing mediasink
+        CCMRActiveOutput *iOutputAO;
+
+        // Audio codec-specific data is available from this object
+        CCMRAudioCodecs* iAudioCodecs;
+        
+        // Config manager
+        // Doesn't own.
+        CCMRConfigManager* iConfig;        
+
+        // Error code saved while waiting for a completion of an async operation
+        TInt iErrorCode;
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioThreadProxy.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio thread proxy classes
+*
+*/
+
+#ifndef CCMRAUDIOTHREADPROXY_H
+#define CCMRAUDIOTHREADPROXY_H
+
+// INCLUDES
+
+#include "CCMRSubThread.h"
+
+#include <mmf/common/mmfbase.h>
+
+
+// DATA TYPES
+
+
+/**
+* Audio thread messages ids
+*/ 
+enum TCMRAudioSubThreadMessageIds
+    {
+    ECMRAudioThreadSetOutput = ECMRThreadLastCommonMsgId+1,  //combine IDs with TCMRSubThreadMessageIds
+    ECMRAudioThreadAddDataSource,
+    ECMRAudioThreadSetAudioCodec,
+    ECMRAudioThreadSetPriority,
+    ECMRAudioThreadSetGain,
+    ECMRAudioThreadGetGain,
+    ECMRAudioThreadMaxGain,
+    ECMRAudioThreadPrime,
+    ECMRAudioThreadPlay,
+    ECMRAudioThreadPause,
+    ECMRAudioThreadStop,
+    ECMRAudioThreadWaitUntilStopped,
+    ECMRAudioThreadSetConfigManager
+    };
+
+
+// FORWARD DECLARATIONS
+class CCMRActiveOutput;
+class CCMRAudioCodecData;
+class MDataSource;
+class CCMRConfigManager;
+
+//CLASS DECLARATIONS
+
+/**
+*  Audio thread proxy class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class RCMRAudioThreadProxy : public RCMRSubThreadBase
+    {
+    public: // Constructor
+        /**
+        * C++ default constructor.
+        */
+        RCMRAudioThreadProxy() : RCMRSubThreadBase(KCMRThreadProxyShutdownTimeout) {};
+    public: // new functions
+        /**                     
+        * Create thread
+        * @param  TBool& aThreadCreated; thread may be created but session not necessarily so return value doesn't tell all
+        * @return TInt error code
+        */
+        TInt CreateSubThread(TBool& aThreadCreated);
+        /**                     
+        * Set output (sink) for audio
+        * @param CCMRActiveOutput* aOutputAO
+        * @return TInt error code
+        */
+        TInt SetOutput(CCMRActiveOutput* aOutputAO) const;
+        /**                     
+        * Add datasource
+        * @param MDataSource* aSource
+        * @return TInt error code
+        */
+        TInt AddDataSource(MDataSource* aSource) const;
+        /**                     
+        * Set Set config manager.
+        * @since 3.2
+        * @param  TInt aConfig
+        * @return TInt error code
+        */
+        TInt SetConfigManager(CCMRConfigManager* aConfig) const;          
+        /**                     
+        * SetAudioCodec
+        * @param MDataSink* aSink
+        * @return TInt error code
+        */
+        TInt SetAudioCodec(CCMRAudioCodecData* aAudioCodec) const;
+        /**                     
+        * Get audio thread priority
+        * @return TThreadPriority aThreadPriority
+        */
+        TThreadPriority GetThreadPriority() const;
+        /**                     
+        * Set audio policy priority
+        * @return TInt error code
+        */
+        TInt SetPriority(const TMMFPrioritySettings& aPrioritySettings) const;
+        /**                     
+        * Set audio gain
+        * @return TInt error code
+        */
+        TInt SetGain(TInt aGain) const;
+        /**                     
+        * Get audio gain
+        * @return TInt error code
+        */
+        TInt GetGain(TInt& aGain) const;
+        /**                     
+        * Get max audio gain
+        * @return TInt error code
+        */
+        TInt MaxGain(TInt& aGain) const;
+        /**                     
+        * Prime datapath
+        * @return TInt error code
+        */
+        TInt Prime() const;
+        /**                     
+        * Start playing (recording)
+        * @return TInt error code
+        */
+        TInt Play() const;
+        /**                     
+        * Pause datapath
+        * @return TInt error code
+        */
+        TInt Pause() const;
+        /**                     
+        * Stop datapath
+        * @return TInt error code
+        */
+        TInt Stop() const;
+
+        /**                     
+        * Wait until audio datapath has stopped
+        * @return TInt error code
+        */
+        TInt WaitUntilStopped();
+
+        /**                     
+        * Close thread
+        * @return TInt error code
+        */
+        void Close();
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioThreadProxyServer.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio thread proxy classes
+*
+*/
+
+#ifndef CCMRAUDIOTHREADPROXYSERVER_H
+#define CCMRAUDIOTHREADPROXYSERVER_H
+
+// INCLUDES
+
+#include "CCMRAudioThreadProxy.h"
+
+
+
+//CLASS DECLARATIONS
+
+
+
+/**
+*  Audio thread proxy server class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRAudioThreadProxyServer : public CCMRThreadProxyServer
+    {
+    public: // constructor and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRAudioThreadProxyServer* NewL(RServer2* aServer2);
+        /**
+        * Destructor.
+        */
+        ~CCMRAudioThreadProxyServer();
+
+    public: // new functions
+
+        /**                     
+        * Start thread
+        * @param TAny* aAny
+        * @return TInt error code
+        */
+        static TInt StartThread(TAny* aAny);
+    
+    protected: // new functions
+        /**                     
+        * Start thread
+        * @return void
+        */
+        static void DoStartThreadL(TAny* aAny);
+
+    protected: // from base classes
+        /**                     
+        * From CCMRThreadProxyServer/CServer create a new session
+        */
+		CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
+		
+    private: // constructors
+        /**
+        * C++ default constructor.
+        */
+        CCMRAudioThreadProxyServer(TInt aPriority);
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL(RServer2* aServer2);
+
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRAudioThreadProxySession.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio thread proxy classes
+*
+*/
+
+#ifndef CCMRAUDIOTHREADPROXYSESSION_H
+#define CCMRAUDIOTHREADPROXYSESSION_H
+
+// INCLUDES
+#include "CCMRAudioThreadProxy.h"
+
+
+
+// FORWARD DECLARATIONS
+class CCMRAudioInput;
+class CCMRAudioThreadProxyServer;
+class MDataSource;
+class CCMRAudioCodecData;
+
+//CLASS DECLARATIONS
+
+
+
+/**
+*  Audio thread proxy session class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRAudioThreadProxySession : public CCMRThreadProxySession
+    {
+    public:   // Constants        
+
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10050,
+            };
+
+    public: // constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRAudioThreadProxySession* NewL();
+        /**
+        * Destructor.
+        */
+        ~CCMRAudioThreadProxySession();
+
+    public:
+        /**
+        *  Internal class for timeout audio datapath's asynchronous pause
+        *  Calls CCMRAudioThreadProxySession::SendEventToClient with KMMFEventCategoryPlaybackComplete
+        *  if datapath doesn't do it in given time
+        */
+        class CCMRAudioPauseTimer : public CTimer
+            {
+            public: // constructors and destructor
+                
+                /**
+                * Two-phased constructor.
+                */
+                static CCMRAudioPauseTimer* NewL(CCMRAudioThreadProxySession* aHost);
+                
+                /**
+                * Destructor.
+                */
+                ~CCMRAudioPauseTimer();
+
+                /**
+                * Symbian 2nd phase constructor
+                */
+                void ConstructL();
+
+            protected: // from base classes
+
+                /**
+                * From CActive Does the required action (calls the observer)
+                */
+                void RunL();
+
+                /**
+                * From CActive Cancels pending actions
+                */
+                void DoCancel();
+
+            private: // constructor
+                /**
+                * C++ default constructor.
+                */
+                inline CCMRAudioPauseTimer(CCMRAudioThreadProxySession* aHost) : CTimer(EPriorityNormal), iHost(aHost) {};
+
+            private: // data
+                // Handle to the host of the timer, to whom the timer signals its completion (calls iHost->SendEventToClient)
+                CCMRAudioThreadProxySession* iHost;
+            };
+
+    public: // from base classes
+        /**                     
+        * From CCMRThreadProxySession/CSharableSessions service a message.
+        */
+        void ServiceL(const RMessage2& aMessage);
+
+        /**                     
+        * From CCMRThreadProxySession/MAsyncEventHandler catches 
+        * completion events before calling base class implementation
+        */
+        TInt SendEventToClient(const TMMFEvent& aEvent);
+
+    private: // new functions
+        
+        /**                     
+        * Set output (sink) for audio
+        * @return TBool
+        */
+        TBool SetOutputL(const RMessage2& aMessage);
+        /**                     
+        * Add datasource
+        * @return TBool
+        */
+        TBool AddDataSourceL(const RMessage2& aMessage);
+        /**                     
+        * Set Config manager.
+        * @return TBool
+        */
+        TBool SetConfigManager(const RMessage2& aMessage);        
+        /**                     
+        * Set used audio codec
+        * @return TBool
+        */
+        TBool SetAudioCodecL(const RMessage2& aMessage);
+        /**                     
+        * Set audio priority
+        * @return TBool
+        */
+        TBool SetPriorityL(const RMessage2& aMessage);
+        /**                     
+        * Set audio gain
+        * @return TBool
+        */
+        TBool SetGainL(const RMessage2& aMessage);
+        /**                     
+        * Get audio gain
+        * @return TBool
+        */
+        TBool GetGainL(const RMessage2& aMessage);
+        /**                     
+        * Get max audio gain
+        * @return TBool
+        */
+        TBool MaxGainL(const RMessage2& aMessage);
+        /**                     
+        * Set used codec data
+        * @return TBool
+        */
+        TBool SetCodecDataL(const RMessage2& aMessage);
+        /**                     
+        * Prime datapath
+        * @return TBool
+        */
+        TBool PrimeL();
+        /**                     
+        * Start playing (recording)
+        * @return TBool
+        */
+        TBool PlayL();
+        /**                     
+        * Pause datapath
+        * @return TBool
+        */
+        TBool PauseL();
+        /**                     
+        * Stop datapath
+        * @return TBool
+        */
+        TBool StopL();
+
+        /**                     
+        * Check if datapath has stopped recording. Message is not completed before it has completed so client is waiting for it.
+        * @return TBool
+        */
+        TBool CheckIfStoppedL();
+
+    private: // constructor
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRAudioThreadProxySession() {};
+
+    private: // data
+        // state variables for async datapath stopping/pausing
+        TBool iStoppingRecording;
+        TBool iPausingRecording;
+        TBool iInitializingAudioCodec;
+
+        // ETrue if we are paused => no need to stop or pause any more even if asked
+        TBool iPaused;
+
+        // ETrue when waiting for stop to complete
+        TBool iWaitingForStop;
+
+        // MMF audio input
+        MDataSource* iMMFAudioInput;
+
+        // Internal audio input class that handles audio data
+        CCMRAudioInput* iAudioInput;
+
+        // Object handling audio codec specific tasks and data
+        CCMRAudioCodecData* iAudioCodec;
+
+        // timer for pause/stop
+        CCMRAudioPauseTimer* iPauseTimer;
+        
+        // Handle to the message, needed in async stopping
+        RMessage2* iMessage;
+
+        // Active object that gets data from us
+        CCMRActiveOutput* iActiveOutput;
+        
+        // Config manager.
+        // Doesn't own.
+        CCMRConfigManager* iConfig;
+
+        // Thread id of the thread where active output object runs
+        TUint iOutputThreadId;
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRConfigManager.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Config manager for Media recorder
+*
+*/
+
+
+#ifndef CCMRCONFIGMANAGER_H
+#define CCMRCONFIGMANAGER_H
+
+#include <imagingconfigmanager.h>
+#include <mmf/common/mmffourcc.h>
+
+/**
+ *  CamcorderMMFPlugin config manager.
+ *  Manager for config/setup parameters used in Media Recorder.
+ *  Wraps Imaging Config Manager for CamcorderMMFPlugin usage.
+ *
+ *  @lib CAMCMEDIARECORDER.lib
+ *  @since S60 v3.2
+ */
+class CCMRConfigManager : public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCMRConfigManager* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCMRConfigManager* NewLC();    
+    
+    /**
+    * Destructor.
+    */
+    ~CCMRConfigManager();
+    
+    /**
+     * Set video codec mime type.
+     *
+     * @since S60 v3.2
+     * @param aVideoCodec Video codec.         
+     */    
+	void SetVideoCodec(TDesC8& aVideoCodec);
+    
+    /**
+     * Set audio codec mime type (TFourCC).
+     *
+     * @since S60 v3.2
+     * @param aAudioCodec Audio codec.     
+     */    
+    void SetAudioCodec(TFourCC& aAudioCodec);
+
+    /**
+     * Set video frame size.
+     *
+     * @since S60 v3.2
+     * @param aFrameSize Video frame size.    
+     */    
+    void SetVideoFrameSize(TSize aVideoFrameSize);
+
+    /**
+     * Set video pixel aspect ratio.
+     *
+     * @since S60 v3.2
+     * @param aNumerator Numerator.    
+     * @param aDenominator Denominator.         
+     */    
+    void SetVideoPixelAspectRatio(TUint aNumerator, TUint aDenominator);
+
+    /**
+     * Query whether Imaging Configuration data is available
+     *
+     * @since S60 v3.2
+     * @return EFalse/ETrue whether ICM data is available.
+     */    
+    TBool IsICMConfigDataAvailable() const;
+
+    /**
+     * Get CamcorderMMFPlugin specific settings.
+     *
+     * @since S60 v3.2
+     * @return CamcorderMMFPlugin specific settings.
+     */
+	const TCamcorderMMFPluginSettings PluginSettings() const;
+
+    /**
+     * Get Video Quality settings.
+     *
+     * @since S60 v3.2
+     * @return Video quality settings.
+     */
+	const TVideoQualitySet VideoQualitySettings() const;	
+	
+
+private:
+
+    CCMRConfigManager();
+
+    void ConstructL();
+    
+    /**
+     * Resets config manager to new Video Quality (TVideoQualitySet iActiveVideoQualitySet) 
+     * setting using Imaging Config Manager (ICM)
+     *
+     * @since S60 v3.2
+     */
+	void ResetVideoQualitySet();
+
+private: // data
+
+    /**
+     * Set video frame size.
+     */
+	TSize iVideoFrameSize;
+     
+     /**
+     * Set video codec mime type.
+     */
+    TBuf8<256> iVideoCodec;
+
+    /**
+     * Set audio codec type (TFourCC)
+     */     
+    TFourCC iAudioCodec;
+     
+     /**
+     * Set video pixel aspect ration numerator.
+     */
+    TUint iVideoPixelAspectRatioNum;
+     	
+    /**
+     * Set video pixel aspect ration denomirator.
+     */
+    TUint iVideoPixelAspectRatioDenom;
+     
+    /**
+     * Current active Video Quality settings set.
+     */
+	TBool iICMDataAvailable;
+
+    /**
+     * Current active Video Quality settings set.
+     */
+    TVideoQualitySet iActiveVideoQualitySet;
+
+    /**
+     * Current active CamcorderMMFPlugin settings set.
+     */
+    TCamcorderMMFPluginSettings iPluginSettings;
+	
+    /**
+     * Imaging Config Manager
+     * Own.
+     */
+	CImagingConfigManager* iImagingConfigManager;
+    };
+
+
+#endif // CCMRCONFIGMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRFifo.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class to handle buffers in fifo
+*
+*/
+
+
+#ifndef CCMRFIFO_H
+#define CCMRFIFO_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+
+// FORWARD DECLARATION
+class CCMRFifoItem;
+
+// CLASS DECLARATION
+
+/**
+*  Fifo, uses TSglQue to implement a singly-linked list
+*
+*  @lib camcdevvr.lib
+*  @since 2.1
+*/
+class CCMRFifo : public CBase
+    {
+
+    public:
+        
+        /**
+        * C++ default constructor.
+        */
+        CCMRFifo();
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRFifo* NewL(TInt aNumItems);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRFifo();
+        
+    public:  // New functions
+        
+        /**
+        * Adds an element to the end of the fifo
+        * @since 2.1
+        * @param TAny* aData    Pointer to data to be added
+        * @return void
+        */
+        void PutL(TAny* aData);
+        
+        /**
+        * Returns and remove the first element in fifo
+        * @since 2.1
+        * @return TAny*     Pointer to first element
+        */
+        TAny* Get(); 
+        
+      
+        /**
+        * Queries whether fifo is empty    
+        * @since 2.1
+        * @return TBool     ETrue if fifo is empty
+        */
+        TBool IsEmpty();
+
+        /**
+        * Return the size of the fifo (number of items stored)
+        * @since 2.1
+        * @return TInt      Number of items stored in fifo
+        */
+        TInt NumberOfItems();
+        
+    private: // Constructor
+
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL(TInt aNumItems);
+
+    private:    // Data
+        
+        // the actual fifo for stored data items
+        TSglQue<CCMRFifoItem> iFifo;
+        // iterator for the actual fifo
+        TSglQueIter<CCMRFifoItem> iIter;
+        // fifo for empty items
+        TSglQue<CCMRFifoItem> iFifoEmpty;
+        // iterator for the empty-items fifo
+        TSglQueIter<CCMRFifoItem> iIterEmpty;
+
+        // the size of the fifo
+        TInt iNumDataItemsStored;
+
+    };
+
+#endif // CCMRFIFO_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRFrameBuffer.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCMRFrameBuffer.h
+*
+*/
+
+
+
+#ifndef CCMRFRAMEBUFFER_H
+#define CCMRFRAMEBUFFER_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <e32std.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+class MCameraBuffer;
+
+// CLASS DECLARATIONS
+
+/**
+* Wrapper class from MCameraBuffer to MFrameBuffer
+*/
+
+class CCMRFrameBuffer:  public CBase, public MFrameBuffer 
+    {
+
+
+    public: // Construction and destruction
+
+        static CCMRFrameBuffer* NewL( MCameraBuffer* aCameraBuffer );
+
+        virtual ~CCMRFrameBuffer();
+
+    
+    public: // General methods / From MFrameBuffer
+    
+    	/**
+    	Gets a non-bitmap frame in the buffer.
+
+	    @param  aIndex
+	            The index of the required, non-bitmap, frame.
+
+	    @leave  KErrArgument if aIndex is out of range 
+	    @leave  KErrNotSupported if the frame format is bitmap.
+	    @return A pointer to the specified non-bitmap format frame of video data.
+	    */
+	    TDesC8* DataL(TInt aIndex);
+
+	    /** 
+	    Gets a bitmap frame in the buffer.
+
+	    @param  aIndex 
+	            The index of the required, bitmap format, frame.
+
+    	@leave  KErrArgument if aIndex is out of range and 
+	    @leave  KErrNotSupported if
+	            the frame format is not a bitmap.
+    	@return A pointer to the specified bitmap format frame of video data. 
+	    */
+	    CFbsBitmap* FrameL(TInt aIndex);
+
+	    /** 
+	    Releases the buffer for re-use by the camera once the client has processed
+	    the frame data.
+
+	    Signals to CCamera that the buffer data has been used and that the buffer
+	    is free for re-use. 
+	    */
+	    void Release();
+	
+  
+    private: // Private member methods
+
+        /**
+        * C++ constructor.
+        */
+        CCMRFrameBuffer();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        * @param aCameraBuffer  New MCameraBuffer object
+        * @return void
+        */
+        void ConstructL( MCameraBuffer* aCameraBuffer );
+
+
+    private: // Data
+    
+        // Stored MCameraBuffer that is owned by Camera-API.
+        MCameraBuffer* iCameraBuffer;
+
+    };
+
+
+#endif // CCMRFRAMEBUFFER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRMediaRecorderImp.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media recorder implementation header
+*
+*/
+
+
+#ifndef CCMRMEDIARECORDERIMP_H
+#define CCMRMEDIARECORDERIMP_H
+
+//  INCLUDES
+#include "CCMRMediaRecorder.h"
+#include "CCMRVideoRecorderClient.h"
+#include "CCMRAudioRecorder.h"
+#include "CCMRActiveOutput.h"
+
+// FORWARD DECLARATION
+class CCMRPerfMonitor;
+class CCMRConfigManager;
+
+
+// CLASS DECLARATION
+
+/**
+*  Media recorder implementation
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+
+class CCMRMediaRecorderImp : public CCMRMediaRecorder, public MCMRVideoRecorderObserver,
+                             public MCMRAudioRecorderObserver, public MCMRActiveOutputObserver
+    {
+
+    public:  // Constants
+
+        // Error codes
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10000
+            };
+
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        CCMRMediaRecorderImp();
+
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL();                
+        
+        /**
+        * Destructor.
+        */
+        ~CCMRMediaRecorderImp();    
+
+    public: // new functions
+
+        /**
+        *  Internal class for reporting errors to observer using active object
+        *  Needed to break the callback chain since controller may call MR::StopL from this callback
+        */
+        class CCMRErrorReporter : public CActive
+            {
+            public: // Constants
+                enum TErrorType
+                    {
+                    EErrorFatal,
+                    EErrorTemp
+                    };
+
+                class TCMRError
+                    {
+                    public:
+                        TCMRError(TInt aError, TErrorType aType) : iErrorCode(aError), iErrorType(aType) {};
+
+                    public: //data
+                        // Error code from the client to be passed
+                        TInt iErrorCode;
+                        // Error types (fatal/temporary)
+                        TErrorType iErrorType;
+                    };
+
+
+            public: // Constructors and destructor
+                /**
+                * C++ default constructor.
+                */
+                CCMRErrorReporter(MCMRMediaRecorderObserver *aObserver);
+                /**
+                * Destructor.
+                */
+                ~CCMRErrorReporter();
+
+            public: // New functions
+                /**
+                * Report fatal error to the observer
+                */
+                void FatalError(TInt aError);
+                /**
+                * Report temporary error to the observer
+                */
+                void TemporaryError(TInt aError);
+
+            protected: // from baseclass
+
+                /**
+                * From CActive Does the required action (calls the observer)
+                */
+                void RunL();
+                /**
+                * From CActive Cancels pending actions
+                */
+                void DoCancel();
+
+            private: // data
+                // List of error codes from the client to be passed
+                RArray<TCMRError> iErrors;
+                // Observer for whom to report the error
+                MCMRMediaRecorderObserver *iObserver;
+                // ETrue if RunL of the active object is running => another AO can't change the contents of the object
+                TBool iRunning;
+            };
+
+    public: // Functions from base classes
+        
+        /**
+        * From CCMRMediaRecorder 
+        */        
+        void OpenL(MCMRMediaRecorderObserver *aObserver, 
+                   MDataSource *aAudioSource, 
+                   MCMRMediaSink *aSink, TInt aCameraHandle, 
+                   const TDesC8& aVideoMimeType = KNullDesC8,  // video codec to use     
+                   TFourCC aAudioType = KFourCCNULL); // audio codec to use
+        
+        /**
+        * From CCMRMediaRecorder Return current state
+        */ 
+        inline TRecorderState State() { return iState; }
+        
+        // Settings
+        
+        /**
+        * From CCMRMediaRecorder Set video codec to be used (overrides the one given in OpenL)
+        */
+        void SetVideoCodecL( const TDesC8& aVideoMimeType );
+
+        /**
+        * From CCMRMediaRecorder Get the used video codec
+        */
+        void GetVideoCodecL( TDes8& aVideoMimeType );
+
+        /**
+        * From CCMRMediaRecorder Get the supported & installed video codecs
+        */
+        void GetSupportedVideoCodecsL( CDesC8Array& aVideoMimeTypes );
+
+        /**
+        * From CCMRMediaRecorder Set audio codec to be used (overrides the one given in OpenL)
+        */
+        void SetAudioCodecL( const TFourCC& aAudioType );
+        
+        /**
+        * From CCMRMediaRecorder Get the used audio codec
+        */
+        void GetAudioCodecL( TFourCC& aAudioType );
+        
+        /**
+        * From CCMRMediaRecorder Get the supported & installed audio codecs
+        */
+        void GetSupportedAudioCodecsL( RArray<TFourCC>& aAudioTypes );
+
+        /**
+        * From CCMRMediaRecorder Set new maximum total (audio+video) bitrate
+        */
+        inline void SetMaxTotalBitRateL(TInt aBitRate) { iMaxTargetBitRate = aBitRate; }
+
+        /**
+        * From CCMRMediaRecorder Get current maximum total (audio+video) bitrate
+        */
+        inline TInt MaxTotalBitRateL() const { return iMaxTargetBitRate; }
+
+        /**
+        * From CCMRMediaRecorder Set new video frame rate
+        */
+        void SetVideoFrameRateL(TReal32 aFrameRate);
+        
+        /**
+        * From CCMRMediaRecorder Get current video frame rate
+        */
+        TReal32 VideoFrameRateL();
+
+        /**
+        * From CCMRMediaRecorder Set new video frame size
+        */
+        void SetVideoFrameSizeL(const TSize& aSize);
+
+        /**
+        * From CCMRMediaRecorder Get current video frame size
+        */
+        void GetVideoFrameSizeL(TSize& aSize) const;
+
+        /**
+        * From CCMRMediaRecorder Set new target video bitrate
+        */
+        void SetVideoBitRateL(TInt aBitRate);
+
+        /**
+        * From CCMRMediaRecorder Get current target video bitrate
+        */
+        TInt VideoBitRateL();
+
+        /**
+        * From CCMRMediaRecorder Set misc video coding options
+        */
+        void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions);
+
+        /**
+        * From CCMRMediaRecorder Set video rate control options
+        */
+    	void SetVideoRateControlOptionsL(const TRateControlOptions& aOptions);        
+        
+        /**
+        * From CCMRMediaRecorder Get video rate control options
+        */
+        void GetVideoRateControlOptionsL(TRateControlOptions& aOptions);        
+    	
+        /**
+        * From CCMRMediaRecorder Set new target audio bitrate
+        */
+        void SetAudioBitRateL(TInt aBitRate);
+
+        /**
+        * From CCMRMediaRecorder Gets the current target audio bitrate  
+        */
+        TInt AudioBitRateL();
+
+        /**
+        * From CCMRMediaRecorder Toggles audio recording on/off
+        */
+        void SetAudioEnabledL(TBool aEnabled);
+
+        /**
+        * From CCMRMediaRecorder Query whether audio recording is enabled
+        */
+        TBool AudioEnabledL() const;                
+        
+        /**
+        * From CCMRMediaRecorder Set new audio recording input gain
+        */
+        void SetGainL(TInt aGain);
+
+        /**
+        * From CCMRMediaRecorder Get current audio recording gain
+        */
+        TInt GainL() const;
+
+        /**
+        * From CCMRMediaRecorder Get maximum audio recording gain
+        */
+        TInt MaxGainL() const;   
+        
+        /**
+        * From CCMRMediaRecorder Set audio priority settings
+        */
+        void SetAudioPriorityL(const TMMFPrioritySettings& aPrioritySettings);
+
+
+        // Recording control
+     
+        /**
+        * From CCMRMediaRecorder Prepares the recorder for recording
+        */
+        void PrepareL();
+
+        /**
+        * From CCMRMediaRecorder Starts recording audio and video
+        */
+        void RecordL();
+      
+        /**
+        * From CCMRMediaRecorder Stops recording audio and video
+        */
+        void StopL();
+       
+        /**
+        * From CCMRMediaRecorder Pauses recording
+        */
+        void PauseL();
+
+        /**
+        * From CCMRMediaRecorder Resumes recording
+        */
+        void ResumeL();
+
+        /**
+        * From CCMRMediaRecorder Called when video recorder state has changed
+        */
+        void MvroStateChange(CCMRRecorderBase::TRecorderState aState);
+
+        /**
+        * From CCMRMediaRecorder Called when an error has occurred in the video recorder
+        */
+        void MvroError(TInt aError);    
+
+
+        /**
+        * From MCMRAudioRecorderObserver Informs that audio recorder has changed its state
+        */
+        void MaroStateChange(CCMRRecorderBase::TRecorderState aState);
+
+        /**
+        * From MCMRAudioRecorderObserver Informs about error in audio recorder
+        */
+        void MaroError(TInt aError);
+
+        /**
+        * From MCMRActiveOutputObserver Informs about error in active output
+        */
+        void MaooError(TInt aError);
+
+        // Video encoder overrides
+
+        /**
+        * Set video encoder using its UID. Usage optional.
+        * This overrides Media Recorder internal search for encoder based on set video mime type ( SetVideoCodecL() ).
+        *
+        * @since 3.2.3
+        * @param    "aEncoder"  "Video encoder UID."
+        * @return void
+        */
+        void SetPreferredVideoEncoderL(TUid& aEncoder);
+
+        /**
+        * Set video encoder output format encapsulation. Usage optional.
+        * This overrides Media Recorder internal default preferences for TVideoDataUnitEncapsulation with H.264/AVC video output.
+        * if used encoder supports multiple encapsulations.
+        *
+        * Default for H.264 / AVC is EDuGenericPayload
+        * Possible values: EDuGenericPayload or EDuElementaryStream
+        *
+        * @since 3.2.3
+        * @param    "aCapsulation"  "Encapsulation for coded video data units."
+        * @return void
+        */
+        void SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation);
+        
+        /**
+        * Set video encoder target segment size. Usage optional.
+        * @since 5.2
+        * @param  TUint aLayer              Layer number
+        * @param  TUint aSizeBytes          Segment target size in bytes
+        * @param  TUint aSizeMacroblocks    Segment target size in number of macroblocks per segment
+        * @return TBool
+        */            
+        void SetSegmentTargetSizeL(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks );        
+
+    private:  // Data
+
+        // internal state
+        TRecorderState iState;
+
+        // observer for callbacks
+        MCMRMediaRecorderObserver* iObserver;
+
+        // media sink, e.g. 3GP file composer
+        MCMRMediaSink* iSink;
+
+        // active objects taking care of video and audio output
+        CCMRActiveOutput* iAudioOutput;
+        CCMRActiveOutput* iVideoOutput;
+
+        // MMF audio input, given as parameter
+        MDataSource *iAudioSource;
+
+        // video recorder
+        CCMRVideoRecorderClient* iVideoRecorder; 
+
+        // audio recorder
+        CCMRAudioRecorder* iAudioRecorder; 
+
+        // is video recording being prepared ?
+        TBool iVideoRecorderPreparing;  
+
+        // is audio recording being prepared ?
+        TBool iAudioRecorderPreparing;  
+
+        // audio recording flag (on/off)
+        TBool iAudioEnabled;  
+
+        // Max bitrate, -1 if not set (=> won't be checked when setting A/V bitrates)       
+        TInt iMaxTargetBitRate;  
+        // target bitrate, used only to store the actual value when asked from audio/videorecorder
+        TInt iTargetBitRate;
+        // video frame rate, used only to store the actual value when asked from videorecorder
+        TReal32 iFrameRate;
+
+        // Error code saved while waiting for a completion of an async operation
+        TInt iErrorCode;
+
+        // Flags used when waiting async stoppings to complete
+        TBool iVideoStopped;
+        TBool iAudioStopped;
+        
+        // Status for EOS / streamend marker
+        TInt iVideoEOSReached;
+
+        // Active object to report errors to the observer. Needed to break the callback chain since the observer may call e.g. MR::Stop in the callback
+        CCMRErrorReporter* iErrorReporter;
+
+        // Performance monitor object
+        CCMRPerfMonitor *iPerfMonitor;
+        
+        // Mediarecorder / CamcorderMMFPlugin config manager.
+        CCMRConfigManager* iConfig;
+    };
+
+
+#endif // CCMRMEDIARECORDERIMP_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRMediaSource.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface class for media source 
+*
+*/
+
+
+#ifndef CCMRMEDIASOURCE_H
+#define CCMRMEDIASOURCE_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "CCMRMediaSink.h"
+
+
+// CLASS DECLARATION
+
+/**
+*  Internal media source class, a common interface from active output objects to audio & video sources
+*  
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class MCMRMediaSource
+    {
+        
+    public:
+
+        /**
+        * Sink (output active object) is ready to accept new data
+        * @since 2.1
+        * @param aStatus    status object for active object
+        * @return void
+        */
+        virtual void RequestNewData(TRequestStatus& aStatus) = 0;
+
+        /**
+        * Cancel previous "request new data" request
+        */
+        virtual void RequestNewDataCancel(TRequestStatus& aStatus) = 0;
+
+        /**
+        * Get the next output buffer
+        * @since 2.1
+        * @return CCMRMediaBuffer* buffer, or NULL if doesn't exist
+        */
+        virtual CCMRMediaBuffer* GetNextBuffer() = 0;
+
+        /**
+        * Get the number of output buffers waiting in the source
+        * @since 2.1
+        * @return Number of buffers
+        */
+        virtual TInt NumBuffersWaiting() = 0;
+
+        /**
+        * Return the latest time stamp from the input stream
+        * @since 2.1
+        * @param TTimeIntervalMicroSeconds& aTimeStamp
+        */
+        virtual void LatestTimeStampL(TTimeIntervalMicroSeconds& aTimeStamp) const = 0;
+
+        /**
+        * Return the duration of the recording
+        * @since 2.6
+        * @param TTimeIntervalMicroSeconds& aDuration
+        */
+        virtual void DurationL(TTimeIntervalMicroSeconds& aDuration) const = 0;
+
+        /**
+        * Return a previously given buffer back to the source
+        * @since 2.1
+        * @param aBuffer The buffer to return
+        * @return void
+        */
+        virtual void ReturnBuffer(CCMRMediaBuffer* aBuffer) = 0;
+
+    };
+
+
+#endif // CCMRMEDIASOURCE_H
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRPerfMonitor.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Performance monitor timer
+*
+*/
+
+
+#ifndef CCMRPERFMONITOR_H
+#define CCMRPERFMONITOR_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mmf/devvideo/devvideobase.h>
+
+// FORWARD DECLARATIONS
+class CCMRActiveOutput;
+class CCMRVideoRecorderClient;
+class MMMFClockSource;
+class CCMRMediaRecorder;
+
+// CLASS DECLARATION
+
+/**
+*  Performance monitor class. Continuously checks the performance of the system (e.g. timestamps) 
+*  and adjusts video settings based on the current state
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRPerfMonitor : public CTimer, public MMMFClockSource
+    {
+    public: // Constants
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10060
+            };
+        
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRPerfMonitor* NewL(
+            CCMRActiveOutput* aAudioOutput, 
+            CCMRActiveOutput* aVideoOutput, 
+            CCMRVideoRecorderClient* aVideoRecorder,
+            CCMRMediaRecorder* aMediaRecorder);
+
+        /**
+        * Destructor.
+        */
+        ~CCMRPerfMonitor();
+
+    public: // New functions
+
+
+        /**
+        * Starts monitoring
+        * @since 2.1
+        */
+        void StartL();
+
+        /**
+        * Stops monitoring
+        * @since 2.1
+        */
+        void StopL();
+
+        void PauseL();
+
+    public: // From MMMFClockSource
+
+	    /**
+	    Retrieves a custom interface for the clock source.
+
+	    @param  "aInterface"	"Interface UID, defined by the entity specifying the interface."
+	    @return "Pointer to the interface implementation, or NULL if the interface is not available. 
+    			The pointer must be cast to the appropriate interface class."
+    	*/
+    	TAny* CustomInterface(TUid aInterface);
+
+	    /**
+	    Retrieves the current stream time.
+
+	    @return "The number of microseconds passed in the clock compared to the reference time."
+	    */
+	    TTimeIntervalMicroSeconds Time();
+
+    protected: // From CTimer/CActive
+
+        /**
+        * From CTimer Checks status & possibly adjusts settings
+        */
+        void RunL();
+
+        /**
+        * From CTimer Cancels timer
+        */
+        void DoCancel();
+
+        /**
+        * From CTimer Handles leaves from RunL
+        */
+        TInt RunError(TInt aError);
+
+    private: // Constructors
+
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRPerfMonitor() : CTimer(EPriorityHigh) {};
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(            
+            CCMRActiveOutput* aAudioOutput, 
+            CCMRActiveOutput* aVideoOutput, 
+            CCMRVideoRecorderClient* aVideoRecorder,
+            CCMRMediaRecorder* aMediaRecorder);
+
+
+    private: // Data
+        // active object handling audio output
+        CCMRActiveOutput* iAudioOutput;
+        // active object handling video output
+        CCMRActiveOutput* iVideoOutput;
+        // video recorder client handling video settings
+        CCMRVideoRecorderClient* iVideoRecorder;
+        // Mediarecorder - audio/video settings, audioenabled
+        CCMRMediaRecorder* iMediaRecorder;
+
+        // counter for total adjusted time in milliseconds
+        TInt iAdjustedTimeMs;
+        // latest audio timestamp
+        TTimeIntervalMicroSeconds iAudioTime;
+        // Pause offset when iClockSource in use.
+        TTimeIntervalMicroSeconds iClockSourcePauseOffset;
+        // whether performance monitor's timed monitoring function is running or not
+        TBool iTimedMonitoringRunning;
+        // System clocksource started
+        TBool iClockSourceStarted;
+        // Performance monitor paused
+        TBool iPerfMonPaused;
+        
+        TTime iStartTime;
+        TTimeIntervalMicroSeconds iTimeStampWhenPaused;
+    };
+
+
+#endif // CCMRPERFMONITOR_H
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRRecorderBase.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Abstract base class definition for A/V recorders
+*
+*/
+
+
+#ifndef CMRRECORDERBASE_H
+#define CMRRECORDERBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "CCMRConfigManager.h"
+
+// CLASS DECLARATION
+
+/**
+*  Abstract base class for A/V recorders
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+
+class CCMRRecorderBase : public CBase
+    {
+                 
+    
+    public: // Constants
+    
+        // Recorder states
+        enum TRecorderState
+            {
+                EStateNone=0,
+                EStateOpen,
+                EStatePreparing,
+                EStateReadyToRecord,
+                EStateRecording,
+                EStatePaused,
+                EStateStopping
+            };
+
+    public:  // Constructors and destructor        
+
+        /**
+        * C++ default constructor.        
+        */
+        inline CCMRRecorderBase() : iTargetBitRate(-2) {}
+
+        // CBase provides a virtual destructor
+
+    public: // New functions
+        
+        /**
+        * Set new target bitrate
+        * @since 2.1
+        * @param aBitrate bitrate
+        * @return void
+        */
+        virtual inline void SetTargetBitRateL( TInt aBitRate ) { iTargetBitRate = aBitRate; }
+
+        /**
+        * Get current target bitrate
+        * @since 2.1
+        * @param void
+        * @return TInt Bitrate     
+        */
+        virtual inline void TargetBitRateL(TInt& aTargetBitRate) { aTargetBitRate = iTargetBitRate; }
+
+        /**
+        * ?member_description.
+        * @since 2.1
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        inline void SetState(TRecorderState aState) { iState = aState; }
+
+        /**
+        * Get current state of the recorder
+        * @since 2.1
+        * @param void
+        * @return TRecorderState State
+        */
+        inline TRecorderState State() const { return iState; }
+
+        /**
+        * Checks if only dynamic recorder settings can be given. Other settings require prepare
+        * @since 2.1
+        * @param void
+        * @return ETrue, if 
+        */
+        inline TBool StateRequiresDynamicSetting() const { return ( (iState == EStateReadyToRecord || iState == EStateRecording || iState == EStatePaused || iState == EStateStopping)? ETrue : EFalse); }
+
+        /**
+        * Prepares the recorder 
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void PrepareL() = 0;
+
+        /**
+        * Starts recording
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void RecordL() = 0;
+
+        /**
+        * Stops recording
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void StopL() = 0;
+
+        /**
+        * Pauses recording
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void PauseL() = 0;
+
+        /**
+        * Resumes recording
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void ResumeL() = 0; 
+            
+    protected:  // Data        
+
+        // target bitrate in bits per second  
+        TInt iTargetBitRate;     
+
+    private:    // Data     
+
+        // internal state
+        TRecorderState iState;     
+
+    };
+
+            
+// End of File
+
+#endif      // CMRRECORDERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRSubThread.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,452 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Classes for subthread handling in media recorder
+*
+*/
+
+#ifndef CCMRSUBTHREAD_H
+#define CCMRSUBTHREAD_H
+
+// INCLUDES
+
+//#include <mmf/server/mmfdatapathproxy.h>
+#include <mmf/common/mmfcontrollerframework.h>
+
+// DATA TYPES
+
+/**
+* Thread messages ids
+*/ 
+enum TCMRSubThreadMessageIds
+    {
+    ECMRThreadReceiveEvents,
+    ECMRThreadCancelReceiveEvents,
+    ECMRThreadShutdown,
+    ECMRThreadLastCommonMsgId // dummy id needed when combining audio/video ids with this
+    };
+
+/** An attempt to close the subthread using RCMRSubThreadBase::Shutdown() has failed. The shutdown command
+* waits for both the death of the thread and the time-out of a timer to minimise the risk of deadlock.
+* If the timer times-out and the sub-thread is not dead then this thread is panicked in debug mode or,
+* in release mode the sub-thread is killed.
+*/
+enum TCMRSubThreadPanicCode
+	{
+	ECMRSubThreadPanicTimedOut = 1
+	};
+
+/**
+* The amount of time that is allowed for the thread to close down before the its thread is killed.
+*/
+#define  KCMRThreadProxyShutdownTimeout TTimeIntervalMicroSeconds32(10000000)
+
+/**
+* Thread's general error code used when sending events to clients; the same is used in MMF
+*/
+const TUid KCMRErrorCategoryThreadGeneralError = {0x101F76DC};
+/**
+* Defines the maximum number of event messages that will be held server-side
+* while waiting for the client to request the next message in the queue.
+*/
+static const TInt KCMRSubThreadMaxCachedMessages = 4;
+
+
+//CLASS DECLARATIONS
+
+/**
+*  Media recorder thread base class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class RCMRSubThreadBase : public RSessionBase
+    {
+    public: // Constructor
+
+        /**
+        * C++ default constructor.
+        */
+        inline RCMRSubThreadBase(const TTimeIntervalMicroSeconds32& aShutdownTimeout) 
+            : RSessionBase(), iSubThread(), iShutdownTimeout(aShutdownTimeout), iSessionCreated(EFalse) {};
+
+    public: // New functions
+        /**                     
+        * Return the thread id allowing a client to logon to the thread to receive notifications.
+        * @since 2.1
+        * @return TThreadId id
+        */
+        TThreadId SubThreadId() const {return iSubThread.Id();};
+
+        /**                     
+        * Allows a client to receive events from the thread
+        * @since 2.1
+        * @param TMMFEventPckg& aEventPckg
+        * @param TRequestStatus& aStatus
+        * @return void
+        */
+        void ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus) const;
+
+        /**                     
+        * Cancels reception of events from the thread
+        * @since 2.1
+        * @return TInt error code
+        */
+        TInt CancelReceiveEvents() const;
+
+        /**                     
+        * Shutdown the thread
+        * Note: This function will not return until the subthread has exited, or a timeout has occurred.
+        * @since 2.1
+        * @return void
+        */
+        void Shutdown();
+
+    protected:  // New functions
+        /**                     
+        * Derived classes call this to start the thread & create session with it
+        * @since 3.0
+        * @param TThreadFunction aFunction
+        * @param const TVersion& aVersion
+        * @param TBool& aThreadCreated
+        * @return TInt error code
+        */
+        TInt DoCreateSubThread(TThreadFunction aFunction, const TVersion& aVersion, TBool& aThreadCreated);
+
+
+        /**                     
+        * Panic the thread
+        * @since 2.1
+        * @param TCMRSubThreadPanicCode aPanicCode
+        * @return void
+        */
+        void Panic(TCMRSubThreadPanicCode aPanicCode);
+
+    protected:  //data
+        // handle of the thread
+        RThread iSubThread;
+
+        // shutdown timeout
+        TTimeIntervalMicroSeconds32 iShutdownTimeout;
+
+        // ETrue if session was created successfully (can send messages)
+        TBool iSessionCreated;
+
+    };
+
+
+/**
+*  Media recorder thread event monitor observer
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class MCMRSubThreadEventMonitorObserver
+    {
+    public: 
+        /**                     
+        * Handle the given event
+        * @since 2.1
+        * @param const TMMFEvent& aEvent
+        * @return void
+        */
+        virtual void HandleEvent(const TMMFEvent& aEvent) = 0;
+    };
+
+
+/**
+*  Media recorder thread event monitor
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRSubThreadEventMonitor : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRSubThreadEventMonitor* NewL(MCMRSubThreadEventMonitorObserver& aObserver, 
+            RCMRSubThreadBase& aSubThreadProxy);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRSubThreadEventMonitor();
+
+    public: // New functions
+        /**                     
+        * Start the event monitor
+        * @since 2.1
+        * @return void
+        */
+        void Start();
+
+    protected: // from CActive
+
+        /**
+        * From CActive active object main function
+        */
+        void RunL();
+        /**
+        * From CActive cancel active object
+        */
+        void DoCancel();
+
+    private: // constructor
+
+        /**
+        * C++ default constructor.
+        */
+        CCMRSubThreadEventMonitor(MCMRSubThreadEventMonitorObserver& aObserver, 
+            RCMRSubThreadBase& aSubThreadProxy);
+
+    private: // Data
+        // event monitor observer
+        MCMRSubThreadEventMonitorObserver& iObserver;
+        // sub thread proxy
+        RCMRSubThreadBase& iSubThreadProxy;
+        // events 
+        TMMFEventPckg iEventPckg;
+    };
+
+/**
+*  Media recorder thread shutdown timer class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRSubThreadShutdownTimer : public CTimer
+    {
+    enum {ECMRSubThreadShutdownDelay=5000000}; // 5s
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRSubThreadShutdownTimer* NewL();
+
+    public: // New functions
+
+        /**                     
+        * Start timer for forced shutdown if closing takes too long
+        * @since 2.1
+        * @return void
+        */
+        void Start();
+
+        /**                     
+        * Shutdown immediately
+        * @since 2.1
+        * @return void
+        */
+        void ShutdownNow() const;
+
+    protected: // from CTimer
+        /**
+        * From CTimer/CActive active object main function
+        */
+        void RunL();
+
+    private: // constructors
+        /**
+        * C++ default constructor.
+        */
+        CCMRSubThreadShutdownTimer();
+
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL();
+
+    };
+
+
+/**
+*  Media recorder thread event receiver class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRSubThreadEventReceiver : public CBase
+    {
+    public: // constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRSubThreadEventReceiver* NewL(const RMessage2& aMessage);
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRSubThreadEventReceiver();
+
+    public: // new functions
+        /**                     
+        * Send an event via this class
+        * @since 2.1
+        * @param const TMMFEvent& aEvent
+        * @return void
+        */
+        void SendEvent(const TMMFEvent& aEvent);
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CCMRSubThreadEventReceiver(const RMessage2& aMessage);
+
+    private: // data
+
+        // Message where event is put
+        RMessage2 iMessage;
+        // ETrue if message not completed
+        TBool iNeedToCompleteMessage;
+    };
+
+
+
+/**
+*  Media recorder thread proxy server base class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRThreadProxyServer : public CServer2
+    {
+    public: // Constructors and destructor
+        /**
+        * C++ default constructor.
+        */
+        CCMRThreadProxyServer(TInt aPriority);
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRThreadProxyServer();
+
+    public: // New functions
+
+        /**                     
+        * Informs that session has been created successfully
+        * @since 2.1
+        * @return void
+        */
+        virtual void SessionCreated();
+
+        /**                     
+        * Request to shutdown immediately
+        * @since 2.1
+        * @return void
+        */
+        virtual void ShutdownNow();
+
+    protected:
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL(RServer2* aServer2);
+
+    protected: // from CServer2
+        /**                     
+        * From CServer2/CActive handle errors in RunL
+        */
+        TInt RunError(TInt aError);
+
+        /**                     
+        * From CServer2 create a new session. Each derived class must implement this.
+        */
+        CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const = 0;
+
+    private: // data
+        // shutdown timer, needed if closing takes too much time
+        CCMRSubThreadShutdownTimer* iShutdownTimer;
+    };
+
+
+
+
+/**
+*  Media recorder thread proxy session base class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRThreadProxySession : public CSession2, public MAsyncEventHandler
+    {
+    public: // Constructors and destructor
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRThreadProxySession();
+
+    public: // from base classes
+
+        /**                     
+        * From CSession2 Completes construction of this server-side client session object
+        */
+        void CreateL();
+        /**                     
+        * From CSession2 service a message. Each derived class must implement this.
+        */
+        virtual void ServiceL(const RMessage2& aMessage) = 0;
+
+        /**                     
+        * From MAsyncEventHandler send event to client
+        */
+        virtual TInt SendEventToClient(const TMMFEvent& aEvent);
+
+    protected:
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRThreadProxySession() {};
+
+    protected: // New functions
+        /**                     
+        * Client requests to receive events
+        * @since 2.1
+        *
+        * @return TBool
+        */
+        virtual TBool ReceiveEventsL(const RMessage2& aMessage);
+        /**                     
+        * Stop event receiver
+        * @since 2.1
+        * @return TBool
+        */
+        virtual TBool CancelReceiveEvents();
+        /**                     
+        * Shutdown the server
+        * @since 2.1
+        * @return TBool
+        */
+        virtual TBool ShutDown();
+
+    protected: // data
+        // server connected to the session
+        CCMRThreadProxyServer* iServer;
+
+    private: // data
+        // event receiver
+        CCMRSubThreadEventReceiver* iEventReceiver;
+
+        // cached events
+        RArray<TMMFEvent> iEvents;
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRSupportedCodecs.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Four CC and Mime types for (supported) video and audio codecs
+*
+*/
+
+
+
+#ifndef CCMRSUPPORTEDCODECS_H
+#define CCMRSUPPORTEDCODECS_H
+
+#include <mmf/common/mmffourcc.h>
+
+// FourCC types for video and audio
+
+// These can't be TFourCC objects since TFourCC objects can't be constructed in compile time
+// The ID is internal representation of TFourCC, and computed like follows:
+// iFourCC =(aChar4<<24)+(aChar3<<16)+(aChar2<<8)+aChar1
+// The users should construct a TFourCC object using these numbers
+
+// Four CC for narrowband AMR (' ','A','M','R'), taken from Nokia MMF audio plugin source code
+const TInt32 KCMRFourCCIdAMRNB = KMMFFourCCCodeAMR;
+// Four CC for MPEG-4 AAC (' ','A','A','C')
+const TInt32 KCMRFourCCIdMPEG4AAC = KMMFFourCCCodeAAC;
+
+
+// Mime types for video
+
+// H.263 with profiles & levels. Exact level can be added after this string has been copied to destination
+_LIT8(KCMRMimeTypeH263, "video/H263-2000");
+// Baseline Profile
+_LIT8(KCMRMimeTypeH263BaselineProfile, "video/H263-2000; profile=0");
+// Profile 3; Version 2 Interactive and Streaming Wireless Profile
+_LIT8(KCMRMimeTypeH263Profile3, "video/H263-2000; profile=3");
+
+// MPEG-4 profile & level ID added after ; e.g. "video/mp4v-es; profile-level-id=8"
+_LIT8(KCMRMimeTypeMPEG4V, "video/mp4v-es");
+_LIT8(KCMRMimeTypeMPEG4VSP, "video/mp4v-es; profile-level-id=");
+_LIT8(KCMRMimeTypeMPEG4VSPL0, "video/mp4v-es; profile-level-id=8");
+_LIT8(KCMRMimeTypeMPEG4VSPL0B, "video/mp4v-es; profile-level-id=9");
+_LIT8(KCMRMimeTypeMPEG4VSPL1, "video/mp4v-es; profile-level-id=1");
+_LIT8(KCMRMimeTypeMPEG4VSPL2, "video/mp4v-es; profile-level-id=2");
+_LIT8(KCMRMimeTypeMPEG4VSPL3, "video/mp4v-es; profile-level-id=3");
+_LIT8(KCMRMimeTypeMPEG4VSPL4A, "video/mp4v-es; profile-level-id=4");
+_LIT8(KCMRMimeTypeMPEG4VSPL5, "video/mp4v-es; profile-level-id=5");
+_LIT8(KCMRMimeTypeMPEG4VSPL6, "video/mp4v-es; profile-level-id=6");
+
+// H.264 AVC 
+_LIT8(KCMRMimeTypeH264AVC, "video/H264");
+_LIT8(KCMRMimeTypeH264AVCProfileId, "video/H264; profile-level-id=");
+
+// H.264 AVC Baseline profile, levels 1 - 4
+_LIT8(KCMRMimeTypeH264AVCBPL10, "video/H264; profile-level-id=42800A");	// Level 1
+_LIT8(KCMRMimeTypeH264AVCBPL10b, "video/H264; profile-level-id=42900B");// Level 1b
+_LIT8(KCMRMimeTypeH264AVCBPL11, "video/H264; profile-level-id=42800B");	// Level 1.1
+_LIT8(KCMRMimeTypeH264AVCBPL12, "video/H264; profile-level-id=42800C");	// Level 1.2
+_LIT8(KCMRMimeTypeH264AVCBPL13, "video/H264; profile-level-id=42800D");	// Level 1.3
+_LIT8(KCMRMimeTypeH264AVCBPL20, "video/H264; profile-level-id=428014");	// Level 2
+_LIT8(KCMRMimeTypeH264AVCBPL21, "video/H264; profile-level-id=428015"); // Level 2.1
+_LIT8(KCMRMimeTypeH264AVCBPL22, "video/H264; profile-level-id=428016"); // Level 2.2
+_LIT8(KCMRMimeTypeH264AVCBPL30, "video/H264; profile-level-id=42801E"); // Level 3
+_LIT8(KCMRMimeTypeH264AVCBPL31, "video/H264; profile-level-id=42801F"); // Level 3.1
+_LIT8(KCMRMimeTypeH264AVCBPL32, "video/H264; profile-level-id=428020"); // Level 3.2
+_LIT8(KCMRMimeTypeH264AVCBPL40, "video/H264; profile-level-id=428028"); // Level 4
+
+// H.264 AVC Main profile, levels 1 - 4
+_LIT8(KCMRMimeTypeH264AVCMPL10, "video/H264; profile-level-id=4D400A");	// Level 1
+_LIT8(KCMRMimeTypeH264AVCMPL10b, "video/H264; profile-level-id=4D500B");// Level 1b
+_LIT8(KCMRMimeTypeH264AVCMPL11, "video/H264; profile-level-id=4D400B");	// Level 1.1
+_LIT8(KCMRMimeTypeH264AVCMPL12, "video/H264; profile-level-id=4D400C");	// Level 1.2
+_LIT8(KCMRMimeTypeH264AVCMPL13, "video/H264; profile-level-id=4D400D");	// Level 1.3
+_LIT8(KCMRMimeTypeH264AVCMPL20, "video/H264; profile-level-id=4D4014");	// Level 2
+_LIT8(KCMRMimeTypeH264AVCMPL21, "video/H264; profile-level-id=4D4015"); // Level 2.1
+_LIT8(KCMRMimeTypeH264AVCMPL22, "video/H264; profile-level-id=4D4016"); // Level 2.2
+_LIT8(KCMRMimeTypeH264AVCMPL30, "video/H264; profile-level-id=4D401E"); // Level 3
+_LIT8(KCMRMimeTypeH264AVCMPL31, "video/H264; profile-level-id=4D401F"); // Level 3.1
+_LIT8(KCMRMimeTypeH264AVCMPL32, "video/H264; profile-level-id=4D4020"); // Level 3.2
+_LIT8(KCMRMimeTypeH264AVCMPL40, "video/H264; profile-level-id=4D4028"); // Level 4
+
+// H.264 AVC High profile, levels 1 - 4
+_LIT8(KCMRMimeTypeH264AVCHPL10, "video/H264; profile-level-id=64400A");	// Level 1
+_LIT8(KCMRMimeTypeH264AVCHPL10b, "video/H264; profile-level-id=644009");// Level 1b
+_LIT8(KCMRMimeTypeH264AVCHPL11, "video/H264; profile-level-id=64400B");	// Level 1.1
+_LIT8(KCMRMimeTypeH264AVCHPL12, "video/H264; profile-level-id=64400C");	// Level 1.2
+_LIT8(KCMRMimeTypeH264AVCHPL13, "video/H264; profile-level-id=64400D");	// Level 1.3
+_LIT8(KCMRMimeTypeH264AVCHPL20, "video/H264; profile-level-id=644014");	// Level 2
+_LIT8(KCMRMimeTypeH264AVCHPL21, "video/H264; profile-level-id=644015"); // Level 2.1
+_LIT8(KCMRMimeTypeH264AVCHPL22, "video/H264; profile-level-id=644016"); // Level 2.2
+_LIT8(KCMRMimeTypeH264AVCHPL30, "video/H264; profile-level-id=64401E"); // Level 3
+_LIT8(KCMRMimeTypeH264AVCHPL31, "video/H264; profile-level-id=64401F"); // Level 3.1
+_LIT8(KCMRMimeTypeH264AVCHPL32, "video/H264; profile-level-id=644020"); // Level 3.2
+_LIT8(KCMRMimeTypeH264AVCHPL40, "video/H264; profile-level-id=644028"); // Level 4
+
+#endif // CCMRSUPPORTEDCODECS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRThreadPriorities.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video parameters optimized for reference HW
+*                when porting to another HW these may need to be changed
+*
+*/
+
+
+
+#ifndef CCMRTHREADPRIORITIES_H
+#define CCMRTHREADPRIORITIES_H
+
+// Audio thread priority. In some (at least low performance) HWs this should be EPriorityNormal 
+// to have audio and video running smoothly, whereas in some HWs it should be EPriorityMore, 
+// e.g. if fast response time to DevSound/HW buffer input is required
+// Please check video thread priorities too when changing these.
+// In udeb EPriorityMore seems to make audio thread the only active thread which makes the system 
+// unresponsive, hence the priority is then always normal, but the audio recording may not work properly
+// in all HWs (some frames may be missing)
+#ifdef _DEBUG
+const TThreadPriority KCMRAudioThreadPrioritySWCodec = EPriorityNormal;
+const TThreadPriority KCMRAudioThreadPriorityHWAccelarated = EPriorityNormal;
+#else
+const TThreadPriority KCMRAudioThreadPrioritySWCodec = EPriorityMore;
+const TThreadPriority KCMRAudioThreadPriorityHWAccelarated = EPriorityMore;
+#endif
+
+// Video thread priority. In some configurations high performance video requires higher thread 
+// priority to be able to move buffers fast enough between camera and video encoder.
+// However, it may have negative impact to audio operation. 
+// Hence please check audio thread priorities too when changing these.
+// In udeb it is better to have them as normal.
+#ifdef _DEBUG
+const TThreadPriority KCMRVideoThreadPriorityNormal = EPriorityNormal;
+const TThreadPriority KCMRVideoThreadPriorityHighPerf = EPriorityNormal;
+#else
+const TThreadPriority KCMRVideoThreadPriorityNormal = EPriorityMore;
+const TThreadPriority KCMRVideoThreadPriorityHighPerf = EPriorityMore;
+#endif
+
+#endif // CCMRVIDEOSETTINGS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoCameraSource.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for video camera source using the Symbian onboard camera API                 
+*
+*/
+
+
+#ifndef CCMRVIDEOCAMERASOURCE_H
+#define CCMRVIDEOCAMERASOURCE_H
+
+//  INCLUDES
+#include <ecam.h>  // Symbian onboard camera API header
+#include "CCMRVideoSource.h"
+
+// CLASS DECLARATION
+
+/**
+*  Symbian camera API wrapper
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRVideoCameraSource : public CBase, public MCMRVideoSource, public MCameraObserver, public MCameraObserver2
+    {
+    
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        CCMRVideoCameraSource(MCMRVideoSourceObserver* aObserver, TInt aCameraHandle);        
+        
+        /**
+        * Two-phased constructor.
+        */
+        
+        static CCMRVideoCameraSource* NewL(MCMRVideoSourceObserver* aObserver, TInt aCameraHandle);
+                                  
+        /**
+        * Destructor.
+        */
+        ~CCMRVideoCameraSource();           
+
+    public:  // Constants
+
+
+    public: // New functions
+        
+        /**
+        * Returns the current state of the camera source
+        * @since 2.1
+        * @param void 
+        * @return TVideoSourceState State (from CCMRVideoSource.h)
+        */
+        TVideoSourceState State();
+        
+    public: // Functions from base classes               
+
+        /**
+        * From MCMRVideoSource Get camera info        
+        */
+        void CameraInfo(TCameraInfo& aInfo);
+        
+        /**
+        * From MCMRVideoSource Get frame size        
+        */      
+        void GetFrameSize(TSize& aSize);
+        
+        /**
+        * From MCMRVideoSource Get frame rate        
+        */
+        TReal32 FrameRate();
+        
+        /**
+        * From MCMRVideoSource Get no. of frame buffers in use                
+        */
+        TInt BuffersInUse();
+        
+        /**
+        * From MCMRVideoSource Get no. of frames in one buffer
+        */
+        TInt FramesPerBuffer();
+        
+        /**
+        * From MCMRVideoSource Query whether capture is active        
+        */       
+        TBool CaptureActive();
+        
+        /**
+        * From MCMRVideoSource Reserve camera                
+        */
+        void Reserve();
+        
+        /**
+        * From MCMRVideoSource Release camera       
+        */
+        void Release();               
+        
+        /**
+        * From MCMRVideoSource Enumarates frame sizes
+        */
+        void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,
+            CCamera::TFormat aFormat) const;
+        
+        /**
+        * From MCMRVideoSource Enumarates frame rates        
+        */
+        void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,CCamera::TFormat aFormat, 
+            TInt aSizeIndex, CCamera::TExposure aExposure) const;       
+        
+        /**
+        * From MCMRVideoSource Prepares camera for capturing
+        */
+        void PrepareCaptureL(CCamera::TFormat aFormat,TInt aSizeIndex,
+            TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer);
+                
+        /**
+        * From MCMRVideoSource Prepares camera for capturing
+        */
+        void PrepareCaptureL(CCamera::TFormat aFormat, TInt aSizeIndex,
+            TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,
+            const TRect& aClipRect);
+        
+        /**
+        * From MCMRVideoSource Starts capturing
+        */
+        void StartCapture();
+        
+        /**
+        * From MCMRVideoSource Stops capturing
+        */
+        void StopCapture();           
+
+        /**
+        * From MCMRVideoSource Get current exposure setting
+        */
+        CCamera::TExposure GetExposure() const;
+
+        /**
+        * From MCameraObserver Informs that reserve has completed
+        */
+        void ReserveComplete(TInt aError);
+
+        /**
+        * From MCameraObserver Informs that frame buffer is ready
+        */
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);
+
+        /**
+        * From MCameraObserver Informs that Power on has completed
+        */
+        void PowerOnComplete( TInt aError );
+
+        /**
+        * From MCameraObserver Informs that Viewfinder frame is ready => not applicable..
+        */
+        inline void ViewFinderFrameReady( CFbsBitmap& /*aFrame*/ )
+            { User::Panic(_L("CCMRVIDEOCAMERASOURCE"), KErrNotSupported); }
+
+        /**
+        * From MCameraObserver Informs that still image is ready => not applicable..                
+        */
+        inline void ImageReady( CFbsBitmap* /*aBitmap*/,HBufC8* /*aData*/,TInt /*aError*/ ) 
+            { User::Panic(_L("CCMRVIDEOCAMERASOURCE"), KErrNotSupported); }
+
+        /**
+        * From MCameraObserver2 Informs that client should handle a event
+        */
+        void HandleEvent(const TECAMEvent& aEvent);
+
+        /**
+        * From MCameraObserver2 Informs that viewfinder frame is ready
+        */
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+        /**
+        * From MCameraObserver2 Informs that a new captured image is ready
+        */
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    
+        /**
+        * From MCameraObserver2 Informs that a new captured video is ready
+        */
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    private:  // New functions
+        
+        /**
+        * By default EPOC constructor is private.
+        */
+        void ConstructL();      
+               
+    private:    // Data
+
+        // internal state
+        TVideoSourceState iState;  
+        // is the camera reserved for us?
+        TBool iReserved;  
+        // the observer
+        MCMRVideoSourceObserver* iObserver;                                      
+        // camera index
+        TInt iCameraHandle; 
+        // the Camera
+        CCamera* iCamera;   
+        // ETrue if the camera was opened as duplicate using a given handle
+        TBool iDuplicateInstance;
+    };
+
+
+#endif // CCMRVIDEOCAMERASOURCE_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecData.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for video codec data class which is specific to each codec type
+*
+*/
+
+
+#ifndef CCMRVIDEOCODECDATA_H
+#define CCMRVIDEOCODECDATA_H
+
+// INCLUDES
+#include "CCMRMediaSink.h"
+
+#include <e32base.h>
+
+// FORWARD DECLARATION
+class CMMFDevVideoRecord;
+class TCCMRVideoCodingOptions;
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for audio codec data
+*
+*  @lib 
+*  @since 2.7
+*/
+class CCMRVideoCodecData : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRVideoCodecData(CCMRMediaBuffer::TBufferType aCodecType, TInt aVideoCodecLevel) : iCodecType(aCodecType), iVideoCodecLevel(aVideoCodecLevel) {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRVideoCodecData() {};
+       
+    public: // New functions
+
+        /**                     
+        * Get the max bitrate for the used level
+        * @return TInt bitrate in bps
+        */
+        virtual TInt MaxBitRate() const = 0;
+
+        /**                     
+        * Get the max framerate for the used level
+        * @param TSize& aFrameSize
+        * @return TReal32 framerate in fps
+        */
+        virtual TReal32 MaxFrameRate(const TSize& aFrameSize) const = 0;
+
+        /**                     
+        * Get the max frame size for the used level
+        * @param TSize& aFrameSize
+        */
+        virtual TBool MaxFrameSize(const TSize& aFrameSize) const = 0;
+
+        /**                     
+        * Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+        * @param TSize& aFrameSize
+        * @return TInt Max frame length in bytes
+        */
+        virtual TInt MaxBufferLength(const TSize& aFrameSize) const = 0;
+
+        /**
+        * Check if codec level indicates we are recording for MMS; then some tighter restrictions apply
+        * @return ETrue if level is a typical MMS level
+        */
+        virtual TBool LevelForMMS() const = 0;
+
+        /**
+        * Check if decoder configuration info is needed in separate buffer
+        * @return ETrue if decoder configuration info is needed
+        */
+        virtual TBool DecoderConfigInfoUsed() const = 0;
+
+        /**
+        * Set misc video coding options
+        * @param  aOptions      video coding options
+        * @return void
+        */
+        virtual void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions) = 0;
+        
+        /**
+        * Set codec-specific video coding options to DevVideoRecord before initialize
+        * @param  CMMFDevVideoRecord* aDevVideoRecord
+        * @return void
+        */
+        virtual void SetPreInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const = 0;
+        
+        /**
+        * Set codec-specific video coding options to DevVideoRecord after initialize
+        * @param  CMMFDevVideoRecord* aDevVideoRecord
+        * @return void
+        */
+        virtual void SetPostInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const = 0;
+        
+        /**                     
+        * Returns the CCMRMediaSink/CCMRMediaBuffer compatible type of the codec buffer 
+        * @return CCMRMediaBuffer::TBufferType buffer type
+        */
+        inline CCMRMediaBuffer::TBufferType CodecType() const { return iCodecType; };
+
+    protected:
+
+        // Codec type in highest level: H.263 or MPEG-4; using CCMRMediaBuffer types since it is the only existing available enum for codecs
+        CCMRMediaBuffer::TBufferType iCodecType;
+
+        // Codec level; actual values depend on the codec used, e.g for H.263 the values are 10,45,20, ... and for MPEG-4 0,9 (=0b),1,2,3
+        TInt iVideoCodecLevel;
+        
+        // Indicates if client expects any bit errors => should video codec be configured for error resilience
+        TReal iExpectedBitErrorRate;
+    
+    };  
+    
+
+
+#endif      // CCMRVIDEOCODECDATA_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecDataH263.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for H.263 video codec data class
+*
+*/
+
+
+#ifndef CCMRVIDEOCODECDATAH263_H
+#define CCMRVIDEOCODECDATAH263_H
+
+// INCLUDES
+#include "CCMRVideoCodecData.h"
+#include "CCMRVideoSettings.h"
+
+#include <e32base.h>
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for audio codec data
+*
+*  @lib 
+*  @since 2.7
+*/
+class CCMRVideoCodecDataH263 : public CCMRVideoCodecData
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRVideoCodecDataH263(TInt aVideoCodecLevel) : CCMRVideoCodecData( CCMRMediaBuffer::EVideoH263, aVideoCodecLevel ), iSyncIntervalInPicture(KCMRSyncIntervalInPicture) {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRVideoCodecDataH263() {};
+       
+    public: // functions from base classes
+
+        /**                     
+        * Get the max bitrate for the used level
+        * @return TInt bitrate in bps
+        */
+        TInt MaxBitRate() const;
+
+        /**                     
+        * Get the max framerate for the used level
+        * @param TSize& aFrameSize
+        * @return TReal32 framerate in fps
+        */
+        TReal32 MaxFrameRate(const TSize& aFrameSize) const;
+
+        /**                     
+        * Get the max frame size for the used level
+        * @param TSize& aFrameSize
+        * @return TBool 
+        */
+        TBool MaxFrameSize(const TSize& aFrameSize) const;
+
+        /**                     
+        * Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+        * @param TSize& aFrameSize
+        * @return TInt Max frame length in bytes
+        */
+        TInt MaxBufferLength(const TSize& aFrameSize) const;
+
+        /**
+        * Check if codec level indicates we are recording for MMS; then some tighter restrictions apply
+        * @return ETrue if level is a typical MMS level
+        */
+        TBool LevelForMMS() const;
+
+        /**
+        * Check if decoder configuration info is needed in separate buffer
+        * @return EFalse since this is H.263
+        */
+        inline TBool DecoderConfigInfoUsed() const { return EFalse; };
+
+        /**
+        * Set misc video coding options
+        * @param  aOptions      video coding options
+        * @return void
+        */
+        void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions);
+
+        /**
+        * Set codec-specific video coding options to DevVideoRecord before initialize
+        * @param  aDevVideoRecord
+        * @return void
+        */
+        void SetPreInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const;
+        
+        /**
+        * Set codec-specific video coding options to DevVideoRecord after initialize
+        * @param  aDevVideoRecord
+        * @return void
+        */
+        void SetPostInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const;
+  
+    private:
+
+        // Interval of GOB headers in picture
+        TInt iSyncIntervalInPicture;
+    
+    };  
+    
+
+
+#endif      // CCMRVIDEOCODECDATAH263_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecDataH264AVC.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for H.264 AVC video codec data class
+*
+*/
+
+
+#ifndef CCMRVIDEOCODECDATAH264AVC_H
+#define CCMRVIDEOCODECDATAH264AVC_H
+
+// INCLUDES
+#include "CCMRVideoCodecData.h"
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+*  Base class for audio codec data
+*
+*  @lib 
+*  @since 3.2
+*/
+class CCMRVideoCodecDataH264AVC : public CCMRVideoCodecData
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRVideoCodecDataH264AVC(TInt aVideoCodecLevel) : CCMRVideoCodecData( CCMRMediaBuffer::EVideoH264NAL, aVideoCodecLevel ) {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRVideoCodecDataH264AVC() {};
+       
+    public: // functions from base classes
+
+        /**                     
+        * Get the max bitrate for the used level
+        * @return TInt bitrate in bps
+        */
+        TInt MaxBitRate() const;
+
+        /**                     
+        * Get the max framerate for the used level
+        * @return TReal32 framerate in fps
+        */
+        TReal32 MaxFrameRate(const TSize& aFrameSize) const;
+
+        /**                     
+        * Get the max frame size for the used level
+        * @param TSize& framesize
+        */
+        TBool MaxFrameSize(const TSize& aFrameSize) const;
+
+        /**                     
+        * Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+        * @return TInt Max frame length in bytes
+        */
+        TInt MaxBufferLength(const TSize& aFrameSize) const;
+
+        /**
+        * Check if codec level indicates we are recording for MMS; then some tighter restrictions apply
+        * @return ETrue if level is a typical MMS level
+        */
+        TBool LevelForMMS() const;
+
+        /**
+        * Check if decoder configuration info is needed in separate buffer
+        * @return ETrue since this is MPEG-4
+        */
+        inline TBool DecoderConfigInfoUsed() const { return ETrue; };
+
+        /**
+        * Set misc video coding options
+        * @param  aOptions      video coding options
+        * @return void
+        */
+        void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions);
+  
+        /**
+        * Set codec-specific video coding options to DevVideoRecord before initialize
+        * @param  aDevVideoRecord
+        * @return void
+        */
+        void SetPreInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const;
+        
+        /**
+        * Set codec-specific video coding options to DevVideoRecord after initialize
+        * @param  aDevVideoRecord
+        * @return void
+        */
+        void SetPostInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const;
+  
+    };  
+    
+
+
+#endif      // CCMRVIDEOCODECDATAH264AVC_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecDataMPEG4.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for H.263 video codec data class
+*
+*/
+
+
+#ifndef CCMRVIDEOCODECDATAMPEG4_H
+#define CCMRVIDEOCODECDATAMPEG4_H
+
+// INCLUDES
+#include "CCMRVideoCodecData.h"
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+*  Base class for audio codec data
+*
+*  @lib 
+*  @since 2.7
+*/
+class CCMRVideoCodecDataMPEG4 : public CCMRVideoCodecData
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRVideoCodecDataMPEG4(TInt aVideoCodecLevel) : CCMRVideoCodecData( CCMRMediaBuffer::EVideoMPEG4, aVideoCodecLevel ) {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRVideoCodecDataMPEG4() {};
+       
+    public: // functions from base classes
+
+        /**                     
+        * Get the max bitrate for the used level
+        * @return TInt bitrate in bps
+        */
+        TInt MaxBitRate() const;
+
+        /**                     
+        * Get the max framerate for the used level
+        * @return TReal32 framerate in fps
+        */
+        TReal32 MaxFrameRate(const TSize& aFrameSize) const;
+
+        /**                     
+        * Get the max frame size for the used level
+        * @param TSize& framesize
+        */
+        TBool MaxFrameSize(const TSize& aFrameSize) const;
+
+        /**                     
+        * Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+        * @return TInt Max frame length in bytes
+        */
+        TInt MaxBufferLength(const TSize& aFrameSize) const;
+
+        /**
+        * Check if codec level indicates we are recording for MMS; then some tighter restrictions apply
+        * @return ETrue if level is a typical MMS level
+        */
+        TBool LevelForMMS() const;
+
+        /**
+        * Check if decoder configuration info is needed in separate buffer
+        * @return ETrue since this is MPEG-4
+        */
+        inline TBool DecoderConfigInfoUsed() const { return ETrue; };
+
+        /**
+        * Set misc video coding options
+        * @param  aOptions      video coding options
+        * @return void
+        */
+        void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions);
+  
+        /**
+        * Set codec-specific video coding options to DevVideoRecord before initialize
+        * @param  aDevVideoRecord
+        * @return void
+        */
+        void SetPreInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const;
+        
+        /**
+        * Set codec-specific video coding options to DevVideoRecord after initialize
+        * @param  aDevVideoRecord
+        * @return void
+        */
+        void SetPostInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const;
+  
+    };  
+    
+
+
+#endif      // CCMRVIDEOCODECDATAMPEG4_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoCodecs.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for video codec class
+*                Codec variation is handled through this class: MPEG-4 video 
+*                can be supported only if feature flag __MPEG4_VIDEO_ENCODING
+*                is defined. Most of the MPEG-4 code is embedded, but the current
+*                controller allows to set MPEG-4 iff GetSupportedVideoCodecsL
+*                returns MPEG-4 codec as one of the supported codecs.
+*                There are two implementations for this class, one that checks 
+*                DevVideoRecord for basic codecs (H.263 only), and another one
+*                that checks H.263 and MPEG-4. The basic one is used if the MPEG4
+*                feature flag is not defined.
+*
+*/
+
+
+#ifndef CCMRVIDEOCODECS_H
+#define CCMRVIDEOCODECS_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>    // CDesC8ArrayFlat
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Internal class to check supported video codecs
+*
+*  @lib 
+*  @since 2.6
+*/
+class CCMRVideoCodecs : public CBase
+                          
+
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRVideoCodecs* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRVideoCodecs();               
+
+    public: // New functions
+        
+        /**
+        * Get supported & installed video codecs.
+        * @since 2.6
+        * @param  aVideoMimeTypes   List of supported & installed video codecs as MIME type
+        * @return void
+        */
+        void GetSupportedVideoCodecsL( CDesC8Array& aVideoMimeTypes ) const;
+
+        /**
+        * Check if the given codec is supported & installed.
+        * @since 2.6
+        * @param  aMimeType   Video codec MIME type
+        * @return void
+        */
+        TBool DoWeSupportThisL(const TDesC8& aMimeType) const;
+
+    protected:
+
+        /**
+        * Generate list of supported & installed video codecs.
+        * Called internally in the construction
+        */
+        void GenerateListOfSupportedVideoCodecsL();
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRVideoCodecs() {};
+                        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // List of supported & installed video codecs
+        CDesC8ArrayFlat* iVideoMimeTypes;
+
+
+    };  
+    
+#endif      // CCMRVIDEOCODECS_H
+    
+// End of File
+    
+    
+    
+    
+    
+
+    
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoHWParams.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video parameters optimized for reference HW
+*                when porting to another HW these may need to be changed
+*
+*/
+
+
+
+#ifndef CCMRVIDEOHWPARAMS_H
+#define CCMRVIDEOHWPARAMS_H
+
+// INCLUDES
+#include "CCMRVideoSettings.h"
+
+
+// GENERIC CONSTANTS
+
+// lipsync: 
+// give larger number if video is ahead/audio is late (more audio recorded than video)
+// give smaller number if video is behind/audio is early
+// if value is negative, video should "pause" for a while, if positive, video should fast forward
+// first values for HW codecs (DevSound outputs compressed data)
+const TInt KCMRInitialVideoAudioTimeSyncHW = -100;   
+const TInt KCMRPauseVideoAudioTimeSyncHW = -100;   
+// the same values for SW codecs (DevSound outputs PCM)
+const TInt KCMRInitialVideoAudioTimeSyncSW = 0;  
+const TInt KCMRPauseVideoAudioTimeSyncSW = -60;  
+// values for DirectCapture encoders (camcorderMMFPlugin doestn't provide raw image data, but encoder
+// uses camera directly).
+const TInt KCMRInitialVideoAudioTimeSyncDC = -200;
+const TInt KCMRPauseVideoAudioTimeSyncDC = -65;
+const TInt KCMRPauseVideoAudioTimeSyncDC_LowSampleRate = 0;
+const TInt KCMRPauseVideoAudioTimeSyncDC_LowSampleRateValue = 8000;
+const TInt KCMRPauseVideoAudioTimeSyncDC_MidSampleRate = -137;
+const TInt KCMRPauseVideoAudioTimeSyncDC_MidSampleRateValue = 16000;
+
+// default video complexity settings. If HW device doesn't support given level, 0 is used
+const TInt KCMRVideoComplexityARMSubQCIF = 0; // 0 is the highest
+const TInt KCMRVideoComplexityARMQCIF = 1; // 0 is the highest, but use 1 
+
+// night mode framerate, assumes camera HW 
+const TReal32 KCMRNightModeFrameRate = 3.75;//This is assumed to be KCMRFrameRate/4 but some compilers don't like if const is divided
+
+// Average video bitrate is assumed to be 90% of the target. This depends on the HW performance and encoder's rate control etc, 
+// but may also depend on the content of video and may hence be difficult to hardcode. By default the encoder is asked to use
+// "semi-variable bitrate" meaning that it is asked prefer quality over constant rate (KCMRLatencyQyalityTradeoff in CCMRVideoSettings.h)
+// but it depends on the encoder if it can follow the setting. This settings has direct impact to the estimated remaining recording time
+// in the beginning of recording
+const TReal KCMRAvgVideoBitRateScaler = 0.9;
+
+// Preferred AAC audio samplerates based on video framesize.
+const TInt KCMRAACAudioSampleRateWithVGA = 48000;
+const TInt KCMRAACAudioSampleRateWithQVGA = 48000;
+const TInt KCMRAACAudioSampleRateWithCIF = 16000;
+
+// Preferred AAC audio channelmode based on video framesize (mono=1, stereo=2).
+const TInt KCMRAACAudioChannelModeWithVGA = 2;
+const TInt KCMRAACAudioChannelModeWithQVGA = 2;
+const TInt KCMRAACAudioChannelModeWithCIF = 1;
+
+#endif // CCMRVIDEOSETTINGS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoRecorder.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,752 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for video recorder class
+*
+*/
+
+
+#ifndef CCMRVIDEORECORDER_H
+#define CCMRVIDEORECORDER_H
+
+// INCLUDES
+
+#include "CCMRRecorderBase.h"
+#include "CCMRVideoSource.h"
+#include "CCMRMediaSource.h"
+#include <mmf/devvideo/devvideorecord.h>
+
+
+// FORWARD DECLARATIONS
+class CCMRFifo;
+class CCMRActiveOutput;
+class TCCMRVideoCodingOptions;
+class CCMRVideoCodecData;
+class CVideoEncoderInfo;
+
+
+// this is set in .mmp
+#ifdef VIDEO_FILE_INPUT
+// use test file input
+#include "ccmrvideofilesource.h"
+
+#else
+// use actual camera API
+#include "CCMRVideoCameraSource.h"
+#endif
+
+// this is set in .mmp
+// Write captured frames OR video bitstream to a file
+#if defined VIDEO_FILE_OUTPUT || defined VIDEO_BS_FILE_OUTPUT
+#include <f32file.h>
+#endif
+
+// FORWARD DECLARATIONS
+class MAsyncEventHandler;
+class CCMRConfigManager;
+
+
+// CLASS DECLARATION
+
+
+/**
+*  Video recorder class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRVideoRecorder : public CCMRRecorderBase, public MCMRVideoSourceObserver, 
+                          public MMMFDevVideoRecordObserver, public MCMRMediaSource
+
+    {
+    public:
+        // Video bit-rate control mode
+        enum TCMRVideoBitRateMode
+            {
+            EBitRateConstant,
+            EBitRateVariable
+            };
+
+    public:
+        /**
+        *  Internal class for returning buffers to devvideo using active object
+        *  Needed since devvideo can't handle calls from multiple threads
+        */
+        class CCMRReturnAO : public CActive
+            {
+            public: // Constructors and destructor
+                     
+                /**
+                * Two-phased constructor.
+                */
+                static CCMRReturnAO* NewL(CCMRVideoRecorder* aHost);
+                /**
+                * Destructor.
+                */
+                virtual ~CCMRReturnAO(); 
+
+            public: // New functions
+            
+                /**
+                * Enqueue TVideoOutputBuffer from controller thread to be returned to 
+                * DevVideoRecord from this thread
+                */
+                void EnqueueReturnBuffer(TVideoOutputBuffer* aBuffer);
+                
+                /**
+                * Flush TVideoOutputBuffer's from video thread to DevVideoRecord
+                */                
+                void Flush();
+
+            protected: // from baseclass
+
+                /**
+                * From CActive Does the required action (calls the observer)
+                */
+                void RunL();
+                /**
+                * From CActive Cancels pending actions
+                */
+                void DoCancel();
+                
+                /**
+                * From CActive Handles leaves from RunL
+                */
+                TInt RunError(TInt aError);
+
+            private: // constructors
+                
+                /**
+                * By default ConstructL is private.
+                */
+                void ConstructL();
+                
+                /**
+                * C++ default constructor.
+                */
+                CCMRReturnAO(CCMRVideoRecorder* aHost);
+
+            private: // data
+            
+                // Queue for buffers to be returned
+                TDblQue<TVideoOutputBuffer> iVideoOutputBufferReturnQue;
+                TDblQueIter<TVideoOutputBuffer> iVideoOutputBufferReturnQueIter;
+                
+                // "host" object used to actually return the buffer, it owns the DevVideoRecord object
+                CCMRVideoRecorder* iHost;
+                // Mutex
+                TBool iMutexCreated;
+                RMutex iMutexObj; 
+                // Video thread handle; needed since AO may be activated from controller thread
+                RThread iVideoThreadHandle;
+                TBool iThreadHandleOpened;
+            };
+    
+    public:  // Constructors and destructor
+        
+                        
+        /**
+        * Two-phased constructor.
+        */
+        
+        static CCMRVideoRecorder* NewL(MAsyncEventHandler& aEventHandler, CCMRConfigManager* aConfig );
+
+        /**
+        * Destructor.
+        */
+
+        virtual ~CCMRVideoRecorder();               
+
+    public:   // Constants        
+
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10030,
+            };
+        
+    public: // New functions
+        
+        /**
+        * Sets output active object
+        * @since 2.1
+        * @param CCMRActiveOutput* aOutput
+        * @return void
+        */
+        void SetOutputL(CCMRActiveOutput* aOutput);
+        /**
+        * Sets clock source
+        * @since 3.0
+        * @param MMMFClockSource* aClockSource
+        * @return void
+        */
+        void SetClockSource(MMMFClockSource* aClockSource);
+        /**
+        * Sets camera handle & create camera instance
+        * @since 2.1
+        * @param TInt aCameraHandle
+        * @return void
+        */
+        void SetCameraHandleL(TInt aCameraHandle);
+
+        /**
+        * Sets id of the output thread
+        * @since 2.1
+        * @param TUint aThreadId
+        * @return void
+        */
+        void SetOutputThreadIdL(TUint aThreadId);
+               
+        /**
+        * Sets video Mime type (codec)
+        * @since 2.1
+        * @param aMimeType   video codec Mime type
+        * @return void
+        */
+        void SetVideoCodecL(const TDesC8& aMimeType);
+
+        /**
+        * Get the currently used video codec
+        * @since 2.1
+        * @param  aVideoMimeType    Used codec as mime type
+        * @return TInt Error code
+        */
+        void GetVideoCodecL( TDes8& aVideoMimeType ) const;
+
+
+        /**
+        * Sets new input & output frame size
+        * @since 2.1
+        * @param aSize New size
+        * @return void
+        */
+        void SetFrameSizeL(const TSize& aSize);
+        
+        /**
+        * Gets current input & output video frame size
+        * @since 2.1
+        * @param aSize Output parameter for the size
+        * @return void
+        */
+        void FrameSizeL(TSize& aSize) const;
+        
+        /**
+        * Sets new target encoding frame rate
+        * @since 2.1
+        * @param aFrameRate New frame rate
+        * @return TInt Error code     
+        */
+        void SetFrameRateL(TReal32 aFrameRate);
+        
+        /**
+        * Get current target encoding frame rate
+        * @since 2.1
+        * @return TReal32 Frame rate
+        */
+        void FrameRateL(TReal32& aFrameRate) const;
+
+        /**
+        * Set misc video coding options
+        * @since 2.1
+        * @param  aOptions      video coding options
+        * @return void
+        */
+        void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions);
+        
+        /**                     
+        * Set video rate control options
+        * @since 3.2
+        * @param  const TRateControlOptions& aOptions
+        * @return void
+        */        
+        void SetVideoRateControlOptionsL(const TRateControlOptions& aOptions);   
+        
+        /**                     
+        * Get video rate control options
+        * @since 3.2
+        * @param  const TRateControlOptions& aOptions
+        * @return void
+        */
+        void GetVideoRateControlOptionsL(TRateControlOptions& aOptions);
+
+        /**
+        * Set video encoder using its UID. Usage optional.
+        * This overrides Media Recorder internal search for encoder based on set video mime type ( SetVideoCodecL() ).
+        * @since 3.2.3
+        * @param    "aEncoder"  "Video encoder UID."
+        * @return void
+        */
+        void SetPreferredVideoEncoderL(TUid& aEncoder);
+
+        /**
+        * Set video encoder output format encapsulation. Usage optional.
+        * This overrides Media Recorder internal default preferences for TVideoDataUnitEncapsulation
+        * if used encoder supports multiple encapsulations.
+        *
+        * Defaults are:
+        *   H.263 and MPEG-4 part 2 : EDuElementaryStream
+        *               H.264 / AVC : EDuGenericPayload
+        *
+        * @since 3.2.3
+        * @param    "aCapsulation"  "Encapsulation for coded video data units."
+        * @return void
+        */
+        void SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation);
+
+        /**                     
+        * Set video segment target size
+        * @since 5.2
+        * @param  TUint aLayer              Layer number
+        * @param  TUint aSizeBytes          Segment target size in bytes
+        * @param  TUint aSizeMacroblocks    Segment target size in number of macroblocks per segment
+        * @return void
+        */     
+        void SetSegmentTargetSizeL(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks);        
+        
+        /**
+        * Adjust time stamps of video
+        * @since 2.1
+        * @param  const TInt aAdjustmentMs time in ms, can be positive or negative
+        * @return void
+        */
+        void AdjustTimeStampsL(const TInt aAdjustmentMs);
+        
+        /**                     
+        * Return buffer to DevVideoRecord
+        * @param  TVideoOutputBuffer* aBuffer returned buffer
+        * @return void
+        */                
+        void ReturnBufferToDevVR(TVideoOutputBuffer* aBuffer);
+
+        /**
+        * Used while stopping. Requests encoded video frames from adaptation and waits for the streamend / EOS notification.
+        * @since 5.2
+        * @return void
+        */
+        void RequestBuffersAndWaitEOSL(TInt& aVideoEOSReached);  
+
+    public: // Functions from base classes
+
+        /**
+        * From CCMRRecorderBase Set new target bitrate
+        */
+        void SetTargetBitRateL(TInt aBitRate);
+
+        /**
+        * From CCMRRecorderBase Get current target bitrate
+        */
+        void TargetBitRateL(TInt& aBitRate);
+
+        /**
+        * From CCMRRecorderBase Prepare for recording
+        */
+        void PrepareL();
+
+        /**
+        * From CCMRRecorderBase Start recording
+        */
+        void RecordL();
+
+        /**
+        * From CCMRRecorderBase Stops recording (async, client must wait for state change)
+        */
+        void StopL();
+
+        /**
+        * From CCMRRecorderBase Pause recording
+        */
+        void PauseL();
+
+        /**
+        * From CCMRRecorderBase Resume recording
+        */
+        void ResumeL();     
+
+        /**
+        * From MDEVVRVideoRecordObserver Return a video picture to the devVideo interface
+        * @param aPicture Pointer to the returned picture        
+        */
+        void MdvroReturnPicture(TVideoPicture* aPicture);
+
+        /**
+        * From MDEVVRVideoRecordObserver Supplemental info sent to encoder
+        */
+        void MdvroSupplementalInfoSent();
+
+        /**
+        * From MDEVVRVideoRecordObserver New buffers available for retrieval
+        */
+        void MdvroNewBuffers();
+
+        /**
+        * From MDEVVRVideoRecordObserver Fatal error has occurred
+        */
+        void MdvroFatalError(TInt aError);
+
+        /**
+        * From MDEVVRVideoRecordObserver Initialisation has been completed
+        * @param aError Error code
+        */
+        void MdvroInitializeComplete(TInt aError);
+
+        /**
+        * From MDEVVRVideoRecordObserver All pictures have been processed.
+        */
+        void MdvroStreamEnd();
+
+        /**
+        * From MCMRVideoSourceObserver Video source has been reserved
+        */
+        void MvsoReserveComplete(TInt aError);
+
+        /**
+        * From MCMRVideoSourceObserver A video frame has been captured
+        */
+        void MvsoFrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);
+        
+
+        /**
+        * From MCMRMediaSource Output active object is ready to accept new data
+        */
+        void RequestNewData(TRequestStatus& aStatus);
+
+        /**
+        * From MCMRMediaSource Output active object is cancelling new data request
+        */
+        void RequestNewDataCancel(TRequestStatus& aStatus);
+
+        /**
+        * From MCMRMediaSource Output active object takes the next output buffer
+        */
+        CCMRMediaBuffer* GetNextBuffer();
+
+        /**
+        * From MCMRMediaSource Return the number of buffers in the source
+        */
+        TInt NumBuffersWaiting();
+
+        /**
+        * From MCMRMediaSource Return the latest time stamp from the input stream
+        */
+        void LatestTimeStampL(TTimeIntervalMicroSeconds& aTimeStamp) const;
+
+        /**
+        * From MCMRMediaSource Return the duration of the recording
+        */
+        void DurationL(TTimeIntervalMicroSeconds& aDuration) const;
+
+        /**
+        * From MCMRMediaSource Output active object returns an emptied buffer
+        */
+        void ReturnBuffer(CCMRMediaBuffer* aBuffer);
+
+    private: // constructors
+        
+        /**
+        * C++ default constructor.
+        */
+        CCMRVideoRecorder(MAsyncEventHandler& aEventHandler) : iEventHandler(aEventHandler),
+        	                iVideoOutputBufferInputQue(_FOFF(TVideoOutputBuffer,iLink)),
+	                        iVideoOutputBufferInputQueIter(iVideoOutputBufferInputQue)
+            {};
+
+        /**
+        * By default EPOC constructor is private.
+        */
+        void ConstructL( CCMRConfigManager* aConfig );  
+        
+
+    private: // new functions
+
+        /**
+        * Select encoder plugin used in devvr
+        * @return void
+        */
+        void SetupEncoderL();
+
+        /**
+        * Read encoder plugin information object from plugin with given Uid
+        * @param TUid aUid
+        * @return CDEVVRVideoEncoderInfo* information object
+        */
+        CVideoEncoderInfo* ReadEncoderInfoL(TUid aUid);
+        
+        /**
+        * Encode the given video frame
+        * @param aFrameBuffer The buffer to be encoded
+        */
+        void EncodeFrame(MFrameBuffer* aFrameBuffer);
+
+        /**
+        * Fills DevVideoRecord rate control options structure
+        * @return void
+        */
+        void FillRateControlOptions( TRateControlOptions& aRC );
+
+        /**
+        * Send event to client
+        * @return error code
+        */
+        TInt DoSendEventToClient(TUid aEventType, TInt aErrorCode);
+
+        /**
+        * Check exposure setting from camera and decice framerates based on it
+        * @return void
+        */
+        void CheckExposure();
+        
+        /**
+        * Update available video frames and sizes table from ECAM and MDF encoders.
+        * @return void
+        */
+        void UpdateSupportedVideoFrameSizesRates();
+        
+        /**
+		* RemoveSeqHeader remove MPEG4 decoder configuration info (VOS+VO+VOL header)
+		* from the 1st video packet (it is saved in metadata, and duplication not allowed)
+        * @return number of bytes removed
+        */        
+        TInt RemoveSeqHeader( TDesC8* aVideoBuffer );
+        
+        /**
+        * Removes decoder configuration info (SPS & PPS) from first NAL encapsulated H.264/AVC video buffer
+        * from encoder to avoid situation where its both in .mp4 file metadata and in bitstream of video track.
+        * @return number of bytes removed
+        */
+        TInt RemoveNalDecSpecInfoHeader( TDesC8* aVideoBuffer );
+        
+        /**
+        * Removes decoder configuration info (SPS & PPS) from first bytestream encapsulated H.264/AVC video buffer
+        * from encoder to avoid situation where its both in .mp4 file metadata and in bitstream of video track.
+        * @return number of bytes removed
+        */
+        TInt RemoveByteStreamDecSpecInfoHeader( TDesC8* aVideoBuffer );
+
+    private:    // Data                 
+
+        // event handler
+        MAsyncEventHandler& iEventHandler;
+
+        // source for raw frames        
+#ifdef VIDEO_FILE_INPUT
+        // File input test
+        CCMRVideoFileSource *iSource;    
+#else
+        // Symbian Onboard Camera API handle
+        CCMRVideoCameraSource *iSource;  
+#endif
+
+        // Video source -specific
+
+        // output format from source
+        CCamera::TFormat iVideoFormat;  
+        // source initialization done ?
+        TBool iSourceInitComplete;  
+        // camera properties
+        TCameraInfo iCameraInfo;    
+        // size index from enumeration, the used one and then saved ones for both supported formats YUV420 planar and YUV422 interleaved
+        TInt iSizeIndex;
+        TInt iSizeIndex420;
+        TInt iSizeIndex422;
+        // rate index from enumeration, the used one and then saved ones for both supported formats YUV420 planar and YUV422 interleaved
+        TInt iRateIndex;
+        TInt iRateIndex420;
+        TInt iRateIndex422;
+        // Encoder UID from user - override for encoder search
+        TUid iPreferredEncoderUID;
+        // Video output data unit format encapsulation from user - override for internal default.
+        TBool iPreferredEncapsulationSet;
+        TVideoDataUnitEncapsulation iPreferredEncapsulation;
+
+        // DevVideoRecord -specific
+        // handle
+        CMMFDevVideoRecord* iDevVideoRec;
+        // encoder initialization done ?
+        TBool iEncoderInitComplete;         
+        // Mime type for encoded data
+        TBuf8<256> iMimeType;                
+        // Array of available encoders for given video mime type.
+        RArray<TUid> iAvailableVideoEncoders;                
+        // device ID for the encoder        
+        THwDeviceId iEncoderHWDeviceId;  
+        // device ID for the preprocessor        
+        THwDeviceId iPreProcessorHWDeviceId;
+        // output buffer pointer (from encoder)
+        TVideoOutputBuffer* iOutputVideoBuffer;
+       	// video encoder output buffer type
+       	CCMRMediaBuffer::TBufferType iVideoBufferType;
+       	// available frame sizes and rates for given video codec.
+       	RArray<TPictureRateAndSize> iAvailableVideoFrameSizesRates;
+		// Index of iAvailableVideoFrameSizesRates that matches current set video frame size & rate
+       	TInt iSizeIndexDCEncoder;
+		// Index of iAvailableVideoFrameSizesRates that matches current set video frame size & rate       	
+		TInt iRateIndexDCEncoder;
+
+        TDblQue<TVideoOutputBuffer> iVideoOutputBufferInputQue;
+        TDblQueIter<TVideoOutputBuffer> iVideoOutputBufferInputQueIter;
+        TInt iNumberOfVideoOutputBuffers;
+        
+        // class for codec-specific data
+        CCMRVideoCodecData* iVideoCodecData;
+
+        CCMRReturnAO* iBufferReturnAO;
+        
+        // time between random access points
+        TInt iMinRandomAccessPeriodInSeconds;
+
+        // ETrue if we are using HW accelerated video encoder => affects e.g. on default settings such as framerate
+        TBool iVideoCodecHWAccelerated;
+
+        // clocksource
+        MMMFClockSource* iClockSource;
+        // Config manager
+        // Doesn't own.
+        CCMRConfigManager* iConfig;
+        // the sink for data
+        CCMRActiveOutput* iOutput;
+        // output mediasink buffer
+        CCMRMediaBuffer* iOutputSinkBuffer;
+
+        // FIFO for maintaining source buffers
+        CCMRFifo *iSourceFifo;  
+        // FIFO for maintaining buffers being encoded
+        CCMRFifo *iCodingFifo;  
+        // Number of pictures in the encoder input queue at the moment
+        TUint iEncoderInputQueueLength;
+        // Number of camera buffers
+        TUint iNumCameraBuffers;
+
+        // input/output frame dimensions
+        TSize iFrameSize;    
+        // capture frame rate in frames per second
+        TReal32 iSourceFrameRate;  
+        // average time between 2 successive captured frames (==timeunit/framerate)
+        TInt iSourceFrameInterval;
+        // target encoding frame rate in frames per second
+        TReal32 iEncodingFrameRate;
+        // max encoding frame rate in frames per second the used encoder promises to produce
+        TReal iMaxFrameRate4GivenSize;
+        // capture & target encoding frame rate for the next recording if given while recording
+        TReal32 iRequestedFrameRate;
+
+        // ETrue if camera's exposure is set to night mode
+        TBool iNightMode;
+
+        // constant or variable bit-rate?
+        TInt iBitRateMode;
+
+        // Error code saved while waiting for a completion of an async operation
+        TInt iErrorCode;
+
+        // thread handle for output active object
+        RThread iOutputThreadHandle;
+        // Status info for output active objct
+        TRequestStatus* iRequestStatus;
+
+        // ETrue if thread handle was opened
+        TBool iThreadHandleOpened;
+
+        // Video encoder complexity level
+        TInt iVideoComplexity;
+
+        // Time stamp adjustment after pause
+        TTime iTimeWhenPaused;
+        TTimeIntervalMicroSeconds iTotalPausedTime;
+        TTimeIntervalMicroSeconds iSystemClockDelta;
+
+        // Timestamp of the latest buffer given to devvideorecord
+        TTimeIntervalMicroSeconds iLatestUsedTimeStamp;
+        TTimeIntervalMicroSeconds iLatestAbsoluteTimeStamp;
+
+        // Required adjustment for the timestamp in microseconds, 
+        // will be included in iTotalPausedTime when possible
+        TInt64 iAdjustmentTimeUs;
+
+        // Mutex used to use variables safely in case of use from other thread
+        RMutex      iMutexObj; 
+        TBool       iMutexCreated;
+
+        // MPEG-4 decoder configuration information
+        HBufC8* iDecSpecInfo;
+        // MPEG-4 decoder configuration information data length
+        TInt iDecSpecInfoLength;
+        // Flag to remove decoder configuration info from the 1st video packet (it is saved in metadata, and duplication not allowed)
+        TBool iRemoveHeader;
+
+        // Indicates fatal error from devVideo
+        TBool iFatalError;
+
+        // Indicates input end call to devVideo
+        TBool iInputEnd;
+        
+        // Indicates stream end call from devVideo
+        TBool iStreamEnd;
+        
+        // Indicates when to skip buffers between inputend -> streamend to avoid parent thread lockup.
+        TBool iStoppingSkipBuffers;
+
+        // For statistics
+        TInt iNumberOfCapturedFrames;
+        TInt iNumberOfEncodedFrames;
+        
+        // Direct capture
+        TBool iDirectCapture;
+        
+        // Camera handle
+        TInt iCameraHandle;
+
+        // Skip buffer flag
+        TBool iSkipBuffers;
+        
+        // Number of input camera frames skipped because of frame drift from camera.
+        TInt iDriftFrameSkipCount;
+        // Number of input camera frames that has had their frame duration increased to compensate
+        // camera timestamp drift from expected.
+        TUint iAddedFrameDurationCount;
+        
+        // Index of previous camera frame
+        TInt iPreviousCameraFrameIndex;
+        
+        // TRateControlOptions received from client/ICM
+        TRateControlOptions iRateControlOptions;
+           
+#if defined VIDEO_FILE_OUTPUT || defined VIDEO_BS_FILE_OUTPUT
+        RFs iFs;
+        RFile iOutputFile;
+#endif           
+
+#ifdef _DEBUG
+        TTime iRecordStartTime;
+        
+        TTime iLastCapture;        
+        TInt iCumulativeCaptureTime;
+        TReal iAverageCaptureTime; // per frame
+
+        TTime iEncodingStartTime;  // per frame
+        TInt iCumulativeEncodingTime;
+        TReal iAverageEncodingTime; // per frame
+#endif
+
+    };  
+    
+#endif      // CCMRVIDEORECORDER_H
+    
+// End of File
+    
+    
+    
+    
+    
+
+    
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoRecorderClient.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,347 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for video recorder client class
+*
+*/
+
+
+#ifndef CCMRVIDEORECORDERCLIENT_H
+#define CCMRVIDEORECORDERCLIENT_H
+
+// INCLUDES
+#include "CCMRRecorderBase.h"
+#include "CCMRVideoThreadProxy.h"
+
+// FORWARD DECLARATION
+class CCMRVideoCodecs;
+class CCMRActiveOutput;
+class TCCMRVideoCodingOptions;
+class CDesC8Array;
+class MMMFClockSource;
+class TRateControlOptions;
+
+// CLASS DECLARATION
+
+/**
+*  Video recorder observer interface  
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class MCMRVideoRecorderObserver
+    {
+    public:
+
+        /**
+        * Informs about a state change
+        * @since 2.1
+        * @param aState New state
+        * @return void
+        */
+        virtual void MvroStateChange(CCMRRecorderBase::TRecorderState aState) = 0;
+
+        /**
+        * Informs about an error
+        * @since 2.1
+        * @param aError Error code
+        * @return void
+        */
+        virtual void MvroError(TInt aError) = 0;
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  Video recorder client class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRVideoRecorderClient : public CCMRRecorderBase, public MCMRSubThreadEventMonitorObserver
+                          
+
+    {
+    public:
+        // Video bit-rate control mode
+        enum TCMRVideoBitRateMode
+            {
+            EBitRateConstant,
+            EBitRateVariable
+            };
+
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRVideoRecorderClient() {};
+                        
+        /**
+        * Two-phased constructor.
+        */
+        
+        static CCMRVideoRecorderClient* NewL();
+
+        /**
+        * Destructor.
+        */
+
+        virtual ~CCMRVideoRecorderClient();               
+
+    public:   // Constants        
+
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10040,
+            };
+        
+    public: // New functions
+        
+        /**
+        * Open the video recorder
+        * @since 2.1
+        * @param aObserver      Observer instance
+        * @param aOutput        Output active object
+        * @param aCameraHandle  Camera handle (index)
+        * @param aVideoMimeType Video Mime-type
+        * @param aClockSource   Clock source from audio timestamps
+        * @return void
+        */
+        void OpenL(MCMRVideoRecorderObserver* aObserver, CCMRActiveOutput* aOutput, 
+            TInt aCameraHandle, const TDesC8& aVideoMimeType, MMMFClockSource* aClockSource, CCMRConfigManager* aConfig );
+                
+        /**
+        * Sets video Mime type (codec)
+        * @since 2.1
+        * @param aMimeType   video codec Mime type
+        * @return void
+        */
+        void SetVideoCodecL(const TDesC8& aMimeType) const;
+
+        /**
+        * Get the currently used video codec
+        * @since 2.1
+        * @param  aVideoMimeType    Used codec as mime type
+        * @return TInt Error code
+        */
+        void GetVideoCodecL( TDes8& aVideoMimeType ) const;
+
+        /**
+        * Get supported & installed video codecs.
+        * This can be called also when the recorder is not open
+        * @since 2.1
+        * @param  aVideoMimeTypes   List of supported & installed video codecs as mime type
+        * @return void
+        */
+        void GetSupportedVideoCodecsL( CDesC8Array& aVideoMimeTypes ) const;
+
+        /**
+        * Sets new input & output frame size
+        * @since 2.1
+        * @param aSize New size
+        * @return void
+        */
+        void SetFrameSizeL(const TSize& aSize) const;
+        
+        /**
+        * Gets current input & output video frame size
+        * @since 2.1
+        * @param aSize Output parameter for the size
+        * @return void
+        */
+        void FrameSizeL(TSize& aSize) const;
+        
+        /**
+        * Sets new target encoding frame rate
+        * @since 2.1
+        * @param aFrameRate New frame rate
+        * @return TInt Error code     
+        */
+        void SetFrameRateL(TReal32 aFrameRate) const;
+        
+        /**
+        * Get current target encoding frame rate
+        * @since 2.1
+        * @return TReal32 Frame rate
+        */
+        void FrameRateL(TReal32& aFrameRate) const;
+
+        /**
+        * Set misc video coding options
+        * @since 2.1
+        * @param  aOptions      video coding options
+        * @return void
+        */
+        void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions) const;
+
+        /**
+        * Set video rate control options
+        * @since 3.2
+        * @param  aOptions      video rate control options
+        * @return void
+        */        
+        void SetVideoRateControlOptionsL(const TRateControlOptions& aOptions) const;        
+
+        /**
+        * Get video rate control options
+        * @since 3.2
+        * @param  aOptions      video rate control options
+        * @return void
+        */        
+        void GetVideoRateControlOptionsL(TRateControlOptions& aOptions) const;               
+        
+        /**
+        * Adjust time stamps of video
+        * @since 2.1
+        * @param  const TInt aAdjustmentMs time in ms, can be positive or negative
+        * @return void
+        */
+        void AdjustTimeStampsL(const TInt aAdjustmentMs) const;
+
+        /**
+        * Set video thread priority
+        * @since 2.8
+        * @param  const TThreadPriority& aAudioThreadPriority
+        * @return void
+        */
+        void SetThreadPriorityL(const TThreadPriority& aAudioThreadPriority) const;
+
+        /**
+        * Set video encoder using its UID. Usage optional.
+        * This overrides Media Recorder internal search for encoder based on set video mime type ( SetVideoCodecL() ).
+        *
+        * @since 3.2.3
+        * @param    "aEncoder"  "Video encoder UID."
+        * @return void
+        */
+        void SetPreferredVideoEncoderL(TUid& aEncoder);
+
+        /**
+        * Set video encoder output format encapsulation. Usage optional.
+        * This overrides Media Recorder internal default preferences for TVideoDataUnitEncapsulation
+        * if used encoder supports multiple encapsulations.
+        *
+        * Defaults are:
+        *   H.263 and MPEG-4 part 2 : EDuElementaryStream
+        *               H.264 / AVC : EDuGenericPayload
+        *
+        * @since 3.2.3
+        * @param    "aCapsulation"  "Encapsulation for coded video data units."
+        * @return void
+        */
+        void SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation);
+        
+        /**
+        * Set video encoder target segment size. Usage optional.
+        * @since 5.2
+        * @param  TUint aLayer              Layer number
+        * @param  TUint aSizeBytes          Segment target size in bytes
+        * @param  TUint aSizeMacroblocks    Segment target size in number of macroblocks per segment
+        * @return TBool
+        */            
+        void SetSegmentTargetSizeL(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks );        
+
+    public: // Functions from base classes
+
+        /**
+        * From CCMRRecorderBase Set new target bitrate
+        */
+        void SetTargetBitRateL(TInt aBitRate);
+
+        /**
+        * From CCMRRecorderBase Get current target bitrate
+        */
+        void TargetBitRateL(TInt& aBitRate);
+
+
+        /**
+        * From CCMRRecorderBase Prepare for recording
+        */
+        void PrepareL();
+
+        /**
+        * From CCMRRecorderBase Start recording
+        */
+        void RecordL();
+
+        /**
+        * From CCMRRecorderBase Stop recording (async => must wait for state change)
+        */
+        void StopL();
+        
+        /**
+        * Used while stopping. Requests encoded video frames from adaptation and waits for the streamend / EOS notification.
+        */
+        void RequestBuffersAndWaitEOSL(TInt& aVideoEOSReached);          
+
+        /**
+        * From CCMRRecorderBase Pause recording
+        */
+        void PauseL();
+
+        /**
+        * From CCMRRecorderBase Resume recording
+        */
+        void ResumeL();     
+
+        /**
+        * From MCMRSubThreadEventMonitorObserver Handle event
+        */
+        void HandleEvent(const TMMFEvent& aEvent);
+
+    private:
+        
+        /**
+        * By default EPOC constructor is private.
+        */
+        void ConstructL();  
+        
+
+    private:    // Data                 
+
+
+
+        // level of video, e.g. H.263 level 10
+        TInt iVideoCodecLevel;
+
+        // the observer for the video recorder
+        MCMRVideoRecorderObserver* iObserver;  
+
+        // video thread
+        RCMRVideoThreadProxy iThreadProxy;
+
+        // ETrue if iThreadProxy was opened => can be closed
+        TBool iThreadCreated;
+
+        // Thread event monitor
+        CCMRSubThreadEventMonitor* iThreadEventMonitor;
+
+        // Maintains list of supported & installed video codecs
+        CCMRVideoCodecs* iVideoCodecs;
+
+    };  
+    
+#endif      // CCMRVIDEORECORDERCLIENT_H
+    
+// End of File
+    
+    
+    
+    
+    
+
+    
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoSettings.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Default settings and common types for video
+*
+*/
+
+
+
+#ifndef CCMRVIDEOSETTINGS_H
+#define CCMRVIDEOSETTINGS_H
+
+// INCLUDES
+#include "CCMRVideoSource.h"
+#include <mmf/devvideo/devvideoconstants.h>
+
+
+// GENERIC CONSTANTS
+
+// Sub-QCIF picture size
+const TInt KCMRSubQCIFHeight = 96;
+const TInt KCMRSubQCIFWidth = 128;
+// QCIF picture size
+const TInt KCMRQCIFHeight = 144;
+const TInt KCMRQCIFWidth = 176;
+// CIF picture size
+const TInt KCMRCIFHeight = 288;
+const TInt KCMRCIFWidth = 352;
+// QVGA picture size
+const TInt KCMRQVGAHeight = 240;
+const TInt KCMRQVGAWidth = 320;
+// VGA picture size
+const TInt KCMRVGAHeight = 480;
+const TInt KCMRVGAWidth = 640;
+// D1 / SDTV NTSC / 525 SD
+const TInt KCMRNTSCHeight = 480;
+const TInt KCMRNTSCWidth = 720;
+// D1 / SDTV PAL / 625 SD
+const TInt KCMRPALHeight = 576;
+const TInt KCMRPALWidth = 720;
+// HD 720p
+const TInt KCMRHD720Height = 720;
+const TInt KCMRHD720Width = 1280;
+// HD 1080p
+const TInt KCMRHD1080Height = 1088;
+const TInt KCMRHD1080Width = 1920;
+
+// special level id for MPEG-4; other levels are used as such since the levels are integers
+const TInt KCMRMPEG4SPLevel0B = 9;
+
+// special level ids for H.264/AVC
+// CONSTANTS
+const TUint KCMRH264AVCCodecLevel10 = 10;
+const TUint KCMRH264AVCCodecLevel10b = 101;
+const TUint KCMRH264AVCCodecLevel11 = 11;
+const TUint KCMRH264AVCCodecLevel12 = 12;
+const TUint KCMRH264AVCCodecLevel13 = 13;
+const TUint KCMRH264AVCCodecLevel20 = 20;
+const TUint KCMRH264AVCCodecLevel21 = 21;
+const TUint KCMRH264AVCCodecLevel22 = 22;
+const TUint KCMRH264AVCCodecLevel30 = 30;
+const TUint KCMRH264AVCCodecLevel31 = 31;
+const TUint KCMRH264AVCCodecLevel32 = 32;
+const TUint KCMRH264AVCCodecLevel40 = 40;
+
+// number of supported H.263 levels
+const TInt KCMRNumSupportedH263Levels = 6; // 10, 20, 30, 40, 45, 50
+// supported H.263 levels in descending order (support of level 45 implies support of level 10,
+// and hence it is really between 10 and 20). Defined as macro since can't have const
+// TBuf8 as static (requires run-time initialization => would be writable static data)
+#define KCMRH263Levels \
+        {_L8("50"), \
+         _L8("40"), \
+         _L8("30"), \
+         _L8("20"), \
+         _L8("45"), \
+         _L8("10")}
+
+// number of supported MPEG-4 profile-level ids
+const TInt KCMRNumSupportedMPEG4ProfileLevels = 8;
+// supported MPEG-4 profile-level id's in descending order; last two are 0b and 0
+// Defined as macro since can't have const TBuf8 as static (requires run-time
+// initialization => would be writable static data)
+#define KCMRMPEG4Levels \
+        {_L8("8"), \
+         _L8("9"), \
+         _L8("1"), \
+         _L8("2"), \
+         _L8("3"), \
+         _L8("4"), \
+         _L8("5"), \
+         _L8("6")}
+
+// number of supported H.264 AVC profile-level ids
+const TInt KCMRNumSupportedH264AVCProfileLevels = 36;
+// supported H.264 AVC profile-level id's
+// Defined as macro since can't have const TBuf8 as static (requires run-time
+// initialization => would be writable static data)
+#define KCMRH264AVCLevels \
+        {_L8("42800A"), \
+         _L8("42900B"), \
+         _L8("42800B"), \
+         _L8("42800C"), \
+         _L8("42800D"), \
+         _L8("428014"), \
+         _L8("428015"), \
+         _L8("428016"), \
+         _L8("42801E"), \
+         _L8("42801F"), \
+         _L8("428020"), \
+         _L8("428028"), \
+         _L8("4D400A"), \
+         _L8("4D500B"), \
+         _L8("4D400B"), \
+         _L8("4D400C"), \
+         _L8("4D400D"), \
+         _L8("4D4014"), \
+         _L8("4D4015"), \
+         _L8("4D4016"), \
+         _L8("4D401E"), \
+         _L8("4D401F"), \
+         _L8("4D4020"), \
+         _L8("4D4028"), \
+         _L8("64400A"), \
+         _L8("644009"), \
+         _L8("64400B"), \
+         _L8("64400C"), \
+         _L8("64400D"), \
+         _L8("644014"), \
+         _L8("644015"), \
+         _L8("644016"), \
+         _L8("64401E"), \
+         _L8("64401F"), \
+         _L8("644020"), \
+         _L8("644028")}
+
+const TInt KCMRMinAcceptedBitRate = 10000; // 10000 bps is considered the smallest reasonable bitrate
+
+// OUTPUT PARAMETERS (default)
+
+// default target bitrate
+const TUint KCMRTargetBitRate = 64000;
+
+// default frame size = QCIF
+const TInt KCMRFrameWidth = 176;
+const TInt KCMRFrameHeight = 144;
+
+// default frame rate
+const TReal32 KCMRFrameRate = 15;
+
+// SOURCE OPTIONS
+
+// number of camera buffers to use; 1st one is default & used with HW accelerated encoder, the 2nd one is for ARM encoder
+const TUint KCMRNumCameraBuffers = 2;
+const TUint KCMRNumCameraBuffersARM = 1;
+
+// number of frames per one camera buffer
+const TUint KCMRNumFramesInCameraBuffer = 1;
+
+
+
+// ENCODER OPTIONS
+
+// max. number of pictures in the buffer before encoder
+const TUint KCMRMaxPreEncoderBufferPictures = KCMRNumCameraBuffers;
+
+// min number of output (bitstream) buffers
+const TUint KCMRMinNumOutputBuffers = 4;
+
+// One random access point every 5 seconds
+const TInt KCMRMinRandomAccessPeriod = 5;
+const TInt KCMRMinRandomAccessPeriodHighRes = 1;
+
+// If == 0 no other sync codes in picture than picture start code.
+// For H.263 baseline, value > 0 refers to the number of GOBs in segment, in MB-based segments nr of MBs per segment
+const TInt KCMRSyncIntervalInPicture = 0;
+
+// Encoding in real-time or not? Non-real-time probably needed only in debugging
+const TBool KCMREncodingRealTime = ETrue;
+
+// input format parameters to video codec
+// Aspect ratio, in H.263 default is 12:11, but camera probably provides 1:1
+const TInt KCMRAspectRatioNum = 12;
+const TInt KCMRAspectRatioDenom = 11;
+// Aspect ratio MPEG-4
+const TInt KCMRMPEG4AspectRatioNum = 1;
+const TInt KCMRMPEG4AspectRatioDenom = 1;
+
+//   Rate control
+
+// Quality is more important in camcorder than delay
+const TReal KCMRLatencyQyalityTradeoff = 1.0;
+
+// range is [0...100]
+const TUint KCMRPictureQuality = 50;
+
+// Try to maintain the frame-rate
+// (1.0 means the picture quality is sacrificed
+// "all the way" to match the target fps
+const TReal KCMRQualityTemporalTradeoff = 0.8;
+
+// Error control
+
+// Very strong simplification for the thresholds to map between packet loss rates and bit error rates; used to set
+// adaptive intra refresh parameters for the encoder, which currently supports only bit error rate based setting
+const TReal KCMRBadBitErrorRate = 0.001;
+const TReal KCMRTolerableBitErrorRate = 0.0001;
+const TReal KCMRNotNoticeableBitErrorRate = 0.00001;
+
+const TReal KCMRBadPacketLossRate = 0.05;
+const TReal KCMRNotNoticeablePacketLossRate = 0.01;
+
+#endif // CCMRVIDEOSETTINGS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoSource.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface definition for a video source
+*                this is "hiding" the Symbian on-board camera API, included
+*                so that each and every definition doesn't need to be duplicated here
+*
+*/
+
+
+#ifndef CCMRVIDEOSOURCE_H
+#define CCMRVIDEOSOURCE_H
+
+// INCLUDES
+#include <ecam.h>
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Video source observer interface  
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class MCMRVideoSourceObserver
+    {
+    public:
+    
+        /**
+        * Camera reservation completed
+        * @since 2.1
+        * @param TInt aError
+        * @return void
+        */
+        virtual void MvsoReserveComplete(TInt aError) = 0;
+        /**
+        * Frame buffer from camera
+        * @since 2.1
+        * @param MFrameBuffer* aFrameBuffer
+        * @param TInt aError
+        * @return void
+        */
+        virtual void MvsoFrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError ) = 0;        
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract video source interface
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+
+class MCMRVideoSource
+    {
+
+    public:  // Constants
+         
+        // States the source can be in
+        enum TVideoSourceState
+            {
+                EStateNone = 0,
+                EStateReady,   // == stopped
+                EStateCapturing
+            };
+
+
+    public:  // New functions
+
+        /**
+        * Gets info from the camera
+        * @since 2.1
+        * @param TCameraInfo Info (See Ecam.h)
+        * @return void
+        */
+        virtual void CameraInfo(TCameraInfo& aInfo) = 0;
+
+        /**
+        * Returns the current output frame size
+        * @since 2.1
+        * @param aSize Output parameter for the size
+        * @return void        
+        */
+        virtual void GetFrameSize(TSize& aSize) = 0;
+
+        /**
+        * Returns the current output frame rate
+        * @since 2.1
+        * @param void
+        * @return TReal32 Frame rate
+        */
+        virtual TReal32 FrameRate() = 0;
+
+        /**
+        * Returns the number of buffers the source is using
+        * @since 2.1
+        * @param void
+        * @return TInt Number of buffers in use
+        */
+        virtual TInt BuffersInUse() = 0;        
+
+        /**
+        * Returns the number of frames in one buffer
+        * @since 2.1
+        * @param void
+        * @return TInt The number of frames in one buffer
+        */
+        virtual TInt FramesPerBuffer() = 0;
+
+        /**
+        * Queries whether video capture is active
+        * @since 2.1
+        * @param void
+        * @return TBool ETrue if capture is active
+        */
+        virtual TBool CaptureActive() = 0;
+
+        /**
+        * Reserves the source for exclusive use
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void Reserve() = 0;
+
+        /**
+        * Releases the source for others to use it
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void Release() = 0;             
+        
+        /**
+        * Enumerates through available video frame sizes using the aSizeIndex -parameter
+        * @since 2.1
+        * @param aSize Output parameter for the enumerated size
+        * @param aSizeIndex Size index, range 0 <= aSizeIndex <= cameraInfo.NumFrameSizesSupported - 1)
+        * @param aFormat Output video format to be used
+        * @return void
+        */
+        virtual void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,
+            CCamera::TFormat aFormat) const = 0;
+
+        /**
+        * Enumerates through available video frame rates using the aRateIndex -parameter
+        * @since 2.1
+        * @param aRate Output parameter for the enumerated rate
+        * @param aRateIndex Rate index, range 0 <= aRateIndex <= cameraInfo.NumFrameRatesSupported - 1)
+        * @param aFormat Output video format to be used
+        * @param aSizeIndex Index of the frame size to be used (from EnumerateVideoFrameSizes)
+        * @param aExposure Exposure mode to be used (See Ecam.h)
+        * @return void
+        */
+        virtual void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,
+            CCamera::TFormat aFormat, TInt aSizeIndex, CCamera::TExposure aExposure) const = 0;     
+        
+        /**
+        * Prepares the source for capturing video
+        * @since 2.1
+        * @param aFormat Output video format to be used
+        * @param aSizeIndex Index of the frame size to be used (from EnumerateVideoFrameSizes)
+        * @param aRateIndex Index of the frame rate to be used (from EnumerateVideoFrameRates)
+        * @param aBuffersToUse Number of frame buffers to use
+        * @param aFramesPerBuffer Number of frames in one buffer
+        * @return void
+        */
+        virtual void PrepareCaptureL(CCamera::TFormat aFormat,TInt aSizeIndex,
+            TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer)=0;
+        
+        /**
+        * Prepares the source for capturing video
+        * @since 2.1
+        * @param aFormat Output video format to be used
+        * @param aSizeIndex Index of the frame size to be used (from EnumerateVideoFrameSizes)
+        * @param aRateIndex Index of the frame rate to be used (from EnumerateVideoFrameRates)
+        * @param aBuffersToUse Number of frame buffers to use
+        * @param aFramesPerBuffer Number of frames in one buffer
+        * @param aClipRect The frames will be clipped to the given rectangle        
+        * @return void
+        */
+        virtual void PrepareCaptureL(CCamera::TFormat aFormat, TInt aSizeIndex,
+            TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,
+            const TRect& aClipRect) = 0;
+        
+        /**
+        * Starts capturing video
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void StartCapture() = 0;        
+
+        /**
+        * Stops capturing video
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void StopCapture() = 0;            
+
+        /**
+        * Get current exposure setting
+        * @since 2.1
+        * @param void
+        * @return TExposure Current exposure setting
+        */
+        virtual CCamera::TExposure GetExposure() const = 0;
+    };
+
+
+#endif // CCMRVIDEOSOURCE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoThreadProxy.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,315 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video thread proxy class
+*
+*/
+
+#ifndef CCMRVIDEOTHREADPROXY_H
+#define CCMRVIDEOTHREADPROXY_H
+
+// INCLUDES
+#include "CCMRSubThread.h"
+#include <mmf/devvideo/devvideoconstants.h>
+
+
+// MACROS
+
+
+// DATA TYPES
+
+/**
+* Video thread messages ids
+*/ 
+enum TCMRVideoSubThreadMessageIds
+    {
+    ECMRVideoThreadLoadVideoRecorder = ECMRThreadLastCommonMsgId+1,  //combine IDs with TCMRSubThreadMessageIds
+    ECMRVideoThreadSetCameraHandle,
+    ECMRVideoThreadSetOutput,
+    ECMRVideoThreadSetOutputThreadId,
+    ECMRVideoThreadSetBitRate,
+    ECMRVideoThreadGetBitRate,
+    ECMRVideoThreadSetFrameSize,
+    ECMRVideoThreadGetFrameSize,
+    ECMRVideoThreadSetFrameRate,
+    ECMRVideoThreadGetFrameRate,
+    ECMRVideoThreadSetCodec,
+    ECMRVideoThreadGetCodec,
+    ECMRVideoThreadSetMiscOptions,
+    ECMRVideoThreadAdjustTimeStamps,
+    ECMRVideoThreadPrepare,
+    ECMRVideoThreadRecord,
+    ECMRVideoThreadStop,
+    ECMRVideoThreadPause,
+    ECMRVideoThreadResume,
+    ECMRVideoThreadSetClockSource,
+    ECMRVideoThreadSetVideoRateControlOptions,
+    ECMRVideoThreadGetVideoRateControlOptions,
+    ECMRVideoThreadSetPreferredVideoEncoder,
+    ECMRVideoThreadSetPreferredVideoEncapsulation,
+    ECMRVideoRequestBuffersAndThreadWaitEOS,
+    ECMRVideoThreadSetSegmentTargetSize
+    };
+
+// CONSTANTS
+// error codes for events sent from video thread to client
+const TUid KCMRCameraPrepareError = {0x0001};
+const TUid KCMRCameraReserveError = {0x0002};
+const TUid KCMRCameraCaptureError = {0x0004};
+const TUid KCMREncoderInitError = {0x0008};
+const TUid KCMRRunTimeError = {0x0010};
+const TUid KCMRPrepareComplete = {0x0020};
+const TUid KCMRRecordingComplete = {0x0040};
+const TUid KCMRPrepareNeeded = {0x0080};
+
+
+// FORWARD DECLARATIONS
+class CCMRActiveOutput;
+class TCCMRVideoCodingOptions;
+class MMMFClockSource;
+class CCMRConfigManager;
+class TRateControlOptions;
+
+//CLASS DECLARATIONS
+
+/**
+*  Video thread proxy class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class RCMRVideoThreadProxy : public RCMRSubThreadBase
+    {
+    public: // Constructor
+        /**
+        * C++ default constructor.
+        */
+        RCMRVideoThreadProxy() : RCMRSubThreadBase(KCMRThreadProxyShutdownTimeout) {};
+    public: // new functions
+        /**                     
+        * Create thread
+        * @since 2.1
+        * @param  TBool& aThreadCreated; thread may be created but session not necessarily so return value doesn't tell all
+        * @return TInt error code
+        */
+        TInt CreateSubThread(TBool& aThreadCreated, CCMRConfigManager* aConfig );
+        /**                     
+        * Set camera handle
+        * @since 2.1
+        * @param  TInt aCameraHandle
+        * @return TInt error code
+        */
+        TInt SetCameraHandle(TInt aCameraHandle) const;
+        /**                     
+        * Set Set config manager.
+        * @since 3.2
+        * @param  TInt aConfig
+        * @return TInt error code
+        */
+        TInt SetConfigManager(CCMRConfigManager* aConfig) const;        
+        /**                     
+        * Set output active object
+        * @since 2.1
+        * @param  CCMRActiveOutput* aOutput
+        * @return TInt error code
+        */
+        TInt SetOutput(CCMRActiveOutput* aOutput) const;
+        /**                     
+        * Set clock source
+        * @since 3.0
+        * @param  MMMFClockSource* aClockSource
+        * @return TInt error code
+        */
+        TInt SetClockSource(MMMFClockSource* aClockSource) const;
+        /**                     
+        * Set target bitrate
+        * @since 2.1
+        * @param  TInt aBitRate
+        * @return TInt error code
+        */
+        TInt SetBitRate(TInt aBitRate) const;
+        /**                     
+        * Get current target bitrate
+        * @since 2.1
+        * @param  TInt& aBitRate
+        * @return TInt error code
+        */
+        TInt GetBitRate(TInt& aBitRate) const;
+        /**                     
+        * Set video frame size (width&height)
+        * @since 2.1
+        * @param  const TSize& aSize
+        * @return TInt error code
+        */
+        TInt SetFrameSize(const TSize& aSize) const;
+        /**                     
+        * Get current video frame size (width&height)
+        * @since 2.1
+        * @param  TSize& aSize
+        * @return TInt error code
+        */
+        TInt GetFrameSize(TSize& aSize) const;
+        /**                     
+        * Set video framerate
+        * @since 2.1
+        * @param  TReal32 aFrameRate
+        * @return TInt error code
+        */
+        TInt SetFrameRate(TReal32 aFrameRate) const;
+        /**                     
+        * Get current video framerate
+        * @since 2.1
+        * @param  TReal32& aFrameRate
+        * @return TInt error code
+        */
+        TInt GetFrameRate(TReal32& aFrameRate) const;
+        /**                     
+        * Set video codec MIME-type
+        * @since 2.1
+        * @param  const TDesC8& aMimeType
+        * @return TInt error code
+        */
+        TInt SetCodec(const TDesC8& aMimeType) const;
+        /**                     
+        * Get current video codec MIME-type
+        * @since 2.1
+        * @param  TDes8& aMimeType
+        * @return TInt error code
+        */
+        TInt GetCodec(TDes8& aMimeType) const;
+        /**                     
+        * Set video options
+        * @since 2.1
+        * @param  const TCCMRVideoCodingOptions& aOptions
+        * @return TInt error code
+        */
+        TInt SetMiscOptions(const TCCMRVideoCodingOptions& aOptions) const;
+        
+        /**                     
+        * Set video rate control options
+        * @since 3.2
+        * @param  const TRateControlOptions& aOptions
+        * @return TInt error code
+        */        
+        TInt SetVideoRateControlOptions(const TRateControlOptions& aOptions) const;
+        
+        /**
+        * Get video rate control options
+        * @since 3.2
+        * @param  const TRateControlOptions& aOptions
+        * @return TInt error code
+        */
+        TInt GetVideoRateControlOptions(TRateControlOptions& aOptions) const;
+
+        /**
+        * Set video encoder using its UID. Usage optional.
+        * This overrides Media Recorder internal search for encoder based on set video mime type ( SetVideoCodecL() ).
+        *
+        * @since 3.2.3
+        * @param    "aEncoder"  "Video encoder UID."
+        * @return void
+        */
+        TInt SetPreferredVideoEncoder(TUid& aEncoder);
+
+        /**
+        * Set video encoder output format encapsulation. Usage optional.
+        * This overrides Media Recorder internal default preferences for TVideoDataUnitEncapsulation
+        * if used encoder supports multiple encapsulations.
+        *
+        * Defaults are:
+        *   H.263 and MPEG-4 part 2 : EDuElementaryStream
+        *               H.264 / AVC : EDuGenericPayload
+        *
+        * @since 3.2.3
+        * @param    "aCapsulation"  "Encapsulation for coded video data units."
+        * @return void
+        */
+        TInt SetPreferredVideoEncapsulation(TVideoDataUnitEncapsulation aCapsulation);
+
+        /**
+        * Set video encoder target segment size. Usage optional.
+        * @since 5.2
+        * @param  TUint aLayer              Layer number
+        * @param  TUint aSizeBytes          Segment target size in bytes
+        * @param  TUint aSizeMacroblocks    Segment target size in number of macroblocks per segment
+        * @return TBool
+        */            
+        TInt SetSegmentTargetSize(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks );        
+        
+        /**
+        * Adjust video time stamps (+ or -)
+        * @since 2.1
+        * @param  const TInt aAdjustmentMs
+        * @return TInt error code
+        */
+        TInt AdjustTimeStamps(const TInt aAdjustmentMs) const;
+
+        /**
+        * Set video thread priority
+        * @since 2.8
+        * @param  const TThreadPriority& audioThreadPriority
+        * @return TInt error code
+        */
+        TInt SetThreadPriority(const TThreadPriority& audioThreadPriority) const;
+
+        /**                     
+        * Prepare for recording (freeze settings)
+        * @since 2.1
+        * @return TInt error code
+        */
+        TInt Prepare() const;
+        /**                     
+        * Start playing (recording)
+        * @since 2.1
+        * @return TInt error code
+        */
+        TInt Record() const;
+        /**                     
+        * Stop video recorder
+        * @since 2.1
+        * @return TInt error code
+        */
+        TInt Stop() const;
+        /**                     
+        * Used while stopping. Requests encoded video frames from adaptation and waits for the streamend / EOS notification.
+        * @since 5.2
+        * @return TInt error code
+        */
+        TInt RequestBuffersAndWaitEOSL(TInt& aVideoEOSReached) const;
+        /**                     
+        * Pause video recorder
+        * @since 2.1
+        * @return TInt error code
+        */
+        TInt Pause() const;
+        /**                     
+        * Resume video recorder
+        * @since 2.1
+        * @return TInt error code
+        */
+        TInt Resume() const;
+        /**                     
+        * Close thread
+        * @since 2.1
+        * @return TInt error code
+        */
+        void Close();
+    };
+
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoThreadProxyServer.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video thread proxy server class
+*
+*/
+
+#ifndef CCMRVIDEOTHREADPROXYSERVER_H
+#define CCMRVIDEOTHREADPROXYSERVER_H
+
+// INCLUDES
+#include "CCMRVideoThreadProxy.h"
+
+
+
+// DATA TYPES
+
+
+
+//CLASS DECLARATIONS
+
+
+
+/**
+*  Video thread proxy server class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRVideoThreadProxyServer : public CCMRThreadProxyServer
+    {
+    public: // constructor and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRVideoThreadProxyServer* NewL(RServer2* aServer2);
+        /**
+        * Destructor.
+        */
+        ~CCMRVideoThreadProxyServer();
+
+    public: // new functions
+
+        /**                     
+        * Start thread
+        * @since 2.1
+        * @param TAny* aAny
+        * @return TInt error code
+        */
+        static TInt StartThread(TAny* aAny);
+    
+    protected: // new functions
+        /**                     
+        * Start thread
+        * @since 2.1
+        * @return void
+        */
+        static void DoStartThreadL(TAny* aAny);
+
+    protected: // from base classes
+        /**                     
+        * From CCMRThreadProxyServer/CServer create a new session
+        */
+		CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
+
+    private: // constructors
+        /**
+        * C++ default constructor.
+        */
+        CCMRVideoThreadProxyServer(TInt aPriority);
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL(RServer2* aServer2);
+
+    };
+
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoThreadProxySession.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video thread proxy session class
+*
+*/
+
+#ifndef CCMRVIDEOTHREADPROXYSESSION_H
+#define CCMRVIDEOTHREADPROXYSESSION_H
+
+// INCLUDES
+#include "CCMRVideoThreadProxy.h"
+
+
+
+
+// FORWARD DECLARATIONS
+class CCMRVideoRecorder;
+class CCMRVideoThreadProxyServer;
+
+// CLASS DECLARATION
+
+
+/**
+*  Video thread proxy session class
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRVideoThreadProxySession : public CCMRThreadProxySession
+    {
+    public: // constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRVideoThreadProxySession* NewL();
+        /**
+        * Destructor.
+        */
+        ~CCMRVideoThreadProxySession();
+
+    public: // from base classes
+        /**                     
+        * From CCMRThreadProxySession/CSharableSessions service a message.
+        */
+        void ServiceL(const RMessage2& aMessage);
+
+        /**                     
+        * From CCMRThreadProxySession/MAsyncEventHandler catches 
+        * completion events before calling base class implementation
+        */
+        TInt SendEventToClient(const TMMFEvent& aEvent);
+
+    private: // new functions
+        
+        /**
+        * Loads video recorder
+        * @since 2.1
+        * @return TBool
+        */
+        TBool LoadVideoRecorderL(const RMessage2& aMessage);
+        /**
+        * Set camera handle
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetCameraHandleL(const RMessage2& aMessage);
+        /**
+        * Set output active object
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetOutputL(const RMessage2& aMessage);
+        /**
+        * Set clock source
+        * @since 3.0
+        * @return TBool
+        */
+        TBool SetClockSource(const RMessage2& aMessage);
+        /**
+        * Set thread id of the client & output active object
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetOutputThreadIdL(const RMessage2& aMessage);
+        /**
+        * Set target bitrate
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetBitRateL(const RMessage2& aMessage);
+        /**
+        * Get current target bitrate
+        * @since 2.1
+        * @return TBool
+        */
+        TBool GetBitRateL(const RMessage2& aMessage) const;
+        /**
+        * Set video frame size (width&height)
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetFrameSizeL(const RMessage2& aMessage);
+        /**
+        * Get current video frame size (width&height)
+        * @since 2.1
+        * @return TBool
+        */
+        TBool GetFrameSizeL(const RMessage2& aMessage) const;
+        /**
+        * Set video framerate
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetFrameRateL(const RMessage2& aMessage);
+        /**
+        * Get current video framerate
+        * @since 2.1
+        * @return TBool
+        */
+        TBool GetFrameRateL(const RMessage2& aMessage) const;
+        /**
+        * Set video codec MIME-type
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetCodecL(const RMessage2& aMessage);
+        /**
+        * Get current video codec MIME-type
+        * @since 2.1
+        * @return TBool
+        */
+        TBool GetCodecL(const RMessage2& aMessage) const;
+        /**
+        * Set video options
+        * @since 2.1
+        * @return TBool
+        */
+        TBool SetMiscOptionsL(const RMessage2& aMessage);
+        
+        /**                     
+        * Set video rate control options
+        * @since 3.2
+        * @return TBool
+        */        
+        TBool SetVideoRateControlOptionsL(const RMessage2& aMessage);  
+        
+        /**                     
+        * Get video rate control options
+        * @since 3.2
+        * @return TBool
+        */
+        TBool GetVideoRateControlOptionsL(const RMessage2& aMessage) const;
+
+        /**
+        * Set video encoder using its UID. Usage optional.
+        * @since 3.2.3
+        * @param    "aEncoder"  "Video encoder UID."
+        * @return TBool
+        */
+        TBool SetPreferredVideoEncoderL(const RMessage2& aMessage);
+
+        /**
+        * Set video encoder output format encapsulation. Usage optional.
+        * @since 3.2.3
+        * @param    "aCapsulation"  "Encapsulation for coded video data units."
+        * @return TBool
+        */
+        TBool SetPreferredVideoEncapsulationL(const RMessage2& aMessage);
+
+        /**
+        * Set video encoder target segment size. Usage optional.
+        * @since 5.2
+        * @param  TUint aLayer              Layer number
+        * @param  TUint aSizeBytes          Segment target size in bytes
+        * @param  TUint aSizeMacroblocks    Segment target size in number of macroblocks per segment
+        * @return TBool
+        */        
+        TBool SetSegmentTargetSizeL(const RMessage2& aMessage);
+        
+        /**
+        * Adjust video time stamps (+ or -)
+        * @since 2.1
+        * @return TBool
+        */
+        TBool AdjustTimeStampsL(const RMessage2& aMessage);
+        /**
+        * Prepare for recording (freeze settings)
+        * @since 2.1
+        * @return TBool
+        */
+        TBool PrepareL();
+        /**                     
+        * Start recording
+        * @since 2.1
+        * @return TBool
+        */
+        TBool RecordL();
+        /**                     
+        * Stop recording
+        * @since 2.1
+        * @return TBool
+        */
+        TBool StopL();
+        /**                     
+        * Used while stopping. Requests encoded video frames from adaptation and waits for the streamend / EOS notification.
+        * @since 5.1
+        * @return TBool
+        */
+        TBool RequestBuffersAndWaitEOSL(const RMessage2& aMessage);        
+        /**                     
+        * Pause recording
+        * @since 2.1
+        * @return TBool
+        */
+        TBool PauseL();
+        /**                     
+        * Resume recording
+        * @since 2.1
+        * @return TBool
+        */
+        TBool ResumeL();
+
+    private: // constructor
+        /**
+        * C++ default constructor.
+        */
+        inline CCMRVideoThreadProxySession() {};
+
+    private: // data
+        // video recorder
+        CCMRVideoRecorder* iRecorder;
+        // ETrue if we are stopping and stopping hasn't completed yet.
+        TBool iStopping;
+        // Handle to the message, needed in async stopping
+        RMessage2* iMessage;
+    };
+
+#endif      
+            
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAMRNBCodecData.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AMR-NB related data & functions
+*                Note!!! The custom interface class, Uid and type definitions must be
+*                synchronized with the actual HW device custom interface
+*                class before building the component, there is no
+*                run-time checking!!
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRAMRNBCodecData.h"
+#include "CCMRSupportedCodecs.h"
+
+#include <mmf/server/mmfaudioinput.h>
+#include <SpeechEncoderConfig.h>
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// CONSTANTS
+const TUint KCMRRawAmrFrameLength[16] = {13,14,16,18,20,21,27,32,6,0,0,0,0,0,0,1};
+
+const TInt KCMRDefAudioBitRate(12200);
+const TInt KCMRMinAudioBitRate(400);      // voice activity detection creates at least 1 byte per frame => 50 bytes/s = 400 bits/s
+const TInt KCMRMaxAudioBitRate(12200);
+
+const TInt KCMRAMRBufferSize(32);
+
+// Buffer duration for splitted PCM16 buffers in ms
+const TUint KCMRAMRMaxPCMBufferTime = 60;  // 60 ms; kept short to keep encoding times also short, which should minimize the effects to video framerate
+
+
+//CLASS DECLARATIONS
+
+/**
+*    TCMRAMREncParams
+*    Encoding parameters structure for SW AMR codec
+*/
+class TCMRAMREncParams
+    {
+public:
+    // encoding mode (for AMR-NB: 0=MR475,1=MR515,...,7=MR122, default 7)
+    TInt iMode;
+    // DTX flag (TRUE or default FALSE)
+    TInt iDTX;
+    };
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::CCMRAMRNBCodecData
+// -----------------------------------------------------------------------------
+//
+CCMRAMRNBCodecData::CCMRAMRNBCodecData(TCMRCodecType aType) : CCMRAudioCodecData(KCMRFourCCIdAMRNB, KCMRDefAudioBitRate, CCMRMediaBuffer::EAudioAMRNB, aType)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::~CCMRAMRNBCodecData
+// -----------------------------------------------------------------------------
+//
+CCMRAMRNBCodecData::~CCMRAMRNBCodecData()
+    {
+    PRINT((_L("CCMRAMRNBCodecData::~CCMRAMRNBCodecData() in")));
+    delete iConfigData;
+    PRINT((_L("CCMRAMRNBCodecData::~CCMRAMRNBCodecData() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::Supported
+// Return ETrue if the codec is supported in this configuration, EFalse otherwise
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAMRNBCodecData::Supported()
+    {
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::GetPCMCaptureDurationMs
+// Return preferred duration of PCM capture in milliseconds, relevant only for CMMFCodecs
+// -----------------------------------------------------------------------------
+//
+TReal CCMRAMRNBCodecData::GetPCMCaptureDurationMs() const
+    {
+    return KCMRAMRMaxPCMBufferTime;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::GetCodecConfigParamL
+// Converts bitrate to configuration parameters expected by the AMR codec
+// -----------------------------------------------------------------------------
+//
+TDes8* CCMRAMRNBCodecData::GetCodecConfigParamL(MDataSource* /*aDataSource*/)
+    {
+    PRINT((_L("CCMRAMRNBCodecData::GetCodecConfigParamL()")));
+    if ( iConfigData == NULL )
+        {
+        // no exact bitrate given, use the default
+        SetBitRateL(iBitRate);
+        }
+    return reinterpret_cast<TDes8*>(iConfigData);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::FrameLengthL
+// Reads frame length from header in the given buffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAMRNBCodecData::FrameLength( const TUint8* aBuf, TInt /*aDataLen*/ ) const
+    {
+    return KCMRRawAmrFrameLength[(TInt)(((*aBuf) & 0x78) >> 3)];
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::SetBitRateL
+// Saves & converts bitrate to configuration parameters expected by the AMR-NB codec
+// -----------------------------------------------------------------------------
+//
+void CCMRAMRNBCodecData::SetBitRateL(TInt aBitRate)
+    {
+    PRINT((_L("CCMRAMRNBCodecData::SetBitRateL(); aBitRate %d"),aBitRate));
+
+    if ( (aBitRate < KCMRMinAudioBitRate) || (aBitRate > KCMRMaxAudioBitRate) )
+        {
+        PRINT((_L("CCMRAMRNBCodecData::SetBitRateL(); illegal bitrate")));
+        User::Leave( KErrArgument );
+        }
+
+    iBitRate = aBitRate;
+
+    TCMRAMREncParams* configData;
+    if ( iConfigData == NULL )
+        {
+        configData = new (ELeave) TCMRAMREncParams;
+        iConfigData = reinterpret_cast<TDes8*>(configData);
+        }
+    else
+        {
+        configData = reinterpret_cast<TCMRAMREncParams*>(iConfigData);
+        }
+
+    // the bitrates in the switch & if below are not magic numbers but AMR bitrates in bits per seconds and mode indices from TAmrEncParams
+
+    switch ( aBitRate )
+        {
+        case 4750:
+            configData->iMode = 0;
+            configData->iDTX = EFalse;
+            break;
+        case 5150:
+            configData->iMode = 1;
+            configData->iDTX = EFalse;
+            break;
+        case 5900:
+            configData->iMode = 2;
+            configData->iDTX = EFalse;
+            break;
+        case 6700:
+            configData->iMode = 3;
+            configData->iDTX = EFalse;
+            break;
+        case 7400:
+            configData->iMode = 4;
+            configData->iDTX = EFalse;
+            break;
+        case 7950:
+            configData->iMode = 5;
+            configData->iDTX = EFalse;
+            break;
+        case 10200:
+            configData->iMode = 6;
+            configData->iDTX = EFalse;
+            break;
+        case 12200:
+            configData->iMode = 7;
+            configData->iDTX = EFalse;
+            break;
+        default :
+            // Interprets now the bitrate proprietarily: bitrates that are not exactly AMR bitrates
+            // mean that voice activity detection is used and the AMR bitrates is the given bitrate rounded upwards to the next AMR bitrate
+            if ( aBitRate < 4750 )
+                {
+                configData->iMode = 0;
+                configData->iDTX = ETrue;
+                }
+            else if ( aBitRate < 5150 )
+                {
+                configData->iMode = 1;
+                configData->iDTX = ETrue;
+                }
+            else if ( aBitRate < 5900 )
+                {
+                configData->iMode = 2;
+                configData->iDTX = ETrue;
+                }
+            else if ( aBitRate < 6700 )
+                {
+                configData->iMode = 3;
+                configData->iDTX = ETrue;
+                }
+            else if ( aBitRate < 7400 )
+                {
+                configData->iMode = 4;
+                configData->iDTX = ETrue;
+                }
+            else if ( aBitRate < 7950 )
+                {
+                configData->iMode = 5;
+                configData->iDTX = ETrue;
+                }
+            else if ( aBitRate < 10200 )
+                {
+                configData->iMode = 6;
+                configData->iDTX = ETrue;
+                }
+            else // must be: ( aBitRate < 12200 ) since checked earlier
+                {
+                configData->iMode = 7;
+                configData->iDTX = ETrue;
+                }
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::GetBitRateL
+// Get the used bitrate
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAMRNBCodecData::GetBitRateL() const
+    {
+    return iBitRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::MaxFrameLengthL
+// Return max size of coded buffer in bytes
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAMRNBCodecData::MaxFrameLengthL() const
+    {
+    return KCMRAMRBufferSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::CCMRAudioHWConfigL
+// Configures sample DevSound AMR HW device
+// Returns: KErrNone or one of the system wide error codes
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAMRNBCodecData::AudioHWConfigL(MDataSource* aDataSource, const TDesC8& aParams )
+    {
+    PRINT((_L("CCMRAMRNBCodecData::AudioHWConfig() in")));
+    TInt err = KErrNone;
+
+    CMMFAudioInput* audioInput = static_cast<CMMFAudioInput*>(aDataSource);
+    CSpeechEncoderConfig* custInt = CSpeechEncoderConfig::NewL( audioInput->SoundDevice() );
+    CleanupStack::PushL(custInt);
+
+    if (custInt)
+        {
+        // set it to the HW device
+        TInt err = custInt->SetBitrate( iBitRate );
+        if ( err != KErrNone )
+            {
+            PRINT((_L("CCMRAMRNBCodecData::CCMRAudioHWConfig() setting new bitrate to HW device failed %d"), err));
+            return err;
+            }
+
+        const TCMRAMREncParams* amrParams = reinterpret_cast<const TCMRAMREncParams*>(&aParams);
+        // Voice activity detection, error not that relevant
+        err = custInt->SetVadMode( amrParams->iDTX );
+        }
+    else
+        {
+        // no custom interface for the HW device with the given Uid / no HW device; use default settings
+        }
+    CleanupStack::PopAndDestroy(custInt);
+    PRINT((_L("CCMRAMRNBCodecData::AudioHWConfig() out, err %d"), err));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::PreferredSampleCountPerInputBuffer
+// Preferred samplecount per inputbuffer.
+// Returns: samplecount per inputbuffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAMRNBCodecData::PreferredSampleCountPerInputBuffer()
+    {
+    return 8*KCMRAMRMaxPCMBufferTime;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAMRNBCodecData::PreferredFrameCountPerInputBuffer
+// Get the preferred framecount per PCM inputbuffer.
+// Returns: samplecount per inputbuffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAMRNBCodecData::PreferredFrameCountPerInputBuffer()
+    {
+    return 3;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAacCodecData.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AAC related data & functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRAacCodecData.h"
+
+#include "CCMRSupportedCodecs.h"
+
+#include <mmf/server/mmfaudioinput.h>
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// CONSTANTS
+const TInt KCMRDefAudioBitRate(32000);
+// const TInt KCMRMaxAudioBitRate(96000); // recommended is 2x max samplerate.
+const TInt KCMRMinAudioBitRate(16000);
+
+const TInt KCMRAudioType(2);    //AAC-LC
+const TUint KCMRSampleRate(16000);
+const TInt KCMRAACBufferSize(768);  // this is the max AAC framelength; 6*128 bytes
+
+
+// Length of decoder configuration info in bytes. Is filled in CCMRAACCodecData::GetDecoderConfigInfoLC() and this should match with the method
+const TInt KCMRAACDecoderConfigInfoLength = 2;
+
+// list of supported sample rates
+const TInt KCMRNumSupportedSampleRates = 5;
+const TUint KCMRSupportedSampleRates[5] = {8000,16000,24000,32000,48000};
+
+
+
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RateIndex: converts sample rate to rate index used in decoder config info
+// -----------------------------------------------------------------------------
+//
+static TUint8 RateIndex(TInt aRate)
+    {
+    switch ( aRate )
+        {
+        case 96000:
+            return 0x0;
+        case 88200:
+            return 0x1;
+        case 64000:
+            return 0x2;
+        case 48000:
+            return 0x3;
+        case 44100:
+            return 0x4;
+        case 32000:
+            return 0x5;
+        case 24000:
+            return 0x6;
+        case 22050:
+            return 0x7;
+        case 16000:
+            return 0x8;
+        case 12000:
+            return 0x9;
+        case 11025:
+            return 0xa;
+        case 8000:
+            return 0xb;
+        case 7350:
+            return 0xc;
+        default:
+            return 0xf;
+        }
+    }
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::CCMRAACCodecData
+// -----------------------------------------------------------------------------
+//
+CCMRAACCodecData::CCMRAACCodecData(TCMRCodecType aType) : CCMRAudioCodecData(KCMRFourCCIdMPEG4AAC, KCMRDefAudioBitRate, CCMRMediaBuffer::EAudioMPEG4AAC, aType)
+    {
+    // this formula comes from AAC, the constants too
+    iChannels = 1;
+    iSampleRate = KCMRSampleRate;
+    iMaxBitRate = 6144 * iChannels * iSampleRate / 1024;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::~CCMRAACCodecData
+// -----------------------------------------------------------------------------
+//
+CCMRAACCodecData::~CCMRAACCodecData()
+    {
+    PRINT((_L("CCMRAACCodecData::~CCMRAACCodecData() in")));
+    delete iConfigData;
+    iAACConfigData.Close();
+    PRINT((_L("CCMRAACCodecData::~CCMRAACCodecData() out")));
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::Supported
+// Return ETrue if the codec is supported in this configuration, EFalse otherwise
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAACCodecData::Supported()
+    {
+    PRINT((_L("CCMRAACCodecData::Supported()")));
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetPCMCaptureDurationMs
+// Return preferred duration of PCM capture in milliseconds, relevant only for CMMFCodecs
+// -----------------------------------------------------------------------------
+//
+TReal CCMRAACCodecData::GetPCMCaptureDurationMs() const
+    {
+    return GetFrameDurationUs()/1000;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetCodecConfigParamL
+// Converts bitrate to configuration parameters expected by the codec
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TDes8* CCMRAACCodecData::GetCodecConfigParamL(MDataSource* /*aDataSource*/)
+    {
+    PRINT((_L("CCMRAACCodecData::GetCodecConfigParamL()")));
+
+    // AAC codec interprets the input as array of TInts, not as a class
+    iAACConfigData.Reset();
+	iAACConfigData.Append (iBitRate);	//iBitRate
+	iAACConfigData.Append (iSampleRate);	//iSamplingRate
+	iAACConfigData.Append (0);	//iToolFlags
+	iAACConfigData.Append (iChannels);	//iNumChan
+	iAACConfigData.Append (0);	//iuseFormat 0=RAW; 1=ADTS; 2=ADIF
+	iAACConfigData.Append (0);	// 0 = 1 Frame only; 1 = Full Buffer
+
+    PRINT((_L("CCMRAACCodecData::GetCodecConfigParamL() out")));
+    return reinterpret_cast<TDes8*>(&iAACConfigData);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::FrameLengthL
+// Reads frame length from header in the given buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::FrameLength( const TUint8* /*aBuf*/, TInt aDataLen ) const
+    {
+    return aDataLen;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetFrameDurationUs
+// Return frame duration in microseconds
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal CCMRAACCodecData::GetFrameDurationUs() const
+    {
+    return (TReal(1000)*1024/iSampleRate)*1000;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::SetBitRateL
+// Saves & converts bitrate to configuration parameters expected by the codec
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAACCodecData::SetBitRateL(TInt aBitRate)
+    {
+    PRINT((_L("CCMRAACCodecData::SetBitRateL(); aBitRate %d"),aBitRate));
+
+    if ( (aBitRate > iMaxBitRate) || (aBitRate < KCMRMinAudioBitRate))
+        {
+        PRINT((_L("CCMRAACCodecData::SetBitRateL(); illegal bitrate")));
+        User::Leave( KErrArgument );
+        }
+
+    iBitRate = aBitRate;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetBitRateL
+// Get the used bitrate
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::GetBitRateL() const
+    {
+    return iBitRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::SetSampleRateL
+// Set sample rate for the codec, leaves if not supported
+// -----------------------------------------------------------------------------
+//
+void CCMRAACCodecData::SetSampleRateL(TUint aSampleRate)
+    {
+    TInt i;
+    TBool iSet = EFalse;
+    for ( i = 0; i < KCMRNumSupportedSampleRates; i++ )
+        {
+        if ( aSampleRate == KCMRSupportedSampleRates[i] )
+            {
+            iSampleRate = aSampleRate;
+            iSet = ETrue;
+            }
+        }
+    if ( !iSet )
+        {
+        // given samplerate is not supported
+        PRINT((_L("CCMRAACCodecData::SetSampleRateL(); unsupported samplerate")));
+        User::Leave( KErrNotSupported );
+        }
+
+    // this formula comes from AAC, the constants too
+    iMaxBitRate = 6144 * iChannels * iSampleRate / 1024;
+
+    if ( iBitRate > iMaxBitRate )
+        {
+        PRINT((_L("CCMRAACCodecData::SetSampleRateL(); illegal bitrate & samplerate combination")));
+        User::Leave( KErrArgument );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetSampleRate
+// Get the used sample rate
+// -----------------------------------------------------------------------------
+//
+TUint CCMRAACCodecData::GetSampleRate() const
+    {
+    return iSampleRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::SetChannelModeL
+// Get the used channel mode
+// -----------------------------------------------------------------------------
+//
+void CCMRAACCodecData::SetChannelModeL(TUint aChannelMode)
+    {
+    iChannels = aChannelMode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::MaxFrameLengthL
+// Return max size of coded buffer in bytes
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::MaxFrameLengthL() const
+    {
+    return KCMRAACBufferSize*iChannels;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetDecoderConfigInfoLC
+// Get the decoder configuration info for the codec to be saved into metadata etc
+// -----------------------------------------------------------------------------
+//
+HBufC8* CCMRAACCodecData::GetDecoderConfigInfoLC()
+    {
+    HBufC8* configData = 0;
+    configData = (HBufC8*) HBufC8::NewLC(KCMRAACDecoderConfigInfoLength);
+
+    TUint8 data[2];
+
+    data[0] = KCMRAudioType<<3;
+    TUint8 rate = RateIndex(iSampleRate);
+    data[0] |= rate>>1;
+    data[1] = TUint8(rate<<7);
+    data[1] |= TUint8(iChannels<<3);
+
+    configData->Des().Append( data[0] );
+    configData->Des().Append( data[1] );
+
+    return configData;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::CCMRAudioHWConfigL
+// Configures sample DevSound AAC HW device
+// Returns: KErrNone or one of the system wide error codes
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::AudioHWConfigL(MDataSource* /*aDataSource*/, const TDesC8& /*aParams*/ )
+    {
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::PreferredSampleCountPerInputBuffer
+// Preferred samplecount per inputbuffer.
+// Returns: samplecount per inputbuffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::PreferredSampleCountPerInputBuffer()
+    {
+    return 1024; //from AAC samplecount per frame.
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::PreferredFrameCountPerInputBuffer
+// Get the preferred framecount per PCM inputbuffer.
+// Returns: samplecount per inputbuffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::PreferredFrameCountPerInputBuffer()
+    {
+    return 1;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAacCodecDataStub.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AAC related stub data & functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRAacCodecData.h"
+#include "CCMRSupportedCodecs.h"
+
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// CONSTANTS
+const TInt KCMRDefAudioBitRate(32000);
+
+const TUint KCMRSampleRate(16000);
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::CCMRAACCodecData
+// -----------------------------------------------------------------------------
+//
+CCMRAACCodecData::CCMRAACCodecData(TCMRCodecType aType) : CCMRAudioCodecData(KCMRFourCCIdMPEG4AAC, KCMRDefAudioBitRate, CCMRMediaBuffer::EAudioMPEG4AAC, aType), iSampleRate(KCMRSampleRate), iChannels(1)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::~CCMRAACCodecData
+// -----------------------------------------------------------------------------
+//
+CCMRAACCodecData::~CCMRAACCodecData()
+    {
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::Supported
+// Is codec supported? No since this is a stub
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAACCodecData::Supported()
+    {
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetPCMCaptureDurationMs
+// Return preferred duration of PCM capture in milliseconds, relevant only for CMMFCodecs
+// returns 0 since this is a stub
+// -----------------------------------------------------------------------------
+//
+TReal CCMRAACCodecData::GetPCMCaptureDurationMs() const
+    {
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetCodecConfigParamL
+// Converts bitrate to configuration parameters expected by the codec
+// leaves since this is stub
+// -----------------------------------------------------------------------------
+//
+TDes8* CCMRAACCodecData::GetCodecConfigParamL(MDataSource* /*aDataSource*/)
+    {
+    User::Leave( KErrNotSupported );
+    return NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::FrameLengthL
+// Reads frame length from header in the given buffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::FrameLength( const TUint8* /*aBuf*/, TInt aDataLen ) const
+    {
+    return aDataLen;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetFrameDurationUs
+// Get frame duration in microseconds, 0 for stub
+// -----------------------------------------------------------------------------
+//
+TReal CCMRAACCodecData::GetFrameDurationUs() const
+    {
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::SetBitRateL
+// Saves & converts bitrate to configuration parameters expected by the codec
+// -----------------------------------------------------------------------------
+//
+void CCMRAACCodecData::SetBitRateL(TInt /*aBitRate*/)
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetBitRateL
+// Get the used bitrate; leaves since this is stub
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::GetBitRateL() const
+    {
+    User::Leave( KErrNotSupported );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::SetSampleRateL
+// Set sample rate for the codec, leaves since this is stub
+// -----------------------------------------------------------------------------
+//
+void CCMRAACCodecData::SetSampleRateL(TUint /*aSampleRate*/)
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetSampleRate
+// Get the used sample rate
+// -----------------------------------------------------------------------------
+//
+TUint CCMRAACCodecData::GetSampleRate() const
+    {
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::SetChannelModeL
+// Get the used channel mode
+// -----------------------------------------------------------------------------
+//
+void CCMRAACCodecData::SetChannelModeL(TUint aChannelMode)
+    {
+    iChannels = aChannelMode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::MaxFrameLengthL
+// Return max size of coded buffer in bytes; leaves since this is stub
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::MaxFrameLengthL() const
+    {
+    User::Leave( KErrNotSupported );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::GetDecoderConfigInfoLC
+// Get the decoder configuration info for the codec to be saved into metadata etc
+// leaves since this is stub
+// -----------------------------------------------------------------------------
+//
+HBufC8* CCMRAACCodecData::GetDecoderConfigInfoLC()
+    {
+    User::Leave( KErrNotSupported );
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::CCMRAudioHWConfigL
+// Configures sample DevSound AAC HW device
+// Returns: KErrNone or one of the system wide error codes
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::AudioHWConfigL(MDataSource* /*aDataSource*/, const TDesC8& /*aParams*/ )
+    {
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::PreferredSampleCountPerInputBuffer
+// Preferred samplecount per inputbuffer.
+// Returns: samplecount per inputbuffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::PreferredSampleCountPerInputBuffer()
+    {
+    return 1024;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAACCodecData::PreferredFrameCountPerInputBuffer
+// Get the preferred framecount per PCM inputbuffer.
+// Returns: samplecount per inputbuffer
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAACCodecData::PreferredFrameCountPerInputBuffer()
+    {
+    return 1;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRActiveOutput.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,516 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active object class for writing audio/video to CCMRMediaSink.
+*                Forwards buffers from different threads to a single-thread 
+*                CCMRMediaSink
+*
+*/
+
+
+// INCLUDES
+#include "CCMRActiveOutput.h"
+
+// CONSTANTS
+const TInt KCMROutputSleepTime = 10000;    // 10 ms time for other AOs to execute
+const TInt KCMROutputMaxBufsPerRun = 10;   // Nr of bufs to handle in single AO run
+
+// MACROS
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::NewL
+// Two-phased constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCMRActiveOutput* CCMRActiveOutput::NewL(MCMRMediaSink* aSink, MCMRActiveOutputObserver* aObserver)
+    {
+    CCMRActiveOutput* self = new (ELeave) CCMRActiveOutput;
+    CleanupStack::PushL(self);
+    self->ConstructL( aSink, aObserver );
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::CCMRActiveOutput
+// Constructor
+// 
+// -----------------------------------------------------------------------------
+//
+CCMRActiveOutput::CCMRActiveOutput()
+:		CActive(EPriorityStandard)
+		{
+		CActiveScheduler::Add( this );
+		}
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::~CCMRActiveOutput
+// Destructor
+// 
+// -----------------------------------------------------------------------------
+//
+CCMRActiveOutput::~CCMRActiveOutput()
+    {
+    PRINT((_L("CCMRActiveOutput::~CCMRActiveOutput() AO %x destructor in"), this));
+    Cancel();
+    
+    iTimer.Close();
+    iMutexObj.Close();
+    
+    iSink = NULL; // to satisfy PC Lint
+    iMediaSource = NULL;
+    iObserver = NULL;
+    PRINT((_L("CCMRActiveOutput::~CCMRActiveOutput() AO %x destructor out"), this));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::ConstructL
+// Symbian 2nd phase constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::ConstructL(MCMRMediaSink* aSink, MCMRActiveOutputObserver* aObserver)
+    {
+    iSink = aSink;
+	iObserver = aObserver;
+
+	User::LeaveIfError( iTimer.CreateLocal() );
+	User::LeaveIfError( iMutexObj.CreateLocal() );
+
+
+    PRINT((_L("CCMRActiveOutput::ConstructL() created AO %x"), this));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::RegisterSourceL
+// Register source (audio or video) for this active object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::RegisterSourceL(MCMRMediaSource* aSource)
+    {
+    PRINT((_L("CCMRActiveOutput::RegisterSourceL() - START - this: 0x%08x, iStatus %d, IsActive: %d, iRunning: %d"), this, iStatus.Int(), IsActive(), iRunning ));
+	Cancel();
+
+    // we can safely change the source
+    // save the source object handle
+    PRINT((_L("CCMRActiveOutput::RegisterSourceL() AO %x for source %x"), this, aSource));
+    iMediaSource = aSource;
+
+    // enter restricted area
+    iMutexObj.Wait();
+    if ( iRunning && !IsActive() )
+        {
+        //should issue a request now, since it was not issued in Start (possible if there was no mediasource yet registered in Start)
+        
+        PRINT((_L("CCMRActiveOutput::RegisterSourceL() AO %x issued a data request"), this));
+        RequestNewData();
+        }
+    // leave restricted area
+    iMutexObj.Signal();
+
+    PRINT((_L("CCMRActiveOutput::RegisterSourceL() - END - this: 0x%08x, iStatus %d, IsActive: %d, iRunning: %d"), this, iStatus.Int(), IsActive(), iRunning ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::Start
+// Start output by giving the first request to registered source
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::Start()
+    {
+    PRINT((_L("CCMRActiveOutput::Start() AO %x in"), this));
+    if ( iMediaSource == NULL )
+        {
+        // no source registered yet
+        PRINT((_L("CCMRActiveOutput::Start() AO %x no source!!"), this));
+        return;
+        }
+    // enter restricted area
+    iMutexObj.Wait();
+    if ( !IsActive() )
+        {
+        PRINT((_L("CCMRActiveOutput::Start() AO %x issued a data request"), this));
+    	RequestNewData();
+        }
+    else 
+        {
+        PRINT((_L("CCMRActiveOutput::Start() AO %x already active!!"), this));
+        }
+    iRunning = ETrue;
+
+    // leave restricted area
+    iMutexObj.Signal();
+    PRINT((_L("CCMRActiveOutput::Start() AO %x out"), this));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::Stop
+// Stops and flushes buffers
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::Stop()
+    {
+    PRINT((_L("CCMRActiveOutput::Stop() AO %x in"), this));
+    iRunning = EFalse;
+    Cancel();
+    Flush();
+    PRINT((_L("CCMRActiveOutput::Stop() AO %x out"), this));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::Flush
+// Flushed buffers from the queue of the source
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::Flush()
+    {
+    PRINT((_L("CCMRActiveOutput::Flush() - START - this: 0x%08x, iState: %d iStatus: %d"), this, iState, iStatus.Int()));
+
+    if ( iMediaSource == NULL )
+        {
+        // no source registered yet
+        return;
+        }
+        
+    if ( iBuffer ) 
+        {
+        // return the buffer to the source; it may have been reset in Flush
+        PRINT((_L("CCMRActiveOutput::Flush() - iBuffer=0x%x"), iBuffer));
+        iMediaSource->ReturnBuffer(iBuffer);
+        iBuffer = NULL;
+        }
+    // read all buffers from the source
+    CCMRMediaBuffer* buffer;
+    TInt err = KErrNone;
+    for (;;)
+        {
+        buffer = iMediaSource->GetNextBuffer();
+        if ( buffer == NULL )
+            {
+            break;
+            }
+
+        // write the data to 3GP
+        TRAP(err, iSink->WriteBufferL(buffer) )	;
+        if ( err != KErrNone )
+            {
+            // need to flush the buffers anyway
+            PRINT((_L("CCMRActiveOutput::Flush() of %x WriteBufferL left with error %d"), this, err));
+            }
+        else
+            {
+            PRINT((_L("CCMRActiveOutput::Flush() of %x wrote a buffer %x to external sink"), iMediaSource, buffer));
+            }
+
+        // return the buffer to the source
+        iMediaSource->ReturnBuffer(buffer);
+        buffer = NULL;
+        }
+        
+    PRINT((_L("CCMRActiveOutput::Flush() - END - this: 0x%08x, iState: %d iStatus: %d"), this, iState, iStatus.Int()));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::RunL
+// Main function of the active object, writes buffers from source to sink
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::RunL()
+    {
+    PRINT((_L("CCMRActiveOutput::RunL() - START - this: 0x%08x, iState: %d iStatus: %d"), this, iState, iStatus.Int()));
+
+    if ( iMediaSource == NULL )
+        {
+        // no source registered yet
+        return;
+        }
+
+    // issue a new request right away, this may result in one useless call for this runl if this flushes all the buffers now, but 
+    // if the issuing is done after the loop here, there can be new data without completion of the request (the source thread 
+    // may pre-emptively get scheduled) which is then left unread
+    PRINT((_L("CCMRActiveOutput::RunL() of %x issued a new data request"), this));
+    RequestNewData();
+
+    PRINT((_L("CCMRActiveOutput::RunL() of %x started processing old buffers"), this));
+    // read all buffers from the source
+    TInt i = 0;
+    for ( i = 0; i < KCMROutputMaxBufsPerRun; i++ )
+        {
+        iBuffer = iMediaSource->GetNextBuffer();
+        if ( iBuffer == NULL )
+            {
+            PRINT((_L("CCMRActiveOutput::RunL() of %x got a NULL buffer from %x, breaking the for-loop"), this, iMediaSource));
+            break;
+            }
+
+        // write the data to 3GP
+        iSink->WriteBufferL(iBuffer);
+
+        if ( iBuffer )
+            {
+            // return the buffer to the source; it may have been reset in Flush
+            PRINT((_L("CCMRActiveOutput::RunL() of %x wrote a buffer %x of type %d from source %x to sink"), this, iBuffer, iBuffer->Type(), iMediaSource));
+            iMediaSource->ReturnBuffer(iBuffer);
+            iBuffer = NULL;
+            }
+
+        if ( iStatus == KErrCancel )
+            {
+            PRINT((_L("CCMRActiveOutput::RunL() of %x canceled while writing buffer, get out"), this));
+            return;
+            }
+        }
+
+    if ( iMediaSource->NumBuffersWaiting() > 0 )
+        {
+        // break the loop to give other AOs time to execute
+        PRINT((_L("CCMRActiveOutput::RunL() of %x goes to asleep for 10 ms, # of buffers still waiting in source %d"), this, iMediaSource->NumBuffersWaiting()));
+        
+        // must cancel the earlier request before setting timer
+        Cancel();
+		RequestTimerPause();
+        }
+    else
+        {
+        // new request was issued already
+        }
+
+    PRINT((_L("CCMRActiveOutput::RunL() - END - this: 0x%08x"), this));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::DoCancel
+// 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::DoCancel()
+    {
+	PRINT((_L("CCMRActiveOutput::DoCancel() - START - this: 0x%08x, iState: %d, thread: %d, iStatus: %d, sc: %d"), 
+	           this, iState, I64INT(RThread().Id()), iStatus.Int(), RThread().RequestCount() ));
+
+    switch( iState )
+		{
+		case EStateTimerPause:
+			iTimer.Cancel();
+			break;
+		case EStateRequestingNewData: 
+			iMediaSource->RequestNewDataCancel( iStatus );			
+			break;
+		default:
+		case EStateIdle:
+			ASSERT( EFalse );
+			break;
+		}    
+  
+	iState = EStateIdle;
+
+	PRINT((_L("CCMRActiveOutput::DoCancel() - END - this: 0x%08x, iState: %d, thread: %d, iStatus: %d, sc: %d"), 
+	           this, iState, I64INT(RThread().Id()), iStatus.Int(), RThread().RequestCount() ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::RunError
+// Inform the observer about an error occurred in RunL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRActiveOutput::RunError(TInt aError)
+    {
+    PRINT((_L("CCMRActiveOutput::RunError() of %x"), this));
+    iObserver->MaooError( aError );
+
+    // return the buffer to the source
+    if ( iBuffer )
+        {
+        iMediaSource->ReturnBuffer(iBuffer);
+        iBuffer = NULL;
+        }
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::NumBuffersInQueueL
+// Return the number of buffers waiting in the input of the active object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRActiveOutput::NumBuffersInQueueL()
+    {
+    PRINT((_L("CCMRActiveOutput::NumBuffersInQueueL() of %x"), this));
+    if ( !iMediaSource )
+        {
+        PRINT((_L("CCMRActiveOutput::NumBuffersInQueueL() of %x not ready")));
+        User::Leave( KErrNotReady );
+        }
+    return iMediaSource->NumBuffersWaiting();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::LatestTimeStampL
+// Return the latest time stamp from the input stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::LatestTimeStampL(TTimeIntervalMicroSeconds& aTimeStamp) const
+    {
+    PRINT((_L("CCMRActiveOutput::LatestTimeStampL() of %x"), this));
+    if ( !iMediaSource )
+        {
+        PRINT((_L("CCMRActiveOutput::LatestTimeStampL() of %x not ready")));
+        aTimeStamp = 0;
+        }
+    else
+        {
+        iMediaSource->LatestTimeStampL( aTimeStamp );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::DurationL
+// Return the duration of the recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::DurationL(TTimeIntervalMicroSeconds& aDuration) const
+    {
+    PRINT((_L("CCMRActiveOutput::DurationL() of %x"), this));
+    if ( !iMediaSource )
+        {
+        PRINT((_L("CCMRActiveOutput::DurationL() of %x not ready")));
+        User::Leave( KErrNotReady );
+        }
+    iMediaSource->DurationL(aDuration);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::SetVideoFrameSize
+// Passes video frame size to mediasink
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRActiveOutput::SetVideoFrameSize(TSize aSize)
+    {
+    return iSink->SetVideoFrameSize( aSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::SetAverageVideoBitRate
+// Passes average video bitrate to mediasink
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRActiveOutput::SetAverageVideoBitRate(TInt aBitRate)
+    {
+    return iSink->SetAverageVideoBitRate( aBitRate );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::SetMaxVideoBitRate
+// Passes maximum video bitrate to mediasink
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRActiveOutput::SetMaxVideoBitRate(TInt aBitRate)
+    {
+    return iSink->SetMaxVideoBitRate( aBitRate );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::SetMaxVideoBitRate
+// Passes average audio bitrate to mediasink
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRActiveOutput::SetAverageAudioBitRate(TInt aBitRate)
+    {
+    return iSink->SetAverageAudioBitRate( aBitRate );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::SetState
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::SetState( TState aState )
+	{
+    PRINT((_L("CCMRActiveOutput::SetState() changing state from %d to %d"), iState, aState ));
+	iState = aState;
+	}
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::RequestTimerPause
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::RequestTimerPause()
+	{
+	PRINT((_L("CCMRActiveOutput::RequestTimerPause() - IsActive: %d, iState: %d, iStatus: %d"), 
+	           IsActive(), iState, iStatus.Int() ));
+	ASSERT( !IsActive() );
+	
+    iTimer.After( iStatus, KCMROutputSleepTime ); // give other active objects a chance to execute and sleep 10 ms
+	SetActive();
+	
+    SetState( CCMRActiveOutput::EStateTimerPause );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCMRActiveOutput::RequestNewData
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CCMRActiveOutput::RequestNewData()
+	{
+	PRINT((_L("CCMRActiveOutput::RequestNewData() - IsActive: %d, iState: %d, iStatus: %d"), 
+	           IsActive(), iState, iStatus.Int() ));
+	ASSERT( !IsActive() );
+	
+    iMediaSource->RequestNewData(iStatus);
+    SetActive();
+
+    SetState( CCMRActiveOutput::EStateRequestingNewData );
+	}
+	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioCodecs.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,437 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCMRAudioCodecs functions for checking supported codecs etc
+*                and CCMRAudioCodecData base class implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRAudioCodecs.h"
+#include "CCMRAudioCodecData.h"
+#include "CCMRAMRNBCodecData.h"
+#include "CCMRAacCodecData.h"
+
+#include "CCMRSupportedCodecs.h"
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <ecom/ecom.h>
+#include <mmfplugininterfaceuids.hrh>
+#include <mmf/server/sounddevice.h> // devsound
+#include <AudioPreference.h>  // For MMF audio preference definitions.
+
+
+// MACROS
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// ============================ CCMRAudioCodecs MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::NewL
+// -----------------------------------------------------------------------------
+//
+CCMRAudioCodecs* CCMRAudioCodecs::NewL()
+    {
+    CCMRAudioCodecs* self = new (ELeave) CCMRAudioCodecs;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecs::~CCMRAudioCodecs
+// -----------------------------------------------------------------------------
+//
+CCMRAudioCodecs::~CCMRAudioCodecs()
+    {
+    PRINT((_L("CCMRAudioCodecs::~CCMRAudioCodecs() in")));
+    iAudioTypesHW.Close();
+    iAudioTypesSW.Close();
+
+    delete iAudioCodec;
+    PRINT((_L("CCMRAudioCodecs::~CCMRAudioCodecs() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioCodecs::ConstructL()
+    {
+    PRINT((_L("CCMRAudioCodecs::ConstructL() in")));
+    iAudioTypesHW.Reset();
+    iAudioTypesSW.Reset();
+
+    // AMR-NB
+    CCMRAMRNBCodecData amr(ECodecTypeNA);
+
+    if ( amr.Supported() )
+        {
+        // 1st check HW codecs
+        if ( CheckIfInstalledL(TFourCC(KCMRFourCCIdAMRNB), KMmfUidPluginInterfaceHwDevice, KNullUid) )
+            {
+            PRINT((_L("CCMRAudioCodecs::GetSupportedAudioCodecsL() AMR HW codec found")));
+            iAudioTypesHW.Append( TFourCC(KCMRFourCCIdAMRNB) );
+            }
+        else if ( CheckIfInstalledL(TFourCC(KCMRFourCCIdAMRNB), KMmfUidPluginInterfaceCodec, amr.SWCodecUid() ) )
+        // then check for SW codecs
+            {
+            PRINT((_L("CCMRAudioCodecs::GetSupportedAudioCodecsL() AMR SW codec found")));
+            iAudioTypesSW.Append( TFourCC(KCMRFourCCIdAMRNB) );
+            }
+        // else no AMR codecs => nothing to add to the list
+        }
+
+    //AAC
+    CCMRAACCodecData aac(ECodecTypeNA);
+
+    if ( aac.Supported() )
+        {
+        // 1st check HW codecs
+        if ( CheckIfInstalledL(TFourCC(KCMRFourCCIdMPEG4AAC), KMmfUidPluginInterfaceHwDevice, KNullUid ) )
+            {
+            PRINT((_L("CCMRAudioCodecs::GetSupportedAudioCodecsL() AAC HW codec found")));
+            iAudioTypesHW.Append( TFourCC(KCMRFourCCIdMPEG4AAC) );
+            }
+        else if ( CheckIfInstalledL(TFourCC(KCMRFourCCIdMPEG4AAC), KMmfUidPluginInterfaceCodec, aac.SWCodecUid() ) )
+        // then check for SW codecs
+            {
+            PRINT((_L("CCMRAudioCodecs::GetSupportedAudioCodecsL() AAC SW codec found")));
+            iAudioTypesSW.Append( TFourCC(KCMRFourCCIdMPEG4AAC) );
+            }
+        // else no AAC codecs => nothing to add to the list
+        }
+
+    PRINT((_L("CCMRAudioCodecs::ConstructL() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRAudioCodecs::CheckIfInstalledL
+// Helper function to check if given codec FourCC is supported
+// in the system, either HW or SW
+//
+// ---------------------------------------------------------
+//
+TBool CCMRAudioCodecs::CheckIfInstalledL( const TFourCC& aFourCC, const TInt aUidMmfPluginInterfaceCodec, const TUid& aCodecUid )
+    {
+    PRINT((_L("CCMRAudioCodecs::CheckIfInstalledL() in") ));
+    TBool found = EFalse;
+
+	// Create a match string using a FourCC code
+	_LIT8(emptyFourCCString, "    ,    ");
+	TBufC8<9> fourCCString(emptyFourCCString);
+	TPtr8 fourCCPtr = fourCCString.Des();
+	TPtr8 fourCCPtr1(&fourCCPtr[0], 4);
+	TPtr8 fourCCPtr2(&fourCCPtr[5], 4 );
+
+	TFourCC srcFourCC(' ','P','1','6');
+	srcFourCC.FourCC(&fourCCPtr1);
+	aFourCC.FourCC(&fourCCPtr2);
+
+	// Create a TEcomResolverParams structure.
+	TEComResolverParams resolverParams;
+	resolverParams.SetDataType( fourCCPtr );
+	resolverParams.SetWildcardMatch( EFalse );
+
+	RImplInfoPtrArray plugInArray; // Array to return matching decoders in (place on cleanupstack _after_ ListImplementationsL() )
+
+  	TUid UidMmfPluginInterfaceCodec = {aUidMmfPluginInterfaceCodec};
+
+	// ListImplementationsL leaves if it cannot find anything so trap the error and ignore it.
+	TRAPD( err, REComSession::ListImplementationsL(UidMmfPluginInterfaceCodec, resolverParams, plugInArray ) );
+
+	CleanupResetAndDestroyPushL(plugInArray);
+
+	if (err == KErrNone)
+		{
+		if ( plugInArray.Count() != 0 )
+            {
+            if ( aCodecUid == KNullUid )
+                {
+			    //match found and accepted; for a HW codec the Uid is not that critical, since the API is more fixed (no ConfigureL with undefined argument),
+                //and licensees should be able to use their optimized HW codecs
+			    found = CheckIfHWInstalledL( aFourCC );
+                }
+            else
+                {
+                for ( TInt i = 0; i < plugInArray.Count(); i++)
+                    {
+                    // there is a match, but 1st we need to ensure it is the one we have tested with, and that have compatible implementation of ConfigureL
+                    PRINT((_L("CCMRAudioCodecs::CheckIfInstalledL() plugin found with Uid 0x%x"), plugInArray[i]->ImplementationUid().iUid ));
+                    if ( plugInArray[i]->ImplementationUid() == aCodecUid )
+                        {
+			            //match accepted
+			            found = ETrue;
+                        }
+                    }
+                }
+			}
+		else
+			{
+			//no match
+			found = EFalse;
+			}
+		}
+	else
+		{
+		//no match
+		found = EFalse;
+		}
+	CleanupStack::PopAndDestroy();	//plugInArray
+    PRINT((_L("CCMRAudioCodecs::CheckIfInstalledL() out, found[%d]"), found));
+    return found;
+    }
+
+// ---------------------------------------------------------
+// CCMRAudioCodecs::CheckIfHWInstalledL
+// Helper function to check if given codec FourCC is supported
+// by devsound
+//
+// ---------------------------------------------------------
+//
+TBool CCMRAudioCodecs::CheckIfHWInstalledL( const TFourCC& aFourCC )
+    {
+    PRINT((_L("CCMRAudioCodecs::CheckIfHWInstalledL() in") ));
+    TBool found = EFalse;
+
+    CMMFDevSound* dev;
+    dev = CMMFDevSound::NewL();
+
+    TMMFPrioritySettings prioritySettings;
+    prioritySettings.iPriority = KAudioPriorityVideoRecording;
+    prioritySettings.iPref =  TMdaPriorityPreference( KAudioPrefVideoRecording );
+
+    RArray<TFourCC> supportedHWTypes;
+    CleanupStack::PushL( dev );
+    dev->GetSupportedOutputDataTypesL( supportedHWTypes, prioritySettings );
+    CleanupStack::PopAndDestroy(dev);	//dev
+
+    for ( TInt i = 0; i < supportedHWTypes.Count(); i++)
+        {
+        TFourCC fourccFromDevsound = supportedHWTypes[i];
+        PRINT((_L("CCMRAudioCodecs::CheckIfHWInstalledL() FourCC supported by devsound: %d"), fourccFromDevsound.FourCC() ));
+        if ( fourccFromDevsound == aFourCC )
+            {
+            PRINT((_L("CCMRAudioCodecs::CheckIfHWInstalledL() FourCC match found to %d"), fourccFromDevsound.FourCC() ));
+            //match accepted
+            found = ETrue;
+            }
+        }
+    supportedHWTypes.Close();
+    PRINT((_L("CCMRAudioCodecs::CheckIfHWInstalledL() out, found[%d]"), found));
+    return found;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecs::GetSupportedAudioCodecsL
+// Get the supported & installed audio codecs.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioCodecs::GetSupportedAudioCodecsL( RArray<TFourCC>& aAudioTypes )
+    {
+    TInt i;
+
+    for( i = 0; i < iAudioTypesHW.Count(); i++ )
+        {
+        PRINT((_L("CCMRAudioCodecs::GetSupportedAudioCodecsL() HW codec found, FourCC %d"), iAudioTypesHW[i].FourCC() ));
+        aAudioTypes.Append( iAudioTypesHW[i] );
+        }
+    for( i = 0; i < iAudioTypesSW.Count(); i++ )
+        {
+        PRINT((_L("CCMRAudioCodecs::GetSupportedAudioCodecsL() SW codec found, FourCC %d"), iAudioTypesSW[i].FourCC() ));
+        aAudioTypes.Append( iAudioTypesSW[i] );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecs::CheckIfSupportedL
+// Check if the given codec FourCC is supported & installed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioCodecs::CheckIfSupportedL( const TFourCC& aAudioCodec )
+    {
+    TInt i;
+    TFourCC tmpFourCC = aAudioCodec;
+
+    if ( aAudioCodec == KFourCCNULL )
+        {
+        // use default
+        tmpFourCC = TFourCC(KCMRFourCCIdAMRNB);
+        }
+
+    // search from the lists
+    for( i = 0; i < iAudioTypesHW.Count(); i++ )
+        {
+        if ( iAudioTypesHW[i] == tmpFourCC )
+            {
+            PRINT((_L("CCMRAudioCodecs::CheckIfSupportedL() the codec is in HW")));
+            return ETrue;
+            }
+        }
+    for( i = 0; i < iAudioTypesSW.Count(); i++ )
+        {
+        if ( iAudioTypesSW[i] == tmpFourCC )
+            {
+            PRINT((_L("CCMRAudioCodecs::CheckIfSupportedL() the codec is in SW")));
+            return ETrue;
+            }
+        }
+
+    // no match
+    PRINT((_L("CCMRAudioCodecs::CheckIfSupportedL() no codec exist with given fourCC")));
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecs::GetCodecSWHWTypeL
+// Returns the codec type (SW/HW)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCMRCodecType CCMRAudioCodecs::GetCodecSWHWTypeL( const TFourCC& aCodec )
+    {
+
+    TInt i;
+    // search from the lists
+    for( i = 0; i < iAudioTypesHW.Count(); i++ )
+        {
+        if ( iAudioTypesHW[i] == aCodec )
+            {
+            PRINT((_L("CCMRAudioCodecs::GetCodecTypeL() the codec is in HW")));
+            return ECodecTypeHW;
+            }
+        }
+    for( i = 0; i < iAudioTypesSW.Count(); i++ )
+        {
+        if ( iAudioTypesSW[i] == aCodec )
+            {
+            PRINT((_L("CCMRAudioCodecs::GetCodecTypeL() the codec is in SW")));
+            return ECodecTypeSW;
+            }
+        }
+
+    // no match
+    PRINT((_L("CCMRAudioCodecs::GetCodecTypeL() no codec exist with given fourCC")));
+    return ECodecTypeNA;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecs::SetAudioCodecL
+// Set the audio codec to use
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioCodecs::SetAudioCodecL( const TFourCC& aAudioCodec )
+    {
+    if ( !CheckIfSupportedL( aAudioCodec ) )  // CheckIfSupportedL can interpret KFourCCNULL as default AMR-NB
+        {
+        // the requested codec does not exist or is not supported
+        User::Leave( KErrNotSupported );
+        // The original functionality was so that codec's existence was checked only in PrepareL,
+        // and if it didn't exist, recording was video-only. The same behaviour is not any more supported,
+        // mainly because the old behaviour was a restriction from lower layer components (Symbian datapath)
+        // and was considered problematic if the leave with KErrNotSupported occurred only in PrepareL
+        // although OpenL or SetCodecL were successful. It is now considered better to leave in setup phase
+        // if the requested codec doesn't exist or is not supported
+        }
+    // All ok, we can change the codec
+    delete iAudioCodec;
+    iAudioCodec = NULL;
+
+    if ( aAudioCodec == KCMRFourCCIdMPEG4AAC )
+        {
+        PRINT((_L("CCMRAudioCodecs::SetAudioCodecL() AAC selected")));
+        iAudioCodec = new (ELeave) CCMRAACCodecData(GetCodecSWHWTypeL(aAudioCodec));
+        }
+    else if ( aAudioCodec == KCMRFourCCIdAMRNB )
+        {
+        PRINT((_L("CCMRAudioCodecs::SetAudioCodecL() AMR-NB selected")));
+        iAudioCodec = new (ELeave) CCMRAMRNBCodecData(GetCodecSWHWTypeL(aAudioCodec));
+        }
+    else    // AMR-NB is the default
+        {
+        PRINT((_L("CCMRAudioCodecs::SetAudioCodecL() default codec selected, use AMR-NB")));
+        iAudioCodec = new (ELeave) CCMRAMRNBCodecData(GetCodecSWHWTypeL(TFourCC(KCMRFourCCIdAMRNB)));
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecs::GetCodecDataL
+// Get the audio codec data object
+// -----------------------------------------------------------------------------
+//
+CCMRAudioCodecData* CCMRAudioCodecs::GetCodecDataL()
+    {
+    return iAudioCodec;
+    }
+
+
+
+
+
+
+
+// ============================ CCMRAudioCodecData base class MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecData::~CCMRAudioCodecData
+// -----------------------------------------------------------------------------
+//
+CCMRAudioCodecData::~CCMRAudioCodecData()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecData::GetCodecFourCCL
+// Returns the FourCC of the codec
+// -----------------------------------------------------------------------------
+//
+TFourCC CCMRAudioCodecData::GetCodecFourCCL() const
+    {
+    return iFourCC;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecData::BufferType
+// Returns the CCMRMediaSink/CCMRMediaBuffer compatible type of the codec buffer
+// -----------------------------------------------------------------------------
+//
+CCMRMediaBuffer::TBufferType CCMRAudioCodecData::BufferType() const
+    {
+    return iBufferType;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioCodecData::GetDecoderConfigInfoLC
+// Get the decoder configuration info == NULL by default, inherited classes may
+// provide real info if needed
+// -----------------------------------------------------------------------------
+//
+HBufC8* CCMRAudioCodecData::GetDecoderConfigInfoLC()
+    {
+    return NULL;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1041 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio input class for handling audio data and giving it to CCMRActiveOutput
+*
+*/
+
+
+// INCLUDES
+#include "CCMRAudioInput.h"
+#include "CCMRAudioInputSW.h"
+#include "CCMRAudioInputHW.h"
+#include "CCMRActiveOutput.h"
+#include "CCMRAudioCodecData.h"
+#include "CCMRFifo.h"
+#include "CCMRVideoHWParams.h"
+#include "CCMRConfigManager.h"
+#include <mmf/server/mmfaudioinput.h>
+#include <AudioInput.h>
+#include <AudioPreference.h>                // For MMF audio preference definitions.
+#include <mmf/common/mmfaudio.h>            // For KMMFEventCategoryAudioLoadingComplete
+
+// CONSTANTS
+// Initial number of buffers allocated
+const TInt KCMRNumAudioBuffers = 10;
+
+// MACROS
+#define AIASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CCMRAUDIOINPUT"), EInternalAssertionFailure))
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::~CCMRAudioInput
+// -----------------------------------------------------------------------------
+//
+CCMRAudioInput::~CCMRAudioInput()
+    {
+
+    if ( iInputEmpty )
+        {
+        delete iInputEmpty;
+        iInputEmpty = NULL;
+        }
+    if ( iInputFilled )
+        {
+        delete iInputFilled;
+        iInputFilled = NULL;
+        }
+    if ( iOutputFilled )
+        {
+        delete iOutputFilled;
+        iOutputFilled = NULL;
+        }
+    if ( iOutputEmptied )
+        {
+        delete iOutputEmptied;
+        iOutputEmptied = NULL;
+        }
+
+    if ( (!iSrcBufRef) && iDevSoundBuffer )
+        {
+        delete iDevSoundBuffer;
+        iDevSoundBuffer = NULL;
+        }
+    if ( iProcessingBuffer )
+        {
+        // we happen to have the last buffer still in process, must delete it now
+        delete iProcessingBuffer;
+        iProcessingBuffer = NULL;
+        }
+
+    if ( iDecConfigInfo )
+        {
+        delete iDecConfigInfo;
+        iDecConfigInfo = NULL;
+        // iOutputVideoBuffer is not used with decspecinfo
+        }
+
+    if ( iMediaSinkBuffer )
+        {
+        delete iMediaSinkBuffer;
+        iMediaSinkBuffer = NULL;
+        }
+
+    iOutputThreadHandle.Close();
+
+    if ( iMutexCreated )
+        {
+        iMutexObj.Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::ConstructL(CCMRActiveOutput* aOutput, TUint aThreadId, CCMRConfigManager* aConfig )
+    {
+    PRINT((_L("CCMRAudioInput::ConstructL() in") ));
+    iConfig = aConfig; // doesn't own
+    iPrioritySettings.iPriority = KAudioPriorityVideoRecording;
+    iPrioritySettings.iPref =  TMdaPriorityPreference( KAudioPrefVideoRecording );
+
+    // Create input fifos
+    // this fifo is for buffers that are available for storing data from MMFAudioInput/DevSound
+    iInputEmpty = CCMRFifo::NewL(KCMRNumAudioBuffers);
+    // this fifo is for buffers that are storing data from MMFAudioInput/DevSound
+    iInputFilled = CCMRFifo::NewL(KCMRNumAudioBuffers);
+    // this fifo is for buffers that contain encoded data and are waiting for sink to retrieve
+    iOutputFilled = CCMRFifo::NewL(KCMRNumAudioBuffers);
+    // this fifo is for buffers that sink has read and are available for reuse in iOutputFilled
+    iOutputEmptied = CCMRFifo::NewL(KCMRNumAudioBuffers);
+
+    iFirstTime = ETrue;
+    iFirstBufferRequested = EFalse;
+    iTimeStampWhenPaused = TTimeIntervalMicroSeconds(0);
+    User::LeaveIfError(iOutputThreadHandle.Open(aThreadId));
+    User::LeaveIfError(iMutexObj.CreateLocal());
+    iMutexCreated = ETrue;
+
+    iMediaSinkBuffer = new (ELeave) CCMRMediaBuffer();
+    iConsumer = aOutput;
+    iConsumer->RegisterSourceL( this );
+
+    PRINT((_L("CCMRAudioInput::ConstructL() out") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SetCodecL
+//
+// Set codec
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::SetCodecL( CCMRAudioCodecData* aCodecData )
+    {
+    PRINT((_L("CCMRAudioInput::SetCodecL() in")));
+    iCodecData = aCodecData;
+    PRINT((_L("CCMRAudioInput::SetCodecL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SourcePrimeL
+// Primes the source
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::SourcePrimeL()
+    {
+    PRINT((_L("CCMRAudioInput::SourcePrimeL()")));
+    iDevSoundBuffer = NULL;
+    iSendBufCount = 0;
+    iFirstTime = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SourceRecordL
+// Start recording
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::SourceRecordL()
+    {
+    PRINT((_L("CCMRAudioInput::SourceRecordL() in")));
+    ConfigDevSoundL();
+    iState = EStateRecording;
+    iSamplesUpdatedAfterStart = EFalse;
+    iFirstBufferRequested = EFalse;
+    PRINT((_L("CCMRAudioInput::SourceRecordL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SourcePauseL
+// Pause recording
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::SourcePauseL()
+    {
+    PRINT((_L("CCMRAudioInput::SourcePauseL(), calling iDataSource->SourceStopL")));
+    iState = EStateStopping;
+
+    // store the latest timestamp - must do it already here, since sending event may reset it and we should not touch it after reset
+  	MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+    CMMFDevSound* devSound = &audioInput->SoundDevice();
+    TInt sampleRate = iCodecData->GetSampleRate();
+
+	TBool firstPause = EFalse;
+	if (iTimeStampWhenPaused == 0)
+		{
+		firstPause = ETrue;
+		}
+
+    if ( sampleRate )
+        {
+        TTimeIntervalMicroSeconds currentTimeStamp;
+        currentTimeStamp = devSound->SamplesRecorded();
+        currentTimeStamp = currentTimeStamp.Int64() * 1000000;
+        currentTimeStamp = currentTimeStamp.Int64() / sampleRate;
+        iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + currentTimeStamp.Int64();
+        }
+    else
+        {
+        iTimeStampWhenPaused = 0;
+        }
+
+   	TInt initialDelay = 0;
+    // Add A/V sync constant to paused timestamp
+	if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+		{
+		PRINT((_L("CCMRAudioInput::SourcePauseL(), using ICM setting value for AVsync delay")));
+		iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (iConfig->VideoQualitySettings().iAVSyncResumeDelay*1000);
+		initialDelay = iConfig->VideoQualitySettings().iAVSyncStartDelay;
+		}
+	else
+		{
+		initialDelay = KCMRInitialVideoAudioTimeSyncDC;
+		if ( sampleRate <= KCMRPauseVideoAudioTimeSyncDC_LowSampleRateValue )
+		    {
+		    PRINT((_L("CCMRAudioInput::SourcePauseL(), using LowSampleRateValue")));
+		    iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (KCMRPauseVideoAudioTimeSyncDC_LowSampleRate*1000);
+		    }
+		else if ( sampleRate <= KCMRPauseVideoAudioTimeSyncDC_MidSampleRateValue )
+			{
+		    PRINT((_L("CCMRAudioInput::SourcePauseL(), using MidSampleRateValue")));
+		    iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (KCMRPauseVideoAudioTimeSyncDC_MidSampleRate*1000);
+			}
+		else
+		    {
+		    iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (KCMRPauseVideoAudioTimeSyncDC*1000);
+		    }
+		}
+
+    // Add startdelay if first pause.
+    if ( firstPause )
+	    {
+	    // only add start delay if we haven't been paused. Only add delay after first audio available
+		if ( initialDelay < 0 )
+			{
+			if ( iTimeStampWhenPaused > -(initialDelay*1000) )
+				{
+				iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (initialDelay*1000);
+				}
+			else
+				{
+				iTimeStampWhenPaused = 0;
+				}
+			}
+		else
+			{
+			iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (initialDelay*1000);
+			}
+	    }
+
+    // Stop audio.
+    PRINT((_L("CCMRAudioInput::SourceStopL() DevSound SourceStopL()")));
+    devSound->Stop();
+
+    if ( iOutputFilled->IsEmpty() )
+        {
+        PRINT((_L("CCMRAudioInput::SourcePauseL(), no data buffers queued so no chance to signal end of data; sending an event instead")));
+        TMMFEvent event (KMMFEventCategoryPlaybackComplete, KErrNone);
+    	iEventHandler.SendEventToClient(event);
+        }
+
+    PRINT((_L("CCMRAudioInput::SourcePauseL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SourceStopL
+// Stop playing (recording)
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::SourceStopL()
+    {
+    PRINT((_L("CCMRAudioInput::SourceStopL() in")));
+    if ( iState != EStateStopping )
+        {
+        // we came here without pause => there was an error, must stop source
+        PRINT((_L("CCMRAudioInput::SourceStopL() DevSound SourceStopL()")));
+        MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+        CMMFDevSound* devSound = &audioInput->SoundDevice();
+        devSound->Stop();
+        iFirstBufferRequested = EFalse;
+        }
+    // else data source was already stopped in pause
+    iState = EStateStopped;
+    PRINT((_L("CCMRAudioInput::SourceStopL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SetSourcePrioritySettings
+// Set priority settings to source
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::SetSourcePrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
+    {
+    iPrioritySettings = aPrioritySettings;
+    MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+    CMMFDevSound* devSound = &audioInput->SoundDevice();
+    devSound->SetPrioritySettings(aPrioritySettings);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SoundDevice
+// Get reference to DevSound from MMFAudioInput
+// -----------------------------------------------------------------------------
+//
+CMMFDevSound& CCMRAudioInput::SoundDevice()
+    {
+	MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+    return audioInput->SoundDevice();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::ResetTimeStamp
+//
+// Resets audio timestamp before new recording; can't be reset automatically
+// in stop/play since they are used also in pause/resume when the stamp should
+// not reset
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::ResetTimeStamp()
+    {
+    iTimeStampWhenPaused = TTimeIntervalMicroSeconds(0);
+    iNumFramesReceived = 0;
+    iDecConfigInfoChecked = EFalse;
+    iSamplesUpdatedAfterStart = EFalse;
+    iLatestTimeStamp = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SendEventToClient
+// Stop & send event (error) to client
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::SendEventToClient(const TMMFEvent& aEvent)
+	{
+    PRINT((_L("CCMRAudioInput::SendEventToClient() in, event & error, %x & %d"), aEvent.iEventType, aEvent.iErrorCode));
+    TRAPD(error,SourceStopL()); // errors can be ignored, we are already reporting an error here
+    if (error != KErrNone)
+        {
+        PRINT((_L("CCMRAudioInput::SendEventToClient() stop error: %d"), error));
+        }
+	iEventHandler.SendEventToClient(aEvent);
+    PRINT((_L("CCMRAudioInput::SendEventToClient() out")));
+	}
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::NewBufferL
+// Inform sink about new coded buffer, and store it in iOutputCoded unless there
+// aren't any older buffer under processing
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::NewBufferL(CMMFBuffer* aBuffer)
+    {
+    // enter restricted area
+    iMutexObj.Wait();
+
+    CMMFBuffer* storeBuffer = NULL;
+    storeBuffer = aBuffer;
+
+    TInt bufLength = storeBuffer->BufferSize();
+    TInt frameLength = 1;   // set to 1 since nonzero needed as the initial value in the while-loop below
+    TUint8* data = const_cast<TUint8*>((static_cast<CMMFDataBuffer*>(storeBuffer))->Data().Ptr());
+    while ( (bufLength > 0) && (frameLength > 0) )
+        {
+        frameLength = iCodecData->FrameLength( data, bufLength );
+        bufLength -= frameLength;
+        data += frameLength;
+        iNumFramesReceived++;
+        iNumFramesWaiting++;
+        }
+
+    TInt error = KErrNone;
+    if ( iProcessingBuffer )
+        {
+        // there is one under processing, store this one to fifo
+        TRAP(error, iOutputFilled->PutL( reinterpret_cast<TAny*>(storeBuffer) ));
+        PRINT((_L("CCMRAudioInput::NewBufferL() added %x to fifo. Fifo size %d"), storeBuffer, iOutputFilled->NumberOfItems() ));
+        }
+    else
+        {
+        // take it into use immediately
+        iProcessingBuffer = static_cast<CMMFDataBuffer*>(storeBuffer);
+        iProcessingIndex = 0;
+        iSrcNumUnreadBytes = storeBuffer->BufferSize();
+        PRINT((_L("CCMRAudioInput::NewBufferL() taken buffer into iProcessingBuffer %x, size %d"), storeBuffer, iSrcNumUnreadBytes ));
+        }
+
+    // signal to sink
+    if ( ( error == KErrNone ) && iSinkRequestStatus  )
+        {
+        PRINT((_L("CCMRAudioInput::EmptyBufferL() RequestComplete")));
+        iOutputThreadHandle.RequestComplete( iSinkRequestStatus, KErrNone );
+        }
+    else
+        {
+        // else a new request has not been issued yet; this buffer will be handled jointly with previous ones
+        PRINT((_L("CCMRAudioInput::NewBufferL() skipping RequestComplete")));
+        }
+
+    // leave restricted area
+    iMutexObj.Signal();
+
+    if ( error != KErrNone )
+        {
+        // leave postponed here to get out of mutex
+        PRINT((_L("CCMRAudioInput::NewBufferL() leave with error code %d"), error));
+        User::Leave( error );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::FillBufferL
+// Ask new buffers from devsound.
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::FillBufferL()
+    {
+    PRINT((_L("CCMRAudioInput::FillBufferL() in")));
+    //this is a one-shot "prime" funtion for MMFDevSound as first buffer is uninitialised
+    MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+    CMMFDevSound* devSound = &audioInput->SoundDevice();
+
+    if (!iFirstBufferRequested)
+        {
+        PRINT((_L("CCMRAudioInput::FillBufferL() DevSound RecordInitL")));
+        devSound->RecordInitL();
+        iFirstBufferRequested = ETrue;
+        PRINT((_L("CCMRAudioInput::FillBufferL() out")));
+        return;
+        }
+    PRINT((_L("CCMRAudioInput::FillBufferL() DevSound RecordData")));
+    devSound->RecordData();
+    PRINT((_L("CCMRAudioInput::FillBufferL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::RequestNewData
+// Output active object is ready to accept new data
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::RequestNewData(TRequestStatus& aStatus)
+    {
+	PRINT((_L("CCMRAudioInput::RequestNewData() - START - aStatus: 0x%08x, iSinkRequestStatus: 0x%08x"), &aStatus, iSinkRequestStatus ));
+    // enter restricted area
+    iMutexObj.Wait();
+
+    iSinkRequestStatus = &aStatus;
+    aStatus = KRequestPending;
+
+    // leave restricted area
+    iMutexObj.Signal();
+	PRINT((_L("CCMRAudioInput::RequestNewData() - END - aStatus: 0x%08x, iSinkRequestStatus: 0x%08x"), &aStatus, iSinkRequestStatus ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::RequestNewDataCancel
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::RequestNewDataCancel(TRequestStatus& aStatus)
+    {
+	PRINT((_L("CCMRAudioInput::RequestNewDataCancel() - START - aStatus: 0x%08x, iSinkRequestStatus: 0x%08x"), &aStatus, iSinkRequestStatus ));
+
+    // enter restricted area
+    iMutexObj.Wait();
+
+	if ( &aStatus == iSinkRequestStatus )
+		{
+		iOutputThreadHandle.RequestComplete( iSinkRequestStatus, KErrCancel );
+		}
+
+    // leave restricted area
+    iMutexObj.Signal();
+
+	PRINT((_L("CCMRAudioInput::RequestNewDataCancel() - END - aStatus: 0x%08x, iSinkRequestStatus: 0x%08x"), &aStatus, iSinkRequestStatus ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::GetNextBuffer
+// Output active object takes the next output buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCMRMediaBuffer* CCMRAudioInput::GetNextBuffer()
+    {
+    PRINT((_L("CCMRAudioInput::GetNextBuffer() in")));
+
+    if ( (!iDecConfigInfoChecked) && (iState == EStateRecording)  )
+        {
+        // check if we have to provide decoder config info first
+
+        iDecConfigInfoChecked = ETrue;
+
+        TRAPD(err,
+            {
+            iDecConfigInfo = iCodecData->GetDecoderConfigInfoLC();
+            if ( iDecConfigInfo != NULL )
+                {
+                // must pop, otherwise TRAPD will panic
+                CleanupStack::Pop(iDecConfigInfo);
+                }
+            }
+            );
+        if ( err != KErrNone )
+            {
+            return NULL;
+            }
+        if ( iDecConfigInfo )
+            {
+            PRINT((_L("CCMRAudioInput::GetNextBuffer() providing decoder config info first")));
+            const TUint8* data = iDecConfigInfo->Ptr();
+            TInt length = iDecConfigInfo->Length();
+            PRINT((_L("CCMRAudioInput::GetNextBuffer() length of the info %d"), length));
+
+            iMediaSinkBuffer->Set( TPtrC8(data,length),
+                CCMRMediaBuffer::EAudioDecSpecInfo,
+                length,
+                EFalse,
+                TTimeIntervalMicroSeconds(0) );
+
+            // can handle only 1 output buffer at a time
+            iOutputBufferInUse = ETrue;
+
+            PRINT((_L("CCMRAudioInput::GetNextBuffer() with DecConfigInfo out")));
+            return iMediaSinkBuffer;
+            }
+        // else the codec doesn't provide it
+        }
+
+
+    // enter restricted area
+    iMutexObj.Wait();
+
+    // take it from fifo
+    if ( iProcessingBuffer && (!iOutputBufferInUse) )
+        {
+
+        // check frame length
+
+        TUint8* data = const_cast<TUint8*>(iProcessingBuffer->Data().Ptr());
+        data += iProcessingIndex;
+
+        AIASSERT( iCodecData );
+
+        TInt frameLength = iCodecData->FrameLength( data, iProcessingBuffer->BufferSize() );
+
+        // associate the next frame from the buffer to mediabuffer
+        iMediaSinkBuffer->Set( TPtrC8(data,frameLength),
+            iCodecData->BufferType(),
+            frameLength,
+            EFalse,
+            TTimeIntervalMicroSeconds((iNumFramesReceived - iNumFramesWaiting)*iCodecData->GetFrameDurationUs()) );
+
+        iNumFramesWaiting--;
+
+        PRINT((_L("CCMRAudioInput::GetNextBuffer() send buf of length %d"),frameLength));
+
+        iProcessingIndex += frameLength;
+        iSrcNumUnreadBytes -= frameLength;
+
+        // leave restricted area
+        iMutexObj.Signal();
+
+        // can handle only 1 output buffer at a time
+        iOutputBufferInUse = ETrue;
+
+        PRINT((_L("CCMRAudioInput::GetNextBuffer() out")));
+        return iMediaSinkBuffer;
+        }
+    else
+        {
+        // leave restricted area
+        iMutexObj.Signal();
+
+        PRINT((_L("CCMRAudioInput::GetNextBuffer() out (no data)")));
+        return NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::NumBuffersWaiting
+// Return the number of buffers in the source
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAudioInput::NumBuffersWaiting()
+    {
+    return iNumFramesWaiting;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::LatestTimeStampL
+// Return the latest time stamp from the input stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::LatestTimeStampL(TTimeIntervalMicroSeconds& aTimeStamp) const
+    {
+  	// estimate the time since the previous call to devsound's samplesrecorded
+  	if ( iSamplesUpdatedAfterStart )
+  	    {
+        TTime current;
+        current.UniversalTime();
+        aTimeStamp = iLatestTimeStamp.Int64() + current.MicroSecondsFrom(iTimeWhenSamplesUpdated).Int64();
+  	    }
+    else
+        {
+        aTimeStamp = iLatestTimeStamp.Int64();
+        }
+
+    PRINT((_L("CCMRAudioInput::LatestTimeStampL() timestamp %d"), I64INT(aTimeStamp.Int64()) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::DurationL
+// Return the duration of the recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::DurationL(TTimeIntervalMicroSeconds& aDuration) const
+    {
+    aDuration = TTimeIntervalMicroSeconds(iNumFramesReceived*iCodecData->GetFrameDurationUs());
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::ReturnBuffer
+// Output active object returns an emptied buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::ReturnBuffer(CCMRMediaBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRAudioInput::ReturnBuffer() in")));
+    // save it for reuse
+    iMediaSinkBuffer = aBuffer;
+    iOutputBufferInUse = EFalse;
+    if ( iDecConfigInfo )
+        {
+        delete iDecConfigInfo;
+        iDecConfigInfo = NULL;
+        // iOutputVideoBuffer is not used with decspecinfo
+        }
+
+    if ( !iProcessingBuffer )
+        {
+        // we must have stopped due to pausetimer in audiothreadproxysession; no need to save the buffer, it was already saved
+        return;
+        }
+
+    if ( iProcessingBuffer->LastBuffer() )
+        {
+        PRINT((_L("CCMRAudioInput::ReturnBuffer(), last data buffer given to sink; sending an event to inform completion")));
+        TMMFEvent event (KMMFEventCategoryPlaybackComplete, KErrNone);
+    	iEventHandler.SendEventToClient(event);
+        }
+
+    // enter restricted area
+    iMutexObj.Wait();
+    TInt err = KErrNone;
+    if ( iSrcNumUnreadBytes <= 0 )
+        {
+        TRAP(err,iOutputEmptied->PutL( reinterpret_cast<TAny*>(iProcessingBuffer)));
+        if ( err == KErrNone )
+            {
+            PRINT((_L("CCMRAudioInput::ReturnBuffer() save buffer %x to iOutputEmptied"),iProcessingBuffer));
+            // reset
+            iProcessingIndex = 0;
+            iProcessingBuffer = NULL;
+            if (iOutputFilled && !iOutputFilled->IsEmpty())
+                {
+                /* take the next into processing */
+                iProcessingBuffer = reinterpret_cast<CMMFDataBuffer*>(iOutputFilled->Get());
+                iProcessingIndex = 0;
+                iSrcNumUnreadBytes = iProcessingBuffer->BufferSize();
+                PRINT((_L("CCMRAudioInput::ReturnBuffer() started processing a new buffer %x from iOutputFilled"),iProcessingBuffer));
+                }
+            }
+        else
+            {
+            // Can't store in fifo; however, aBuffer was stored to iOutputBuffer already, and iProcessingBuffer is a member
+            // signal the error after got out of mutex
+            PRINT((_L("CCMRAudioInput::ReturnBuffer() putting buffer to fifo failed, deallocate the buffer")));
+            delete iProcessingBuffer;
+            iProcessingBuffer = NULL;
+            }
+        }
+    // leave restricted area
+    iMutexObj.Signal();
+
+    if ( err != KErrNone )
+        {
+        // leave postponed here to get out of mutex
+        PRINT((_L("CCMRAudioInput::ReturnBuffer() report GeneralError event with error code %d"), err));
+        TMMFEvent event(KMMFEventCategoryVideoRecorderGeneralError, err);
+        iEventHandler.SendEventToClient(event);
+        }
+
+    PRINT((_L("CCMRAudioInput::ReturnBuffer() out")));
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::ConfigDevSoundL
+// Check DevSound capabilities before configuring. If sampling rate is not
+// supported by DevSound, select the next highest sampling rate supported.
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::ConfigDevSoundL()
+	{
+    PRINT((_L("CCMRAudioInput::ConfigDevSoundL() in")));
+  	MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+    CMMFDevSound* devSound = &audioInput->SoundDevice();
+
+	// Set Audio Routing API to use default mic only.
+	// Create CAudioInput (errors trapped as this is optional feature from adaptation).
+	PRINT((_L("CCMRAudioInput::ConfigDevSoundL(), Audio Routing in")));
+	CAudioInput* audioRoutingInput = NULL;
+	TRAPD(audioRoutingError, audioRoutingInput = CAudioInput::NewL( *devSound ));
+	CleanupStack::PushL(audioRoutingInput);
+	if ( audioRoutingError == KErrNone )
+		{
+		PRINT((_L("CCMRAudioInput::ConfigDevSoundL(), Audio Routing API created")));
+		RArray<CAudioInput::TAudioInputPreference> inputArray;
+		if ( inputArray.Append( CAudioInput::EDefaultMic ) == KErrNone )
+			{
+			PRINT((_L("CCMRAudioInput::ConfigDevSoundL(), Audio Routing API input array set to default mic.")));
+			// Set Audio Input
+			if ( audioRoutingInput )
+				{
+				TRAP(audioRoutingError, audioRoutingInput->SetAudioInputL( inputArray.Array( ) ));
+				if ( audioRoutingError )
+					{
+					// if KErrNotSupported the devsound implementation probably doesn't support custom interface.
+					PRINT((_L("CCMRAudioInput::ConfigDevSoundL(), Audio Routing API SetAudioInputL failed: %d"), audioRoutingError));
+					}
+				else
+					{
+					PRINT((_L("CCMRAudioInput::ConfigDevSoundL(), Audio Routing API set to default mic.")));
+					}
+				}
+			}
+		else
+			{
+			PRINT((_L("CCMRAudioInput::ConfigDevSoundL(), Audio Routing API input array set to default mic failed.")));
+			}
+		inputArray.Close();
+		PRINT((_L("CCMRAudioInput::ConfigDevSoundL(), Audio Routing out")));
+		}
+	CleanupStack::PopAndDestroy(audioRoutingInput);
+
+	// Query DevSound capabilities and Try to use DevSound sample rate and
+	// mono/stereo capability
+	TMMFCapabilities devSoundCaps = devSound->Capabilities();
+	// get current config
+	TMMFCapabilities devSoundConfig = devSound->Config();
+
+	// Default PCM16
+	devSoundConfig.iEncoding = EMMFSoundEncoding16BitPCM;
+
+	// 1 = Monophonic and 2 == Stereo
+    TInt channels = iCodecData->GetNumChannels();
+    if ((channels == 2) && (devSoundCaps.iChannels & EMMFStereo))
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() stereo recording")));
+        devSoundConfig.iChannels = channels;
+        }
+	else if (devSoundCaps.iChannels & EMMFMono)
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() mono recording")));
+		devSoundConfig.iChannels = 1;
+        }
+    else
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() unsupported channel configuration requested")));
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iCodecData->GetNumChannels() != devSoundConfig.iChannels )
+	    {
+		iCodecData->SetChannelModeL(devSoundCaps.iChannels);
+    	}
+
+	// Check for std sample rates.
+    TInt sampleRate = iCodecData->GetSampleRate();
+    PRINT((_L("CCMRAudioInput::ConfigDevSoundL() got samplerate: %d from codec"), sampleRate));
+
+    // At the moment only 8 and 16 kHz is supported. If we'll get codecs with other sampling rates, this must be modified
+	if ((sampleRate == 8000) && (devSoundCaps.iRate & EMMFSampleRate8000Hz))
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() using sample rate 8000")));
+		devSoundConfig.iRate = EMMFSampleRate8000Hz;
+        }
+	else if ((sampleRate == 16000) && (devSoundCaps.iRate & EMMFSampleRate16000Hz))
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() using sample rate 16000")));
+		devSoundConfig.iRate = EMMFSampleRate16000Hz;
+        }
+	else if ((sampleRate == 24000) && (devSoundCaps.iRate & EMMFSampleRate24000Hz))
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() using sample rate 24000")));
+		devSoundConfig.iRate = EMMFSampleRate24000Hz;
+        }
+	else if ((sampleRate == 32000) && (devSoundCaps.iRate & EMMFSampleRate32000Hz))
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() using sample rate 32000")));
+		devSoundConfig.iRate = EMMFSampleRate32000Hz;
+        }
+	else if ((sampleRate == 48000) && (devSoundCaps.iRate & EMMFSampleRate48000Hz))
+        {
+        PRINT((_L("CCMRAudioInput::ConfigDevSoundL() using sample rate 48000")));
+		devSoundConfig.iRate = EMMFSampleRate48000Hz;
+        }
+    else
+		{
+        // try to set the codec to 16k samplerate.
+        if ( (sampleRate >= 16000) && (devSoundCaps.iRate & EMMFSampleRate16000Hz) )
+            {
+            // this one leaves if the rate is not supported
+            PRINT((_L("CCMRAudioInput::ConfigDevSoundL() unsupported audio samplerate - trying 16k")));
+            iCodecData->SetBitRateL( 32000 );
+            iCodecData->SetSampleRateL( 16000 );
+    		devSoundConfig.iRate = EMMFSampleRate16000Hz;
+            }
+        else if ( devSoundCaps.iRate & EMMFSampleRate8000Hz)
+            {
+            // this one leaves if the rate is not supported
+            PRINT((_L("CCMRAudioInput::ConfigDevSoundL() unsupported audio samplerate - trying 8k")));
+            iCodecData->SetBitRateL( 16000 );
+            iCodecData->SetSampleRateL( 8000 );
+    		devSoundConfig.iRate = EMMFSampleRate8000Hz;
+            }
+        else
+            {
+            PRINT((_L("CCMRAudioInput::ConfigDevSoundL() unsupported sample rate %d"), sampleRate));
+    		User::Leave( KErrNotSupported );
+            }
+		}
+	devSound->SetConfigL(devSoundConfig);
+    PRINT((_L("CCMRAudioInput::ConfigDevSoundL() out")));
+	}
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::UpdateTimeL
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::UpdateTimeL()
+    {
+    PRINT((_L("CCMRAudioInput::UpdateTimeL() in")));
+    MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+    CMMFDevSound* devSound = &audioInput->SoundDevice();
+    TInt sampleRate = iCodecData->GetSampleRate();
+
+    if ( sampleRate )
+        {
+        TInt64 samples = devSound->SamplesRecorded();
+        PRINT((_L("CCMRAudioInput::UpdateTimeL() samples recorded %d"),I64INT(samples)));
+
+        samples = samples * 1000000;
+        samples = samples / sampleRate;
+        iLatestTimeStamp = samples + iTimeStampWhenPaused.Int64();
+        }
+    else
+        {
+        iLatestTimeStamp = 0;
+        }
+
+    // only add start delay if we haven't been paused. Only add delay after first audio available
+	if ( (iTimeStampWhenPaused == 0) && (iLatestTimeStamp != 0) )
+		{
+		TInt initialDelay = 0;
+	    // Add A/V sync constant to timestamp
+		if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+			{
+			PRINT((_L("CCMRAudioInput::UpdateTimeL(), using ICM setting value for AVsync delay")));
+			initialDelay = iConfig->VideoQualitySettings().iAVSyncStartDelay;
+			}
+		else
+			{
+			PRINT((_L("CCMRAudioInput::UpdateTimeL(), using old setting value for AVsync delay")));
+			initialDelay = KCMRInitialVideoAudioTimeSyncDC;
+			}
+
+		if ( initialDelay < 0 )
+			{
+			if ( iLatestTimeStamp > -( initialDelay*1000) )
+				{
+				iLatestTimeStamp = iLatestTimeStamp.Int64() + ( initialDelay*1000 );
+				}
+			else
+				{
+				iLatestTimeStamp = 0;
+				}
+			}
+		else
+			{
+			iLatestTimeStamp = iLatestTimeStamp.Int64() + ( initialDelay*1000 );
+			}
+		}
+
+	if ( iLatestTimeStamp != 0 )
+		{
+	    iTimeWhenSamplesUpdated.UniversalTime();
+	    iSamplesUpdatedAfterStart = ETrue;
+		}
+    PRINT((_L("CCMRAudioInput::UpdateTimeL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::InitializeComplete
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::InitializeComplete(TInt aError)
+    {
+    PRINT((_L("CCMRAudioInput::InitializeComplete() in, error:%d"), aError));
+    TInt error = aError;
+    if ( error == KErrNone )
+        {
+        MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+        PRINT((_L("CCMRAudioInput::InitializeComplete() SetPrioritySettings")));
+        audioInput->SoundDevice().SetPrioritySettings(iPrioritySettings);
+        PRINT((_L("CCMRAudioInput::InitializeComplete() ConfigDevSoundL")));
+        TRAP(error, ConfigDevSoundL());
+        if (error == KErrNone)
+            {
+            PRINT((_L("CCMRAudioInput::InitializeComplete() AllocateInputBuffersL")));
+            TRAP(error, AllocateInputBuffersL());
+            }
+        else
+            {
+            PRINT((_L("CCMRAudioInput::InitializeComplete() ConfigDevSoundL, error=%d"), error));
+            }
+        }
+    PRINT((_L("CCMRAudioInput::InitializeComplete() SendEventToClient KMMFEventCategoryAudioLoadingComplete, error: %d"), error));
+    TMMFEvent event(KMMFEventCategoryAudioLoadingComplete, error);
+    iEventHandler.SendEventToClient(event);
+    PRINT((_L("CCMRAudioInput::InitializeComplete() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::ToneFinished
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::ToneFinished(TInt aError)
+    {
+    PRINT((_L("CCMRAudioInput::ToneFinished(), error:%d"), aError));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::BufferToBeFilled
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
+    {
+    PRINT((_L("CCMRAudioInput::BufferToBeFilled()")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::PlayError
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::PlayError(TInt aError)
+    {
+    PRINT((_L("CCMRAudioInput::PlayError(), error:%d"), aError));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::BufferToBeEmptied
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::BufferToBeEmptied(CMMFBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRAudioInput::BufferToBeEmptied()")));
+    TInt error = KErrNone;
+    TRAP(error, BufferFilledL(aBuffer));
+    if (error != KErrNone)
+        {
+        TMMFEvent event (KMMFEventCategoryPlaybackComplete, error);
+        SendEventToClient( event );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::RecordError
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::RecordError(TInt aError)
+    {
+    PRINT((_L("CCMRAudioInput::RecordError(), error=%d"), aError));
+    TMMFEvent event (KMMFEventCategoryPlaybackComplete, aError);
+    iEventHandler.SendEventToClient(event);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::ConvertError
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::ConvertError(TInt aError)
+    {
+    PRINT((_L("CCMRAudioInput::ConvertError(), error:%d"), aError));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::DeviceMessage
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioInput::DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/)
+    {
+    PRINT((_L("CCMRAudioInput::DeviceMessage()")));
+    }
+
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioInputHW.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,597 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio input class to handle compressed audio input from codec
+*                HW devices located under DevSound
+*
+*/
+
+
+// INCLUDES
+#include "CCMRAudioInput.h"
+#include "CCMRAudioInputHW.h"
+#include "CCMRActiveOutput.h"
+#include "CCMRAudioCodecData.h"
+#include "CCMRFifo.h"
+#include <mmf/server/mmfaudioinput.h>
+
+// CONSTANTS
+// Initial number of buffers allocated
+const TInt KCMRNumPassAudioBuffers = 2;     // # of buffers for passthrough mode
+
+// MACROS
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::NewL
+// -----------------------------------------------------------------------------
+//
+CCMRAudioInput* CCMRHWAudioInput::NewL(MDataSource* aRealSource, CCMRActiveOutput* aOutput, TUint aThreadId, MAsyncEventHandler& aEventHandler, CCMRConfigManager* aConfig )
+    {
+    PRINT((_L("CCMRHWAudioInput::NewL() MMFAudioInput 0x%x"), aRealSource ));
+    CCMRHWAudioInput* self = new(ELeave) CCMRHWAudioInput(aRealSource, aEventHandler);
+    CleanupStack::PushL(self);
+    self->ConstructL(aOutput, aThreadId, aConfig );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::~CCMRAudioInput
+// -----------------------------------------------------------------------------
+//
+CCMRHWAudioInput::~CCMRHWAudioInput()
+    {
+    // allocated bufs can be either in iInputEmpty, iInputFilled, iOutputFilled, or iOutputEmptied
+    CMMFDataBuffer* tmp;
+    TInt i = 0;
+    if ( iInputEmpty )
+        {
+        while ( !iInputEmpty->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iInputEmpty->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRHWAudioInput::~CCMRHWAudioInput() deleted %d bufs from iInputEmpty queue"), i ));
+        }
+    i = 0;
+    if ( iInputFilled )
+        {
+        while ( !iInputFilled->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iInputFilled->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRHWAudioInput::~CCMRHWAudioInput() deleted %d bufs from iInputFilled queue"), i ));
+        }
+    i = 0;
+    if ( iOutputFilled )
+        {
+        while ( !iOutputFilled->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputFilled->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRHWAudioInput::~CCMRHWAudioInput() deleted %d bufs from iOutputFilled queue"), i ));
+        }
+    i = 0;
+    if ( iOutputEmptied )
+        {
+        while ( !iOutputEmptied->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputEmptied->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRHWAudioInput::~CCMRHWAudioInput() deleted %d bufs from iOutputEmptied queue"), i ));
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::ConstructL(CCMRActiveOutput* aOutput, TUint aThreadId, CCMRConfigManager* aConfig )
+    {
+    PRINT((_L("CCMRHWAudioInput::ConstructL() in") ));
+
+    CCMRAudioInput::ConstructL(aOutput, aThreadId, aConfig );
+    CActiveScheduler::Add( this );
+
+    PRINT((_L("CCMRHWAudioInput::ConstructL() out") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::SourceRecordL
+// Start recording
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::SourceRecordL()
+    {
+    CCMRAudioInput::SourceRecordL();
+
+    FillBufferL( NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::SourceStopL
+// Stops recording
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::SourceStopL()
+    {
+    PRINT((_L("CCMRHWAudioInput::SourceStopL() in")));
+    // stop also sending our data; please remember that we are paused first also in stop => all data should have been flushed already when coming here
+    Cancel();
+
+    if ( iState != EStateStopped )
+        {
+        CCMRAudioInput::SourceStopL();
+
+        PRINT((_L("CCMRHWAudioInput::SourceStopL() start moving buffers from full to empty queue")));
+        // this is a real stop, no need to flush buffers to sink; that was done in pause
+        TInt i = 0;
+
+        // move all buffers from all fifos to iInputEmpty
+
+
+        CMMFDataBuffer* tmp;
+        while ( !iInputFilled->IsEmpty() )
+            {
+            // move bufs from filled to empty
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iInputFilled->Get());
+            tmp->SetLastBuffer( EFalse );
+            tmp->Data().SetLength(0);
+            CleanupStack::PushL( tmp );
+            iInputEmpty->PutL(reinterpret_cast<TAny*>(tmp) );
+            CleanupStack::Pop( tmp );
+            i++;
+            }
+        PRINT((_L("CCMRHWAudioInput::SourceStopL() moved %d bufs from iInputFilled to iInputEmpty queue"), i ));
+
+        // iOutput-fifos are being handled by output thread also, mutexes are needed
+
+        // enter restricted area
+        iMutexObj.Wait();
+        TInt error = KErrNone;
+        i = 0;
+        while ( (!iOutputFilled->IsEmpty()) && (error == KErrNone) )
+            {
+            // move bufs from filled to empty
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputFilled->Get());
+            tmp->SetLastBuffer( EFalse );
+            tmp->Data().SetLength(0);
+            CleanupStack::PushL( tmp );
+            TRAP(error, iInputEmpty->PutL(reinterpret_cast<TAny*>(tmp) ));
+            CleanupStack::Pop( tmp );
+            i++;
+            }
+        PRINT((_L("CCMRHWAudioInput::SourceStopL() moved %d bufs from iOutputFilled to iInputEmpty queue"), i ));
+
+        i = 0;
+        while ( (!iOutputEmptied->IsEmpty()) && (error == KErrNone) )
+            {
+            // move bufs from filled to empty
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputEmptied->Get());
+            tmp->SetLastBuffer( EFalse );
+            tmp->Data().SetLength(0);
+            CleanupStack::PushL( tmp );
+            TRAP(error,iInputEmpty->PutL(reinterpret_cast<TAny*>(tmp) ));
+            CleanupStack::Pop( tmp );
+            i++;
+            }
+        PRINT((_L("CCMRHWAudioInput::SourceStopL() moved %d bufs from iOutputEmptied to iInputEmpty queue"), i ));
+
+        // move also iProcessingBuffer
+        if ( (iProcessingBuffer) && ( error == KErrNone) )
+            {
+            tmp = iProcessingBuffer;
+            iProcessingBuffer = NULL;
+            tmp->SetLastBuffer( EFalse );
+            tmp->Data().SetLength(0);
+            TRAP(error,iInputEmpty->PutL(reinterpret_cast<TAny*>(tmp) ));
+            PRINT((_L("CCMRHWAudioInput::SourceStopL() moved iProcessingBuffer to iInputEmpty queue")));
+            }
+
+        iNumFramesWaiting = 0;
+
+        // leave restricted area
+        iMutexObj.Signal();
+
+        if ( error != KErrNone )
+            {
+            // leave postponed here to get out of mutex
+            PRINT((_L("CCMRHWAudioInput::SourceStopL() leave with error code %d"), error));
+            User::Leave( error );
+            }
+        }
+    PRINT((_L("CCMRHWAudioInput::SourceStopL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::SetCodecL
+// Set codec
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::SetCodecL( CCMRAudioCodecData* aCodecData )
+    {
+    PRINT((_L("CCMRHWAudioInput::SetCodecL() in")));
+
+    CCMRAudioInput::SetCodecL( aCodecData );
+
+    // passing the codec-FourCC tells DevSound to create the hardware device
+	MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+	audioInput->SoundDevice().InitializeL(*this, aCodecData->GetCodecFourCCL(), EMMFStateRecording);
+    PRINT((_L("CCMRHWAudioInput::SetCodecL() DevSound initializing - waiting for InitializeComplete.")));
+    PRINT((_L("CCMRHWAudioInput::SetCodecL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::AllocateInputBuffersL
+// Allocated input buffers.
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::AllocateInputBuffersL()
+    {
+    PRINT((_L("CCMRHWAudioInput::AllocateInputBuffersL() in")));
+    // allocate buffers for coded data
+    iInputBufferSize = iCodecData->MaxBufferLength();
+    TInt i = 0;
+    CMMFDataBuffer* tmp;
+    TInt numBufs = KCMRNumPassAudioBuffers;
+    while ( !iInputEmpty->IsEmpty() )
+        {
+        tmp = reinterpret_cast<CMMFDataBuffer*>(iInputEmpty->Get());
+        delete tmp;
+        tmp = NULL;
+        i++;
+        }
+    PRINT((_L("CCMRHWAudioInput::AllocateInputBuffersL() deleted %d bufs from iOutputEmptied queue"), i ));
+
+    for ( i = 0; i < numBufs; i++ )
+        {
+        tmp = CMMFDataBuffer::NewL(iInputBufferSize);
+        CleanupStack::PushL( tmp );
+        iInputEmpty->PutL( reinterpret_cast<TAny*>(tmp) );
+        CleanupStack::Pop( tmp );
+        }
+    PRINT((_L("CCMRHWAudioInput::AllocateInputBuffersL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::BufferFilledL
+// Catches the call from MDataSource when it has filled the buffer and copies
+// the data to internal buffers and returns the buffer back to MDataSource so
+// that it can continue filling it with new data
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::BufferFilledL(CMMFBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRHWAudioInput::BufferFilledL() in") ));
+
+    // copy the src buffer to internal buffers
+
+    CMMFDataBuffer* dBuffer = static_cast<CMMFDataBuffer*>(aBuffer);
+
+    // determine the number of bytes to copy,
+    // abs max is the KCMRMaxSplittedAudioBufferSize unless the buffer
+    // has less data
+    TUint length = dBuffer->BufferSize();
+
+    if ( length > 0 )
+        {
+        // take empty buffer
+        CMMFDataBuffer* tmp = NULL;
+        if ( iInputEmpty->IsEmpty() )
+            {
+            //out of buffers!! Create a new buffer
+            PRINT((_L("CCMRHWAudioInput::BufferFilledL(), out of buffers, create a new") ));
+            // determine the size
+            if ( length > iInputBufferSize )
+                {
+                // we need to increase iInputBufferSize
+                PRINT((_L("CCMRHWAudioInput::BufferFilledL(), increase iInputBufferSize to %d"), length ));
+                iInputBufferSize = length;
+                }
+
+            TRAPD(err, (tmp = CMMFDataBuffer::NewL(iInputBufferSize)));
+            PRINT((_L("CCMRHWAudioInput::BufferFilledL(), created a new") ));
+            if ( err != KErrNone )
+                {
+                PRINT((_L("CCMRHWAudioInput::BufferFilledL(), allocation failed, error %d"), err));
+                // allocation failed
+
+                // send the given buffer back
+                CCMRAudioInput::FillBufferL();
+
+                // stop & send event to client
+                TMMFEvent event( KMMFEventCategoryPlaybackComplete, err);
+                SendEventToClient(event);
+                return;
+                }
+            }
+        else
+            {
+            // try to use an older buffer from the queue
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iInputEmpty->Get());
+            if ( static_cast<TInt>(length) > tmp->Data().MaxLength() )
+                {
+                PRINT((_L("CCMRHWAudioInput::BufferFilledL(), too small buffer, create a new") ));
+                iInputBufferSize = length;
+                delete tmp;
+                TRAPD(err, (tmp = CMMFDataBuffer::NewL(iInputBufferSize)));
+                if ( err != KErrNone )
+                    {
+                    PRINT((_L("CCMRHWAudioInput::BufferFilledL(), allocation failed, error %d"), err));
+                    // allocation failed
+
+                    // send the given buffer back
+                    CCMRAudioInput::FillBufferL();
+
+                    // stop & send event to client
+                    TMMFEvent event( KMMFEventCategoryPlaybackComplete, err);
+                    SendEventToClient(event);
+                    return;
+                    }
+                }
+            }
+        CleanupStack::PushL(tmp);
+
+        TPtr8 tmpPtr(static_cast<TPtr8&>(tmp->Data()));
+
+        // copy data
+        tmpPtr.Copy( (dBuffer->Data().Ptr()), length );
+
+        tmp->Data().SetLength( length );
+        PRINT((_L("CCMRHWAudioInput::BufferFilledL() copied %d"), length ));
+
+        iNumBytesStored += length;
+
+        if ( dBuffer->LastBuffer() )
+            {
+            PRINT((_L("CCMRHWAudioInput::BufferFilledL(), last buffer set") ));
+            tmp->SetLastBuffer( ETrue );
+            iState = EStateStopping;
+            }
+        // copy the timestamp
+        tmp->SetTimeToPlay( aBuffer->TimeToPlay() );
+
+        // save filled buffer to iInputFilled
+        iInputFilled->PutL( reinterpret_cast<TAny*>(tmp) );
+        CleanupStack::Pop(tmp);
+
+        if ( !IsActive() )
+            {
+            SetActive();
+            TRequestStatus* tmpStatus = &iStatus;
+            User::RequestComplete(tmpStatus, KErrNone);
+            }
+        }
+    else
+        {
+        // empty buffer received
+        if ( dBuffer->LastBuffer() )
+            {
+            PRINT((_L("CCMRHWAudioInput::BufferFilledL(), last buffer set") ));
+            iState = EStateLastReceived;
+            }
+        }
+
+
+#if (defined (__WINS__) || defined (__WINSCW__) )
+    // save the buffer handle, to be returned to source when the first splitted buffer has been encoded
+    iDevSoundBuffer = aBuffer;
+#else
+    // reset buf information
+	aBuffer->SetFrameNumber(++iCurrentSourceFrameNumber); //so source knows which data to load buffer with
+	aBuffer->SetStatus(EBeingFilled);
+	aBuffer->SetLastBuffer(EFalse);
+    // return the original buffer to source
+	CCMRAudioInput::FillBufferL();
+    //iMMFDataSource->FillBufferL( aBuffer, this, (TMediaId)KUidMediaTypeAudio );
+#endif
+
+    // update time by asking from DevSound
+    UpdateTimeL();
+
+    PRINT((_L("CCMRHWAudioInput::BufferFilledL() out") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::FillBufferL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::FillBufferL(CMMFBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRHWAudioInput::FillBufferL() in") ));
+
+    // this buffer is used through all the fifos in this class, save it to the iInputEmpty-fifo
+    iUnderProcessing = EFalse;
+    if ( aBuffer )
+        {
+        aBuffer->SetLastBuffer(EFalse);
+        (static_cast<CMMFDataBuffer*>(aBuffer))->Data().SetLength(0);
+        (static_cast<CMMFDataBuffer*>(aBuffer))->SetPosition(0);
+        iInputEmpty->PutL( reinterpret_cast<TAny*>(aBuffer) );
+        }
+
+    if ( iInputFilled->IsEmpty() )
+        {
+        // no more data waiting to be processed, request new
+        // we come here always also when doing the first recording request
+
+#if (defined (__WINS__) || defined (__WINSCW__) )
+        // In WINS source buffer is returned only here, to avoid too fast buffer exchange
+        // which causes problems due to low performance
+
+        if ( iState == EStateRecording )
+            {
+            if ( iFirstTime )
+                {
+                iFirstTime = EFalse;
+                }
+            else
+                {
+                // reset buf information
+		        iDevSoundBuffer->SetFrameNumber(++iCurrentSourceFrameNumber); //so source knows which data to load buffer with
+		        iDevSoundBuffer->SetStatus(EBeingFilled);
+		        iDevSoundBuffer->SetLastBuffer(EFalse);
+                }
+            PRINT((_L("CCMRHWAudioInput::FillBufferL() request new data") ));
+            CCMRAudioInput::FillBufferL();
+            iDevSoundBuffer = NULL;
+            }
+#else
+        // HW
+        if ( iFirstTime )
+            {
+            // iDevSoundBuffer is NULL here, this is just used to prime devsound
+            iFirstTime = EFalse;
+            CCMRAudioInput::FillBufferL();
+            // iMMFDataSource->FillBufferL( iDevSoundBuffer, this, (TMediaId)KUidMediaTypeAudio );
+            PRINT((_L("CCMRHWAudioInput::FillBufferL() requested new data") ));
+            iDevSoundBuffer = NULL;
+            }
+        else
+            {
+            // In HW source buffer was already returned
+            PRINT((_L("CCMRHWAudioInput::FillBufferL() all buffered data processed, waiting for new") ));
+            }
+#endif
+        }
+    PRINT((_L("CCMRHWAudioInput::FillBufferL() out") ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::RunL
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::RunL()
+    {
+    PRINT((_L("CCMRHWAudioInput::RunL() in")));
+    // move waiting buffers from iInputFilled to iOutputFilled. Handling of iOutputFilled is done in NewBufferL which takes care of mutexes too
+    CMMFDataBuffer* buffer = reinterpret_cast<CMMFDataBuffer*>(iInputFilled->Get());
+    while ( buffer )
+        {
+        iNumBytesStored -= buffer->BufferSize();
+        if ( ( iState == EStateStopping ) && iInputFilled->IsEmpty() )
+            {
+            buffer->SetLastBuffer( ETrue );
+            }
+        // just in case, check that the buffer is not empty
+        if ( buffer->BufferSize() > 0 )
+            {
+            iSendBufCount++;
+            // inform sink
+            NewBufferL(buffer);
+            PRINT((_L("CCMRHWAudioInput::RunL(), sent a buffer to sink, data left in buffers %d"), iNumBytesStored ));
+            }
+        else
+            {
+            // buffer is empty, store it back to the queue of empty buffers
+            FillBufferL(buffer);
+            }
+        buffer = reinterpret_cast<CMMFDataBuffer*>(iInputFilled->Get());
+        }
+
+    // move used buffers from iOutputEmptied to input. That fifo is used by 2 threads so we need mutexes
+    // enter restricted area
+    iMutexObj.Wait();
+
+    TInt error = KErrNone;
+    buffer = reinterpret_cast<CMMFDataBuffer*>(iOutputEmptied->Get());
+    while ( buffer )
+        {
+        TRAP( error, FillBufferL(buffer));
+        if ( error != KErrNone )
+            {
+            // must break and not leave since we are inside mutex
+            break;
+            }
+        buffer = reinterpret_cast<CMMFDataBuffer*>(iOutputEmptied->Get());
+        }
+
+    // leave restricted area
+    iMutexObj.Signal();
+
+    if ( error != KErrNone )
+        {
+        // leave postponed here to get out of mutex
+        PRINT((_L("CCMRHWAudioInput::RunL() leave with error code %d"), error));
+        User::Leave( error );
+        }
+
+    PRINT((_L("CCMRHWAudioInput::RunL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::RunError
+// Handle leave from RunL
+// -----------------------------------------------------------------------------
+//
+TInt CCMRHWAudioInput::RunError(TInt aError)
+    {
+    PRINT((_L("CCMRHWAudioInput::RunError() with error code %d"), aError));
+    TMMFEvent event (KMMFEventCategoryPlaybackComplete, aError);
+
+    SendEventToClient( event );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::ConfigureCodecL
+// Configure HW device.
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::ConfigureCodecL()
+    {
+    // HW codec
+    // configure codec
+//    ADASSERT( iCodecData );
+    PRINT((_L("CCMRHWAudioInput::ConfigureCodecL() calls CCMRAudioAMRHWConfig()") ));
+    TDesC8* configData = iCodecData->GetCodecConfigParamL(iMMFDataSource);
+    User::LeaveIfError(iCodecData->AudioHWConfigL( iMMFDataSource, const_cast<TDesC8&>(*configData) ));
+    PRINT((_L("CCMRHWAudioInput::ConfigureCodecL() call to CCMRAudioAMRHWConfig() succeed") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::DoCancel
+// Cancels the active object
+// -----------------------------------------------------------------------------
+//
+void CCMRHWAudioInput::DoCancel()
+    {
+    }
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioInputSW.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,881 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio input class to handle uncompressed audio input from DevSound
+*                and compress it using CMMFCodecs
+*
+*/
+
+
+// INCLUDES
+#include "CCMRAudioInput.h"
+#include "CCMRAudioInputSW.h"
+#include "CCMRActiveOutput.h"
+#include "CCMRAudioCodecData.h"
+#include "CCMRFifo.h"
+
+#include <mmf/server/mmfcodec.h>
+#include <mmf/server/mmfaudioinput.h>
+#include <mmf/plugin/mmfcodecimplementationuids.hrh>
+
+// CONSTANTS
+
+// Initial number of buffers allocated
+const TInt KCMRNumSplitAudioBuffers = 10;   // # of buffers for splitting mode
+
+// Default timeout for the timer
+#if (defined (__WINS__) || defined (__WINSCW__) )
+const TUint KCMRWinsTimeOut = 100000;    // 100 ms; in WINS the performance is too slow to run this real-time, has to skip data
+#endif
+
+
+// MACROS
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+
+// CCMRSWAudioInput
+
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::NewL
+// -----------------------------------------------------------------------------
+//
+CCMRAudioInput* CCMRSWAudioInput::NewL(MDataSource* aRealSource, CCMRActiveOutput* aOutput, TUint aThreadId, MAsyncEventHandler& aEventHandler, CCMRConfigManager* aConfig )
+    {
+    CCMRSWAudioInput* self = new(ELeave) CCMRSWAudioInput(aRealSource, aEventHandler);
+    CleanupStack::PushL(self);
+    self->ConstructL(aOutput, aThreadId, aConfig );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::~CCMRSWAudioInput
+// -----------------------------------------------------------------------------
+//
+CCMRSWAudioInput::~CCMRSWAudioInput()
+    {
+    // cancel the timer
+    Cancel();
+
+    delete iCodec;
+    iCodec = NULL;
+
+    // there can be allocated bufs in all queueu: iInputEmpty, iInputFilled, iOutputFilled, and iOutputEmptied
+    CMMFDataBuffer* tmp;
+    TInt i = 0;
+    if ( iInputEmpty )
+        {
+        while ( !iInputEmpty->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iInputEmpty->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRSWAudioInput::~CCMRSWAudioInput() deleted %d bufs from iInputEmpty queue"), i ));
+        }
+    i = 0;
+    if ( iInputFilled )
+        {
+        while ( !iInputFilled->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iInputFilled->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRSWAudioInput::~CCMRSWAudioInput() deleted %d bufs from iInputFilled queue"), i ));
+        }
+    i = 0;
+    if ( iOutputFilled )
+        {
+        while ( !iOutputFilled->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputFilled->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRSWAudioInput::~CCMRSWAudioInput() deleted %d bufs from iOutputFilled queue"), i ));
+        }
+    i = 0;
+    if ( iOutputEmptied )
+        {
+        while ( !iOutputEmptied->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputEmptied->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRSWAudioInput::~CCMRSWAudioInput() deleted %d bufs from iOutputEmptied queue"), i ));
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::ConstructL(CCMRActiveOutput* aOutput, TUint aThreadId, CCMRConfigManager* aConfig )
+    {
+    PRINT((_L("CCMRSWAudioInput::ConstructL() in") ));
+    // construct the timer
+    CTimer::ConstructL();
+    CCMRAudioInput::ConstructL(aOutput, aThreadId, aConfig );
+    CActiveScheduler::Add( this );
+
+    PRINT((_L("CCMRSWAudioInput::ConstructL() out") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SetCodecL
+// Set codec
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::SetCodecL( CCMRAudioCodecData* aCodecData )
+    {
+    PRINT((_L("CCMRSWAudioInput::SetCodecL() in")));
+    CCMRAudioInput::SetCodecL( aCodecData );
+    iBufferDuration = iCodecData->GetFrameDurationUs();
+
+    iDeleteOld = EFalse;
+    if ( iCodec )
+        {
+		delete iCodec;
+		iCodec = NULL;
+        iDeleteOld = ETrue;
+		}
+    // instantiate the codec with default Uid. For security reasons, only tested codecs are supported and hence Uid is hardcoded
+    PRINT((_L("CCMRSWAudioInput::SetCodecL() create CMMFCodec with Uid %d"), iCodecData->SWCodecUid().iUid ));
+    iCodec = CMMFCodec::NewL ( iCodecData->SWCodecUid() );
+
+    PRINT((_L("CCMRSWAudioInput::SetCodecL() codec created, initialize & configure DevSound")));
+    // passing the srcFourCC tells DevSound NOT to create the hardware device
+	MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource);
+    // PCM16 is the default input
+    TFourCC srcFourCC = KMMFFourCCCodePCM16;
+	audioInput->SoundDevice().InitializeL(*this, srcFourCC, EMMFStateRecording);
+    PRINT((_L("CCMRSWAudioInput::SetCodecL() Devsound Initializing - waiting for InitializeComplete.")));
+    PRINT((_L("CCMRSWAudioInput::SetCodecL() out"))); 
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::AllocateInputBuffersL
+// Allocated input buffers.
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::AllocateInputBuffersL()
+    {
+    PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() in")));
+    // allocate input buffers for PCM
+    PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() PCM Channels: %d"), iCodecData->GetNumChannels() ));
+    iInputBufferSize = 2*iCodecData->GetNumChannels()*iCodecData->PreferredSampleCountPerInputBuffer();   
+    PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() PCM input buffer size: %d"), iInputBufferSize ));
+
+    // 2 comes from PCM16 => 2 bytes per sample
+    // If sample rate is 8 kHz => the multiplier is 2*8=16; for 16 kHz the multiplier is 2*16; 
+    // E.g. a 8kHz codec with 20 ms capture this gives 320 bytes
+
+    // this is in practice the size of PCM buffer for one frame. It can be exactly the same as iInputBufferSize. Typecast due to signed/unsigned mismatch
+    iMinPCMBufferSize = TInt(iInputBufferSize) / iCodecData->PreferredFrameCountPerInputBuffer();
+    PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() PCM min buffer size: %d"), iMinPCMBufferSize ));
+
+    TInt numBufs = KCMRNumSplitAudioBuffers;
+    TInt i;
+    CMMFDataBuffer* tmp;
+    for ( i = 0; i < numBufs; i++ )
+        {
+        tmp = CMMFDataBuffer::NewL(iInputBufferSize);
+        CleanupStack::PushL( tmp );
+        iInputEmpty->PutL( reinterpret_cast<TAny*>(tmp) );
+        CleanupStack::Pop( tmp );
+        }
+
+    // allocate buffers for coded data
+    iCodedBufferLength = iCodecData->PreferredFrameCountPerInputBuffer() * iCodecData->MaxFrameLengthL();
+    PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() PCM iCodedBufferLength: %d"), iCodedBufferLength ));    
+    numBufs = KCMRNumSplitAudioBuffers;
+    if ( iDeleteOld )
+        {
+        iDeleteOld = EFalse;
+        while ( !iOutputEmptied->IsEmpty() )
+            {
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputEmptied->Get());
+            delete tmp;
+            tmp = NULL;
+            i++;
+            }
+        PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() deleted %d bufs from iOutputEmptied queue"), i ));
+        }
+    for ( i = 0; i < numBufs; i++ )
+        {
+        tmp = CMMFDataBuffer::NewL(iCodedBufferLength);
+        CleanupStack::PushL( tmp );
+        iOutputEmptied->PutL( reinterpret_cast<TAny*>(tmp) );
+        CleanupStack::Pop( tmp );
+        }
+    PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() created %d bufs for iOutputEmptied queue"), i )); 
+    PRINT((_L("CCMRSWAudioInput::AllocateInputBuffersL() out")));    
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioInput::SourcePrimeL
+// Primes the source
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::SourcePrimeL()
+    {
+    PRINT((_L("CCMRSWAudioInput::SourcePrimeL()")));
+    CCMRAudioInput::SourcePrimeL();
+    iStartTime = TInt64(0);
+    iRemainder = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::BufferFilledL
+// Catches the call from MDataSource when it has filled the buffer and if 
+// buffering is needed, copies the buffer possibly to many smaller buffers
+// and saves them to be encoded one at a time in timed intervals
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::BufferFilledL(CMMFBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRSWAudioInput::BufferFilledL() in") ));
+
+    // take the start time, used as a basis for the timer for splitted buffers
+    if ( iSendBufCount == 0 )
+        {
+        iStartTime.HomeTime();
+        }
+
+    // copy the src buffer to internal buffers, splitting it to many if it is large
+
+    CMMFDataBuffer* dBuffer = static_cast<CMMFDataBuffer*>(aBuffer);
+    PRINT((_L("CCMRSWAudioInput::BufferFilledL() Data.length %d"), dBuffer->Data().Length() ));
+
+    // determine the number of bytes to copy, 
+    // abs max is the KCMRMaxSplittedAudioBufferSize unless the buffer
+    // has less data
+    TUint length = dBuffer->BufferSize();
+    TUint copyLength = iInputBufferSize;
+    if ( (iSendBufCount == 0) && (length < iInputBufferSize) )
+        {
+        // looks like DevSound outputs data in shorter buffers than we expect, must adjust timeout etc. 
+        // this is done only in the 1st round
+        iBufferDuration = length / (2*iCodecData->GetSampleRate()/1000); // 2 comes from PCM 16 (2 bytes per sample), the rest depends on sampling rate. No stereo support currently
+        iInputBufferSize = length;
+        copyLength = length;    // adjust this one here also to skip the following checks
+        PRINT((_L("CCMRSWAudioInput::BufferFilledL() smaller input buffers, copyLength set to %d"), copyLength));
+        }
+
+    if ( iRemainder > 0 )
+        {
+        // the last input buffer didn't fill the last splitted buffer completely. To stay in sync with timer, we need to copy now more data
+        copyLength += iRemainder;
+        PRINT((_L("CCMRSWAudioInput::BufferFilledL() copyLength %d increased to include iRemainder %d"), copyLength, iRemainder));
+        }
+    if ( copyLength > length )
+        {
+        // there was less data in input than should be in output
+        if ((iRemainder > 0 ) || (length < iInputBufferSize))
+            {
+            // more data in iRemainder
+            iRemainder = copyLength - length;
+            }
+
+        copyLength = length;
+        PRINT((_L("CCMRSWAudioInput::BufferFilledL() copyLength was larger than input length, reduced to %d"), copyLength));
+        }
+
+    // check if we have any buffers now in queue or in output
+    TBool notOldBuffers = EFalse;
+    if ( (iUnderProcessing == EFalse) && (iInputFilled->IsEmpty()) )
+        {
+        // no bufs neither in output nor in filled queue, can take the newest one into use right away
+        PRINT((_L("CCMRSWAudioInput::BufferFilledL() no old buffers, taken into use immediately after copy") ));
+        notOldBuffers = ETrue;
+        }
+
+    TInt readIndex = 0;
+
+    if ( length > 0 )
+        {
+        while ( length > 0 )
+            {
+            // take empty buffer
+            CMMFDataBuffer* tmp = NULL;
+            if ( iInputEmpty->IsEmpty() )
+                {
+                //out of buffers!! Create a new buffer
+                PRINT((_L("CCMRSWAudioInput::BufferFilledL(), out of buffers, create a new") ));
+                // determine the size
+                if ( copyLength > iInputBufferSize )
+                    {
+                    // we need to increase iInputBufferSize
+                    PRINT((_L("CCMRSWAudioInput::BufferFilledL(), increase iInputBufferSize to %d"), copyLength ));
+                    iInputBufferSize = copyLength;
+                    if ( (iInputBufferSize % iMinPCMBufferSize) != 0 )
+                        {
+                        // align the buffer size with smallest buffer size accepted by AMR, since AMR encoder increases the size by this number and may cause buffer overflow otherwise
+                        iInputBufferSize += iMinPCMBufferSize - (iInputBufferSize % iMinPCMBufferSize);
+                        }
+                    }
+
+                TRAPD(err, (tmp = CMMFDataBuffer::NewL(iInputBufferSize)));
+                PRINT((_L("CCMRSWAudioInput::BufferFilledL(), created a new") ));
+                if ( err != KErrNone )
+                    {
+                    PRINT((_L("CCMRSWAudioInput::BufferFilledL(), allocation failed, error %d"), err));
+                    // allocation failed
+
+                    // send the given buffer back
+                    CCMRAudioInput::FillBufferL();
+
+                    // stop & send event to client
+                    TMMFEvent event( KMMFEventCategoryPlaybackComplete, err);
+                    SendEventToClient(event);    
+                    return;
+                    }
+                }
+            else
+                {
+                // try to use an older buffer from the queue
+                tmp = reinterpret_cast<CMMFDataBuffer*>(iInputEmpty->Get());
+                if ( static_cast<TInt>(copyLength) > tmp->Data().MaxLength() )
+                    {
+                    PRINT((_L("CCMRSWAudioInput::BufferFilledL(), too small buffer, create a new") ));
+                    iInputBufferSize = copyLength;
+                    if ( (iInputBufferSize % iMinPCMBufferSize) != 0 )
+                        {
+                        // align the buffer size with smallest buffer size accepted by AMR, since AMR encoder increases the size by this number and may cause buffer overflow otherwise
+                        iInputBufferSize += iMinPCMBufferSize - (iInputBufferSize % iMinPCMBufferSize);
+                        }
+                    delete tmp;
+                    TRAPD(err, (tmp = CMMFDataBuffer::NewL(iInputBufferSize)));
+                    if ( err != KErrNone )
+                        {
+                        PRINT((_L("CCMRSWAudioInput::BufferFilledL(), allocation failed, error %d"), err));
+                        // allocation failed
+
+                        // send the given buffer back
+                        CCMRAudioInput::FillBufferL();
+
+                        // stop & send event to client
+                        TMMFEvent event( KMMFEventCategoryPlaybackComplete, err);
+                        SendEventToClient(event);    
+                        return;
+                        }
+                    }
+                }
+            CleanupStack::PushL(tmp);
+
+            TPtr8 tmpPtr(static_cast<TPtr8&>(tmp->Data()));
+
+            // copy data
+            tmpPtr.Copy( (dBuffer->Data().Ptr()+readIndex), copyLength );
+
+            tmp->Data().SetLength( copyLength );
+            length -= copyLength;
+            readIndex += copyLength;
+            PRINT((_L("CCMRSWAudioInput::BufferFilledL() copied %d"), copyLength ));
+
+            iNumBytesStored += copyLength;
+
+            if ( dBuffer->LastBuffer() && (length == 0) )
+                {
+                PRINT((_L("CCMRSWAudioInput::BufferFilledL(), last buffer set") ));
+                tmp->SetLastBuffer( ETrue );
+                iState = EStateStopping;
+                }
+
+            // save filled buffer
+            iInputFilled->PutL( reinterpret_cast<TAny*>(tmp) );
+            CleanupStack::Pop(tmp);
+
+            if ( (iRemainder > 0) && (length > 0) )
+                {
+                // there was some remainder from the previous buffer, and there are still data in the input buffer
+                // if length == 0, iRemainder was set in the previous round for this buffer, and value should not be changed
+                // if input had less data than required, iRemainder was set in the beginning and it forces length to be 0 at this point
+                // we are in sync again
+                // go back to the normal length
+                iRemainder = 0;
+                copyLength = iInputBufferSize;
+                }
+
+            if ( (length < copyLength) && (length > 0) )
+                {
+                // last buf will get less data, mark down how much less. 
+                // if iRemainder >> input length, this limits it since copyLength is reduced above. 
+                // It may be even better to have such limit to avoid too large buffers; such case most likely indicates a problem
+                iRemainder = copyLength - length;
+                PRINT((_L("CCMRSWAudioInput::BufferFilledL(), iRemainder set to %d"), iRemainder ));
+
+                copyLength = length;
+                }
+
+#if (defined (__WINS__) || defined (__WINSCW__) )
+            //skip the rest; in WINS the performance is too slow to run this real-time, has to skip data
+            length = 0;
+#endif
+            } // end of while-loop
+
+        PRINT((_L("CCMRSWAudioInput::BufferFilledL(), data processed.")));
+
+        if ( notOldBuffers )
+            {
+#if (defined (__WINS__) || defined (__WINSCW__) )
+            // in WINS the performance is too slow to run this real-time, has to wait longer
+            Cancel();
+            CTimer::After( KCMRWinsTimeOut );
+            PRINT((_L("CCMRSWAudioInput::BufferFilledL(), timer set") ));
+#else
+            // we didn't have any old buffers queued or in output, send the 1st new one right away
+            CTimer::After( 0 );
+#endif
+            }
+
+        }
+    else
+        {
+        // empty buffer received
+        if ( dBuffer->LastBuffer() )
+            {
+            PRINT((_L("CCMRSWAudioInput::BufferFilledL(), last buffer set") ));
+            iState = EStateLastReceived;
+            }
+        }
+
+
+#if (defined (__WINS__) || defined (__WINSCW__) )
+    // save the buffer handle, to be returned to source when the first splitted buffer has been encoded
+    iDevSoundBuffer = aBuffer;
+#else
+    // reset buf information
+    PRINT((_L("CCMRSWAudioInput::BufferFilledL(), resetting data buffer.")));    
+	aBuffer->SetFrameNumber(++iCurrentSourceFrameNumber); //so source knows which data to load buffer with
+	aBuffer->SetStatus(EBeingFilled);
+	aBuffer->SetLastBuffer(EFalse);
+    // return the original buffer to source
+    PRINT((_L("CCMRSWAudioInput::BufferFilledL(), calling CCMRAudioInput::FillBufferL()")));	
+	CCMRAudioInput::FillBufferL();
+#endif
+
+    // update time by asking from DevSound
+    UpdateTimeL();
+    PRINT((_L("CCMRSWAudioInput::BufferFilledL() out") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::FillBufferL
+// Returns buffer from RunL to iInputEmpty and depending on state & mode, either starts 
+// a new timer or requests the source to fill the buffer
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::FillBufferL(CMMFBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRSWAudioInput::FillBufferL() in") ));
+
+    // this buffer is used between output and this class, save it to fifo
+    iUnderProcessing = EFalse;
+    if ( aBuffer )
+        {
+        aBuffer->SetLastBuffer(EFalse);
+        (static_cast<CMMFDataBuffer*>(aBuffer))->Data().SetLength(0);
+        (static_cast<CMMFDataBuffer*>(aBuffer))->SetPosition(0);
+        iInputEmpty->PutL( reinterpret_cast<TAny*>(aBuffer) );
+        }
+
+    if ( iInputFilled->IsEmpty() )
+        {
+        // no more data to process, request new
+        // we come here always also when doing the first recording request
+
+#if (defined (__WINS__) || defined (__WINSCW__) )
+        // In WINS source buffer is returned only here, to avoid too fast buffer exchange 
+        // which causes problems due to low performance
+
+        if ( iState == EStateRecording )
+            {
+            if ( iFirstTime )
+                {
+                iFirstTime = EFalse;
+                }
+            else if ( iDevSoundBuffer )
+                {
+                // reset buf information
+		        iDevSoundBuffer->SetFrameNumber(++iCurrentSourceFrameNumber); //so source knows which data to load buffer with
+		        iDevSoundBuffer->SetStatus(EBeingFilled);
+		        iDevSoundBuffer->SetLastBuffer(EFalse);
+                }
+            PRINT((_L("CCMRSWAudioInput::FillBufferL() request new data") ));
+            CCMRAudioInput::FillBufferL();
+            iDevSoundBuffer = NULL;
+            }
+#else
+        // HW
+        if ( iFirstTime )
+            {
+            // iDevSoundBuffer is NULL here, this is just used to prime devsound
+            iFirstTime = EFalse;
+            CCMRAudioInput::FillBufferL();
+            PRINT((_L("CCMRSWAudioInput::FillBufferL() requested new data") ));
+            iDevSoundBuffer = NULL;
+            }
+        else
+            {
+            // In HW source buffer was already returned
+            PRINT((_L("CCMRSWAudioInput::FillBufferL() all buffered data encoded, waiting for new") ));
+            }
+#endif
+        }
+    else
+        {
+        // continue feeding new data after a timeout
+        // more data in iInputFilled than supposed to be => we are late, no time to sleep
+        CTimer::After( 0 );
+        PRINT((_L("CCMRSWAudioInput::FillBufferL(), timer with timeout 0 set") ));
+        }
+    PRINT((_L("CCMRSWAudioInput::FillBufferL() out") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::SourceRecordL
+// Start recording
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::SourceRecordL()
+    {
+    CCMRAudioInput::SourceRecordL();
+
+    FillBufferL( NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::SourceStopL
+// Stops playing (recording)
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::SourceStopL()
+    {
+    PRINT((_L("CCMRSWAudioInput::SourceStopL() in")));
+    // stop also sending our data; please remember that we pause first also in stop => all data should have been flushed already when coming here
+    Cancel();
+
+    if ( iState != EStateStopped )
+        {
+        CCMRAudioInput::SourceStopL();
+
+        PRINT((_L("CCMRSWAudioInput::SourceStopL() start moving buffers from full to empty queue")));
+        // this is a real stop, no need to flush buffers to sink; that was done in pause
+        // move all buffers to empty-fifos: from iInputFilled to iInputEmpty and from iOutputFilled to iOutputEmpty
+        TInt i = 0;
+        CMMFDataBuffer* tmp;
+        while ( !iInputFilled->IsEmpty() )
+            {
+            // move bufs from filled to empty
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iInputFilled->Get());
+            tmp->SetLastBuffer( EFalse );
+            tmp->Data().SetLength(0);
+            CleanupStack::PushL( tmp );
+            iInputEmpty->PutL(reinterpret_cast<TAny*>(tmp) );
+            CleanupStack::Pop( tmp );
+            i++;
+            }
+        PRINT((_L("CCMRSWAudioInput::SourceStopL() moved %d bufs from iInputFilled to iInputEmpty queue"), i ));
+
+
+        // iOutput-fifos are being handled by output thread also, mutexes are needed
+
+        // enter restricted area
+        iMutexObj.Wait();
+
+        TInt error = KErrNone;
+        i = 0;
+        while ( (!iOutputFilled->IsEmpty()) && (error == KErrNone) )
+            {
+            // move bufs from filled to empty
+            tmp = reinterpret_cast<CMMFDataBuffer*>(iOutputFilled->Get());
+            tmp->SetLastBuffer( EFalse );
+            tmp->Data().SetLength(0);
+            CleanupStack::PushL( tmp );
+            TRAP( error, iOutputEmptied->PutL(reinterpret_cast<TAny*>(tmp) ));
+            CleanupStack::Pop( tmp );
+            i++;
+            }
+        PRINT((_L("CCMRSWAudioInput::SourceStopL() moved %d bufs from iOutputFilled to iOutputEmptied queue"), i ));
+
+        // move also iProcessingBuffer
+        if ( (iProcessingBuffer) && ( error == KErrNone) )
+            {
+            tmp = iProcessingBuffer;
+            iProcessingBuffer = NULL;
+            tmp->SetLastBuffer( EFalse );
+            tmp->Data().SetLength(0);
+            TRAP(error,iOutputEmptied->PutL(reinterpret_cast<TAny*>(tmp) ));
+            PRINT((_L("CCMRSWAudioInput::SourceStopL() moved iProcessingBuffer to iOutputEmptied queue")));
+            }
+
+        iNumFramesWaiting = 0;
+        // leave restricted area
+        iMutexObj.Signal();
+
+        if ( error != KErrNone )
+            {
+            // leave postponed here to get out of mutex
+            PRINT((_L("CCMRSWAudioInput::SourceStopL() leave with error code %d"), error));
+            User::Leave( error );
+            }
+
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::RunL
+// Encodes a buffer and informs sink about it
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::RunL()
+    {
+    // iStatus may be KErrUnderflow but it doesn't matter, timer was just set on too late, and we can't do anything about it
+    PRINT((_L("CCMRSWAudioInput::RunL() with timer in iStatus = %d"), iStatus.Int() ));
+
+
+    // take oldest from fifo, cast it to correct type, and encode it
+    CMMFDataBuffer* pcmBuffer = reinterpret_cast<CMMFDataBuffer*>(iInputFilled->Get());
+    if ( pcmBuffer )
+        {
+        CleanupStack::PushL( pcmBuffer );
+
+        iNumBytesStored -= pcmBuffer->BufferSize();
+        if ( ( iState == EStateStopping ) && iInputFilled->IsEmpty() )
+            {
+            pcmBuffer->SetLastBuffer( ETrue );
+            }
+        iUnderProcessing = ETrue;
+
+        // loop until all data from the pcmBuffer is consumed
+        while ( !EncodeBufferL( pcmBuffer ) )
+            {
+            }
+
+		
+        // Give PCM16 input buffer back
+        FillBufferL(pcmBuffer);
+        // pcmBuffer was saved into fifo, can be popped out now (but not destroy!)
+        CleanupStack::Pop( pcmBuffer );
+
+        PRINT((_L("CCMRSWAudioInput::RunL(), encoded buffer, data left in buffers %d"), iNumBytesStored ));
+        }
+
+    // Else the timer was useless; should not be possible but is not a fatal error case either. 
+    //When new data arrives, it will set a new timer
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::RunError
+// Handle leave from RunL
+// -----------------------------------------------------------------------------
+//
+TInt CCMRSWAudioInput::RunError(TInt aError)
+    {
+    PRINT((_L("CCMRSWAudioInput::RunError() with error code %d"), aError));
+    TMMFEvent event (KMMFEventCategoryPlaybackComplete, aError);
+
+    SendEventToClient( event );
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::EncodeBufferL
+// Encode the given PCM buffer, using EncodeL. This generates 0 or 1 output 
+// buffer and may need to be called again to completely consume the input.
+// -----------------------------------------------------------------------------
+//
+TBool CCMRSWAudioInput::EncodeBufferL(CMMFDataBuffer* aInBuffer)
+    {
+    PRINT((_L("CCMRSWAudioInput::EncodeBufferL() in")));
+    // take buffer for encoding
+    // enter restricted area
+    iMutexObj.Wait();
+    CMMFDataBuffer* codedBuffer = reinterpret_cast<CMMFDataBuffer*>(iOutputEmptied->Get());
+    // leave restricted area
+    iMutexObj.Signal();    
+    if ( codedBuffer == NULL )
+        {
+        // must create a new one - better to store data in compressed buffers than PCM16 buffers
+        codedBuffer = CMMFDataBuffer::NewL(iCodedBufferLength);
+        }
+
+    CleanupStack::PushL( codedBuffer );
+
+    TBool completed = ETrue;
+
+    // encode and check the result
+    switch ( EncodeL(aInBuffer, codedBuffer) )
+        {
+        case TCodecProcessResult::EProcessIncomplete:
+            // Not all data from input was consumed (EncodeL updated buffer members), but output was generated
+            PRINT((_L("CCMRSWAudioInput::EncodeBufferL() not all data consumed from input")));
+
+            completed = EFalse;
+			// purposely fall through
+
+        case TCodecProcessResult::EProcessComplete:
+            // all data from input was used and output was generated
+
+
+            // check the length, just in case
+            if ( codedBuffer->BufferSize() > 0 )
+                {
+                PRINT((_L("CCMRSWAudioInput::EncodeBufferL() generated output")));
+                iSendBufCount++;
+                // inform sink
+                NewBufferL(codedBuffer);
+                }
+            else
+                {
+                PRINT((_L("CCMRSWAudioInput::EncodeBufferL() codec returned an empty buffer with EProcessComplete")));
+    			// enter restricted area
+    			iMutexObj.Wait();                
+                iOutputEmptied->PutL( reinterpret_cast<TAny*>(codedBuffer) );
+    			// leave restricted area
+    			iMutexObj.Signal();                 
+                }
+            break;
+
+        case TCodecProcessResult::EDstNotFilled:
+            // need more input data, can't fill the output yet; put it back to the empty queue
+            PRINT((_L("CCMRSWAudioInput::EncodeBufferL() not enough input data to generate output")));
+    		// enter restricted area
+    		iMutexObj.Wait();               
+            iOutputEmptied->PutL( reinterpret_cast<TAny*>(codedBuffer) );
+    		// leave restricted area
+    		iMutexObj.Signal();               
+            break;
+
+        default:
+            // EEndOfData, EProcessError, EProcessIncompleteRepositionRequest, EProcessCompleteRepositionRequest
+            PRINT((_L("CCMRSWAudioInput::EncodeBufferL() unknown status from CMMFCodec")));
+            User::Leave( KErrUnknown );
+        }
+
+    // codedBuffer was saved into fifo (here or in NewBufferL), can be popped out now (but not destroy!)
+    CleanupStack::Pop( codedBuffer );
+
+    PRINT((_L("CCMRSWAudioInput::EncodeBufferL() out")));
+    return completed;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::EncodeL
+// Encodes a buffer using CMMFCodec
+// -----------------------------------------------------------------------------
+//
+TCodecProcessResult::TCodecProcessResultStatus CCMRSWAudioInput::EncodeL(CMMFDataBuffer* aInBuffer, CMMFDataBuffer* aOutBuffer)
+    {
+    PRINT((_L("CCMRSWAudioInput::EncodeL() in")));
+    TCodecProcessResult result;
+
+    result = iCodec->ProcessL (*aInBuffer, *aOutBuffer);
+
+	switch (result.iStatus)
+		{
+		case TCodecProcessResult::EProcessComplete:
+			// finished processing source data, all data in sink buffer
+            PRINT((_L("CCMRSWAudioInput::EncodeL() EProcessComplete")));
+			aOutBuffer->SetPosition(0);
+            if ( aInBuffer->LastBuffer() )
+                {
+                aOutBuffer->SetLastBuffer(ETrue);
+                }
+			break;
+
+		case TCodecProcessResult::EDstNotFilled:
+			// the destination is not full, we need more data. Handled in caller
+            PRINT((_L("CCMRSWAudioInput::EncodeL() EDstNotFilled")));
+            break;
+
+        case TCodecProcessResult::EProcessIncomplete:
+			// the sink was filled before all the source was processed
+            PRINT((_L("CCMRSWAudioInput::EncodeL() EProcessIncomplete, bytes processed: %d"), result.iSrcBytesProcessed));
+			aOutBuffer->SetPosition(0);
+            aInBuffer->SetPosition( aInBuffer->Position() + result.iSrcBytesProcessed);
+			break;
+
+		default:
+			break;
+		}
+
+    PRINT((_L("CCMRSWAudioInput::EncodeL() out")));
+    return result.iStatus;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRHWAudioInput::ConfigureCodecL
+// Configure the used CMMFCodec.
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::ConfigureCodecL()
+    {
+    PRINT((_L("CCMRSWAudioInput::ConfigureCodecL() in") ));
+    TDesC8* configData = iCodecData->GetCodecConfigParamL(iMMFDataSource);
+    if ( configData )
+        {
+        TUid uid ={KUidMmfCodecAudioSettings}; // Use Uid reserved for codec configurations
+        TRAPD(err,iCodec->ConfigureL( uid, const_cast<TDesC8&>(*configData)));
+        if ( err ) {}
+        // some codecs may not support, ignore error and hope it is configured properly
+        }
+    PRINT((_L("CCMRSWAudioInput::ConfigureCodecL() out") ));
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRSWAudioInput::DoCancel
+// Cancels the timer
+// -----------------------------------------------------------------------------
+//
+void CCMRSWAudioInput::DoCancel()
+    {
+    PRINT((_L("CCMRSWAudioInput::DoCancel() timer in")));
+    // cancel the timer
+    CTimer::DoCancel();
+    PRINT((_L("CCMRSWAudioInput::DoCancel() timer out")));
+    }
+
+
+
+
+
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioRecorder.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,709 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio recorder class. Client side for audio thread
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    "CCMRAudioRecorder.h"
+#include    "CCMRSupportedCodecs.h"
+#include    "CCMRAudioCodecs.h"
+#include    "CCMRAudioCodecData.h"
+#include    "CCMRActiveOutput.h"
+#include    "CCMRVideoHWParams.h"
+
+#include    <mmf/server/mmfdatabuffer.h>
+#include    <mmf/server/mmfaudioinput.h>
+#include 	<AudioPreference.h>                // For MMF audio preference definitions.
+
+// MACROS
+
+// Assertion macro wrapper for code cleanup
+#define ARASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CCMRAUDIORECORDER"), EInternalAssertionFailure)) 
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::CCMRAudioRecorder
+//
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRAudioRecorder::CCMRAudioRecorder()
+    {
+    iObserver = NULL;
+    iDataSource = NULL;
+    iThreadCreated = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::~CCMRAudioRecorder
+//
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCMRAudioRecorder::~CCMRAudioRecorder()
+    {
+    PRINT((_L("CCMRAudioRecorder::~CCMRAudioRecorder() in")));
+    
+    delete iThreadEventMonitor;
+    iThreadEventMonitor = NULL;
+
+    if ( iThreadCreated )
+        {
+        iThreadProxy.Close();
+        }
+    //audio thread already logs off audio source (=> deletes it)
+    PRINT((_L("CCMRAudioRecorder::~CCMRAudioRecorder() thread closed")));
+
+    iObserver = NULL;
+    iDataSource = NULL;
+    iOutputAO = NULL;
+    
+    delete iAudioCodecs;
+    iAudioCodecs = NULL;
+
+    PRINT((_L("CCMRAudioRecorder::~CCMRAudioRecorder() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::NewL
+//
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRAudioRecorder* CCMRAudioRecorder::NewL()
+    {
+    
+    CCMRAudioRecorder* self = new (ELeave) CCMRAudioRecorder;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::ConstructL
+//
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::ConstructL()
+    {
+    SetState(EStateNone);
+    iPrioritySettings.iPriority = KAudioPriorityVideoRecording;
+    iPrioritySettings.iPref =  TMdaPriorityPreference( KAudioPrefVideoRecording );
+
+    RArray<TFourCC> audioTypes;
+    CleanupClosePushL( audioTypes );
+    audioTypes.Reset();
+    
+    iAudioCodecs = CCMRAudioCodecs::NewL();
+    iAudioCodecs->GetSupportedAudioCodecsL( audioTypes );
+    // audioTypes have always >= 1 element now
+    if ( audioTypes.Count() > 0 )
+        {
+        iAudioCodecFourCC = TFourCC(audioTypes[0]);
+        iAudioCodecs->SetAudioCodecL( iAudioCodecFourCC );
+        CCMRRecorderBase::SetTargetBitRateL( iAudioCodecs->GetCodecDataL()->GetBitRateL() );
+        }
+    else
+        {
+        // no audio codecs exist. Must anyway create audio recorder, since mediarecorder should work also video-only and codec support is checked later
+        iAudioCodecFourCC = TFourCC(' ',' ',' ',' ');
+        }
+
+    CleanupStack::PopAndDestroy( &audioTypes ); // calls also audioTypes.Close()
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::OpenL
+//
+// Open recorder. This is like audio controller's AddSource
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::OpenL(MCMRAudioRecorderObserver *aObserver, MDataSource *aSource, 
+                              CCMRActiveOutput* aOutputAO, const TFourCC& aAudioType, CCMRConfigManager* aConfig )
+    {
+    PRINT((_L("CCMRAudioRecorder::OpenL() in")));
+    if ( State() != EStateNone ) 
+        {
+        PRINT((_L("CCMRAudioRecorder::OpenL() already exists")));
+        User::Leave( KErrAlreadyExists );
+        }
+  
+    // save the references/pointers
+    iObserver = aObserver;
+    iConfig = aConfig;
+    iConfig->SetAudioCodec( iAudioCodecFourCC );
+
+    // check the source type
+    if ( aSource && aSource->DataSourceType() != KUidMmfAudioInput)
+        {
+        PRINT((_L("CCMRAudioRecorder::OpenL() unsupported source")));
+        User::Leave(KErrNotSupported);
+        }
+    iDataSource = aSource;
+
+    iOutputAO = aOutputAO;
+
+    // create thread for audio 
+    User::LeaveIfError(iThreadProxy.CreateSubThread(iThreadCreated));
+    User::LeaveIfError(iThreadProxy.SetOutput(iOutputAO));
+
+    iThreadEventMonitor = CCMRSubThreadEventMonitor::NewL(*this, iThreadProxy); 
+    iThreadEventMonitor->Start();
+
+    // add data source => we will be connected also to DevSound and then we can use e.g. gain settings
+    if (iDataSource)
+        {
+        User::LeaveIfError(iThreadProxy.AddDataSource(iDataSource));
+        }
+
+    // set config manager to thread
+    User::LeaveIfError(iThreadProxy.SetConfigManager( aConfig ));
+
+    // SetAudioCodec requires we are at least open
+    SetState( EStateOpen );
+    iObserver->MaroStateChange( State() );
+
+    SetAudioCodecL( aAudioType );
+  
+    PRINT((_L("CCMRAudioRecorder::OpenL() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::SetAudioCodecL
+//
+// Set audio codec to be used (overrides the one given in OpenL)
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::SetAudioCodecL( const TFourCC& aAudioType )
+    {
+    PRINT((_L("CCMRAudioRecorder::SetAudioCodecL() in")));    
+    if ( ( State() != EStateOpen ) && ( State() != EStateReadyToRecord ) )
+        {
+        PRINT((_L("CCMRAudioRecorder::SetAudioCodecL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+    if ( aAudioType != iAudioCodecFourCC )
+        {
+        iAudioCodecs->SetAudioCodecL( aAudioType );
+        iAudioCodecFourCC = aAudioType;
+        iConfig->SetAudioCodec(iAudioCodecFourCC);
+
+        SetState( EStateOpen );
+        iObserver->MaroStateChange( State() );
+        }
+    PRINT((_L("CCMRAudioRecorder::SetAudioCodecL() out")));        
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::GetAudioCodecL
+// Get the used audio codec.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::GetAudioCodecL( TFourCC& aAudioType ) const
+    {
+    if ( (State() == EStateNone) || (iAudioCodecs->GetCodecDataL() == NULL) )
+        {
+        PRINT((_L("CCMRAudioRecorder::GetAudioCodecL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    aAudioType = iAudioCodecs->GetCodecDataL()->GetCodecFourCCL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::GetSupportedAudioCodecsL
+// Get the supported & installed audio codecs.
+// This can be called also when the recorder is not open
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::GetSupportedAudioCodecsL( RArray<TFourCC>& aAudioTypes ) const
+    {
+    aAudioTypes.Reset();
+    
+    iAudioCodecs->GetSupportedAudioCodecsL( aAudioTypes );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::SetPriorityL
+//
+// Set audio priority (for DevSound)
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::SetPriorityL(const TMMFPrioritySettings& aPrioritySettings)
+    {
+    if ( State() == EStateNone || State() == EStateRecording || State() == EStatePaused )
+        {
+        PRINT((_L("CCMRAudioRecorder::SetPriorityL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+    if ( aPrioritySettings.iPriority < EMdaPriorityMin || aPrioritySettings.iPriority > EMdaPriorityMax )
+        {
+        // outside allowed range
+        PRINT((_L("CCMRAudioRecorder::SetPriorityL() unsupported priority")));
+        User::Leave( KErrArgument );
+        }
+
+    iPrioritySettings = aPrioritySettings;
+    SetState( EStateOpen );
+    iObserver->MaroStateChange( State() );
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::SetTargetBitRateL
+//
+// Set audio bitrate. Note: checked only in PrepareL
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::SetTargetBitRateL(TInt aBitRate)
+    {
+    PRINT((_L("CCMRAudioRecorder::SetTargetBitRateL() in")));
+    if ( (( State() != EStateOpen ) && ( State() != EStateReadyToRecord )) || (iAudioCodecs->GetCodecDataL() == NULL) )
+        {
+        PRINT((_L("CCMRAudioRecorder::SetTargetBitRateL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    iAudioCodecs->GetCodecDataL()->SetBitRateL( aBitRate );
+    // if we are here, the bitrate was ok, store it also here since the system assumes recorder class stores it
+    CCMRRecorderBase::SetTargetBitRateL( aBitRate );
+
+    SetState( EStateOpen );
+    iObserver->MaroStateChange( State() );
+    PRINT((_L("CCMRAudioRecorder::SetTargetBitRateL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::SetTargetSampleRateL
+//
+// Set audio samplerate. AAC only.
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::SetTargetSampleRateL(TInt aSampleRate)
+    {
+    PRINT((_L("CCMRAudioRecorder::SetTargetSampleRateL() in, samplerate=%d"),aSampleRate));
+    if ( (( State() != EStateOpen ) && ( State() != EStateReadyToRecord )) || (iAudioCodecs->GetCodecDataL() == NULL) )
+        {
+        PRINT((_L("CCMRAudioRecorder::SetTargetSampleRateL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    iAudioCodecs->GetCodecDataL()->SetSampleRateL( aSampleRate );
+
+    SetState( EStateOpen );
+    iObserver->MaroStateChange( State() );
+    PRINT((_L("CCMRAudioRecorder::SetTargetSampleRateL() out")));
+    }    
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::SetChannelModeL
+//
+// Set audio channel mode. AAC only.
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::SetChannelModeL(TInt aChannelMode)
+    {
+    PRINT((_L("CCMRAudioRecorder::SetChannelModeL() in, channelmode=%d"), aChannelMode));
+    if ( (( State() != EStateOpen ) && ( State() != EStateReadyToRecord )) || (iAudioCodecs->GetCodecDataL() == NULL) )
+        {
+        PRINT((_L("CCMRAudioRecorder::SetChannelModeL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    iAudioCodecs->GetCodecDataL()->SetChannelModeL( aChannelMode );
+
+    SetState( EStateOpen );
+    iObserver->MaroStateChange( State() );
+    PRINT((_L("CCMRAudioRecorder::SetChannelModeL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::MaxGainL
+//
+// Get maximum gain from audio input
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAudioRecorder::MaxGainL()
+    {
+    PRINT((_L("CCMRAudioRecorder::MaxGainL() in")));
+    if ( State() == EStateNone )
+        {
+        PRINT((_L("CCMRAudioRecorder::MaxGainL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    // check max gain from sound device
+    TInt gain;
+    User::LeaveIfError( iThreadProxy.MaxGain( gain ));
+    PRINT((_L("CCMRAudioRecorder::MaxGainL() almost out, max gain %d"),gain));
+    return gain;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::GainL
+//
+// Get current gain from audio input
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAudioRecorder::GainL()
+    {
+    PRINT((_L("CCMRAudioRecorder::GainL() in")));
+    if ( State() == EStateNone )
+        {
+        PRINT((_L("CCMRAudioRecorder::GainL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    // check current gain from sound device
+    TInt gain;
+    User::LeaveIfError( iThreadProxy.GetGain( gain ));
+    PRINT((_L("CCMRAudioRecorder::GainL() almost out, gain %d"),gain));
+    return gain;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::SetGainL
+//
+// Sets gain for audio input. Can be done before and during recording 
+// and is effective immediately
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::SetGainL(TInt aGain)
+    {
+    PRINT((_L("CCMRAudioRecorder::SetGainL() in")));
+    if ( State() == EStateNone )
+        {
+        PRINT((_L("CCMRAudioRecorder::SetGainL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    if ( aGain >= 0 ) 
+        {
+        User::LeaveIfError( iThreadProxy.SetGain(aGain));
+
+        PRINT((_L("CCMRAudioRecorder::SetGainL() out")));
+        }
+    else
+        {
+        PRINT((_L("CCMRAudioRecorder::SetGainL() out due to illegal argument: %d"),aGain));
+        User::Leave( KErrArgument );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::GetThreadPriority
+//
+// Get audio thread priority
+// -----------------------------------------------------------------------------
+//
+TThreadPriority CCMRAudioRecorder::GetThreadPriority() const
+    {
+    return iThreadProxy.GetThreadPriority();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::PrepareL
+//
+// Prepare recorder for recording (freeze settings / implements PrimeL)
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::PrepareL()
+    {
+    PRINT((_L("CCMRAudioRecorder::PrepareL() in    ")));
+
+    if ( (State() != EStateOpen) && (State() != EStateReadyToRecord) )
+        {
+        PRINT((_L("CCMRAudioRecorder::PrepareL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( !iThreadCreated )
+        {
+        PRINT((_L("CCMRAudioRecorder::PrepareL() no thread")));
+        User::Leave( KErrNotReady );
+        }
+
+    // set priority settings
+    User::LeaveIfError( iThreadProxy.SetPriority(iPrioritySettings));    
+    
+    // give handle to the audio codec
+    User::LeaveIfError( iThreadProxy.SetAudioCodec( iAudioCodecs->GetCodecDataL() ) );
+
+    // inform sink about average audio bitrate
+    User::LeaveIfError( iOutputAO->SetAverageAudioBitRate(iAudioCodecs->GetCodecDataL()->GetBitRateL()) );
+
+    // prime the audio thread
+    User::LeaveIfError(iThreadProxy.Prime());
+    PRINT((_L("CCMRAudioRecorder::PrepareL(), iThreadProxy.Prime() done") ));
+
+    //no need to be in preparing state; prepare is synchronous
+
+    SetState( EStateReadyToRecord );
+    iObserver->MaroStateChange( State() );
+
+    PRINT((_L("CCMRAudioRecorder::PrepareL() out    ")));
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::RecordL
+//
+// Start recording
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::RecordL()
+    {
+    PRINT((_L("CCMRAudioRecorder::RecordL() in    ")));
+    if ( (State() == EStateRecording) || (State() == EStatePaused) )
+        {
+        // ignore, already recording
+        return;
+        }
+    
+    if ( State() != EStateReadyToRecord )
+        {
+        PRINT((_L("CCMRAudioRecorder::RecordL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    if ( State() == EStateReadyToRecord )
+        {
+        User::LeaveIfError(iThreadProxy.Play());
+
+        SetState( EStateRecording );
+        iObserver->MaroStateChange( State() );
+        }
+
+    PRINT((_L("CCMRAudioRecorder::RecordL() out    ")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::StopL
+//
+// Stop recording
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::StopL()
+    {
+    PRINT((_L("CCMRAudioRecorder::StopL() in    ")));
+
+    if ( (State() == EStateRecording) || (State() == EStatePaused) )
+        {
+
+        User::LeaveIfError(iThreadProxy.Stop());
+        SetState( EStateStopping );
+        }
+    PRINT((_L("CCMRAudioRecorder::StopL() out    ")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::PauseL
+//
+// Pause recording
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::PauseL()
+    {
+    if ( State() == EStateRecording )
+        {
+        User::LeaveIfError(iThreadProxy.Pause());
+        // pause was sync
+        SetState( EStatePaused );
+        iObserver->MaroStateChange( State() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::ResumeL
+//
+// Resume recording
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::ResumeL()
+    {
+    if ( State() == EStatePaused )
+        {
+        User::LeaveIfError(iThreadProxy.Play());
+
+        SetState( EStateRecording );
+        iObserver->MaroStateChange( State() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::WaitUntilStoppedL
+// Wait until audio thread has stopped recording
+// 
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::WaitUntilStoppedL()
+    {
+    if ( (State() == EStateRecording) || (State() == EStatePaused) || (State() == EStateStopping))
+        {
+        // not stopped yet
+        User::LeaveIfError(iThreadProxy.WaitUntilStopped());
+        // wait was sync
+        SetState( EStateReadyToRecord );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::AVSyncAdjustmentStart
+// Get default AV sync adjustment for start of recording, depending on codec type
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAudioRecorder::AVSyncAdjustmentStart()
+    {
+    if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+        {
+		return iConfig->VideoQualitySettings().iAVSyncStartDelay;
+        }
+    
+    TCMRCodecType type = ECodecTypeSW;
+
+    TRAPD(err, type = iAudioCodecs->GetCodecDataL()->GetCodecSWHWTypeL());
+    ARASSERT( err == KErrNone );
+    if ( err ) {}
+
+    if ( type == ECodecTypeHW )
+        {
+        //HW codecs (DevSound outputs compressed data)
+        return KCMRInitialVideoAudioTimeSyncHW;
+        }
+    else
+        {
+        //SW codecs (DevSound outputs PCM)
+        return KCMRInitialVideoAudioTimeSyncSW;
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::AVSyncAdjustmentResume
+// Get default AV sync adjustment for resume of recording, depending on codec type
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAudioRecorder::AVSyncAdjustmentResume()
+    {
+    if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+        {
+		return iConfig->VideoQualitySettings().iAVSyncResumeDelay;
+        }
+    
+    TCMRCodecType type = ECodecTypeSW;
+
+    TRAPD(err, type = iAudioCodecs->GetCodecDataL()->GetCodecSWHWTypeL());
+    ARASSERT( err == KErrNone );
+    if ( err ) {}
+
+    if ( type == ECodecTypeHW )
+        {
+        //HW codecs (DevSound outputs compressed data)
+        return KCMRPauseVideoAudioTimeSyncHW;
+        }
+    else
+        {
+        //SW codecs (DevSound outputs PCM)
+        return KCMRPauseVideoAudioTimeSyncSW;
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioRecorder::HandleEvent
+// Handle event from audio thread
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioRecorder::HandleEvent(const TMMFEvent& aEvent)
+    {
+    PRINT((_L("CCMRAudioRecorder::HandleEvent(), aEvent.iEventType %d   aEvent.iErrorCode %d"), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete)
+        {
+        // Lose of audio resource is signalled like this. Also some errors are signaled using this event
+        // If aEvent.iErrorCode == KErrDied, dev policy kicked us out, if it is something else, some other error occurred
+        // audio-thread goes to stopped state before sending this
+        SetState( EStateReadyToRecord );
+        iObserver->MaroStateChange( State() );
+        iObserver->MaroError( aEvent.iErrorCode );
+        PRINT((_L("CCMRAudioRecorder::HandleEvent(), state changed to ready and error informed") ));
+        }
+    else if (aEvent.iErrorCode != KErrNone ) 
+        {
+        if ( aEvent.iErrorCode == KErrServerTerminated )
+            {
+            // audio thread terminated, no need to stop etc anything
+            PRINT((_L("CCMRAudioRecorder::HandleEvent(), audio thread terminated") ));
+            SetState( EStateNone );
+            iObserver->MaroError( aEvent.iErrorCode );
+            iObserver->MaroStateChange( State() );
+            }
+        else
+            {
+            // some other event, e.g. OOM
+            if ( (State() == EStateRecording) || (State() == EStatePaused) )
+                { 
+                // stop first
+                PRINT((_L("CCMRAudioRecorder::HandleEvent(), error received but must stop first") ));
+                iErrorCode = aEvent.iErrorCode;
+                if ( iThreadProxy.Stop() == KErrNone )
+                    {
+                    // wait until stopped
+                    iThreadProxy.WaitUntilStopped();
+                    // wait was sync, can proceed with error handling
+                    }
+                }
+            //inform observer about error
+            SetState( EStateNone );
+            iObserver->MaroError( aEvent.iErrorCode );
+            iObserver->MaroStateChange( State() );
+            PRINT((_L("CCMRAudioRecorder::HandleEvent(), state changed to ready and error informed") ));
+            }
+        }
+    else
+        {
+        // some event without an errorcode! Don't know if this is possible
+        }
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioThreadProxy.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio thread proxy classes
+*
+*/
+
+//INCLUDES
+#include "CCMRAudioThreadProxy.h"
+#include "CCMRAudioThreadProxyServer.h"
+#include "CCMRThreadPriorities.h"
+#include "CCMRAudioCodecs.h"
+
+#include <e32math.h>
+
+//MACROS
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+#define KCMRAudioThreadProxyVersion TVersion(1,0,0)
+
+
+
+// ========================= RCMRAudioThreadProxy MEMBER FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::CreateSubThread
+// Create thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::CreateSubThread(TBool& aThreadCreated)
+    {
+    PRINT((_L("RCMRAudioThreadProxy::CreateSubThread() in")));
+    //start the subthread with no name
+    
+    TInt error = DoCreateSubThread(&CCMRAudioThreadProxyServer::StartThread, KCMRAudioThreadProxyVersion, aThreadCreated);
+    if (error)
+        {
+        return error;
+        }
+
+    iSessionCreated = ETrue;
+
+    PRINT((_L("RCMRAudioThreadProxy::CreateSubThread() out")));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::SetOutput
+// Load datapath
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::SetOutput(CCMRActiveOutput* aOutputAO) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::SetOutput()")));
+    return SendReceive(ECMRAudioThreadSetOutput, TIpcArgs(aOutputAO, RThread().Id()));
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::AddDataSource
+// Add datasource
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::AddDataSource(MDataSource* aSource) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::AddDataSource()")));
+    return SendReceive(ECMRAudioThreadAddDataSource, TIpcArgs(aSource));
+    }
+    
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::SetConfigManager
+// Set config manager.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::SetConfigManager(CCMRConfigManager* aConfig) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::SetConfigManager()")));
+    return SendReceive( ECMRAudioThreadSetConfigManager, TIpcArgs(aConfig ));
+    }    
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::SetAudioCodec
+// Set used audio codec
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::SetAudioCodec(CCMRAudioCodecData* aAudioCodec) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::SetAudioCodec()")));
+
+    TCMRCodecType codecType = ECodecTypeNA;
+    TRAPD( err, codecType = aAudioCodec->GetCodecSWHWTypeL());
+    if ( err != KErrNone )
+        {
+        PRINT((_L("RCMRAudioThreadProxy::SetAudioCodec() GetCodecSWHWTypeL returned error %d"), err));
+        return err;
+        }
+
+    if ( codecType == ECodecTypeSW )
+        {
+        PRINT((_L("RCMRAudioThreadProxy::SetAudioCodec(), SW codec used, set thread priority to %d"),KCMRAudioThreadPrioritySWCodec));
+        iSubThread.SetPriority(KCMRAudioThreadPrioritySWCodec);
+        }
+    else
+        {
+        PRINT((_L("RCMRAudioThreadProxy::SetAudioCodec(), HW codec used, set thread priority to %d"),KCMRAudioThreadPriorityHWAccelarated));
+        iSubThread.SetPriority(KCMRAudioThreadPriorityHWAccelarated);
+        }
+
+    return SendReceive(ECMRAudioThreadSetAudioCodec, TIpcArgs(aAudioCodec));
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::GetThreadPriority
+// Get audio thread priority
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TThreadPriority RCMRAudioThreadProxy::GetThreadPriority() const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::GetThreadPriority()")));
+    return iSubThread.Priority();
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::SetPriority
+// Set audio priority
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::SetPriority(const TMMFPrioritySettings &aPrioritySettings) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::SetPriority()")));
+    return SendReceive(ECMRAudioThreadSetPriority, TIpcArgs(&aPrioritySettings));
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::SetGain
+// Set audio gain
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::SetGain(TInt aGain) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::SetGain()")));
+    return SendReceive(ECMRAudioThreadSetGain, TIpcArgs(aGain));
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::GetGain
+// Get audio gain
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::GetGain(TInt& aGain) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::GetGain()")));
+    return SendReceive(ECMRAudioThreadGetGain, TIpcArgs(&aGain));
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::MaxGain
+// Get max audio gain
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::MaxGain(TInt& aGain) const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::MaxGain()")));
+    return SendReceive(ECMRAudioThreadMaxGain, TIpcArgs(&aGain));
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::Prime
+// Prime datapath
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::Prime() const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::Prime()")));
+    return SendReceive(ECMRAudioThreadPrime);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::Play
+// Start playing (recording)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::Play() const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::Play()")));
+    return SendReceive(ECMRAudioThreadPlay);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::Pause
+// Pause datapath
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::Pause() const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::Pause()")));
+    return SendReceive(ECMRAudioThreadPause);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::Stop
+// Start stopping datapath
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::Stop() const
+    {
+    PRINT((_L("RCMRAudioThreadProxy::Stop()")));
+    return SendReceive(ECMRAudioThreadStop);
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::WaitUntilStopped
+// Wait until audio datapath has stopped
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRAudioThreadProxy::WaitUntilStopped()
+    {
+    PRINT((_L("RCMRAudioThreadProxy::WaitUntilStopped()")));
+    return SendReceive(ECMRAudioThreadWaitUntilStopped);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRAudioThreadProxy::Close
+// Close thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCMRAudioThreadProxy::Close()
+    {
+    PRINT((_L("RCMRAudioThreadProxy::Close() in")));
+    Shutdown();
+    PRINT((_L("RCMRAudioThreadProxy::Close() out")));
+    }
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioThreadProxyServer.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio thread proxy classes
+*
+*/
+
+
+//INCLUDES
+#include "CCMRAudioThreadProxyServer.h"
+#include "CCMRAudioThreadProxySession.h"
+
+#include <ecom/ecom.h>
+
+//MACROS
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+
+
+// ====================== CCMRAudioThreadProxyServer MEMBER FUNCTIONS =======================
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxyServer::CCMRAudioThreadProxyServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCMRAudioThreadProxyServer::CCMRAudioThreadProxyServer(TInt aPriority) :
+    CCMRThreadProxyServer(aPriority)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxyServer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRAudioThreadProxyServer* CCMRAudioThreadProxyServer::NewL(RServer2* aServer2)
+    {
+    CCMRAudioThreadProxyServer* self = new(ELeave) CCMRAudioThreadProxyServer(EPriorityHigh);
+    CleanupStack::PushL(self);
+    self->ConstructL(aServer2);
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxyServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioThreadProxyServer::ConstructL(RServer2* aServer2)
+    {
+    //just need to call baseclass's constructL here
+    CCMRThreadProxyServer::ConstructL(aServer2);
+    }
+
+// destructor
+CCMRAudioThreadProxyServer::~CCMRAudioThreadProxyServer()
+    {
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxyServer::NewSessionL
+// Create new session
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSession2* CCMRAudioThreadProxyServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
+    {
+    return CCMRAudioThreadProxySession::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxyServer::StartThread
+// Start server thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAudioThreadProxyServer::StartThread(TAny* aParam)
+    {
+    PRINT((_L("CCMRAudioThreadProxyServer::StartThread() in")));
+    TInt err = KErrNone;
+    //create cleanupstack
+    CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
+    if (!cleanup)
+        {
+        err = KErrNoMemory;
+        }
+    if (!err)
+        {
+        TRAP(err, DoStartThreadL(aParam));
+        }
+    delete cleanup;
+    PRINT((_L("CCMRAudioThreadProxyServer::StartThread() out")));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxyServer::DoStartThreadL
+// Start server thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioThreadProxyServer::DoStartThreadL(TAny* aParam)
+    {
+    PRINT((_L("CCMRAudioThreadProxyServer::DoStartThread() in")));
+    // create and install the active scheduler we need
+    CActiveScheduler* self=new(ELeave) CActiveScheduler;
+    CleanupStack::PushL(self);
+    CActiveScheduler::Install(self);
+    // create the server (leave it on the cleanup stack)
+    CleanupStack::PushL(CCMRAudioThreadProxyServer::NewL(static_cast<RServer2*>(aParam)));
+    // Initialisation complete, now signal the client
+    RThread::Rendezvous(KErrNone);
+    // Ready to run
+    CActiveScheduler::Start();
+    // Cleanup the server and scheduler
+    CleanupStack::PopAndDestroy(2);
+
+	REComSession::FinalClose();
+
+    PRINT((_L("CCMRAudioThreadProxyServer::DoStartThread() out")));
+    }
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioThreadProxySession.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,611 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio thread proxy classes
+*
+*/
+
+
+
+//INCLUDES
+#include "CCMRAudioThreadProxySession.h"
+#include "CCMRAudioCodecData.h"
+#include "CCMRAudioInputSW.h"
+#include "CCMRAudioInputHW.h"
+
+#include <mmf/server/mmfdatasource.h>
+#include <mmf/server/mmfaudioinput.h>
+
+//MACROS
+
+// Assertion macro wrapper for code cleanup
+#define APASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CCMRAUDIOTHREADPROXYSESSION"), EInternalAssertionFailure)) 
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// Timeout for pausing audioinput
+#if (defined __WINS__) || (defined __WINSCW__)
+const TInt KCMRPauseTimeout = 2000000;  // 2 seconds
+#else
+const TInt KCMRPauseTimeout = 1000000;  // 1 second
+#endif
+
+// ====================== CCMRAudioThreadProxySession MEMBER FUNCTIONS =====================
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRAudioThreadProxySession* CCMRAudioThreadProxySession::NewL()
+    {
+    return new(ELeave) CCMRAudioThreadProxySession();
+    }
+
+// destructor
+CCMRAudioThreadProxySession::~CCMRAudioThreadProxySession()
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::~CCMRAudioThreadProxySession() in")));
+    delete iPauseTimer;
+    iPauseTimer = NULL;
+
+    if ( iMMFAudioInput )
+        {
+        iMMFAudioInput->SourceThreadLogoff();
+        }
+
+    delete iAudioInput;
+
+    PRINT((_L("CCMRAudioThreadProxySession::~CCMRAudioThreadProxySession() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::ServiceL
+// Service messages
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioThreadProxySession::ServiceL(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::ServiceL() in")));
+    TBool complete = EFalse;
+    switch(aMessage.Function())
+        {
+    case ECMRAudioThreadSetOutput:
+        complete = SetOutputL(aMessage);
+        break;
+    case ECMRAudioThreadAddDataSource:
+        complete = AddDataSourceL(aMessage);
+        break;
+    case ECMRAudioThreadSetConfigManager:
+        complete = SetConfigManager(aMessage);
+        break;        
+    case ECMRAudioThreadSetPriority:
+        complete = SetPriorityL(aMessage);
+        break;
+    case ECMRAudioThreadSetGain:
+        complete = SetGainL(aMessage);
+        break;
+    case ECMRAudioThreadGetGain:
+        complete = GetGainL(aMessage);
+        break;
+    case ECMRAudioThreadMaxGain:
+        complete = MaxGainL(aMessage);
+        break;
+    case ECMRAudioThreadSetAudioCodec:
+        iMessage = const_cast<RMessage2*>(&aMessage);        
+        complete = SetAudioCodecL(aMessage);
+        break;
+    case ECMRAudioThreadPrime:
+        complete = PrimeL();
+        break;
+    case ECMRAudioThreadPlay:
+        complete = PlayL();
+        break;
+    case ECMRAudioThreadPause:
+		iMessage = const_cast<RMessage2*>(&aMessage);
+        complete = PauseL();
+        break;
+    case ECMRAudioThreadStop:
+        complete = StopL();
+        break;
+    case ECMRAudioThreadWaitUntilStopped:
+		iMessage = const_cast<RMessage2*>(&aMessage);
+        complete = CheckIfStoppedL();
+        break;
+    case ECMRThreadReceiveEvents:
+        complete = ReceiveEventsL(aMessage);//provided by baseclass
+        break;
+    case ECMRThreadCancelReceiveEvents:
+        complete = CancelReceiveEvents();//provided by baseclass
+        break;
+    case ECMRThreadShutdown:
+        complete = ShutDown();//provided by baseclass
+        break;
+    default:
+        PRINT((_L("CCMRAudioThreadProxySession::ServiceL() unknown msg")));
+        User::Leave(KErrNotSupported);
+        break;
+        }
+
+    if (complete)
+        {
+        aMessage.Complete(KErrNone);
+        }
+
+    PRINT((_L("CCMRAudioThreadProxySession::ServiceL() out")));
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::SetOutputL
+// Set output object and threadid & create a timer for pause/stop
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::SetOutputL(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::SetOutputL() in")));
+
+
+    if ( !iPauseTimer )
+        {
+        iPauseTimer = CCMRAudioPauseTimer::NewL(this);
+        }
+
+    iActiveOutput = reinterpret_cast<CCMRActiveOutput*>(aMessage.Int0());
+    iOutputThreadId = static_cast<TUint>(aMessage.Int1());
+
+    PRINT((_L("CCMRAudioThreadProxySession::SetOutputL() out")));
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::AddDataSourceL
+// Add datasource
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::AddDataSourceL(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::AddDataSourceL() in")));
+    iMMFAudioInput = reinterpret_cast<MDataSource*>(aMessage.Int0());
+
+    PRINT((_L("CCMRAudioThreadProxySession::AddDataSourceL() logon to MMFAudioInput; loads DevSound")));
+    iMMFAudioInput->SourceThreadLogon(*this);
+
+    PRINT((_L("CCMRAudioThreadProxySession::AddDataSourceL() out")));
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::SetConfigManager
+// Set config manager
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::SetConfigManager(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::SetConfigManager() in")));
+	iConfig = reinterpret_cast<CCMRConfigManager*>(aMessage.Int0());    
+    PRINT((_L("CCMRAudioThreadProxySession::SetConfigManager() out")));
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::SetPriorityL
+// Set audio priority
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::SetPriorityL(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::SetPriorityL()")));
+    APASSERT( iMMFAudioInput );
+
+    TMMFPrioritySettings* priority = reinterpret_cast<TMMFPrioritySettings*>(aMessage.Int0());
+    // set priority settings
+    iMMFAudioInput->SetSourcePrioritySettings(*priority);
+
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::SetGainL
+// Set audio gain
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::SetGainL(const RMessage2& aMessage)
+    {
+    APASSERT( iMMFAudioInput );
+
+    // Set gain of sound device
+    MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFAudioInput);
+    audioInput->SoundDevice().SetGain(aMessage.Int0());
+
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::GetGainL
+// Get audio gain
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::GetGainL(const RMessage2& aMessage)
+    {
+    APASSERT( iMMFAudioInput );
+
+    TInt* gain = reinterpret_cast<TInt*>(aMessage.Int0());
+    MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFAudioInput);
+    *gain = audioInput->SoundDevice().Gain();
+
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::MaxGainL
+// Get max audio gain
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::MaxGainL(const RMessage2& aMessage)
+    {
+    APASSERT( iMMFAudioInput );
+
+    TInt* gain = reinterpret_cast<TInt*>(aMessage.Int0());
+    MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFAudioInput);
+    *gain = audioInput->SoundDevice().MaxGain();
+
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::SetAudioCodecL
+// Set audio codec
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::SetAudioCodecL(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::SetAudioCodecL() in")));
+
+    iAudioCodec = reinterpret_cast<CCMRAudioCodecData *>(aMessage.Int0());
+
+    APASSERT( iMMFAudioInput );
+
+    iInitializingAudioCodec = ETrue;    
+    
+    if ( iAudioInput )
+        {
+        delete iAudioInput;
+        iAudioInput = NULL;
+        }
+
+    if ( iAudioCodec->GetCodecSWHWTypeL() == ECodecTypeSW )
+        {
+        // SW codec in use; create our own source and give the MMFAudioInput source for it
+        iAudioInput = CCMRSWAudioInput::NewL( iMMFAudioInput, iActiveOutput, iOutputThreadId, *this, iConfig );
+        }
+    else
+        {
+        // HW codec in use; create our own source and give the MMFAudioInput source for it
+        iAudioInput = CCMRHWAudioInput::NewL( iMMFAudioInput, iActiveOutput, iOutputThreadId, *this, iConfig );
+        }
+
+    iAudioInput->SetCodecL( iAudioCodec );
+
+    PRINT((_L("CCMRAudioThreadProxySession::SetAudioCodecL() out, iAudioCodec 0x%x, waiting InitializeComplete"), iAudioCodec));
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::PrimeL
+// Prime thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::PrimeL()
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::PrimeL() in")));
+    APASSERT( iMMFAudioInput && iAudioInput && iAudioCodec );
+
+    // config audio codec
+    iAudioInput->ConfigureCodecL();
+
+    iAudioInput->SourcePrimeL();
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::PlayL
+// Start/continue playing (recording)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::PlayL()
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::PlayL()")));
+    APASSERT( iMMFAudioInput && iAudioInput && iAudioCodec );
+
+    iAudioInput->SourceRecordL();
+    iPaused = EFalse;
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::PauseL
+// Pause audio thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::PauseL()
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::PauseL()")));
+    iPausingRecording = ETrue;
+    iAudioInput->SourcePauseL();
+    if ( iPausingRecording )    // could have been set to EFalse in a callback from SourcePauseL
+        {
+        // did not pause synchronously, set timer for pause; start by canceling possible previous timer
+        iPauseTimer->Cancel();
+        iPauseTimer->After(KCMRPauseTimeout); 
+        }
+
+    return EFalse;   
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::StopL
+// Stop audio thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::StopL()
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::StopL()")));
+    APASSERT( iMMFAudioInput && iAudioInput && iAudioCodec );
+
+    iWaitingForStop = EFalse;
+    if ( iPaused )
+        {
+        PRINT((_L("CCMRAudioThreadProxySession::StopL() already paused => also stopped")));
+        // we are paused and hence also stopped => no callback coming => operation completed immediately
+        iPaused = EFalse;
+
+        // now we really stopped, not just paused, reset audio timestamp
+        iAudioInput->ResetTimeStamp();
+
+        return ETrue; // complete msg anyway
+        }
+    else
+        {
+        PRINT((_L("CCMRAudioThreadProxySession::StopL() starting with pause first")));
+        iStoppingRecording = ETrue;
+        iAudioInput->SourcePauseL();// stop will be called in the callback
+        if ( iStoppingRecording ) // could have been set to EFalse in a callback from SourcePauseL
+            {
+            // did not stop synchronously, set timer for pause; start by canceling possible previous timer
+            iPauseTimer->Cancel();
+            iPauseTimer->After(KCMRPauseTimeout);
+            }
+
+        PRINT((_L("CCMRAudioThreadProxySession::StopL() out")));
+        return ETrue; // complete msg anyway
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::CheckIfStoppedL
+// Check if we have stopped. If not, message is not completed and client keeps waiting. 
+// Msg is in this case completed in SendEventToClient
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRAudioThreadProxySession::CheckIfStoppedL()
+    {
+    if ( !iStoppingRecording )
+        {
+        PRINT((_L("CCMRAudioThreadProxySession::CheckIfStoppedL() stopped already")));
+        return ETrue;
+        }
+    else
+        {
+        PRINT((_L("CCMRAudioThreadProxySession::CheckIfStoppedL() not stopped yet, start waiting")));
+        iWaitingForStop = ETrue;
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxySession::SendEventToClient
+// Catches completion events and sends other events to client using base class
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRAudioThreadProxySession::SendEventToClient(const TMMFEvent& aEvent)
+    {
+    if ( iInitializingAudioCodec )
+        {
+        iInitializingAudioCodec = EFalse;
+        TInt errorToClient = aEvent.iErrorCode;
+        iMessage->Complete( errorToClient );
+        return KErrNone;        
+        }
+    else if ( iStoppingRecording )
+        {
+        // Normally we come here if aEvent.iEventType == KMMFEventCategoryPlaybackComplete, signaled by audioinput.
+        // or if pausetimer timeouts
+        // note that if aEvent.iEventType != KMMFEventCategoryPlaybackComplete we should stop still since it indicates problems
+
+        // stopped
+        iStoppingRecording = EFalse;
+
+        // cancel the timer
+        iPauseTimer->Cancel();
+
+        TInt errorToClient = aEvent.iErrorCode;
+
+        TRAPD(error,iAudioInput->SourceStopL());
+
+        if ( (error != KErrNone) && (errorToClient == KErrNone) )
+            {
+            errorToClient = error;
+            }
+            // if errorToClient != KErrNone we are handling an error already
+
+        // prime also just in case; to make sure that state is correct before new play
+        TRAP(error,iAudioInput->SourcePrimeL());
+        if ( (error != KErrNone) && (errorToClient == KErrNone) )
+            {
+            errorToClient = error;
+            }
+            // if errorToClient != KErrNone we are handling an error already
+        
+        // release the client from waiting
+        if ( iWaitingForStop )
+            {
+            iMessage->Complete( errorToClient );
+            iWaitingForStop = EFalse;
+            }
+
+        // now we really stopped, not just paused, reset audio timestamp
+        iAudioInput->ResetTimeStamp();
+
+        PRINT((_L("CCMRAudioThreadProxySession::SendEventToClient() stopping completed")));
+
+        return KErrNone;
+        }
+    else if ( iPausingRecording )
+        {
+        // Normally we come here if aEvent.iEventType == KMMFEventCategoryPlaybackComplete, signaled by audioinput.
+        // or if pausetimer timeouts
+        // note that if aEvent.iEventType != KMMFEventCategoryPlaybackComplete we should stop still since it indicates problems
+
+        // paused
+        PRINT((_L("CCMRAudioThreadProxySession::SendEventToClient() pausing completed, informing client")));
+        iPausingRecording = EFalse;
+        iPaused = ETrue;
+
+        // cancel the timer
+        iPauseTimer->Cancel();
+
+        TInt errorToClient = aEvent.iErrorCode;
+
+        // stop & prime also just in case; to make sure that state is correct before resume
+        TRAPD( error, iAudioInput->SourceStopL());
+        if ( (error != KErrNone) && (errorToClient == KErrNone) )
+            {
+            errorToClient = error;
+            }
+            // if errorToClient != KErrNone we are handling an error already
+
+        TRAP(error,iAudioInput->SourcePrimeL());
+        if ( (error != KErrNone) && (errorToClient == KErrNone) )
+            {
+            errorToClient = error;
+            }
+            // if errorToClient != KErrNone we are handling an error already
+
+        // release the client from waiting
+        iMessage->Complete( errorToClient );
+        return KErrNone;
+        }
+    else
+        {
+        if ( aEvent.iErrorCode != KErrNone )
+            {
+            // audioinput informed error & stopped operation, make sure also our CCMRAudioInput is stopped
+            PRINT((_L("CCMRAudioThreadProxySession::SendEventToClient() error received, stop audioinput immediately before informing client, %d"),aEvent.iErrorCode));
+            TRAPD(error, iAudioInput->SourceStopL());
+            TRAP(error, iAudioInput->SourcePrimeL());
+            // ignore error, we are already reporting an error here.
+
+            // now we really stopped, not just paused, reset audio timestamp
+            iAudioInput->ResetTimeStamp();
+            }
+
+        // call base class implementation
+        return CCMRThreadProxySession::SendEventToClient( aEvent );
+        }
+    }
+
+
+
+
+// destructor
+CCMRAudioThreadProxySession::CCMRAudioPauseTimer::~CCMRAudioPauseTimer()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::CCMRAudioPauseTimer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRAudioThreadProxySession::CCMRAudioPauseTimer* CCMRAudioThreadProxySession::CCMRAudioPauseTimer::NewL(CCMRAudioThreadProxySession* aHost)
+    {
+    CCMRAudioPauseTimer* self = new(ELeave) CCMRAudioPauseTimer(aHost);
+    CleanupStack::PushL(self);
+    self->ConstructL ();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::CCMRAudioPauseTimer::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioThreadProxySession::CCMRAudioPauseTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::CCMRAudioPauseTimer::RunL
+// Calls CCMRAudioThreadProxySession::SendEventToClient since audioinput has not called it in time
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioThreadProxySession::CCMRAudioPauseTimer::RunL()
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::CCMRAudioPauseTimer::RunL() in")));
+    TMMFEvent event(KMMFEventCategoryPlaybackComplete, KErrNone);
+    iHost->SendEventToClient( event );
+    PRINT((_L("CCMRAudioThreadProxySession::CCMRAudioPauseTimer::RunL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRAudioThreadProxySession::CCMRAudioPauseTimer::DoCancel
+// Cancels the timer
+// -----------------------------------------------------------------------------
+//
+void CCMRAudioThreadProxySession::CCMRAudioPauseTimer::DoCancel()
+    {
+    PRINT((_L("CCMRAudioThreadProxySession::CCMRAudioPauseTimer::DoCancel() in")));
+    // cancel the timer
+    CTimer::DoCancel();
+    PRINT((_L("CCMRAudioThreadProxySession::CCMRAudioPauseTimer::DoCancel() out")));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRConfigManager.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Config manager for Media recorder
+*
+*/
+
+
+#include <e32base.h>
+#include "CCMRConfigManager.h"
+#include "CCMRVideoHWParams.h"
+#include "CCMRSupportedCodecs.h"
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CCMRConfigManager::CCMRConfigManager()
+// Default constructor.
+// ---------------------------------------------------------------------------
+//
+CCMRConfigManager::CCMRConfigManager()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCMRConfigManager::ConstructL()
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+void CCMRConfigManager::ConstructL()
+    {
+	PRINT(_L("CCMRConfigManager::ConstructL in"));   
+	iICMDataAvailable = EFalse;
+	 
+	TInt icmError = KErrNone;
+	TRAP(icmError, iImagingConfigManager = CImagingConfigManager::NewL());
+	if ( icmError )
+		{
+		// if ICM values cannot be read from central reposity or ICM is not available.
+		PRINT((_L("CCMRConfigManager::ConstructL ICM initialization failed - using old default values. %d"), icmError));		
+		}
+	else
+		{
+		PRINT((_L("CCMRConfigManager::ConstructL ICM initialized")));
+		}
+	
+	if ( icmError == KErrNone )
+		{
+		PRINT(_L("CCMRConfigManager::ConstructL reading plugin settings."));    		
+		iImagingConfigManager->GetCamcorderMMFPluginSettings(iPluginSettings); 
+		PRINT(_L("CCMRConfigManager::ConstructL plugin settings read."));    	
+		}
+	else
+		{
+		PRINT(_L("CCMRConfigManager::ConstructL ICM init failed - using old defaults instead."));
+		iPluginSettings.iVideoNightFrameRate = KCMRNightModeFrameRate;
+		iPluginSettings.iCMRAvgVideoBitRateScaler = KCMRAvgVideoBitRateScaler;
+		iPluginSettings.iVideoComplexitySetting = KCMRVideoComplexityARMSubQCIF;
+		iPluginSettings.iCMRLatencyQualityTradeoff = KCMRLatencyQyalityTradeoff;
+		iPluginSettings.iCMRPictureQuality = KCMRPictureQuality;
+		iPluginSettings.iCMRQualityTemporalTradeoff = KCMRQualityTemporalTradeoff;
+		iPluginSettings.iCMRNumCameraBuffers = KCMRNumCameraBuffers;
+		iPluginSettings.iCMRNumCameraBuffersARM	= KCMRNumCameraBuffersARM;	
+		iPluginSettings.iCMRMinNumOutputBuffers = KCMRMinNumOutputBuffers;
+		}
+		
+	// set some reasonable defaults for Video Quality set.
+	iVideoFrameSize = TSize(KCMRQCIFWidth, KCMRQCIFHeight);
+    iVideoCodec = KCMRMimeTypeH263;
+    iAudioCodec = KCMRFourCCIdAMRNB;
+    iVideoPixelAspectRatioNum = KCMRAspectRatioNum;
+    iVideoPixelAspectRatioDenom = KCMRAspectRatioDenom;
+		
+	ResetVideoQualitySet();
+		
+	PRINT(_L("CCMRConfigManager::ConstructL out"));   		
+    }
+
+// ---------------------------------------------------------------------------
+// CCMRConfigManager::NewL()
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCMRConfigManager* CCMRConfigManager::NewL()
+    {
+	PRINT(_L("CCMRConfigManager::NewL in"));    
+    CCMRConfigManager* self = CCMRConfigManager::NewLC();
+    CleanupStack::Pop( self );
+    PRINT(_L("CCMRConfigManager::NewL out"));    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCMRConfigManager::NewLC()
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCMRConfigManager* CCMRConfigManager::NewLC()
+    {
+	PRINT(_L("CCMRConfigManager::NewLC in"));    
+    CCMRConfigManager* self = new( ELeave ) CCMRConfigManager;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+	PRINT(_L("CCMRConfigManager::NewLC out"));        
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCMRConfigManager::~CCMRConfigManager
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCMRConfigManager::~CCMRConfigManager()
+    {
+	PRINT(_L("CCMRConfigManager::~CCMRConfigManager in"));     
+   	delete iImagingConfigManager;
+	PRINT(_L("CCMRConfigManager::~CCMRConfigManager out"));        	
+    }
+
+// ---------------------------------------------------------------------------
+// Set video codec mime type.
+// ---------------------------------------------------------------------------
+//    
+void CCMRConfigManager::SetVideoCodec(TDesC8& aVideoCodec)
+	{
+	PRINT((_L("CCMRConfigManager::SetVideoCodec() in")));	
+	if (iVideoCodec != aVideoCodec)
+		{
+		iVideoCodec = aVideoCodec;
+		ResetVideoQualitySet();		
+		}
+	else
+		{
+		PRINT((_L("CCMRConfigManager::SetVideoCodec() already using given codec")));		
+		}
+	PRINT((_L("CCMRConfigManager::SetVideoCodec() out")));				
+	}
+
+// ---------------------------------------------------------------------------
+// Set audio codec mime type (TFourCC).
+// ---------------------------------------------------------------------------
+//
+void CCMRConfigManager::SetAudioCodec(TFourCC& aAudioCodec)
+	{
+	PRINT((_L("CCMRConfigManager::SetAudioCodec() in")));	
+	if ( iAudioCodec.FourCC() != aAudioCodec.FourCC() )
+		{
+		PRINT((_L("CCMRConfigManager::SetAudioCodec() 1")));		
+		iAudioCodec.Set(aAudioCodec);
+		PRINT((_L("CCMRConfigManager::SetAudioCodec() 2")));		
+		ResetVideoQualitySet();		
+		}
+	else
+		{
+		PRINT((_L("CCMRConfigManager::SetAudioCodec() already using given codec")));		
+		}
+	PRINT((_L("CCMRConfigManager::SetAudioCodec() out")));				
+	}
+
+// ---------------------------------------------------------------------------
+// Set video frame size.
+// ---------------------------------------------------------------------------
+// 
+void CCMRConfigManager::SetVideoFrameSize(TSize aVideoFrameSize)
+	{
+	PRINT((_L("CCMRConfigManager::SetVideoFrameSize() in, width: %d, height: %d"), aVideoFrameSize.iWidth, aVideoFrameSize.iHeight));			
+	if (iVideoFrameSize != aVideoFrameSize)
+		{
+		iVideoFrameSize = aVideoFrameSize;
+		ResetVideoQualitySet();		
+		}
+	else
+		{
+		PRINT((_L("CCMRConfigManager::SetVideoFrameSize() already using given size")));		
+		}
+	PRINT((_L("CCMRConfigManager::SetVideoFrameSize() out")));		
+	}
+ 
+// ---------------------------------------------------------------------------
+// Set video pixel aspect ratio.
+// ---------------------------------------------------------------------------
+//
+void CCMRConfigManager::SetVideoPixelAspectRatio(TUint aNumerator, TUint aDenominator)
+	{
+	PRINT((_L("CCMRConfigManager::SetVideoPixelAspectRatio() in, num: %d, denom: %d"), aNumerator, aDenominator));	
+	if ((iVideoPixelAspectRatioNum != aNumerator) ||
+		(iVideoPixelAspectRatioDenom != aDenominator) )
+		{
+		iVideoPixelAspectRatioNum = aNumerator;
+		iVideoPixelAspectRatioDenom = aDenominator;
+		ResetVideoQualitySet();		
+		}
+	else
+		{
+		PRINT((_L("CCMRConfigManager::SetVideoPixelAspectRatio() already using given pixel aspect ratio")));		
+		}
+	PRINT((_L("CCMRConfigManager::SetVideoPixelAspectRatio() out")));		
+	}
+
+// ---------------------------------------------------------------------------
+// Query whether Imaging Configuration data is available
+// ---------------------------------------------------------------------------
+//
+TBool CCMRConfigManager::IsICMConfigDataAvailable() const
+	{
+	PRINT((_L("CCMRConfigManager::IsICMConfigDataAvailable(): %d"), iICMDataAvailable));		
+	return iICMDataAvailable;
+	}
+
+// ---------------------------------------------------------------------------
+// Get CamcorderMMFPlugin specific settings.
+// ---------------------------------------------------------------------------
+//
+const TCamcorderMMFPluginSettings CCMRConfigManager::PluginSettings() const
+    {
+    PRINT((_L("CCMRConfigManager::PluginSettings() being used.")));
+    return iPluginSettings;
+    }
+    
+// ---------------------------------------------------------------------------
+//  Get Video Quality settings.
+// ---------------------------------------------------------------------------
+//
+const TVideoQualitySet CCMRConfigManager::VideoQualitySettings() const
+    {
+	PRINT((_L("CCMRConfigManager::VideoQualitySettings() being used.")));    
+    return iActiveVideoQualitySet;
+    }    
+
+// ---------------------------------------------------------------------------
+// Resets config manager to new Video Quality set.
+// ---------------------------------------------------------------------------
+//
+void CCMRConfigManager::ResetVideoQualitySet()
+	{
+	PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() in")));					
+    if ( iImagingConfigManager )
+	    {
+	    TVideoQualitySet newQualitySet;
+	    PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() getting Video Quality Set from ICM.")));
+	    TInt error = iImagingConfigManager->GetVideoQualitySet( newQualitySet,
+	                 			                  			   	iVideoFrameSize,
+	                             			     			   	iVideoCodec,
+	                                  						   	iVideoPixelAspectRatioNum,
+	                                  			   				iVideoPixelAspectRatioDenom,
+	                                  			   				iAudioCodec,
+	                                  			   				0 );	// aCameraDisplayID, 0 = ignore and use default.
+	    PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() ICM error: %d"), error));	                                  			   				
+	                                  			
+		// Test if we get valid data   
+		if ( error == KErrNone)
+			{
+			iActiveVideoQualitySet = newQualitySet;
+			iICMDataAvailable = ETrue;
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() Video quality set reset, new settings:")));			
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iVideoQualitySetLevel: %d "), iActiveVideoQualitySet.iVideoQualitySetLevel ));
+#ifdef _DEBUG
+			RDebug::Printf("CCMRConfigManager::ResetVideoQualitySet() iVideoFileMimeType: %s ", iActiveVideoQualitySet.iVideoFileMimeType );
+			RDebug::Printf("CCMRConfigManager::ResetVideoQualitySet() iVideoCodecMimeType: %s ", iActiveVideoQualitySet.iVideoCodecMimeType );
+#endif
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iVideoWidth: %d, iVideoHeight: %d "), iActiveVideoQualitySet.iVideoWidth, iActiveVideoQualitySet.iVideoHeight ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iVideoFrameRate: %f "), iActiveVideoQualitySet.iVideoFrameRate ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iVideoBitRate: %d "), iActiveVideoQualitySet.iVideoBitRate ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iVideoEncoderUID: %d "), iActiveVideoQualitySet.iVideoEncoderUID.iUid ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iRandomAccessRate: %f "), iActiveVideoQualitySet.iRandomAccessRate ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iVideoPixelAspectRatio Num: %d, Denom: %d "), iActiveVideoQualitySet.iVideoPixelAspectRatioNum, iActiveVideoQualitySet.iVideoPixelAspectRatioDenom ));
+#ifdef _DEBUG			
+			RDebug::Printf("CCMRConfigManager::ResetVideoQualitySet() iPreferredSupplier: %s ", iActiveVideoQualitySet.iPreferredSupplier);
+#endif			
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iAudioFourCCType: %d "), iActiveVideoQualitySet.iAudioFourCCType.FourCC() ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iAudioBitRate: %d "), iActiveVideoQualitySet.iAudioBitRate ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iAudioSamplingRate: %d "), iActiveVideoQualitySet.iAudioSamplingRate ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iAudioChannels: %d "), iActiveVideoQualitySet.iAudioChannels ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iAudioEncoderUID: %d "), iActiveVideoQualitySet.iAudioEncoderUID.iUid ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iAVSyncStartDelay: %d "), iActiveVideoQualitySet.iAVSyncStartDelay ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iAVSyncResumeDelay: %d "), iActiveVideoQualitySet.iAVSyncResumeDelay ));
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iCameraDisplayId: %d "), iActiveVideoQualitySet.iCameraDisplayId ));																														
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() iCamcorderVisible: %d "), iActiveVideoQualitySet.iCamcorderVisible ));				
+			}
+		else
+			{
+			PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() matching video quality set not found from ICM or ICM error")));
+			iICMDataAvailable = EFalse;
+			}
+	    }
+	else
+		{
+		PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() ICM not available")));
+		iICMDataAvailable = EFalse;
+		}	 
+	PRINT((_L("CCMRConfigManager::ResetVideoQualitySet() out")));							   
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRFifo.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class to handle buffers in fifo
+*
+*/
+
+
+// INCLUDE FILES
+#include "CCMRFifo.h"
+
+// CLASS DECLARATION
+
+/**
+*  Fifo item, internal class used only by class CCMRFifo
+*  @lib camcmediarecorder.lib
+*  @since 2.1
+*/
+class CCMRFifoItem : public CBase
+    {
+    
+    public:
+        
+        /**
+        * C++ default constructor.
+        */
+        CCMRFifoItem();
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCMRFifoItem* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCMRFifoItem();
+        
+    public:  // New functions
+        
+        /**
+        * Return the data pointer
+        * @since 2.1
+        * @return TAny*     Reference to data
+        */
+        const TAny* Data() const;
+
+        /**
+        * Return the data pointer
+        * @since 2.1
+        * @param TAny* 
+        */
+        void SetData(const TAny* aData);
+
+    private:    // Data
+    
+        TSglQueLink     iNext;   // link to next element
+        const TAny* iData;   // pointer to stored data
+
+    private:  // Friend classes
+        friend class CCMRFifo;
+        
+    };
+
+// ================= MEMBER FUNCTIONS =======================
+
+// CCMRFifoItem
+
+// ---------------------------------------------------------
+// CCMRFifoItem::CCMRFifoItem
+// Default constructor
+// ---------------------------------------------------------
+//
+CCMRFifoItem::CCMRFifoItem()
+    {
+    }
+
+// ---------------------------------------------------------
+// CCMRFifoItem::NewL
+// "Two-phased" constructor
+// ---------------------------------------------------------
+//
+CCMRFifoItem* CCMRFifoItem::NewL()
+    {
+    CCMRFifoItem* self = new (ELeave) CCMRFifoItem();
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CCMRFifoItem::~CCMRFifoItem
+// Destructor
+// ---------------------------------------------------------
+//
+CCMRFifoItem::~CCMRFifoItem()
+    {
+    iData = NULL;
+    }
+
+// ---------------------------------------------------------
+// CCMRFifoItem::Data()
+// Returns the data pointer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+const TAny* CCMRFifoItem::Data() const
+    {
+    return iData;
+    }
+
+// ---------------------------------------------------------
+// CCMRFifoItem::SetData()
+// Sets the data pointer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRFifoItem::SetData(const TAny* aData)
+    {
+    iData = aData;
+    }
+
+
+
+
+// CCMRFifo
+
+// ---------------------------------------------------------
+// CCMRFifo::CCMRFifo
+// Default constructor
+// ---------------------------------------------------------
+//
+CCMRFifo::CCMRFifo() : 
+    iFifo( _FOFF(CCMRFifoItem,iNext) ), 
+        iIter(iFifo), 
+        iFifoEmpty( _FOFF(CCMRFifoItem,iNext) ), 
+        iIterEmpty(iFifoEmpty), 
+        iNumDataItemsStored(0) 
+    { 
+    }
+
+
+// ---------------------------------------------------------
+// CMRFifo::NewL
+// "Two-phased" constructor
+// ---------------------------------------------------------
+//
+CCMRFifo* CCMRFifo::NewL(TInt aNumItems)
+    {
+    CCMRFifo* self = new (ELeave) CCMRFifo();
+    CleanupStack::PushL(self);
+    self->ConstructL( aNumItems );
+    CleanupStack::Pop(1);
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CMRFifo::ConstructL
+// 2nd phase constructor
+// ---------------------------------------------------------
+//
+void CCMRFifo::ConstructL(TInt aNumItems)
+    {
+    TInt i;
+    CCMRFifoItem* item;
+
+    for ( i = 0; i < aNumItems; i++ )
+        {
+        item = CCMRFifoItem::NewL();
+        iFifoEmpty.AddLast(*item);
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRFifo::~CCMRFifo
+// Destructor
+// ---------------------------------------------------------
+//
+CCMRFifo::~CCMRFifo()
+    {
+    CCMRFifoItem*  item;
+
+    iIter.SetToFirst();     // rewind
+
+    // delete all items
+    while ((item = iIter++) != NULL)
+        {
+        iFifo.Remove(*item);
+        delete item;
+        }
+
+    iIterEmpty.SetToFirst();     // rewind
+
+    // delete all items
+    while ((item = iIterEmpty++) != NULL)
+        {
+        iFifoEmpty.Remove(*item);
+        delete item;
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRFifo::Get
+// Returns the first element and removes it from fifo
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TAny* CCMRFifo::Get()
+    {
+
+    CCMRFifoItem* firstItem;
+    if (iFifo.IsEmpty())
+        {
+        return NULL;
+        }
+
+    firstItem = iFifo.First();
+    iFifo.Remove(*firstItem);  // remove
+    iNumDataItemsStored--;
+    iFifoEmpty.AddLast(*firstItem);
+    return (const_cast<TAny*>(firstItem->Data()));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRFifo::PutL
+// Puts an element to the fifo
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRFifo::PutL(TAny* aData)
+    {
+    CCMRFifoItem* item;
+    if (iFifoEmpty.IsEmpty())
+        {
+        //allocate a new
+        item = CCMRFifoItem::NewL();
+        }
+    else
+        {
+        item = iFifoEmpty.First();
+        iFifoEmpty.Remove(*item);  // remove
+        }
+
+    item->SetData(aData);
+    iFifo.AddLast(*item);  // add
+    iNumDataItemsStored++;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRFifo::IsEmpty()
+// Is it empty ?
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CCMRFifo::IsEmpty()
+    {
+    return iFifo.IsEmpty(); // is it empty ?
+    }
+
+// ---------------------------------------------------------
+// CCMRFifo::NumberOfItems()
+// Number of items stored in fifo
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CCMRFifo::NumberOfItems()
+    {
+    return iNumDataItemsStored;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRFrameBuffer.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCMRFrameBuffer.cpp
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <fbs.h>                            // For CFbsBitmap
+#include "CCMRFrameBuffer.h"
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRFrameBuffer::CCMRFrameBuffer
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRFrameBuffer::CCMRFrameBuffer() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRFrameBuffer::~CCMRFrameBuffer
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCMRFrameBuffer::~CCMRFrameBuffer()
+    {
+    PRINT(( _L( "CCMRFrameBuffer::~CCMRFrameBuffer() entering" ) ));
+
+    if ( iCameraBuffer )
+        {
+        iCameraBuffer->Release();
+        }
+
+    PRINT(( _L( "CCMRFrameBuffer::~CCMRFrameBuffer() returning" ) ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRFrameBuffer::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// -----------------------------------------------------------------------------
+//
+void CCMRFrameBuffer::ConstructL( MCameraBuffer* aCameraBuffer )
+    {
+    PRINT(( _L( "CCMRFrameBuffer::ConstructL() entering" ) ));
+    
+    iCameraBuffer = aCameraBuffer;
+    if ( aCameraBuffer )
+        {
+        iIndexOfFirstFrameInBuffer = aCameraBuffer->iIndexOfFirstFrameInBuffer;
+        iElapsedTime = aCameraBuffer->iElapsedTime;
+        }
+        
+    PRINT(( _L( "CCMRFrameBuffer::ConstructL() returning" ) ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRFrameBuffer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRFrameBuffer* CCMRFrameBuffer::NewL( MCameraBuffer* aCameraBuffer )
+    {
+    PRINT(( _L( "CCMRFrameBuffer::NewL() entering, aCameraBuffer=%x" ), aCameraBuffer ));
+
+    CCMRFrameBuffer* self = new( ELeave ) CCMRFrameBuffer();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aCameraBuffer );
+    CleanupStack::Pop( self );
+
+    PRINT(( _L( "CCMRFrameBuffer::NewL() returning" ) ));
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRFrameBuffer::DataL
+// -----------------------------------------------------------------------------
+//
+TDesC8* CCMRFrameBuffer::DataL(TInt aIndex)
+    {
+    PRINT(( _L( "CCMRFrameBuffer::DataL() entering" ) ));
+    TDesC8* data = NULL;
+    if ( iCameraBuffer )
+        {
+        data = iCameraBuffer->DataL( aIndex );
+        iIndexOfFirstFrameInBuffer = iCameraBuffer->iIndexOfFirstFrameInBuffer;
+        iElapsedTime = iCameraBuffer->iElapsedTime;
+        }
+    PRINT(( _L( "CCMRFrameBuffer::DataL() returning" ) ));
+    return data;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRFrameBuffer::FrameL
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CCMRFrameBuffer::FrameL(TInt aIndex)
+    {
+    PRINT(( _L( "CCMRFrameBuffer::FrameL() entering" ) ));
+    CFbsBitmap* data = NULL;
+    if ( iCameraBuffer )
+        {
+        data = &iCameraBuffer->BitmapL( aIndex );
+        iIndexOfFirstFrameInBuffer = iCameraBuffer->iIndexOfFirstFrameInBuffer;
+        iElapsedTime = iCameraBuffer->iElapsedTime;
+        }
+    PRINT(( _L( "CCMRFrameBuffer::FrameL() returning" ) ));
+    return data;
+    }
+   
+// -----------------------------------------------------------------------------
+// CCMRFrameBuffer::Release
+// -----------------------------------------------------------------------------
+//
+void CCMRFrameBuffer::Release()
+    {
+    PRINT(( _L( "CCMRFrameBuffer::Release() entering" ) ));
+    if ( iCameraBuffer )
+        {
+        iCameraBuffer->Release();
+        iCameraBuffer = 0;
+        iIndexOfFirstFrameInBuffer = 0;
+        iElapsedTime = 0;
+        }
+    PRINT(( _L( "CCMRFrameBuffer::Release() returning" ) ));
+    delete this;
+    }
+
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRMDFVideoRecorder.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4238 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for video recorder
+*
+*/
+
+
+// INCLUDE FILES
+#include "mmf/common/mmfbase.h"
+#include "CCMRRecorderBase.h"
+#include "CCMRVideoSettings.h"      // default video settings
+#include "CCMRSupportedCodecs.h"
+#include "CCMRVideoHWParams.h"
+#include "CCMRVideoRecorder.h"
+#include "CCMRMediaRecorder.h"      // for bitrate control mode
+#include "CCMRVideoThreadProxy.h"
+#include "CCMRFifo.h"
+#include "CCMRActiveOutput.h"
+#include "CCMRVideoCodecDataH263.h"
+#include "CCMRVideoCodecDataMPEG4.h"
+#include "CCMRVideoCodecDataH264AVC.h"
+#include <mmf/common/mmfvideo.h>
+
+/*
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CCMRMDFVideoRecorderTraces.h"
+#endif
+*/
+
+// MACROS
+// Assertion macro wrapper for code cleanup
+#define VRASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CCMRMDFVIDEORECORDER"), EInternalAssertionFailure))
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// convertFrameRateToInterval Converts framerate to frame time interval
+// (time between 2 consecutive frames).
+// Returns: TInt time between 2 consecutive frames
+// -----------------------------------------------------------------------------
+//
+static TInt convertFrameRateToInterval(TReal32 aFrameRate)
+    {
+    return (TInt(1E6/aFrameRate + 0.5));
+    }
+
+
+// -----------------------------------------------------------------------------
+// convertFrameRateToInterval Converts framerate to frame time interval
+// (time between 2 consecutive frames).
+// Returns: TInt time between 2 consecutive frames
+// -----------------------------------------------------------------------------
+//
+static TInt TLinearOrderFuncVideoSizeRate(const TPictureRateAndSize& aPictureRateAndSize1,
+										  const TPictureRateAndSize& aPictureRateAndSize2 )
+	{
+	if ( (aPictureRateAndSize1.iPictureSize.iWidth == aPictureRateAndSize2.iPictureSize.iWidth) &&
+		 (aPictureRateAndSize1.iPictureSize.iHeight == aPictureRateAndSize2.iPictureSize.iHeight) &&
+		 (aPictureRateAndSize1.iPictureRate == aPictureRateAndSize2.iPictureRate) )
+		{
+		return 0;
+		}
+
+	if ( (aPictureRateAndSize1.iPictureSize.iWidth < aPictureRateAndSize2.iPictureSize.iWidth) ||
+		 (aPictureRateAndSize1.iPictureSize.iHeight < aPictureRateAndSize2.iPictureSize.iHeight) ||
+		 (aPictureRateAndSize1.iPictureRate < aPictureRateAndSize2.iPictureRate))
+		{
+		return -1;
+		}
+	else
+		{
+		return 1;
+		}
+	}
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+CCMRVideoRecorder* CCMRVideoRecorder::NewL(MAsyncEventHandler& aEventHandler, CCMRConfigManager* aConfig )
+    {
+    PRINT((_L("CCMRVideoRecorder::NewL(), In: MDF")))
+
+    CCMRVideoRecorder* self = new (ELeave) CCMRVideoRecorder(aEventHandler);
+    CleanupStack::PushL( self );
+    self->ConstructL(aConfig);
+    CleanupStack::Pop();
+
+    PRINT((_L("CCMRVideoRecorder::NewL(), Out: MDF")))
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::ConstructL(CCMRConfigManager* aConfig)
+    {
+    PRINT((_L("CCMRVideoRecorder::ConstructL(), In")))
+
+    SetState(EStateNone);
+
+    iConfig = aConfig;
+    iNumCameraBuffers = iConfig->PluginSettings().iCMRNumCameraBuffers;
+    // Create input fifo
+    iSourceFifo = CCMRFifo::NewL(iNumCameraBuffers);
+    iCodingFifo = CCMRFifo::NewL(iNumCameraBuffers);
+
+    iOutputSinkBuffer = new (ELeave) CCMRMediaBuffer;
+
+    iSizeIndex = -1;
+    iSizeIndex420 = -1;
+    iSizeIndex422 = -1;
+    iSizeIndexDCEncoder = -1;
+    iRateIndex = -1;
+    iRateIndex420 = -1;
+    iRateIndex422 = -1;
+    iRateIndexDCEncoder = -1;
+    iDevVideoRec = NULL;
+    iEncoderHWDeviceId = 0;
+    iPreProcessorHWDeviceId = 0;
+    iOutputVideoBuffer = NULL;
+    iVideoBufferType = CCMRMediaBuffer::EVideoH263;
+    iClockSource = NULL;
+    iDecSpecInfoLength = 0;
+    iPreferredEncoderUID = KNullUid;
+    iPreferredEncapsulationSet = EFalse;
+    iFrameSize.SetSize( KCMRFrameWidth, KCMRFrameHeight );
+    iSourceFrameRate = KCMRFrameRate;
+    iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+    iEncodingFrameRate = KCMRFrameRate;
+    iMaxFrameRate4GivenSize = KCMRFrameRate;
+    iRequestedFrameRate = KCMRFrameRate;
+    CCMRRecorderBase::SetTargetBitRateL( KCMRTargetBitRate );
+
+    iMinRandomAccessPeriodInSeconds = KCMRMinRandomAccessPeriod;
+
+    iMimeType = KCMRMimeTypeH263BaselineProfile;    //copy
+    iMimeType += _L8( "; level=10" );    // append
+    iVideoCodecData = new (ELeave) CCMRVideoCodecDataH263(10);    // default is H.263 level 10
+
+    iBitRateMode = EBitRateConstant;
+
+    iTimeWhenPaused = 0;
+    iTotalPausedTime = 0;
+
+    iErrorCode = KErrNone;
+
+    iEncoderInputQueueLength = 0;
+
+    iNumberOfCapturedFrames = 0;
+    iNumberOfEncodedFrames = 0;
+
+    iMutexObj.CreateLocal();
+    iMutexCreated = ETrue;
+    iBufferReturnAO = CCMRReturnAO::NewL(this);
+
+    iFatalError = EFalse;
+    iInputEnd = EFalse;
+    iStreamEnd = EFalse;
+
+    // Direct capture
+    iDirectCapture = EFalse;
+    iCameraHandle = 0;
+    iSkipBuffers = EFalse;
+    iDriftFrameSkipCount = 0;
+    iAddedFrameDurationCount = 0;
+    iPreviousCameraFrameIndex = 0;
+
+#ifdef _DEBUG
+    iLastCapture = 0;
+    iCumulativeEncodingTime = iCumulativeCaptureTime = 0;
+    iAverageEncodingTime = iAverageCaptureTime = 0;
+#endif
+	iDevVideoRec = CMMFDevVideoRecord::NewL( *this );
+	iAvailableVideoEncoders.Reset();
+	iAvailableVideoFrameSizesRates.Reset();
+
+	PRINT((_L("CCMRVideoRecorder::ConstructL() looking for defaul video codec encoder(s)")));
+	iDevVideoRec->FindEncodersL(iMimeType, 0 /* aPreProc */, iAvailableVideoEncoders, EFalse );
+	PRINT((_L("CCMRVideoRecorder::ConstructL() search found %d encoder(s)"), iAvailableVideoEncoders.Count() ));
+
+	if ( iConfig )
+		{
+		iConfig->SetVideoCodec(iMimeType);
+		iConfig->SetVideoPixelAspectRatio(KCMRAspectRatioNum, KCMRAspectRatioDenom);
+
+		// fill out defaults for Rate Control from ICM.
+	    iRateControlOptions.iPictureQuality = iConfig->PluginSettings().iCMRPictureQuality;
+	    iRateControlOptions.iLatencyQualityTradeoff = iConfig->PluginSettings().iCMRLatencyQualityTradeoff; // latency vs. quality
+	    iRateControlOptions.iQualityTemporalTradeoff = iConfig->PluginSettings().iCMRQualityTemporalTradeoff; // spatial vs. temporal quality
+		}
+    UpdateSupportedVideoFrameSizesRates();
+    PRINT((_L("CCMRVideoRecorder::ConstructL(), Out")))
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::~CCMRVideoRecorder()
+// Destructor
+// ---------------------------------------------------------
+//
+CCMRVideoRecorder::~CCMRVideoRecorder()
+    {
+    PRINT((_L("CCMRVideoRecorder::~CCMRVideoRecorder(), In")));
+    // This is the counterpart to NewL & OpenL, e.g. Close & Delete
+    // free all memory allocated and uninitalize & delete objects created, e.g. DevVideoRecord
+
+#if defined VIDEO_FILE_OUTPUT || defined VIDEO_BS_FILE_OUTPUT
+    iOutputFile.Close();
+    iFs.Close();
+#endif
+
+    // to make PC Lint happy
+    iOutputVideoBuffer = NULL;
+    iOutput = NULL;
+    iClockSource = NULL;
+
+    // delete DevVideoRecord instance
+    delete iDevVideoRec;
+    PRINT((_L("CCMRVideoRecorder::~CCMRVideoRecorder() devvideorec deleted")));
+
+    iAvailableVideoFrameSizesRates.Close();
+    iAvailableVideoEncoders.Close();
+
+    delete iOutputSinkBuffer;
+    iOutputSinkBuffer = NULL;
+
+    delete iVideoCodecData;
+    iVideoCodecData = NULL;
+
+    // empty the source fifo, just in case once more; this should be done a) by encoder and b) by MdvroStreamEnd()
+    MFrameBuffer* cbuffer;
+    if ( iSourceFifo )
+        {
+        while ( !iSourceFifo->IsEmpty() )
+            {
+            cbuffer = reinterpret_cast<MFrameBuffer*>(iSourceFifo->Get());
+            // Release camera API buffer
+            cbuffer->Release();
+            }
+        delete iSourceFifo;
+        iSourceFifo = NULL;
+        }
+    TVideoPicture* picture;
+    if ( iCodingFifo )
+        {
+        // delete the empty devvr picture-holders stored in the fifo
+        while ( !iCodingFifo->IsEmpty() )
+            {
+            picture = reinterpret_cast<TVideoPicture*>(iCodingFifo->Get());
+            PRINT((_L("CCMRVideoRecorder::~CCMRVideoRecorder() deleting %x"),picture));
+            delete picture;
+            }
+        delete iCodingFifo;
+        iCodingFifo = NULL;
+        }
+    PRINT((_L("CCMRVideoRecorder::~CCMRVideoRecorder() fifos deleted")));
+
+    if ( iDecSpecInfo )
+        {
+        // We still have MPEG-4 decoder configuration info stored
+        delete iDecSpecInfo;
+        iDecSpecInfo = NULL;
+        }
+
+    // delete camera
+    delete iSource;
+    iSource = NULL;
+    PRINT((_L("CCMRVideoRecorder::~CCMRVideoRecorder() camera deleted")));
+
+    if ( iBufferReturnAO )
+        {
+        iBufferReturnAO->Cancel();
+        delete iBufferReturnAO;
+        }
+
+    if ( iThreadHandleOpened )
+        {
+        iOutputThreadHandle.Close();
+        iThreadHandleOpened = EFalse;
+        }
+
+    if ( iMutexCreated )
+        {
+        iMutexObj.Close();
+        }
+
+    SetState(EStateNone);
+
+    PRINT((_L("CCMRVideoRecorder::~CCMRVideoRecorder(), Out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetOutputL
+// Sets output active object
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetOutputL(CCMRActiveOutput* aOutput)
+    {
+    iOutput = aOutput;
+    iOutput->RegisterSourceL( this );
+    if ( iSource && iThreadHandleOpened )
+        {
+        SetState( EStateOpen );
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetClockSourceL
+// Set clock source
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetClockSource(MMMFClockSource* aClockSource)
+    {
+    iClockSource = aClockSource;
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetOutputThreadIdL
+// Sets id of the output thread
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetOutputThreadIdL(TUint aThreadId)
+    {
+    User::LeaveIfError( iOutputThreadHandle.Open(aThreadId) );
+
+    iThreadHandleOpened = ETrue;
+    if ( iOutput && iSource )
+        {
+        SetState( EStateOpen );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetCameraHandleL
+// Sets camera handle and creates camera instance
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetCameraHandleL(TInt aCameraHandle)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetCameraHandleL(), In")))
+
+    // Create video source
+#ifdef VIDEO_FILE_INPUT
+    iSource = CCMRVideoFileSource::NewL(this);
+#else
+    iSource = CCMRVideoCameraSource::NewL(this, aCameraHandle);
+#endif
+
+    // Store a camera handle for future use
+    iCameraHandle = aCameraHandle;
+
+    // get camera info
+    iSource->CameraInfo(iCameraInfo);
+
+#if defined VIDEO_FILE_OUTPUT || defined VIDEO_BS_FILE_OUTPUT
+    User::LeaveIfError(iFs.Connect());
+    User::LeaveIfError(iOutputFile.Replace(iFs, _L("videorec_out.bin"), EFileWrite | EFileShareExclusive));
+#endif
+
+    if ( iOutput && iThreadHandleOpened )
+        {
+        SetState( EStateOpen );
+        }
+
+    PRINT((_L("CCMRVideoRecorder::SetCameraHandleL(), Out")))
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetupEncoderL
+// Private helper method to select & setup the encoder
+// plugin devvr must use
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetupEncoderL()
+    {
+#ifdef _DEBUG
+    TBuf<256> mime;
+    mime.Copy(iMimeType);
+    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() in, video mime-type: %S "), &mime ));
+#endif
+
+    if ( iPreferredEncoderUID != KNullUid )
+        {// We have preferred encoder UID from client - override encoder search and use it instead.
+        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() skipping encoder search. Using API user encoder: %d "), iPreferredEncoderUID.iUid));
+        iAvailableVideoEncoders.Reset();
+        iAvailableVideoEncoders.AppendL(iPreferredEncoderUID);
+        }
+    else if ( iConfig &&
+            ( iConfig->IsICMConfigDataAvailable() ) &&
+            ( iConfig->VideoQualitySettings().iVideoEncoderUID != KNullUid ) )
+        {// Video quality set has set UID value - override encoder search and use it instead.
+        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() skipping encoder search. Using ICM config encoder: %d "), iPreferredEncoderUID.iUid));
+        iAvailableVideoEncoders.Reset();
+        iAvailableVideoEncoders.AppendL(iPreferredEncoderUID);
+        }
+
+    // uncompressed format structures for YUV420 planar
+    TBool cameraSupports420 = ETrue;
+
+    if ( (iSizeIndex420 < 0) || (iRateIndex420 < 0) )
+        {
+        cameraSupports420 = EFalse;
+        }
+    else
+        {
+        cameraSupports420 = ETrue;
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() camera supports YUV420 planar") ));
+        }
+
+    // uncompressed format structures for YUV422
+    TBool cameraSupports422 = ETrue;
+    if ( (iSizeIndex422 < 0) || (iRateIndex422 < 0) )
+        {
+        cameraSupports422 = EFalse;
+        }
+    else
+        {
+        cameraSupports422 = ETrue;
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() camera supports YUV422 interleaved") ));
+        }
+
+    // Output format
+    CCompressedVideoFormat *comprFormat = CCompressedVideoFormat::NewL( iMimeType );
+    CleanupStack::PushL( comprFormat );
+
+    // index for encoder candidate. Have to go through the list to find an accerated encoder
+    TInt encoderIndex = -1;
+    TUncompressedVideoFormat encoderUncompFormat;
+
+    // encoder info for retrieving capabilities
+    CVideoEncoderInfo* encoderInfo = NULL;
+
+    // this is needed if init of HW accelerated codec failed and we retry => forces to select ARM codec
+    TBool alreadyFailedWithHWAccelerated = iVideoCodecHWAccelerated;
+    iVideoCodecHWAccelerated = EFalse;
+
+    TInt infoError = KErrNone;
+    TBool encoderSupports422 = EFalse;
+    TBool encoderSupports420 = EFalse;
+
+    TYuvCoefficients preproInputYuvCoefficient;
+    TYuvCoefficients preproOutputYuvCoefficient;
+    TYuvCoefficients encoderInputYuvCoefficient;
+    TUint aspectRatioNum = 0;
+    TUint aspectRatioDenom = 0;
+    TVideoDataUnitEncapsulation outputFormatEncapsulation = EDuElementaryStream;
+
+    if( KCMRMimeTypeH263() == iMimeType.Left( KCMRMimeTypeH263().Length() ))
+        {// H.263
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - setting H.263 YUVs") ));
+        preproInputYuvCoefficient = EYuvBt601Range1;
+        preproOutputYuvCoefficient = EYuvBt601Range0;
+        encoderInputYuvCoefficient = EYuvBt601Range0;
+        iVideoBufferType = CCMRMediaBuffer::EVideoH263;
+        // pixel aspect ratios
+        if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+	        {
+	        aspectRatioNum = iConfig->VideoQualitySettings().iVideoPixelAspectRatioNum;
+	        aspectRatioDenom = iConfig->VideoQualitySettings().iVideoPixelAspectRatioDenom;
+	        }
+        else
+	        {
+	        aspectRatioNum = KCMRAspectRatioNum;
+	        aspectRatioDenom = KCMRAspectRatioDenom;
+	        }
+        }
+    else if ( KCMRMimeTypeMPEG4V() == iMimeType.Left( KCMRMimeTypeMPEG4V().Length() ))
+        {// MPEG-4
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - setting MPEG4 YUVs") ));
+        preproInputYuvCoefficient = EYuvBt709Range1;
+        preproOutputYuvCoefficient = EYuvBt709Range1;
+        encoderInputYuvCoefficient = EYuvBt709Range1;
+        // pixel aspect ratios
+        if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+	        {
+	        aspectRatioNum = iConfig->VideoQualitySettings().iVideoPixelAspectRatioNum;
+	        aspectRatioDenom = iConfig->VideoQualitySettings().iVideoPixelAspectRatioDenom;
+	        }
+        else
+	        {
+	        aspectRatioNum = KCMRMPEG4AspectRatioNum;
+	        aspectRatioDenom = KCMRMPEG4AspectRatioDenom;
+	        }
+        iVideoBufferType = CCMRMediaBuffer::EVideoMPEG4;
+        }
+    else
+        {// H.264 AVC
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - setting H.264 AVC YUVs") ));
+        preproInputYuvCoefficient = EYuvBt709Range1;
+        preproOutputYuvCoefficient = EYuvBt709Range1;
+        encoderInputYuvCoefficient = EYuvBt709Range1;
+        // pixel aspect ratios 1:1
+        if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+	        {
+	        aspectRatioNum = iConfig->VideoQualitySettings().iVideoPixelAspectRatioNum;
+	        aspectRatioDenom = iConfig->VideoQualitySettings().iVideoPixelAspectRatioDenom;
+	        }
+        else
+	        {
+	        aspectRatioNum = KCMRMPEG4AspectRatioNum;
+	        aspectRatioDenom = KCMRMPEG4AspectRatioDenom;
+	        }
+        // output format encapsulation
+        iVideoBufferType = CCMRMediaBuffer::EVideoH264NAL;
+        outputFormatEncapsulation = EDuGenericPayload;
+        }
+
+    TBool directCaptureEncoder = EFalse;
+    TInt supportedEncoderInputsCount = 0;
+    // find an encoder with matching capabilities
+    for ( TInt i = 0 ; i < iAvailableVideoEncoders.Count(); i++ )
+        {
+        encoderInfo = NULL;
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - getting info from a plugin index[%d] with Uid 0x%x"), i, iAvailableVideoEncoders[i].iUid ));
+        TRAPD(error, (encoderInfo = ReadEncoderInfoL(iAvailableVideoEncoders[i])) );
+
+        if ( encoderInfo == NULL )
+            {
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - getting info from a plugin failed, skipping") ));
+            infoError = error;
+            }
+        else
+            {
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - got an info from a plugin, checking...") ));
+
+            // item was popped in CheckEncoderInfoL, push it back to stack
+            CleanupStack::PushL( encoderInfo );
+
+            // check if compressed video format matches
+            if ( encoderInfo->SupportsOutputFormat(*comprFormat) )   // max picture size & bit-rate was checked in the level of comprFormat
+                {
+                // check input format of encoder.
+                // a candidate encoder supporting the required compressed format was found
+                encoderSupports422 = EFalse;
+                encoderSupports420 = EFalse;
+
+                RArray<TUncompressedVideoFormat> supportedEncoderInputs = encoderInfo->SupportedInputFormats();
+                supportedEncoderInputsCount = supportedEncoderInputs.Count();
+                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Encoder at index[%d] supports %d input format(s), checking for support"), i, supportedEncoderInputs.Count() ));
+
+                // Go through supported input format and look for match to important parameters.
+                for(TInt j = 0; j < supportedEncoderInputsCount; j++ )
+                    {
+                    if ( !encoderSupports422 &&
+                         cameraSupports422 &&
+                         supportedEncoderInputs[j].iDataFormat == EYuvRawData &&
+                         supportedEncoderInputs[j].iYuvFormat.iCoefficients == encoderInputYuvCoefficient &&
+                         ( supportedEncoderInputs[j].iYuvFormat.iDataLayout == EYuvDataInterleavedLE ||
+                           supportedEncoderInputs[j].iYuvFormat.iDataLayout == EYuvDataInterleavedBE ) &&
+                         supportedEncoderInputs[j].iYuvFormat.iYuv2RgbMatrix == NULL &&
+                         supportedEncoderInputs[j].iYuvFormat.iRgb2YuvMatrix == NULL &&
+                         supportedEncoderInputs[j].iYuvFormat.iAspectRatioNum ==  aspectRatioNum &&
+                         supportedEncoderInputs[j].iYuvFormat.iAspectRatioDenom ==  aspectRatioDenom &&
+                         ( supportedEncoderInputs[j].iYuvFormat.iPattern == EYuv422Chroma1 ||
+                         supportedEncoderInputs[j].iYuvFormat.iPattern == EYuv422Chroma2 ) )
+                        {
+                        // YUV 422 input format can be used with this encoder
+                        encoderSupports422 = ETrue;
+                        encoderUncompFormat = supportedEncoderInputs[j];
+                        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Encoder at index[%d] supports YUV422 interleaved"), i ));
+                        break;
+                        }
+                    if ( !encoderSupports420 &&
+                         !encoderSupports422 &&
+                         cameraSupports420 &&
+                         supportedEncoderInputs[j].iDataFormat == EYuvRawData &&
+                         supportedEncoderInputs[j].iYuvFormat.iCoefficients == encoderInputYuvCoefficient &&
+                         supportedEncoderInputs[j].iYuvFormat.iDataLayout == EYuvDataPlanar &&
+                         supportedEncoderInputs[j].iYuvFormat.iYuv2RgbMatrix == NULL &&
+                         supportedEncoderInputs[j].iYuvFormat.iRgb2YuvMatrix == NULL &&
+                         supportedEncoderInputs[j].iYuvFormat.iAspectRatioNum ==  aspectRatioNum &&
+                         supportedEncoderInputs[j].iYuvFormat.iAspectRatioDenom ==  aspectRatioDenom &&
+                         ( supportedEncoderInputs[j].iYuvFormat.iPattern == EYuv420Chroma1 ||
+                           supportedEncoderInputs[j].iYuvFormat.iPattern == EYuv420Chroma2 ) )
+                        {
+                        // YUV 420 planar input format can be used with this encoder
+                        encoderSupports420 = ETrue;
+                        encoderUncompFormat = supportedEncoderInputs[j];
+                        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Encoder at index[%d] supports YUV420 planar"), i ));
+                        if( !cameraSupports422 )
+                            {
+                            break;
+                            }
+                        }
+                    }
+                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Encoder at index[%d] supports: 420[%d], 422[%d]"), i, encoderSupports420, encoderSupports422 ));
+
+                // Check directCapture support for current codec
+                directCaptureEncoder = encoderInfo->SupportsDirectCapture();
+                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Encoder at index[%d] supports DirectCapture:[%d]."), i, directCaptureEncoder));
+
+                // determine H.264 AVC encapsulation
+                if ( (iVideoBufferType == CCMRMediaBuffer::EVideoH264NAL) ||
+                     (iVideoBufferType == CCMRMediaBuffer::EVideoH264Bytestream) )
+                    {
+                    if (( iPreferredEncapsulationSet ) &&
+                        ( encoderInfo->SupportedDataUnitEncapsulations() & iPreferredEncapsulation ))
+                        {
+                        outputFormatEncapsulation = iPreferredEncapsulation;
+                        }
+                    else
+                        {
+                        if (encoderInfo->SupportedDataUnitEncapsulations() & EDuGenericPayload)
+                            {
+                            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() H.264 Encoder at index[%d] set to EDuGenericPayload encapsulation."), i));
+                            outputFormatEncapsulation = EDuGenericPayload;
+                            }
+                        else
+                            {
+                            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() H.264 Encoder at index[%d] set to EDuElementaryStream encapsulation."), i));
+                            outputFormatEncapsulation = EDuElementaryStream;
+                            }
+                        }
+
+                    if ( outputFormatEncapsulation == EDuGenericPayload )
+                        {
+                        iVideoBufferType = CCMRMediaBuffer::EVideoH264NAL;
+                        }
+                    else
+                        {
+                        iVideoBufferType = CCMRMediaBuffer::EVideoH264Bytestream;
+                        }
+                    }
+
+                if (directCaptureEncoder && (supportedEncoderInputsCount != 0))
+                    {
+                    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Warning - Encoder at index[%d] publish input formats even though it supports directcapture - ERROR!."), i));
+                    }
+
+                if ( encoderSupports422 || encoderSupports420 || (directCaptureEncoder && (supportedEncoderInputsCount == 0)) )
+                    {
+                    // encoder's input format matches with camera's output
+                    if ( encoderInfo->Accelerated() && (alreadyFailedWithHWAccelerated == EFalse) )
+                        // assume there is only 1 HW accelerated codec, and if it was selected previously we come here only if the init failed
+                        // => must use non-hw-accelerated codec
+                        {
+                        // no need to search for more, accelerated encoder is preferred
+                        encoderIndex = i;
+                        iVideoCodecHWAccelerated = ETrue;
+                        iDirectCapture = directCaptureEncoder;
+                        // HW accelerated is preferred regardless of the input format, but if both formats are supported, then 422 is preferred
+                        // need to set the camera variables accordingly
+                        if ( !(directCaptureEncoder && (supportedEncoderInputsCount == 0)) )
+                            {
+                            if ( encoderSupports422 )
+                                {
+                                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() YUV422 interleaved selected as input format") ));
+                                iSizeIndex = iSizeIndex422;
+                                iRateIndex = iRateIndex422;
+                                iVideoFormat = CCamera::EFormatYUV422;
+                                }
+                            else if (encoderSupports420)
+                                {
+                                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() YUV420 planar selected as input format") ));
+                                iSizeIndex = iSizeIndex420;
+                                iRateIndex = iRateIndex420;
+                                iVideoFormat = CCamera::EFormatYUV420Planar;
+                                }
+                            }
+                        // check max framerate for given picture size
+                        RArray<TPictureRateAndSize> rateAndSize = encoderInfo->MaxPictureRates();
+                        TUint rates = rateAndSize.Count();
+                        for ( TUint j = 0; j < rates; j++ )
+                            {
+                            if ( rateAndSize[j].iPictureSize == iFrameSize )
+                                {
+                                iMaxFrameRate4GivenSize = rateAndSize[j].iPictureRate;
+                                break;
+                                }
+                            }
+                        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - there is a suitable HW accelerated plugin, don't check other plugins") ));
+                        CleanupStack::PopAndDestroy( encoderInfo );
+                        break;
+                        }
+                    else if ( encoderIndex < 0 )
+                        {
+                        // accept also non-accelerated if no other is available
+                        encoderIndex = i;
+                        // encoder is selected regardless of the input format, but if both formats are supported, then 422 is preferred
+                        // need to set the camera variables accordingly
+                        if ( !(directCaptureEncoder && (supportedEncoderInputsCount == 0)) )
+                            {
+                            if ( encoderSupports422 )
+                                {
+                                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() YUV422 interleaved selected as input format") ));
+                                iSizeIndex = iSizeIndex422;
+                                iRateIndex = iRateIndex422;
+                                iVideoFormat = CCamera::EFormatYUV422;
+                                }
+                            else if (encoderSupports420)
+                                {
+                                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() YUV420 planar selected as input format") ));
+                                iSizeIndex = iSizeIndex420;
+                                iRateIndex = iRateIndex420;
+                                iVideoFormat = CCamera::EFormatYUV420Planar;
+                                }
+                            }
+
+                        // check max framerate for given picture size
+                        RArray<TPictureRateAndSize> rateAndSize = encoderInfo->MaxPictureRates();
+                        TUint rates = rateAndSize.Count();
+
+                        for ( TUint j = 0; j < rates; j++ )
+                            {
+                            if ( rateAndSize[j].iPictureSize == iFrameSize )
+                                {
+                                iMaxFrameRate4GivenSize = rateAndSize[j].iPictureRate;
+                                break;
+                                }
+                            }
+                        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - there is a suitable SW plugin.") ));
+                        }
+                    else
+                        {
+                        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - there is already similar encoder - preferring first.") ));
+                        // this kind of encoder already found
+                        }
+
+                    }
+                else
+                    {
+                    // skip this encoder, done in the following lines
+                    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() encoder doesn't support YUV420/YUV422 input format or isn't directcapture encoder") ));
+                    }
+                }
+            else
+                {
+                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() encoder at index[%d] doesn't support given compressed output format"), i ));
+                }
+            CleanupStack::PopAndDestroy( encoderInfo );
+            }
+        }
+
+    TUncompressedVideoFormat preproInputFormat = encoderUncompFormat;
+    TUncompressedVideoFormat preproOutputFormat = encoderUncompFormat;
+    preproInputFormat.iYuvFormat.iCoefficients = preproInputYuvCoefficient;
+    preproOutputFormat.iYuvFormat.iCoefficients = preproOutputYuvCoefficient;
+
+    if ( encoderIndex >= 0 )
+        {
+        if ( iVideoCodecHWAccelerated )
+            {
+            iNumCameraBuffers = iConfig->PluginSettings().iCMRNumCameraBuffers;
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - found a suitable HW accelerated video encoder")));
+            }
+        else
+            {
+            iNumCameraBuffers = iConfig->PluginSettings().iCMRNumCameraBuffersARM;
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() - found a suitable ARM video encoder")));
+            }
+
+        // if encoder doesn´t support directcapture try to find preprocessor that does.
+        if ( !iDirectCapture && iVideoCodecHWAccelerated )
+            {
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Searching preprocessor.")));
+            RArray<TUid> preprocessors;
+            CleanupClosePushL( preprocessors );
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Search starting")));
+
+            TInt preproSearchErr = KErrNone;
+            TRAP(preproSearchErr, iDevVideoRec->FindPreProcessorsL(EPpYuvToYuv, preprocessors));
+            if (preproSearchErr == KErrNone)
+                {
+                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Search found %d preprocessor(s)"), preprocessors.Count() ));
+                CPreProcessorInfo* preprocessorInfo = NULL;
+                // find a preprocessor with matching capabilities to encoder
+                for ( TInt k = 0; k < preprocessors.Count(); k++ )
+                    {
+                    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Checking preprocessor at index[%d] with Uid 0x%x"), k, preprocessors[k].iUid ));
+                    preprocessorInfo = iDevVideoRec->PreProcessorInfoLC(preprocessors[k]);
+
+                    if ( preprocessorInfo->SupportsInputFormat(preproInputFormat) &&
+                         preprocessorInfo->SupportsOutputFormat(preproOutputFormat) &&
+                         preprocessorInfo->SupportsDirectCapture() )
+                        {
+                        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() preprocessor[%d] is suitable, setting it as preprocessor"), k ));
+                        iDirectCapture = ETrue;
+                        iPreProcessorHWDeviceId = iDevVideoRec->SelectPreProcessorL(preprocessors[k]);
+                        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() preprocessor selected")));
+                        CleanupStack::PopAndDestroy(preprocessorInfo);
+                        break;
+                        }
+                    CleanupStack::PopAndDestroy(preprocessorInfo);
+                    }
+                }
+            else if (preproSearchErr == KErrNotFound)
+                {
+                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() didn't find any preprocessors")));
+                }
+            else
+                {
+                PRINT((_L("CCMRVideoRecorder::SetupEncoderL() preprocessors search error: %d"), preproSearchErr));
+                CleanupStack::PopAndDestroy(); //preprocessors
+                User::Leave(preproSearchErr);
+                }
+            CleanupStack::PopAndDestroy(); //preprocessors
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Searching preprocessor done.")));
+            }
+        }
+    else
+        {
+        if ( infoError != KErrNone )
+            {
+            // there is an encoder but it can't be used
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() there is an encoder but it can't be used - info error=%d"), infoError ));
+            User::Leave( infoError );
+            }
+        else
+            {
+            // No suitable encoder found. This should not be possible if the codec was properly set beforehand
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() No suitable encoder found.")));
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+    iEncoderHWDeviceId = iDevVideoRec->SelectEncoderL(iAvailableVideoEncoders[encoderIndex]);
+    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() encoder selected")));
+
+    // Set input format only for non-directcapture encoders
+    if ( (directCaptureEncoder && (supportedEncoderInputsCount == 0)) )
+        {
+        // Direct capture encoders should ignore
+        TUncompressedVideoFormat ignoredFormat;
+        iDevVideoRec->SetInputFormatL(iEncoderHWDeviceId, ignoredFormat, iFrameSize);
+        }
+    else
+        {
+        iDevVideoRec->SetInputFormatL(iEncoderHWDeviceId, encoderUncompFormat, iFrameSize);
+        }
+
+    if ( iPreProcessorHWDeviceId )
+        {
+        iDevVideoRec->SetInputFormatL(iPreProcessorHWDeviceId, preproInputFormat, iFrameSize);
+        }
+
+    // Buffer options
+    TEncoderBufferOptions bufferOptions;
+    bufferOptions.iHrdVbvParams.Set(NULL, 0);
+    bufferOptions.iHrdVbvSpec = EHrdVbvNone;
+    bufferOptions.iMaxPreEncoderBufferPictures = iConfig->PluginSettings().iCMRNumCameraBuffers;
+    bufferOptions.iMinNumOutputBuffers = iConfig->PluginSettings().iCMRMinNumOutputBuffers;
+
+    bufferOptions.iMaxCodedSegmentSize =
+        bufferOptions.iMaxOutputBufferSize =
+        bufferOptions.iMaxCodedPictureSize = iVideoCodecData->MaxBufferLength(iFrameSize);
+
+    iDevVideoRec->SetBufferOptionsL(bufferOptions);
+
+    // Set output format
+    iDevVideoRec->SetOutputFormatL(iEncoderHWDeviceId, *comprFormat, EDuCodedPicture,
+                                   outputFormatEncapsulation, EFalse /* aSegmentationAllowed */);
+
+    if( iPreProcessorHWDeviceId)
+    {
+        iDevVideoRec->SetOutputFormatL(iPreProcessorHWDeviceId, preproOutputFormat);
+    }
+
+    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() MinRandomAccess= %d"), iMinRandomAccessPeriodInSeconds ));
+    if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+        {
+        iMinRandomAccessPeriodInSeconds = iConfig->VideoQualitySettings().iRandomAccessRate;
+        }
+    else
+        {
+        if ( (iFrameSize.iWidth >= KCMRCIFWidth) && (iFrameSize.iHeight >= KCMRCIFHeight) )
+	        {
+	        iMinRandomAccessPeriodInSeconds = KCMRMinRandomAccessPeriodHighRes;
+	        }
+        }
+    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Set to MinRandomAccess= %d"), iMinRandomAccessPeriodInSeconds ));
+
+    // Set random access in fps
+    if ( iMinRandomAccessPeriodInSeconds > 0 )
+        {
+        iDevVideoRec->SetMinRandomAccessRate( TReal(1) / TReal(iMinRandomAccessPeriodInSeconds) );
+        }
+    else
+        {
+        // there is no concept of disabling random access in MSL, hence use the default
+        iDevVideoRec->SetMinRandomAccessRate( TReal(1) / TReal(KCMRMinRandomAccessPeriod) );
+        }
+
+    CleanupStack::PopAndDestroy( comprFormat );
+
+    // set codec specific settings
+    iVideoCodecData->SetPreInitParamsL(iDevVideoRec);
+
+    if (iDirectCapture)
+        {
+        TInt status = KErrNone;
+        // Set the data source to a camera
+        TRAP( status, iDevVideoRec->SetSourceCameraL( iCameraHandle, TReal(iSourceFrameRate)) );
+
+        if ( status != KErrNone )
+            {
+            // Probably it's not supported, although directCapture was declared in the hwdevice info.
+            // Leave or to give one more chance to encoder, to use src memory as a source ?
+            // Yes, otherwise User::Leave(status);
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Setting camerasource to MDF failed.")));
+            }
+        else
+            {
+            if ( iClockSource )
+                {
+                iDevVideoRec->SetClockSource( iClockSource );
+                }
+            // Ok, use direct capture
+            PRINT((_L("CCMRVideoRecorder::SetupEncoderL() out")));
+            return;
+            }
+        }
+
+    // Set source memory is allocated & released by camera API
+    iDevVideoRec->SetSourceMemoryL( TReal(iSourceFrameRate), ETrue, KCMREncodingRealTime);
+    // Set the source to memory buffers
+    iDirectCapture = EFalse;
+    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::ReadEncoderInfoL
+// Read encoder information object. The object is popped from
+// stack and MUST be handled properly by the caller
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+CVideoEncoderInfo* CCMRVideoRecorder::ReadEncoderInfoL(TUid aUid)
+    {
+    PRINT((_L("CCMRVideoRecorder::ReadEncoderInfoL(), In")))
+    CVideoEncoderInfo* info = iDevVideoRec->VideoEncoderInfoLC( aUid );
+    CleanupStack::Pop(info);
+
+    PRINT((_L("CCMRVideoRecorder::ReadEncoderInfoL(), Out")))
+    return info;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::PrepareL
+// Prepares the recorder for recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::PrepareL()
+    {
+    PRINT((_L("CCMRVideoRecorder::PrepareL(), In")));
+
+    if ( (State() != EStateOpen) && (State() != EStateReadyToRecord) )
+        {
+        PRINT((_L("CCMRVideoRecorder::PrepareL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+	if ( State() == EStateReadyToRecord )
+		{
+		// No prepare needed... already ready.
+		// everything ok, inform observer that we are prepared.
+		PRINT((_L("CCMRVideoRecorder::PrepareL(), Already prepared. Return right away")));
+        DoSendEventToClient( KCMRPrepareComplete, KErrNone );
+		return;
+		}
+
+	if (iDevVideoRec)
+		{
+		delete iDevVideoRec;
+		iDevVideoRec = NULL;
+		}
+
+	iDevVideoRec = CMMFDevVideoRecord::NewL( *this );
+
+    // reset error code
+    iErrorCode = KErrNone;
+
+    // If the user of the recorder API has not set valid settings,
+    // use default ones
+
+    if ( ((iSizeIndex420 < 0) && (iSizeIndex422 < 0) && (iSizeIndexDCEncoder < 0))
+        || ((iSizeIndex420 >= iCameraInfo.iNumVideoFrameSizesSupported) && (iSizeIndex422 >= iCameraInfo.iNumVideoFrameSizesSupported)) )
+        {
+        // set default frame size
+        SetFrameSizeL( TSize( KCMRFrameWidth, KCMRFrameHeight ) );
+        }
+
+    if ( ((iRateIndex420 < 0) && (iRateIndex422 < 0) && (iRateIndexDCEncoder < 0))
+        || ((iRateIndex420 >= iCameraInfo.iNumVideoFrameRatesSupported) && (iRateIndex422 >= iCameraInfo.iNumVideoFrameRatesSupported)) )
+        {
+        // set default frame rate
+        SetFrameRateL( KCMRFrameRate );
+        }
+
+    // if during previous run a new frame rate was requested; when requested it affected only on encoding rate
+    if ( iRequestedFrameRate != iSourceFrameRate )
+        {
+        SetState(EStateOpen);//change state to make the SetFrameRate work correctly
+        SetFrameRateL( iRequestedFrameRate );
+        }
+
+    // reset init completion flags
+    iEncoderInitComplete = EFalse;
+    iSourceInitComplete = EFalse;
+    iVideoCodecHWAccelerated = EFalse;
+    // Select & set parameters to video encoder
+    TRAPD(err, SetupEncoderL());
+    if ( err == KErrHardwareNotAvailable && iVideoCodecHWAccelerated )
+        {
+        // HW codec exists but can't be used, try again with ARM codec
+        SetupEncoderL();
+        }
+    else if ( err != KErrNone )
+        {
+        // some other error
+        PRINT((_L("CCMRVideoRecorder::PrepareL(), error [%d]"), err));
+        User::Leave( err );
+        }
+
+    SetState(EStatePreparing);
+
+    // Reserve camera for use
+    // Possibly asynchronous call (if not already reserved), completion is anyway informed using this->ReserveComplete()
+    // iSource has to be reserved only if we don't set hwdevice to use DirectCapture.
+    if ( !iDirectCapture )
+        {
+        iSource->Reserve();
+        }
+
+    // Initialize DevVideoRec
+    // asynchronous call, completion informed using this->MdvroInitializeComplete()
+    iDevVideoRec->Initialize();
+
+    PRINT((_L("CCMRVideoRecorder::PrepareL(), Out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::RecordL
+// Starts recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::RecordL()
+    {
+	PRINT((_L("CCMRVideoRecorder::RecordL() - START - iRequestStatus: 0x%08x"), iRequestStatus ));
+
+    if ( (State() == EStateRecording) || (State() == EStatePaused) )
+        {
+        // ignore, already recording
+        PRINT((_L("CCMRVideoRecorder::RecordL() ignore")));
+        return;
+        }
+
+    if ( State() != EStateReadyToRecord )
+        {
+        PRINT((_L("CCMRVideoRecorder::RecordL() not ready")));
+        User::Leave(KErrNotReady);
+        }
+
+    // check exposure setting from camera => decide framerates
+    CheckExposure();
+
+#ifdef _DEBUG
+    iRecordStartTime.UniversalTime();
+    iLastCapture.UniversalTime();
+#endif
+    iNumberOfCapturedFrames = 0;
+    iNumberOfEncodedFrames = 0;
+    iEncoderInputQueueLength = 0;
+    iDriftFrameSkipCount = 0;
+    iAddedFrameDurationCount = 0;
+    iPreviousCameraFrameIndex = 0;
+    iDecSpecInfoLength = 0;
+
+    // reset pause time adjustments variables
+    iTimeWhenPaused = 0;
+    iTotalPausedTime = 0;
+    iSystemClockDelta = 0;
+    iLatestUsedTimeStamp = -iSourceFrameInterval;
+    iLatestAbsoluteTimeStamp = 0;
+    iNumberOfCapturedFrames = 0;
+    iNumberOfVideoOutputBuffers = 0;
+
+    if ( iVideoCodecData->DecoderConfigInfoUsed() )
+        {
+        // Read decoder specific information from the encoder
+        PRINT((_L("CCMRVideoRecorder::RecordL() asking CodingStandardSpecificInitOutputLC from the encoder.")));
+        iDecSpecInfo = iDevVideoRec->CodingStandardSpecificInitOutputLC();
+        if ( iDecSpecInfo )
+            {
+            PRINT((_L("CCMRVideoRecorder::RecordL() CodingStandardSpecificInitOutputLC received.")));
+            // it was placed to cleanupstack, pop it now since it takes some time before
+            // this ptr can be destructed, and if destructed from the stack, there may
+            // be newer objects in the stack at that time. The ptr is also now stored
+            // to member variable which must not be in stack
+            CleanupStack::Pop(iDecSpecInfo);
+
+            // Inform the output that we have new data; it will read it in callback
+            if ( iRequestStatus )
+                {
+				PRINT((_L("CCMRVideoRecorder::RecordL() - completing output request..." )));
+                iOutputThreadHandle.RequestComplete( iRequestStatus, KErrNone );
+                }
+            }
+        else
+            {
+            // This codec should have decoder specific info field in metadata, hence leave with error
+            PRINT((_L("CCMRVideoRecorder::RecordL() no decoder specific info available from the encoder!?!")));
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+    // Start encoding
+    iDevVideoRec->Start();
+    iSkipBuffers = EFalse;
+
+    iInputEnd = EFalse;
+    iStreamEnd = EFalse;
+
+    // Start capturing
+    // StartCapture in case, if we don't use direct capture mode
+    if ( !iDirectCapture )
+        {
+        iSource->StartCapture();
+        }
+
+    SetState(EStateRecording);
+
+	PRINT((_L("CCMRVideoRecorder::RecordL() - END - iRequestStatus: 0x%08x"), iRequestStatus ));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::StopL
+// Stops recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::StopL()
+    {
+    PRINT((_L("CCMRVideoRecorder::StopL(), In")))
+
+    if ( (State() == EStateRecording) || (State() == EStatePaused) )
+        {
+        PRINT((_L("CCMRVideoRecorder::StopL(), Stop capture")));
+
+        // Stop capturing
+        // Stop capture only incase, if we don't use direct capture mode
+        if ( !iDirectCapture )
+            {
+            iSource->StopCapture();
+            PRINT((_L("CCMRVideoRecorder::StopL() camera stopped")));
+            }
+
+
+        // Stopping is async => state can't be "recording"
+        SetState(EStateStopping);
+
+        // Stop encoding
+        if ( !iFatalError )
+            {
+            iInputEnd = ETrue;
+            PRINT((_L("CCMRVideoRecorder::StopL(), calling DevVideo::InputEnd().")));                
+            iDevVideoRec->InputEnd();
+            // try to free buffers for video adaptation to complete video bitstream / EOS marker.
+            PRINT((_L("CCMRVideoRecorder::StopL(), flushing written frames back to DevVideo.")));                
+            iBufferReturnAO->Flush();
+            
+            // get all available buffers from devvideo
+            PRINT((_L("CCMRVideoRecorder::StopL(), getting all encoded frames from DevVideo.")));                
+            TVideoOutputBuffer* buffer = NULL;
+            for (;;)
+                {
+                TRAPD( err, ( buffer = iDevVideoRec->NextBufferL()));
+                if ( err != KErrNone || buffer == NULL)
+                    {
+                    break;
+                    }
+                // enter restricted area
+                iMutexObj.Wait();
+                // store
+                TInt timestamp = I64INT(buffer->iCaptureTimestamp.Int64());
+                PRINT((_L("CCMRVideoRecorder::StopL(), storing buffer: 0x%x, timestamp:%d"), buffer, timestamp ));                  
+                iVideoOutputBufferInputQue.AddLast(*buffer);
+                iNumberOfVideoOutputBuffers++;
+
+                // leave restricted area
+                iMutexObj.Signal();
+                }
+            }
+        else
+            {
+            PRINT((_L("CCMRVideoRecorder::StopL(), Fatal error was reported by devVideo, next step is to delete it")));
+
+            // set state & inform MR => it can return from stop
+            SetState( EStateReadyToRecord );
+
+            // everything ok, inform observer that we are ready for a new recording (iStopping does it too, though).
+            DoSendEventToClient( KCMRRecordingComplete, KErrNone );
+            }
+
+        PRINT((_L("CCMRVideoRecorder::StopL() out, must wait for state change before stop completed")));
+        }
+    else
+        {
+        DoSendEventToClient( KCMRRecordingComplete, KErrNone );
+        PRINT((_L("CCMRVideoRecorder::StopL() out, already stopped")));
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::RequestBuffersAndWaitEOSL
+// While stopping keep requesting buffers from adaptation and waiting for EOS marker encodc signal
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CCMRVideoRecorder::RequestBuffersAndWaitEOSL(TInt& aVideoEOSReached)
+    {
+    PRINT((_L("CCMRVideoRecorder::RequestBuffersAndWaitEOSL(), in")))
+    PRINT((_L("CCMRVideoRecorder::RequestBuffersAndWaitEOSL(), flushing written frames back to DevVideo.")));                
+    iBufferReturnAO->Flush();
+
+    // get all available buffers from devvideo
+    PRINT((_L("CCMRVideoRecorder::RequestBuffersAndWaitEOSL(), getting all encoded frames from DevVideo.")));                
+    TVideoOutputBuffer* buffer = NULL;
+    for (;;)
+        {
+        TRAPD( err, ( buffer = iDevVideoRec->NextBufferL()));
+        if ( err != KErrNone || buffer == NULL)
+            {
+            break;
+            }
+        // enter restricted area
+        iMutexObj.Wait();
+        // store
+        TInt timestamp = I64INT(buffer->iCaptureTimestamp.Int64());
+        PRINT((_L("CCMRVideoRecorder::RequestBuffersAndWaitEOSL(), storing buffer: 0x%x, timestamp:%d"), buffer, timestamp));                  
+        iVideoOutputBufferInputQue.AddLast(*buffer);
+        iNumberOfVideoOutputBuffers++;
+
+        // leave restricted area
+        iMutexObj.Signal();
+        }
+    
+    aVideoEOSReached = iStreamEnd;
+    PRINT((_L("CCMRVideoRecorder::RequestBuffersAndWaitEOSL() out, aVideoEOSReached=%d"), aVideoEOSReached));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::PauseL
+// Pauses recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::PauseL()
+    {
+    PRINT((_L("CCMRVideoRecorder::PauseL(), In")))
+
+    if ( State() != EStateRecording )
+        {
+        return;
+        }
+
+    SetState( EStatePaused );
+
+    // Take the time stamp and later subtract it from real stamps
+    iTimeWhenPaused.UniversalTime();
+    PRINT((_L("CCMRVideoRecorder::PauseL() at %i:%i"),I64LOW(iTimeWhenPaused.Int64()), I64HIGH(iTimeWhenPaused.Int64()) ));
+
+    // Adjust in the clock time changes, so we don't add it in twice during resume
+    iTimeWhenPaused = iTimeWhenPaused + iSystemClockDelta;
+    PRINT((_L("CCMRVideoRecorder::PauseL() at %i:%i"),I64LOW(iTimeWhenPaused.Int64()), I64HIGH(iTimeWhenPaused.Int64()) ));
+
+    // Pause encoding
+    iDevVideoRec->Pause();
+    PRINT((_L("CCMRVideoRecorder::PauseL(), In")))
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::ResumeL
+// Resumes recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::ResumeL()
+    {
+    PRINT((_L("CCMRVideoRecorder::ResumeL(), In")))
+
+    if ( State() != EStatePaused )
+        {
+        return;
+        }
+
+    // Resume encoding
+    iDevVideoRec->Resume();
+
+    // measure the time we were paused; remember that this could have been Nth pause
+    TTime current;
+    current.UniversalTime();
+    iTotalPausedTime = iTotalPausedTime.Int64() + current.MicroSecondsFrom(iTimeWhenPaused-iSystemClockDelta).Int64();
+    PRINT((_L("CCMRVideoRecorder::ResumeL() at %i:%i, iTotalPausedTime now %d, iSystemClockDelta now %d"),I64LOW(current.Int64()),
+                                                                                                          I64HIGH(current.Int64()),
+                                                                                                          I64INT(iTotalPausedTime.Int64()),
+                                                                                                          I64INT(iSystemClockDelta.Int64()) ));
+
+    SetState( EStateRecording );
+    PRINT((_L("CCMRVideoRecorder::ResumeL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::SetVideoCodecL
+// Set video codec.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::SetVideoCodecL(const TDesC8& aMimeType)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() in")));
+    if ( ( State() != EStateOpen ) && ( State() != EStateReadyToRecord ) )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    if ( iMimeType == aMimeType )
+        {
+        // the same codec was already selected, no need to change anything
+        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() out, no change needed. Requested codec already in use.")));
+        return;
+        }
+
+	TInt numerator = KCMRAspectRatioNum;
+	TInt denominator = KCMRAspectRatioDenom;
+    TInt videoCodecLevel = 10;  // default: H.263 p0 level 10
+    TBuf8<256> newMimeType;
+    if ( aMimeType == KNullDesC8 )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() Requested NULL video codec, default H.263 Baseline profile, level 10 in use.")));
+        // use default (H.263 p0 level 10); theoretically this could be useful if codec is first set to smth else and then reset to default
+        newMimeType = KCMRMimeTypeH263BaselineProfile;  //copy the contents
+        newMimeType += _L8( "; level=10" );    //append level
+        videoCodecLevel = 10;
+        }
+    else {
+        // check the given type first
+        TBuf8<256> string;
+        string = KCMRMimeTypeH263;
+        string += _L8( "*" );
+
+        // the client-class checked the availability of the codec in the system already
+
+        if ( aMimeType.MatchF( (const TDesC8& )string ) != KErrNotFound )
+            {
+            // H.263
+            PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263 requested")));
+            newMimeType = KCMRMimeTypeH263; //copy the contents
+
+            if ( aMimeType.MatchF( _L8("*profile*") ) != KErrNotFound )
+                {
+                // profile given, check if we support it
+                if ( aMimeType.MatchF( _L8("*profile=0*")) != KErrNotFound )
+                    {
+                    // profile 0 requested
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, profile 0 requested")));
+                    newMimeType += _L8( "; profile=0" );    //append
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile=3*")) != KErrNotFound )
+                    {
+                    // profile 3 requested
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, profile 3 requested")));
+                    newMimeType += _L8( "; profile=3" );    //append
+                    }
+                else
+                    {
+                    // no other profiles supported
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() unsupported profile")));
+                    User::Leave(KErrNotSupported);
+                    }
+                }
+            else
+                {
+                // no profile is given => assume 0
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, no profile requested - default to 0.")));
+                newMimeType += _L8( "; profile=0" );    //append
+                }
+
+            if ( aMimeType.MatchF( _L8("*level=10*") ) != KErrNotFound )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, level 10 requested.")));
+                videoCodecLevel = 10;
+                newMimeType += _L8( "; level=10" );    //append
+                }
+            else if ( aMimeType.MatchF( _L8("*level=20*") ) != KErrNotFound )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, level 20 requested.")));
+                videoCodecLevel = 20;
+                newMimeType += _L8( "; level=20" );    //append
+                }
+            else if ( aMimeType.MatchF( _L8("*level=30*") ) != KErrNotFound )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, level 30 requested.")));
+                videoCodecLevel = 30;
+                newMimeType += _L8( "; level=30" );    //append
+                }
+            else if ( aMimeType.MatchF( _L8("*level=40*") ) != KErrNotFound )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, level 40 requested.")));
+                videoCodecLevel = 40;
+                newMimeType += _L8( "; level=40" );    //append
+                }
+            else if ( aMimeType.MatchF( _L8("*level=45*") ) != KErrNotFound )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, level 45 requested.")));
+                videoCodecLevel = 45;
+                newMimeType += _L8( "; level=45" );    //append
+                }
+            else if ( aMimeType.MatchF( _L8("*level=50*") ) != KErrNotFound )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, level 50 requested.")));
+                videoCodecLevel = 50;
+                newMimeType += _L8( "; level=50" );    //append
+                }
+            else if ( aMimeType.MatchF( _L8("*level*") ) != KErrNotFound )
+                {
+                // no other levels supported
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() unsupported level requested.")));
+                User::Leave(KErrNotSupported);
+                }
+            else
+                {
+                // if no level is given assume 10
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263, no level requested - default to 10.")));
+                newMimeType += _L8( "; level=10" );    //append
+                videoCodecLevel = 10;
+                }
+
+            // recreate the codec data object
+            PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.263 recreating codecdata.")));
+            delete iVideoCodecData;
+            iVideoCodecData = NULL;
+            iVideoCodecData = new (ELeave) CCMRVideoCodecDataH263(videoCodecLevel);
+            }
+        else
+            {
+			numerator = KCMRMPEG4AspectRatioNum;
+			denominator = KCMRMPEG4AspectRatioDenom;
+
+            string = KCMRMimeTypeMPEG4V;
+            string += _L8( "*" );
+
+            if ( aMimeType.MatchF( string ) != KErrNotFound )
+                {
+                // MPEG-4 Visual
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4 Visual requested")));
+                newMimeType = KCMRMimeTypeMPEG4VSP; //copy the contents
+                if ( aMimeType.MatchF( _L8("*profile-level-id=8*") ) != KErrNotFound )
+                    {
+                    // simple profile level 0
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 0 requested.")));
+                    videoCodecLevel = 0;
+                    newMimeType += _L8("8");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=9*") ) != KErrNotFound )
+                    {
+                    // simple profile level 0b
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 0b requested.")));
+                    videoCodecLevel = KCMRMPEG4SPLevel0B;
+                    newMimeType += _L8("9");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=1*") ) != KErrNotFound )
+                    {
+                    // simple profile level 1
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 1 requested.")));
+                    videoCodecLevel = 1;
+                    newMimeType += _L8("1");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=2*") ) != KErrNotFound )
+                    {
+                    // simple profile level 2
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 2 requested.")));
+                    videoCodecLevel = 2;
+                    newMimeType += _L8("2");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=3*") ) != KErrNotFound )
+                    {
+                    // simple profile level 3
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 3 requested.")));
+                    videoCodecLevel = 3;
+                    newMimeType += _L8("3");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=4*") ) != KErrNotFound )
+                    {
+                    // simple profile level 4
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 4a requested.")));
+                    videoCodecLevel = 4;
+                    newMimeType += _L8("4");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=5*") ) != KErrNotFound )
+                    {
+                    // simple profile level 5
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 5 requested.")));
+                    videoCodecLevel = 5;
+                    newMimeType += _L8("5");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=6*") ) != KErrNotFound )
+                    {
+                    // simple profile level 6
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, simple profile level 6 requested.")));
+                    videoCodecLevel = 6;
+                    newMimeType += _L8("6");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+                    {
+                    // no other profile-level ids supported
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() unsupported profile-level requested.")));
+                    User::Leave(KErrNotSupported);
+                    }
+                else
+                    {
+                    // Default is level 1
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4, no profile requested - defaulting to 1.")));
+                    videoCodecLevel = 1;
+                    newMimeType += _L8("1");
+                    }
+
+                // recreate the codec data object
+                PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() MPEG-4 recreating codecdata.")));
+                delete iVideoCodecData;
+                iVideoCodecData = NULL;
+                iVideoCodecData = new (ELeave) CCMRVideoCodecDataMPEG4(videoCodecLevel);
+                }
+            else
+                {
+				numerator = KCMRMPEG4AspectRatioNum;
+				denominator = KCMRMPEG4AspectRatioDenom;
+
+                string = KCMRMimeTypeH264AVC;
+                string += _L8( "*" );
+
+                if ( aMimeType.MatchF( string ) != KErrNotFound )
+                    {
+                    // H.264/AVC
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC requested")));
+                    newMimeType = KCMRMimeTypeH264AVCProfileId; //copy the contents
+                    if ( aMimeType.MatchF( _L8("*profile-level-id=42800A*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel10;
+                        newMimeType += _L8("42800A");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=42900B*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 1b
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 1b requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel10b;
+                        newMimeType += _L8("42900B");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=42800B*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 1.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 1.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel11;
+                        newMimeType += _L8("42800B");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=42800C*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 1.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 1.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel12;
+                        newMimeType += _L8("42800C");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=42800D*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 1.3
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 1.3 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel13;
+                        newMimeType += _L8("42800D");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=428014*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel20;
+                        newMimeType += _L8("428014");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=428015*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 2.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 2.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel21;
+                        newMimeType += _L8("428015");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=428016*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 2.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 2.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel22;
+                        newMimeType += _L8("428016");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=42801E*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 3
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 3 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel30;
+                        newMimeType += _L8("42801E");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=42801F*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 3.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 3.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel31;
+                        newMimeType += _L8("42801F");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=428020*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 3.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 3.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel32;
+                        newMimeType += _L8("428020");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=428028*") ) != KErrNotFound )
+                        {
+                        // baseline profile level 4
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, baseline profile level 4 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel40;
+                        newMimeType += _L8("428028");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D400A*") ) != KErrNotFound )
+                        {
+                        // main profile level 1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel10;
+                        newMimeType += _L8("4D400A");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D500B*") ) != KErrNotFound )
+                        {
+                        // main profile level 1b
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 1b requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel10b;
+                        newMimeType += _L8("4D500B");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D400B*") ) != KErrNotFound )
+                        {
+                        // main profile level 1.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 1.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel11;
+                        newMimeType += _L8("4D400B");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D400C*") ) != KErrNotFound )
+                        {
+                        // main profile level 1.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 1.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel12;
+                        newMimeType += _L8("4D400C");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D400D*") ) != KErrNotFound )
+                        {
+                        // main profile level 1.3
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 1.3 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel13;
+                        newMimeType += _L8("4D400D");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D4014*") ) != KErrNotFound )
+                        {
+                        // main profile level 2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel20;
+                        newMimeType += _L8("4D4014");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D4015*") ) != KErrNotFound )
+                        {
+                        // main profile level 2.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 2.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel21;
+                        newMimeType += _L8("4D4015");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D4016*") ) != KErrNotFound )
+                        {
+                        // main profile level 2.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 2.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel22;
+                        newMimeType += _L8("4D4016");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D401E*") ) != KErrNotFound )
+                        {
+                        // main profile level 3
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 3 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel30;
+                        newMimeType += _L8("4D401E");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D401F*") ) != KErrNotFound )
+                        {
+                        // main profile level 3.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 3.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel31;
+                        newMimeType += _L8("4D401F");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D4020*") ) != KErrNotFound )
+                        {
+                        // main profile level 3.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 3.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel32;
+                        newMimeType += _L8("4D4020");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=4D4028*") ) != KErrNotFound )
+                        {
+                        // main profile level 4
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, main profile level 4 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel40;
+                        newMimeType += _L8("4D4028");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=64400A*") ) != KErrNotFound )
+                        {
+                        // high profile level 1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel10;
+                        newMimeType += _L8("64400A");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=644009*") ) != KErrNotFound )
+                        {
+                        // high profile level 1b
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 1b requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel10b;
+                        newMimeType += _L8("644009");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=64400B*") ) != KErrNotFound )
+                        {
+                        // high profile level 1.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 1.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel11;
+                        newMimeType += _L8("64400B");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=64400C*") ) != KErrNotFound )
+                        {
+                        // high profile level 1.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 1.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel12;
+                        newMimeType += _L8("64400C");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=64400D*") ) != KErrNotFound )
+                        {
+                        // high profile level 1.3
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 1.3 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel13;
+                        newMimeType += _L8("64400D");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=644014*") ) != KErrNotFound )
+                        {
+                        // high profile level 2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel20;
+                        newMimeType += _L8("644014");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=644015*") ) != KErrNotFound )
+                        {
+                        // high profile level 2.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 2.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel21;
+                        newMimeType += _L8("644015");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=644016*") ) != KErrNotFound )
+                        {
+                        // high profile level 2.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 2.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel22;
+                        newMimeType += _L8("644016");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=64401E*") ) != KErrNotFound )
+                        {
+                        // high profile level 3
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 3 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel30;
+                        newMimeType += _L8("64401E");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=64401F*") ) != KErrNotFound )
+                        {
+                        // high profile level 3.1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 3.1 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel31;
+                        newMimeType += _L8("64401F");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=644020*") ) != KErrNotFound )
+                        {
+                        // high profile level 3.2
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 3.2 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel32;
+                        newMimeType += _L8("644020");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=644028*") ) != KErrNotFound )
+                        {
+                        // high profile level 4
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, high profile level 4 requested.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel40;
+                        newMimeType += _L8("644028");
+                        }
+                    else if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+                        {
+                        // no other profile-level ids supported
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() unsupported profile-level requested.")));
+                        User::Leave(KErrNotSupported);
+                        }
+                    else
+                        {
+                        // Default is level 1
+                        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC, no profile requested - defaulting to 1.")));
+                        videoCodecLevel = KCMRH264AVCCodecLevel10;
+                        newMimeType += _L8("42800A");
+                        }
+
+                    // recreate the codec data object
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() H.264/AVC recreating codecdata.")));
+                    delete iVideoCodecData;
+                    iVideoCodecData = NULL;
+                    iVideoCodecData = new (ELeave) CCMRVideoCodecDataH264AVC(videoCodecLevel);
+                    }
+                else
+                    {
+                    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() Unknown mimetype requested.")));
+                    // unknown mimetype
+                    }
+                }
+            }
+        }
+
+    // successfully interpreted the input mime type
+    if ( newMimeType != iMimeType )
+	    {
+        iMimeType = newMimeType; //copy the contents
+		PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() new supported video codec requested - updating available encoders.")));
+		iAvailableVideoEncoders.Reset();
+        if ( iPreferredEncoderUID != KNullUid )
+            {// We have preferred encoder UID from client - override encoder search and use it instead.
+            PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() skipping encoder search. Using API user encoder: %d "), iPreferredEncoderUID.iUid));
+            iAvailableVideoEncoders.AppendL(iPreferredEncoderUID);
+            }
+        else if ( iConfig &&
+                ( iConfig->IsICMConfigDataAvailable() ) &&
+                ( iConfig->VideoQualitySettings().iVideoEncoderUID != KNullUid ) )
+            {// Video quality set has set UID value - override encoder search and use it instead.
+            PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() skipping encoder search. Using ICM config encoder: %d "), iPreferredEncoderUID.iUid));
+            iAvailableVideoEncoders.AppendL(iPreferredEncoderUID);
+            }
+        else
+            {
+            iDevVideoRec->FindEncodersL(iMimeType, 0 /* aPreProc */, iAvailableVideoEncoders, EFalse );
+            PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() search found %d encoder(s)"), iAvailableVideoEncoders.Count() ));
+            }
+        iConfig->SetVideoCodec(iMimeType);
+        iConfig->SetVideoPixelAspectRatio(numerator, denominator);
+
+        UpdateSupportedVideoFrameSizesRates();
+
+        // user has to call this->PrepareL() now that a setting has been changed !!!
+        // allow to start recording only when the state is "EReadyToRecord"
+        PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() codec set, prepare needed before recording.")));
+        SetState(EStateOpen);
+        DoSendEventToClient( KCMRPrepareNeeded, iErrorCode );   // use iErrorCode in case we had stored error; it may be KErrNone too
+        iErrorCode = KErrNone;
+	    }
+
+    PRINT((_L("CCMRVideoRecorder::SetVideoCodecL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::GetVideoCodec
+// Get the used video codec.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::GetVideoCodecL( TDes8& aVideoMimeType ) const
+    {
+    aVideoMimeType = iMimeType;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetTargetBitRateL
+// Sets new target bitrate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetTargetBitRateL(TInt aBitRate)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetTargetBitRate, aBitrate = % d"),aBitRate));
+
+    if ( aBitRate == KMMFVariableVideoBitRate )
+        {
+        // Variable rate requested; normalize the bit-rate (temporarily only in this function)
+        // but set a mode
+        aBitRate = iVideoCodecData->MaxBitRate();
+        iBitRateMode = EBitRateVariable;
+        }
+    else
+        {
+        iBitRateMode = EBitRateConstant;
+        }
+
+    // check that values are reasonable; check max bitrate only when the level is expected to be used for MMS
+    if ( (aBitRate < KCMRMinAcceptedBitRate) || ((iVideoCodecData->LevelForMMS()) && (aBitRate > iVideoCodecData->MaxBitRate())) )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetTargetBitRateL() illegal bitrate")));
+        User::Leave(KErrArgument);
+        }
+
+    // call base class implementation
+    CCMRRecorderBase::SetTargetBitRateL(aBitRate);
+
+    // inform the max bitrate to the sink
+    User::LeaveIfError( iOutput->SetMaxVideoBitRate( aBitRate ) );
+
+    //inform the estimated average bitrate to sink; use a HW-specific scaler to estimate the average
+    TReal videoBitrateScaler = 0;
+    if ( iConfig )
+    	{
+        videoBitrateScaler = iConfig->PluginSettings().iCMRAvgVideoBitRateScaler;
+    	}
+
+    // make sure we never get scaler value 0 (ends up Div0 error)
+    if ( videoBitrateScaler == 0 )
+    	{
+    	videoBitrateScaler = KCMRAvgVideoBitRateScaler;
+    	}
+
+    TInt br = static_cast<TInt>(aBitRate*videoBitrateScaler);
+    User::LeaveIfError( iOutput->SetAverageVideoBitRate( br ) );
+
+    if ( StateRequiresDynamicSetting() )
+        {
+        // we have prepared => new value must be given via dynamic methods
+        FillRateControlOptions( iRateControlOptions );
+        iDevVideoRec->SetRateControlOptions(0, iRateControlOptions); // only base layer (layer 0) supported
+        }
+    else
+        {
+        // we are not recording or prepared => value will be given forward in prepare
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::TargetBitRateL
+// Gets current target bitrate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::TargetBitRateL(TInt& aBitRate)
+    {
+    PRINT((_L("CCMRVideoRecorder::TargetBitRate")));
+
+
+    if ( iBitRateMode == EBitRateConstant )
+        {
+        aBitRate = iTargetBitRate;
+        }
+    else
+        {
+        aBitRate = KMMFVariableVideoBitRate;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetFrameSizeL
+// Sets new input & output frame size
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetFrameSizeL(const TSize& aSize)
+    {
+
+    PRINT((_L("CCMRVideoRecorder::SetFrameSizeL(), In, size: %dx%d"), aSize.iWidth, aSize.iHeight ));
+
+    // allow settings only when in "open" or "readytorecord" states
+    if ( ( State() != EStateOpen ) && ( State() != EStateReadyToRecord ) )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    // check that size is acceptable
+    if ( !iVideoCodecData->MaxFrameSize( aSize ) )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() illegal frame size")));
+        User::Leave(KErrArgument);//could be also KErrNotSupported
+        }
+
+    TSize size;
+    TInt i = 0;
+    TInt j = 0;
+   	TInt k = 0;
+
+    PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() looking match for frame size: %d x %d from camera"), aSize.iWidth, aSize.iHeight ));
+
+    // Some explanation of the logic here. Camera API must support the same rates for all formats, since there
+    // is just a single variable in the info class to check the number of rates.
+    // But the indices may differ and that's why we need enumerations
+    if ( iCameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+        {
+        // check YUV420 planar
+        for ( i = 0; i < iCameraInfo.iNumVideoFrameSizesSupported; i++ )
+            {
+            iSource->EnumerateVideoFrameSizes(size, i, CCamera::EFormatYUV420Planar);
+            PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() Camera EFormatYUV420Planar %d x %d found from camera"), size.iWidth, size.iHeight ));
+
+            if ( size == aSize )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() Camera EFormatYUV420Planar %d x %d Matched."), size.iWidth, size.iHeight ));
+                iSizeIndex420 = i;
+                break;
+                }
+            }
+        }
+    else
+        {
+        i = iCameraInfo.iNumVideoFrameSizesSupported;
+        PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() Camera doesn't support EFormatYUV420Planar")));
+        }
+
+    if ( iCameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV422 )
+        {
+        // check YUV422 interleaved
+        for ( j = 0; j < iCameraInfo.iNumVideoFrameSizesSupported; j++ )
+            {
+            iSource->EnumerateVideoFrameSizes(size, j, CCamera::EFormatYUV422 );
+            PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() Camera EFormatYUV422 %d x %d found from camera"), size.iWidth, size.iHeight ));
+
+            if ( size == aSize )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() Camera EFormatYUV422 %d x %d Matched."), size.iWidth, size.iHeight ));
+                iSizeIndex422 = j;
+                break;
+                }
+            }
+        }
+    else
+        {
+        j = iCameraInfo.iNumVideoFrameSizesSupported;
+        PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() Camera doesn't support EFormatYUV422")));
+        }
+
+	// Search if we have direct capture encoder available -> no need to care about camera supported sizes.
+	if ( iAvailableVideoFrameSizesRates.Count() )
+		{
+        // check direct capture encoder size array
+        for ( k = 0; k < iAvailableVideoFrameSizesRates.Count(); k++ )
+            {
+            // All target resolutions that are below higher resolution found from encoders are accepted.
+            if ( (iAvailableVideoFrameSizesRates[k].iPictureSize.iWidth >= aSize.iWidth) &&
+            	 (iAvailableVideoFrameSizesRates[k].iPictureSize.iHeight >= aSize.iHeight) )
+                {
+                PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() DirectCapture encoder %d x %d Matched."), aSize.iWidth, aSize.iHeight ));
+				iSizeIndexDCEncoder = k;
+                break;
+                }
+            }
+		}
+	else
+		{
+		PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() no directcapture encoder available for given size.")));
+		}
+
+    if ( (i == iCameraInfo.iNumVideoFrameSizesSupported) &&
+    	 (j == iCameraInfo.iNumVideoFrameSizesSupported) &&
+    	 (k == iAvailableVideoFrameSizesRates.Count()) )
+        {
+        // Requested size not supported by camera API or the directcapture encoder
+        PRINT((_L("CCMRVideoRecorder::SetFrameSizeL(), Camera and/or direct capture encoder does not support this resolution")));
+        User::Leave(KErrNotSupported);
+        }
+
+    iFrameSize = aSize;
+    iOutput->SetVideoFrameSize(aSize);
+
+    // user has to call this->PrepareL() now that a setting has been changed !!!
+    // allow to start recording only when the state is "EReadyToRecord"
+    SetState(EStateOpen);
+    DoSendEventToClient( KCMRPrepareNeeded, iErrorCode );   // use iErrorCode in case we had stored error; it may be KErrNone too
+    iErrorCode = KErrNone;
+
+    // update MaxFrameRate to new frame size
+    iMaxFrameRate4GivenSize = iVideoCodecData->MaxFrameRate( iFrameSize );
+
+    // framerate is tied with framesize; if it was set before update it accordingly
+    // this may be overridden by user e.g. with a higher rate; this sets the rates <= previous encoding rate
+    if ( (iRateIndex420 >= 0) || (iRateIndex422 >= 0) || (iRateIndexDCEncoder >= 0) )
+        {
+        // must use iEncodingFrameRate, since other rates may raise encoding rate higher than wanted; this allows camera frame rate to be higher
+        TInt success = KErrNone;
+        do
+            {
+            TRAP( success, SetFrameRateL( iEncodingFrameRate ));
+            if ( success == KErrNone )
+                {
+                break;
+                }
+            // if picture size was increased, we may need to decrease framerate
+            iEncodingFrameRate--;
+            } while ( iEncodingFrameRate > 0 );
+            if ( success != KErrNone )
+                {
+                // This framesize - framerate combination not possible
+                PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() illegal frame size - rate combination")));
+                User::Leave(success);
+                }
+        }
+
+    PRINT((_L("CCMRVideoRecorder::SetFrameSizeL(), Out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::FrameSizeL
+// Gets current frame size
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::FrameSizeL(TSize& aSize) const
+    {
+    PRINT((_L("CCMRVideoRecorder::FrameSizeL()")));
+    aSize = iFrameSize;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetFrameRateL
+// Sets new target frame rate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetFrameRateL(TReal32 aFrameRate)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetFrameRate(), requested rate %f"), aFrameRate));
+
+    // Size has to be set before setting frame rate !!!
+    if ( (State() == EStateNone) || ((iSizeIndex420 < 0) && (iSizeIndex422 < 0) && (iSizeIndexDCEncoder < 0)) )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetFrameRateL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    // check that values are reasonable
+    if ( (aFrameRate <= 0) || (aFrameRate > iVideoCodecData->MaxFrameRate(iFrameSize)) )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetFrameSizeL() illegal frame rate")));
+        User::Leave(KErrArgument);
+        }
+
+    // encoding frame rate is always the requested one
+    if ( aFrameRate <= iMaxFrameRate4GivenSize ) // actually iMaxFrameRate4GivenSize is valid only after prepare
+        {
+        // requested rate looks ok
+        iEncodingFrameRate = aFrameRate;
+        }
+    else if ( iEncodingFrameRate < iMaxFrameRate4GivenSize )
+        {
+        // too high rate requested, but the current rate is still lower than max possible, so we can set the rate higher anyway
+        iEncodingFrameRate = static_cast<TReal32>(iMaxFrameRate4GivenSize);
+        PRINT((_L("CCMRVideoRecorder::SetFrameRate(), requested rate is too high for the used encoder, but set it to this rate: %f"), iMaxFrameRate4GivenSize));
+        }
+    else
+        {
+        // The change has no effect; the used encoder is already set to max possible rate and can't be configured for the requested rate
+        // for now camera api capability is not checked; e.g. if H.263 level is 20 => framerate could be 30fps for QCIF but if max encoder
+        // impl. rate is 10fps, we don't leave, but just ignore
+        PRINT((_L("CCMRVideoRecorder::SetFrameRate(), requested rate is too high for the used encoder, max rate %f"), iMaxFrameRate4GivenSize));
+        return;
+        }
+
+    if ( StateRequiresDynamicSetting() )
+        {
+        // we are running, change only encoding rate now
+
+        // store the requested rate also, to be taken into use in the next prepare
+        if ( !iNightMode )
+            {
+            iRequestedFrameRate = aFrameRate;
+            }
+
+        if ( iEncodingFrameRate > iSourceFrameRate )
+            {
+            // can't be higher than capture rate, limit it
+            iEncodingFrameRate = iSourceFrameRate;
+            }
+
+        // set the rate control params
+        FillRateControlOptions( iRateControlOptions );
+        iDevVideoRec->SetRateControlOptions(0, iRateControlOptions); // only base layer (layer 0) supported
+        }
+    else
+        {
+        // we are in initialization phase, change also camera rate
+
+        TReal32 rate;
+        TInt i;
+
+        iRateIndex420 = -1; //reset just in case, needed to determine if the loop below was successful
+        iRateIndex422 = -1; //reset just in case, needed to determine if the loop below was successful
+        iRateIndexDCEncoder = -1;
+
+        // Some explanation of the logic here. Camera API must support the same rates for all formats, since there
+        // is just a single variable in the info class to check the number of rates.
+        // But the indices may differ and that's why we need enumerations
+        // Since we prefer YUV422, it can override the member variables.
+
+        if ( iCameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+            {
+            // check YUV420 planar
+
+            // search for an exact match from camera's supported rates
+            for ( i = 0; i < iCameraInfo.iNumVideoFrameRatesSupported; i++ )
+                {
+
+                iSource->EnumerateVideoFrameRates(rate, i, CCamera::EFormatYUV420Planar, iSizeIndex420,
+                                                  CCamera::EExposureAuto);
+
+                if ( rate == aFrameRate )
+                    {
+                    iRateIndex420 = i;
+                    iSourceFrameRate = aFrameRate;
+                    iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+                    PRINT((_L("CCMRVideoRecorder::SetFrameRate, asked framerate found")));
+                    break;
+                    }
+                else if ( rate > aFrameRate )
+                    {
+                    // this is higher but could be used (encoder can match the rates)
+                    // Check the other rates too if a better is found
+                    iRateIndex420 = i;
+                    iSourceFrameRate = rate;
+                    iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+                    PRINT((_L("CCMRVideoRecorder::SetFrameRate, a higher source framerate found")));
+                    }
+                }
+            }
+
+        if ( iCameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV422 )
+            {
+            // check YUV422 interleaved
+
+            // search for an exact match from camera's supported rates
+            for ( i = 0; i < iCameraInfo.iNumVideoFrameRatesSupported; i++ )
+                {
+                iSource->EnumerateVideoFrameRates(rate, i, CCamera::EFormatYUV422, iSizeIndex422,
+                                                  CCamera::EExposureAuto);
+
+                if ( rate == aFrameRate )
+                    {
+                    iRateIndex422 = i;
+                    iSourceFrameRate = aFrameRate;
+                    iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+                    PRINT((_L("CCMRVideoRecorder::SetFrameRate, asked framerate found")));
+                    break;
+                    }
+                else if ( rate > aFrameRate )
+                    {
+                    // this is higher but could be used (encoder can match the rates)
+                    // Check the other rates too if a better is found
+                    iRateIndex422 = i;
+                    iSourceFrameRate = rate;
+                    iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+                    PRINT((_L("CCMRVideoRecorder::SetFrameRate, a higher source framerate found")));
+                    }
+                }
+            }
+
+        if ( iAvailableVideoFrameSizesRates.Count() && (iSizeIndexDCEncoder >= 0) && (iSizeIndexDCEncoder < iAvailableVideoFrameSizesRates.Count()) )
+            {
+            // check Direct capture encoder supported rates.
+
+            // search for an exact match from encoders supported rates
+            for ( i = 0; i < iAvailableVideoFrameSizesRates.Count(); i++ )
+                {
+                if ( (iAvailableVideoFrameSizesRates[i].iPictureRate == aFrameRate) &&
+                	 (iAvailableVideoFrameSizesRates[i].iPictureSize == iAvailableVideoFrameSizesRates[iSizeIndexDCEncoder].iPictureSize) )
+                    {
+                    iRateIndexDCEncoder = i;
+                    iSizeIndexDCEncoder = i;
+                    iSourceFrameRate = aFrameRate;
+                    iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+                    PRINT((_L("CCMRVideoRecorder::SetFrameRate, asked framerate found")));
+                    break;
+                    }
+                else if ( (iAvailableVideoFrameSizesRates[i].iPictureRate >= aFrameRate) &&
+                	 	  (iAvailableVideoFrameSizesRates[i].iPictureSize.iWidth >= iAvailableVideoFrameSizesRates[iSizeIndexDCEncoder].iPictureSize.iWidth ) &&
+                	 	  (iAvailableVideoFrameSizesRates[i].iPictureSize.iHeight >= iAvailableVideoFrameSizesRates[iSizeIndexDCEncoder].iPictureSize.iHeight ) )
+                    {
+                    // this is higher but could be used (encoder can match the rates)
+                    // Check the other rates too if a better is found
+                    iRateIndexDCEncoder = i;
+                    iSizeIndexDCEncoder = i;
+                    iSourceFrameRate = aFrameRate;
+                    iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+                    PRINT((_L("CCMRVideoRecorder::SetFrameRate, a higher source framerate found: %dx%d at %f"), iAvailableVideoFrameSizesRates[i].iPictureSize.iWidth,
+                    																							iAvailableVideoFrameSizesRates[i].iPictureSize.iHeight,
+                    																							iAvailableVideoFrameSizesRates[i].iPictureRate ));
+                    }
+                }
+            }
+
+
+        if ( (iRateIndex420 < 0) && (iRateIndex422 < 0) && (iRateIndexDCEncoder < 0) )
+            {
+            // there is no suitable frame rate available, not even a higher one, return error
+            PRINT((_L("CCMRVideoRecorder::SetFrameRate, no suitable framerate found from Camera API and/or direct capture encoder.")));
+            User::Leave(KErrNotSupported);
+            }
+
+        // set to the actual rate to prevent trying set the rate again from PrepareL
+        iRequestedFrameRate = iSourceFrameRate;
+
+        // user has to call this->PrepareL() now that a setting has been changed !!!
+        // allow to start recording only when the state is "EReadyToRecord"
+        if ( State() != EStateOpen )
+            {
+            SetState(EStateOpen);
+            DoSendEventToClient( KCMRPrepareNeeded, iErrorCode );   // use iErrorCode in case we had stored error; it may be KErrNone too
+            iErrorCode = KErrNone;
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::FrameRateL
+// Get the used encoding frame rate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::FrameRateL(TReal32& aFrameRate) const
+    {
+    PRINT((_L("CCMRVideoRecorder::FrameRateL()")));
+    aFrameRate = iEncodingFrameRate;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetVideoCodingOptionsL
+// Set misc video coding options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions)
+    {
+    if ( ( State() != EStateOpen ) && ( State() != EStateReadyToRecord ) )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetVideoCodingOptionsL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    if ( iMinRandomAccessPeriodInSeconds != KCMRUseDefault )
+        {
+        iMinRandomAccessPeriodInSeconds = aOptions.iMinRandomAccessPeriodInSeconds;
+        }
+
+    iVideoCodecData->SetVideoCodingOptionsL(aOptions);
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetVideoRateControlOptionsL
+// Set video rate control options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetVideoRateControlOptionsL(const TRateControlOptions& aOptions)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() in")));
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() TBitrateControlType iControl: %d"), aOptions.iControl));
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() iBitrate: %d"), aOptions.iBitrate));
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() iPictureQuality: %d"), aOptions.iPictureQuality));
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() iPictureRate: %f"), aOptions.iPictureRate));
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() iQualityTemporalTradeoff: %f"), aOptions.iQualityTemporalTradeoff));
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() iLatencyQualityTradeoff: %f"), aOptions.iLatencyQualityTradeoff));
+
+    if ( !StateRequiresDynamicSetting() )
+    	{
+        PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() illegal state for dynamic settings")));
+    	User::Leave(KErrNotReady);
+    	}
+
+	// Handle new bitrate value:
+    if ( (aOptions.iBitrate < KCMRMinAcceptedBitRate) || ((iVideoCodecData->LevelForMMS()) && (aOptions.iBitrate > iVideoCodecData->MaxBitRate())) )
+        {// check that values are reasonable; check max bitrate only when the level is expected to be used for MMS
+        PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() illegal bitrate")));
+        User::Leave(KErrArgument);
+        }
+    CCMRRecorderBase::SetTargetBitRateL(aOptions.iBitrate);
+    // inform the max bitrate to the sink
+    User::LeaveIfError( iOutput->SetMaxVideoBitRate( aOptions.iBitrate ) );
+    //inform the estimated average bitrate to sink; use a HW-specific scaler to estimate the average
+    TReal videoBitrateScaler = 0;
+    if ( iConfig )
+    	{
+        videoBitrateScaler = iConfig->PluginSettings().iCMRAvgVideoBitRateScaler;
+    	}
+    if ( videoBitrateScaler == 0 )
+    	{// make sure we never get scaler value 0 (ends up Div0 error)
+    	videoBitrateScaler = KCMRAvgVideoBitRateScaler;
+    	}
+    TInt br = static_cast<TInt>(aOptions.iBitrate*videoBitrateScaler);
+    User::LeaveIfError( iOutput->SetAverageVideoBitRate( br ) );
+
+
+    //Handle new framerate value:
+    if ( (aOptions.iPictureRate <= 0) || (aOptions.iPictureRate > iVideoCodecData->MaxFrameRate(iFrameSize)) )
+        {// check that values are reasonable
+        PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() illegal frame rate, %f"), aOptions.iPictureRate));
+        User::Leave(KErrArgument);
+        }
+    if ( aOptions.iPictureRate <= iMaxFrameRate4GivenSize ) // actually iMaxFrameRate4GivenSize is valid only after prepare
+        {// encoding frame rate is always the requested one
+        iEncodingFrameRate = aOptions.iPictureRate;        // requested rate looks ok
+        }
+    else if ( iEncodingFrameRate < iMaxFrameRate4GivenSize )
+        {// too high rate requested, but the current rate is still lower than max possible, so we can set the rate higher anyway
+        iEncodingFrameRate = static_cast<TReal32>(iMaxFrameRate4GivenSize);
+        PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL(), requested rate is too high for the used encoder, but set it to this rate: %f"), iMaxFrameRate4GivenSize));
+        }
+    if ( !iNightMode )
+        {// store the requested rate also, to be taken into use in the next prepare
+        iRequestedFrameRate = aOptions.iPictureRate;
+        }
+    if ( iEncodingFrameRate > iSourceFrameRate )
+        {// can't be higher than capture rate, limit it
+        iEncodingFrameRate = iSourceFrameRate;
+        }
+
+    iRateControlOptions = aOptions;
+    iRateControlOptions.iPictureRate = iEncodingFrameRate;
+    if ( iDevVideoRec )
+    	{
+        PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() settings stored and sending them to Devvideo.")));
+        iDevVideoRec->SetRateControlOptions(0, iRateControlOptions); // only base layer (layer 0) supported
+    	}
+    else
+    	{
+        PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() no DevVideoRec! Leaving KErrNotReady -18")));
+    	User::Leave(KErrNotReady);
+    	}
+    PRINT((_L("CCMRVideoRecorder::SetVideoRateControlOptionsL() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::GetVideoRateControlOptionsL
+// Get video rate control options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::GetVideoRateControlOptionsL(TRateControlOptions& aOptions)
+    {
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() in")));
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() TBitrateControlType iControl: %d"), iRateControlOptions.iControl));
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() iBitrate: %d"), iRateControlOptions.iBitrate));
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() iPictureQuality: %d"), iRateControlOptions.iPictureQuality));
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() iPictureRate: %f"), iRateControlOptions.iPictureRate));
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() iQualityTemporalTradeoff: %f"), iRateControlOptions.iQualityTemporalTradeoff));
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() iLatencyQualityTradeoff: %f"), iRateControlOptions.iLatencyQualityTradeoff));
+
+    if ( !StateRequiresDynamicSetting() )
+        {
+        PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() illegal state for dynamic settings")));
+        User::Leave(KErrNotReady);
+        }
+    aOptions = iRateControlOptions;
+    PRINT((_L("CCMRVideoRecorder::GetVideoRateControlOptionsL() out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetPreferredVideoEncoderL
+// Set video encoder using its UID. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetPreferredVideoEncoderL(TUid& aEncoder)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetPreferredVideoEncoderL() in")));
+    iPreferredEncoderUID = aEncoder;
+
+    if ( iPreferredEncoderUID != KNullUid )
+        {// We have preferred encoder UID from client - override encoder search and use it instead.
+        PRINT((_L("CCMRVideoRecorder::SetPreferredVideoEncoderL() skipping encoder search. Using API user encoder: %d "), iPreferredEncoderUID.iUid));
+        iAvailableVideoEncoders.Reset();
+        iAvailableVideoEncoders.AppendL(iPreferredEncoderUID);
+        UpdateSupportedVideoFrameSizesRates();
+        }
+
+    PRINT((_L("CCMRVideoRecorder::SetPreferredVideoEncoderL() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetPreferredVideoEncapsulationL
+// Set video encoder output format encapsulation. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetPreferredVideoEncapsulationL() in")));
+    iPreferredEncapsulation = aCapsulation;
+    iPreferredEncapsulationSet = ETrue;
+    PRINT((_L("CCMRVideoRecorder::SetPreferredVideoEncapsulationL() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::SetSegmentTargetSize
+// Set video segment target size
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::SetSegmentTargetSizeL(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks)
+    {
+    PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() in")));
+    PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() aLayer: %d"), aLayer));
+    PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() aSizeBytes: %d"), aSizeBytes));
+    PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() aSizeMacroblocks: %d"), aSizeMacroblocks));
+
+    if ( !StateRequiresDynamicSetting() )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() illegal state for dynamic settings")));
+        User::Leave(KErrNotReady);
+        }
+
+    if ( iDevVideoRec )
+        {
+        PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() sending SetSegmentTargetSize to Devvideo.")));
+        iDevVideoRec->SetSegmentTargetSize(aLayer, aSizeBytes, aSizeMacroblocks); // only base layer (layer 0) supported
+        }
+    else
+        {
+        PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() no DevVideoRec! Leaving KErrNotReady -18")));
+        User::Leave(KErrNotReady);
+        }
+    PRINT((_L("CCMRVideoRecorder::SetSegmentTargetSize() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::AdjustTimeStampsL
+// Adjust time stamps of video
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::AdjustTimeStampsL(const TInt aAdjustmentMs)
+    {
+    if ( State() != EStateRecording )
+        {
+        PRINT((_L("CCMRVideoRecorder::AdjustTimeStampsL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    iAdjustmentTimeUs = TInt64( aAdjustmentMs * 1000 );
+
+    PRINT((_L("CCMRVideoRecorder::AdjustTimeStampsL() by %d us"),I64INT(iAdjustmentTimeUs)));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MvsoReserveComplete
+// Called by camera API when camera API has been reserved
+// for exclusive use
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MvsoReserveComplete(TInt aError)
+    {
+    PRINT((_L("CCMRVideoRecorder::MvsoReserveComplete() in")));
+
+    // Should not be called, if we use direct capture mode
+    if (iDirectCapture)
+        {
+        VRASSERT(0);
+        }
+
+    // need to set this already here if returns unsuccesfully, to enable error handling when encoder init completes
+    iSourceInitComplete = ETrue;
+
+    if ( iEncoderInitComplete && (iErrorCode != KErrNone) )
+        {
+        // there was an error in the encoder initialisation, but the reporting was
+        // waiting for the completion of the source initialisation => report it now
+        PRINT((_L("CCMRVideoRecorder::MvsoReserveComplete() but error in video encoder: %d"), iErrorCode));
+        DoSendEventToClient( KCMREncoderInitError, iErrorCode );
+        iErrorCode = KErrNone;
+        return;
+        }
+
+    if ( aError != KErrNone )
+        {
+        if ( iEncoderInitComplete )
+            {
+            PRINT((_L("CCMRVideoRecorder::MvsoReserveComplete() with error: %d"), aError));
+            DoSendEventToClient( KCMRCameraReserveError, aError );
+            }
+        else
+            {
+            // report only when encoder is completed too
+            PRINT((_L("CCMRVideoRecorder::MvsoReserveComplete() with error: %d, but must wait for encoder init completion"), aError));
+            iErrorCode = aError;
+            }
+        return;
+        }
+
+    TInt error;
+
+    TRAP(error, iSource->PrepareCaptureL(iVideoFormat, iSizeIndex, iRateIndex,
+                                         iNumCameraBuffers, KCMRNumFramesInCameraBuffer));
+
+    PRINT((_L("CCMRVideoRecorder::MvsoReserveComplete() camera prepared, error %d"),error));
+    if ( error != KErrNone )
+        {
+        if ( iEncoderInitComplete )
+            {
+            DoSendEventToClient( KCMRCameraPrepareError, error );
+            }
+        else
+            {
+            // report only when encoder is completed too
+            iErrorCode = error;
+            }
+        return;
+        }
+
+
+    if ( iEncoderInitComplete )
+        {
+        SetState(EStateReadyToRecord);
+
+        // everything ok, inform observer that we are prepared.
+        DoSendEventToClient( KCMRPrepareComplete, KErrNone );
+        }
+
+    PRINT((_L("CCMRVideoRecorder::MvsoReserveComplete() out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MvsoFrameBufferReady
+// Called by camera API when a frame (or several frames)
+// has been captured
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MvsoFrameBufferReady(MFrameBuffer* aFrameBuffer, TInt aError)
+    {
+    // Should not be called, if we use direct capture mode
+    if (iDirectCapture)
+        {
+        VRASSERT(0);
+        }
+
+    if ( aError != KErrNone || aFrameBuffer == NULL )
+        {
+        // some errors, inform observer and return
+        DoSendEventToClient( KCMRCameraCaptureError, aError );
+        if ( aFrameBuffer )
+            {
+            // in case of errors, aFrameBuffer may be NULL
+            aFrameBuffer->Release();
+            }
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady with error %d"), aError));
+        return;
+        }
+
+    PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady in %x, frame & time & systemdrift\t%d\t%d\t%d"),aFrameBuffer,
+                                                                                       aFrameBuffer->iIndexOfFirstFrameInBuffer,
+                                                                                       I64INT(aFrameBuffer->iElapsedTime.Int64()),
+                                                                                       I64INT(iSystemClockDelta.Int64())
+                                                                                       ));
+
+#ifdef VIDEO_FILE_OUTPUT
+
+    // Write the frame to a file for testing purposes
+    TInt error = KErrNone;
+    TRAPD(error2, error = iOutputFile.Write( *(aFrameBuffer->DataL(0)) ));
+
+    // release frame
+    aFrameBuffer->Release();
+
+    if (error != KErrNone || error2 != KErrNone)
+        {
+        DoSendEventToClient( KCMRRunTimeError, error );
+        }
+
+
+#else
+    // the real deal
+
+    if ( (State() != EStateRecording) || (iErrorCode != KErrNone) )
+        {
+        // we are paused or stopping or there was an error => return the framebuffer immediately
+        // if system clock has been changed during pause take that account in future frame timestamp calculations.
+        if ( (((aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64()) < iLatestAbsoluteTimeStamp.Int64()) ||
+             ((aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64()) > (iLatestAbsoluteTimeStamp.Int64() + 2*iSourceFrameInterval))) &&
+             (aFrameBuffer->iIndexOfFirstFrameInBuffer == iPreviousCameraFrameIndex + 1) )
+             {
+             // something has changed system clock during pause, add cumulatively to drift delta.
+             iSystemClockDelta = (iLatestAbsoluteTimeStamp.Int64() + iSourceFrameInterval) -
+                                 (aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64())
+                                 + iSystemClockDelta.Int64();
+
+             PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady() System time change: aFrameBuffer->iElapsedTime = %d, iSystemClockDelta = %d, iLatestAbsoluteTimeStamp = %d, iSourceFrameInterval = %d"),
+                                                                                              I64INT(aFrameBuffer->iElapsedTime.Int64()),
+                                                                                              I64INT(iSystemClockDelta.Int64()),
+                                                                                              I64INT(iLatestAbsoluteTimeStamp.Int64()),
+                                                                                              iSourceFrameInterval));
+             }
+
+        iLatestAbsoluteTimeStamp = aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64();
+        iPreviousCameraFrameIndex = aFrameBuffer->iIndexOfFirstFrameInBuffer;
+        aFrameBuffer->Release();
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady() not recording, skip this one")));
+        return;
+        }
+
+
+#if ( defined (__WINS__) || defined (__WINSCW__) )
+    if ( iEncoderInputQueueLength > 0 )
+        {
+        // Too many pictures already in the encoder's input queue - skip this one. In Wins the criteria is more strict since performance is lower
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady() - encoder already has one frame under processing, skip this one")));
+        iPreviousCameraFrameIndex = aFrameBuffer->iIndexOfFirstFrameInBuffer;
+        aFrameBuffer->Release();
+        return;
+        }
+#else
+    if ( iEncoderInputQueueLength >= KCMRMaxPreEncoderBufferPictures )
+        {
+        // Too many pictures already in the encoder's input queue - skip this one
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady() - Encoder input/output queue(s) already full, must skip a captured frame")));
+        iPreviousCameraFrameIndex = aFrameBuffer->iIndexOfFirstFrameInBuffer;
+        aFrameBuffer->Release();
+        return;
+        }
+#endif
+
+    // Regulate timestamp to avoid too small or too large variations
+
+    // use frame index instead of associated buffer timestamp, since timestamps may be
+    // less accurate and may cause rounding problems when converted to e.g. H.263 TRs
+    TInt64 frameTimeStamp;
+    frameTimeStamp = TInt64((aFrameBuffer->iIndexOfFirstFrameInBuffer - iDriftFrameSkipCount + iAddedFrameDurationCount) * 1E6/iSourceFrameRate + 0.5);   // use accurate division here since rounded value in multiplication multiplies also the rounding error
+
+    // However, relying purely on frameindex causes drifting if the used source framerate value here is not exactly
+    // the camera input rate. Hence we need to do some adjustments.
+    // The frameindex may also be exclude skipped frames, but that should considered a bug in camera drivers, although the Camera API spec is not fully unambiguous about this
+    TInt64 expectedNewTimeStamp;
+    if ( iNumberOfCapturedFrames > 0 )
+        {
+        expectedNewTimeStamp = iLatestAbsoluteTimeStamp.Int64() + iSourceFrameInterval;
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), expectedNewTimeStamp (abs)\t%d\t"),I64INT(expectedNewTimeStamp)));
+        }
+    else
+        {
+        //first frame
+        expectedNewTimeStamp = 0;
+        iDriftFrameSkipCount = 0;
+        iAddedFrameDurationCount = 0;
+        iPreviousCameraFrameIndex = 0;
+        }
+
+    TInt frameDropCount = aFrameBuffer->iIndexOfFirstFrameInBuffer - iPreviousCameraFrameIndex - 1;
+    iPreviousCameraFrameIndex = aFrameBuffer->iIndexOfFirstFrameInBuffer;
+    //
+    // Handle case where camera has dropped frames.
+    //
+    if ( frameDropCount > 0 )
+        {// Camera dropped frame
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), Camera dropped %d frame(s), drift from expected: \t%d\t"),
+                                                frameDropCount,
+                                                I64INT((frameTimeStamp - expectedNewTimeStamp ))));
+        frameTimeStamp = expectedNewTimeStamp + (frameDropCount*iSourceFrameInterval);
+        }
+	//
+	// Handle case where camera frame timestamp is more than previous encoded timestamp + specified camera frame duration.
+	//
+    else if ( aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64() > expectedNewTimeStamp )
+        {
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), adjusted timestamp since it was greater than expected timestamp and we have delayed timestamps earlier\t%d\t"),I64INT((expectedNewTimeStamp - frameTimeStamp))));
+        // we have adjusted timestamps more to positive direction (delayed timestamps), try to compensate it now
+        // if camera frames have drifted more than 1 frame duration increase frame time stamp with one frame duration (as if frame dropped).
+        if ((aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64() - expectedNewTimeStamp) > iSourceFrameInterval )
+        	{
+        	iAddedFrameDurationCount++;
+        	PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), Camera timestamp has drifted more than 1 frame duration - adding 1 frame duration to timestamp from now on!\t%d\t"), iAddedFrameDurationCount ));
+        	expectedNewTimeStamp = iLatestAbsoluteTimeStamp.Int64() + 2*iSourceFrameInterval;
+            PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), new expectedNewTimeStamp (abs)\t%d\t"),I64INT(expectedNewTimeStamp)));
+        	}
+        frameTimeStamp = expectedNewTimeStamp;
+        }
+	//
+	// Handles case where camera frame timestamp is less than previous encoded frame timestamp
+	// * happens when Camera is producing higher FPS that target FPS causing frame timestamp to drift below calculated cumulative recording time.
+	//
+    else if ( aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64() < iLatestAbsoluteTimeStamp.Int64() )
+        {
+        // frame with the timestamp of this frame was already encoded
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), drift between expected and frame buffer timestamp more than 1 frame duration, dropping frame!")));
+        iDriftFrameSkipCount++;
+        aFrameBuffer->Release();
+        return;
+        }
+	//
+	// Handle case where (camera frame index * framerate) is less than camera frame timestamp - specified camera frame duration
+	// * happens when Camera is skipping frames without extra increase in frame index count.
+	//
+    else if ( frameTimeStamp < ( (aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64()) - iSourceFrameInterval ) )
+        {
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), adjusted timestamp since frame counter was too small compared to elapsed time: difference\t%d\t"),I64INT(aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64() - frameTimeStamp)));
+        // frame numbers & elapsed time do not match, probably camera is skipping frames but doesn't know it / doesn't inform it to us
+        frameTimeStamp = Max( aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64(), expectedNewTimeStamp );
+        }
+    //
+    // Handle case where (camera frame index * framerate) is less than calculated estimated timestamp value for currect frame
+    // (based on previous encoded frame timestamp + specified camera frame duration)
+    //
+    else if ( frameTimeStamp < expectedNewTimeStamp )
+        {
+        // timestamp should not be too close to the previous timestamp (video codecs set max for framerate <=> min for ts diff)
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), adjusted timestamp since it was smaller than expected timestamp, difference\t%d\t"),I64INT(expectedNewTimeStamp - frameTimeStamp)));
+        frameTimeStamp = expectedNewTimeStamp;
+        }
+    else
+        {
+        // leave it as it is
+        }
+
+    // for now we've been playing with absolute times, excluding all pauses & adjustments. Save this value as reference for determining timestamp for the next frame
+    iLatestAbsoluteTimeStamp = frameTimeStamp;
+
+    if ( iAdjustmentTimeUs != 0 )
+        {
+        // at the moment, initial and pause values are in opposite direction (+/-)
+        // for initial adjustment:
+        // if audio is ahead (iAdjustmentTimeUs > 0) => video should fast forward (video timestamps should be increased),
+        // if audio is behind (iAdjustmentTimeUs < 0) => video should "pause" for a while (video timestamps should be decreased)
+        // note that we modify here the iPausedTime which is subtracted from aFrameBuffer->iElapsedTime, so these
+        // changes affect kind of reverse way
+
+        if ( ( frameTimeStamp - (iTotalPausedTime.Int64() - iAdjustmentTimeUs) ) >= (iLatestUsedTimeStamp.Int64() + iSourceFrameInterval) )
+            {
+            // iAdjustmentTimeUs > 0 or < 0 but not too much < 0 so that the resulting timestamp won't be < (latest time stamp + sourceframeinterval)
+            iTotalPausedTime = iTotalPausedTime.Int64() - iAdjustmentTimeUs;
+            PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), adjusted paused time by %d us"), I64INT(iAdjustmentTimeUs)));
+            iAdjustmentTimeUs = 0;
+            }
+        else
+            {
+            // iAdjustmentTimeUs < 0 here, we should "pause" video (skip frames) until we reach the required time
+            // Skipping is needed to avoid the timestamps to skip back over already captured frames.
+            PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), skipped a frame due to time adjustment request %d; buffer->elapsedTime %d; latest time stamp %d"), I64INT(iAdjustmentTimeUs), I64INT(aFrameBuffer->iElapsedTime.Int64() + iSystemClockDelta.Int64()), I64INT(iLatestUsedTimeStamp.Int64()) ));
+            aFrameBuffer->Release();
+            return;
+            }
+        }
+
+    // subtract the time we were paused
+    // (MSL assumes devvideorecord/hw device does this but we do it here)
+    TTimeIntervalMicroSeconds iPrevUsedTimeStamp = iLatestUsedTimeStamp;
+    iLatestUsedTimeStamp = frameTimeStamp - iTotalPausedTime.Int64();
+
+    // Increment timestamp in case we dropped frames during pause
+    while(( iLatestUsedTimeStamp < iPrevUsedTimeStamp ) && ( iNumberOfCapturedFrames > 0 ))
+        {
+        PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady() incrementing timestamp by one frame")));
+        iLatestUsedTimeStamp = TTimeIntervalMicroSeconds( iLatestUsedTimeStamp.Int64() + iSourceFrameInterval );
+        }
+
+    PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), iTotalPausedTime \t%d"), I64INT(iTotalPausedTime.Int64()) ));
+    PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady(), iLatestUsedTimeStamp (relative) & drift from elapsed time\t%d"), I64INT(iLatestUsedTimeStamp.Int64()) ));
+
+    EncodeFrame(aFrameBuffer);
+
+    PRINT((_L("CCMRVideoRecorder::MvsoFrameBufferReady, out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::EncodeFrame
+// Encodes the given video frame.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::EncodeFrame(MFrameBuffer* aFrameBuffer)
+    {
+    PRINT((_L("CCMRVideoRecorder::EncodeFrame, in")));
+
+    // Take a TVideoPicture into use
+    TVideoPicture* outputPicture = NULL;
+    if ( iCodingFifo->IsEmpty() )
+        {
+        // allocate a new
+        outputPicture = new TVideoPicture;
+        if ( outputPicture == NULL )
+            {
+            // out of memory, stop operation
+            DoSendEventToClient( KCMRRunTimeError, KErrNoMemory );
+            aFrameBuffer->Release();
+            return;
+            }
+        }
+    else
+        {
+        // take an old one from the queue
+        outputPicture = reinterpret_cast<TVideoPicture*>(iCodingFifo->Get());
+        }
+
+    iNumberOfCapturedFrames++;
+
+#ifdef _DEBUG
+    TTime current;
+    current.UniversalTime();
+    TInt elapsedMs = I64INT((current.MicroSecondsFrom(iLastCapture).Int64())) / 1000;
+    iCumulativeCaptureTime += elapsedMs;
+    iAverageCaptureTime = TReal(iCumulativeCaptureTime) / TReal(iNumberOfCapturedFrames);
+
+    PRINT((_L("CCMRVideoRecorder::EncodeFrame() recording time %d, ms since last: %d, average capture time: %4.2f"),
+        (I64INT(current.MicroSecondsFrom(iRecordStartTime).Int64())) / 1000,
+        elapsedMs,
+        iAverageCaptureTime));
+
+    iLastCapture = current;
+    iEncodingStartTime.UniversalTime();
+#endif
+
+    // wrap captured frame to encoder input buffer
+    outputPicture->iData.iDataFormat = EYuvRawData;
+    outputPicture->iData.iDataSize.iWidth = iFrameSize.iWidth;
+    outputPicture->iData.iDataSize.iHeight = iFrameSize.iHeight;
+    TRAPD(err, (outputPicture->iData.iRawData = (TPtr8*)aFrameBuffer->DataL(0)));
+    if ( err != KErrNone )
+        {
+        // error, stop operation
+        DoSendEventToClient( KCMRRunTimeError, err );
+        aFrameBuffer->Release();
+        delete outputPicture;
+        return;
+        }
+
+    outputPicture->iTimestamp = iLatestUsedTimeStamp;
+    outputPicture->iOptions = TVideoPicture::ETimestamp;
+    outputPicture->iUser = this;
+
+#ifdef _DEBUG__
+    TTime current;
+    current.UniversalTime();
+
+
+    PRINT((_L("CCMRVideoRecorder::EncodeFrame()\t%d"),
+        (I64INT(current.MicroSecondsFrom(iRecordStartTime).Int64())) ));
+#endif
+
+
+    // Put the captured buffer to iSourceFifo
+    TRAP( err, iSourceFifo->PutL( reinterpret_cast<TAny*>(aFrameBuffer) ));
+    if ( err != KErrNone )
+        {
+        // out of memory, stop operation
+        DoSendEventToClient( KCMRRunTimeError, err );
+        aFrameBuffer->Release();
+        delete outputPicture;
+        return;
+        }
+
+
+    // give the frame to devVideoRec for encoding
+    iEncoderInputQueueLength++;
+    TRAP( err, iDevVideoRec->WritePictureL( outputPicture ) );
+    if ( err != KErrNone )
+        {
+        // error, stop operation, aFrameBuffer will be released from fifo when stopped
+        DoSendEventToClient( KCMRRunTimeError, err );
+        return;
+        }
+
+    PRINT((_L("CCMRVideoRecorder::EncodeFrame, picture %x written to devvr"),outputPicture));
+
+#endif // #else if !VIDEO_FILE_OUTPUT
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MdvroInitializeComplete
+// Called by DevVideoRecord when its initalization is complete
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MdvroInitializeComplete(TInt aError)
+    {
+    PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete(), error[%d]"), aError));
+
+    if ( iDirectCapture )
+        {
+        // Since direct capture is used, it should be true. Actual init CAPI status is
+        // included to aError now.
+        iSourceInitComplete = ETrue;
+        }
+
+    iEncoderInitComplete = ETrue;
+
+    if ( iSourceInitComplete && (iErrorCode != KErrNone) )
+        {
+        // there was an error in the source initialisation, but the reporting was
+        // waiting for the completion of the encoder initialisation => report it now
+        PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete() but camera reservation had error: %d"), iErrorCode));
+        DoSendEventToClient( KCMRCameraReserveError, iErrorCode );
+        iErrorCode = KErrNone;
+        return;
+        }
+
+    if ( aError != KErrNone )
+        {
+        if ( aError == KErrHardwareNotAvailable && iVideoCodecHWAccelerated )
+            {
+            PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete() - initialization of HW accelerated video encoder failed, retrying with ARM codec")));
+            // hw accel codec and init failed due to resource problems => retry with non-hw-accelerated
+            iEncoderInitComplete = EFalse;
+            PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete() - initialization of HW accelerated video encoder failed, delete devvideo")));
+            if (iDevVideoRec)
+                {
+                delete iDevVideoRec;
+                iDevVideoRec = NULL;
+                }
+            TRAPD(err, iDevVideoRec = CMMFDevVideoRecord::NewL( *this ));
+            if ( err == KErrNone )
+                {
+                PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete() - initialization of HW accelerated video encoder failed, new devvideo created")));
+                TRAP(err,SetupEncoderL());
+                if ( err == KErrNone )
+                    {
+                    // ok, continue waiting for the callback
+                    return;
+                    }
+                else
+                    {
+                    // store the last error, to be used in the operations below
+                    aError = err;
+                    }
+                }
+            else
+                {
+                // store the last error, to be used in the operations below
+                PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete() - initialization of HW accelerated video encoder failed, new devvideo creation failed.")));
+                aError = err;
+                }
+            }
+
+        if ( iSourceInitComplete )
+            {
+            PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete() with error: %d"), aError));
+            DoSendEventToClient( KCMREncoderInitError, aError );
+            }
+        else
+            {
+            // report only when source is completed too
+            PRINT((_L("CCMRVideoRecorder::MdvroInitializeComplete() with error: %d, but must wait for camera reserve completion"), aError));
+            iErrorCode = aError;
+            }
+        return;
+        }
+
+    if ( aError == KErrNone )
+        {
+        // If Encoder initialized Ok, give other run-time settings
+        // 1. Give dynamic settings to encoder after initializing
+        if ( !iVideoCodecHWAccelerated && ( iDevVideoRec->NumComplexityLevels(iEncoderHWDeviceId) > 0 ) )
+            {
+            iVideoComplexity = iConfig->PluginSettings().iVideoComplexitySetting;
+            iDevVideoRec->SetComplexityLevel( iEncoderHWDeviceId, iVideoComplexity );
+            }
+        // HW codec-specific configuration is HW dependent, and hence outside the scope of Series 60
+
+        // 2. Rate control options
+        if ( iEncodingFrameRate > iMaxFrameRate4GivenSize )
+            {
+            iEncodingFrameRate = static_cast<TReal32>(iMaxFrameRate4GivenSize);
+            }
+
+        FillRateControlOptions( iRateControlOptions );
+        iDevVideoRec->SetRateControlOptions(0, iRateControlOptions); // only base layer (layer 0) supported
+        TRAPD(err,iVideoCodecData->SetPostInitParamsL(iDevVideoRec));
+        if ( err ) {}
+        // ignore the error, having some post init setting is not crucial
+
+        }
+
+    if ( iSourceInitComplete )
+        {
+        SetState(EStateReadyToRecord);
+
+        // everything ok, inform observer that we are prepared.
+        DoSendEventToClient( KCMRPrepareComplete, KErrNone );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MdvroReturnPicture
+// Called by DevVideoRecord when it does not need the given
+// input frame anymore
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MdvroReturnPicture(TVideoPicture* aPicture)
+    {
+#ifdef _DEBUG
+    TTime current;
+    current.UniversalTime();
+
+
+    PRINT((_L("CCMRVideoRecorder::MdvroReturnPicture() time now\t%d"),
+        (I64INT(current.MicroSecondsFrom(iRecordStartTime).Int64())) ));
+#endif
+
+    // take oldest frame from fifo
+    VRASSERT( !iSourceFifo->IsEmpty() );// if empty, for some reason the buffer was already returned!!
+
+    MFrameBuffer* buffer = reinterpret_cast<MFrameBuffer*>(iSourceFifo->Get());
+
+    // check that its the oldest stored captured picture
+    TPtr8* tmp = NULL;
+    TRAPD(error, (tmp = static_cast<TPtr8*>(buffer->DataL(0))));
+    if ( tmp != aPicture->iData.iRawData )
+        {
+        // pictures are returned in different order than they were sent
+		RPointerArray<MFrameBuffer> buffers;
+        buffers.Append(buffer);
+
+        TUint i;
+        for ( i = 1; i < iNumCameraBuffers; i++ )
+            {
+            buffers.Append(reinterpret_cast<MFrameBuffer*>(iSourceFifo->Get()));
+
+            TRAP(error, (tmp = static_cast<TPtr8*>(buffers[i]->DataL(0))));
+            if ( tmp == aPicture->iData.iRawData )
+                {
+                // Found it! Put the retrieved buffers back to the queue
+                TInt err = KErrNone;
+                TUint j;
+                for ( j = 0; j < i; j++ )
+                    {
+                    TRAP( err, iSourceFifo->PutL( reinterpret_cast<TAny*>(buffers[j]) ));
+                    // This can't really fail since we just got the buffers from the fifo and in that case PutL doesn't allocate anything => can't leave
+                    VRASSERT( err == KErrNone );
+                    buffers[j] = NULL;
+                    }
+                break;
+                }
+            }
+        VRASSERT( i < iNumCameraBuffers );
+        buffer = buffers[i];
+        buffers.Close();
+        }
+
+    // release captured buffer
+    PRINT((_L("CCMRVideoRecorder::MdvroReturnPicture() releasing %x"), buffer ));
+    buffer->Release();
+    buffer = NULL;
+
+    iEncoderInputQueueLength--;
+
+
+    // save the picture holder to fifo
+    TRAPD( err, iCodingFifo->PutL( reinterpret_cast<TAny*>(aPicture) ));
+    if ( err != KErrNone )
+        {
+        // OOM, inform error and stop operation
+        DoSendEventToClient( KCMRRunTimeError, err );
+        delete aPicture;
+        return;
+        }
+    PRINT((_L("CCMRVideoRecorder::MdvroReturnPicture() stored %x"), aPicture ));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MdvroSupplementalInfoSent
+// Called by DevVideoRecord when supplemental info (e.g.,
+// VOL header) has been sent to the encoder
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MdvroSupplementalInfoSent()
+    {
+    PRINT((_L("CCMRVideoRecorder::MdvroSupplementalInfoSent()")));
+    User::Panic(_L("CCMRVIDEORECORDER"), KErrGeneral);
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MdvroNewBuffers
+// Called by DevVideoRecord when new bitstream buffers are
+// available for retrieval
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MdvroNewBuffers()
+    {
+	PRINT((_L("CCMRVideoRecorder::MdvroNewBuffers() - START - iRequestStatus: 0x%08x"), iRequestStatus ));
+    PRINT((_L("CCMRVideoRecorder::MdvroNewBuffers(), NumDataBuffers[%d]"), iDevVideoRec->NumDataBuffers() ));
+    iNumberOfEncodedFrames++;
+
+    TVideoOutputBuffer* buffer = NULL;
+    for (;;)
+        {
+        TRAPD( err, ( buffer = iDevVideoRec->NextBufferL()));
+
+        if ( err != KErrNone )
+            {
+            return;
+            }
+        if ( buffer == NULL )
+            {
+            break;
+            }
+/*      TInt bufferSize = buffer->iData.Length();
+        TInt bufferTimeStamp = I64INT(buffer->iCaptureTimestamp.Int64());
+        OstTraceExt2( TRACE_PERFORMANCE, CCMRVIDEORECORDER_MDVRONEWBUFFERS, "CCMRVideoRecorder::MdvroNewBuffers %d %d", bufferSize, bufferTimeStamp );
+*/        
+        // enter restricted area
+        iMutexObj.Wait();
+        // store
+        PRINT((_L("CCMRVideoRecorder::MdvroNewBuffers(), storing buffer: 0x%x, timestamp: high: %u low: %u"), buffer, I64HIGH(buffer->iCaptureTimestamp.Int64()),I64LOW(buffer->iCaptureTimestamp.Int64())));
+        iVideoOutputBufferInputQue.AddLast(*buffer);
+        iNumberOfVideoOutputBuffers++;
+
+        // leave restricted area
+        iMutexObj.Signal();
+        }
+
+    // enter restricted area
+    iMutexObj.Wait();
+    if ( iRequestStatus )
+        {
+    	PRINT((_L("CCMRVideoRecorder::MdvroNewBuffers() - completing output request..." )));
+        iOutputThreadHandle.RequestComplete( iRequestStatus, KErrNone );
+        }
+    else
+        {
+        // else a new request has not been issued yet
+    	PRINT((_L("CCMRVideoRecorder::MdvroNewBuffers() - skipping RequestComplete" )));
+        }
+    // leave restricted area
+    iMutexObj.Signal();
+
+	PRINT((_L("CCMRVideoRecorder::MdvroNewBuffers() - END - iRequestStatus: 0x%08x"), iRequestStatus ));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MdvroFatalError
+// Called by devVideoRecord when a fatal error has occurred
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MdvroFatalError(TInt aError)
+    {
+    PRINT((_L("CCMRVideoRecorder::MdvroFatalError(), error[%d]"), aError));
+
+    // Since now don't touch DevVideo that expects only destruction from the client, otherwise panics..
+    iFatalError = ETrue;
+
+    // Cancel returning buffers to DevVideo
+    iBufferReturnAO->Cancel();
+
+    if ( iDevVideoRec )
+    	{
+    	delete iDevVideoRec;
+    	iDevVideoRec = NULL;
+    	}
+
+    if ( State() == EStateStopping )
+        {
+        // error occurred while stopping => carry out the rest of stopping & inform client
+        SetState( EStateReadyToRecord );
+        DoSendEventToClient( KCMRRecordingComplete, aError );
+        }
+    else
+        {
+        // inform client
+        DoSendEventToClient( KCMRRunTimeError, aError );
+        iErrorCode = aError;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::MdvroStreamEnd
+// Called by devVideoRecord when all pictures have been processed
+// (after InputEnd is called)
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::MdvroStreamEnd()
+    {
+    PRINT((_L("CCMRVideoRecorder::MdvroStreamEnd() in")));
+
+    // MdvroStreamEnd was called by devVideo without InputEnd
+    VRASSERT( iInputEnd );
+
+    // get all available buffers from devvideo
+    PRINT((_L("CCMRVideoRecorder::MdvroStreamEnd(), getting all encoded frames from DevVideo.")));                
+    TVideoOutputBuffer* buffer = NULL;
+    for (;;)
+        {
+        TRAPD( err, ( buffer = iDevVideoRec->NextBufferL()));
+        if ( err != KErrNone || buffer == NULL)
+            {
+            break;
+            }
+        // enter restricted area
+        iMutexObj.Wait();
+        // store
+        PRINT((_L("CCMRVideoRecorder::MdvroStreamEnd(), storing buffer: 0x%x, timestamp:%d"), buffer, I64INT(buffer->iCaptureTimestamp.Int64())));                  
+        iVideoOutputBufferInputQue.AddLast(*buffer);
+        iNumberOfVideoOutputBuffers++;
+
+        // leave restricted area
+        iMutexObj.Signal();
+        }
+    
+    PRINT((_L("CCMRVideoRecorder::MdvroStreamEnd(), flushing written frames back to DevVideo.")));                
+    iBufferReturnAO->Flush();    
+    
+    // stop
+    if ( iDevVideoRec )
+    	{
+        PRINT((_L("CCMRVideoRecorder::MdvroStreamEnd() iDevVideoRec->Stop called")));    	
+        iDevVideoRec->Stop();
+    	}
+
+    iStreamEnd = ETrue;
+    
+    // set state & inform MR => it can return from stop
+    SetState( EStateReadyToRecord );
+
+    // everything ok, inform observer that we are ready for a new recording (iStopping does it too, though).
+    DoSendEventToClient( KCMRRecordingComplete, KErrNone );
+
+    PRINT((_L("CCMRVideoRecorder::MdvroStreamEnd() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::RequestNewData
+// Output active object is ready to accept new data
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::RequestNewData(TRequestStatus& aStatus)
+    {
+	PRINT((_L("CCMRVideoRecorder::RequestNewData() - START - aStatus: 0x%08x, iRequestStatus: 0x%08x"), &aStatus, iRequestStatus ));
+
+    // enter restricted area
+    iMutexObj.Wait();
+
+    iRequestStatus = &aStatus;
+	aStatus = KRequestPending;
+
+    // leave restricted area
+    iMutexObj.Signal();
+
+	PRINT((_L("CCMRVideoRecorder::RequestNewData() - END - aStatus: 0x%08x, iRequestStatus: 0x%08x"), &aStatus, iRequestStatus ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::RequestNewDataCancel
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::RequestNewDataCancel(TRequestStatus& aStatus)
+    {
+	PRINT((_L("CCMRVideoRecorder::RequestNewDataCancel() - START - aStatus: 0x%08x, iRequestStatus: 0x%08x"), &aStatus, iRequestStatus ));
+
+    // enter restricted area
+    iMutexObj.Wait();
+
+	if ( &aStatus == iRequestStatus )
+		{
+		iOutputThreadHandle.RequestComplete( iRequestStatus, KErrCancel );
+		}
+
+    // leave restricted area
+    iMutexObj.Signal();
+
+	PRINT((_L("CCMRVideoRecorder::RequestNewDataCancel() - END - aStatus: 0x%08x, iRequestStatus: 0x%08x"), &aStatus, iRequestStatus ));
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::GetNextBuffer
+// Output active object takes the next output buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCMRMediaBuffer* CCMRVideoRecorder::GetNextBuffer()
+    {
+    PRINT((_L("CCMRVideoRecorder::GetNextBuffer() in") ));
+    if ( iDevVideoRec == NULL || iFatalError )
+        {
+        // probably we have not been opened yet
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer(), We have not been opened yet, or there's an error from devVideo")));
+        return NULL;
+        }
+
+    if ( iDecSpecInfo )
+        {
+        // we have MPEG-4 decoder configuration information, it must be processed first
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer() iDecSpecInfo") ));
+        iRemoveHeader = ETrue;
+        const TUint8* data = iDecSpecInfo->Ptr();
+        iDecSpecInfoLength = iDecSpecInfo->Length();
+
+        CCMRMediaBuffer::TBufferType decSpecType = CCMRMediaBuffer::EVideoMPEG4DecSpecInfo;
+        if ( iVideoBufferType == CCMRMediaBuffer::EVideoH264NAL )
+            {// H.264 AVC NAL / GenericPayload encapsulation
+            decSpecType = CCMRMediaBuffer::EVideoH264NALDecSpecInfo;
+            }
+        else if ( iVideoBufferType == CCMRMediaBuffer::EVideoH264Bytestream )
+            {
+            decSpecType = CCMRMediaBuffer::EVideoH264BytestreamDecSpecInfo;
+            }
+
+        // wrap the relevant data to CCMRMediaBuffer; iOutputSinkBuffer can't be != NULL here since it is created in ConstructL
+        iOutputSinkBuffer->Set( TPtrC8(data,iDecSpecInfoLength),
+                                decSpecType,
+                                iDecSpecInfoLength,
+                                EFalse,
+                                TTimeIntervalMicroSeconds(0) );
+
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer() decoder specific info to sink sent")));
+        return iOutputSinkBuffer;
+        }
+
+    // enter restricted area
+    iMutexObj.Wait();
+    if (iNumberOfVideoOutputBuffers > 0)
+        {
+        iOutputVideoBuffer = iVideoOutputBufferInputQue.First();
+
+        // Remove the picture from the list
+        iOutputVideoBuffer->iLink.Deque();
+        iNumberOfVideoOutputBuffers--;
+        // leave restricted area
+        iMutexObj.Signal();
+        }
+    else
+        {
+        // leave restricted area
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer()returning null, leave restricted area, iNumberOfVideoOutputBuffers == 0 %x"), this));
+        iMutexObj.Signal();
+        return NULL;
+        }
+
+    PRINT((_L("CCMRVideoRecorder::GetNextBuffer() got [0x%x] from devvr"), iOutputVideoBuffer ));
+
+    if ( iOutputVideoBuffer != NULL )
+        {
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer() processing iOutputVideoBuffer") ));
+        TBool outputMediaBufferSet = EFalse;
+        if ( iRemoveHeader )
+            {
+            // check if we need to remove VOS+VO+VOL header from the bitstream, since it is stored in metadata, and
+            // having it in 2 places may cause interoperability problems
+            PRINT((_L("CCMRVideoRecorder::GetNextBuffer() remove extra header info") ));
+            iRemoveHeader = EFalse;
+            if ( iVideoBufferType == CCMRMediaBuffer::EVideoMPEG4 )
+                {// MPEG-4
+                RemoveSeqHeader( reinterpret_cast<TDesC8*>(&iOutputVideoBuffer->iData) );
+                }
+            else if ( iVideoBufferType == CCMRMediaBuffer::EVideoH264NAL )
+                {// H.264 AVC NAL /  EDuGenericPayload / NAL encapsulation
+                // Removes SPS & PPS from first frame from encoder to avoid situation where its both in
+                // .mp4 file metadata and in bitstream of video track.
+                // Make sure buffer contains only one frame and rewrite encapsulation to make sure its ok.
+                RemoveNalDecSpecInfoHeader( reinterpret_cast<TDesC8*>(&iOutputVideoBuffer->iData) );
+                outputMediaBufferSet = ETrue;
+                }
+            else if ( iVideoBufferType == CCMRMediaBuffer::EVideoH264Bytestream )
+                {// H.264 AVC NAL /  EDuElementarystream / Bytestream
+                // Removes SPS & PPS from first frame from encoder to avoid situation where its both in
+                // .mp4 file metadata and in bitstream of video track.
+                RemoveByteStreamDecSpecInfoHeader( reinterpret_cast<TDesC8*>(&iOutputVideoBuffer->iData) );
+                outputMediaBufferSet = ETrue;
+                }
+            }
+
+        if ( !outputMediaBufferSet )
+        	{
+            // wrap the relevant data to CCMRMediaBuffer
+	        iOutputSinkBuffer->Set( iOutputVideoBuffer->iData,
+									iVideoBufferType,
+									iOutputVideoBuffer->iData.Length(),
+									iOutputVideoBuffer->iRandomAccessPoint,
+									iOutputVideoBuffer->iCaptureTimestamp );
+        	}
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer() iOutputSinkBuffer set") ));
+
+#ifdef _DEBUG__
+            TTime current;
+            current.UniversalTime();
+            TInt elapsedMs = (I64INT(current.MicroSecondsFrom(iEncodingStartTime).Int64())) / 1000;
+            iCumulativeEncodingTime += elapsedMs;
+            iAverageEncodingTime = TReal(iCumulativeEncodingTime) / TReal(iNumberOfEncodedFrames);
+
+
+            PRINT((_L("CCMRVideoRecorder::GetNextBuffer() %d, time consumed: %d, average encoding time: %4.2f"),
+                (I64INT(current.MicroSecondsFrom(iRecordStartTime).Int64())) / 1000,
+                (I64INT(current.MicroSecondsFrom(iEncodingStartTime).Int64())) / 1000,
+                iAverageEncodingTime));
+#endif
+
+#ifdef VIDEO_BS_FILE_OUTPUT
+            // Write the frame to a file for testing purposes; have to ignore possible errors
+            iOutputFile.Write(videoBuffer->iData);
+#endif
+
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer() a buffer to sink sent with timestamp high: %u low: %u"),I64HIGH(iOutputVideoBuffer->iCaptureTimestamp.Int64()),I64LOW(iOutputVideoBuffer->iCaptureTimestamp.Int64())));        
+        return iOutputSinkBuffer;
+        }
+    else
+        {
+        PRINT((_L("CCMRVideoRecorder::GetNextBuffer() returning NULL - no new buffers in queue") ));
+        // no more new buffers in queue
+        return NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::NumBuffersWaiting
+// Return the number of buffers in the source
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoRecorder::NumBuffersWaiting()
+    {
+    if (iFatalError)
+        {
+        // NumDataBuffers() cannot be called since fatalError was reported
+        return 0;
+        }
+
+    if ( iDecSpecInfo )
+        {
+        // decspecinfo is not counted in iNumberOfVideoOutputBuffers
+        return (iNumberOfVideoOutputBuffers+1);
+        }
+    else
+        {
+        return iNumberOfVideoOutputBuffers;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::LatestTimeStampL
+// Return the latest time stamp from the input stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::LatestTimeStampL(TTimeIntervalMicroSeconds& aTimeStamp) const
+    {
+    aTimeStamp = iLatestUsedTimeStamp;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::DurationL
+// Get duration of the recording (in practice the same as the latest time stamp)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::DurationL(TTimeIntervalMicroSeconds& aDuration) const
+    {
+    LatestTimeStampL( aDuration );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::ReturnBuffer
+// Output active object returns an emptied buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::ReturnBuffer(CCMRMediaBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRVideoRecorder::ReturnBuffer() buffers 0x%x, 0x%x"),aBuffer, iOutputSinkBuffer));
+    VRASSERT( iOutputSinkBuffer == aBuffer );
+
+    if ( iFatalError )
+        {
+        PRINT((_L("CCMRVideoRecorder::ReturnBuffer(), don't return anything, since there's an error from devVideo")));
+        iOutputVideoBuffer = NULL;
+        return;
+        }
+
+    iOutputSinkBuffer = aBuffer;
+    if ( iDecSpecInfo )
+        {
+        delete iDecSpecInfo;
+        iDecSpecInfo = NULL;
+        // iOutputVideoBuffer is not used with decspecinfo
+        }
+    else
+        {
+        // normal case; iOutputVideoBuffer != NULL if functions are called in correct order
+        PRINT((_L("CCMRVideoRecorder::ReturnBuffer() iOutputVideoBuffer 0x%x"), iOutputVideoBuffer));
+        VRASSERT( iOutputVideoBuffer != NULL );
+        // store the buffer for sending from this thread
+        iBufferReturnAO->EnqueueReturnBuffer(iOutputVideoBuffer);
+
+        iOutputVideoBuffer = NULL;
+        }
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::FillRateControlOptions
+// Fill DevVideoRecord rate control options structure
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::FillRateControlOptions( TRateControlOptions& aRC )
+    {
+    TRAPD(error,CCMRRecorderBase::TargetBitRateL((TInt&)(aRC.iBitrate)));
+
+    // error can be ignored, it will never be != KErrNone at this stage
+    if (error != KErrNone)
+        {
+        VRASSERT( error == KErrNone );
+        }
+
+    if ( iBitRateMode == EBitRateConstant )
+        {
+        aRC.iControl = EBrControlStream;
+        }
+    else
+        {
+        // Variable bitrate; rc.iBitrate is probably not needed but it gives now the upper limit
+        aRC.iControl = EBrControlNone;
+        }
+
+    aRC.iPictureRate = iEncodingFrameRate;
+    // these are filled already in constructor:
+    //aRC.iPictureQuality
+    //aRC.iLatencyQualityTradeoff
+    //aRC.iQualityTemporalTradeoff
+    PRINT((_L("CCMRVideoRecorder::FillRateControlOptions() - framerate %f, bitrate %d"), aRC.iPictureRate, aRC.iBitrate));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CheckExposure
+// Check exposure from camera and adjust framerates if needed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::CheckExposure()
+    {
+    if ( iSource->GetExposure() == CCamera::EExposureNight )
+        {
+        iNightMode = ETrue;
+        iSourceFrameRate = iConfig->PluginSettings().iVideoNightFrameRate;
+        iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+
+        // new framerate should be set to the encoder too
+        TRAPD(error, SetFrameRateL( iSourceFrameRate ));
+
+        // error can be ignored, it will never be != KErrNone here
+        if (error != KErrNone)
+            {
+            VRASSERT( error == KErrNone );
+            }
+        }
+    else
+        {
+        // other modes don't affect to framerates, except if we switch back from night mode to normal
+        if ( iNightMode )
+            {
+            iSourceFrameRate = iRequestedFrameRate;
+            iSourceFrameInterval = convertFrameRateToInterval(iSourceFrameRate);
+
+            // new framerate should be set to the encoder too
+            TRAPD(error,SetFrameRateL( iSourceFrameRate ));
+
+            // error can be ignored, it will never be != KErrNone here
+            if (error != KErrNone)
+                {
+                VRASSERT( error == KErrNone );
+                }
+
+            iNightMode = EFalse;
+            }
+        }
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::UpdateSupportedFrameSizesRates
+// Update supported video frames and sizes table from ECAM and MDF encoders.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::UpdateSupportedVideoFrameSizesRates()
+	{
+	PRINT((_L("CCMRVideoRecorder::UpdateSupportedFrameSizesRates() in")));
+	iAvailableVideoFrameSizesRates.Reset();
+
+	if ( iAvailableVideoEncoders.Count() )
+		{
+	    for ( TInt i = 0 ; i < iAvailableVideoEncoders.Count(); i++ )
+	        {
+		    // encoder info for retrieving capabilities
+		    CVideoEncoderInfo* encoderInfo = NULL;
+	        PRINT((_L("CCMRVideoRecorder::UpdateSupportedFrameSizesRates() - getting info from a plugin index[%d] with Uid 0x%x"), i, iAvailableVideoEncoders[i].iUid ));
+	        TRAPD(error, (encoderInfo = ReadEncoderInfoL(iAvailableVideoEncoders[i])) );
+
+	        if ( (encoderInfo != NULL) && (error == KErrNone))
+	            {
+                // Check directCapture support for current codec
+				if ( encoderInfo->SupportsDirectCapture() )
+					{
+			        // check max framerate for given picture size
+			        RArray<TPictureRateAndSize> rateAndSize = encoderInfo->MaxPictureRates();
+			        for ( TUint j = 0; j < rateAndSize.Count(); j++ )
+			            {
+			            TPictureRateAndSize newSizeRate = rateAndSize[j];
+						TInt addError = iAvailableVideoFrameSizesRates.InsertInOrder(newSizeRate, TLinearOrder<TPictureRateAndSize>(TLinearOrderFuncVideoSizeRate) );
+						if (addError == KErrNone)
+							{
+							PRINT((_L("CCMRVideoRecorder::UpdateSupportedFrameSizesRates() - Added size: %d x %d, rate: %f"),
+																					rateAndSize[j].iPictureSize.iWidth,
+																					rateAndSize[j].iPictureSize.iHeight,
+																					rateAndSize[j].iPictureRate));
+							}
+						}
+					}
+				delete encoderInfo;
+	            }
+	        }
+		}
+	PRINT((_L("CCMRVideoRecorder::UpdateSupportedFrameSizesRates() out")));
+	}
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::DoSendEventToClient
+// Send event to client
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoRecorder::DoSendEventToClient(TUid aEventType, TInt aErrorCode)
+    {
+    PRINT((_L("CCMRVideoRecorder::DoSendEventToClient(), aEventType %d"),aEventType.iUid));
+    TMMFEvent event(aEventType, aErrorCode);
+    return iEventHandler.SendEventToClient(event);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::ReturnBufferToDevVR
+// CCMRReturnAO uses this function to return buffer to DevVideoRecord
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::ReturnBufferToDevVR(TVideoOutputBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRVideoRecorder::ReturnBufferToDevVR() in buffer: 0x%x, timestamp: high: %u low: %u"), aBuffer, I64HIGH(aBuffer->iCaptureTimestamp.Int64()),I64LOW(aBuffer->iCaptureTimestamp.Int64())));
+    if (iDevVideoRec)
+    	{
+        iDevVideoRec->ReturnBuffer(aBuffer);
+    	}
+    PRINT((_L("CCMRVideoRecorder::ReturnBufferToDevVR() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::RemoveSeqHeader( TDesC8* aVideoBuffer )
+// RemoveSeqHeader remove MPEG4 decoder configuration info (VOS+VO+VOL header)
+// from the 1st video packet (it is saved in metadata, and duplication not allowed)
+// Returns: TInt number of bytes removed
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoRecorder::RemoveSeqHeader( TDesC8* aVideoBuffer )
+    {
+    // MPEG-4 VOP header == the 1st element in the buffer to not remove
+    const TUint8 KHeader[4] = {0x00, 0x00, 0x01, 0xb6};
+    const TUint KSampleLength = 4;
+
+    TPtr8* buffer = reinterpret_cast<TPtr8*>(aVideoBuffer);
+    // Bitstream start point
+    const TUint8* data = buffer->Ptr();
+    TUint headerLength;
+    TBool iFound = EFalse;
+
+    // Search for VOP start code
+    for ( headerLength = 0; headerLength < (buffer->Length() - (KSampleLength - 1)); headerLength++ )
+        {
+        if ( (data[headerLength] == KHeader[0])
+            && (data[headerLength+1] == KHeader[1])
+            && (data[headerLength+2] == KHeader[2])
+            && (data[headerLength+3] == KHeader[3]) )
+            {
+            // VOP start code is found => video data starts from here
+            iFound = ETrue;
+            break;
+            }
+        }
+
+    if ( (headerLength > 0) && iFound )
+        {
+        // adjust ptr & length depending which is longer VOP header location or earlier iDecSpecInfoLength length
+        if ( iDecSpecInfoLength && (iDecSpecInfoLength <= headerLength ) )
+	        {
+	        buffer->Delete(0,iDecSpecInfoLength);
+	        }
+        else
+	        {
+			buffer->Delete(0,headerLength);
+	        }
+        }
+    return headerLength;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::RemoveNalDecSpecInfoHeader( TDesC8* aVideoBuffer )
+// Removes decoder configuration info (SPS & PPS) from first NAL encapsulated H.264/AVC video buffer
+// from encoder to avoid situation where its both in .mp4 file metadata and in bitstream of video track.
+// Makes sure buffer contains only one frame and rewrite encapsulation to make sure its ok.
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoRecorder::RemoveNalDecSpecInfoHeader( TDesC8* aVideoBuffer )
+	{
+	// H.264 AVC NAL /  EDuGenericPayload / NAL encapsulation
+
+    // Get reference to the buffer
+    TPtr8* ptr = reinterpret_cast<TPtr8*>(aVideoBuffer);
+    // Bitstream start point
+    TPtr8& buffer(*ptr);
+    TInt frameStart = 0;
+    TInt frameSize = 0;
+    TInt offset = 0;
+    TInt bufType = 0;
+    TInt i=0;
+    TInt totalNALLength = 0;
+    TInt firstCopiedNAL = 0;
+    TInt nalCount = 0;
+    RArray<TInt> nalSizes;
+    RArray<TInt> nalStarts;
+
+    PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() in, length: %d "), buffer.Length() ));
+
+	// There should be enough data for the NAL header + frame
+    if ( buffer.Length() > 12 )
+        {
+        // Offset to the end and get NAL unit count
+        offset = buffer.Length()-4; //last 4 bytes are the NAL unit count
+        nalCount = TInt(buffer[offset]) +
+                  (TInt(buffer[offset + 1]) << 8) +
+                  (TInt(buffer[offset + 2]) << 16) +
+                  (TInt(buffer[offset + 3]) << 24);
+
+        for(i=0; i<nalCount; i++)
+            {//go through all NAL units in buffer
+            // Offset to the start of NAL Unit infos
+            offset = buffer.Length()-4-(8*nalCount); // 4 is the NAL unit count at end of buffer, 8 bytes used per NAL Unit for FrameStartOffset and FrameSize.
+
+            // Get frame start offset
+            offset += 8*i;
+            frameStart = TInt(buffer[offset]) +
+                        (TInt(buffer[offset + 1]) << 8) +
+                        (TInt(buffer[offset + 2]) << 16) +
+                        (TInt(buffer[offset + 3]) << 24);
+
+            PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() NAL unit %d frame start: %d "), i, frameStart ));
+
+            // Get frame size
+            offset += 4;
+            frameSize = TInt(buffer[offset]) +
+                       (TInt(buffer[offset + 1]) << 8) +
+                       (TInt(buffer[offset + 2]) << 16) +
+                       (TInt(buffer[offset + 3]) << 24);
+
+           PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() NAL unit %d frame size: %d "), i, frameSize ));
+           bufType = buffer[frameStart] & 0x1F;
+           PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() NAL unit %d type: %d "), i, bufType ));
+           if ( bufType != 7 && //SPS
+                bufType != 8 )//PPS
+               {
+               // we found first NAL unit that isn't SPS or PPS
+               nalSizes.Append(frameSize);
+               if (firstCopiedNAL==0)
+                   {
+                   firstCopiedNAL = frameStart;
+                   }
+               nalStarts.Append(frameStart-firstCopiedNAL);               
+               totalNALLength = frameStart+frameSize-firstCopiedNAL;
+               PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() new total length: %d, padding: %d "), totalNALLength, totalNALLength%4 ));
+               totalNALLength += totalNALLength%4;
+               }
+           }
+
+        // The buffer should have enough space for the new NAL header
+
+        // We need to write a new NAL header just after the frame end
+        PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() writing new header.")));
+        offset = firstCopiedNAL + totalNALLength;
+        
+        if ( (offset + nalSizes.Count()*8 + 4) > buffer.Length() ) 
+            {
+            PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() Fatal error, cannot create header, non-align 32bit encoder output buffer.")));
+            VRASSERT(0);            
+            }
+
+        for (TInt j=0; j<nalSizes.Count(); j++)
+            {
+            PRINT((_L("CCMRVideoRecorder::RemoveNalDecSpecInfoHeader() new header, unit: %d, start: %d, size: %d."), j, nalStarts[j], nalSizes[j] ));            
+            // Write NAL unit start position
+            buffer[offset + 0] = TUint8(nalStarts[j] & 0xff);
+            buffer[offset + 1] = TUint8((nalStarts[j] >> 8) & 0xff);
+            buffer[offset + 2] = TUint8((nalStarts[j] >> 16) & 0xff);
+            buffer[offset + 3] = TUint8((nalStarts[j] >> 24) & 0xff);
+
+            // Write NAL unit size
+            offset +=4;
+            buffer[offset + 0] = TUint8(nalSizes[j] & 0xff);
+            buffer[offset + 1] = TUint8((nalSizes[j] >> 8) & 0xff);
+            buffer[offset + 2] = TUint8((nalSizes[j] >> 16) & 0xff);
+            buffer[offset + 3] = TUint8((nalSizes[j] >> 24) & 0xff);
+
+            offset +=4;
+            }
+
+        // Write the number of NAL units
+        buffer[offset + 0] = TUint8(nalSizes.Count() & 0xff);;
+        buffer[offset + 1] = TUint8((nalSizes.Count() >> 8) & 0xff);;
+        buffer[offset + 2] = TUint8((nalSizes.Count() >> 16) & 0xff);
+        buffer[offset + 3] = TUint8((nalSizes.Count() >> 24) & 0xff);
+        }
+
+    // Get a pointer to the position where the frame starts
+    TPtrC8 tmp( (buffer.Ptr() + firstCopiedNAL), (totalNALLength + (nalSizes.Count()*8) + 4) );
+
+    // Set output media buffer
+    iOutputSinkBuffer->Set( tmp, CCMRMediaBuffer::EVideoH264NAL,
+                            tmp.Length(), iOutputVideoBuffer->iRandomAccessPoint,
+                            iOutputVideoBuffer->iCaptureTimestamp );
+
+    nalSizes.Close();
+    nalStarts.Close();
+    return firstCopiedNAL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::RemoveByteStreamDecSpecInfoHeader( TDesC8* aVideoBuffer )
+// Removes decoder configuration info (SPS & PPS) from first bytestream encapsulated H.264/AVC video buffer
+// from encoder to avoid situation where its both in .mp4 file metadata and in bitstream of video track.
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoRecorder::RemoveByteStreamDecSpecInfoHeader( TDesC8* aVideoBuffer )
+	{// H.264 AVC NAL /  EDuElementarystream / Bytestream
+    TInt skippedBytes = -1;
+    TInt bufType = 0;
+
+    // Get reference to the buffer
+    TPtr8* buffer = reinterpret_cast<TPtr8*>(aVideoBuffer);
+    // Bitstream start point
+    const TUint8* data = buffer->Ptr();
+
+    PRINT((_L("CCMRVideoRecorder::RemoveByteStreamDecSpecInfoHeader() in, length: %d "), buffer->Length() ));
+
+    // check buffer for bytestream header and possible decSpecInfo (SPS & PPS)
+    for (TInt i=0; i+4< buffer->Length(); i++)
+    	{
+    	// check for bytestream encapsulation [00 00 00 01]
+    	if ( data[i] == 0 &&
+    		 data[i+1] == 0 &&
+    		 data[i+2] == 0 &&
+    		 data[i+3] == 1 )
+    		{
+    	    PRINT((_L("CCMRVideoRecorder::RemoveByteStreamDecSpecInfoHeader() 0001 header at: %d "), i ));
+    		// search buffer that isn't SPS or PPS
+    		bufType = data[i+4] & 0x1F;
+    		PRINT((_L("CCMRVideoRecorder::RemoveByteStreamDecSpecInfoHeader() buffer type: %d "), bufType ));
+    		if ( (bufType == 7 || //SPS
+    			  bufType == 8) && //PPS
+    			  skippedBytes == -1 )
+    		    {// we need to skip SPS and PPS so activate next if clause
+    			skippedBytes = 0;
+    		    }
+    		if ( bufType != 7 && //SPS
+                 bufType != 8 && //PPS
+                 skippedBytes == 0)
+    		    {// found first non SPS / PPS buffer content -> stop stripping here
+    			skippedBytes = i;
+    		    PRINT((_L("CCMRVideoRecorder::RemoveByteStreamDecSpecInfoHeader() skipping: %d bytes"), skippedBytes ));
+    			}
+    		}
+    	}
+/*
+    if (skippedBytes)
+        {
+        for (TInt j=0; j<skippedBytes;j++)
+            {
+            PRINT((_L("CCMRVideoRecorder::RemoveByteStreamDecSpecInfoHeader() skipping %d: %x "), j, data[j] ));
+            }
+        }
+*/
+    // Get a pointer to the position where the frame starts
+    TPtrC8 tmp(buffer->Ptr() + skippedBytes, buffer->Length() - skippedBytes);
+
+    // Set output media buffer
+    iOutputSinkBuffer->Set( tmp, CCMRMediaBuffer::EVideoH264Bytestream,
+                            tmp.Length(), iOutputVideoBuffer->iRandomAccessPoint,
+                            iOutputVideoBuffer->iCaptureTimestamp );
+
+    return skippedBytes;
+	}
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+CCMRVideoRecorder::CCMRReturnAO* CCMRVideoRecorder::CCMRReturnAO::NewL(CCMRVideoRecorder* aHost)
+    {
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::NewL(), In")))
+
+    CCMRReturnAO* self = new (ELeave) CCMRReturnAO(aHost);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::NewL(), Out")))
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::CCMRReturnAO
+// Default constructor for CCMRReturnAO
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCMRVideoRecorder::CCMRReturnAO::CCMRReturnAO(CCMRVideoRecorder* aHost) :
+        CActive(EPriorityNormal),
+        iVideoOutputBufferReturnQue(_FOFF(TVideoOutputBuffer,iLink)),
+        iVideoOutputBufferReturnQueIter(iVideoOutputBufferReturnQue),
+        iHost(aHost)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorder::CCMRReturnAO::ConstructL()
+    {
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::ConstructL() in")));
+    User::LeaveIfError(iMutexObj.CreateLocal());
+    iMutexCreated = ETrue;
+    User::LeaveIfError(iVideoThreadHandle.Open(RThread().Id()));
+    iThreadHandleOpened = ETrue;
+
+    iStatus = KRequestPending;
+    SetActive();
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::ConstructL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::~CCMRReturnAO
+// Destructor for CCMRReturnAO
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCMRVideoRecorder::CCMRReturnAO::~CCMRReturnAO()
+    {
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::~CCMRReturnAO")));
+    if ( iMutexCreated )
+        {
+        iMutexObj.Close();
+        }
+    if ( iThreadHandleOpened )
+        {
+        iVideoThreadHandle.Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::EnqueueReturnBuffer
+// Enqueue TVideoOutputBuffer from controller thread to be returned to
+// DevVideoRecord from this thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::CCMRReturnAO::EnqueueReturnBuffer(TVideoOutputBuffer* aBuffer)
+    {
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::EnqueueReturnBuffer() in aBuffer=0x%x "), aBuffer));
+    // enter restricted area
+    iMutexObj.Wait();
+    iVideoOutputBufferReturnQue.AddLast(*aBuffer);
+    if ( iStatus == KRequestPending )
+        {
+        TRequestStatus* tmp = &iStatus;
+        iVideoThreadHandle.RequestComplete(tmp, KErrNone);
+        }
+    // leave restricted area
+    iMutexObj.Signal();
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::EnqueueReturnBuffer() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::Flush
+// Flush content of return queueu to DevVideo
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::CCMRReturnAO::Flush()
+    {
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::Flush() in.")));
+    iMutexObj.Wait();
+    while (!iVideoOutputBufferReturnQue.IsEmpty())
+        {
+        // take the oldest buffer
+        TVideoOutputBuffer* tmp = iVideoOutputBufferReturnQue.First();
+        // Remove the picture from the list
+        tmp->iLink.Deque();
+        // send it to DevVR using the CCMRVideoRecorder object
+        iHost->ReturnBufferToDevVR(tmp);
+        tmp = NULL;
+        }
+    // leave restricted area
+    iMutexObj.Signal();
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::Flush() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::RunL
+// Returns the queued buffers
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::CCMRReturnAO::RunL()
+    {
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::RunL() - iStatus: %d"), iStatus.Int() ));
+    SetActive();
+    // enter restricted area
+    iMutexObj.Wait();
+    iStatus = KRequestPending;
+    while (!iVideoOutputBufferReturnQue.IsEmpty())
+        {
+        // take the oldest buffer
+        TVideoOutputBuffer* tmp = iVideoOutputBufferReturnQue.First();
+        // Remove the picture from the list
+        tmp->iLink.Deque();
+        // send it to DevVR using the CCMRVideoRecorder object
+        iHost->ReturnBufferToDevVR(tmp);
+        tmp = NULL;
+        }
+    // leave restricted area
+    iMutexObj.Signal();
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::RunL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::RunError
+// Handles errors from RunL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoRecorder::CCMRReturnAO::RunError(TInt aError)
+    {
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::RunError")));
+    // currently RunL can't leave, but keep this here to remind the possible need in the future
+    if (aError != KErrNone)
+        {
+        PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::RunError() error %d"),aError));
+        }
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorder::CCMRReturnAO::DoCancel
+// Cancels the active object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorder::CCMRReturnAO::DoCancel()
+    {
+    // Cancel the request
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::DoCancel() in")));
+    if ( iStatus == KRequestPending )
+        {
+        TRequestStatus *stat = &iStatus;
+        User::RequestComplete(stat, KErrCancel);
+        }
+    PRINT((_L("CCMRVideoRecorder::CCMRReturnAO::DoCancel() out")));
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRMediaRecorderImp.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1594 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for video recorder
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRVideoRecorderClient.h"
+#include "CCMRMediaRecorderImp.h"
+#include "CCMRPerfMonitor.h"
+#include "CCMRVideoHWParams.h"
+#include "CCMRVideoCodecs.h"
+#include "CCMRSupportedCodecs.h"
+#include "CCMRConfigManager.h"
+#include <mmf/common/mmfvideo.h>
+
+
+// MACROS
+
+// Assertion macro wrapper for code cleanup
+#define MRASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CCMRMEDIARECORDER"), EInternalAssertionFailure))
+
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::CCMRMediaRecorderImp
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCMRMediaRecorderImp::CCMRMediaRecorderImp()
+    {
+
+    iObserver = NULL;
+    iSink = NULL;
+    iVideoRecorder = NULL;
+    iAudioRecorder = NULL;
+    iVideoRecorderPreparing = EFalse;
+    iAudioRecorderPreparing = EFalse;
+    iAudioEnabled = ETrue;
+    iState = EStateNone;
+    iErrorCode = KErrNone;
+
+    iMaxTargetBitRate = KMMFVariableVideoBitRate; //here this means: not set (=> won't be checked when setting A/V bitrates)
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCMRMediaRecorder* CCMRMediaRecorder::NewL()
+    {
+
+    CCMRMediaRecorderImp* self = new (ELeave) CCMRMediaRecorderImp();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::ConstructL()
+    {
+    iState = EStateNone;
+
+    // create video recorder
+    iVideoRecorder = CCMRVideoRecorderClient::NewL();
+    // create audio recorder
+    iAudioRecorder = CCMRAudioRecorder::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::~CCMRMediaRecorderImp
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCMRMediaRecorderImp::~CCMRMediaRecorderImp()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::~CCMRMediaRecorderImp() in")));
+    // note, adding "this->" below disabled a PC Lint warning since it makes State explicitly to refer to this class
+    if ( (this->State() == EStateRecording) || (this->State() == EStatePaused) )
+        {
+        // recorder must be stopped first
+        PRINT((_L("CCMRMediaRecorderImp::~CCMRMediaRecorderImp() must stop first")));
+        TRAPD(err, this->StopL());
+        if ( err ) {}
+        // we are destructing, ignore the error; error can't be KErrNotReady since our state is not stopping
+        }
+    // we can't enter here when in stopping-state since stop is blocking controller thread to wait
+    // for audio & video threads to complete stop
+    // Note that pausing & destructing can't happen at the same time since neither of them can be executed internally,
+    // so we don't need to check pausing state here
+
+    // zeroed to make PC Lint happy
+    iObserver = NULL;
+    iSink = NULL;
+    iAudioSource = NULL;
+
+
+    delete iAudioRecorder;
+    PRINT((_L("CCMRMediaRecorderImp::~CCMRMediaRecorderImp() iAudioRecorder deleted")));
+    delete iPerfMonitor;
+    delete iConfig;
+    delete iVideoRecorder;
+    PRINT((_L("CCMRMediaRecorderImp::~CCMRMediaRecorderImp() iVideoRecorder deleted")));
+    delete iAudioOutput;
+    delete iVideoOutput;
+
+    if ( iErrorReporter )
+        {
+        iErrorReporter->Cancel();
+        delete iErrorReporter;
+        }
+
+    PRINT((_L("CCMRMediaRecorderImp::~CCMRMediaRecorderImp() out")));
+    //#pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::OpenL
+// Opens media recorder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::OpenL(MCMRMediaRecorderObserver *aObserver,
+                                 MDataSource *aAudioSource,
+                                 MCMRMediaSink *aSink, TInt aCameraHandle,
+                                 const TDesC8& aVideoMimeType,
+                                 TFourCC aAudioType)
+
+    {
+    PRINT((_L("CCMRMediaRecorderImp::OpenL() in, thread id %x"),TInt(RThread().Id())));
+    if ( State() != EStateNone )
+        {
+        PRINT((_L("CCMRMediaRecorderImp::OpenL() already exists")));
+        User::Leave( KErrAlreadyExists );
+        }
+
+    MRASSERT(aObserver);
+    iObserver = aObserver;
+
+    MRASSERT(aSink);
+    iSink = aSink;
+
+    if ( aAudioSource == NULL )
+        {
+        iAudioEnabled = EFalse;
+        }
+    iAudioSource = aAudioSource;
+
+    // create active output objects; must be created here so that they all are in the same thread
+    iAudioOutput = CCMRActiveOutput::NewL( iSink, this );
+    iVideoOutput = CCMRActiveOutput::NewL( iSink, this );
+
+    iPerfMonitor = CCMRPerfMonitor::NewL( iAudioOutput, iVideoOutput, iVideoRecorder, this );
+    iConfig = CCMRConfigManager::NewL();
+
+    // open video recorder
+    TRAPD( err, iVideoRecorder->OpenL(this, iVideoOutput, aCameraHandle, aVideoMimeType, iPerfMonitor, iConfig) );
+    if ( err != KErrNone )
+        {
+        PRINT((_L("CCMRMediaRecorderImp::OpenL() video open failed")));
+        User::Leave( err );
+        }
+    // Inform sink about average bit-rate
+    TInt br = 0;
+    TRAP( err, iVideoRecorder->TargetBitRateL(br));
+    if ( err == KErrNone )
+        {
+        TReal videoBitrateScaler = 0;
+        if ( iConfig )
+        	{
+             videoBitrateScaler = iConfig->PluginSettings().iCMRAvgVideoBitRateScaler;
+         	}
+         // make sure we never get scaler value 0 (ends up Div0 error)
+        if ( videoBitrateScaler == 0 )
+         	{
+         	videoBitrateScaler = KCMRAvgVideoBitRateScaler;
+         	}
+
+         //inform the estimated average bitrate to sink; use a HW-specific scaler to estimate the average
+        br = static_cast<TInt>( br*videoBitrateScaler );
+        iSink->SetAverageVideoBitRate( br );
+
+        // open audio recorder
+        TRAP( err, iAudioRecorder->OpenL(this, iAudioSource, iAudioOutput, aAudioType, iConfig) );
+        }
+
+    if ( err != KErrNone )
+        {
+        PRINT((_L("CCMRMediaRecorderImp::OpenL() audio open failed")));
+        User::Leave( err );
+        }
+
+    TRAP( err, iAudioRecorder->TargetBitRateL(br));
+    if ( err == KErrNone )
+        {
+        // Inform sink about the default average bit-rate
+        iSink->SetAverageAudioBitRate( br );
+        }
+    else
+        {
+        PRINT((_L("CCMRMediaRecorderImp::OpenL() audio bitrate check failed")));
+        User::Leave( err );
+        }
+
+    iErrorReporter = new (ELeave) CCMRErrorReporter(aObserver);
+
+    iState = EStateOpen;
+    PRINT((_L("CCMRMediaRecorderImp::OpenL() out")));
+    }
+
+
+// Settings
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetVideoCodecL
+// Sets video codec (overrides the codec given in OpenL).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetVideoCodecL( const TDesC8& aVideoMimeType )
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetVideoCodecL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetVideoCodecL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->SetVideoCodecL( aVideoMimeType );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::GetVideoCodecL
+// Gets the currently used video codec
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::GetVideoCodecL( TDes8& aVideoMimeType )
+    {
+    PRINT((_L("CCMRMediaRecorderImp::GetVideoCodecL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::GetVideoCodecL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->GetVideoCodecL( aVideoMimeType );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::GetSupportedVideoCodecsL
+// Gets the supported & installed video codecs. This can be called also before opened
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::GetSupportedVideoCodecsL( CDesC8Array& aVideoMimeTypes )
+    {
+    PRINT((_L("CCMRMediaRecorderImp::GetSupportedVideoCodecsL()")));
+
+    iVideoRecorder->GetSupportedVideoCodecsL( aVideoMimeTypes );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetAudioCodecL
+// Sets audio codec (overrides the codec given in OpenL).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetAudioCodecL( const TFourCC& aAudioType )
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetAudioCodecL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetAudioCodecL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iAudioRecorder->SetAudioCodecL( aAudioType );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::GetAudioCodecL
+// Gets the currently used audio codec
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::GetAudioCodecL( TFourCC& aAudioType )
+    {
+    PRINT((_L("CCMRMediaRecorderImp::GetAudioCodecL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::GetAudioCodecL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iAudioRecorder->GetAudioCodecL( aAudioType );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::GetSupportedAudioCodecsL
+// Gets the supported & installed audio codecs. This can be called also before opened
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::GetSupportedAudioCodecsL( RArray<TFourCC>& aAudioTypes )
+    {
+    PRINT((_L("CCMRMediaRecorderImp::GetSupportedAudioCodecsL()")));
+    iAudioRecorder->GetSupportedAudioCodecsL( aAudioTypes );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetVideoFrameRateL
+// Sets video frame rate (capture rate & encoding target rate.
+// This can be changed also while recording, but then affects only to encoding frame rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetVideoFrameRateL(TReal32 aFrameRate)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameRateL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameRateL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->SetFrameRateL(aFrameRate);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::VideoFrameRateL
+// Gets video (encoding) frame rate (capture rate is the same or higher).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal32 CCMRMediaRecorderImp::VideoFrameRateL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::VideoFrameRateL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::VideoFrameRateL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->FrameRateL(iFrameRate);
+    return iFrameRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetVideoFrameSizeL
+// Sets video frame size.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetVideoFrameSizeL(const TSize& aSize)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameSizeL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameSizeL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    // this can't be changed while recording; video recorder is supposed to notice if in wrong state
+    // state is changed based on mvroStateChange()
+    iVideoRecorder->SetFrameSizeL(aSize);
+    iConfig->SetVideoFrameSize(aSize);
+
+    // Change audio samplerate based on framesize
+    TSize framesize;
+    TInt samplerate = 0;
+    TInt channelmode = 0;
+    iVideoRecorder->FrameSizeL(framesize);
+
+
+	if ( iConfig && iConfig->IsICMConfigDataAvailable() )
+		{
+		samplerate = iConfig->VideoQualitySettings().iAudioSamplingRate;
+		channelmode = iConfig->VideoQualitySettings().iAudioChannels;
+		PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameSizeL() setting audio settings using ICM samplerate: %d, channels: %d"), samplerate, channelmode));
+		}
+	else
+		{
+	    if ( (framesize.iHeight >= KCMRVGAHeight) && (framesize.iWidth >= KCMRVGAWidth) )
+	        {
+	        samplerate = KCMRAACAudioSampleRateWithVGA;
+	        channelmode = KCMRAACAudioChannelModeWithVGA;
+	        PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameSizeL() >=VGA Default audio to samplerate:%d channels:%d"), samplerate, channelmode));
+	        }
+	    else if ( (framesize.iHeight >= KCMRCIFHeight) && (framesize.iWidth >= KCMRCIFWidth) )
+	        {
+	        samplerate = KCMRAACAudioSampleRateWithCIF;
+	        channelmode = KCMRAACAudioChannelModeWithCIF;
+	        PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameSizeL() CIF Default audio to samplerate:%d channels:%d"), samplerate, channelmode));
+	        }
+	    else if ( (framesize.iHeight >= KCMRQVGAHeight) && (framesize.iWidth >= KCMRQVGAWidth) )
+	        {
+	        samplerate = KCMRAACAudioSampleRateWithQVGA;
+	        channelmode = KCMRAACAudioChannelModeWithQVGA;
+	        PRINT((_L("CCMRMediaRecorderImp::SetVideoFrameSizeL() QVGA Default audio to samplerate:%d channels:%d"), samplerate, channelmode));
+	        }
+	     else
+	        {
+	        // AAC is not used for lower resolutions.
+	        }
+		}
+
+    TFourCC currentAudioCodec;
+    iAudioRecorder->GetAudioCodecL(currentAudioCodec);
+    if ( currentAudioCodec == KCMRFourCCIdMPEG4AAC )
+	    {
+    	if ( samplerate )
+        	{
+        	iAudioRecorder->SetTargetSampleRateL( samplerate );
+        	}
+	    if ( channelmode )
+	        {
+	        iAudioRecorder->SetChannelModeL( channelmode );
+	        }
+	    }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::GetVideoFrameSizeL
+// Gets video frame size.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::GetVideoFrameSizeL(TSize& aSize) const
+    {
+    PRINT((_L("CCMRMediaRecorderImp::GetVideoFrameSizeL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::GetVideoFrameSizeL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->FrameSizeL(aSize);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetVideoBitRateL
+// Sets video bitrate (or KMMFVariableVideoBitRate)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetVideoBitRateL(TInt aBitRate)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetVideoBitRateL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetVideoBitRateL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( ( iMaxTargetBitRate != KMMFVariableVideoBitRate ) && ( aBitRate != KMMFVariableVideoBitRate ) )
+        {
+        TInt abr;
+        // check that the total bit-rate (audio+video) does not exceed a given limit
+        iAudioRecorder->TargetBitRateL(abr);
+        if ( iAudioRecorder && iAudioEnabled && ( abr > 0 ) &&
+             ( abr + aBitRate > iMaxTargetBitRate ) )
+            {
+            PRINT((_L("CCMRMediaRecorderImp::SetVideoBitRateL() too high combined bitrate")));
+            User::Leave(KErrArgument);
+            }
+        }
+
+    // this can be changed also while recording
+    iVideoRecorder->SetTargetBitRateL(aBitRate);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::VideoBitRateL
+// Gets video bitrate.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRMediaRecorderImp::VideoBitRateL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::VideoBitRateL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::VideoBitRateL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->TargetBitRateL(iTargetBitRate);
+    return iTargetBitRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetVideoCodingOptionsL
+// Set misc video coding options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetVideoCodingOptionsL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetVideoCodingOptionsL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->SetVideoCodingOptionsL( aOptions );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetVideoRateControlOptionsL
+// Set video rate control options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetVideoRateControlOptionsL(const TRateControlOptions& aOptions)
+	{
+    PRINT((_L("CCMRMediaRecorderImp::SetVideoCodingOptionsL() in")));
+    if ( (iState == EStateNone) ||
+    	 (iState == EStateOpen) ||
+    	 (iState == EStatePreparing) )
+    	{
+        // not prepared / recording yet
+        PRINT((_L("CCMRMediaRecorderImp::SetVideoRateControlOptionsL() wrong state")));
+        User::Leave( KErrNotReady );
+    	}
+    iVideoRecorder->SetVideoRateControlOptionsL( aOptions );
+    PRINT((_L("CCMRMediaRecorderImp::SetVideoCodingOptionsL() out")));
+	}
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::GetVideoRateControlOptionsL
+// Get video rate control options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::GetVideoRateControlOptionsL(TRateControlOptions& aOptions)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::GetVideoRateControlOptionsL() in")));
+    if ( (iState == EStateNone) ||
+         (iState == EStateOpen) ||
+         (iState == EStatePreparing) )
+        {
+        // not prepared / recording yet
+        PRINT((_L("CCMRMediaRecorderImp::GetVideoRateControlOptionsL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->GetVideoRateControlOptionsL( aOptions );
+    PRINT((_L("CCMRMediaRecorderImp::GetVideoRateControlOptionsL() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetAudioBitRateL
+// Sets audio bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetAudioBitRateL(TInt aBitRate)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetAudioBitRateL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetAudioBitRateL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( ( iMaxTargetBitRate != KMMFVariableVideoBitRate ) && ( aBitRate > 0 ) )
+        {
+        TInt vbr;
+        // check that the total bit-rate (audio+video) does not exceed a given limit
+        iVideoRecorder->TargetBitRateL(vbr);
+        if ( ( vbr != KMMFVariableVideoBitRate ) &&
+             (vbr + aBitRate > iMaxTargetBitRate ) )
+            {
+            PRINT((_L("CCMRMediaRecorderImp::SetAudioBitRateL() too high combined bitrate")));
+            User::Leave(KErrArgument);
+            }
+        }
+
+    iAudioRecorder->SetTargetBitRateL(aBitRate);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::AudioBitRateL
+// Gets audio bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRMediaRecorderImp::AudioBitRateL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::AudioBitRateL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::AudioBitRateL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iAudioRecorder->TargetBitRateL(iTargetBitRate);
+    return iTargetBitRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetAudioEnabledL
+// Sets audio enabled / disabled for the next recording.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetAudioEnabledL(TBool aEnabled)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetAudioEnabledL(), aEnabled: %d"),aEnabled));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetAudioEnabledL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( (State() == EStateRecording) || (State() == EStatePaused) )
+        {
+        // can't change this parameter when recording or paused.
+        PRINT((_L("CCMRMediaRecorderImp::SetAudioEnabledL(), leaves, state: %d"),State()));
+        User::Leave(KErrNotReady);
+        }
+    else
+        {
+        if ( iAudioEnabled && (!aEnabled) )
+            {
+            // audio recorder was used but should not be used any more
+            iAudioRecorderPreparing = EFalse; //this should be redundant, but repeated to ensure prepare to complete
+
+            if ( iSink )
+                {
+                // Inform sink about the bit-rate which is now 0
+                iSink->SetAverageAudioBitRate( 0 );
+                }
+            }
+        else if ( aEnabled )
+            {
+            // Enable possibly disabled audio
+            TInt bitrate;
+            iAudioRecorder->TargetBitRateL( bitrate );
+            if ( iSink )
+                {
+                // Inform sink about the average bit-rate.
+                iSink->SetAverageAudioBitRate( bitrate );
+                }
+            }
+
+        if ( iAudioEnabled != aEnabled )
+            {
+            // state is changed
+            iAudioEnabled = aEnabled;
+            // force prepare
+            iState = EStateOpen;
+            // inform controller
+            iObserver->MmroStateChange( iState, KErrNone );
+            }
+        else
+            {
+            // redundant call
+            }
+
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::AudioEnabledL
+// Checks if audio is enabled / disabled.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRMediaRecorderImp::AudioEnabledL() const
+    {
+    PRINT((_L("CCMRMediaRecorderImp::AudioEnabledL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::AudioEnabledL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    return iAudioEnabled;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetGainL
+// Sets audio recording gain.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetGainL(TInt aGain)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetGainL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetGainL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iAudioRecorder->SetGainL( aGain );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::GainL
+// Gets audio recording gain.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRMediaRecorderImp::GainL() const
+    {
+    PRINT((_L("CCMRMediaRecorderImp::GainL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::GainL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    return iAudioRecorder->GainL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::MaxGainL
+// Gets max audio recording gain.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRMediaRecorderImp::MaxGainL() const
+    {
+    PRINT((_L("CCMRMediaRecorderImp::MaxGainL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::MaxGainL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    return iAudioRecorder->MaxGainL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetAudioPriorityL
+// Set audio priority settings.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetAudioPriorityL(const TMMFPrioritySettings& aPrioritySettings)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetAudioPriorityL()")));
+    if ( iState == EStateNone )
+        {
+        // not opened yet
+        PRINT((_L("CCMRMediaRecorderImp::SetAudioPriorityL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iAudioRecorder->SetPriorityL( aPrioritySettings );
+    }
+
+
+// Recording control
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::PrepareL
+// Prepares audio & video recorders for recording.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::PrepareL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::PrepareL()")));
+
+    if ( (State() != EStateOpen) && (State() != EStateReadyToRecord) )
+        {
+        // prepare possible only when open or prepared
+        PRINT((_L("CCMRMediaRecorderImp::PrepareL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    iState = EStatePreparing;
+
+    TThreadPriority audioThreadPriority = EPriorityNormal;
+    // since we don't know the order of preparecomplete callbacks, both flags must be ETrue
+    // before any preparations are started.
+    if ( iAudioEnabled )
+        {
+        iAudioRecorderPreparing = ETrue;
+        audioThreadPriority = iAudioRecorder->GetThreadPriority();
+        }
+    else
+        {
+        iAudioRecorderPreparing = EFalse;
+        }
+
+    iVideoRecorder->SetThreadPriorityL( audioThreadPriority );
+
+    // start preparing video recorder, then wait for MvroStateChange
+    iVideoRecorderPreparing = ETrue;
+    TRAPD( err, iVideoRecorder->PrepareL() );
+    if ( err != KErrNone )
+        {
+        // As we know the implementation of iVideoRecorder, it can leave only before any async calls.
+        // Hence we can restore the previous state & leave here and there is no need to return the observer call
+        iVideoRecorderPreparing = EFalse;
+        PRINT((_L("CCMRMediaRecorderImp::PrepareL() video prepare failed %d"), err));
+        User::Leave( err );
+        }
+
+
+    if ( iAudioEnabled )
+        {
+        // Prepare audio recorder
+
+        TRAP(err, iAudioRecorder->PrepareL());
+
+        if ( err == KErrNotSupported )
+            {
+            // No suitable audio codec found => disable audio but don't let this trouble video recording
+            PRINT((_L("CCMRMediaRecorderImp::PrepareL() - iAudioRecorder->PrepareL didn't find a suitable audio codec, error code %d"),err));
+            iAudioEnabled = EFalse;
+            iAudioRecorderPreparing = EFalse;
+            // Inform sink about the bit-rate which is now 0
+            iSink->SetAverageAudioBitRate( 0 );
+            }
+        else if ( err != KErrNone )
+            {
+            // Some more serious problem => preparation of media recorder is not successful.
+            // However, we cannot leave here since video recorder is preparing and hence
+            // media recorder state can not be restored => error is informed in callback
+            PRINT((_L("CCMRMediaRecorderImp::PrepareL() - iAudioRecorder->PrepareL failed with error code %d"),err));
+            iErrorCode = err;
+            iAudioRecorderPreparing = EFalse;
+            }
+        else
+            {
+            // ok
+            }
+        }
+
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::RecordL
+// Starts recording.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::RecordL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::RecordL() in")));
+    if ( ( State() == EStateStopping ) || ( State() == EStatePausing ) )
+        {
+        PRINT((_L("CCMRMediaRecorderImp::RecordL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( (State() == EStateRecording) || (State() == EStatePaused) )
+        {
+        // ignore, recording already going on
+        PRINT((_L("CCMRMediaRecorderImp::RecordL() ignore, recording already")));
+        return;
+        }
+
+    if ( iState != EStateReadyToRecord )
+        {
+        PRINT((_L("CCMRMediaRecorderImp::RecordL() wrong state")));
+        User::Leave(KErrNotReady);
+        }
+
+    iVideoOutput->Start();
+
+    iVideoStopped = EFalse;
+    TRAPD(err,iVideoRecorder->RecordL());
+
+    if ( err == KErrNone )
+        {
+        if ( iAudioEnabled )
+            {
+            iAudioStopped = EFalse;
+            iAudioOutput->Start();
+            TRAP(err,iAudioRecorder->RecordL());
+
+            if ( err != KErrNone )
+                {
+                // if audio leaved, video should be stopped
+                StopL();
+                }
+            }
+        else
+            {
+            // audio not recording
+            iAudioStopped = ETrue;
+            }
+        }
+    else
+        {
+        // Leave only now when both components are stopped (can't let audio->recordL leave)
+        PRINT((_L("CCMRMediaRecorderImp::RecordL() video's recordl failed %d"), err));
+        User::Leave( err );
+        }
+
+    // Start performance monitor
+    iPerfMonitor->StartL();
+
+    if ( iAudioEnabled )
+        {
+        // set initial lipsync adjustment
+        iVideoRecorder->AdjustTimeStampsL( iAudioRecorder->AVSyncAdjustmentStart() );
+        }
+
+    //successful
+    iState = EStateRecording;
+
+    PRINT((_L("CCMRMediaRecorderImp::RecordL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::StopL
+// Stop recording.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::StopL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::StopL() in")));
+    if ( (State() == EStateRecording) || (State() == EStatePaused) )
+        {
+        TInt errVideo;
+        TInt errVideoStop;        
+        TInt errAudio;
+
+        iState = EStateStopping;
+
+        // try to free as many buffers as possible for stop / EOS marker
+        iVideoOutput->Flush();
+        
+        if ( iAudioEnabled && (!iAudioStopped) )
+            {
+            // start stopping of audio (async)
+            TRAP(errAudio,iAudioRecorder->StopL());
+            }
+        else
+            {
+            errAudio = KErrNone;
+            }
+
+        // try to free as many buffers for video thread as possible.
+        iVideoOutput->Flush();
+        
+        // stop video (sync)
+        TRAP(errVideo, iVideoRecorder->StopL());        
+
+        iVideoEOSReached = EFalse;
+        TTimeIntervalMicroSeconds32 sleeptime = 15000; // 15ms roughly 1 or ½ frame duration
+        PRINT((_L("CCMRMediaRecorderImp::StopL() EOS sleeptime: %d"), sleeptime.Int() ));        
+        while ( !iVideoEOSReached )
+            {
+            PRINT((_L("CCMRMediaRecorderImp::StopL() Waiting EOS / streamend, flushing controller thread buffers:")));            
+            iVideoOutput->Flush();
+            PRINT((_L("CCMRMediaRecorderImp::StopL() Waiting EOS / streamend, returning to video thread to return buffers to encoder:")));            
+            TRAP(errVideoStop, iVideoRecorder->RequestBuffersAndWaitEOSL(iVideoEOSReached));
+            if (!iVideoEOSReached)
+                {
+                PRINT((_L("CCMRMediaRecorderImp::StopL() sleeping %d microsecs waiting for EOS"), sleeptime.Int() ));                
+                User::After(sleeptime); // wait 1 frame duration until asking again for StreamEnd again;
+                }
+            }
+        
+        iVideoStopped = ETrue;
+
+        if ( iAudioEnabled && (!iAudioStopped) && (errAudio == KErrNone) )
+            {
+            // Start waiting until audiorecorder indicates it has stopped
+            PRINT((_L("CCMRMediaRecorderImp::StopL() ensure that audio recorder has stopped")));
+            TRAP(errAudio,iAudioRecorder->WaitUntilStoppedL());
+            iAudioStopped = ETrue;
+            }
+        iAudioOutput->Stop();
+        iAudioOutput->Flush();
+
+        // final cleanup for video buffers.
+        iVideoOutput->Stop();
+        iVideoOutput->Flush();
+        
+        iPerfMonitor->StopL();
+
+        iState = EStateReadyToRecord;
+
+        if ( errVideo != KErrNone )
+            {
+            PRINT((_L("CCMRMediaRecorderImp::StopL() leaves, video error %d"),errVideo));
+            User::Leave( errVideo );
+            }
+        if ( errVideoStop != KErrNone )
+            {
+            PRINT((_L("CCMRMediaRecorderImp::StopL() leaves, videostop error %d"),errVideoStop));
+            User::Leave( errVideo );
+            }
+        if ( errAudio != KErrNone )
+            {
+            PRINT((_L("CCMRMediaRecorderImp::StopL() leaves, audio error %d"),errAudio));
+            User::Leave( errAudio );
+            }
+        }
+    else
+        {
+        PRINT((_L("CCMRMediaRecorderImp::StopL() already stopped, ignoring")));
+        }
+    PRINT((_L("CCMRMediaRecorderImp::StopL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::PauseL
+// Pause recording.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::PauseL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::PauseL() in")));
+    if ( State() != EStateRecording )
+        {
+        return;
+        }
+
+    TInt err;
+
+    // sync call
+    TRAP( err, iVideoRecorder->PauseL() );
+
+    if ( err != KErrNone )
+        {
+        //Stop both
+        StopL();
+        PRINT((_L("CCMRMediaRecorderImp::PauseL() video's recordl failed %d"),err));
+        User::Leave( err );
+
+        }
+    else if ( iAudioEnabled )
+        {
+        iState = EStatePausing;
+
+        // sync call
+        TRAP( err, iAudioRecorder->PauseL());
+
+        if ( err != KErrNone )
+            {
+            // stop both
+            iState = EStateRecording;
+            StopL();
+            PRINT((_L("CCMRMediaRecorderImp::PauseL() audio's recordl failed %d"),err));
+            User::Leave( err );
+            }
+        }
+    else
+        {
+        // ok
+        }
+
+    iPerfMonitor->PauseL();
+
+    //successful
+    iState = EStatePaused;
+    PRINT((_L("CCMRMediaRecorderImp::PauseL() out")));
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::ResumeL
+// Resume recording.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::ResumeL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::ResumeL() in")));
+    if ( State() == EStatePausing )
+        {
+        PRINT((_L("CCMRMediaRecorderImp::Resume() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( State() != EStatePaused )
+        {
+        return;
+        }
+
+    TInt err = KErrNone;
+
+    if ( iAudioEnabled )
+        {
+        TRAP(err,iAudioRecorder->ResumeL());
+        if ( err != KErrNone )
+            {
+            // stop both
+            StopL();
+            PRINT((_L("CCMRMediaRecorderImp::ResumeL() audio's resumel failed %d"),err));
+            User::Leave( err );
+            }
+
+        }
+
+
+    TRAP( err, iVideoRecorder->ResumeL() );
+    if ( err != KErrNone )
+        {
+        //Stop both
+        StopL();
+        PRINT((_L("CCMRMediaRecorderImp::ResumeL() video's resumel failed %d"),err));
+        User::Leave( err );
+        }
+    else
+        {
+        // ok
+        }
+
+    iPerfMonitor->StartL();
+
+    if ( iAudioEnabled )
+        {
+        // set lipsync adjustment after pause
+        iVideoRecorder->AdjustTimeStampsL( iAudioRecorder->AVSyncAdjustmentResume() );
+        }
+
+    //successful
+    iState = EStateRecording;
+    PRINT((_L("CCMRMediaRecorderImp::ResumeL() out")));
+
+    }
+
+// Observer methods
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::MvroStateChange
+// Video recorder state change callback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::MvroStateChange(CCMRRecorderBase::TRecorderState aState)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::MvroStateChange(), aState %d, iState %d"),aState,iState));
+
+    switch ( State() )
+        {
+        case EStatePreparing:
+
+            if ( iErrorCode != KErrNone )
+                {
+                // audio preparation was completed with an error
+                iVideoRecorderPreparing = EFalse;
+                iState = EStateOpen;
+                iObserver->MmroPrepareComplete( iErrorCode );
+                PRINT((_L("CCMRMediaRecorderImp::MvroStateChange(), called preparecomplete with audio errorcode %d"),iErrorCode));
+                iErrorCode = KErrNone;
+                }
+            else if ( aState == CCMRRecorderBase::EStateReadyToRecord )
+                {
+                iVideoRecorderPreparing = EFalse;
+
+                // call prepare complete -callback if both recorders are prepared
+                if ( !iAudioRecorderPreparing )
+                    {
+                    iState = EStateReadyToRecord;
+                    iObserver->MmroPrepareComplete(KErrNone);
+                    }
+                //else have to wait until audio is prepared
+                }
+            else
+                {
+                PRINT((_L("CCMRMediaRecorderImp::MvroStateChange() unexpected state change")));
+                MRASSERT( 0 );
+                }
+            break;
+
+        case EStateReadyToRecord:
+            if ( aState == CCMRRecorderBase::EStateOpen )
+                {
+                // a setting changed video recorder to not-readytorecord state => new prepare needed
+                iState = EStateOpen;
+                // inform controller
+                iObserver->MmroStateChange( iState, KErrNone );
+                }
+            // else by default state change is to record => no actions needed
+
+            break;
+
+        case EStateStopping:
+            {
+            PRINT((_L("CCMRMediaRecorderImp::MvroStateChange(), video stopped either normally by receiving EOS or by fatal error.")));            
+            iVideoStopped = ETrue;
+            break;
+            }
+        default:
+            {
+            if ( (aState == CCMRRecorderBase::EStateReadyToRecord)
+                || (aState == CCMRRecorderBase::EStateNone) )     // none is signalled if thread was terminated
+                {
+                // recording stopped
+                PRINT((_L("CCMRMediaRecorderImp::MvroStateChange(), video stopped unexpectedly while recording")));
+                iVideoStopped = ETrue;
+                }
+            break;
+            }
+        }
+
+    PRINT((_L("CCMRMediaRecorderImp::MvroStateChange() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::MvroError
+// Video recorder error callback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::MvroError(TInt aError)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::MvroError(), aError %d"),aError));
+
+    switch ( State() )
+        {
+        case EStatePreparing:
+
+            iVideoRecorderPreparing = EFalse;
+            if ( !iAudioRecorderPreparing )
+                {
+                // Some problem happened with either in camera API or devvr initialisation.
+                iObserver->MmroPrepareComplete( aError );
+                iState = EStateOpen;
+                }
+            else
+                {
+                // have to wait until audio is prepared, don't send any error code yet
+                iErrorCode = aError;
+                }
+            break;
+
+        case EStateStopping:
+            // error occurred while stopping, must wait until stop is complete before signaling the error
+            PRINT((_L("CCMRMediaRecorderImp::MvroError(), error occurred while stopping, must wait until stop is complete before signaling the error")));
+            iErrorCode = aError;
+            break;
+
+
+        default:
+            {
+            // all the errors are considered fatal, and the fatality is interpreted by application/user based on error code.
+            PRINT((_L("CCMRMediaRecorderImp::MvroError(), forwarding error to iErrorReporter")));
+            iErrorReporter->FatalError(aError);
+            // assumes the controller will stop us
+            }
+        }
+
+    PRINT((_L("CCMRMediaRecorderImp::MvroError() out")));
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::MaroStateChange
+// Audio recorder state change callback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::MaroStateChange(CCMRRecorderBase::TRecorderState aState)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::MaroStateChange(), aState %d, iState %d"),aState,iState));
+
+    switch ( State() )
+        {
+        case EStatePreparing:
+
+            if ( iErrorCode != KErrNone )
+                {
+                // preparation was completed with error
+                iState = EStateOpen;
+                iObserver->MmroPrepareComplete( iErrorCode );
+                iErrorCode = KErrNone;
+                iAudioRecorderPreparing = EFalse;
+                }
+            else if ( aState == CCMRRecorderBase::EStateReadyToRecord )
+                {
+
+                iAudioRecorderPreparing = EFalse;
+                // call prepare complete -callback if both recorders are prepared
+                if ( !iVideoRecorderPreparing )
+                    {
+                    iState = EStateReadyToRecord;
+                    iObserver->MmroPrepareComplete(KErrNone);
+                    }
+                //else have to wait until video is prepared
+                }
+            else
+                {
+                PRINT((_L("CCMRMediaRecorderImp::MaroStateChange() unexpected state change")));
+                MRASSERT( 0 );
+                }
+
+            break;
+
+        case EStateReadyToRecord:
+            if ( aState == CCMRRecorderBase::EStateOpen )
+                {
+                // a setting changed audio recorder to not-readytorecord state => new prepare needed
+                iState = EStateOpen;
+                // inform controller
+                iObserver->MmroStateChange( iState, KErrNone );
+                }
+            // else by default state change is to record => no actions needed
+
+            break;
+
+        case EStatePausing:
+            // waiting for audio to pause, pausing is sync and no extra actions needed here
+            break;
+
+        case EStateStopping:
+            // waiting for audio to stop; should not come here
+            iAudioStopped = ETrue;
+            break;
+
+        default:
+            {
+            if ( (aState == CCMRRecorderBase::EStateReadyToRecord)
+                || (aState == CCMRRecorderBase::EStateNone) )     // none is signalled if thread was terminated
+                {
+                PRINT((_L("CCMRMediaRecorderImp::MaroStateChange(), audio stopped unexpectedly while recording")));
+                iAudioStopped = ETrue;
+                }
+            break;
+            }
+
+        }
+
+    PRINT((_L("CCMRMediaRecorderImp::MaroStateChange() out")));
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::MaroError
+// Audio recorder error callback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::MaroError(TInt aError)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::MaroError(), aError %d"),aError));
+
+    switch ( State() )
+        {
+        case EStatePreparing:
+            {
+            iAudioRecorderPreparing = EFalse;
+            if ( !iVideoRecorderPreparing )
+                {
+                // Some problem happened with audio initialisation.
+                iObserver->MmroPrepareComplete( aError );
+                iState = EStateOpen;
+                }
+            else
+                {
+                // have to wait until video is prepared => don't call any observer callbacks yet
+                iErrorCode = aError;
+                }
+            break;
+            }
+
+        default:
+            {
+            PRINT((_L("CCMRMediaRecorderImp::MaroError(), forwarding error to iErrorReporter")));
+            // all the errors are considered fatal, and the fatality is interpreted by application/user based on error code.
+            // audio recorder always changes its state before signalling error
+            iErrorReporter->FatalError(aError);
+            }
+        }
+    PRINT((_L("CCMRMediaRecorderImp::MaroError() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::MaooError
+// Active output error callback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::MaooError(TInt aError)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::MaooError(), error %d, forwarding error to iErrorReporter"),aError));
+    iErrorReporter->FatalError( aError );
+    // assumes the controller will stop us
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetPreferredVideoEncoderL
+// Set video encoder using its UID. Usage optional.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetPreferredVideoEncoderL(TUid& aEncoder)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetPreferredVideoEncoderL() in, UID: %d"), aEncoder.iUid));
+    if ( (iState == EStateNone) )
+        {
+        // not prepared / recording yet
+        PRINT((_L("CCMRMediaRecorderImp::SetPreferredVideoEncoderL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->SetPreferredVideoEncoderL( aEncoder );
+    PRINT((_L("CCMRMediaRecorderImp::SetPreferredVideoEncoderL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::SetPreferredVideoEncapsulationL
+// Set video encoder output format encapsulation. Usage optional.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation)
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetPreferredVideoEncapsulationL() in, encapsulation: %d"), (TInt)aCapsulation));
+    if ( (iState == EStateNone) )
+        {
+        // not prepared / recording yet
+        PRINT((_L("CCMRMediaRecorderImp::SetPreferredVideoEncapsulationL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->SetPreferredVideoEncapsulationL( aCapsulation );
+    PRINT((_L("CCMRMediaRecorderImp::SetPreferredVideoEncapsulationL() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRMediaRecorderImp::SetSegmentTargetSizeL
+// Set video encoder target segment size. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRMediaRecorderImp::SetSegmentTargetSizeL(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks )
+    {
+    PRINT((_L("CCMRMediaRecorderImp::SetSegmentTargetSizeL() in")));
+    if ( (iState == EStateNone) )
+        {
+        // not prepared / recording yet
+        PRINT((_L("CCMRMediaRecorderImp::SetSegmentTargetSizeL() wrong state")));
+        User::Leave( KErrNotReady );
+        }
+    iVideoRecorder->SetSegmentTargetSizeL( aLayer,  aSizeBytes, aSizeMacroblocks);
+    PRINT((_L("CCMRMediaRecorderImp::SetSegmentTargetSizeL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::CCMRErrorReporter::CCMRErrorReporter
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CCMRMediaRecorderImp::CCMRErrorReporter::CCMRErrorReporter(MCMRMediaRecorderObserver *aObserver) : CActive(EPriorityNormal), iObserver(aObserver)
+    {
+    CActiveScheduler::Add(this);
+    iRunning = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::CCMRErrorReporter::~CCMRErrorReporter
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CCMRMediaRecorderImp::CCMRErrorReporter::~CCMRErrorReporter()
+    {
+    PRINT((_L("CCMRErrorReporter::~CCMRErrorReporter")));
+    Cancel();
+    iErrors.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::CCMRErrorReporter::FatalError
+// Report fatal error
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::CCMRErrorReporter::FatalError(TInt aError)
+    {
+    if ( !IsActive() )
+        {
+ 		iStatus=KRequestPending;
+		SetActive();
+		TRequestStatus *tmp=(&iStatus);
+		User::RequestComplete(tmp,0);
+        }
+    iErrors.Append( TCMRError(aError, EErrorFatal) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::CCMRErrorReporter::TemporaryError
+// Report temporary error
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::CCMRErrorReporter::TemporaryError(TInt aError)
+    {
+    if ( !IsActive() )
+        {
+ 		iStatus=KRequestPending;
+		SetActive();
+		TRequestStatus *tmp=(&iStatus);
+		User::RequestComplete(tmp,0);
+        }
+    iErrors.Append( TCMRError(aError, EErrorTemp) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::CCMRErrorReporter::RunL
+// Serve error reporting requests
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::CCMRErrorReporter::RunL()
+    {
+    PRINT((_L("CCMRMediaRecorderImp::CCMRErrorReporter::RunL() in")));
+    if ( !iRunning )
+        {
+        // this may be called again while observer callback is running, since callback calls MR::StopL which sets activescheduler running
+        iRunning = ETrue;
+
+        while ( iErrors.Count() > 0 )
+            {
+            TCMRError tmp = iErrors[0];
+            if ( tmp.iErrorType == EErrorFatal )
+                {
+                iObserver->MmroFatalError(tmp.iErrorCode);
+                }
+            else
+                {
+                iObserver->MmroTemporaryError(tmp.iErrorCode);
+                }
+            iErrors.Remove(0);
+            }
+
+        iErrors.Reset();
+        iRunning = EFalse;
+        }
+    PRINT((_L("CCMRMediaRecorderImp::CCMRErrorReporter::RunL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRMediaRecorderImp::CCMRErrorReporter::DoCancel
+// Cancel pending requests
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRMediaRecorderImp::CCMRErrorReporter::DoCancel()
+    {
+    // activation & request are set at the same time => nothing to cancel
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRPerfMonitor.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Performance monitor timer
+*
+*/
+
+
+
+// INCLUDES
+#include "CCMRPerfMonitor.h"
+#include "CCMRActiveOutput.h"
+#include "CCMRVideoRecorderClient.h"
+#include "CCMRVideoSettings.h"
+#include "CCMRVideoHWParams.h"
+#include "CCMRMediaRecorder.h"
+
+// CONSTANTS
+const TInt KCMRPerfMonitorFreq = 2000000;   // timer timeout value, 2 seconds
+
+// MACROS
+#define PMASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CCMRPERFMONITOR"), EInternalAssertionFailure))
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRPerfMonitor* CCMRPerfMonitor::NewL(
+            CCMRActiveOutput* aAudioOutput,
+            CCMRActiveOutput* aVideoOutput,
+            CCMRVideoRecorderClient* aVideoRecorder,
+            CCMRMediaRecorder* aMediaRecorder)
+    {
+    PRINT((_L("CCMRPerfMonitor::NewL() in ")));
+
+    CCMRPerfMonitor* self = new (ELeave) CCMRPerfMonitor();
+    CleanupStack::PushL( self );
+    self->ConstructL(aAudioOutput, aVideoOutput, aVideoRecorder, aMediaRecorder);
+    CleanupStack::Pop();
+
+    PRINT((_L("CCMRPerfMonitor::NewL() out ")));
+    return self;
+    }
+
+// destructor
+CCMRPerfMonitor::~CCMRPerfMonitor()
+    {
+    // Make sure we're cancelled
+	Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::ConstructL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+void CCMRPerfMonitor::ConstructL(
+            CCMRActiveOutput* aAudioOutput,
+            CCMRActiveOutput* aVideoOutput,
+            CCMRVideoRecorderClient* aVideoRecorder,
+            CCMRMediaRecorder* aMediaRecorder)
+    {
+    PRINT((_L("CCMRPerfMonitor::ConstructL() in ")));
+
+    iAudioOutput = aAudioOutput;
+    iVideoOutput = aVideoOutput;
+    iVideoRecorder = aVideoRecorder;
+    iMediaRecorder = aMediaRecorder;
+    iTimedMonitoringRunning = EFalse;
+    iClockSourceStarted = EFalse;
+    iPerfMonPaused = EFalse;
+    iStartTime = 0;
+    iTimeStampWhenPaused = 0;
+
+	CTimer::ConstructL();
+    CActiveScheduler::Add( this );
+
+    PRINT((_L("CCMRPerfMonitor::ConstructL() out ")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::StartL
+// Start the timed monitor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRPerfMonitor::StartL()
+    {
+    PRINT((_L("CCMRPerfMonitor::Start() in")));
+
+    if ( iMediaRecorder->AudioEnabledL() )
+        {
+        PRINT((_L("CCMRPerfMonitor::Start() Audio available")));
+        // can't use this without audio
+        PMASSERT( iAudioOutput );
+
+        if ( !iTimedMonitoringRunning )
+            {
+            iTimedMonitoringRunning = ETrue;
+            After( 2*KCMRPerfMonitorFreq );  // give some time to settle
+            }
+        }
+    else
+        {
+        PRINT((_L("CCMRPerfMonitor::Start() No Audio, using system clock with offset: %d "), I64INT(iClockSourcePauseOffset.Int64() )));
+        iClockSourceStarted = ETrue;
+        iStartTime.UniversalTime();
+        }
+    iPerfMonPaused = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::StopL
+// Stop the timed monitor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRPerfMonitor::StopL()
+    {
+    PRINT((_L("CCMRPerfMonitor::Stop() in ")));
+    Cancel();
+    iAdjustedTimeMs = 0;
+    iTimeStampWhenPaused = 0;
+    iStartTime = 0;
+    iClockSourceStarted = EFalse;
+    iPerfMonPaused = EFalse;
+    PRINT((_L("CCMRPerfMonitor::Stop() out ")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::PauseL
+// Stop the timed monitor, but don't reset variables
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRPerfMonitor::PauseL()
+    {
+    PRINT((_L("CCMRPerfMonitor::Pause() in ")));
+    Cancel();
+    if ( iClockSourceStarted )
+        {
+        TTime current;
+        current.UniversalTime();
+        iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + current.MicroSecondsFrom(iStartTime).Int64();
+        PRINT((_L("CCMRPerfMonitor::Pause() ClockSource paused at: %d "), I64INT(iTimeStampWhenPaused.Int64()) ));
+        }
+    else
+        {
+        iTimeStampWhenPaused = 0;
+        }
+
+	iPerfMonPaused = ETrue;
+    PRINT((_L("CCMRPerfMonitor::Pause() in ")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::CustomInterface
+// Retrieves a custom interface for the clock source.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TAny* CCMRPerfMonitor::CustomInterface(TUid /*aInterface*/)
+    {
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::Time
+// Retrieves the current stream time.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCMRPerfMonitor::Time()
+    {
+    PRINT((_L("CCMRPerfMonitor::Time() in ")));
+
+    // if timed monitorin is running turn it off as encoder will use clocksource to correct timestamps.
+    if ( iTimedMonitoringRunning )
+        {
+        iTimedMonitoringRunning = EFalse;
+        }
+
+    TBool audioEnabled = EFalse;
+    TRAPD(audioError, audioEnabled = iMediaRecorder->AudioEnabledL());
+    if ( audioError != KErrNone )
+        {
+        iAudioTime = 0;
+        PRINT((_L("CCMRPerfMonitor::Time() getting AudioEnabledL failed with %d"), audioError ));
+        return iAudioTime;
+        }
+
+    if ( audioEnabled )
+        {
+        PRINT((_L("CCMRPerfMonitor::Time() Audio available, using it as clocksource") ));
+        TRAPD(error, iAudioOutput->LatestTimeStampL( iAudioTime ) );
+        if ( error )
+            {
+            iAudioTime = 0;
+            }
+        }
+    else
+        {
+        if (iClockSourceStarted)
+            {
+            if ( iPerfMonPaused == EFalse )
+	            {
+                PRINT((_L("CCMRPerfMonitor::Time() No audio, using available system ClockSource") ));
+    	        TTime current;
+        	    current.UniversalTime();
+            	iAudioTime = current.MicroSecondsFrom(iStartTime).Int64() + iTimeStampWhenPaused.Int64();
+        	    }
+        	else
+        		{
+        		iAudioTime = iTimeStampWhenPaused.Int64();
+        		}
+            }
+        else
+            {
+            PRINT((_L("CCMRPerfMonitor::Time() No audio, Time() called before start!") ));
+            iAudioTime = 0;
+            }
+        }
+
+    PRINT((_L("CCMRPerfMonitor::Time() out, Time: %d "), I64INT(iAudioTime.Int64()) ));
+    return iAudioTime;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::RunL
+// Main routine: check statuses & possibly adjust settings
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRPerfMonitor::RunL()
+    {
+    PRINT((_L("CCMRPerfMonitor::RunL() in")));
+    PRINT((_L("CCMRPerfMonitor::RunL() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::DoCancel
+// Cancels the timer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRPerfMonitor::DoCancel()
+    {
+    // cancel the timer
+    CTimer::DoCancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRPerfMonitor::RunError
+// Handle leaves from RunL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRPerfMonitor::RunError(TInt aError)
+    {
+    // ignore, but since RunL left, a new timer is not set
+    PRINT((_L("CCMRPerfMonitor::RunError() %d"), aError));
+    aError++;//to eliminate compiler warning
+    return KErrNone;
+    }
+
+
+
+
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRSubThread.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,628 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base and helper classes for subthread use in mediarecorder
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32math.h>
+#include "CCMRSubThread.h"
+#include "CCMRAudioThreadProxy.h"
+
+
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// ========================= RCMRSubThreadBase MEMBER FUNCTIONS =========================
+
+
+// -----------------------------------------------------------------------------
+// RCMRSubThreadBase::ReceiveEvents
+// Allows a client to receive events from the thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCMRSubThreadBase::ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus) const
+    {
+    SendReceive(ECMRThreadReceiveEvents, TIpcArgs(reinterpret_cast<TDes8*>(&aEventPckg)), aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRSubThreadBase::CancelReceiveEvents
+// Cancels reception of events from the thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRSubThreadBase::CancelReceiveEvents() const
+    {
+    return SendReceive(ECMRThreadCancelReceiveEvents);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRSubThreadBase::Shutdown
+// Shutdown the thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCMRSubThreadBase::Shutdown()
+    {
+    PRINT((_L("RCMRSubThreadBase::Shutdown() in")));
+    //close the subthread and wait for its exit.
+    //signal to the subthread to close down.
+
+    // logon to thread first
+    TRequestStatus death;
+    iSubThread.Logon(death);
+
+    TInt shutdownError = 0;
+    if ( iSessionCreated )
+        {
+        // a session was created with the thread; even if there is no session, the thread may still exist
+        shutdownError = SendReceive(ECMRThreadShutdown);
+        PRINT((_L("RCMRSubThreadBase::Shutdown() shutdown msg to session sent, error %d"),shutdownError));
+        }
+
+    if ( shutdownError == KErrNone )
+        {
+        //now wait for the death of the subthread...
+
+        RTimer timer;
+        TInt err = timer.CreateLocal();
+        //if we managed to create the timer, wait for both the death and the timeout to minimise the risk of deadlock
+        if ( !err )
+            {
+            TRequestStatus timeout;
+            timer.After(timeout, iShutdownTimeout);
+            User::WaitForRequest(death, timeout);
+            if ( death == KRequestPending )
+                {
+                //we have timed out.  Panic the thread in debug mode, kill it in release mode.
+                PRINT((_L("RCMRSubThreadBase::Shutdown() timeout in waiting for subthread to exit")));
+                iSubThread.LogonCancel(death);
+                User::WaitForRequest(death);
+#ifdef _DEBUG   
+                if ( iSessionCreated )
+                    {
+                    Panic(ECMRSubThreadPanicTimedOut);
+                    }
+                else 
+                    {
+                    iSubThread.Kill(KErrDied);
+                    }
+#else
+                iSubThread.Kill(KErrDied);
+#endif
+                }
+            else
+                {
+                //subthread has exited. Cancel the timer.
+                PRINT((_L("RCMRSubThreadBase::Shutdown() subthread exited ok")));
+                timer.Cancel();
+                User::WaitForRequest(timeout);
+                }
+            }
+        else
+            {
+            //we have no timer so we'll just have to risk the deadlock
+            User::WaitForRequest(death);
+            }
+        timer.Close();
+        }
+    else
+        {
+        PRINT((_L("RCMRSubThreadBase::Shutdown() sending shutdown msg failed, cancel logon")));
+        iSubThread.LogonCancel(death);
+        User::WaitForRequest(death);
+        }
+    //close the handles to the subthread
+    iSubThread.Close();
+	// close our parent
+	RHandleBase::Close(); 
+    PRINT((_L("RCMRSubThreadBase::Shutdown() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRSubThreadBase::DoCreateSubThread
+// Derived classes call this to start the thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRSubThreadBase::DoCreateSubThread(TThreadFunction aFunction, 
+                                            const TVersion& aVersion, TBool& aThreadCreated)
+    {
+    TInt error = KErrNone;
+    RServer2 server2;
+
+    error = iSubThread.Create(
+        KNullDesC, 
+        aFunction,
+        KDefaultStackSize, 
+        &User::Heap(), 
+        &server2, 
+        EOwnerThread);
+
+    if (error)
+        {
+        return error;
+        }
+
+	TRequestStatus rendezvous;
+	iSubThread.Rendezvous(rendezvous);
+	
+	if (rendezvous!=KRequestPending)
+        {
+        // logon failed - server is not yet running, so cannot have terminated
+		iSubThread.Kill(0);
+		}
+	else
+		{
+        // logon OK - start the thread
+		iSubThread.Resume();
+		}
+	User::WaitForRequest(rendezvous); // wait for start or death
+	
+	if (rendezvous!=KErrNone)
+        {
+		iSubThread.Close();
+		return rendezvous.Int();
+		}
+
+    aThreadCreated = ETrue;
+    		
+	return CreateSession( server2, aVersion);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRSubThreadBase::Panic
+// Panic the thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCMRSubThreadBase::Panic(TCMRSubThreadPanicCode aPanicCode)
+    {
+    _LIT(KMMFSubThreadPanicCategory, "MMFSubThread");
+    iSubThread.Panic(KMMFSubThreadPanicCategory, aPanicCode);
+    }
+
+
+
+
+// ==================== CCMRSubThreadEventMonitor MEMBER FUNCTIONS =======================
+
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventMonitor::CCMRSubThreadEventMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCMRSubThreadEventMonitor::CCMRSubThreadEventMonitor(MCMRSubThreadEventMonitorObserver& aObserver, 
+                                                       RCMRSubThreadBase& aSubThreadProxy) :
+    CActive(EPriorityStandard),
+    iObserver(aObserver), 
+    iSubThreadProxy(aSubThreadProxy)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRSubThreadEventMonitor* CCMRSubThreadEventMonitor::NewL(MCMRSubThreadEventMonitorObserver& aObserver, 
+                                                             RCMRSubThreadBase& aSubThreadProxy)
+    {
+    return (new(ELeave) CCMRSubThreadEventMonitor(aObserver, aSubThreadProxy));
+    }
+
+// Destructor
+CCMRSubThreadEventMonitor::~CCMRSubThreadEventMonitor()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventMonitor::Start
+// Start the event monitor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadEventMonitor::Start()
+    {
+    iSubThreadProxy.ReceiveEvents(iEventPckg, iStatus);
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventMonitor::RunL
+// Active object main function
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadEventMonitor::RunL()
+    {
+    if (iStatus.Int() == KErrNone)
+        {
+        PRINT((_L("CCMRSubThreadEventMonitor::RunL() handle event %x"),iEventPckg().iEventType));
+        iObserver.HandleEvent(iEventPckg());
+        Start();
+        }
+    else
+        {
+        //something's gone wrong with trying to receive events (e.g. server died etc)
+        PRINT((_L("CCMRSubThreadEventMonitor::RunL() event %x but there is a general error"),iEventPckg().iEventType));
+        TMMFEvent event(KCMRErrorCategoryThreadGeneralError, iStatus.Int());
+        iObserver.HandleEvent(event);
+        //we don't want to receive events again here...
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventMonitor::DoCancel
+// Cancel active object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadEventMonitor::DoCancel()
+    {
+    iSubThreadProxy.CancelReceiveEvents();
+    }
+
+
+
+
+
+
+// ======================= CCMRSubThreadShutdownTimer MEMBER FUNCTIONS ======================
+
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadShutdownTimer::CCMRSubThreadShutdownTimer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCMRSubThreadShutdownTimer::CCMRSubThreadShutdownTimer() : 
+    CTimer(EPriorityLow)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadShutdownTimer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRSubThreadShutdownTimer* CCMRSubThreadShutdownTimer::NewL() 
+    {
+    CCMRSubThreadShutdownTimer* s = new(ELeave) CCMRSubThreadShutdownTimer();
+    CleanupStack::PushL(s);
+    s->ConstructL();
+    CleanupStack::Pop();
+    return s;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadShutdownTimer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadShutdownTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadShutdownTimer::Start
+// Start timer for forced shutdown if closing takes too long
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadShutdownTimer::Start()
+    {
+    After(ECMRSubThreadShutdownDelay);
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadShutdownTimer::ShutdownNow
+// Shutdown immediately
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadShutdownTimer::ShutdownNow() const
+    {
+    CActiveScheduler::Stop();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadShutdownTimer::RunL
+// Active object main function
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadShutdownTimer::RunL()
+    {
+    ShutdownNow();
+    }
+
+
+
+
+
+
+
+// ==================== CCMRSubThreadEventReceiver MEMBER FUNCTIONS =======================
+
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventReceiver::CCMRSubThreadEventReceiver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCMRSubThreadEventReceiver::CCMRSubThreadEventReceiver(const RMessage2& aMessage) : 
+    iMessage(aMessage), iNeedToCompleteMessage(ETrue)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventReceiver::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRSubThreadEventReceiver* CCMRSubThreadEventReceiver::NewL(const RMessage2& aMessage)
+    {
+    return new(ELeave) CCMRSubThreadEventReceiver(aMessage);
+    }
+
+// Destructor
+CCMRSubThreadEventReceiver::~CCMRSubThreadEventReceiver()
+    {
+    if (iNeedToCompleteMessage)
+        {
+        iMessage.Complete(KErrDied);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRSubThreadEventReceiver::SendEvent
+// Send an event via this class
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRSubThreadEventReceiver::SendEvent(const TMMFEvent& aEvent)
+    {
+    TMMFEventPckg eventpckg(aEvent);
+    PRINT((_L("CCMRSubThreadEventReceiver::SendEvent() event %x"),aEvent.iEventType));
+	TRAPD(err, iMessage.WriteL(0, eventpckg));
+    iMessage.Complete(err);
+    iNeedToCompleteMessage = EFalse;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+// ==================== CCMRThreadProxyServer MEMBER FUNCTIONS =======================
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxyServer::CCMRThreadProxyServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCMRThreadProxyServer::CCMRThreadProxyServer(TInt aPriority) :
+    CServer2(aPriority, CServer2::ESharableSessions)
+    {
+    }
+
+// Destructor
+CCMRThreadProxyServer::~CCMRThreadProxyServer()
+    {
+    delete iShutdownTimer;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxyServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCMRThreadProxyServer::ConstructL(RServer2* aServer2)
+    {
+    StartL(KNullDesC);
+    // store a reference to the given object, to be used in when creating session with the server
+    *aServer2 = Server();
+    
+    iShutdownTimer = CCMRSubThreadShutdownTimer::NewL();
+    iShutdownTimer->Start();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxyServer::SessionCreated
+// Informs that session has been created successfully
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRThreadProxyServer::SessionCreated()
+    {
+    //stop the shutdown timer
+    iShutdownTimer->Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxyServer::ShutdownNow
+// Request to shutdown immediately
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRThreadProxyServer::ShutdownNow()
+    {
+    iShutdownTimer->ShutdownNow();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxyServer::RunError
+// Handle errors in RunL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRThreadProxyServer::RunError(TInt aError)
+    {
+    //signal the client
+    Message().Complete(aError);
+    ReStart();
+    return KErrNone;
+    }
+
+ 
+
+
+
+// ==================== CCMRThreadProxySession MEMBER FUNCTIONS =======================
+
+
+
+
+// Destructor
+CCMRThreadProxySession::~CCMRThreadProxySession()
+    {
+    PRINT((_L("CCMRThreadProxySession::~CCMRThreadProxySession() deleted iEventReceiver %x"),iEventReceiver));
+    delete iEventReceiver;
+    iEvents.Close();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxySession::CreateL
+// Completes construction of this server-side client session object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRThreadProxySession::CreateL()
+    {
+    iServer = static_cast<CCMRThreadProxyServer*>(const_cast<CServer2*>(Server()));
+    iServer->SessionCreated();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxySession::SendEventToClient
+// Send event to client
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRThreadProxySession::SendEventToClient(const TMMFEvent& aEvent)
+    {
+    TInt error = KErrNone;
+    if ( iEventReceiver )
+        {
+        //send event to client now
+        iEventReceiver->SendEvent(aEvent);
+        PRINT((_L("CCMRThreadProxySession::SendEventToClient() sent event and deleted iEventReceiver %x"),iEventReceiver));
+        delete iEventReceiver;
+        iEventReceiver=NULL;
+        error = KErrNone;
+        }
+    else
+        {
+        //queue the request for later
+        PRINT((_L("CCMRThreadProxySession::SendEventToClient() queued event for later delivery")));
+        TMMFEvent event(aEvent);
+        //if we've exceeded the max number of cached messages, delete the first and append this one to the end
+        if ( iEvents.Count() >= KCMRSubThreadMaxCachedMessages )
+            {
+            iEvents.Remove(0);
+            }
+        error = iEvents.Append(event);
+        }
+
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxySession::ReceiveEventsL
+// Client requests to receive events
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRThreadProxySession::ReceiveEventsL(const RMessage2& aMessage)
+    {
+    if (iEventReceiver)
+        {
+        PRINT((_L("CCMRThreadProxySession::ReceiveEventsL() iEventReceiver already exists")));
+        User::Leave(KErrAlreadyExists);
+        }
+    iEventReceiver = CCMRSubThreadEventReceiver::NewL(aMessage);
+    PRINT((_L("CCMRThreadProxySession::ReceiveEventsL() created iEventReceiver %x"),iEventReceiver));
+    //send the next cached event (if any) to the client
+    if ( iEvents.Count() > 0 )
+        {
+        TMMFEvent& event = iEvents[0];
+        iEventReceiver->SendEvent(event);
+        PRINT((_L("CCMRThreadProxySession::ReceiveEventsL() sent event and deleted iEventReceiver %x"),iEventReceiver));
+        delete iEventReceiver;
+        iEventReceiver=NULL;
+        iEvents.Remove(0);
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxySession::CancelReceiveEvents
+// Stop event receiver
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRThreadProxySession::CancelReceiveEvents()
+    {
+    PRINT((_L("CCMRThreadProxySession::CancelReceiveEvents() deleted iEventReceiver %x"),iEventReceiver));
+    delete iEventReceiver;
+    iEventReceiver = NULL;
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRThreadProxySession::ShutDown
+// Shutdown the server
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRThreadProxySession::ShutDown()
+    {
+    iServer->ShutdownNow();
+    return ETrue;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoCameraSource.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,469 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for camera API wrapper
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CCMRVideoCameraSource.h"
+#include    "CCMRFrameBuffer.h"
+
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::CCMRVideoCameraSource
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CCMRVideoCameraSource::CCMRVideoCameraSource(MCMRVideoSourceObserver* aObserver, TInt aCameraHandle)
+    {
+    
+    iObserver = aObserver;
+    iCameraHandle = aCameraHandle;
+    // zero-initialize all variables
+
+    iCamera = NULL;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::ConstructL()
+    {
+    
+    iReserved = EFalse;
+
+    if ( iCameraHandle == 0 ) 
+        {
+        // camera handle not available, should only happen in development phase?
+        // Create a new Camera API implementation object, if supported
+        TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+        if ( err )
+            {
+            PRINT( ( _L( "CCMRVideoCameraSource::ConstructL() CCamera::New2L return code=%d" ), err ) ); 
+
+            // Create old Camera API implementation object.
+            iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+            }
+        else
+            {
+            PRINT( ( _L( "CCMRVideoCameraSource::ConstructL() using new MCameraObserver2" )) ); 
+            }
+        iDuplicateInstance = EFalse;
+        }
+    else
+        {
+        // Normal case, duplicate camera instance
+        // Create a new Camera API duplicate object, if supported
+        TRAPD( err, iCamera = CCamera::NewDuplicate2L( static_cast<MCameraObserver2&>(*this), iCameraHandle ) );
+        if ( err )
+            {
+            PRINT( ( _L( "CCMRVideoCameraSource::ConstructL() CCamera::NewDuplicate2L return code=%d" ), err ) ); 
+
+            // Create old Camera API duplicate object.
+            iCamera = CCamera::NewDuplicateL( static_cast<MCameraObserver&>(*this), iCameraHandle );
+            }
+        else
+            {
+            PRINT( ( _L( "CCMRVideoCameraSource::ConstructL() using duplicated MCameraObserver2" )) ); 
+            }
+        iDuplicateInstance = ETrue;
+        }
+   
+    iState = EStateNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCameraSource::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoCameraSource* CCMRVideoCameraSource::NewL(MCMRVideoSourceObserver* aObserver, TInt aCameraHandle)
+    {
+    CCMRVideoCameraSource* self = new (ELeave) CCMRVideoCameraSource(aObserver, aCameraHandle);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::~CCMRVideoCameraSource()
+// Destructor
+// ---------------------------------------------------------
+//
+CCMRVideoCameraSource::~CCMRVideoCameraSource()
+    {   
+    // verify that camera has been released
+    if ( iReserved && iCamera )
+        {
+        iCamera->Release();
+        }
+
+    iObserver = NULL;
+    delete iCamera;
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::GetFrameSize
+// Get frame size from camera
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::GetFrameSize(TSize& aSize)
+   {
+   iCamera->GetFrameSize(aSize);
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::CameraInfo
+// Get camera info
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::CameraInfo(TCameraInfo& aInfo)
+    {
+    iCamera->CameraInfo(aInfo);
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::FrameRate
+// Get frame rate from camera
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TReal32 CCMRVideoCameraSource::FrameRate()
+    {
+    return iCamera->FrameRate();
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::BuffersInUse
+// Get number of buffers used by camera
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CCMRVideoCameraSource::BuffersInUse()
+   {
+   return iCamera->BuffersInUse();
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::FramesPerBuffer
+// Get number of frames per buffer used by camera
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CCMRVideoCameraSource::FramesPerBuffer()
+   {
+   return iCamera->FramesPerBuffer();
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::ReserveComplete
+// Camera observer callback informs reserve was completed
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::ReserveComplete(TInt aError)
+   {   
+   iReserved = ETrue;
+   if ( iDuplicateInstance || (aError != KErrNone) )
+       {
+       // no need to switch power on
+       iObserver->MvsoReserveComplete(aError);
+       }
+   else 
+       {
+       // we have the main instance so we must also switch the power on
+       // this hides the poweron from the user and combines reserve & poweron
+       iCamera->PowerOn();
+       }
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::PowerOnComplete
+// Camera observer callback informs poweron was completed
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::PowerOnComplete(TInt aError)
+    {
+    // we hide the poweron from the user and combine reserve & poweron
+    iObserver->MvsoReserveComplete(aError);
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::FrameBufferReady
+// Camera observer callback informs a video buffer is ready
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError)
+   {
+   iObserver->MvsoFrameBufferReady(aFrameBuffer, aError);
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::Reserve
+// Reservers camera, result is informed in callback
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::Reserve()
+   {
+
+   if (iReserved) 
+       {
+       // reserved already, call observer to indicate to caller that source is ready
+       iObserver->MvsoReserveComplete( KErrNone );
+       return;
+       }
+
+   iCamera->Reserve();
+
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::Release
+// Release camera for other use
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::Release()
+   {   
+   iCamera->Release();
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::EnumerateVideoFrameSizes
+// Asks camera to enumerate video frame sizes
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,
+                                                     CCamera::TFormat aFormat) const
+   {
+
+   iCamera->EnumerateVideoFrameSizes(aSize, aSizeIndex, aFormat);
+
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::EnumerateVideoFrameRates
+// Asks camera to enumerate video frame rates
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex, CCamera::TFormat aFormat, 
+                                                     TInt aSizeIndex, CCamera::TExposure /*aExposure*/) const
+   {
+ 
+   iCamera->EnumerateVideoFrameRates(aRate, aRateIndex, aFormat, aSizeIndex /* Exposure == Auto */);
+
+   }
+
+
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::PrepareCaptureL
+// Prepares camera for video capture
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::PrepareCaptureL(CCamera::TFormat aFormat,TInt aSizeIndex,
+                                          TInt aRateIndex,TInt aBuffersToUse, TInt aFramesPerBuffer)
+   {
+
+   // NOTE: Trap this in video recorder !!!
+   iCamera->PrepareVideoCaptureL(aFormat, aSizeIndex, aRateIndex, aBuffersToUse, aFramesPerBuffer);   
+
+   iState = EStateReady;
+
+   }
+
+
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::PrepareCaptureL
+// Prepares camera for video capture
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::PrepareCaptureL(CCamera::TFormat aFormat, TInt aSizeIndex, TInt aRateIndex,
+                                            TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect)        
+   {
+
+   // NOTE: Trap this in video recorder !!!
+   iCamera->PrepareVideoCaptureL(aFormat, aSizeIndex, aRateIndex, aBuffersToUse, aFramesPerBuffer, aClipRect);
+
+   iState = EStateReady;
+
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::StartCapture
+// Start video capture from camera
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::StartCapture()
+   {
+   iCamera->StartVideoCapture();
+   iState = EStateCapturing;
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::StopCapture
+// Stop video capture from camera
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCameraSource::StopCapture()
+   {
+   iCamera->StopVideoCapture();
+   iState = EStateReady;
+   }
+
+// ---------------------------------------------------------
+// CCMRVideoCameraSource::StopCapture
+// Check if capture is active
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CCMRVideoCameraSource::CaptureActive()
+   {
+   return iCamera->VideoCaptureActive();
+   }
+
+// ---------------------------------------------------------
+// Get current exposure setting
+//
+// ---------------------------------------------------------
+//
+CCamera::TExposure CCMRVideoCameraSource::GetExposure() const
+    {
+    return iCamera->Exposure();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCameraSource::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCameraSource::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCMRVideoCameraSource::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCMRVideoCameraSource::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCMRVideoCameraSource::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCMRVideoCameraSource::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCMRVideoCameraSource::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCameraSource::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCameraSource::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCMRVideoCameraSource::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCameraSource::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCameraSource::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCMRVideoCameraSource::ImageBufferReady() NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCMRVideoCameraSource::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCameraSource::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCMRVideoCameraSource::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CCMRFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        // Create a new wrapper class to make conversion from MCameraBuffer to MFrameBuffer
+        
+        TRAPD( err, buffer = CCMRFrameBuffer::NewL( &aCameraBuffer ));
+        if ( err )
+            {
+            PRINT(( _L( "CCMRVideoCameraSource::VideoBufferReady() CCMRFrameBuffer::NewL failed, err=%d" ), err ));
+            aCameraBuffer.Release();
+            aError = err;
+            }
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCMRVideoCameraSource::VideoBufferReady() returning" )));
+    }
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecDataH263.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  H.263 specific data
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRVideoCodecDataH263.h"
+#include "CCMRVideoSettings.h"
+#include "CCMRMediaRecorder.h"
+
+#include <mmf/devvideo/devvideorecord.h>
+#include <mmf/devvideo/h263.h>
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// CONSTANTS based on ITU-T H.263 specification (04/2005)
+// Annex X, profiles and levels definition
+// Table X.2/H.263 - Levels of operation:
+
+// Max framerates (fps) based on codec levels
+const TReal32 KCMRH263Level10Fps = 15.0; // or actually 14.985
+const TReal32 KCMRH263Level20Fps = 15.0; // or actually 14.985
+const TReal32 KCMRH263Level20FpsQCIF = 30.0; // or actually 29.97
+const TReal32 KCMRH263Level3040Fps = 30.0; // or actually 29.97
+const TReal32 KCMRH263Level45Fps = 15.0; // or actually 14.985
+const TReal32 KCMRH263Level50Fps = 50.0;
+const TReal32 KCMRH263Level50FpsSIF = 60.0; // or actually 59.94
+
+// Max bitrates (bps) based on codec levels
+const TInt KCMRH263Level10Bps = 64000;
+const TInt KCMRH263Level20Bps = 128000;
+const TInt KCMRH263Level30Bps = 384000;
+const TInt KCMRH263Level40Bps = 2048000;
+const TInt KCMRH263Level45Bps = 128000;
+const TInt KCMRH263Level50Bps = 4096000;
+
+// max coded picture size (bytes; per H.263 requirements).
+const TUint KCMRMaxCodedPictureSizeQCIF = 16384; // QCIF and smaller
+const TUint KCMRMaxCodedPictureSizeCIF = 65536; // CIF and smaller
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH263::MaxBitRate
+// Checks the maximum allowed bitrate for the selected codec
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CCMRVideoCodecDataH263::MaxBitRate() const
+    {
+    switch ( iVideoCodecLevel )
+        {
+        case 20 :
+            return KCMRH263Level20Bps;
+        case 30 :
+            return KCMRH263Level30Bps;
+        case 40 :
+            return KCMRH263Level40Bps;
+        case 45 :
+            return KCMRH263Level45Bps;
+        case 50 :
+            return KCMRH263Level50Bps;
+        case 10 : // 10 is the default level
+        default :
+            return KCMRH263Level10Bps;
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH263::MaxFrameRate
+// Checks the maximum allowed frame rate for the selected codec
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TReal32 CCMRVideoCodecDataH263::MaxFrameRate(const TSize& aFrameSize) const
+    {
+    switch ( iVideoCodecLevel )
+        {
+        case 20 :
+            if ( aFrameSize.iHeight > KCMRQCIFHeight || aFrameSize.iWidth > KCMRQCIFWidth )
+                {
+                return KCMRH263Level20Fps;
+                }
+            else
+                {
+                // smaller size (at most QCIF) => different max rate
+                return KCMRH263Level20FpsQCIF;
+                }
+        case 30 :
+        case 40 :
+            return KCMRH263Level3040Fps;
+        case 45 :
+            return KCMRH263Level45Fps;
+        case 50 :
+            if ( aFrameSize.iHeight == KCMRCIFHeight )
+                {
+                return KCMRH263Level50Fps;
+                }
+            else
+                {
+                // smaller size (at most 352x240) => different max rate
+                return KCMRH263Level50FpsSIF;
+                }
+        case 10 : // 10 is the default level
+        default :
+            return KCMRH263Level10Fps;
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH263::MaxFrameSize
+// Checks if the frame size for the selected codec is acceptable
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CCMRVideoCodecDataH263::MaxFrameSize( const TSize& aSize ) const
+    {
+    TSize maxSize;
+    TBool arbitrarySizeAllowed = ETrue;
+    switch ( iVideoCodecLevel )
+        {
+        case 20 :
+        case 30 :
+        case 40 :
+            arbitrarySizeAllowed = EFalse;
+        case 50 : 
+            maxSize.SetSize(KCMRCIFWidth,KCMRCIFHeight);
+            break;
+        case 45 :
+            arbitrarySizeAllowed = ETrue;
+            maxSize.SetSize(KCMRQCIFWidth,KCMRQCIFHeight);
+            break;
+        case 10 : // 10 is the default level
+        default: 
+            arbitrarySizeAllowed = EFalse;
+            maxSize.SetSize(KCMRQCIFWidth,KCMRQCIFHeight);
+        }
+
+    // subQCIF is always the smallest one we support. 
+    // Max size depends on codec level and checked above
+    if ( (aSize.iWidth < KCMRSubQCIFWidth) || (aSize.iHeight < KCMRSubQCIFHeight) 
+        || (aSize.iWidth > maxSize.iWidth) || (aSize.iHeight > maxSize.iHeight) )
+        {
+        // size not ok
+        return EFalse;
+        }
+
+    // next step, check if size is arbitrary
+    if ( !arbitrarySizeAllowed )
+        {
+        // accept only subQCIF, QCIF or CIF
+        if ( ((aSize.iWidth == KCMRSubQCIFWidth) && (aSize.iHeight == KCMRSubQCIFHeight)) ||
+             ((aSize.iWidth == KCMRQCIFWidth) && (aSize.iHeight == KCMRQCIFHeight)) ||
+             ((aSize.iWidth == KCMRCIFWidth) && (aSize.iHeight == KCMRCIFHeight)) 
+            )
+            {
+            // size ok
+            return ETrue;
+            }
+        else
+            {
+            // size not ok
+            return EFalse;
+            }
+        }
+    else
+        {
+        // size ok
+        return ETrue;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecDataH263::LevelForMMS
+// Check if codec level indicates we are recording for MMS; then some tighter restrictions apply
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoCodecDataH263::LevelForMMS() const
+    {
+    if ( iVideoCodecLevel == 10 )
+        {
+        // H.263 level 10 is the mandatory codec for MMS
+        PRINT((_L("CCMRVideoCodecDataH263::LevelForMMS() using H.263 level 10, applying MMS restrictions")));
+        return ETrue;
+        }
+    else
+        {
+        PRINT((_L("CCMRVideoCodecDataH263::LevelForMMS() using some non-MMS H.263 level")));
+        return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecDataH263::MaxBufferLength
+// Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoCodecDataH263::MaxBufferLength(const TSize& aFrameSize) const
+    {
+
+    if ( (aFrameSize.iHeight <= KCMRQCIFHeight) && (aFrameSize.iWidth <= KCMRQCIFWidth) )
+        {
+        // QCIF and smaller
+        // H.263, only depends on picture size
+        return KCMRMaxCodedPictureSizeQCIF;
+        }
+    else if ( (aFrameSize.iHeight <= KCMRCIFHeight) && (aFrameSize.iWidth <= KCMRCIFWidth) )
+        {
+        // QCIF+ to CIF
+        return KCMRMaxCodedPictureSizeCIF;
+        }
+    else
+        {
+        // larger picture sizes not supported
+        return 0;
+        }
+    }
+    
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH263::SetVideoCodingOptionsL
+// Set misc video coding options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataH263::SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions)
+    {
+    iSyncIntervalInPicture = aOptions.iSyncIntervalInPicture;
+    
+    if ( (aOptions.iExpectedBitErrorRate == 0.0) && (aOptions.iExpectedPacketLossRate > 0.0) )
+        {
+        // currently only BitErrorRate has an effect, map also PacketLossRate to BitErrorRate; a very strong simplification
+        if ( aOptions.iExpectedPacketLossRate > KCMRBadPacketLossRate )
+            {
+            // bad packet loss rate
+            iExpectedBitErrorRate = KCMRBadBitErrorRate;
+            }
+        else if ( aOptions.iExpectedPacketLossRate > KCMRNotNoticeablePacketLossRate )
+            {
+            // between bad and not noticeable
+            iExpectedBitErrorRate = KCMRTolerableBitErrorRate;
+            }
+        else
+            {
+            // not noticeable
+            iExpectedBitErrorRate = KCMRNotNoticeableBitErrorRate;
+            }
+        }
+    else
+        {
+        iExpectedBitErrorRate = aOptions.iExpectedBitErrorRate;
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH263::SetPreInitParamsL
+// Set codec-specific video coding options to DevVideoRecord before initialize
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataH263::SetPreInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const
+    {
+    if ( iSyncIntervalInPicture > 0 )
+        {
+        // Set Standard specific coding options
+        TH263VideoMode h263Options;
+        h263Options.iAllowedPictureTypes = EH263PictureTypeI | EH263PictureTypeP;
+        h263Options.iForceRoundingTypeToZero = ETrue;
+        h263Options.iPictureHeaderRepetition = 0;
+        h263Options.iGOBHeaderInterval = iSyncIntervalInPicture;
+        TPckgC<TH263VideoMode> h263pckg(h263Options);
+        aDevVideoRecord->SetCodingStandardSpecificOptionsL( h263pckg );
+        }
+    }
+    
+
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH263::SetPostInitParamsL
+// Set codec-specific video coding options to DevVideoRecord after initialize
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataH263::SetPostInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const
+    {
+    if ( iExpectedBitErrorRate > 0.0 )
+        {
+        // set expected bit error rate to encoder
+        aDevVideoRecord->SetChannelBitErrorRate( 0, iExpectedBitErrorRate, 0);
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecDataH264AVC.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  H.264 AVC specific data
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRVideoCodecDataH264AVC.h"
+#include "CCMRVideoSettings.h"
+#include "CCMRMediaRecorder.h"
+
+#include <mmf/devvideo/devvideorecord.h>
+#include <mmf/devvideo/avc.h>
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// Max bitrates (bps) based on codec levels
+// from ISO IEC 14496-10:2003 Annex A, Table A-1, Max video bit rate MaxBR.
+const TInt KCMRH264AVCMaxBpsLevel10 = 64000;
+const TInt KCMRH264AVCMaxBpsLevel10b = 128000;
+const TInt KCMRH264AVCMaxBpsLevel11 = 192000;
+const TInt KCMRH264AVCMaxBpsLevel12 = 384000;
+const TInt KCMRH264AVCMaxBpsLevel13 = 768000;
+const TInt KCMRH264AVCMaxBpsLevel20 = 2000000;
+const TInt KCMRH264AVCMaxBpsLevel21 = 4000000;
+const TInt KCMRH264AVCMaxBpsLevel22 = 4000000;
+const TInt KCMRH264AVCMaxBpsLevel30 = 10000000;
+const TInt KCMRH264AVCMaxBpsLevel31 = 14000000;
+const TInt KCMRH264AVCMaxBpsLevel32 = 20000000;
+const TInt KCMRH264AVCMaxBpsLevel40 = 20000000;
+
+// Max coded picture size (in bytes; per H.264 AVC specification).
+// from ISO/IEC 14496-10:2003 Annex A, Table A-1, Max CPB size MaxCPB (in 1000 bits units).
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel10 = 21875;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel10b = 43750;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel11 = 62500;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel12 = 125000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel13 = 250000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel20 = 250000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel21 = 500000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel22 = 500000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel30 = 1250000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel31 = 1750000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel32 = 2500000;
+const TUint KCMRMaxCodedPictureSizeH264AVCLevel40 = 3125000;
+
+// max macroblocks/second:
+// from ISO/IEC 14496-10:2003 Annex A, Table A-1, Max macroblock processing rate MaxMBPS.
+const TUint KCMRMaxMBPSH264AVCLevel10 = 1485;
+const TUint KCMRMaxMBPSH264AVCLevel10b = 1485;
+const TUint KCMRMaxMBPSH264AVCLevel11 = 3000;
+const TUint KCMRMaxMBPSH264AVCLevel12 = 6000;
+const TUint KCMRMaxMBPSH264AVCLevel13 = 11880;
+const TUint KCMRMaxMBPSH264AVCLevel20 = 11880;
+const TUint KCMRMaxMBPSH264AVCLevel21 = 19800;
+const TUint KCMRMaxMBPSH264AVCLevel22 = 20250;
+const TUint KCMRMaxMBPSH264AVCLevel30 = 40500;
+const TUint KCMRMaxMBPSH264AVCLevel31 = 108000;
+const TUint KCMRMaxMBPSH264AVCLevel32 = 216000;
+const TUint KCMRMaxMBPSH264AVCLevel40 = 245760;
+
+// max frame size (in macroblocks)
+// from ISO/IEC 14496-10:2003 Table A-1, Max frame size MaxFS
+const TUint KCMRMaxFrameSizeH264AVCLevel10 = 99;
+const TUint KCMRMaxFrameSizeH264AVCLevel10b = 99;
+const TUint KCMRMaxFrameSizeH264AVCLevel11 = 396;
+const TUint KCMRMaxFrameSizeH264AVCLevel12 = 396;
+const TUint KCMRMaxFrameSizeH264AVCLevel13 = 396;
+const TUint KCMRMaxFrameSizeH264AVCLevel20 = 396;
+const TUint KCMRMaxFrameSizeH264AVCLevel21 = 792;
+const TUint KCMRMaxFrameSizeH264AVCLevel22 = 1620;
+const TUint KCMRMaxFrameSizeH264AVCLevel30 = 1620;
+const TUint KCMRMaxFrameSizeH264AVCLevel31 = 3600;
+const TUint KCMRMaxFrameSizeH264AVCLevel32 = 5120;
+const TUint KCMRMaxFrameSizeH264AVCLevel40 = 8192;
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::MaxBitRate
+// Checks the maximum allowed bitrate for the selected codec
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CCMRVideoCodecDataH264AVC::MaxBitRate() const
+    {
+    // H.264 AVC maximum bitrates per level (baseline profile).
+    switch ( iVideoCodecLevel )
+        {
+        case KCMRH264AVCCodecLevel10 :
+            return KCMRH264AVCMaxBpsLevel10;
+        case KCMRH264AVCCodecLevel10b :
+            return KCMRH264AVCMaxBpsLevel10b;
+        case KCMRH264AVCCodecLevel11 :
+            return KCMRH264AVCMaxBpsLevel11;
+        case KCMRH264AVCCodecLevel12 :
+            return KCMRH264AVCMaxBpsLevel12;
+        case KCMRH264AVCCodecLevel13 :
+            return KCMRH264AVCMaxBpsLevel13;
+        case KCMRH264AVCCodecLevel20 :
+            return KCMRH264AVCMaxBpsLevel20;
+        case KCMRH264AVCCodecLevel21 :
+            return KCMRH264AVCMaxBpsLevel21;
+        case KCMRH264AVCCodecLevel22 :
+            return KCMRH264AVCMaxBpsLevel22;
+        case KCMRH264AVCCodecLevel30 :
+            return KCMRH264AVCMaxBpsLevel30;
+        case KCMRH264AVCCodecLevel31 :
+            return KCMRH264AVCMaxBpsLevel31;
+        case KCMRH264AVCCodecLevel32 :
+            return KCMRH264AVCMaxBpsLevel32;
+        case KCMRH264AVCCodecLevel40 :
+            return KCMRH264AVCMaxBpsLevel40;
+        default :
+            return KCMRH264AVCMaxBpsLevel10;
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::MaxFrameRate
+// Checks the maximum allowed frame rate for the selected codec
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TReal32 CCMRVideoCodecDataH264AVC::MaxFrameRate(const TSize& aFrameSize) const
+    {
+    TReal32 macroblocksPerSecond = 0;
+    switch ( iVideoCodecLevel )
+        {
+        case KCMRH264AVCCodecLevel10 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel10;
+            break;
+        case KCMRH264AVCCodecLevel10b :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel10b;
+            break;
+        case KCMRH264AVCCodecLevel11 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel11;
+            break;
+        case KCMRH264AVCCodecLevel12 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel12;
+            break;
+        case KCMRH264AVCCodecLevel13 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel13;
+            break;
+        case KCMRH264AVCCodecLevel20 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel20;
+            break;
+        case KCMRH264AVCCodecLevel21 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel21;
+            break;
+        case KCMRH264AVCCodecLevel22 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel22;
+            break;
+        case KCMRH264AVCCodecLevel30 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel30;
+            break;
+        case KCMRH264AVCCodecLevel31 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel31;
+            break;
+        case KCMRH264AVCCodecLevel32 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel32;
+            break;
+        case KCMRH264AVCCodecLevel40 :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel40;
+            break;
+        default :
+            macroblocksPerSecond = KCMRMaxMBPSH264AVCLevel10;
+            break;
+        }
+    return  (macroblocksPerSecond / ( (aFrameSize.iWidth/16)*(aFrameSize.iHeight/16))); // macroblocks are 16x16 pixels
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::MaxFrameSize
+// Checks if the frame size for the selected codec is acceptable
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CCMRVideoCodecDataH264AVC::MaxFrameSize( const TSize& aSize ) const
+    {
+    PRINT((_L("CCMRVideoCodecDataH264AVC::MaxFrameSize() in, finding max frame size for level: %d"), iVideoCodecLevel));
+    TInt maxFrameSizeInMacroblocks;
+
+    // H.264 AVC
+    switch ( iVideoCodecLevel )
+        {
+        case KCMRH264AVCCodecLevel10 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel10;
+            break;
+        case KCMRH264AVCCodecLevel10b :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel10b;
+            break;
+        case KCMRH264AVCCodecLevel11 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel11;
+            break;
+        case KCMRH264AVCCodecLevel12 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel12;
+            break;
+        case KCMRH264AVCCodecLevel13 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel13;
+            break;
+        case KCMRH264AVCCodecLevel20 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel20;
+            break;
+        case KCMRH264AVCCodecLevel21 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel21;
+            break;
+        case KCMRH264AVCCodecLevel22 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel22;
+            break;
+        case KCMRH264AVCCodecLevel30 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel30;
+            break;
+        case KCMRH264AVCCodecLevel31 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel31;
+            break;
+        case KCMRH264AVCCodecLevel32 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel32;
+            break;
+        case KCMRH264AVCCodecLevel40 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel40;
+            break;
+        default :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeH264AVCLevel10;
+            break;
+        }
+	PRINT((_L("CCMRVideoCodecDataH264AVC::MaxFrameSize() max size in macroblocks: %d"), maxFrameSizeInMacroblocks ));
+
+    // subQCIF is always the smallest one we support.
+    // Max size depends on codec level and checked above
+    if ( (aSize.iWidth < KCMRSubQCIFWidth) || (aSize.iHeight < KCMRSubQCIFHeight)
+        || (((aSize.iWidth/16)*(aSize.iHeight/16)) > maxFrameSizeInMacroblocks) ) //macroblocks are 16x16 pixels
+        {
+        // size not ok
+        return EFalse;
+        }
+    return ETrue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::LevelForMMS
+// Check if codec level indicates we are recording for MMS; then some tighter restrictions apply
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoCodecDataH264AVC::LevelForMMS() const
+    {
+    // H.264 AVC no MMS support.
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::MaxBufferLength
+// Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoCodecDataH264AVC::MaxBufferLength(const TSize& /*aFrameSize*/) const
+    {
+    switch ( iVideoCodecLevel )
+        {
+        case KCMRH264AVCCodecLevel10 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel10;
+        case KCMRH264AVCCodecLevel10b :
+            return KCMRMaxCodedPictureSizeH264AVCLevel10b;
+        case KCMRH264AVCCodecLevel11 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel11;
+        case KCMRH264AVCCodecLevel12 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel12;
+        case KCMRH264AVCCodecLevel13 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel13;
+        case KCMRH264AVCCodecLevel20 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel20;
+        case KCMRH264AVCCodecLevel21 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel21;
+        case KCMRH264AVCCodecLevel22 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel22;
+        case KCMRH264AVCCodecLevel30 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel30;
+        case KCMRH264AVCCodecLevel31 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel31;
+        case KCMRH264AVCCodecLevel32 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel32;
+        case KCMRH264AVCCodecLevel40 :
+            return KCMRMaxCodedPictureSizeH264AVCLevel40;
+        default :
+            return KCMRH264AVCMaxBpsLevel10;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::SetVideoCodingOptionsL
+// Set misc video coding options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataH264AVC::SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions)
+    {
+    if ( (aOptions.iExpectedBitErrorRate == 0.0) && (aOptions.iExpectedPacketLossRate > 0.0) )
+        {
+        // currently only BitErrorRate has an effect, map also PacketLossRate to BitErrorRate; a very strong simplification
+        if ( aOptions.iExpectedPacketLossRate > KCMRBadPacketLossRate )
+            {
+            // bad packet loss rate
+            iExpectedBitErrorRate = KCMRBadBitErrorRate;
+            }
+        else if ( aOptions.iExpectedPacketLossRate > KCMRNotNoticeablePacketLossRate )
+            {
+            // between bad and not noticeable
+            iExpectedBitErrorRate = KCMRTolerableBitErrorRate;
+            }
+        else
+            {
+            // not noticeable
+            iExpectedBitErrorRate = KCMRNotNoticeableBitErrorRate;
+            }
+        }
+    else
+        {
+        iExpectedBitErrorRate = aOptions.iExpectedBitErrorRate;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::SetPreInitParamsL
+// Set codec-specific video coding options to DevVideoRecord before initialize
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataH264AVC::SetPreInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const
+    {
+    // Set standard specific coding options
+    TAvcVideoMode h264avcOptions;
+    h264avcOptions.iAllowedPictureTypes = EAvcPictureTypeI | EAvcPictureTypeP;
+    h264avcOptions.iFlexibleMacroblockOrder = EFalse;
+    h264avcOptions.iRedundantPictures = EFalse;
+    h264avcOptions.iDataPartitioning = EFalse;
+    h264avcOptions.iFrameMBsOnly = ETrue;
+    h264avcOptions.iMBAFFCoding = EFalse;
+    h264avcOptions.iEntropyCodingCABAC = EFalse;
+    h264avcOptions.iWeightedPPrediction = EFalse;
+    h264avcOptions.iWeightedBipredicitonMode = 0;
+    h264avcOptions.iDirect8x8Inference = EFalse;
+    TPckgC<TAvcVideoMode> h264avcpckg(h264avcOptions);
+    aDevVideoRecord->SetCodingStandardSpecificOptionsL( h264avcpckg );
+    }
+
+
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataH264AVC::SetPostInitParamsL
+// Set codec-specific video coding options to DevVideoRecord after initialize
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataH264AVC::SetPostInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const
+    {
+    if ( iExpectedBitErrorRate > 0.0 )
+        {
+        // set expected bit error rate to encoder
+        aDevVideoRecord->SetChannelBitErrorRate( 0, iExpectedBitErrorRate, 0);
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecDataMPEG4.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,322 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPEG4 specific data
+*
+*/
+
+
+// INCLUDE FILES
+#include "CCMRVideoCodecDataMPEG4.h"
+#include "CCMRVideoSettings.h"
+#include "CCMRMediaRecorder.h"
+#include <mmf/devvideo/devvideorecord.h>
+#include <mmf/devvideo/mpeg4visual.h>
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// CONSTANTS
+
+// Max bitrates (bps):
+// from ISO/IEC 14496-2:2003 Annex N Table N-1, Max Bitrate
+const TInt KCMRMpeg4Level0Bps = 64000;
+const TInt KCMRMpeg4Level0bBps = 128000;
+const TInt KCMRMpeg4Level1Bps = 64000;
+const TInt KCMRMpeg4Level2Bps = 128000;
+const TInt KCMRMpeg4Level3Bps = 384000;
+const TInt KCMRMpeg4Level4aBps = 4000000;
+const TInt KCMRMpeg4Level5Bps = 8000000;
+const TInt KCMRMpeg4Level6Bps = 12000000;
+
+// Max coded picture size (in bytes):
+// from ISO/IEC 14496-2:2003 Annex N Table N-1, Max vbv buffer size (units of 16384 bits)
+const TUint KCMRMaxCodedPictureSizeLevel0 = 20480;
+const TUint KCMRMaxCodedPictureSizeLevel0b = 40960;
+const TUint KCMRMaxCodedPictureSizeLevel1 = 20480;
+const TUint KCMRMaxCodedPictureSizeLevel2 = 81920;
+const TUint KCMRMaxCodedPictureSizeLevel3 = 81920;
+const TUint KCMRMaxCodedPictureSizeLevel4a = 163840;
+const TUint KCMRMaxCodedPictureSizeLevel5 = 229376;
+const TUint KCMRMaxCodedPictureSizeLevel6 = 507904;
+
+// Max frame size (in macroblocks)
+// from ISO/IEC 14496-2:2003 Annex N Table N-1, Max VCV buffer size (MB)
+const TUint KCMRMaxFrameSizeMpeg4Level0 = 99;
+const TUint KCMRMaxFrameSizeMpeg4Level0b = 99;
+const TUint KCMRMaxFrameSizeMpeg4Level1 = 99;
+const TUint KCMRMaxFrameSizeMpeg4Level2 = 396;
+const TUint KCMRMaxFrameSizeMpeg4Level3 = 396;
+const TUint KCMRMaxFrameSizeMpeg4Level4a = 1200;
+const TUint KCMRMaxFrameSizeMpeg4Level5 = 1620;
+const TUint KCMRMaxFrameSizeMpeg4Level6 = 3600;
+
+// Max frame rate ( macroblocks/second ):
+// from ISO/IEC 14496-2:2003 Annex N Table N-1, VCV decoder rate (MB/s)
+const TUint KCMRMaxMBPSMpeg4Level0 = 1485;
+const TUint KCMRMaxMBPSMpeg4Level0b = 1485;
+const TUint KCMRMaxMBPSMpeg4Level1 = 1485;
+const TUint KCMRMaxMBPSMpeg4Level2 = 5940;
+const TUint KCMRMaxMBPSMpeg4Level3 = 11880;
+const TUint KCMRMaxMBPSMpeg4Level4a = 36000;
+const TUint KCMRMaxMBPSMpeg4Level5 = 40500;
+const TUint KCMRMaxMBPSMpeg4Level6 = 108000;
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::MaxBitRate
+// Checks the maximum allowed bitrate for the selected codec
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CCMRVideoCodecDataMPEG4::MaxBitRate() const
+    {
+    // MPEG-4
+    switch ( iVideoCodecLevel )
+        {
+        case 0 :
+            return KCMRMpeg4Level0Bps;
+        case KCMRMPEG4SPLevel0B :
+            return KCMRMpeg4Level0bBps;
+        case 2 :
+            return KCMRMpeg4Level2Bps;
+        case 3 :
+            return KCMRMpeg4Level3Bps;
+        case 4 :
+            return KCMRMpeg4Level4aBps;
+        case 5 :
+            return KCMRMpeg4Level5Bps;
+        case 6 :
+            return KCMRMpeg4Level6Bps;
+        case 1 : // 1 is the default level
+        default :
+            return KCMRMpeg4Level1Bps;
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::MaxFrameRate
+// Checks the maximum allowed frame rate for the selected codec
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TReal32 CCMRVideoCodecDataMPEG4::MaxFrameRate(const TSize& aFrameSize) const
+    {
+    TReal32 macroblocksPerSecond = 0;
+    switch ( iVideoCodecLevel )
+        {
+        case 6 :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level6;
+            break;
+        case 5 :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level5;
+            break;
+        case 4 :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level4a;
+            break;
+        case 3 :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level3;
+            break;
+        case 2 :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level2;
+            break;
+        case 1 :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level1;
+            break;
+        case KCMRMPEG4SPLevel0B :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level0b;
+            break;
+        case 0 :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level0;
+            break;
+        default :
+            macroblocksPerSecond = KCMRMaxMBPSMpeg4Level1;
+            break;
+        }
+    return  (macroblocksPerSecond / ( (aFrameSize.iWidth/16)*(aFrameSize.iHeight/16))); // macroblocks are 16x16 pixels
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::MaxFrameSize
+// Checks if the frame size for the selected codec is acceptable
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CCMRVideoCodecDataMPEG4::MaxFrameSize( const TSize& aSize ) const
+    {
+    PRINT((_L("CCMRVideoCodecDataMPEG4::MaxFrameSize() in, finding max frame size for level: %d"), iVideoCodecLevel));
+    TInt maxFrameSizeInMacroblocks;
+
+    // MPEG-4
+    switch ( iVideoCodecLevel )
+        {
+        case 6 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level6;
+            break;
+        case 5 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level5;
+            break;
+        case 4 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level4a;
+            break;
+        case 3 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level3;
+            break;
+        case 2 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level2;
+            break;
+        case 1 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level1;
+            break;
+        case KCMRMPEG4SPLevel0B : // 0b
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level0b;
+            break;
+        case 0 :
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level0;
+            break;
+        default:
+            maxFrameSizeInMacroblocks = KCMRMaxFrameSizeMpeg4Level1;
+            break;
+        }
+    PRINT((_L("CCMRVideoCodecDataMPEG4::MaxFrameSize() max size in macroblocks: %d"), maxFrameSizeInMacroblocks ));
+
+    // subQCIF is always the smallest one we support.
+    // Max size depends on codec level and checked above
+    if ( (aSize.iWidth < KCMRSubQCIFWidth) || (aSize.iHeight < KCMRSubQCIFHeight)
+        || (((aSize.iWidth/16)*(aSize.iHeight/16)) > maxFrameSizeInMacroblocks) ) //macroblocks are 16x16 pixels
+        {
+        // size not ok
+        return EFalse;
+        }
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::LevelForMMS
+// Check if codec level indicates we are recording for MMS; then some tighter restrictions apply
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoCodecDataMPEG4::LevelForMMS() const
+    {
+    // MPEG-4
+    if ( iVideoCodecLevel == 0 )
+        {
+        // MPEG-4 SP Level 0 is for MMS, although not the primary codec for MMS
+        PRINT((_L("CCMRVideoCodecDataMPEG4::LevelForMMS() using MPEG-4 level 0, applying MMS restrictions")));
+        return ETrue;
+        }
+    else
+        {
+        PRINT((_L("CCMRVideoCodecDataMPEG4::LevelForMMS() using some non-MMS MPEG-4 level")));
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::MaxBufferLength
+// Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoCodecDataMPEG4::MaxBufferLength(const TSize& /*aFrameSize*/) const
+    {
+    // MPEG-4
+    switch ( iVideoCodecLevel )
+        {
+        case 6 :
+            return KCMRMaxCodedPictureSizeLevel6;
+        case 5 :
+            return KCMRMaxCodedPictureSizeLevel5;
+        case 4 :
+            return KCMRMaxCodedPictureSizeLevel4a;
+        case 3 :
+            return KCMRMaxCodedPictureSizeLevel3;
+        case 2 :
+            return KCMRMaxCodedPictureSizeLevel2;
+        case 1 :
+            return KCMRMaxCodedPictureSizeLevel1;
+        case KCMRMPEG4SPLevel0B : // 0b
+            return KCMRMaxCodedPictureSizeLevel0b;
+        case 0 :
+            return KCMRMaxCodedPictureSizeLevel0;
+        default:
+            return KCMRMaxCodedPictureSizeLevel1;
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::SetVideoCodingOptionsL
+// Set misc video coding options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataMPEG4::SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions)
+    {
+    if ( (aOptions.iExpectedBitErrorRate == 0.0) && (aOptions.iExpectedPacketLossRate > 0.0) )
+        {
+        // currently only BitErrorRate has an effect, map also PacketLossRate to BitErrorRate; a very strong simplification
+        if ( aOptions.iExpectedPacketLossRate > KCMRBadPacketLossRate )
+            {
+            // bad packet loss rate
+            iExpectedBitErrorRate = KCMRBadBitErrorRate;
+            }
+        else if ( aOptions.iExpectedPacketLossRate > KCMRNotNoticeablePacketLossRate )
+            {
+            // between bad and not noticeable
+            iExpectedBitErrorRate = KCMRTolerableBitErrorRate;
+            }
+        else
+            {
+            // not noticeable
+            iExpectedBitErrorRate = KCMRNotNoticeableBitErrorRate;
+            }
+        }
+    else
+        {
+        iExpectedBitErrorRate = aOptions.iExpectedBitErrorRate;
+        }
+
+
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::SetPreInitParamsL
+// Set codec-specific video coding options to DevVideoRecord before initialize
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataMPEG4::SetPreInitParamsL(CMMFDevVideoRecord* /*aDevVideoRecord*/) const
+    {
+    // Set Standard specific coding options; none at the moment
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoCodecDataMPEG4::SetPostInitParamsL
+// Set codec-specific video coding options to DevVideoRecord after initialize
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoCodecDataMPEG4::SetPostInitParamsL(CMMFDevVideoRecord* aDevVideoRecord) const
+    {
+    if ( iExpectedBitErrorRate > 0.0 )
+        {
+        // set expected bit error rate to encoder
+        aDevVideoRecord->SetChannelBitErrorRate( 0, iExpectedBitErrorRate, 0);
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecsBasic.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for helper class to check supported video codecs,
+*                basic variant (no MPEG4-support enabled in the platform)
+*
+*/
+
+
+#include "CCMRVideoCodecs.h"
+#include "CCMRSupportedCodecs.h"
+#include "CCMRVideoSettings.h"
+#include <mmf/devvideo/devvideorecord.h>
+
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+// ================= LOCAL FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CheckIfSupported
+// Helper function to check if mimetype x is supported in 
+// the system
+// 
+// ---------------------------------------------------------
+//
+static TBool CheckIfSupportedL( const TDes8& aMimeType, RArray <TUid>& aEncoders, CMMFDevVideoRecord* aDevvr )
+    {
+    TBool r = EFalse;
+    TRAPD( err, aDevvr->FindEncodersL( aMimeType, 0, aEncoders, EFalse ));
+
+    if ( (err == KErrNone) && (aEncoders.Count() > 0) )
+        {
+        r = ETrue;
+        }
+    aEncoders.Reset();
+
+    return r;
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::NewL
+//
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoCodecs* CCMRVideoCodecs::NewL()
+    {
+    
+    CCMRVideoCodecs* self = new (ELeave) CCMRVideoCodecs;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::ConstructL
+//
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCodecs::ConstructL()
+    {
+    iVideoMimeTypes = new(ELeave) CDesC8ArrayFlat( 2 ); // 2 is the granularity of the array
+    // check what we support and have installed
+    GenerateListOfSupportedVideoCodecsL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::~CCMRVideoCodecs
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoCodecs::~CCMRVideoCodecs()
+    {
+    delete iVideoMimeTypes;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::GetSupportedVideoCodecsL
+// Get the supported & installed video codecs.
+// This can be called also when the recorder is not open
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCodecs::GetSupportedVideoCodecsL(CDesC8Array& aVideoMimeTypes) const
+    {
+    aVideoMimeTypes.Reset();
+
+    // copy from iVideoMimeTypes
+    TInt i;
+    for ( i = 0; i < iVideoMimeTypes->Count(); i++ )
+        {
+        aVideoMimeTypes.AppendL( iVideoMimeTypes->MdcaPoint(i) );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::DoWeSupportThisL
+// Check if the given codec is supported & installed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoCodecs::DoWeSupportThisL(const TDesC8& aMimeType) const
+    {
+    if ( aMimeType == KNullDesC8 )
+        {
+        // asking to use default codec; we should ensure that all classes use 
+        // the same default
+        TInt i;
+        for ( i = 0; i < iVideoMimeTypes->Count(); i++ )
+            {
+            if ( iVideoMimeTypes->MdcaPoint(i) == KCMRMimeTypeH263BaselineProfile )
+                {
+                PRINT((_L("CCMRVideoCodecs::DoWeSupportThisL() - Null codec was given and checked that we support it"))); 
+                return ETrue;
+                }
+            }
+        }
+    else
+        {
+        TInt i;
+        for ( i = 0; i < iVideoMimeTypes->Count(); i++ )
+            {
+            if ( iVideoMimeTypes->MdcaPoint(i) == aMimeType )
+                {
+                PRINT((_L("CCMRVideoCodecs::DoWeSupportThisL() - a MIME-type was given and checked that we support it") )); 
+                return ETrue;
+                }
+            }
+        }
+    PRINT((_L("CCMRVideoCodecs::DoWeSupportThisL() - given MIME-type is not supported") )); 
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL
+// Generate list of supported & installed video codecs.
+// Called internally in the construction
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL()
+    {
+    MMMFDevVideoRecordObserver* nullObserver = NULL;
+    CMMFDevVideoRecord* tmpDevvr = NULL;
+    tmpDevvr = CMMFDevVideoRecord::NewL( *nullObserver );   //NULL should be acceptable since we are not creating any HW devices here
+    CleanupStack::PushL( tmpDevvr );
+
+
+    RArray <TUid> encoders;
+    CleanupClosePushL( encoders );
+
+    iVideoMimeTypes->Reset();
+
+    // check that each supported encoder also exists in the system
+
+    // H.263 with default profile & level (profile 0; duplicate of the next item).
+    TBool defH263 = CheckIfSupportedL( (const TDes8&)KCMRMimeTypeH263, encoders, tmpDevvr);
+    if ( defH263 )
+        {
+        // encoder exists => add to the list
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 default parameters found"))); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263 );
+        }
+    // profile 0
+    TBool profileH263 = CheckIfSupportedL( (const TDes8&)KCMRMimeTypeH263BaselineProfile, encoders, tmpDevvr);
+    if ( profileH263 )
+        {
+        // encoder exists => add to the list
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 profile 0 and default level found"))); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263BaselineProfile );
+        }
+
+    // check what levels are specified in the codec's registration file
+    TBool levelsH263 = EFalse;
+
+
+    TBuf8<256> h263mime;
+    h263mime = KCMRMimeTypeH263BaselineProfile;
+    TBuf8<256> h263string;
+    TPtrC8 levels[KCMRNumSupportedH263Levels] = KCMRH263Levels;
+
+    // First a special case, we have '*' after profile; assume it means any level is supported
+    h263string = h263mime;
+    h263string += _L8("*");
+    levelsH263 = CheckIfSupportedL( (const TDes8&)h263string, encoders, tmpDevvr);
+    if ( levelsH263 )
+        {
+        // found, all the levels we support are supported also by the encoder
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 profile 0 and all levels found"))); 
+        h263mime += _L8("; level=");
+        TInt j;
+        for ( j = 0; j < KCMRNumSupportedH263Levels; j++ )
+            {
+            // encoder exists => add to the list
+            h263string = h263mime;
+            h263string += levels[j];
+            iVideoMimeTypes->AppendL( h263string );
+            }
+        }
+    else
+        {
+        // go through the levels
+        h263mime += _L8("; level=");
+        TInt i;
+
+        for ( i = 0; i < KCMRNumSupportedH263Levels; i++ )
+            {
+            h263string = h263mime;
+            h263string += levels[i];
+            levelsH263 = CheckIfSupportedL( (const TDes8&)h263string, encoders, tmpDevvr);
+            if ( levelsH263 )
+                {
+                // found, all the levels below this one are supported
+                PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 profile 0 and level from level-array at position %d found"), i )); 
+                TInt j;
+                for ( j = i; j < KCMRNumSupportedH263Levels; j++ )
+                    {
+                    // encoder exists => add to the list
+                    h263string = h263mime;
+                    h263string += levels[j];
+                    iVideoMimeTypes->AppendL( h263string );
+                    }
+                // done, also the levels below this one were already listed
+                break;
+                }
+            }
+        }
+
+    // complement the list with variants of the default, need depends on how plugins were registered & what client is asking
+    if ( (!defH263) && ( profileH263 || levelsH263 ) )
+        {
+        // no short version (default) registered, add also it to the list
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263 ); 
+        }
+    if ( (!profileH263) && (defH263 || levelsH263) )
+        {
+        // add also version with details of the default profile
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263BaselineProfile ); 
+        }
+    if ( (!levelsH263) && (defH263 || profileH263) )
+        {
+        // add also version with details of the default profile & level
+        h263string = h263mime;
+        h263string += _L8("; level=10");
+        iVideoMimeTypes->AppendL( h263string ); 
+        }
+
+
+    CleanupStack::PopAndDestroy( &encoders ); // calls also encoders.Close()
+    CleanupStack::PopAndDestroy( tmpDevvr ); 
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoCodecsMPEG4.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,413 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for helper class to check supported video codecs,
+*                MPEG-4 variant
+*
+*/
+
+
+#include "CCMRVideoCodecs.h"
+#include "CCMRSupportedCodecs.h"
+#include "CCMRVideoSettings.h"
+#include <mmf/devvideo/devvideorecord.h>
+
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+// ================= LOCAL FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CheckIfSupported
+// Helper function to check if mimetype x is supported in 
+// the system
+// 
+// ---------------------------------------------------------
+//
+static TBool CheckIfSupportedL( const TDes8& aMimeType, RArray <TUid>& aEncoders, CMMFDevVideoRecord* aDevvr )
+    {
+    TBool r = EFalse;
+    TRAPD( err, aDevvr->FindEncodersL( aMimeType, 0, aEncoders, EFalse ));
+
+    if ( (err == KErrNone) && (aEncoders.Count() > 0) )
+        {
+        r = ETrue;
+        }
+    aEncoders.Reset();
+
+    return r;
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::NewL
+//
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoCodecs* CCMRVideoCodecs::NewL()
+    {
+    
+    CCMRVideoCodecs* self = new (ELeave) CCMRVideoCodecs;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::ConstructL
+//
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCodecs::ConstructL()
+    {
+    iVideoMimeTypes = new(ELeave) CDesC8ArrayFlat( 2 ); // 2 is the granularity of the array
+    // check what we support and have installed
+    GenerateListOfSupportedVideoCodecsL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::~CCMRVideoCodecs
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoCodecs::~CCMRVideoCodecs()
+    {
+    delete iVideoMimeTypes;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::GetSupportedVideoCodecsL
+// Get the supported & installed video codecs.
+// This can be called also when the recorder is not open
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCodecs::GetSupportedVideoCodecsL(CDesC8Array& aVideoMimeTypes) const
+    {
+    aVideoMimeTypes.Reset();
+
+    // copy from iVideoMimeTypes
+    TInt i;
+    for ( i = 0; i < iVideoMimeTypes->Count(); i++ )
+        {
+        aVideoMimeTypes.AppendL( iVideoMimeTypes->MdcaPoint(i) );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::DoWeSupportThisL
+// Check if the given codec is supported & installed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoCodecs::DoWeSupportThisL(const TDesC8& aMimeType) const
+    {
+    if ( aMimeType == KNullDesC8 )
+        {
+        // asking to use default codec; we should ensure that all classes use 
+        // the same default
+        TInt i;
+        for ( i = 0; i < iVideoMimeTypes->Count(); i++ )
+            {
+            if ( iVideoMimeTypes->MdcaPoint(i) == KCMRMimeTypeH263BaselineProfile )
+                {
+                PRINT((_L("CCMRVideoCodecs::DoWeSupportThisL() - Null codec was given and checked that we support it"))); 
+                return ETrue;
+                }
+            }
+        }
+    else
+        {
+        TInt i;
+        for ( i = 0; i < iVideoMimeTypes->Count(); i++ )
+            {
+            if ( iVideoMimeTypes->MdcaPoint(i) == aMimeType )
+                {
+                PRINT((_L("CCMRVideoCodecs::DoWeSupportThisL() - a MIME-type was given and checked that we support it") )); 
+                return ETrue;
+                }
+            }
+        }
+    PRINT((_L("CCMRVideoCodecs::DoWeSupportThisL() - given MIME-type is not supported") )); 
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL
+// Generate list of supported & installed video codecs.
+// Called internally in the construction
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL()
+    {
+    MMMFDevVideoRecordObserver* nullObserver = NULL;
+    CMMFDevVideoRecord* tmpDevvr = NULL;
+    tmpDevvr = CMMFDevVideoRecord::NewL( *nullObserver );   //NULL should be acceptable since we are not creating any HW devices here
+    CleanupStack::PushL( tmpDevvr );
+
+    RArray <TUid> encoders;
+    CleanupClosePushL( encoders );
+
+    iVideoMimeTypes->Reset();
+
+    // check that each supported encoder also exists in the system
+    // H.263 with default profile & level (profile 0; duplicate of the next item).
+    TBool defH263 = CheckIfSupportedL( (const TDes8&)KCMRMimeTypeH263, encoders, tmpDevvr);
+    if ( defH263 )
+        {
+        // encoder exists => add to the list
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 default parameters found"))); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263 );
+        }
+    // profile 0
+    TBool profileH263 = CheckIfSupportedL( (const TDes8&)KCMRMimeTypeH263BaselineProfile, encoders, tmpDevvr);
+    if ( profileH263 )
+        {
+        // encoder exists => add to the list
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 profile 0 and default level found"))); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263BaselineProfile );
+        }
+
+    // check what levels are specified in the codec's registration file
+    TBool levelsH263 = EFalse;
+
+    TBuf8<256> h263mime;
+    h263mime = KCMRMimeTypeH263BaselineProfile;
+    TBuf8<256> h263string;
+    TPtrC8 levels[KCMRNumSupportedH263Levels] = KCMRH263Levels;
+
+    // First a special case, we have '*' after profile; assume it means any level is supported
+    h263string = h263mime;
+    h263string += _L8("*");
+    levelsH263 = CheckIfSupportedL( (const TDes8&)h263string, encoders, tmpDevvr);
+    if ( levelsH263 )
+        {
+        // found, all the levels we support are supported also by the encoder
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 profile 0 and all levels found"))); 
+        h263mime += _L8("; level=");
+        TInt j;
+        for ( j = 0; j < KCMRNumSupportedH263Levels; j++ )
+            {
+            // encoder exists => add to the list
+            h263string = h263mime;
+            h263string += levels[j];
+            iVideoMimeTypes->AppendL( h263string );
+            }
+        }
+    else
+        {
+        // go through the levels
+        h263mime += _L8("; level=");
+        TInt i;
+
+        for ( i = 0; i < KCMRNumSupportedH263Levels; i++ )
+            {
+            h263string = h263mime;
+            h263string += levels[i];
+            levelsH263 = CheckIfSupportedL( (const TDes8&)h263string, encoders, tmpDevvr);
+            if ( levelsH263 )
+                {
+                // found, all the levels below this one are supported
+                PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.263 profile 0 and level from level-array at position %d found"), i )); 
+                TInt j;
+                for ( j = i; j < KCMRNumSupportedH263Levels; j++ )
+                    {
+                    // encoder exists => add to the list
+                    h263string = h263mime;
+                    h263string += levels[j];
+                    iVideoMimeTypes->AppendL( h263string );
+                    }
+                // done, also the levels below this one were already listed
+                break;
+                }
+            }
+        }
+
+    // complement the list with variants of the default, need depends on how plugins were registered & what client is asking
+    if ( (!defH263) && ( profileH263 || levelsH263 ) )
+        {
+        // no short version (default) registered, add also it to the list
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263 ); 
+        }
+    if ( (!profileH263) && (defH263 || levelsH263) )
+        {
+        // add also version with details of the default profile
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH263BaselineProfile ); 
+        }
+    if ( (!levelsH263) && (defH263 || profileH263) )
+        {
+        // add also version with details of the default profile & level
+        h263string = h263mime;
+        h263string += _L8("; level=10");
+        iVideoMimeTypes->AppendL( h263string ); 
+        }
+
+    // MPEG-4
+    TBool defMPEG4 = CheckIfSupportedL( (const TDes8&)KCMRMimeTypeMPEG4V, encoders, tmpDevvr);
+    if ( defMPEG4 )
+        {
+        // encoder exists => add to the list
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with MPEG4 default parameters found"))); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeMPEG4V );
+        }
+
+    TBool levelsMPEG4 = EFalse;
+
+    TInt i;
+    TPtrC8 mlevels[KCMRNumSupportedMPEG4ProfileLevels] = KCMRMPEG4Levels;
+    // First a special case, we have '*' after profile; assume it means any level is supported
+    TBuf8<256> mpeg4mime;
+    TBuf8<256> mpeg4string;
+    mpeg4mime = KCMRMimeTypeMPEG4VSP;
+    mpeg4string = mpeg4mime;
+    mpeg4string += _L8("*");
+    levelsMPEG4 = CheckIfSupportedL( (const TDes8&)mpeg4string, encoders, tmpDevvr);
+    if ( levelsMPEG4 )
+        {
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with MPEG4 all profile-level-id's found"))); 
+        TInt j;
+        for ( j = 0; j < KCMRNumSupportedMPEG4ProfileLevels; j++ )
+            {
+            // encoder exists => add to the list
+            mpeg4string = mpeg4mime;
+            mpeg4string += mlevels[j];
+            iVideoMimeTypes->AppendL( mpeg4string );
+            }
+        }
+    else
+        {
+        // go through the levels
+        for ( i = 0; i < KCMRNumSupportedMPEG4ProfileLevels; i++ )
+            {
+            mpeg4string = mpeg4mime;
+            mpeg4string += mlevels[i];
+            levelsMPEG4 = CheckIfSupportedL( (const TDes8&)mpeg4string, encoders, tmpDevvr);
+            if ( levelsMPEG4 )
+                {
+                // found, all the levels below this one are supported
+                PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with MPEG4 profile-level-id from level-array at position %d found"), i )); 
+                TInt j;
+                for ( j = i; j < KCMRNumSupportedMPEG4ProfileLevels; j++ )
+                    {
+                    // encoder exists => add to the list
+                    mpeg4string = mpeg4mime;
+                    mpeg4string += mlevels[j];
+                    iVideoMimeTypes->AppendL( mpeg4string );
+                    }
+                // done, also the levels below this one were already listed
+                break;
+                }
+            }
+        }    
+
+    if ( (!defMPEG4) && levelsMPEG4 )
+        {
+        // no short version registered, only with profile-level-id, add also the short one
+        iVideoMimeTypes->AppendL( KCMRMimeTypeMPEG4V ); 
+        }
+    else if ( defMPEG4 && (!levelsMPEG4) )
+        {
+        // only short version registered, add also version with details of the default profile & level
+        iVideoMimeTypes->AppendL( KCMRMimeTypeMPEG4VSPL1 ); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeMPEG4VSPL0B );    // assuming level 1 implies support for 0b also; this is not clear from MPEG-4 specs
+        iVideoMimeTypes->AppendL( KCMRMimeTypeMPEG4VSPL0 ); 
+        }
+
+    // H.264 AVC
+    TBool defH264AVC = CheckIfSupportedL( (const TDes8&)KCMRMimeTypeH264AVC, encoders, tmpDevvr);
+    if ( defH264AVC )
+        {
+        // encoder exists => add to the list
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.264 AVC default parameters found"))); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH264AVC );
+        }
+
+    TBool levelsH264AVC = EFalse;
+    TPtrC8 h264avclevels[KCMRNumSupportedH264AVCProfileLevels] = KCMRH264AVCLevels;
+    // First a special case, we have '*' after profile; assume it means any level is supported
+    TBuf8<256> h264avcmime;
+    TBuf8<256> h264avcstring;
+    h264avcmime = KCMRMimeTypeH264AVCProfileId;
+    h264avcstring = h264avcmime;
+    h264avcstring += _L8("*");
+    levelsH264AVC = CheckIfSupportedL( (const TDes8&)h264avcstring, encoders, tmpDevvr);
+    if ( levelsH264AVC )
+        {
+        PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.264 AVC all profile-level-id's found"))); 
+        TInt j;
+        for ( j = 0; j < KCMRNumSupportedH264AVCProfileLevels; j++ )
+            {
+            // encoder exists => add to the list
+            h264avcstring = h264avcmime;
+            h264avcstring += h264avclevels[j];
+            iVideoMimeTypes->AppendL( h264avcstring );
+            }
+        }
+    else
+        {
+        // go through the levels
+        for ( i = 0; i < KCMRNumSupportedH264AVCProfileLevels; i++ )
+            {
+            h264avcstring = h264avcmime;
+            h264avcstring += h264avclevels[i];
+            levelsH264AVC = CheckIfSupportedL( (const TDes8&)h264avcstring, encoders, tmpDevvr);
+            if ( levelsH264AVC )
+                {
+                // found, all the levels below this one are supported
+                PRINT((_L("CCMRVideoCodecs::GenerateListOfSupportedVideoCodecsL() - a codec with H.264 AVC profile-level-id from level-array at position %d found"), i )); 
+                TInt j;
+                for ( j = i; j < KCMRNumSupportedH264AVCProfileLevels; j++ )
+                    {
+                    // encoder exists => add to the list
+            		h264avcstring = h264avcmime;
+            		h264avcstring += h264avclevels[j];
+                    iVideoMimeTypes->AppendL( h264avcstring );
+                    }
+                // done, also the levels below this one were already listed
+                break;
+                }
+            }
+        }    
+
+    if ( (!defH264AVC) && levelsH264AVC )
+        {
+        // no short version registered, only with profile-level-id, add also the short one
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH264AVC ); 
+        }
+    else if ( defH264AVC && (!levelsH264AVC) )
+        {
+        // only short version registered, add also version with details of the default profile & level
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH264AVCBPL10 ); 
+        iVideoMimeTypes->AppendL( KCMRMimeTypeH264AVCBPL10b );
+        }
+
+    CleanupStack::PopAndDestroy( &encoders ); // calls also encoders.Close()
+    CleanupStack::PopAndDestroy( tmpDevvr ); 
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoRecorderClient.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,642 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for video recorder client class
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCMRRecorderBase.h"
+#include "CCMRVideoSettings.h"  // default video settings
+#include "CCMRSupportedCodecs.h"
+#include "CCMRVideoRecorderClient.h"
+#include "CCMRVideoCodecs.h"
+
+#include <mmf/common/mmfvideo.h>
+#include <badesca.h>
+
+// Assertion macro wrapper for code cleanup
+#define VRCASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CCMRVIDEORECORDER"), EInternalAssertionFailure)) 
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::NewL
+// Standard Symbian OS two-phased constructor
+// Returns: CCMRVideoRecorderClient*: Pointer to the newly-created 
+//                              video recorder
+// ---------------------------------------------------------
+//
+CCMRVideoRecorderClient* CCMRVideoRecorderClient::NewL()
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::NewL()"))); 
+
+    CCMRVideoRecorderClient* self = new (ELeave) CCMRVideoRecorderClient;    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;    
+
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::ConstructL()
+// Symbian OS Constructor
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::ConstructL()
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::ConstructL()")));    
+
+    iVideoCodecs = CCMRVideoCodecs::NewL();
+
+    SetState(EStateNone);
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::~CCMRVideoRecorderClient()
+// Destructor
+// ---------------------------------------------------------
+//
+CCMRVideoRecorderClient::~CCMRVideoRecorderClient()
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::~CCMRVideoRecorderClient() in")));
+
+    // This is the counterpart to NewL & OpenL, e.g. Close & Delete
+
+    // free all memory allocated and uninitalize & delete objects created
+
+    delete iThreadEventMonitor;
+    iThreadEventMonitor = NULL;
+    // close thread
+    if ( iThreadCreated )
+        {
+        iThreadProxy.Close();
+        }
+
+    delete iVideoCodecs;
+    iVideoCodecs = NULL;
+
+    iObserver = NULL;
+
+    SetState(EStateNone);
+
+    // enable for RTRT code coverage
+    //#pragma attol insert _ATCPQ_DUMP(0);
+    PRINT((_L("CCMRVideoRecorderClient::~CCMRVideoRecorderClient() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::OpenL
+// Opens the video recorder instance, creates submodules
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::OpenL(MCMRVideoRecorderObserver* aObserver, 
+                              CCMRActiveOutput* aOutput,
+                              TInt aCameraHandle, 
+                              const TDesC8& aVideoMimeType,
+                              MMMFClockSource* aClockSource,
+                              CCMRConfigManager* aConfig  )
+    {
+    PRINT((_L("CCMRVideoRecorderClient::OpenL()")));
+
+    if ( State() != EStateNone ) 
+        {
+        PRINT((_L("CCMRVideoRecorderClient::OpenL() already exists")));
+        User::Leave( KErrAlreadyExists );
+        }
+
+    User::LeaveIfError(iThreadProxy.CreateSubThread(iThreadCreated, aConfig));
+
+    iThreadEventMonitor = CCMRSubThreadEventMonitor::NewL(*this, iThreadProxy); 
+    iThreadEventMonitor->Start();
+
+    VRCASSERT( aObserver );
+    iObserver = aObserver;
+
+    // set output AO to thread
+    VRCASSERT( aOutput );
+    User::LeaveIfError(iThreadProxy.SetOutput( aOutput ));
+    
+    // set clocksource
+    User::LeaveIfError(iThreadProxy.SetClockSource( aClockSource));
+
+    // set camera handle to thread
+    User::LeaveIfError(iThreadProxy.SetCameraHandle( aCameraHandle ));
+
+    // check that it is supported
+    if ( iVideoCodecs->DoWeSupportThisL( aVideoMimeType ) )
+        {
+        User::LeaveIfError(iThreadProxy.SetCodec( aVideoMimeType ));
+        //Event is signaled if state change is needed
+        }
+    else
+        {
+        // codec doesn't exist in the system
+        PRINT((_L("CCMRVideoRecorderClient::OpenL() unsupported codec")));
+        User::Leave( KErrNotSupported );
+        }
+
+    SetState(EStateOpen);
+    iObserver->MvroStateChange( State() );
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::PrepareL
+// Prepares the recorder for recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::PrepareL()
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::PrepareL() in")));
+
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    SetState(EStatePreparing);
+    // prepare thread
+    User::LeaveIfError(iThreadProxy.Prepare());
+
+                              
+    PRINT((_L("CCMRVideoRecorderClient::PrepareL() out")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::RecordL
+// Starts recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::RecordL()
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::Record()           ")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    // start recording
+    User::LeaveIfError(iThreadProxy.Record());
+
+    SetState(EStateRecording);
+    PRINT((_L("CCMRVideoRecorderClient::Record() complete           ")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::StopL
+// Stops recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::StopL()
+    {
+    PRINT((_L("CCMRVideoRecorderClient::Stop() in")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+            
+    SetState(EStateStopping);
+    // Stop thread
+    User::LeaveIfError(iThreadProxy.Stop());
+    PRINT((_L("CCMRVideoRecorderClient::Stop() out, must wait for state change before stop completed")));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::RequestBuffersAndWaitEOSL
+// Waits until video thread stops recording and receives EOS (end of stream) marker
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::RequestBuffersAndWaitEOSL(TInt& aVideoEOSReached)
+    {
+    PRINT((_L("CCMRVideoRecorderClient::RequestBuffersAndWaitEOSL() in")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+            
+    User::LeaveIfError(iThreadProxy.RequestBuffersAndWaitEOSL(aVideoEOSReached));
+    PRINT((_L("CCMRVideoRecorderClient::RequestBuffersAndWaitEOSL() out, stop completed")));
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::PauseL
+// Pauses recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::PauseL()
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::Pause() in")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    // pause thread
+    User::LeaveIfError(iThreadProxy.Pause());
+    
+    SetState(EStatePaused);
+               
+    PRINT((_L("CCMRVideoRecorderClient::Pause() out")));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::ResumeL
+// Resumes recording
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::ResumeL()
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::Resume() in")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    // resume thread
+    User::LeaveIfError(iThreadProxy.Resume());
+
+    SetState(EStateRecording);
+    PRINT((_L("CCMRVideoRecorderClient::Resume() out")));
+
+    }
+
+
+
+// Setters & Getters
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorderClient::SetVideoCodecL
+// Set video codec.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetVideoCodecL(const TDesC8& aMimeType) const
+    {
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    // check that it is supported
+    if ( iVideoCodecs->DoWeSupportThisL( aMimeType ) )
+        {
+        User::LeaveIfError(iThreadProxy.SetCodec( aMimeType ));
+        //Event is signaled if state change is needed
+        }
+    else
+        {
+        // codec doesn't exist in the system
+        PRINT((_L("CCMRVideoRecorderClient::OpenL() unsupported codec")));
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorderClient::GetVideoCodecL
+// Get the used video codec.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorderClient::GetVideoCodecL( TDes8& aVideoMimeType ) const
+    {
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    User::LeaveIfError(iThreadProxy.GetCodec( aVideoMimeType ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoRecorderClient::GetSupportedVideoCodecsL
+// Get list of supported video codecs.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoRecorderClient::GetSupportedVideoCodecsL( CDesC8Array& aVideoMimeTypes ) const
+    {
+    if ( iVideoCodecs )
+        {
+        iVideoCodecs->GetSupportedVideoCodecsL( aVideoMimeTypes );
+        }
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetTargetBitRateL
+// Sets new target bitrate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetTargetBitRateL(TInt aBitRate) 
+    {
+    PRINT((_L("CCMRVideoRecorderClient::SetTargetBitRate, aBitrate = % d"),aBitRate));
+
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    User::LeaveIfError(iThreadProxy.SetBitRate( aBitRate ));
+
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::TargetBitrateL
+// Gets current target bitrate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::TargetBitRateL(TInt& aBitRate)
+    {
+    PRINT((_L("CCMRVideoRecorderClient::TargetBitRate")));
+
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    User::LeaveIfError(iThreadProxy.GetBitRate(aBitRate));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetFrameSizeL
+// Sets new input & output frame size
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetFrameSizeL(const TSize& aSize) const
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::SetFrameSize")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+    
+
+    User::LeaveIfError(iThreadProxy.SetFrameSize( aSize ));
+    //Event is signaled if state change is needed
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::FrameSizeL
+// Gets current frame size
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::FrameSizeL(TSize& aSize) const
+    {
+    PRINT((_L("CCMRVideoRecorderClient::FrameSizeL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+                
+    User::LeaveIfError(iThreadProxy.GetFrameSize( aSize )); 
+                
+    }
+
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetFrameRateL
+// Sets new target frame rate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetFrameRateL(TReal32 aFrameRate) const
+    {
+
+    PRINT((_L("CCMRVideoRecorderClient::SetFrameRate")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+
+    User::LeaveIfError(iThreadProxy.SetFrameRate( aFrameRate ));
+
+    //Event is signaled if state change is needed
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::FrameRateL
+// Get the used encoding frame rate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::FrameRateL(TReal32& aFrameRate) const
+    {
+    PRINT((_L("CCMRVideoRecorderClient::FrameRateL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+                
+    User::LeaveIfError(iThreadProxy.GetFrameRate(aFrameRate));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetVideoCodingOptionsL
+// Set misc video coding options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions) const
+    {
+    PRINT((_L("CCMRVideoRecorderClient::SetVideoCodingOptionsL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    User::LeaveIfError(iThreadProxy.SetMiscOptions(aOptions));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetVideoRateControlOptionsL
+// Set video rate control options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetVideoRateControlOptionsL(const TRateControlOptions& aOptions) const
+    {
+    PRINT((_L("CCMRVideoRecorderClient::SetVideoRateControlOptionsL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    User::LeaveIfError(iThreadProxy.SetVideoRateControlOptions(aOptions));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::GetVideoRateControlOptionsL
+// Get video rate control options
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::GetVideoRateControlOptionsL(TRateControlOptions& aOptions) const
+    {
+    PRINT((_L("CCMRVideoRecorderClient::GetVideoRateControlOptionsL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+
+    User::LeaveIfError( iThreadProxy.GetVideoRateControlOptions(aOptions) );
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetPreferredVideoEncoderL
+// Set video encoder using its UID. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetPreferredVideoEncoderL(TUid& aEncoder)
+    {
+    PRINT((_L("CCMRVideoRecorderClient::SetPreferredVideoEncoderL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+    User::LeaveIfError(iThreadProxy.SetPreferredVideoEncoder(aEncoder));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetPreferredVideoEncapsulationL
+// Set video encoder output format encapsulation. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation)
+    {
+    PRINT((_L("CCMRVideoRecorderClient::SetPreferredVideoEncapsulationL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+    User::LeaveIfError(iThreadProxy.SetPreferredVideoEncapsulation(aCapsulation));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetSegmentTargetSizeL
+// Set video encoder target segment size. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetSegmentTargetSizeL(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks )
+    {
+    PRINT((_L("CCMRVideoRecorderClient::SetSegmentTargetSizeL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+    User::LeaveIfError(iThreadProxy.SetSegmentTargetSize(aLayer, aSizeBytes, aSizeMacroblocks));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::AdjustTimeStampsL
+// Adjust time stamps of video
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::AdjustTimeStampsL(const TInt aAdjustmentMs) const
+    {
+    PRINT((_L("CCMRVideoRecorderClient::AdjustTimeStampsL()")));
+    // other state checks handled in the thread, but in this state there is no thread
+    VRCASSERT( State() != EStateNone );
+                
+    User::LeaveIfError(iThreadProxy.AdjustTimeStamps(aAdjustmentMs));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::SetThreadPriorityL
+// Set video thread priority, based on audio thread priority
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::SetThreadPriorityL(const TThreadPriority& aAudioThreadPriority) const
+    {
+    User::LeaveIfError(iThreadProxy.SetThreadPriority( aAudioThreadPriority ));
+    }
+
+// ---------------------------------------------------------
+// CCMRVideoRecorderClient::HandleEvent
+// Handle events from video recorder thread
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCMRVideoRecorderClient::HandleEvent(const TMMFEvent& aEvent)
+    {
+    PRINT((_L("CCMRVideoRecorderClient::HandleEvent(), aEvent.iEventType %d"),aEvent.iEventType.iUid));
+    // note: can't use switch here since it can't compare Uids
+    if ( aEvent.iEventType == KCMRCameraPrepareError )
+        {
+        SetState( EStateOpen );// no need to call state change
+        iObserver->MvroError( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KCMRCameraReserveError )
+        {
+        SetState( EStateOpen );// no need to call state change
+        iObserver->MvroError( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KCMRCameraCaptureError )
+        {
+        // assume the client will stop us
+        iObserver->MvroError( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KCMREncoderInitError )
+        {
+        SetState( EStateOpen );// no need to call state change
+        iObserver->MvroError( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KCMRRunTimeError )
+        {
+        // assume the client will stop us
+        iObserver->MvroError( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KCMRPrepareComplete )
+        {
+        SetState( EStateReadyToRecord );
+        iObserver->MvroStateChange( EStateReadyToRecord );
+        }
+    else if ( aEvent.iEventType == KCMRRecordingComplete )
+        {
+        SetState( EStateReadyToRecord );
+        iObserver->MvroStateChange( EStateReadyToRecord );
+        }
+    else if ( aEvent.iEventType == KCMRPrepareNeeded )
+        {
+        if ( State() == EStateReadyToRecord )
+            {
+            SetState( EStateOpen );
+            iObserver->MvroStateChange( EStateOpen );
+            }
+        }
+    else if ( aEvent.iErrorCode == KErrServerTerminated )
+        {
+        // thread was terminated, can't use it any more
+        SetState( EStateNone );
+        iObserver->MvroStateChange( EStateNone );
+        iObserver->MvroError( aEvent.iErrorCode );
+        }
+    else
+        {
+        // something unknown, perhaps from the system
+        PRINT((_L("CCMRVideoRecorderClient::HandleEvent() unknown event")));
+        iObserver->MvroError( aEvent.iErrorCode );
+        }
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoThreadProxy.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video thread proxy
+*
+*/
+
+
+// INCLUDES
+#include "CCMRVideoThreadProxy.h"
+#include "CCMRVideoThreadProxyServer.h"
+#include "CCMRVideoSettings.h"
+#include "CCMRMediaRecorder.h"  // for TCCMRVideoCodingOptions
+#include "CCMRThreadPriorities.h"
+#include <e32math.h>
+
+// MACROS
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+#define KCMRVideoThreadProxyVersion TVersion(1,0,0)
+
+
+
+// ========================= RCMRVideoThreadProxy MEMBER FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::CreateSubThread
+// Create thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::CreateSubThread(TBool& aThreadCreated, CCMRConfigManager* aConfig )
+    {
+    PRINT((_L("RCMRVideoThreadProxy::CreateSubThread() in")));
+
+    //start the subthread with no name & create session
+    TInt error = DoCreateSubThread(&CCMRVideoThreadProxyServer::StartThread, KCMRVideoThreadProxyVersion, aThreadCreated);
+    if (error)
+        {
+        return error;
+        }
+    iSessionCreated = ETrue;
+
+    // load video recorder
+    error = SendReceive( ECMRVideoThreadLoadVideoRecorder, TIpcArgs(aConfig) );
+    if (error)
+        {
+        return error;
+        }
+    // set thread id
+    TUint threadID = RThread().Id();
+    error = SendReceive( ECMRVideoThreadSetOutputThreadId, TIpcArgs(threadID) );
+
+
+    PRINT((_L("RCMRVideoThreadProxy::CreateSubThread() out")));
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetCameraHandle
+// Set camera handle
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetCameraHandle(TInt aCameraHandle) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetCameraHandle()")));
+    return SendReceive( ECMRVideoThreadSetCameraHandle, TIpcArgs(aCameraHandle ));
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetOutput
+// Set output active object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetOutput(CCMRActiveOutput* aOutput) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetOutput()")));
+    return SendReceive( ECMRVideoThreadSetOutput, TIpcArgs(aOutput) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetClockSource
+// Set clock source
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetClockSource(MMMFClockSource* aClockSource) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetClockSource()")));
+    return SendReceive( ECMRVideoThreadSetClockSource, TIpcArgs(aClockSource) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetBitRate
+// Set target bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetBitRate(TInt aBitRate) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetBitRate()")));
+    return SendReceive( ECMRVideoThreadSetBitRate, TIpcArgs(aBitRate) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::GetBitRate
+// Get current target bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::GetBitRate(TInt& aBitRate) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::GetBitRate()")));
+    return SendReceive( ECMRVideoThreadGetBitRate, TIpcArgs(&aBitRate) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetFrameSize
+// Set video frame size (width&height)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetFrameSize(const TSize& aSize) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetFrameSize()")));
+    return SendReceive( ECMRVideoThreadSetFrameSize, TIpcArgs(&aSize) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::GetFrameSize
+// Get current video frame size (width&height)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::GetFrameSize(TSize& aSize) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::GetFrameSize()")));
+    return SendReceive( ECMRVideoThreadGetFrameSize, TIpcArgs(&aSize) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetFrameRate
+// Set video framerate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetFrameRate(TReal32 aFrameRate) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetFrameRate()")));
+    return SendReceive( ECMRVideoThreadSetFrameRate, TIpcArgs(&aFrameRate) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::GetFrameRate
+// Get current video framerate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::GetFrameRate(TReal32& aFrameRate) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::GetFrameRate()")));
+    return SendReceive( ECMRVideoThreadGetFrameRate, TIpcArgs(&aFrameRate) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetCodec
+// Set video codec MIME-type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetCodec(const TDesC8& aMimeType) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetCodec()")));
+    return SendReceive( ECMRVideoThreadSetCodec, TIpcArgs(&aMimeType) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::GetCodec
+// Get current video codec MIME-type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::GetCodec(TDes8& aMimeType) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::GetCodec()")));
+    return SendReceive( ECMRVideoThreadGetCodec, TIpcArgs(&aMimeType) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetMiscOptions
+// Set video options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetMiscOptions(const TCCMRVideoCodingOptions& aOptions) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetMiscOptions()")));
+    return SendReceive( ECMRVideoThreadSetMiscOptions, TIpcArgs(&aOptions) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetVideoRateControlOptions
+// Set video rate control options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetVideoRateControlOptions(const TRateControlOptions& aOptions) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetVideoRateControlOptions()")));
+    return SendReceive( ECMRVideoThreadSetVideoRateControlOptions, TIpcArgs(&aOptions) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::GetVideoRateControlOptions
+// Get video rate control options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::GetVideoRateControlOptions(TRateControlOptions& aOptions) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::GetVideoRateControlOptions()")));
+    return SendReceive( ECMRVideoThreadGetVideoRateControlOptions, TIpcArgs(&aOptions) );
+    }
+
+// ---------------------------------------------------------
+// RCMRVideoThreadProxy::SetPreferredVideoEncoderL
+// Set video encoder using its UID. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetPreferredVideoEncoder(TUid& aEncoder)
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetPreferredVideoEncoder()")));
+    return SendReceive( ECMRVideoThreadSetPreferredVideoEncoder, TIpcArgs(&aEncoder) );
+    }
+
+// ---------------------------------------------------------
+// RCMRVideoThreadProxy::SetPreferredVideoEncapsulationL
+// Set video encoder output format encapsulation. Usage optional.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetPreferredVideoEncapsulation(TVideoDataUnitEncapsulation aCapsulation)
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetPreferredVideoEncapsulation()")));
+    return SendReceive( ECMRVideoThreadSetPreferredVideoEncapsulation, TIpcArgs(&aCapsulation) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetSegmentTargetSizeL
+// Set video segment size. Usage optional.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool RCMRVideoThreadProxy::SetSegmentTargetSize(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks )
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetSegmentTargetSize()")));
+    return SendReceive( ECMRVideoThreadSetSegmentTargetSize, TIpcArgs(aLayer, aSizeBytes, aSizeMacroblocks) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::AdjustTimeStamps
+// Adjust video time stamps (+ or -)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::AdjustTimeStamps(const TInt aAdjustmentMs) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::AdjustTimeStamps()")));
+    return SendReceive( ECMRVideoThreadAdjustTimeStamps, TIpcArgs(aAdjustmentMs ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::SetThreadPriority
+// Set video thread priority based on audio thread priority, video frame size, and
+// defined constants
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::SetThreadPriority(const TThreadPriority& audioThreadPriority) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::SetThreadPriority()")));
+    if ( audioThreadPriority > EPriorityNormal )
+        {
+        // audio is already having a higher priority, can't raise video above normal
+        iSubThread.SetPriority(KCMRVideoThreadPriorityNormal);
+        PRINT((_L("RCMRVideoThreadProxy::SetThreadPriority() set priority to %d since audio thread had a higher priority"), KCMRVideoThreadPriorityNormal));
+        }
+    else
+        {
+        TSize frameSize;
+        TInt err = GetFrameSize( frameSize );
+
+        if ( err != KErrNone )
+            {
+            PRINT((_L("RCMRVideoThreadProxy::SetThreadPriority() getting frame size failed")));
+            return err;
+            }
+
+        if ( frameSize.iWidth > KCMRQCIFWidth )
+            {
+            // consider resolutions higher than QCIF as high performance which may require 
+            // different thread priority. Please check the defined video and audio thread 
+            // priorities in CCMRThreadPriorities.h
+            // Having both video and audio as high priority may not make sense; in some
+            // cases audio must have higher, and in some cases video, sometimes it doesn't matter
+            iSubThread.SetPriority(KCMRVideoThreadPriorityHighPerf);
+            PRINT((_L("RCMRVideoThreadProxy::SetThreadPriority() set priority to %d since video resolution is high"), KCMRVideoThreadPriorityHighPerf));
+            }
+        else
+            {
+            // normal performance
+            iSubThread.SetPriority(KCMRVideoThreadPriorityNormal);
+            PRINT((_L("RCMRVideoThreadProxy::SetThreadPriority() set priority to %d since video resolution is low"), KCMRVideoThreadPriorityNormal));
+            }
+        }
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::Prepare
+// Prepare for recording (freeze settings)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::Prepare() const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::Prepare()")));
+    return SendReceive(ECMRVideoThreadPrepare);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::Record
+// Start recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::Record() const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::Record()")));
+    return SendReceive(ECMRVideoThreadRecord);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::Stop
+// Stop video recorder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::Stop() const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::Stop()")));
+    return SendReceive(ECMRVideoThreadStop);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::RequestBuffersAndWaitEOSL
+// Wait until video recorder is stopped and receives EOS marker
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::RequestBuffersAndWaitEOSL(TInt& aVideoEOSReached) const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::RequestBuffersAndWaitEOSL()")));
+    return SendReceive( ECMRVideoRequestBuffersAndThreadWaitEOS, TIpcArgs(&aVideoEOSReached) );
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::Pause
+// Pause video recorder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::Pause() const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::Pause()")));
+    return SendReceive(ECMRVideoThreadPause);
+    }
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::Resume
+// Resume video recorder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCMRVideoThreadProxy::Resume() const
+    {
+    PRINT((_L("RCMRVideoThreadProxy::Resume()")));
+    return SendReceive(ECMRVideoThreadResume);
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCMRVideoThreadProxy::Close
+// Close thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCMRVideoThreadProxy::Close()
+    {
+    PRINT((_L("RCMRVideoThreadProxy::Close() in")));
+    Shutdown();
+    PRINT((_L("RCMRVideoThreadProxy::Close() out")));
+    }
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoThreadProxyServer.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video thread proxy server 
+*
+*/
+
+
+// INCLUDES
+#include "CCMRVideoThreadProxyServer.h"
+#include "CCMRVideoThreadProxySession.h"
+
+#include <ecom/ecom.h>
+
+// MACROS
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+
+
+
+
+
+// ====================== CCMRVideoThreadProxyServer MEMBER FUNCTIONS =======================
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxyServer::CCMRVideoThreadProxyServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoThreadProxyServer::CCMRVideoThreadProxyServer(TInt aPriority) :
+    CCMRThreadProxyServer(aPriority)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxyServer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoThreadProxyServer* CCMRVideoThreadProxyServer::NewL(RServer2* aServer2)
+    {
+    CCMRVideoThreadProxyServer* self = new(ELeave) CCMRVideoThreadProxyServer(EPriorityHigh);
+    CleanupStack::PushL(self);
+    self->ConstructL(aServer2);
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxyServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoThreadProxyServer::ConstructL(RServer2* aServer2)
+    {
+    //just need to call baseclass's constructL here
+    CCMRThreadProxyServer::ConstructL(aServer2);
+    }
+
+// destructor
+CCMRVideoThreadProxyServer::~CCMRVideoThreadProxyServer()
+    {
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxyServer::NewSessionL
+// Create new session
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSession2* CCMRVideoThreadProxyServer::NewSessionL(const TVersion& /*aVersion*/, const RMessage2& /*aMessage*/) const
+    {
+    return CCMRVideoThreadProxySession::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxyServer::StartThread
+// Start server thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoThreadProxyServer::StartThread(TAny* aParam)
+    {
+    PRINT((_L("CCMRVideoThreadProxyServer::StartThread() in")));
+    TInt err = KErrNone;
+    //create cleanupstack
+    CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
+    if (!cleanup)
+        {
+        err = KErrNoMemory;
+        }
+    if (!err)
+        {
+        TRAP(err, DoStartThreadL(aParam));
+        }
+    delete cleanup;
+    PRINT((_L("CCMRVideoThreadProxyServer::StartThread() out")));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxyServer::DoStartThreadL
+// Start server thread
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoThreadProxyServer::DoStartThreadL(TAny* aParam)
+    {
+    PRINT((_L("CCMRVideoThreadProxyServer::DoStartThread() in")));
+    // create and install the active scheduler we need
+    CActiveScheduler* self=new(ELeave) CActiveScheduler;
+    CleanupStack::PushL(self);
+    CActiveScheduler::Install(self);
+    // create the server (leave it on the cleanup stack)
+    CleanupStack::PushL(CCMRVideoThreadProxyServer::NewL(static_cast<RServer2*>(aParam)));
+    // Initialisation complete, now signal the client
+    RThread::Rendezvous(KErrNone);
+    // Ready to run
+    CActiveScheduler::Start();
+    // Cleanup the server and scheduler
+    CleanupStack::PopAndDestroy(2);
+
+	REComSession::FinalClose();
+
+    PRINT((_L("CCMRVideoThreadProxyServer::DoStartThread() out")));
+    }
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRVideoThreadProxySession.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,533 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Video thread proxy classes
+*
+*/
+
+//INCLUDES
+
+#include "CCMRVideoThreadProxySession.h"
+#include "CCMRMediaRecorder.h"  // for TCCMRVideoCodingOptions
+#include "CCMRVideoRecorder.h"
+
+
+// MACROS
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+// ====================== CCMRVideoThreadProxySession MEMBER FUNCTIONS =====================
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCMRVideoThreadProxySession* CCMRVideoThreadProxySession::NewL()
+    {
+    return new(ELeave) CCMRVideoThreadProxySession();
+    }
+
+// destructor
+CCMRVideoThreadProxySession::~CCMRVideoThreadProxySession()
+    {
+    PRINT((_L("CCMRVideoThreadProxySession::~CCMRVideoThreadProxySession() in")));
+    delete iRecorder;
+    PRINT((_L("CCMRVideoThreadProxySession::~CCMRVideoThreadProxySession() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::ServiceL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCMRVideoThreadProxySession::ServiceL(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRVideoThreadProxySession::ServiceL() in")));
+    TBool complete = EFalse;
+    switch(aMessage.Function())
+        {
+        case ECMRVideoThreadLoadVideoRecorder:
+            complete = LoadVideoRecorderL(aMessage);
+            break;
+        case ECMRVideoThreadSetCameraHandle:
+            complete = SetCameraHandleL(aMessage);
+            break;
+        case ECMRVideoThreadSetOutput:
+            complete = SetOutputL(aMessage);
+            break;
+        case ECMRVideoThreadSetClockSource:
+            complete = SetClockSource(aMessage);
+            break;
+        case ECMRVideoThreadSetOutputThreadId:
+            complete = SetOutputThreadIdL(aMessage);
+            break;
+        case ECMRVideoThreadSetBitRate:
+            complete = SetBitRateL(aMessage);
+            break;
+        case ECMRVideoThreadGetBitRate:
+            complete = GetBitRateL(aMessage);
+            break;
+        case ECMRVideoThreadSetFrameSize:
+            complete = SetFrameSizeL(aMessage);
+            break;
+        case ECMRVideoThreadGetFrameSize:
+            complete = GetFrameSizeL(aMessage);
+            break;
+        case ECMRVideoThreadSetFrameRate:
+            complete = SetFrameRateL(aMessage);
+            break;
+        case ECMRVideoThreadGetFrameRate:
+            complete = GetFrameRateL(aMessage);
+            break;
+        case ECMRVideoThreadSetCodec:
+            complete = SetCodecL(aMessage);
+            break;
+        case ECMRVideoThreadGetCodec:
+            complete = GetCodecL(aMessage);
+            break;
+        case ECMRVideoThreadSetMiscOptions:
+            complete = SetMiscOptionsL(aMessage);
+            break;
+        case ECMRVideoThreadSetVideoRateControlOptions:
+            complete = SetVideoRateControlOptionsL(aMessage);
+            break;
+        case ECMRVideoThreadGetVideoRateControlOptions:
+            complete = GetVideoRateControlOptionsL(aMessage);
+            break;
+        case ECMRVideoThreadSetPreferredVideoEncoder:
+            complete = SetPreferredVideoEncoderL(aMessage);
+            break;
+        case ECMRVideoThreadSetPreferredVideoEncapsulation:
+            complete = SetPreferredVideoEncapsulationL(aMessage);
+            break;
+        case ECMRVideoThreadSetSegmentTargetSize:
+            complete = SetSegmentTargetSizeL(aMessage);
+            break;            
+        case ECMRVideoThreadAdjustTimeStamps:
+            complete = AdjustTimeStampsL(aMessage);
+            break;
+        case ECMRVideoThreadPrepare:
+            complete = PrepareL();
+            break;
+        case ECMRVideoThreadRecord:
+            complete = RecordL();
+            break;
+        case ECMRVideoThreadStop:
+            complete = StopL();
+            break;
+        case ECMRVideoRequestBuffersAndThreadWaitEOS:
+            complete = RequestBuffersAndWaitEOSL(aMessage);
+            break;            
+        case ECMRVideoThreadPause:
+            complete = PauseL();
+            break;
+        case ECMRVideoThreadResume:
+            complete = ResumeL();
+            break;
+        case ECMRThreadReceiveEvents:
+            complete = ReceiveEventsL(aMessage);//provided by baseclass
+            break;
+        case ECMRThreadCancelReceiveEvents:
+            complete = CancelReceiveEvents();//provided by baseclass
+            break;
+        case ECMRThreadShutdown:
+            complete = ShutDown();//provided by baseclass
+            break;
+        default:
+            PRINT((_L("CCMRVideoThreadProxySession::ServiceL() unknown msg")));
+            User::Leave(KErrNotSupported);
+            break;
+        }
+
+    if (complete)
+        {
+        aMessage.Complete(KErrNone);
+        }
+
+    PRINT((_L("CCMRVideoThreadProxySession::ServiceL() out")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::LoadVideoRecorderL
+// Load (create) video recorder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::LoadVideoRecorderL(const RMessage2& aMessage)
+    {
+	CCMRConfigManager* config = reinterpret_cast<CCMRConfigManager*>(aMessage.Int0());    
+    iRecorder = CCMRVideoRecorder::NewL( *this, config);
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetCameraHandleL
+// Set camera handle
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetCameraHandleL(const RMessage2& aMessage)
+    {
+    TInt handle = aMessage.Int0();
+    iRecorder->SetCameraHandleL( handle );
+    return ETrue;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetOutputL
+// Set output active object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetOutputL(const RMessage2& aMessage)
+    {
+    CCMRActiveOutput* output = reinterpret_cast<CCMRActiveOutput*>(aMessage.Int0());
+    iRecorder->SetOutputL( output );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetClockSource
+// Set clock source
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetClockSource(const RMessage2& aMessage)
+    {
+    MMMFClockSource* clocksource = reinterpret_cast<MMMFClockSource*>(aMessage.Int0());
+    iRecorder->SetClockSource( clocksource );
+    return ETrue;
+    }    
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetOutputThreadIdL
+// Set thread id of the client & output active object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetOutputThreadIdL(const RMessage2& aMessage)
+    {
+    TUint id = (TUint)(aMessage.Int0());
+    iRecorder->SetOutputThreadIdL( id );
+    return ETrue;
+    }
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetBitRateL
+// Set target bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetBitRateL(const RMessage2& aMessage)
+    {
+    TInt rate = aMessage.Int0();
+    iRecorder->SetTargetBitRateL( rate );
+    return ETrue;
+    }
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::GetBitRateL
+// Get current target bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::GetBitRateL(const RMessage2& aMessage) const
+    {
+    TInt* rate = reinterpret_cast<TInt*>(aMessage.Int0());
+    iRecorder->TargetBitRateL(*rate);
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetFrameSizeL
+// Set video frame size (width&height)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetFrameSizeL(const RMessage2& aMessage)
+    {
+    TSize* size = reinterpret_cast<TSize*>(aMessage.Int0());
+    iRecorder->SetFrameSizeL( *size );
+    return ETrue;
+    }
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::GetFrameSizeL
+// Get current video frame size (width&height)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::GetFrameSizeL(const RMessage2& aMessage) const
+    {
+    TSize* size = reinterpret_cast<TSize*>(aMessage.Int0());
+    iRecorder->FrameSizeL( *size );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetFrameRateL
+// Set video framerate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetFrameRateL(const RMessage2& aMessage)
+    {
+    TReal32* rate = reinterpret_cast<TReal32*>(aMessage.Int0());
+    iRecorder->SetFrameRateL( *rate );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::GetFrameRateL
+// Get current video framerate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::GetFrameRateL(const RMessage2& aMessage) const
+    {
+    TReal32* rate = reinterpret_cast<TReal32*>(aMessage.Int0());
+    iRecorder->FrameRateL( *rate );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetCodecL
+// Set video codec MIME-type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetCodecL(const RMessage2& aMessage)
+    {
+    TDesC8* codec = reinterpret_cast<TDesC8*>(aMessage.Int0());
+    iRecorder->SetVideoCodecL( *codec );
+    return ETrue;
+    }
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::GetCodecL
+// Get current video codec MIME-type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::GetCodecL(const RMessage2& aMessage) const
+    {
+    TDes8* codec = reinterpret_cast<TDes8*>(aMessage.Int0());
+    iRecorder->GetVideoCodecL( *codec );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetMiscOptionsL
+// Set video options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetMiscOptionsL(const RMessage2& aMessage)
+    {
+    TCCMRVideoCodingOptions* options = reinterpret_cast<TCCMRVideoCodingOptions*>(aMessage.Int0());
+    iRecorder->SetVideoCodingOptionsL( *options );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetVideoRateControlOptionsL
+// Set video rate control options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetVideoRateControlOptionsL(const RMessage2& aMessage)
+    {
+    TRateControlOptions* options = reinterpret_cast<TRateControlOptions*>(aMessage.Int0());
+    iRecorder->SetVideoRateControlOptionsL( *options );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::GetVideoRateControlOptionsL
+// Get video rate control options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::GetVideoRateControlOptionsL(const RMessage2& aMessage) const
+    {
+    TRateControlOptions* options = reinterpret_cast<TRateControlOptions*>(aMessage.Int0());
+    iRecorder->GetVideoRateControlOptionsL( *options );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetPreferredVideoEncoderL
+// Set video encoder using its UID. Usage optional
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetPreferredVideoEncoderL(const RMessage2& aMessage)
+    {
+    TUid* uid = reinterpret_cast<TUid*>(aMessage.Int0());
+    iRecorder->SetPreferredVideoEncoderL( *uid );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetPreferredVideoEncapsulationL
+// Set video encoder output format encapsulation. Usage optional.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetPreferredVideoEncapsulationL(const RMessage2& aMessage)
+    {
+    TVideoDataUnitEncapsulation* encapsulation = reinterpret_cast<TVideoDataUnitEncapsulation*>(aMessage.Int0());
+    iRecorder->SetPreferredVideoEncapsulationL( *encapsulation );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SetSegmentTargetSizeL
+// Set video segment size. Usage optional.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::SetSegmentTargetSizeL(const RMessage2& aMessage)
+    {
+    TUint layer = aMessage.Int0();
+    TUint sizeBytes = aMessage.Int1();
+    TUint sizeMacroblocks = aMessage.Int2();
+    iRecorder->SetSegmentTargetSizeL(layer, sizeBytes, sizeMacroblocks );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::AdjustTimeStampsL
+// Adjust video time stamps (+ or -)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::AdjustTimeStampsL(const RMessage2& aMessage)
+    {
+    TInt adjustment = aMessage.Int0();
+    iRecorder->AdjustTimeStampsL( adjustment );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::PrepareL
+// Prepare video for recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::PrepareL()
+    {
+    PRINT((_L("CCMRVideoThreadProxySession::PrepareL() in")));    
+    iRecorder->PrepareL();
+    PRINT((_L("CCMRVideoThreadProxySession::PrepareL() out")));    
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::RecordL
+// Start recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::RecordL()
+    {
+    PRINT((_L("CCMRVideoThreadProxySession::RecordL() in")));    
+    iRecorder->RecordL();
+    PRINT((_L("CCMRVideoThreadProxySession::RecordL() out")));    
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::StopL
+// Stop recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::StopL()
+    {
+    PRINT((_L("CCMRVideoThreadProxySession::StopL() in")));    
+    iRecorder->StopL();
+    PRINT((_L("CCMRVideoThreadProxySession::StopL() out")));       
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::RequestBuffersAndWaitEOSL
+// Wait until video thread is stopped and receives EOS marker
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::RequestBuffersAndWaitEOSL(const RMessage2& aMessage)
+    {
+    PRINT((_L("CCMRVideoThreadProxySession::RequestBuffersAndWaitEOSL() in")));    
+    TInt* videoEOSReached = reinterpret_cast<TInt*>(aMessage.Int0());
+    iRecorder->RequestBuffersAndWaitEOSL(*videoEOSReached);
+    PRINT((_L("CCMRVideoThreadProxySession::RequestBuffersAndWaitEOSL() out")));
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::PauseL
+// Pause recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::PauseL()
+    {
+    iRecorder->PauseL();
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::ResumeL
+// Resume recording
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCMRVideoThreadProxySession::ResumeL()
+    {
+    iRecorder->ResumeL();
+    return ETrue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCMRVideoThreadProxySession::SendEventToClient
+// Catches completion events and sends other events to client using base class
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCMRVideoThreadProxySession::SendEventToClient(const TMMFEvent& aEvent)
+    {
+    PRINT((_L("CCMRVideoThreadProxySession::SendEventToClient() in")));
+    if ( aEvent.iEventType == KCMRRecordingComplete )
+        {
+        PRINT((_L("CCMRVideoThreadProxySession::SendEventToClient() EOS received = stop success or fatal error")));        
+        // we were waiting for the recorder to stop, release now also the client from waiting (stop is sync for the client)
+        iStopping = EFalse;
+        PRINT((_L("CCMRVideoThreadProxySession::SendEventToClient() out, KCMRRecordingComplete sent forward")));     
+        return CCMRThreadProxySession::SendEventToClient( aEvent );
+        }
+    else 
+        {
+        // call base class implementation
+        PRINT((_L("CCMRVideoThreadProxySession::SendEventToClient() out")));     
+        return CCMRThreadProxySession::SendEventToClient( aEvent );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/traces/CCMRMDFVideoRecorderTraces.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCMRMDFVideoRecorderTraces.h
+*
+*/
+// Created by TraceCompiler 1.0.27
+// DO NOT EDIT, CHANGES WILL BE LOST
+
+#ifndef __CCMRMDFVIDEORECORDERTRACES_H__
+#define __CCMRMDFVIDEORECORDERTRACES_H__
+
+#define KOstTraceComponentID 0x101f8507
+
+#define CCMRVIDEORECORDER_MDVRONEWBUFFERS 0x40001
+
+
+inline TBool OstTraceGen2( TUint32 aTraceID, TInt aParam1, TInt aParam2 )
+    {
+    TBool retval = BTrace8( KBTraceCategoryOpenSystemTrace, EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TInt* )ptr ) = aParam1;
+        ptr += sizeof ( TInt );
+        *( ( TInt* )ptr ) = aParam2;
+        ptr += sizeof ( TInt );
+        ptr -= 8;
+        retval = OstSendNBytes( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGen2( TUint32 aTraceID, TInt32 aParam1, TInt32 aParam2 )
+    {
+    TBool retval = BTrace8( KBTraceCategoryOpenSystemTrace, EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TInt* )ptr ) = aParam1;
+        ptr += sizeof ( TInt );
+        *( ( TInt* )ptr ) = aParam2;
+        ptr += sizeof ( TInt );
+        ptr -= 8;
+        retval = OstSendNBytes( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/mediarecorder/traces/OstTraceDefinitions.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OstTraceDefinitions.h
+*
+*/
+
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/rom/CamcorderMMFPlugin.iby	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF Plugin rom definition file.
+*
+*/
+
+
+#ifndef __CAMCORDERMMFPLUGIN_IBY__
+#define __CAMCORDERMMFPLUGIN_IBY__
+
+// Utilizing constants from data_caging_paths_for_iby.hrh, included in higher level
+
+// Camcorder MMFPlugin
+ECOM_PLUGIN(CAMCCONTROLLER.DLL,101F8502.rsc)
+file=ABI_DIR\BUILD_DIR\CAMC3GPSINK.DLL			SHARED_LIB_DIR\CAMC3GPSINK.DLL
+file=ABI_DIR\BUILD_DIR\CAMCMEDIARECORDER.DLL 		SHARED_LIB_DIR\CAMCMEDIARECORDER.DLL
+
+//data=ZSYSTEM\install\CamcorderMMFPluginStub.sis       system\install\CamcorderMMFPluginStub.sis
+
+#endif	//__CAMCORDERMMFPLUGIN_IBY__
Binary file camcordermmfplugin/rom/CamcorderMMFPluginStub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/rom/CamcorderMMFPluginStub.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,33 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:CamcorderMMFPluginStub.pkg
+;
+; Languages
+&EN
+
+; Header
+#{"CamcorderMMFPlugin"}, (0x101F8502), 1, 0, 0
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\CAMCCONTROLLER.DLL"
+""-"z:\sys\bin\CamcMediaRecorder.dll"
+""-"z:\sys\bin\camc3gpsink.dll"
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/BWINS/CPPUNITCAMCTESTU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateTopFct@@YAPAVMTest@@XZ @ 1 NONAME ; class MTest * __cdecl CreateTopFct(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/BWINS/StifCamcTestU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModule@@XZ @ 1 NONAME ; class CTestModule * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/EABI/StifCamcTestU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,76 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CCamcTest_1 @ 4 NONAME ; #<TI>#
+	_ZTI11CCamcTest_2 @ 5 NONAME ; #<TI>#
+	_ZTI11CCamcTest_3 @ 6 NONAME ; #<TI>#
+	_ZTI11CCamcTest_4 @ 7 NONAME ; #<TI>#
+	_ZTI11CCamcTest_5 @ 8 NONAME ; #<TI>#
+	_ZTI11CCamcTest_6 @ 9 NONAME ; #<TI>#
+	_ZTI11CCamcTest_7 @ 10 NONAME ; #<TI>#
+	_ZTI11CCamcTest_8 @ 11 NONAME ; #<TI>#
+	_ZTI11CCamcTest_9 @ 12 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_1E @ 13 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_2E @ 14 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_3E @ 15 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_4E @ 16 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_5E @ 17 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_6E @ 18 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_7E @ 19 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_8E @ 20 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_9E @ 21 NONAME ; #<TI>#
+	_ZTI11CTestCallerI21CCamcTest_visualcheckE @ 22 NONAME ; #<TI>#
+	_ZTI11CTestCallerI24CCamcTest_visualcheckdspE @ 23 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 24 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_1 @ 25 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_2 @ 26 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_3 @ 27 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_4 @ 28 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_5 @ 29 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_6 @ 30 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_7 @ 31 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_8 @ 32 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_9 @ 33 NONAME ; #<TI>#
+	_ZTI21CCamcTest_visualcheck @ 34 NONAME ; #<TI>#
+	_ZTI24CCamcTest_visualcheckdsp @ 35 NONAME ; #<TI>#
+	_ZTI27CCamcTestClient_visualcheck @ 36 NONAME ; #<TI>#
+	_ZTI30CCamcTestClient_visualcheckdsp @ 37 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 38 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 39 NONAME ; #<VT>#
+	_ZTV11CCamcTest_1 @ 40 NONAME ; #<VT>#
+	_ZTV11CCamcTest_2 @ 41 NONAME ; #<VT>#
+	_ZTV11CCamcTest_3 @ 42 NONAME ; #<VT>#
+	_ZTV11CCamcTest_4 @ 43 NONAME ; #<VT>#
+	_ZTV11CCamcTest_5 @ 44 NONAME ; #<VT>#
+	_ZTV11CCamcTest_6 @ 45 NONAME ; #<VT>#
+	_ZTV11CCamcTest_7 @ 46 NONAME ; #<VT>#
+	_ZTV11CCamcTest_8 @ 47 NONAME ; #<VT>#
+	_ZTV11CCamcTest_9 @ 48 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_1E @ 49 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_2E @ 50 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_3E @ 51 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_4E @ 52 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_5E @ 53 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_6E @ 54 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_7E @ 55 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_8E @ 56 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_9E @ 57 NONAME ; #<VT>#
+	_ZTV11CTestCallerI21CCamcTest_visualcheckE @ 58 NONAME ; #<VT>#
+	_ZTV11CTestCallerI24CCamcTest_visualcheckdspE @ 59 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 60 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_1 @ 61 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_2 @ 62 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_3 @ 63 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_4 @ 64 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_5 @ 65 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_6 @ 66 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_7 @ 67 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_8 @ 68 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_9 @ 69 NONAME ; #<VT>#
+	_ZTV21CCamcTest_visualcheck @ 70 NONAME ; #<VT>#
+	_ZTV24CCamcTest_visualcheckdsp @ 71 NONAME ; #<VT>#
+	_ZTV27CCamcTestClient_visualcheck @ 72 NONAME ; #<VT>#
+	_ZTV30CCamcTestClient_visualcheckdsp @ 73 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 74 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/Group/StifCamcTest.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+#include <platform_paths.hrh>
+
+TARGET        StifCamcTest.dll
+TARGETTYPE    dll
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY	CAP_GENERAL_DLL MultimediaDD
+VENDORID      VID_DEFAULT
+
+SOURCEPATH    ../src
+
+SOURCE        camcTest.cpp
+SOURCE        StifcamcTestTop.cpp
+
+SOURCE        camcTest_1.cpp
+SOURCE        camcTestClient_1.cpp
+SOURCE        camcTest_2.cpp
+SOURCE        camcTestClient_2.cpp
+SOURCE        camcTest_3.cpp
+SOURCE        camcTestClient_3.cpp
+SOURCE        camcTest_4.cpp
+SOURCE        camcTestClient_4.cpp
+SOURCE        camcTest_5.cpp
+SOURCE        camcTestClient_5.cpp
+SOURCE        camcTest_6.cpp
+SOURCE        camcTestClient_6.cpp
+SOURCE        camcTest_7.cpp
+SOURCE        camcTestClient_7.cpp
+SOURCE        camcTest_8.cpp
+SOURCE        camcTestClient_8.cpp
+SOURCE        camcTest_9.cpp
+SOURCE        camcTestClient_9.cpp
+
+SOURCE        camcTest_visualcheckdsp.cpp
+SOURCE        camcTestClient_visualcheckdsp.cpp
+SOURCE        camcTest_visualcheck.cpp
+SOURCE        camcTestClient_visualcheck.cpp
+
+
+//  TestFrameWork files 
+SOURCE        TestFrameWork/testcase.cpp
+SOURCE        TestFrameWork/assertFailure.cpp
+SOURCE        TestFrameWork/testSuite.cpp
+
+USERINCLUDE   ..
+USERINCLUDE   ../inc
+USERINCLUDE   ../inc/TestFrameWork
+USERINCLUDE   ../../../../Controller/inc
+USERINCLUDE   ../../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE	/epoc32/include/libc
+
+LIBRARY       euser.lib
+LIBRARY       efsrv.lib
+LIBRARY       stiftestinterface.lib
+LIBRARY		  mediaclientvideo.lib
+LIBRARY       MMFControllerFramework.lib 
+LIBRARY       bafl.lib 
+LIBRARY       ecam.lib
+LIBRARY		ecom.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/Group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Exported headers
+
+PRJ_EXPORTS
+
+
+// ROM build files
+
+PRJ_MMPFILES
+StifCamcTest.mmp     // Test cases for STIF Test FrameWork
+
+// Makefile for ATS manual runs
+//GNUMAKEFILE MMFTests_CreateATSTestDrop.make
+
+// Makefile for ATS automated scripts
+gnumakefile testcollector.mk
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/Group/testcollector.mk	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  GNU Makefile that updates the ATS3 drop for a test set.
+#
+TESTTYPE=STIF
+DLLS=StifCamcTest.dll
+DLLDIR=..\$(TESTTYPE)_temp
+
+
+BUILD_DIR=\epoc32\RELEASE\$(PLATFORM)\$(CFG)
+
+UPDATE_BINARIES := $(foreach DLL, $(DLLS), \
+                   & xcopy /Q /Y /F "$(BUILD_DIR)\$(DLL)" "$(DLLDIR)")
+UPDATE_BINARIES := $(wordlist 2, 1000, $(UPDATE_BINARIES))
+
+
+
+# For these targets we shall not do anything.
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES FINAL SAVESPACE:
+
+# BLD target of this Makefile is executed after Symbian BLD target
+# so the binaries are ready.
+BLD: 
+	echo Preparing Test collection...
+	-mkdir "$(DLLDIR)" 2> NUL
+	$(UPDATE_BINARIES)
+
+# Clean the copied binaries from the ATS drop.
+CLEAN:
+	echo Cleaning Test collection...
+	-rd /s /q "$(DLLDIR)" 2> NUL
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/StifCamcTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*
+*/
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This file contains the header file of DemoModule of 
+    STIF TestFramework.
+
+-------------------------------------------------------------------------------
+*/
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFramework/testsuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS(CTestModule):public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+        
+            
+	public: //Data
+	    // None
+    	
+	protected: // Data
+        // None
+    	
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+    	
+    public: // Friend classes
+        // None
+    	
+    protected: // Friend classes
+        // None
+    	
+    private: // Friend classes
+        // None
+    	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/AssertFailure.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/TestResult.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/test.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/testCaller.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFrameWork/TestCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/testCase.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFrameWork/Test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/TestFrameWork/testSuite.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFrameWork/Test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+/* Choose proper header file, depending on which test framework 
+   the tests are built for */
+
+#ifndef CAMCTEST_H
+#define CAMCTEST_H
+
+#ifdef USING_CPPUNIT_FRAMEWORK
+
+ /* CppUnit headers */
+#include <CppUnit/Test.h>
+#include <CppUnit/TestCase.h>
+#include <CppUnit/TestCaller.h>
+#include <CppUnit/TestSuite.h>
+
+#else
+
+  /* STIF TFW headers */
+#include "TestFramework/test.h"
+#include "TestFramework/TestCase.h"
+#include "TestFramework/TestCaller.h"
+#include "TestFramework/TestSuite.h"
+
+#endif
+
+
+//////////////////
+// Utility function
+//////////////////
+
+void AddDriveLetterToPath(const TDesC &aFileName,TDes &aFileNameWithPath ) ;
+
+//////////////////
+// Defines
+//////////////////
+
+#if ( defined ( __MPEG4_AAC_ENCODING) ) && ( defined (__MPEG4_VIDEO_ENCODING) )
+#define MP4_FILE_FORMAT_SUPPORTED
+#else
+#undef MP4_FILE_FORMAT_SUPPORTED
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTTOP_H
+#define __CAMCTESTTOP_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+IMPORT_C  MTest* CreateTopFct ();
+class CCamcTestTop : public CTestSuite
+{
+public:
+
+	CCamcTestTop ();
+    ~CCamcTestTop ();
+
+
+	// A function to collect and return a suite of tests
+	 static MTest* suiteL ();
+
+
+protected:
+
+private:
+
+};
+
+
+
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_1.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef __CAMCTEST_1_H
+#define __CAMCTEST_1_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include "Camctest.h"
+#include <videorecorder.h>
+#include <ecam.h>
+#include "camctestclient_1.h"
+
+// CONSTANTS
+
+#define CONTROLLER_UID 0x101f8503
+#define VIDEO_FORMAT_UID 0x101f8504
+#define VIDEO_FORMAT_UID_NEW 0x101F86D6
+#define VIDEO_FORMAT_UID_MP4 0x101F873D
+
+#define MIME_VIDEO_FORMAT _L8("video/H263-2000")
+#define NEW_MIME_VIDEO_FORMAT _L8("video/mp4v-es")
+#define MPEG4_MIME_VIDEO_FORMAT _L8("video/mp4v-es; profile-level-id=3")
+#define H264_MIME_BASELINE_VIDEO_FORMAT _L8("video/H264; profile-level-id=428016") // AVC/H.264 Baseline profile, Level 2.2
+#define H264_MIME_HIGH_VIDEO_FORMAT _L8("video/H264; profile-level-id=644016") // AVC/H.264 High profile, Level 2.2
+#define NO_AUDIO_FOURCC KMMFFourCCCodeNULL
+#define ACC_AUDIO_FORMAT TFourCC( ' ','A','A','C' )
+#define AMR_AUDIO_FORMAT TFourCC( ' ','A','M','R' )
+#define UNSUPPORTED_VIDEO_FORMAT _L8("video/unSupport")
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTest_1 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_1 ();
+        ~CCamcTest_1 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void OpenFileL_001_L();
+        void OpenFileL_002_L();
+        void OpenFileL_003_L();
+        void OpenFileL_004_L();	
+        void OpenFileL_005_L();
+        
+        void OpenFileL_006_L();
+        void OpenFileL_008_L();
+        void OpenFileL_009_L();	
+        void OpenFileL_010_L();
+        
+        void OpenFileL_011_L();
+        void OpenFileL_017_L();
+        void OpenFileL_018_L();
+        void OpenFileL_019_L();
+        void OpenFileL_020_L();
+        void OpenFileL_021_L();
+        
+        void OpenFileL_030_L();
+        void OpenFileL_031_L();
+        
+        void OpenDesL_001_L();
+        void OpenUrlL_001_L();
+                
+    private:       
+        
+        enum TCamCTest_1_Actions
+            {
+            KCamcorderInDuplicatedMode
+            };
+
+        CCamcTestClient_1 * iCamcTestClient;
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+
+        // Variables and functions for Camera API 
+        void SomethingInActiveObjectIsLeaving (TInt aError);
+        CCamera *iCamera; 
+        TCamCTest_1_Actions iTestCase;
+        TInt iError;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_2.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_2_H
+#define __CAMCTEST_2_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+#include <ecam.h>
+#include <videorecorder.h>
+
+#include "camctestclient_2.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_2 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_2 ();
+        ~CCamcTest_2 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void Close_001_L();
+        void Close_002_L();
+        void Close_003_L();
+        void Close_004_L();
+        void Close_005_L();
+        void Close_007_L();
+        
+        void Prepare_001_L();
+        void Prepare_002_L();
+        void Prepare_003_L();
+        void Prepare_004_L();
+        void Prepare_005_L();
+        void Prepare_006_L();
+        
+        void Record_001_L();
+        void Record_002_L();
+        void Record_003_L();
+        void Record_004_L();
+        void Record_005_L();
+                
+        void SetPriorityL_001_L();
+        void SetPriorityL_002_L();
+        void SetPriorityL_003_L();
+        void SetPriorityL_004_L();
+        
+        
+        void SetVideoFrameRateL_001_L();
+        void SetVideoFrameRateL_002_L();
+        void SetVideoFrameRateL_003_L();
+        void SetVideoFrameRateL_004_L();
+        
+        void SetVideoFrameSizeL_001_L();
+        void SetVideoFrameSizeL_002_L();
+        void SetVideoFrameSizeL_003_L();
+        void SetVideoFrameSizeL_004_L();
+        void SetVideoFrameSizeL_007_L();
+        
+        void SetVideoBitRateL_001_L();
+        void SetVideoBitRateL_002_L();
+        void SetVideoBitRateL_003_L();
+        void SetVideoBitRateL_004_L();
+        
+        
+        void SetAudioBitRateL_001_L();
+        void SetAudioBitRateL_002_L();
+        void SetAudioBitRateL_003_L();
+        void SetAudioBitRateL_004_L();
+        
+        void SetAudioEnabledL_001_L();
+        void SetAudioEnabledL_002_L();
+        void SetAudioEnabledL_003_L();
+        void SetAudioEnabledL_004_L();
+        
+        
+        void SetMaxClipSizeL_001_L();
+        void SetMaxClipSizeL_002_L();
+        void SetMaxClipSizeL_003_L();
+        void SetMaxClipSizeL_004_L();
+        
+        
+        void SetVideoTypeL_001_L();
+        void SetVideoTypeL_002_L();
+        void SetVideoTypeL_003_L();
+        void SetVideoTypeL_004_L();
+        
+        void SetAudioTypeL_001_L();
+        void SetAudioTypeL_002_L();
+        void SetAudioTypeL_003_L();
+        void SetAudioTypeL_004_L();
+        
+    private:
+        CCamcTestClient_2 * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_3.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_3_H
+#define __CAMCTEST_3_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "Camctest.h"
+
+
+#include <videorecorder.h>
+#include "camctestclient_3.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTest_3 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_3 ();
+        ~CCamcTest_3 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+       
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+       
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void NewL_001_L();
+       
+        
+    private:
+        
+        CCamcTestClient_3 * iCamcTestClient;
+
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_4.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_4_H
+#define __CAMCTEST_4_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_4.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_4 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_4 ();
+        ~CCamcTest_4 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);      
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void RecordTimeAvailableL_001_L();
+        void RecordTimeAvailableL_002_L();
+        void RecordTimeAvailableL_003_L();
+        void RecordTimeAvailableL_004_L();
+        void RecordTimeAvailableL_006_L();
+       
+        
+    private:
+        
+        CCamcTestClient_4 * iCamcTestClient;
+
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_5.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_5_H
+#define __CAMCTEST_5_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_5.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTest_5 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_5 ();
+        ~CCamcTest_5 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void NumberOfMetaDataEntriesL_001_L();
+        void NumberOfMetaDataEntriesL_002_L();
+        void MetaDataEntryL_001_L();
+        void MetaDataEntryL_002_L();
+        void AddMetaDataEntryL_001_L();
+        void AddMetaDataEntryL_002_L();
+        void RemoveMetaDataEntryL_001_L();
+        void RemoveMetaDataEntryL_002_L();
+        void ReplaceMetaDataEntryL_001_L();
+        void ReplaceMetaDataEntryL_002_L();
+        void SetPriorityL_005_L();
+        void GetPriorityL_001_L();
+        void SetVideoFrameRateL_005_L();
+        void VideoFrameRateL_001_L();
+        void SetVideoBitRateL_005_L();
+        void VideoBitRateL_001_L();
+        void SetAudioBitRateL_005_L();
+        void AudioBitRateL_001_L();
+        void SetAudioEnabledL_005_L();
+        void AudioEnabledL_001_L();
+        void SetVideoFrameSizeL_006_L();
+        void GetVideoFrameSizeL_001_L();
+        void PauseL_001_L();
+        void PauseL_002_L();
+        void SetMaxClipSizeL_005_L();
+        void SetGainL_001_L();
+        void SetGainL_002_L();
+        void SetGainL_003_L();
+        void GainL_001_L();
+        void MaxGainL_001_L();
+        void MaxGainL_002_L();
+        void Stop_001_L();
+        void Stop_002_L();
+        void Stop_003_L();
+        void Stop_004_L();
+        void Stop_005_L();
+        void Stop_006_L();
+        void Stop_007_L();
+        void GetSupportedVideoTypes_001_L();
+        void GetSupportedVideoTypes_002_L();
+        void GetSupportedAudioTypes_001_L();
+        void GetSupportedAudioTypes_002_L();
+        void GetSupportedAudioTypes_003_L();
+
+    private:
+        
+        CCamcTestClient_5 * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_6.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_6_H
+#define __CAMCTEST_6_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_6.h"
+
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_6 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_6 ();
+        ~CCamcTest_6 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);         
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void PauseL_003_L();
+
+        void SetVideoFrameSizeL_005_L();
+
+        void SetAudioEnabledL_005_L();
+
+        void SetMaxClipSizeL_006_L();
+        void SetMaxClipSizeL_007_L();
+
+        void Record_006_L();
+        void Record_007_L();
+
+        void VideoTypeL_001_L();
+        void VideoTypeL_002_L();
+        void VideoTypeL_003_L();
+        void VideoTypeL_004_L();
+        void VideoTypeL_005_L();
+
+        void AudioTypeL_001_L();
+        void AudioTypeL_002_L();
+        void AudioTypeL_003_L();
+
+        void SetVideoTypeL_005_L();
+        void SetVideoTypeL_006_L();
+        void SetVideoTypeL_007_L();
+        void SetVideoTypeL_008_L();
+        void SetVideoTypeL_009_L();
+
+        void SetAudioTypeL_005_L();
+        void SetAudioTypeL_006_L();
+        void SetAudioTypeL_007_L();
+        void SetAudioTypeL_008_L();
+
+        void ControllerImplementationInformationL_001_L();
+        void ControllerImplementationInformationL_002_L();
+        void ControllerImplementationInformationL_003_L();
+        void ControllerImplementationInformationL_004_L();
+
+        void MMFRegistration_001_L();
+        void MMFRegistration_002_L();
+        void MMFRegistration_003_L();
+        void MMFRegistration_004_L();
+        void MMFRegistration_005_L();
+        void MMFRegistration_006_L();
+
+        void DurationL_001_L();
+        void DurationL_002_L();
+        void DurationL_003_L();
+                    
+    private:
+        
+        CCamcTestClient_6 * iCamcTestClient;
+
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;          
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_7.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_7_H
+#define __CAMCTEST_7_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_7.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_7 : public CTestCase
+    {
+    public:
+        
+        CCamcTest_7 ();
+        ~CCamcTest_7 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void OpenFileL_007_L();
+        void OpenFileL_013_L();
+        void OpenFileL_014_L();    
+        void OpenFileL_015_L();
+        void Close_006_L();
+        
+    private:
+        
+        CCamcTestClient_7 * iCamcTestClient;
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_8.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_8_H
+#define __CAMCTEST_8_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <ecam.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_8.h"
+
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTest_8 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_8 ();
+        ~CCamcTest_8 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);         
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void MultipleInstance_001_L();   
+        void MultipleInstance_002_L(); 
+        void MultipleInstance_003_L();
+        void MultipleInstance_004_L();
+        void MultipleInstance_005_L();
+        void MultipleInstance_006_L();
+        
+    private:
+        
+        CCamcTestClient_8 * iCamcTestClient1;   
+        CCamcTestClient_8 * iCamcTestClient2;
+        TInt iError;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_9.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_9_H
+#define __CAMCTEST_9_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <ecam.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_9.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTest_9 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_9 ();
+        ~CCamcTest_9 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);         
+        
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void Prepare_007_L();
+        void Prepare_008_L();
+        void Prepare_009_L();
+        void RecordTimeAvailableL_005_L();
+        void SetMaxClipSizeL_008_L();
+        void SetMaxClipSizeL_009_L();
+        void NewFileName_001_L();
+        void NewFileName_002_L();
+        void NewFileName_003_L();
+        void NewFileName_004_L();
+        void NewFileName_005_L();
+        void NewFileName_006_L();
+        void NewFileName_007_L();
+        void NewFileName_008_L();
+        void NewFileName_009_L();        
+        void OpenFileL_016_L();
+        
+    private:
+        
+        CCamcTestClient_9 * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;           
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_visualcheck.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_VISUALCHECK_H
+#define __CAMCTEST_VISUALCHECK_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_visualcheck.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTest_visualcheck : public CTestCase
+    {
+    public:
+        
+        CCamcTest_visualcheck ();
+        ~CCamcTest_visualcheck ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+
+       void VisualCheck_101_L();
+       void VisualCheck_102_L();
+       void VisualCheck_103_L();
+       void VisualCheck_104_L();
+       void VisualCheck_105_L();
+       void VisualCheck_106_L();
+       void VisualCheck_107_L();
+       void VisualCheck_108_A_L();
+       void VisualCheck_108_B_L();
+       void VisualCheck_109_L();
+       void VisualCheck_110_L();
+       void VisualCheck_111_L();
+       void VisualCheck_112_L();
+       void VisualCheck_113_L();
+       void VisualCheck_114_L();
+       void VisualCheck_115_L();
+       void VisualCheck_116_L();
+       void VisualCheck_117_L();
+       void VisualCheck_118_L();
+       void VisualCheck_119_L();
+       void VisualCheck_120_L();
+       void VisualCheck_121_L();
+
+    private:
+        
+        CCamcTestClient_visualcheck * iCamcTestClient;
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camcTest_visualcheckdsp.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_VISUALCHECKDSP_H
+#define __CAMCTEST_VISUALCHECKDSP_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <ecam.h>
+#include <videorecorder.h>
+#include "camctestclient_visualcheckdsp.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTest_visualcheckdsp : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_visualcheckdsp ();
+        ~CCamcTest_visualcheckdsp ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+        
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+
+       void VisualCheck_001_L();
+       void VisualCheck_002_L();
+       void VisualCheck_003_L();
+       void VisualCheck_004_L();
+       void VisualCheck_005_L();
+       void VisualCheck_006_L();
+       void VisualCheck_007_L();
+       void VisualCheck_008_L();
+       void VisualCheck_009_A_L();
+       void VisualCheck_009_B_L();
+       void VisualCheck_010_L();
+       void VisualCheck_011_L();
+       void VisualCheck_012_L();
+       void VisualCheck_013_L();
+       void VisualCheck_014_L();
+       void VisualCheck_015_L();
+       void VisualCheck_016_L();
+       void VisualCheck_017_L();
+       void VisualCheck_017_A_L();
+       void VisualCheck_018_L();
+       void VisualCheck_019_L();
+       void VisualCheck_020_L();
+       void VisualCheck_021_L();
+
+    private:
+        
+        CCamcTestClient_visualcheckdsp * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+        CActiveSchedulerWait *iWaitScheduler; 
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_1.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_1_H
+#define __CAMCTESTCLIENT_1_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTestClient_1 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+
+    static CCamcTestClient_1* NewL( );
+    ~CCamcTestClient_1 ();
+	
+
+    void Test_OpenFileL(const TDesC& aFileName, 
+                        TInt aCameraHandle, 
+                        TUid aControllerUid, 
+                        TUid aVideoFormat,
+                        const TDesC8 & aVideoType,
+                        TFourCC aAudioType);
+		
+	void Test_OpenFileL(const TDesC& aFileName, 
+									 TInt aCameraHandle, 
+									 TUid aControllerUid, 
+									 TUid aVideoFormat);
+
+
+	void Test_OpenDesL(TDes8& aDescriptor, 
+									 TInt aCameraHandle, 
+									 TUid aControllerUid, 
+									 TUid aVideoFormat,
+									 const TDesC8 & aVideoType,
+									 TFourCC aAudioType);
+	
+	void Test_OpenUrlL(const TDesC& aUrl, 
+									 TInt aCameraHandle, 
+									 TUid aControllerUid, 
+									 TUid aVideoFormat,
+									 const TDesC8 & aVideoType,
+									 TFourCC aAudioType);
+    
+    TInt WaitForCallbackWithErrors();
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+
+protected:
+
+
+private:
+
+	CCamcTestClient_1 ();
+    void ConstructL();
+
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+
+    TInt  iNrPauses;
+    TInt  iPauseCount;
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TInt iError;
+
+    TBool iStopWhenOpenComplete;
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_2.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_2_H
+#define __CAMCTESTCLIENT_2_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC2_AUDIO_TYPE TFourCC(' ', 'A', 'M', 'R')
+#define TC2_VIDEO_FRAME_RATE 10
+#define TC2_VIDEO_FRAME_SIZE TSize(128,96)
+#define TC2_CIF_VIDEO_FRAME_SIZE TSize(352,288)
+#define TC2_VIDEO_BIT_RATE TInt(40000) 
+#define TC2_AUDIO_BIT_RATE TInt(12200)
+#define TC2_AUDIO_ENABLED EFalse
+#define TC2_VIDEO_TYPE _L8("video/H263-2000")
+
+#define TC2_VIDEO_TYPES_ARRAY  \
+    {     _L8("video/H263-2000"), \
+          _L8("video/H263-2000; profile=0"), \
+          _L8("video/H263-2000; profile=0; level=10") }
+#define TC2_VIDEO_TYPES_ARRAY_LENGTH 3
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION 
+
+
+class CCamcTestClient_2 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+
+public:
+    
+  
+enum TestClient2Actions
+    {
+	Knone,
+    KcloseWhenControllerReady,
+	KcloseWhenControllerNotReady,
+	KcloseWhenPrepareReady,
+	KcloseWhenRecordingReady,
+	KcloseWhenRecording,
+    KcloseWhenPrepareReadyUsingAACandMPEG4,
+
+	KprepareWhenControllerReady,
+	KprepareWhenControllerNotReady,
+	KprepareWhenPrepareReady,
+	KprepareWhenRecordingReady,
+	KprepareWhenRecording,
+	KprepareWhenPrepareReadySetVideoAttributes,
+
+	KrecordWhenControllerReady,
+	KrecordWhenControllerNotReady,
+	KrecordWhenPrepareReady,
+	KrecordWhenRecordingReady,
+	KrecordWhenRecording,
+
+	KSetPriorityLWhenControllerReady,
+	KSetPriorityLWhenControllerNotReady,	
+	KSetPriorityLWhenPrepareReady,
+	KSetPriorityLWhenRecording,
+
+	KSetVideoFrameRateLWhenControllerReady,
+	KSetVideoFrameRateLWhenControllerNotReady,	
+	KSetVideoFrameRateLWhenPrepareReady,
+	KSetVideoFrameRateLWhenRecording,
+	
+	KSetVideoFrameSizeLWhenControllerReady,
+	KSetVideoFrameSizeLWhenControllerReady_MPEG4,
+	KSetVideoFrameSizeLWhenControllerNotReady,	
+	KSetVideoFrameSizeLWhenPrepareReady,
+	KSetVideoFrameSizeLWhenRecording,
+
+	KSetVideoBitRateLWhenControllerReady,
+	KSetVideoBitRateLWhenControllerNotReady,	
+	KSetVideoBitRateLWhenPrepareReady,
+	KSetVideoBitRateLWhenRecording,
+	
+	KSetAudioBitRateLWhenControllerReady,
+	KSetAudioBitRateLWhenControllerNotReady,	
+	KSetAudioBitRateLWhenPrepareReady,
+    KSetAudioBitRateLWhenRecording,
+    
+   	KSetAudioEnabledLWhenControllerReady,
+    KSetAudioEnabledLWhenControllerNotReady,	
+    KSetAudioEnabledLWhenPrepareReady,
+    KSetAudioEnabledLWhenRecording,
+    
+    KSetMaxClipSizeLWhenControllerReady,
+    KSetMaxClipSizeLWhenControllerNotReady,	
+    KSetMaxClipSizeLWhenPrepareReady,
+    KSetMaxClipSizeLWhenRecording,
+    
+    KSetVideoTypeLWhenControllerReady,
+    KSetVideoTypeLWhenControllerNotReady,	
+    KSetVideoTypeLWhenPrepareReady,
+    KSetVideoTypeLWhenRecording,
+    
+    KSetAudioTypeLWhenControllerReady,
+    KSetAudioTypeLWhenControllerNotReady,	
+    KSetAudioTypeLWhenPrepareReady,
+    KSetAudioTypeLWhenRecording
+    };
+
+    static CCamcTestClient_2* NewL( );
+	~CCamcTestClient_2 ();
+
+	void Start_Active_ObjectL(TestClient2Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+protected:
+
+private:
+
+
+enum TestClient2LeavingCodes
+    {
+    KErrGetNotEqualToValuePreviouslySet = 98
+    };
+
+	CCamcTestClient_2 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient2Actions iAction;
+    TestClient2Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TBool iSecondTime;
+};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_3.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_3_H
+#define __CAMCTESTCLIENT_3_H
+
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+
+class CCamcTestClient_3 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    
+
+    static CCamcTestClient_3* NewL(TInt aCameraHandle );
+    ~CCamcTestClient_3 ();
+
+
+
+
+protected:
+
+private:
+
+    enum TestClient3Actions
+        {
+        K_Tc3_none
+        };
+    CCamcTestClient_3 ();
+    void ConstructL(TInt aCameraHandle );
+
+    void Start_Active_ObjectL(TestClient3Actions aAction, TInt aCameraHandle );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient3Actions iAction;
+    TestClient3Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_4.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_4_H
+#define __CAMCTESTCLIENT_4_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32def.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC4_FILE_SIZE_LIMIT 250000 //250k bytes
+#define TC4_VIDEO_BIT_RATE TInt(40000) 
+#define TC4_AUDIO_BIT_RATE TInt(12200)
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_4 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    
+    enum TestClient4Actions
+        {
+        K4RecordTimeAvailSizeLimit,
+        K4RecordTimeAvailNoSizeLimit,
+        K4RecordTimeAvailNotRecordingSizeLimit,  
+        K4RecordTimeAvailNotRecordingNoSizeLimit,
+        K4RecordTimeAvailUntilDiskFull
+        };
+    
+    enum TestClient4LeavingCodes
+        {
+        K4UnexpectedErr = 99,
+        K4ValueNotDecreasingErr,
+        K4ValueNotWithinRange,
+        K4ErrExpectingADifferentValue = 101
+        };
+
+    static CCamcTestClient_4* NewL( );
+	~CCamcTestClient_4 ();
+
+	void Start_Active_ObjectL(TestClient4Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+
+protected:
+
+private:
+
+	CCamcTestClient_4 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient4Actions iAction;
+    TestClient4Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TInt iNumberOfTimeOut;
+    TTimeIntervalMicroSeconds iOldTimeRemaining;
+    TInt64 iTimeRemainingInSec;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_5.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_5_H
+#define __CAMCTESTCLIENT_5_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC5_VIDEO_FRAME_RATE_WRONG 0
+#define TC5_VIDEO_BIT_RATE_WRONG TInt(-50) // Voluntarily Incoherent value
+#define TC5_AUDIO_BIT_RATE_WRONG TInt(1) // Voluntarily Incoherent value
+#define TC5_AUDIO_ENABLED EFalse
+#define TC5_VIDEO_FRAME_SIZE_WRONG TSize(128,0) // Voluntarily Incoherent value
+#define TC5_CIF_VIDEO_FRAME_SIZE TSize(352,288)
+
+// AMR
+#define TC5_AUDIO_TYPE_1 TFourCC( ' ', 'A', 'M', 'R' )
+//AAC
+#define TC5_AUDIO_TYPE_3 TFourCC( ' ', 'A', 'A', 'C' )
+
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient5Actions
+    {
+	K_Tc5_none,
+	K_Tc5_NumberOfMetaDataEntriesWhenNotRecording,
+	K_Tc5_NumberOfMetaDataEntriesWhenRecording,
+    K_Tc5_MetaDataEntryWhenNotRecording,
+    K_Tc5_MetaDataEntryWhenRecording,
+    K_Tc5_AddMetaDataEntryWhenNotRecording,
+    K_Tc5_AddMetaDataEntryWhenRecording,
+    K_Tc5_RemoveMetaDataEntryWhenNotRecording,
+    K_Tc5_RemoveMetaDataEntryWhenRecording,
+    K_Tc5_ReplaceMetaDataEntryWhenNotRecording,
+    K_Tc5_ReplaceMetaDataEntryWhenRecording,
+    K_Tc5_SetPriorityWhenNotRecording,
+    K_Tc5_GetPriorityWhenNotSet,
+    K_Tc5_SetVideoFrameRateWhenOpenNotPrepared,
+    K_Tc5_VideoFrameRateWhenNotSet,
+    K_Tc5_SetVideoBitRateWhenOpenNotPrepared,
+    K_Tc5_VideoBitRateWhenNotSet,
+    K_Tc5_SetAudioBitRateWhenOpenNotPrepared,
+    K_Tc5_AudioBitRateWhenNotSet,
+    K_Tc5_SetAudioEnabledWhenOpenNotPrepared,
+    K_Tc5_AudioEnabledWhenNotSet,
+    K_Tc5_SetVideoFrameSizeWhenOpenNotPrepared,
+    K_Tc5_GetVideoFrameSizeWhenNotSet,
+    K_Tc5_PauseWhenRecording,
+    K_Tc5_PauseWhenStopped,
+    K_Tc5_SetMaxClipSizeLWhenNotRecording,
+    K_Tc5_SetGainWhenNotRecording,
+    K_Tc5_SetGainWhenNotRecordingAndSetWrong,
+    K_Tc5_SetGainWhenRecording,
+    K_Tc5_GainWhenNotSet,
+    K_Tc5_MaxGainWhenNotRecording,
+    K_Tc5_MaxGainWhenRecording,
+    K_Tc5_StopWhenRecording,
+    K_Tc5_StopWhenNotRecording,
+    K_Tc5_StopWhenRecordingNewPrepareCorrect,
+    K_Tc5_StopWhenRecordingAfterOpenFile,
+    K_Tc5_StopWhenRecordingAfterOpenFileNew,
+    K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4,
+    K_Tc5_GetSupportedVideoTypesWhenOpenNotRecording,
+    K_Tc5_GetSupportedVideoTypesWhenOpenNotRecordingNew,
+    K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAMR,
+    K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAAC
+    };
+
+enum TestClient5LeavingCodes
+    {
+    KErrExpectingADifferentValue = 101
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTestClient_5 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_5* NewL( );
+	~CCamcTestClient_5 ();
+
+	void Start_Active_ObjectL(TestClient5Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+    
+protected:
+
+private:
+
+	CCamcTestClient_5 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool iPrepare2ndTime;
+
+    TestClient5Actions iAction;
+    TestClient5Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    CMMFMetaDataEntry *iMMFMetaDataEntry;
+    TInt iUiLevelCameraHandle;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_6.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_6_H
+#define __CAMCTESTCLIENT_6_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32def.h>
+#include "Camctest.h"
+
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC6_VIDEO_FRAME_SIZE TSize(128,96)
+
+// Equivalent video types.
+#define TC6_VIDEO_TYPES_ARRAY  \
+    {     _L8("video/H263-2000"), \
+          _L8("video/H263-2000; profile=0"), \
+          _L8("video/H263-2000; profile=0; level=10") }
+#define TC6_VIDEO_TYPES_ARRAY_NEW  \
+    {     _L8("video/mp4v-es"), \
+          _L8("video/mp4v-es; profile-level-id=8"), \
+	      _L8("video/mp4v-es; profile-level-id=2"), \
+	      _L8("video/mp4v-es; profile-level-id=3"), \
+          _L8("video/mp4v-es; profile-level-id=1") }
+
+#define TC6_VIDEO_TYPES_ARRAY_LENGTH 3
+#define TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW 5
+
+
+#define TC6_VIDEO_TYPE _L8("video/H263-2000")
+#define TC6_VIDEO_TYPE_PROFILE0 _L8("video/H263-2000; profile=0")
+#define TC6_VIDEO_TYPE_PROFILE8 _L8("video/mp4v-es; profile-level-id=8")
+#define TC6_VIDEO_TYPE_PROFILE3 _L8("video/mp4v-es; profile-level-id=3")
+#define TC6_VIDEO_TYPE_WRONG _L8("video/H263-2000; profile=5")
+// There is no other type supported currently,
+// TC6_VIDEO_TYPE_DIFF = TC6_VIDEO_TYPE
+//#define TC6_VIDEO_TYPE_DIFF _L8("video/mp4v-es")
+#define TC6_AUDIO_TYPE TFourCC( ' ', 'A', 'M', 'R' )
+#define TC6_AUDIO_TYPE_WRONG TFourCC( 0,0,0,0 )
+#define TC6_AAC_AUDIO_TYPE TFourCC( ' ','A','A','C' )
+#define TC6_FILE_SIZE_LIMIT 100000 // bytes
+
+#define TC6_CIF_VIDEO_FRAME_SIZE TSize(352,288)
+
+// MACROS
+
+// DATA TYPES
+enum TestClient6Actions
+    {
+	K_Tc6_none,
+    K_Tc6_PauseWhenStopped,
+    K_Tc6_SetVideoFrameSizeLWhenPaused,
+    K_Tc6_SetAudioEnabledLWhenControllerReady,
+    K_Tc6_SetMaxClipSizeLWhenControllerReady,
+    K_Tc6_SetMaxClipSizeLWhenPrepareReady,
+    K_Tc6_RecordWhenPrepareComplete,
+    K_Tc6_RecordWhenPaused,
+    K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecording,
+    K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording,
+    K_Tc6_VideoTypeLWhenOpenWithMimeAndRecording,
+    K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording,
+    K_Tc6_AudioTypeLWhenOpenWithfourCCAndNotRecording,
+    K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording,
+    K_Tc6_AudioTypeLWhenOpenWithfourCCAndRecording,
+    K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording,
+    K_Tc6_SetVideoTypeLWhenOpenWithMimeAndNotRecording,
+    K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat,
+    K_Tc6_SetVideoTypeLWhenNotRecording,
+    K_Tc6_SetVideoTypeLWithProfile,
+    K_Tc6_SetVideoTypeLWithProfile8,
+    K_Tc6_SetVideoTypeLWithProfile3,
+    K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording,
+    K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC,
+    K_Tc6_SetAudioTypeLWhenNotRecording,
+    K_Tc6_ControllerImplementationInformationWhenNotOpen,
+    K_Tc6_ControllerImplementationInformationWhenOpen, 
+    K_Tc6_ControllerImplementationInformationWhenOpenNew, 
+    K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4, 
+    K_Tc6_DurationWhenRecording,
+    K_Tc6_DurationWhenNotRecording,
+    K_Tc6_DurationWhenPaused
+    };
+
+enum TestClient6LeavingCodes
+    {
+    K_Tc6_ErrExpectingADifferentValue = 101,
+    K_Tc6_ValueNotIncreasingErr,
+    K_Tc6_ErrExpectingToLeave
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_6 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_6* NewL( );
+	~CCamcTestClient_6 ();
+
+	void Start_Active_ObjectL(TestClient6Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+    void CheckControllerImplementationInformationL (const CMMFControllerImplementationInformation & aReturnedResult );
+    void CheckControllerImplementationInformationNewL (const CMMFControllerImplementationInformation & aReturnedResult );
+    void CheckControllerImplementationInformationNewMPEG4L (const CMMFControllerImplementationInformation & aReturnedResult );
+
+protected:
+
+private:
+
+	CCamcTestClient_6 ();
+    void ConstructL ();
+   
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient6Actions iAction;
+    TestClient6Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TInt iNumberOfTimeOut;
+    TInt64 iPreviousTime;
+    TTimeIntervalMicroSeconds iOldTimeDuration;
+    TBool iResumeRecording;
+    TInt iNumberOfTimeAsked;
+    TTimeIntervalMicroSeconds iOldDuration;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_7.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_7_H
+#define __CAMCTESTCLIENT_7_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include <ecam.h>
+
+
+// CONSTANTS
+
+#define TC7_CONTROLLER_UID 0x101f8503
+#define TC7_VIDEO_FORMAT_UID 0x101f8504
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient_7_Actions
+    {
+	K_Tc7_none,
+    K_Tc7_ReleaseCameraWhileRecording,
+    K_Tc7_PowerOffCameraWhileRecording,
+    K_Tc7_ReleaseCameraCloseRecorderUseCamera,
+    K_Tc7_OpenFileWhenCameraIsNotAvailable,
+    K_Tc7_OpenFileWithVideoFormatNULL
+    };
+
+enum TCameraReleasedState
+    {
+    ENothingReleased,
+    ECamcStopped,
+    ECameraReleased
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTestClient_7 : public CTimer /* also CActive*/,
+                          public MVideoRecorderUtilityObserver,
+                          public MCameraObserver,
+                          public MCameraObserver2
+
+{
+public:
+    static CCamcTestClient_7* NewL( );
+	~CCamcTestClient_7 ();
+
+	void Start_Active_ObjectL ( TestClient_7_Actions aAction );
+
+protected:
+    //from MVideoRecorder observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+    // Camera API callbacks
+    void ReserveComplete(TInt aError);
+    void PowerOnComplete(TInt aError);
+    void ViewFinderFrameReady(CFbsBitmap& aFrame);
+    void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+    void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);
+
+    // Camera API V2 callbacks
+    void HandleEvent(const TECAMEvent& aEvent);
+    void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+private:
+
+	CCamcTestClient_7 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	CCamera *iCamera, *iCamera2;
+	CActiveSchedulerWait *iWaitScheduler;   
+
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient_7_Actions iAction;
+    TInt iError;
+    TInt iCameraReleasedState;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_8.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_8_H
+#define __CAMCTESTCLIENT_8_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+#include <ecam.h>
+
+
+// CONSTANTS
+
+#define TC8_CONTROLLER_UID 0x101f8503
+#define TC8_VIDEO_FORMAT_UID 0x101f8504
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient_8_Actions
+    {
+    K_Tc8_MultipleInstance001_AO1,    
+    K_Tc8_MultipleInstance001_AO2,
+
+    K_Tc8_MultipleInstance002_AO1,    
+    K_Tc8_MultipleInstance002_AO2,
+
+    K_Tc8_MultipleInstance003_AO1,    
+    K_Tc8_MultipleInstance003_AO2,
+    
+    K_Tc8_MultipleInstance004_AO1,    
+    K_Tc8_MultipleInstance004_AO2,
+
+    K_Tc8_MultipleInstance005_AO1,    
+    K_Tc8_MultipleInstance005_AO2,
+
+    K_Tc8_MultipleInstance006_AO1,    
+    K_Tc8_MultipleInstance006_AO2
+
+    };
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_8 : public CTimer /* also CActive*/,
+                          public MVideoRecorderUtilityObserver
+
+{
+public:
+    static CCamcTestClient_8* NewL( const TDesC & aFileName, TInt *aError,
+        TInt * aNumberOfOpenedCamc, TInt aCameraHandle);
+	~CCamcTestClient_8 ();
+
+	void Start_Active_Object(TestClient_8_Actions aAction,
+                             CCamcTestClient_8 * aClient);
+    void TellMeWhenYouAreInCorrectState(TRequestStatus &aRequest);
+    void Close();
+
+
+protected:
+    //from MVideoRecorder observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+
+// Own functions
+    void WaitForOtherObject();
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+private:
+
+	CCamcTestClient_8 ();
+    void ConstructL( const TDesC &aFileName , TInt *aError,
+        TInt * aNumberOfOpenedCamc, TInt aCameraHandle);
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+    void ReachedWaitingState();
+
+    CVideoRecorderUtility * iCamc;
+    CCamcTestClient_8 * iOtherClient;
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool iReachedWaitingState;
+    TestClient_8_Actions iAction;
+    TInt *iError;
+    TRequestStatus *iReceivedRequest;
+    TBool iRequestPending; // The "server" has been requested for some thing,
+                           // but it hasn't answered yet.  
+    TBool iEmittedRequest; // The "client" has been requesting some thing.
+
+    TBuf<100> iFileName;
+
+    TInt *iNumberOfOpenedCamc;
+    TBool iRecordingReadyTimer;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_9.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_9_H
+#define __CAMCTESTCLIENT_9_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32def.h>
+#include "Camctest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC9_VIDEO_BIT_RATE TInt(40000) 
+#define TC9_AUDIO_BIT_RATE TInt(12200)
+#define TC9_FILE_SIZE_LIMIT 50000
+#define TC9_AUDIO_BIT_RATE_AAC TInt(32000)
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient9Actions
+    {
+	K_Tc9_none,
+    K_Tc9_PrepareWhenControllerReadyWhitoutSetting,
+    K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting,
+    K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting,
+    K_Tc9_RecordTimeAvailWhenRecordingReady,
+    K_Tc9_SetMaxClipSizeLWhenControllerReadySize0,
+    K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize,
+    K_TC9_NewFileNameWhenPreparedNotRecording,
+    K_TC9_NewFileNameWhenRecordSecondTime,
+    K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat,
+    K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat,
+    K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat,
+    K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat,
+    K_TC9_NewFileNameWhenRecording,
+    K_TC9_NewFileNameWhenPaused,
+    K_TC9_NewFileNameWhenInternalStop,
+    K_Tc9_OpenFileInAFolderNonExistent
+    };
+
+enum TestClient9LeavingCodes
+    {
+    K_Tc9_ValueNotWithinRange = 101,
+    K_Tc9_ValueNotExpected
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_9 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_9* NewL( );
+	~CCamcTestClient_9 ();
+
+	void Start_Active_ObjectL ( TestClient9Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+protected:
+
+private:
+
+	CCamcTestClient_9 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void RunLContinuedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient9Actions iAction;
+    TestClient9Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TTimeIntervalMicroSeconds iOldTimeRemaining;
+    TBool iNewFileName;
+    TBool iRecord2ndTime;
+    TBuf<256> iFileName;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_visualcheck.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_VISUALCHECK_H
+#define __CAMCTESTCLIENT_VISUALCHECK_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <mmf/common/mmfvideo.h>
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TCVC_VIDEO_BIT_RATE_10 TInt(64000)
+#define TCVC_VIDEO_BIT_RATE_11 TInt(28000) 
+#define TCVC_VIDEO_BIT_RATE_20 TInt(28000) 
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClientVCActions
+    {
+    K_VC_none,
+        K_VC_test_case_101,
+        K_VC_test_case_102,
+        K_VC_test_case_103,
+        K_VC_test_case_104,
+        K_VC_test_case_105,
+        K_VC_test_case_106,
+        K_VC_test_case_107,
+        K_VC_test_case_108_a,
+        K_VC_test_case_108_b,
+        K_VC_test_case_109,
+        K_VC_test_case_110,
+        K_VC_test_case_111,
+        K_VC_test_case_112,
+        K_VC_test_case_113,
+        K_VC_test_case_114,
+        K_VC_test_case_115,
+        K_VC_test_case_116,
+        K_VC_test_case_117,
+        K_VC_test_case_118,
+        K_VC_test_case_119,
+        K_VC_test_case_120,
+        K_VC_test_case_121
+    };
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTestClient_visualcheck : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_visualcheck* NewL( );
+    ~CCamcTestClient_visualcheck ();
+
+    void Start_Active_ObjectL ( TestClientVCActions aAction );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+
+protected:
+
+private:
+
+    CCamcTestClient_visualcheck ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+    TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool i2ndTime;
+    TBool iDoublePause;
+    TBool iStartRecording2ndTime;
+    TestClientVCActions iAction;
+    TInt iError;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/inc/camctestclient_visualcheckdsp.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_VISUALCHECKDSP_H
+#define __CAMCTESTCLIENT_VISUALCHECKDSP_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+
+#include <mmf/common/mmfvideo.h>
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define VIDEO_BIT_RATE_10 TInt(64000)
+#define VIDEO_BIT_RATE_11 TInt(28000) 
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClientVCdspActions
+    {
+    K_VC_dsp_none,
+        K_VC_dsp_test_case_1,
+        K_VC_dsp_test_case_2,
+        K_VC_dsp_test_case_3,
+        K_VC_dsp_test_case_4,
+        K_VC_dsp_test_case_5,
+        K_VC_dsp_test_case_6,
+        K_VC_dsp_test_case_7,
+        K_VC_dsp_test_case_8,
+        K_VC_dsp_test_case_9_a,
+        K_VC_dsp_test_case_9_b,
+        K_VC_dsp_test_case_10,
+        K_VC_dsp_test_case_11,
+        K_VC_dsp_test_case_12,
+        K_VC_dsp_test_case_13,
+        K_VC_dsp_test_case_14,
+        K_VC_dsp_test_case_15,
+        K_VC_dsp_test_case_16,
+        K_VC_dsp_test_case_17,
+        K_VC_dsp_test_case_17_a,
+        K_VC_dsp_test_case_18,
+        K_VC_dsp_test_case_19,
+        K_VC_dsp_test_case_20,
+        K_VC_dsp_test_case_21
+    };
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTestClient_visualcheckdsp : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_visualcheckdsp* NewL( );
+	~CCamcTestClient_visualcheckdsp ();
+
+	void Start_Active_ObjectL ( TestClientVCdspActions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+    
+
+protected:
+
+private:
+
+	CCamcTestClient_visualcheckdsp ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool i2ndTime;
+    TBool iDoublePause;
+    TBool iStartRecording2ndTime;
+    TestClientVCdspActions iAction;
+    TInt iError;
+    
+     TInt iUiLevelCameraHandle;
+     
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/sis/STIFCamctest.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,60 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Camcorder MMF API Test DLL
+;
+;
+;
+
+; Languages
+&EN
+
+; Package header
+#{"StifCamcTest"},(0x101F8818),0,0,0,TYPE=SA
+
+; Localised Vendor name
+%{"Nokia EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+
+"\epoc32\release\armv5\udeb\StifCamcTest.dll"   -   "!:\Sys\Bin\StifCamcTest.dll"
+  
+"\epoc32\winscw\c\TestFramework\TestFramework.ini"-"C:\TestFramework\TestFramework_camc.ini"
+
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/StifCamcTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "StifCamCTestTop.h"
+#include "TestFramework/testsuite.h"
+
+#include "CamcTest_1.h"
+#include "CamcTest_2.h"
+#include "CamcTest_3.h"
+#include "CamcTest_4.h"
+#include "CamcTest_5.h"
+#include "CamcTest_6.h"
+#include "CamcTest_7.h"
+#include "CamcTest_8.h"
+#include "CamcTest_9.h"
+#include "CamcTest_visualcheckdsp.h"
+#include "CamcTest_visualcheck.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+
+
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL(CCamcTest_1::suiteL());
+    iTestSuite->addTestL(CCamcTest_2::suiteL());
+    iTestSuite->addTestL(CCamcTest_3::suiteL());
+    iTestSuite->addTestL(CCamcTest_4::suiteL());
+    iTestSuite->addTestL(CCamcTest_5::suiteL());   
+    iTestSuite->addTestL(CCamcTest_6::suiteL());
+    iTestSuite->addTestL(CCamcTest_7::suiteL());    
+    iTestSuite->addTestL(CCamcTest_8::suiteL());
+    iTestSuite->addTestL(CCamcTest_9::suiteL());
+
+    // Visual checks are flagged out because tests are very long !
+    
+    // Only one of these suite should be selected, depending on 
+    // HW used for the test.
+    // iTestSuite->addTestL(CCamcTest_visualcheckdsp::suiteL()); 
+    // iTestSuite->addTestL(CCamcTest_visualcheck::suiteL()); 
+
+     /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+
+    // Return value
+    TInt execStatus = KErrNone;
+    iTestSuite->ExecuteTestL(aResult, aCaseNumber);
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+      
+    }
+    
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+    
+    
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+
+    // Stack size
+    param->iTestThreadStackSize= 32768;// 32K stack 
+
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 8*1048576;// 4M heap max
+
+    aTestModuleParam = param;
+
+    return KErrNone;
+    }
+
+#ifndef EKA2
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/TestFrameWork/AssertFailure.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+#include "AssertFailure.h"
+
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+									  TInt aLineNumber,
+									  const TDesC8& aFileName)
+	{
+	CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+									   TInt aLineNumber,
+									   const TDesC8& aFileName)
+
+	{
+	CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+	CleanupStack::PushL(self);
+	self->ConstructL(aMessage, aFileName);
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self=NewLC(aAssertFailure);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self = new(ELeave)CAssertFailure;
+	CleanupStack::PushL(self);
+	self->ConstructL(aAssertFailure);
+	return self;
+	}
+
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+								 const TDesC8& aFileName)
+	{
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+	}
+
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+	{
+	iLineNumber = aAssertFailure.iLineNumber;
+	iMessage = aAssertFailure.iMessage->AllocL();
+	iFileName = aAssertFailure.iFileName->AllocL();
+	}
+
+
+CAssertFailure::CAssertFailure ()
+	{
+	}
+
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+	{
+	}
+
+
+CAssertFailure::~CAssertFailure () 
+	{
+    delete iFileName;
+	delete iMessage;
+	}
+
+
+const TDesC8& CAssertFailure::What() const
+	{
+	return *iMessage;
+	}
+
+
+TInt CAssertFailure::LineNumber()  const
+	{
+	return iLineNumber;
+	}
+
+
+const TDesC8& CAssertFailure::FileName()  const
+	{
+	return *iFileName;
+	}
+
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+	{
+	iMyHeapCellCount = aHeapCellCount;
+	}
+	
+
+TInt CAssertFailure::MyHeapCellCount ()
+	{
+	return iMyHeapCellCount;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/TestFrameWork/TestCase.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+#include <utf.h>
+
+#include "TestFrameWork/TestCase.h"
+#include "TestFrameWork/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "TestCase.h"
+#include "TestResult.h"
+#include "AssertFailure.h"
+#include "CppUnitLog.h"
+#endif
+
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/TestFrameWork/TestSuite.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#include "TestFrameWork/TestSuite.h"
+#include <StifTestModule.h>
+
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#include <e32base.h>
+#include <f32file.h>
+#include "CamcTest.h"
+//////////////////
+// Utility function
+//////////////////
+
+
+void AddDriveLetterToPath(const TDesC &aFileName,TDes &aFileNameWithPath ) 
+    {
+    TFileName aDrive;
+
+    Dll::FileName(aDrive);
+    TParsePtr parse(aDrive);
+    aDrive = parse.Drive();
+    if ((aDrive[0] == 'Z') || (aDrive[0] == 'z'))
+        {
+        aDrive = _L("F:");
+        }
+    aDrive.Append(_L("\\"));
+    aDrive.Append(aFileName);
+    aFileNameWithPath = aDrive;
+    RDebug::Print(_L("Recording Full Path:")); 
+    RDebug::Print(aDrive);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_1.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTestClient_1.h"
+#include "CamCtest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+
+CCamcTestClient_1::CCamcTestClient_1 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+
+CCamcTestClient_1::~CCamcTestClient_1 ()
+    {
+    Cancel();
+    iCamc->Close();
+    delete iCamc;
+    }
+
+CCamcTestClient_1* CCamcTestClient_1::NewL( )
+    {
+    CCamcTestClient_1* self = new(ELeave) CCamcTestClient_1;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_1::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    iNrPauses = 0;
+    iPauseCount = 0;
+    iTimeout = 0;
+    
+    CTimer::ConstructL();
+    
+    CActiveScheduler::Add(this);
+    }
+
+void CCamcTestClient_1::Test_OpenFileL(const TDesC& aFileName, 
+                                       TInt aCameraHandle, 
+                                       TUid aControllerUid, 
+                                       TUid aVideoFormat,
+                                       const TDesC8 & aVideoType,
+                                       TFourCC aAudioType)
+    {
+    TFileName file;
+    AddDriveLetterToPath(aFileName,file);
+    iCamc->OpenFileL( file, aCameraHandle, aControllerUid, aVideoFormat,aVideoType, aAudioType);
+    }
+
+void CCamcTestClient_1::Test_OpenFileL(const TDesC& aFileName, 
+                                       TInt aCameraHandle, 
+                                       TUid aControllerUid, 
+                                       TUid aVideoFormat)
+    {
+    TFileName file;
+    AddDriveLetterToPath(aFileName,file);
+    iCamc->OpenFileL( file, aCameraHandle, aControllerUid, aVideoFormat);
+    }
+
+void CCamcTestClient_1::Test_OpenDesL(TDes8& aDescriptor, 
+                                      TInt aCameraHandle, 
+                                      TUid aControllerUid, 
+                                      TUid aVideoFormat,
+                                      const TDesC8 & aVideoType,
+                                      TFourCC aAudioType)
+    {
+    iCamc->OpenDesL( aDescriptor, aCameraHandle, aControllerUid, aVideoFormat,aVideoType, aAudioType);
+    }
+
+void CCamcTestClient_1::Test_OpenUrlL(const TDesC& aUrl, 
+                                      TInt aCameraHandle, 
+                                      TUid aControllerUid, 
+                                      TUid aVideoFormat,
+                                      const TDesC8 & aVideoType,
+                                      TFourCC aAudioType)
+    {
+    iCamc->OpenUrlL( aUrl, 0, aCameraHandle, aControllerUid, aVideoFormat,aVideoType, aAudioType);
+    }
+
+TInt CCamcTestClient_1::WaitForCallbackWithErrors()
+    {
+    iStopWhenOpenComplete = ETrue;
+    CActiveScheduler::Start();
+    return(iError);
+    }
+
+
+void CCamcTestClient_1::RunL()
+    {
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,
+           RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_1::RunLTrappedL()
+    {
+    TBuf<100> aaa;
+    aaa.Format(_L("RunL iOpenReady:%i iPrepareReady:%i iRecordingReady:%i iPaused:%i"), 
+        iOpenReady, iPrepareReady, iRecordingReady, iPaused);
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(EFalse);
+        iCamc->Prepare();
+        }
+    
+    else if ( iPrepareReady ) 
+        {
+        iPrepareReady = EFalse;
+        iCamc->Record();
+        CTimer::After( iTimeout );
+        }
+    
+    else if ( iRecordingReady )
+        {
+        iRecordingReady = EFalse;
+        iCamc->Close();
+        
+        CActiveScheduler::Stop();
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        if ( iPauseCount < iNrPauses )
+            {
+            iPaused = ETrue;
+            iPauseCount++;
+            iCamc->PauseL();
+            //add timer
+            CTimer::After( iTimeout );
+            }
+        else 
+            {
+            iCamc->Stop();
+            
+            CActiveScheduler::Stop();
+            }
+        }
+    }
+
+void CCamcTestClient_1::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_1::MvruoOpenComplete( TInt aError )
+    {
+    if ( iStopWhenOpenComplete )
+        {
+        iError = aError;
+        CActiveScheduler::Stop();
+        return;
+        }
+
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, it cannot leave.
+        }
+    }
+
+void CCamcTestClient_1::MvruoPrepareComplete( TInt aError )
+    {    
+    TBuf<128> str;
+    str.Format(_L("CCamcTestClient_1::MvruoPrepareComplete %i"), aError);
+    RDebug::Print(str); 
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, it cannot leave.
+        }
+    }
+
+void CCamcTestClient_1::MvruoRecordComplete( TInt aError )
+    {    
+    TBuf<128> str;
+    str.Format(_L("CCamcTestClient_1::MvruoRecordComplete %i"), aError);
+    RDebug::Print(str); 
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, it cannot leave.
+        }
+    }
+
+void CCamcTestClient_1::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {   
+    RDebug::Print(_L("CCamcTestClient_1::MvruoEvent"));
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_1::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    TBuf<128> str;
+    str.Format(_L("CCamcTestClient_1::Something In Active Object is leaving %i"), aError);
+    RDebug::Print(str);   
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_2.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,837 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_2.h"
+#include <e32svr.h>
+#include <AudioPreference.h>
+#include "camctest.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_2::CCamcTestClient_2 () : CTimer(CActive::EPriorityHigh)
+    { 
+    RDebug::Print(_L("CamCTestClient 2: Constructor"));
+    }
+
+
+CCamcTestClient_2::~CCamcTestClient_2 ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2: Destructor Start"));
+#endif
+    Cancel();
+    delete iCamc;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2: Destructor End"));
+#endif
+    }
+
+CCamcTestClient_2* CCamcTestClient_2::NewL()
+    {
+    CCamcTestClient_2* self = new(ELeave) CCamcTestClient_2;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_2::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_2::Start_Active_ObjectL ( TestClient2Actions aAction, TInt aCameraHandle )
+    {
+
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    switch ( iAction )
+        {
+        case  KcloseWhenControllerNotReady :
+            {
+            iCamc->Close();
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+            
+        case KprepareWhenControllerNotReady :
+            {
+            iCamc->Prepare();
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+            
+        case KrecordWhenControllerNotReady :
+            {
+            iCamc->Record();	
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+            
+        case KSetPriorityLWhenControllerNotReady :
+            {
+            iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime );	
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoFrameRateLWhenControllerNotReady :
+            {
+            iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoFrameSizeLWhenControllerNotReady :
+            {
+            iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoBitRateLWhenControllerNotReady :
+            {
+            iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE  );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetAudioBitRateLWhenControllerNotReady :
+            {
+            iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetAudioEnabledLWhenControllerNotReady :
+            {
+            iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetMaxClipSizeLWhenControllerNotReady :
+            {
+            iCamc->SetMaxClipSizeL( 10000 );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoTypeLWhenControllerNotReady :
+            {
+            iCamc->SetVideoTypeL( TC2_VIDEO_TYPE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetAudioTypeLWhenControllerNotReady :
+            {
+            iCamc->SetAudioTypeL(  TC2_AUDIO_TYPE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoFrameSizeLWhenControllerReady_MPEG4 :
+        case KcloseWhenPrepareReadyUsingAACandMPEG4 :
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordCIF.mp4"), file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, 
+                camHandle, 
+                controllerUid,
+                formatUidMP4,
+                _L8("video/mp4v-es; profile-level-id=3"),
+                TFourCC(' ', 'A', 'A', 'C') ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            iOpenReady = EFalse;
+            
+            break;
+            }
+        default:
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, 
+                camHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            iOpenReady = EFalse;
+            
+            break;
+            }
+        }
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_2::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2:RunL"));
+#endif
+    TRAPD( err,
+        RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_2::RunLTrappedL()
+    {
+    TBool prepare = EFalse;
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue);
+
+        switch ( iAction )
+            {
+            case  KcloseWhenControllerReady:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+                
+            case  KprepareWhenControllerReady:
+                {
+                prepare = ETrue;
+                break;
+                }
+                
+            case KrecordWhenControllerReady:
+                {
+                iCamc->Record();
+                break;
+                }
+                
+            case KSetPriorityLWhenControllerReady :
+                {
+                iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoFrameRateLWhenControllerReady :
+                {
+                iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoFrameSizeLWhenControllerReady :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoFrameSizeLWhenControllerReady_MPEG4 :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_CIF_VIDEO_FRAME_SIZE );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoBitRateLWhenControllerReady :
+                {
+                iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetAudioBitRateLWhenControllerReady :
+                {
+                iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE  );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetAudioEnabledLWhenControllerReady :
+                {
+                iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetMaxClipSizeLWhenControllerReady :
+                {
+                iCamc->SetMaxClipSizeL( 10000 );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoTypeLWhenControllerReady :
+                {
+                iCamc->SetVideoTypeL( TC2_VIDEO_TYPE );
+                prepare = ETrue;
+                break;
+                }
+            case KSetAudioTypeLWhenControllerReady :
+                {
+                iCamc->SetAudioTypeL( TC2_AUDIO_TYPE );
+                prepare = ETrue;
+                break;
+                }
+            default:
+                {
+                prepare = ETrue;
+                break;
+                }
+            }
+        if ( prepare )
+            {
+            iCamc->Prepare();
+            }
+        }
+    else if ( iPrepareReady ) 
+        {
+        TBool record = EFalse;
+        
+        switch ( iAction )
+            {
+            case KcloseWhenPrepareReady:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+            case KcloseWhenPrepareReadyUsingAACandMPEG4:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+
+            case  KprepareWhenPrepareReady:
+                {
+                iAction = Knone;
+                iPrepareReady = EFalse;
+                iCamc->Prepare();
+                break;
+                }
+            case  KprepareWhenPrepareReadySetVideoAttributes:
+                {
+                iAction = Knone;
+                iPrepareReady = EFalse;
+                iCamc->SetVideoFrameSizeL( TSize(176,144) );
+                iCamc->SetVideoFrameRateL( TReal32(15) );
+                iCamc->SetVideoBitRateL( TInt(50000) );
+                iCamc->SetAudioEnabledL( EFalse );
+                iCamc->Prepare();
+                break;
+                }
+            case KrecordWhenPrepareReady:
+                {
+                record = ETrue;
+                break;
+                }
+            case KSetPriorityLWhenPrepareReady :
+                {
+                if (!iSecondTime)
+                    {
+                    iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime );
+                    record = EFalse;
+                    iCamc->Prepare();
+                    iSecondTime = ETrue;
+                    }
+                else
+                    {
+                    record= ETrue;
+                    }
+                break;
+                }
+            case KSetVideoFrameRateLWhenPrepareReady :
+                {
+                iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) );
+                record = ETrue;
+                break;
+                }
+            case KSetVideoFrameSizeLWhenPrepareReady :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+                record = ETrue;
+                break;
+                }
+            case KSetVideoBitRateLWhenPrepareReady :
+                {
+                iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE );
+                record = ETrue;
+                break;
+                }
+            case KSetAudioBitRateLWhenPrepareReady :
+                {
+                iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE );
+                record = EFalse;
+                iCamc->Prepare();
+                iAction = Knone;
+                break;
+                }
+            case KSetAudioEnabledLWhenPrepareReady :
+                {
+                iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );	
+                record = ETrue;
+                break;
+                }
+            case KSetMaxClipSizeLWhenPrepareReady :
+                {
+                iCamc->SetMaxClipSizeL( 10000 );	
+                record = ETrue;
+                break;
+                }
+            case KSetVideoTypeLWhenPrepareReady :
+                {
+                iCamc->SetVideoTypeL( TC2_VIDEO_TYPE  );   
+                record = ETrue;
+                break;
+                }
+            case KSetAudioTypeLWhenPrepareReady :
+                {
+                iCamc->SetAudioTypeL( TC2_AUDIO_TYPE );   
+                record = ETrue;
+                break;
+                }   
+            case KSetMaxClipSizeLWhenControllerReady :
+                {
+                record = ETrue;
+                iTimeout = 40 * 1E6; // Wait for 10 seconds.
+                break;
+                }
+            default:
+                {
+                record = ETrue;
+                break;
+                }
+            }
+        if ( record )
+            {
+            iPrepareReady = EFalse;
+            iCamc->Record();
+            CTimer::After( iTimeout );
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+        TBool closeCam = ETrue;
+        switch ( iAction )
+            {
+            case KcloseWhenRecordingReady:
+                {
+                iAction = Knone;
+                iCamc->Close();		
+                closeCam = EFalse;     // False because we want to stop the Active scheduler
+                                       // yet
+                CTimer::After( 10000 );
+                break;
+                }
+            case  KprepareWhenRecordingReady:
+                {
+                iAction = Knone;
+                iRecordingReady = EFalse;
+                iCamc->Prepare();
+                closeCam = EFalse;
+                // Should start a new recording
+                break;
+                }
+            case  KrecordWhenRecordingReady:
+                {
+                iAction = Knone;
+                iRecordingReady = EFalse;
+                iCamc->Record();
+                closeCam = EFalse;
+                CTimer::After( (TInt) (10*1E6) );    // Starts a new recording
+                break;
+                }
+            default:
+                break;
+            }
+        // ////////////////////////////////////////////////////////////////
+        // Check here if the settings were taken into use
+        // (For functions with a get)
+        
+        switch ( iSavedAction )
+            {
+            case KSetPriorityLWhenPrepareReady :
+            case KSetPriorityLWhenRecording:
+            case KSetPriorityLWhenControllerReady :	
+                {
+                TInt priority;
+                TMdaPriorityPreference pref;
+                iCamc->GetPriorityL(priority, pref);
+                __ASSERT_ALWAYS( priority == EMdaPriorityNormal,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                __ASSERT_ALWAYS( pref == EMdaPriorityPreferenceTime, 
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet )); 
+                break;
+                }          
+            
+            case KSetVideoFrameRateLWhenPrepareReady :
+            case KSetVideoFrameRateLWhenRecording:
+            case KSetVideoFrameRateLWhenControllerReady :	
+                {
+                TReal32 frameRate;
+                frameRate = iCamc->VideoFrameRateL();
+                __ASSERT_ALWAYS( frameRate ==  TC2_VIDEO_FRAME_RATE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+                
+            case KSetVideoFrameSizeLWhenPrepareReady :   // Should have left already
+            case KSetVideoFrameSizeLWhenRecording:       // Should have left already
+                User::Panic(_L("Should never come here"),0);
+                break;
+            case KSetVideoFrameSizeLWhenControllerReady :
+                {
+                TSize frameSize;
+                iCamc->GetVideoFrameSizeL( frameSize );
+                __ASSERT_ALWAYS( frameSize==  TC2_VIDEO_FRAME_SIZE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }           
+            case KSetVideoFrameSizeLWhenControllerReady_MPEG4 :
+                {
+                TSize cifFrameSize;
+                iCamc->GetVideoFrameSizeL( cifFrameSize );
+                __ASSERT_ALWAYS( cifFrameSize==  TC2_CIF_VIDEO_FRAME_SIZE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }           
+            case KSetVideoBitRateLWhenPrepareReady :
+            case KSetVideoBitRateLWhenRecording:
+            case KSetVideoBitRateLWhenControllerReady :	
+                {
+                TInt bitRate;
+                bitRate = iCamc->VideoBitRateL();
+                __ASSERT_ALWAYS( bitRate ==  TC2_VIDEO_BIT_RATE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            case KSetAudioBitRateLWhenPrepareReady :
+            case KSetAudioBitRateLWhenControllerReady :	
+                {
+                TInt bitRate;
+                bitRate = iCamc->AudioBitRateL();
+                __ASSERT_ALWAYS( bitRate ==  TC2_AUDIO_BIT_RATE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            case KSetVideoTypeLWhenPrepareReady :  // Should have left already
+            case KSetVideoTypeLWhenRecording:      // Should have left already     
+                User::Panic(_L("Should never come here"),0);
+                break;
+            case KSetVideoTypeLWhenControllerReady :	
+                {
+                 
+                TPtrC8 videoType = iCamc->VideoFormatMimeType();
+         
+
+                TPtrC8 expectedVideoType[TC2_VIDEO_TYPES_ARRAY_LENGTH] = TC2_VIDEO_TYPES_ARRAY ;
+                TBool found = 0;
+                for (TInt i=0; i<TC2_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                    {
+                    if ( expectedVideoType[i] == videoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                __ASSERT_ALWAYS( found,
+                       User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            case KSetAudioTypeLWhenPrepareReady :  // Should have left already
+            case KSetAudioTypeLWhenRecording:      // Should have left already
+               User::Panic(_L("Should never come here"),0);
+               break;
+            case KSetAudioTypeLWhenControllerReady :	
+                {
+                TFourCC audioType;
+                audioType = iCamc->AudioTypeL();
+                __ASSERT_ALWAYS( audioType ==  TC2_AUDIO_TYPE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            default:
+                break;
+            }
+        
+        if (closeCam)
+            {
+            iRecordingReady = EFalse;
+
+            // Close will panic if called here...
+            iCamc->Close();
+            CActiveScheduler::Stop();
+
+            }
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        switch ( iAction )
+            {
+            case KcloseWhenRecording:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+            case KprepareWhenRecording:
+                {
+                // Should leave.
+                iAction = Knone;
+                iCamc->Prepare();
+                break;
+                }
+            case KrecordWhenRecording:
+                {
+                // Should be ignored
+                iAction = Knone;
+                iCamc->Record();
+                CTimer::After ( (TInt) 1E6 ); // Wait 1 Second
+                break;
+                }
+            case KSetPriorityLWhenRecording :
+                {
+                iAction = Knone;
+                iCamc->SetPriorityL( EMdaPriorityNormal,EMdaPriorityPreferenceTime );	
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetVideoFrameRateLWhenRecording:
+                {
+                iAction = Knone;
+                iCamc->SetVideoFrameRateL( TReal32( TC2_VIDEO_FRAME_RATE ) );
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetVideoFrameSizeLWhenRecording :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+                break;
+                }
+            case KSetVideoBitRateLWhenRecording :
+                {
+                iAction = Knone;
+                iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE );
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetAudioBitRateLWhenRecording :
+                {
+                iAction = Knone;   
+                // Should leave
+                iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE  );
+                // If it has left yet, problem !
+                User::Leave(KErrCorrupt);
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetAudioEnabledLWhenRecording :
+                {
+                iAction = Knone;
+                iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );
+                CTimer::After( iTimeout );
+                break; 
+                }
+            case KSetMaxClipSizeLWhenRecording:
+                {
+                iAction = Knone;
+                iCamc->SetMaxClipSizeL( 10000 );
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetVideoTypeLWhenRecording:
+                {
+                iAction = Knone;
+                // Should leave
+                iCamc->SetVideoTypeL( TC2_VIDEO_TYPE  ); 
+                // If it has left yet, problem !
+                User::Leave(KErrCorrupt);
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetAudioTypeLWhenRecording:
+                {
+                iAction = Knone;  
+                // Should leave
+                iCamc->SetAudioTypeL( TC2_AUDIO_TYPE ); 
+                // If it has left yet, problem !
+                User::Leave(KErrCorrupt); 
+                CTimer::After( iTimeout );
+                break;
+                }
+                
+            default:
+                {
+                iCamc->Stop();
+                // Simulates that iRecording has been completed through the 
+                // MvruoRecordComplete callback
+                iRecordingReady=ETrue;				
+                CTimer::After( 1000 );
+                break;
+                }
+            }
+        }
+    
+    
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+}
+
+
+
+void CCamcTestClient_2::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_2::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_2::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_2::MvruoRecordComplete( TInt aError )
+    {  
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2:Record Complete"));
+#endif
+
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_2::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_2::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2:SomethingInActiveObjectIsLeaving"));
+#endif
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_3.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_3.h"
+#include "camctest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_3::CCamcTestClient_3 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_3::~CCamcTestClient_3 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_3* CCamcTestClient_3::NewL(TInt aCameraHandle)
+    {
+    CCamcTestClient_3* self = new(ELeave) CCamcTestClient_3;
+    CleanupStack::PushL(self);
+    self->ConstructL(aCameraHandle );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_3::ConstructL(TInt aCameraHandle)
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add( this );
+    Start_Active_ObjectL ( K_Tc3_none, aCameraHandle );
+    }
+
+
+void CCamcTestClient_3::Start_Active_ObjectL ( TestClient3Actions aAction, TInt aCameraHandle )
+    {
+    
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+    TRAPD(err,
+        iCamc->OpenFileL( file, camHandle, 
+        controllerUid,
+        formatUid,
+        //TFourCC( '2', '6', '3', 'B' ),
+        _L8("video/H263-2000"),
+        TFourCC(' ', 'A', 'M', 'R') ));
+    
+    if (err)
+        {
+        User::Leave(99);
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+
+void CCamcTestClient_3::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_3::RunLTrappedL()
+    { 
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+        
+        iCamc->Prepare();
+        }
+    else if ( iPrepareReady ) 
+        {
+        
+        iPrepareReady = EFalse;
+        iCamc->Record();
+        CTimer::After( iTimeout );
+        }
+    
+    else if ( iRecordingReady )
+        {
+        
+        iRecordingReady = EFalse;
+        iCamc->Close();
+        iClosed =  ETrue;
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        
+        iCamc->Stop();
+        // Simulates that iRecording has been completed through the 
+        // MvruoRecordComplete callback
+        iRecordingReady=ETrue;				
+        CTimer::After( 1000 );
+        
+        }
+    
+    
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    }
+
+
+
+void CCamcTestClient_3::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_3::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL();  // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_3::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_3::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_3::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_3::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_4.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,427 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_4.h"
+#include "camctest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+const TInt KMaxVideoLength = 3600;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_4::CCamcTestClient_4 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_4::~CCamcTestClient_4 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_4* CCamcTestClient_4::NewL()
+    {
+    CCamcTestClient_4* self = new(ELeave) CCamcTestClient_4;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_4::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_4::Start_Active_ObjectL ( TestClient4Actions aAction, TInt aCameraHandle )
+    {
+    
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+    TRAPD(err,
+        iCamc->OpenFileL(file, camHandle, 
+        controllerUid,
+        formatUid,
+        //TFourCC( '2', '6', '3', 'B' ),
+        _L8("video/H263-2000"),
+        TFourCC(' ', 'A', 'M', 'R') ));
+    
+    if (err)
+        {
+        User::Leave(K4UnexpectedErr);
+        }
+    
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    // We continue here when the AO scheduler has been stopped.
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_4::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_4::RunLTrappedL()
+    {
+    
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    else
+        if ( iOpenReady ) 
+            {
+            iOpenReady = EFalse;
+            
+            // Set default parameters. They can be overwritten depending on the test case. 
+            iCamc->SetVideoFrameSizeL(TSize(176,144));
+            iCamc->SetVideoFrameRateL(TReal32(5));
+            iCamc->SetVideoBitRateL(TInt(TC4_VIDEO_BIT_RATE));
+            iCamc->SetAudioBitRateL(TInt(TC4_AUDIO_BIT_RATE));
+            iCamc->SetAudioEnabledL(ETrue); 
+            switch (iAction)
+                {
+                case K4RecordTimeAvailSizeLimit:
+                    {
+                    iCamc->SetMaxClipSizeL(TC4_FILE_SIZE_LIMIT) ; 
+                    break;
+                    }
+                case K4RecordTimeAvailNotRecordingSizeLimit:
+                    {
+                    iCamc->SetMaxClipSizeL(TC4_FILE_SIZE_LIMIT) ; 
+                    break;
+                    }
+                default:
+                    break;
+                }
+            
+            iCamc->Prepare();
+            }
+        else if ( iPrepareReady ) 
+            {    
+            switch (iAction)
+                {
+                case K4RecordTimeAvailNotRecordingSizeLimit:
+                    {
+                    // Compare if set size limit is correctly returned by 
+                    // a RecordTimeAvailableL      
+                    TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                    TInt timeRemainingInSec = (I64LOW (( TInt64 )(timeRemaining.Int64() /1E6)));
+                    
+                    // Value must be proportional to size limit
+                    TInt calculatedDuration = (TInt)
+                       ((float)TC4_FILE_SIZE_LIMIT) * 8 / (TC4_VIDEO_BIT_RATE+TC4_AUDIO_BIT_RATE);
+                    // Allows 5% error margin:
+                    if ( ( timeRemainingInSec > calculatedDuration*1.05 ) ||
+                        ( timeRemainingInSec < calculatedDuration*0.95 ) )
+                        {          
+                        User::Leave( K4ValueNotWithinRange ) ; 
+                        }          
+                    break;
+                    }
+                case K4RecordTimeAvailNotRecordingNoSizeLimit:
+                    {
+                    // Compare if default size limit is correctly returned by 
+                    // a RecordTimeAvailableL      
+                    TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                    TInt64 timeRemainingInSec = timeRemaining.Int64()/1E6;
+                    
+                    // Duration value depends on available disk drive space.
+                    // Get the free space of the disk drive:
+                    RFs fsSession;
+                    User::LeaveIfError(fsSession.Connect());
+                    TVolumeInfo volumeInfo;
+                    TInt err = fsSession.Volume(volumeInfo,EDriveC);
+                    fsSession.Close();
+                    if (err)
+                        {
+                        User::Leave( KErrGeneral) ;
+                        }
+                    // Possible duration = available disk space/videobitrate
+                    TInt64 calculatedDuration = volumeInfo.iFree / TInt64((TC4_VIDEO_BIT_RATE+TC4_AUDIO_BIT_RATE)/8);
+                    
+                    // If there is more space than the max length of the video -> 
+                    // set the calculatedDuration to max length
+                    if ( calculatedDuration > KMaxVideoLength) 
+                        {
+                        calculatedDuration = KMaxVideoLength;
+                        }
+                    
+                    RDebug::Print(_L("CCamcTest_4::RecordTimeAvailable4 timeRemaining is %d (Should be %d)"), timeRemainingInSec, calculatedDuration );
+                    // Allows 5% error margin:
+                    if ( ( timeRemainingInSec > calculatedDuration*1.05 ) ||
+                        ( timeRemainingInSec < calculatedDuration*0.95 ) )
+                        {          
+                        User::Leave( K4ValueNotWithinRange ) ; 
+                        }
+                    break;
+                    
+                    }
+                default:
+                    break;
+                }
+            iPrepareReady = EFalse;
+            
+            iCamc->Record();
+            
+            // Set a timer 
+            // Must be >10 sec to avoid the uncertainties of the bitrates 
+            // at the beginning of a new recording.
+            CTimer::After( (TInt) (20*1E6) );
+
+            }
+        
+        else if ( iRecordingReady )
+            {
+            
+            iRecordingReady = EFalse;
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After( 1500 ); // Give time to the AO to close, will callback RunL after.
+            
+            }
+        else if ( iPaused ) //resume
+            {
+            
+            iPaused = EFalse;
+            iCamc->Record();
+            }
+        else //timer
+            {
+            
+            TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+#ifdef _DEBUG
+            TBuf<128> str;
+            str.Format(_L("Time remaining %x %x"), I64HIGH(timeRemaining.Int64()),
+                I64LOW(timeRemaining.Int64()) );
+            RDebug::Print(str);   
+#endif
+
+            if ( iAction != K4RecordTimeAvailUntilDiskFull )
+                {
+                if (( iNumberOfTimeOut != 0) && (iOldTimeRemaining <= timeRemaining))
+                    {
+                   User::Leave(K4ValueNotDecreasingErr);
+                    }
+                }
+
+            iOldTimeRemaining = timeRemaining;
+            
+            iNumberOfTimeOut++;
+            
+            switch (iAction)
+                {
+                case K4RecordTimeAvailSizeLimit:
+                    {
+                    // Do nothing, stop callback should be called when
+                    // size limit is reached.
+                    CTimer::After( (TInt) 15E6 );     // Wait 15 sec	
+                    break;
+                    }
+                case K4RecordTimeAvailNoSizeLimit:
+                    {
+                    // After 50 timers calls, stop the test
+                    // It is normal behavior.
+                    if (iNumberOfTimeOut == 15)
+                        {
+                        iCamc->Close();
+                        iClosed = ETrue;
+                        }
+                    CTimer::After( (TInt) 15E6 );     // Wait 15 sec	
+                    break;
+                    }
+
+
+            case K4RecordTimeAvailUntilDiskFull:
+                {
+                //TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                iTimeRemainingInSec = timeRemaining.Int64()/1E6;
+                CTimer::After( (TInt) (1*1E6) );
+                break;
+                }
+
+            default:
+                    // Stop the recording
+                    iCamc->Close();
+                    iClosed = ETrue;
+                    CTimer::After( (TInt) 15E6 );     // Wait 15 sec	
+                }
+            }
+        
+        
+    }
+    
+    
+    
+    void CCamcTestClient_4::DoCancel()
+        {
+        iCamc->Stop();
+        iCamc->Close();
+        delete iCamc;
+        iCamc = NULL;
+        }
+    
+    
+    void CCamcTestClient_4::MvruoOpenComplete( TInt aError )
+        {
+        if (aError)
+            {        
+            SomethingInActiveObjectIsLeaving(aError);
+            }
+        else
+            {
+            iOpenReady = ETrue;
+            RunL(); // RunL is trapped, cannot actually leave.
+            }
+        }
+    
+    void CCamcTestClient_4::MvruoPrepareComplete( TInt aError )
+        {    
+        if (aError)
+            {
+            SomethingInActiveObjectIsLeaving(aError);
+            }
+        else
+            {
+            iPrepareReady = ETrue;
+            RunL(); // RunL is trapped, cannot actually leave.
+            }
+        }
+    
+    void CCamcTestClient_4::MvruoRecordComplete( TInt aError )
+        {
+    
+        switch (iAction)
+            {
+            case K4RecordTimeAvailUntilDiskFull:
+                {
+#ifdef _DEBUG
+                TBuf<128> str;
+                str.Format(_L("K4RecordTimeAvailUntilDiskFull : Disk Full ! %i"), iTimeRemainingInSec);
+                RDebug::Print(str);   
+#endif
+                // KErrCompletion if there is more space than needed for 60 min recording.
+                // Otherwise KErrDiskFull
+                if ( (aError !=  KErrDiskFull) || (aError != KErrCompletion ) )
+                    {
+                    User::Leave(K4ErrExpectingADifferentValue);
+                    }
+                if ( iTimeRemainingInSec > 5 ) 
+                    {
+                    User::Leave(K4ValueNotWithinRange);
+                    }
+                break;
+                }
+            }
+
+        if ( (aError) && (aError != KErrCompletion) )
+            {
+            SomethingInActiveObjectIsLeaving(aError);
+            }
+        else
+            {
+            iRecordingReady = ETrue;
+            
+            if ( !IsActive() )
+                {
+                RunL(); // RunL is trapped, cannot actually leave.
+                }
+            }
+        }
+    
+    void CCamcTestClient_4::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+        {
+        /* Should be never called ... */  
+        SomethingInActiveObjectIsLeaving(99);
+        }
+    
+    void CCamcTestClient_4::SomethingInActiveObjectIsLeaving (TInt aError)
+        {
+        // Something in the active object is leaving
+        // or a fatal error has been found.
+        
+        // Stop the active object scheduler.
+#ifdef _DEBUG
+            TBuf<128> str;
+            str.Format(_L("Something is leaving %i"), aError);
+            RDebug::Print(str);   
+#endif
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_5.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,864 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_5.h"
+#include "badesca.h"
+#include "camctest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_5::CCamcTestClient_5 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_5::~CCamcTestClient_5 ()
+    {
+    Cancel();
+    delete iCamc;
+    delete iMMFMetaDataEntry;
+    }
+
+CCamcTestClient_5* CCamcTestClient_5::NewL()
+    {
+    CCamcTestClient_5* self = new(ELeave) CCamcTestClient_5;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_5::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iPrepare2ndTime = EFalse;
+    
+    // Construct the MetaDataEntry
+    iMMFMetaDataEntry = CMMFMetaDataEntry::NewL();
+
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_5::Start_Active_ObjectL ( TestClient5Actions aAction, TInt aCameraHandle )
+    {
+    
+    iUiLevelCameraHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+
+     if ( iAction == K_Tc5_StopWhenRecordingAfterOpenFileNew )
+        {
+        TFileName file;
+        AddDriveLetterToPath(_L("recordQCIF.3g2"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, 
+            iUiLevelCameraHandle, 
+            controllerUid,
+            formatUidG2,
+            _L8("video/mp4v-es"),
+            TC5_AUDIO_TYPE_1 ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else if ( iAction == K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4 )
+        {
+        TFileName file;
+        AddDriveLetterToPath(_L("recordQCIF.mp4"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, 
+            iUiLevelCameraHandle, 
+            controllerUid,
+            formatUidMP4,
+            _L8("video/mp4v-es; profile-level-id=3"),
+            TC5_AUDIO_TYPE_3 ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else
+        {       
+        TFileName file;
+        AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, 
+            iUiLevelCameraHandle, 
+            controllerUid,
+            formatUid,
+            _L8("video/H263-2000"),
+            TFourCC(' ', 'A', 'M', 'R') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_5::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,
+        RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_5::RunLTrappedL()
+    {
+    
+     if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        return;
+        }
+
+    if ( iOpenReady ) 
+
+        {
+
+        iOpenReady = EFalse;
+
+        switch (iAction)
+            {
+            case K_Tc5_GetPriorityWhenNotSet:
+                {
+                TInt priority;
+                TMdaPriorityPreference pref;
+                iCamc->GetPriorityL(priority, pref);
+                // Currently we always set priority to KAudioPriorityVideoRecording to avoid problems caused by keypad tones if keys pressed during testing
+                if (priority != KAudioPriorityVideoRecording || pref != EMdaPriorityPreferenceTimeAndQuality)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_VideoFrameRateWhenNotSet:
+                {
+                TReal32 aValue;
+                aValue = iCamc->VideoFrameRateL();
+                if (aValue != 15.0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+ 
+            case K_Tc5_VideoBitRateWhenNotSet:
+                {
+                TInt aBit;
+                aBit = iCamc->VideoBitRateL();
+                if (aBit != 64000)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+
+            case K_Tc5_AudioBitRateWhenNotSet:
+                {
+                TInt aAudioBit;
+                aAudioBit = iCamc->AudioBitRateL();
+                if (aAudioBit <= 0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+ 
+            case K_Tc5_AudioEnabledWhenNotSet:
+                {
+                
+                TBool aEnabled;
+                aEnabled = iCamc->AudioEnabledL();
+                // By default, audio are enabled.
+                if ( !aEnabled )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_GetVideoFrameSizeWhenNotSet:
+                {
+                TSize aFrame;
+                TSize expectedFrameSize(176,144);
+
+                 iCamc->GetVideoFrameSizeL(aFrame);
+                 if (aFrame != expectedFrameSize)
+                    {
+                    
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+            case K_Tc5_GainWhenNotSet:
+                {
+                TInt aGain;
+                aGain = iCamc->GainL();
+                if ((aGain < 0) || (aGain >= 100))
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+
+            default:
+                break;
+            }
+
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+
+        switch (iAction)
+            {
+           
+            case K_Tc5_NumberOfMetaDataEntriesWhenNotRecording:
+                {
+                TInt aValue;
+                aValue = iCamc->NumberOfMetaDataEntriesL();
+                // aValue should always be 0.
+                if (aValue != 0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_MetaDataEntryWhenNotRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->MetaDataEntryL( 2 );
+                // There is a problem if we haven't left already
+                User::Leave(KErrExpectingADifferentValue);
+                break;
+                }
+
+            case K_Tc5_AddMetaDataEntryWhenNotRecording:
+                {
+                // 
+                iCamc->AddMetaDataEntryL( *iMMFMetaDataEntry );      
+                break;
+                }
+
+            case K_Tc5_RemoveMetaDataEntryWhenNotRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->RemoveMetaDataEntryL( 2 );
+                break;
+                }
+
+            case K_Tc5_ReplaceMetaDataEntryWhenNotRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->ReplaceMetaDataEntryL( 2, *iMMFMetaDataEntry );
+                break;
+                }
+
+            case K_Tc5_SetPriorityWhenNotRecording:
+                {
+                // Set Invalid Priority.
+                iCamc->SetPriorityL( EMdaPriorityMin-100,EMdaPriorityPreferenceTime );
+                break;
+                }
+ 
+            case K_Tc5_SetVideoFrameRateWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetVideoFrameRateL( TReal32(TC5_VIDEO_FRAME_RATE_WRONG) );
+                break;
+                }
+
+            case K_Tc5_SetVideoBitRateWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetVideoBitRateL( TC5_VIDEO_BIT_RATE_WRONG );
+                break;
+                }
+
+            case K_Tc5_SetAudioBitRateWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetAudioBitRateL( TC5_AUDIO_BIT_RATE_WRONG );
+                break;
+                }
+
+            case K_Tc5_SetAudioEnabledWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetAudioEnabledL( TC5_AUDIO_ENABLED );
+                break; 
+                }
+
+            case K_Tc5_SetVideoFrameSizeWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetVideoFrameSizeL( TC5_VIDEO_FRAME_SIZE_WRONG );
+                break;
+                }
+
+            case K_Tc5_SetMaxClipSizeLWhenNotRecording:
+                {
+                iCamc->SetMaxClipSizeL( -10 ); // A wrong value	              
+                break;
+                }
+
+            case K_Tc5_SetGainWhenNotRecording:
+                {
+                // 
+                iCamc->SetGainL( 1 );
+                break;
+                }
+
+            case K_Tc5_SetGainWhenNotRecordingAndSetWrong:
+                {
+                //
+                TInt aSetGain;
+                aSetGain = iCamc->MaxGainL();
+                RDebug::Print(_L("CCamcTest_5::SetGain2 MaxGain is %d "), aSetGain );
+                iCamc->SetGainL( aSetGain+1 );
+                break; 
+                }
+                
+            case K_Tc5_MaxGainWhenNotRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->MaxGainL();
+                RDebug::Print(_L("CCamcTest_5::MaxGain MaxGain is %d (Should be 0-100)"), aGain );
+                if ((aGain <= 0) || (aGain >= 100))
+                    {
+                    User::Leave(KErrExpectingADifferentValue);          
+                    }
+                break;
+                }
+
+            case K_Tc5_StopWhenNotRecording:
+                {
+                iCamc->Stop();
+                //iAction = K_Tc5_none;
+                break;
+                }
+            case K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4:
+                {
+                iCamc->SetVideoFrameSizeL( TC5_CIF_VIDEO_FRAME_SIZE );
+                break;
+                }
+
+            default:
+                break;
+            }
+
+        iCamc->Prepare();
+        }
+
+    else if ( iPrepareReady ) 
+
+        {      
+        TBool prepare = ETrue;
+        switch (iAction)
+            {
+            //Compare
+            case K_Tc5_SetAudioEnabledWhenOpenNotPrepared:
+                {
+                TInt aEnabled;
+                aEnabled = iCamc->AudioEnabledL();
+
+                TBool ok = TC5_AUDIO_ENABLED; // To avoid a warning.
+                if ( ( aEnabled && (!ok) ) || ( (!aEnabled) && ok ) ) 
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+
+                break;
+                }
+
+            //Compare
+            case K_Tc5_SetGainWhenNotRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->GainL();
+                RDebug::Print(_L("CCamcTest_5::SetGain1 Gain is %d (Should be 1)"), aGain );
+                // aSetGain should be the same with previously set 
+                if (aGain != 1)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+
+            case K_Tc5_StopWhenRecordingNewPrepareCorrect:
+                {
+                if ( iPrepare2ndTime )
+
+                    {
+                    // If we are here, the 2nd prepare was ready before the 
+                    // 2s timeout ---> Test passed
+                    iCamc->Stop();
+                    CActiveScheduler::Stop();
+                    prepare =EFalse;
+                    }
+                break;
+                }
+                
+            case K_Tc5_GetSupportedVideoTypesWhenOpenNotRecording:
+                {
+                CDesC8ArrayFlat * spprtVideoTypes = new (ELeave) CDesC8ArrayFlat (1);
+                CleanupStack::PushL(spprtVideoTypes);
+                iCamc->GetSupportedVideoTypesL( *spprtVideoTypes );
+                TInt index;
+                if (spprtVideoTypes->Count() < 2)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                if ( spprtVideoTypes->Find(_L8("video/H263-2000"), index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtVideoTypes->Find(_L8("video/H263-2000; profile=0") ,index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                CleanupStack::PopAndDestroy();
+                break;                
+                }
+                
+            case K_Tc5_GetSupportedVideoTypesWhenOpenNotRecordingNew:
+                {
+                CDesC8ArrayFlat * spprtVideoTypes = new (ELeave) CDesC8ArrayFlat (1);
+                CleanupStack::PushL(spprtVideoTypes);
+                iCamc->GetSupportedVideoTypesL( *spprtVideoTypes );
+                TInt index;
+                if (spprtVideoTypes->Count() < 4)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                if ( spprtVideoTypes->Find(_L8("video/H263-2000"), index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtVideoTypes->Find(_L8("video/H263-2000; profile=0") ,index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+
+                if ( spprtVideoTypes->Find(_L8("video/mp4v-es"), index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtVideoTypes->Find(_L8("video/mp4v-es; profile-level-id=8") ,index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                CleanupStack::PopAndDestroy();
+                break;
+                }
+            case K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAMR:
+                {
+                RArray<TFourCC> spprtAudioTypes;
+                spprtAudioTypes.Reset();
+                iCamc->GetSupportedAudioTypesL( spprtAudioTypes );
+                if (spprtAudioTypes.Count() != 1)
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                
+                if (spprtAudioTypes.Find(TC5_AUDIO_TYPE_1) == KErrNotFound )
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                spprtAudioTypes.Close();
+                break;                
+                }
+            case K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAAC:
+                {
+                RArray<TFourCC> spprtAudioTypes;
+                spprtAudioTypes.Reset();
+                iCamc->GetSupportedAudioTypesL( spprtAudioTypes );
+                if (spprtAudioTypes.Count() != 2)
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                if ( spprtAudioTypes.Find( TC5_AUDIO_TYPE_1 ) == KErrNotFound )
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtAudioTypes.Find( TC5_AUDIO_TYPE_3 ) == KErrNotFound )
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                spprtAudioTypes.Close();
+                break;                
+                }
+                
+            default:
+                break;
+            }
+        if (prepare)
+            {
+            iPrepareReady = EFalse;
+            iCamc->Record();
+            CTimer::After( iTimeout );
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+        switch (iAction)
+            {
+            
+            //Compare
+            case K_Tc5_SetGainWhenRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->GainL();
+                RDebug::Print(_L("CCamcTest_5::SetGain3 Gain is %d (Should be 1)"), aGain );
+                if (aGain != 1)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+            
+            default:
+                break;
+            }
+        iRecordingReady = EFalse;
+        iCamc->Close();
+        iClosed =1;
+        CTimer::After( 1000 );
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        CTimer::After(10 * TInt32 ( 1E6 ) ); // Continue recording for 10 seconds
+                                             // Then stop the recording
+        }
+    else //timer
+        {
+        TBool stopRecording = ETrue;
+
+        switch (iAction)
+            {
+            case K_Tc5_NumberOfMetaDataEntriesWhenRecording:
+                {
+                TInt aValue;
+                aValue = iCamc->NumberOfMetaDataEntriesL();
+                // aValue should always be 0.
+                if (aValue != 0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_MetaDataEntryWhenRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->MetaDataEntryL( 2 );  
+                // There is a problem if we haven't left already
+                User::Leave(KErrExpectingADifferentValue);       
+                break;
+                }
+
+            case K_Tc5_AddMetaDataEntryWhenRecording:
+                {
+                // 
+                iCamc->AddMetaDataEntryL( *iMMFMetaDataEntry );             
+                break;
+                }
+
+            case K_Tc5_RemoveMetaDataEntryWhenRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->RemoveMetaDataEntryL( 2 );
+                break;
+                }
+
+            case K_Tc5_ReplaceMetaDataEntryWhenRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->ReplaceMetaDataEntryL( 2, *iMMFMetaDataEntry );
+                break;
+                }
+
+            case K_Tc5_PauseWhenRecording:
+                {
+                iCamc->PauseL();
+                stopRecording = EFalse;
+                iAction=K_Tc5_none;     
+                CTimer::After(2 * TInt32 ( 1E6 ) ); // Pause for 2 seconds.
+                iPaused=ETrue;
+                break;
+                }
+
+            case K_Tc5_SetGainWhenRecording:
+                {
+                // 
+                iCamc->SetGainL( 1 );
+                break; 
+                }
+
+            case K_Tc5_MaxGainWhenRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->MaxGainL();
+                if ((aGain <= 0) || (aGain >= 100))
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+                
+            case K_Tc5_StopWhenRecording:
+                {
+                //iCamc->Stop();
+                stopRecording = ETrue;
+                //iAction = K_Tc5_none;
+                break;
+                }
+
+            case K_Tc5_StopWhenRecordingNewPrepareCorrect:
+                {
+                if ( iPrepare2ndTime )
+                    {
+                    // If we are here, the 2nd prepare was NOT ready before the 
+                    // 2s timeout ---> Test failed
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                stopRecording = ETrue;
+                break;
+                }
+
+            case K_Tc5_StopWhenRecordingAfterOpenFile:
+                {
+                //iCamc->Stop();
+                stopRecording = ETrue;
+                //iAction = K_Tc5_none;
+                break;
+                }
+            case K_Tc5_StopWhenRecordingAfterOpenFileNew:
+            case K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4:
+                {
+                //iCamc->Stop();
+                stopRecording = ETrue;
+                //iAction = K_Tc5_none;
+                break;
+                }
+            default:
+                break;
+            }
+        if (stopRecording)
+            {
+            
+            iCamc->Stop();
+            // Simulates that iRecording has been completed through the 
+            // MvruoRecordComplete callback
+            iRecordingReady=ETrue;
+            
+            switch (iAction)
+                {
+                case K_Tc5_StopWhenRecordingNewPrepareCorrect:
+                    {
+                    iCamc->Close();
+                    TUid controllerUid = {0x101F8503};	//implementation uid
+                    TUid formatUid = {0};
+                    TRAPD(err,iCamc->OpenFileL( _L("c:\\recordQCIF_2.3gp"), 
+                        iUiLevelCameraHandle, 
+                        controllerUid,
+                        formatUid ));
+                    
+                    User::LeaveIfError(err);
+
+                    CTimer::After(2 * TInt32 ( 1E6 ) ); // Wait 2 seconds
+                    iPrepare2ndTime = ETrue;
+                    break;
+                    }
+                    
+                default:
+                    {
+                    CTimer::After( 1000 );
+                    break;
+                    }
+                }
+            }    
+        
+        switch (iAction)
+            {
+            case K_Tc5_PauseWhenStopped:
+                {
+                iCamc->PauseL();
+                break;
+                }
+            default:
+                break;
+            }
+        }
+
+    }
+
+
+
+void CCamcTestClient_5::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+
+void CCamcTestClient_5::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_5::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_5::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_5::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_5::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_6.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1390 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_6.h"
+#include "badesca.h"
+#include "camctest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_6::CCamcTestClient_6 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_6::~CCamcTestClient_6 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_6* CCamcTestClient_6::NewL()
+    {
+    CCamcTestClient_6* self = new(ELeave) CCamcTestClient_6;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_6::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iResumeRecording = EFalse;
+    
+       CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_6::Start_Active_ObjectL ( TestClient6Actions aAction, TInt aCameraHandle )
+    {
+    
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    
+    switch ( iAction )
+        {
+        case K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+        case K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+        case K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+        case K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, camHandle, 
+                controllerUid,
+                formatUid ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            break;    
+            }
+            
+        case K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording :
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, camHandle, 
+                controllerUid,
+                formatUid,
+                _L8("") ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            break;   
+            }
+            
+        default:
+            {
+            switch ( iAction )
+                {
+                case K_Tc6_ControllerImplementationInformationWhenNotOpen:
+                    {
+                    iCamc->ControllerImplementationInformationL();
+                    // Test case should have left already.    
+                    
+                    // There is a problem if we haven't left already
+                    User::Leave(KErrCorrupt);
+                    break;
+                    }
+                case K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat:
+                    {
+                    TFileName file;
+                    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+                    TRAPD(err,
+                        iCamc->OpenFileL( file, camHandle, 
+                        controllerUid,
+                        formatUid,
+                        _L8("video/mp4v-es"),
+                        TFourCC(' ', 'A', 'M', 'R') ));
+                    
+                    if (err)
+                        {
+                        User::Leave(99);
+                        }
+                    break;
+                    }
+                case K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4:
+                case K_Tc6_SetVideoTypeLWithProfile3:
+                    {
+                    TFileName file;
+                    AddDriveLetterToPath(_L("recordQCIF.mp4"),file);
+                    TRAPD(err,
+                        iCamc->OpenFileL( file, camHandle, 
+                        controllerUid,
+                        formatUid,
+                        _L8("video/mp4v-es; profile-level-id=3"),
+                        TFourCC(' ', 'A', 'M', 'R') ));
+                    
+                    if (err)
+                        {
+                        User::Leave(99);
+                        }
+                    break;
+                    }
+
+                default:
+                    {
+                    TFileName file;
+                    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+                    TRAPD(err,
+                        iCamc->OpenFileL( file, camHandle, 
+                        controllerUid,
+                        formatUid,
+                        _L8("video/H263-2000"),
+                        TFourCC(' ', 'A', 'M', 'R') ));
+                    
+                    if (err)
+                        {
+                        User::Leave(99);
+                        }
+                    break;
+                    }
+                }
+/*            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, camHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }*/
+            }
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_6::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_6::RunLTrappedL()
+    {
+    
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(EFalse); 
+        
+        TBool prepare = ETrue;
+        switch ( iAction )
+            {
+            case K_Tc6_SetAudioEnabledLWhenControllerReady :
+                {
+                iCamc->SetAudioEnabledL( ETrue );	
+                break;
+                }
+            case K_Tc6_SetMaxClipSizeLWhenControllerReady :
+                {
+                // -55 is invalide size
+                iCamc->SetMaxClipSizeL( -55 );	
+                
+                // Should have left already
+                // Don't go on, to prevent a panic
+                User::Leave(K_Tc6_ErrExpectingToLeave);
+                break;
+                }                
+            case K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecording :   
+                {
+                
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }
+            case K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat :   
+                {
+                
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW] = TC6_VIDEO_TYPES_ARRAY_NEW ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }
+            case K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+            case K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording :
+                {
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }
+                
+            case K_Tc6_AudioTypeLWhenOpenWithfourCCAndNotRecording :
+            case K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+                {
+                TFourCC expectedAudioType = TFourCC( ' ', 'A', 'M', 'R' );
+                TFourCC returnedAudioType = iCamc->AudioTypeL(  );
+                if (expectedAudioType != returnedAudioType)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }                           
+            case K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording:
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE );
+                break;
+                }                
+            case K_Tc6_SetVideoTypeLWhenNotRecording :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_WRONG );
+                break;
+                }               
+            case K_Tc6_SetVideoTypeLWithProfile :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_PROFILE0 );
+                break;
+                }         
+            case K_Tc6_SetVideoTypeLWithProfile8 :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_PROFILE8 );
+
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW] = TC6_VIDEO_TYPES_ARRAY_NEW ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                
+                break;
+                }         
+            case K_Tc6_SetVideoTypeLWithProfile3 :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_PROFILE3 );
+
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW] = TC6_VIDEO_TYPES_ARRAY_NEW ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                
+                // set CIF size since level = 3
+                iCamc->SetVideoFrameSizeL( TC6_CIF_VIDEO_FRAME_SIZE );
+
+                break;
+                }         
+            case K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+                {
+                iCamc->SetAudioTypeL( TC6_AUDIO_TYPE );
+                break;
+                }       
+            case K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC :
+                {
+                iCamc->SetAudioTypeL( TC6_AAC_AUDIO_TYPE );
+                break;
+                }            
+            case K_Tc6_SetAudioTypeLWhenNotRecording :
+                {
+                iCamc->SetAudioTypeL( TC6_AUDIO_TYPE_WRONG );
+                break;
+                }
+            case K_Tc6_ControllerImplementationInformationWhenOpen:
+                { 
+                const CMMFControllerImplementationInformation & returnedResult = iCamc->ControllerImplementationInformationL();
+                CheckControllerImplementationInformationL ( returnedResult ); 
+                break;
+                }
+            case K_Tc6_ControllerImplementationInformationWhenOpenNew:
+                { 
+                const CMMFControllerImplementationInformation & returnedResult = iCamc->ControllerImplementationInformationL();
+                CheckControllerImplementationInformationNewL ( returnedResult ); 
+                break;
+                }
+            case K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4:
+                { 
+                const CMMFControllerImplementationInformation & returnedResult = iCamc->ControllerImplementationInformationL();
+                CheckControllerImplementationInformationNewMPEG4L ( returnedResult ); 
+
+                // set CIF size since level = 3
+                iCamc->SetVideoFrameSizeL( TC6_CIF_VIDEO_FRAME_SIZE );
+
+                break;
+                }
+            case K_Tc6_DurationWhenRecording:
+                {
+                // Use a more realistic frame rate
+                // The duration test is quite affected by AO scheduling.
+                iCamc->SetVideoFrameRateL(TReal32(5));
+#if ( defined ( __WINS__ ) || defined ( __WINSCW__) )
+                // Give some help to the wins case.
+                iCamc->SetAudioEnabledL(EFalse); 
+#endif
+                break;
+                }
+
+            default:
+                break;
+            }
+            if ( prepare )           
+                {
+                iCamc->Prepare();
+                }
+        }
+        else if ( iPrepareReady ) 
+            {    
+            switch (iAction)
+                {
+                case K_Tc6_SetAudioEnabledLWhenControllerReady :
+                    {
+                    //Compare
+                    TBool aAudioEnabled;
+                    aAudioEnabled = iCamc->AudioEnabledL();
+                    //aSetAudioEnable should be the same with previously set
+                    if (!aAudioEnabled )
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }
+                case K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+                    //Compare
+                    {
+                    TPtrC8 returnedSetVideoType = iCamc->VideoFormatMimeType();
+                    TBool found = 0;
+                    TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                    for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                        {
+                        if (expectedVideoType[i] == returnedSetVideoType)
+                            {
+                            found = 1;
+                            }
+                        }
+                    if (!found)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    
+                    break;
+                    }                
+                case K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+                    //Compare
+                    {
+                    TFourCC returnedSetAudioType;
+                    returnedSetAudioType = iCamc->AudioTypeL( );
+                    if (returnedSetAudioType != TC6_AUDIO_TYPE)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }               
+                case K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC :
+                    //Compare
+                    {
+                    TFourCC returnedSetAudioType;
+                    returnedSetAudioType = iCamc->AudioTypeL( );
+                    if (returnedSetAudioType != TC6_AAC_AUDIO_TYPE)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }
+                case K_Tc6_DurationWhenNotRecording:
+                    {
+                    TTimeIntervalMicroSeconds aValue = iCamc->DurationL();
+                    TTimeIntervalMicroSeconds expected (0);
+                    //aValue should always be 0. 
+                    if (aValue != expected)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }
+                default:
+                    break;
+                }
+            
+            switch (iAction)
+                {   
+                case K_Tc6_SetMaxClipSizeLWhenPrepareReady :
+                    {
+                    iCamc->SetMaxClipSizeL( TC6_FILE_SIZE_LIMIT );	
+                    iAction = K_Tc6_none;
+                    iCamc->Prepare();
+                    break;
+                    }
+                case K_Tc6_RecordWhenPrepareComplete:
+                    {
+                    iPrepareReady = EFalse;
+                    iCamc->Record();
+                    break;
+                    }
+                case K_Tc6_DurationWhenPaused:
+                    {
+                    iPrepareReady = EFalse;
+                    iCamc->Record();
+                    CTimer::After(5 * TInt32 ( 1E6 ) ); // Record for 5 seconds.
+                    break;
+                    }
+                default:
+                    {
+                    iPrepareReady = EFalse;
+                    iCamc->Record();
+                    if (iSavedAction != K_Tc6_SetMaxClipSizeLWhenPrepareReady)
+                        {
+                        CTimer::After( iTimeout );
+                        }
+                    }
+                }
+        }
+        
+        else if ( iRecordingReady )
+            {
+            switch (iAction)
+                {
+                case K_Tc6_PauseWhenStopped:
+                    {
+                    iCamc->PauseL();
+                    iAction = K_Tc6_none;
+                    break;
+                    }
+                default:   
+                    iRecordingReady = EFalse;                    
+                    iCamc->Close();
+                    iClosed = ETrue;
+                }
+            CTimer::After( 1000 );        
+            }
+        
+        else if ( iPaused ) //resume
+            {
+            switch (iAction)
+                {
+                case K_Tc6_SetVideoFrameSizeLWhenPaused:
+                    {
+                    iCamc->SetVideoFrameSizeL( TC6_VIDEO_FRAME_SIZE );
+                    break;
+                    }
+                case K_Tc6_RecordWhenPaused:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    iPaused = EFalse;
+                    iAction = K_Tc6_none;         
+                    break;
+                    }
+                case K_Tc6_DurationWhenPaused:
+                    {
+                    iNumberOfTimeAsked++;
+                    TTimeIntervalMicroSeconds timeDuration = iCamc->DurationL();                   
+                    if (( iNumberOfTimeAsked != 0) && (iOldDuration > timeDuration))
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    
+                    if (iNumberOfTimeAsked <3)
+                        {
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );
+                        }
+                    else
+                        {
+                        iPaused = EFalse;
+                        iCamc->Record();
+                        iResumeRecording = ETrue;
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );  
+                        }
+                    iOldDuration = timeDuration;
+                    break;
+                    }
+                default:
+                    iPaused = EFalse;
+                    iCamc->Record();
+                }
+            }
+        
+        else //timer
+            {
+            switch (iAction)
+                {
+                case K_Tc6_SetVideoFrameSizeLWhenPaused:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_Tc6_RecordWhenPaused:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_Tc6_VideoTypeLWhenOpenWithMimeAndRecording :
+                    {
+                    TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                    TBool found = 0;
+                    TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                    for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                        {
+                        if (expectedVideoType[i] == returnedVideoType)
+                            {
+                            found = 1;
+                            }
+                        }
+                    if (!found)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    
+                    
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    iAction = K_Tc6_none; 
+                    break;
+                    }               
+                case K_Tc6_AudioTypeLWhenOpenWithfourCCAndRecording :
+                    {
+                    TFourCC expectedAudioType = TFourCC( ' ', 'A', 'M', 'R' );
+                    TFourCC returnedAudioType = iCamc->AudioTypeL(  );
+                    if (expectedAudioType != returnedAudioType)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    iAction = K_Tc6_none; 
+                    break;
+                    }
+                case K_Tc6_DurationWhenRecording:
+                    {
+                    TTimeIntervalMicroSeconds timeDuration = iCamc->DurationL();                   
+#ifdef _DEBUG
+                    TBuf<128> str;
+                    str.Format(_L("Asking for time duration %i:%i"), I64HIGH(timeDuration.Int64()),
+                        I64LOW(timeDuration.Int64()));
+                    RDebug::Print(str);    
+#endif
+                    if (( iNumberOfTimeOut != 0) && (iOldTimeDuration > timeDuration))
+                        {
+                        RDebug::Print(_L("Leaving because not increasing"));
+                        User::Leave(K_Tc6_ValueNotIncreasingErr);
+                        }
+                    
+                    TInt64 expected_duration;
+                    TTime time;
+                    time.UniversalTime(); // Get the real elapsed time
+                    
+                    if (iNumberOfTimeOut == 0)
+                        {
+                        // First wait period is 1.5 seconds.
+                        // The AO are quite inaccurate, especially at the beginning
+                        // We don't check the first run.
+                        }
+                    else
+                        {
+                        // Next wait period are 1 seconds
+                        // But are not accurate, because of low AO priority.
+                        TInt64 delta_time  = time.Int64() - iPreviousTime ;
+                        expected_duration = iOldTimeDuration.Int64() + delta_time;
+                        
+                        TTimeIntervalMicroSeconds kTimeLimit( expected_duration );
+                       
+                        TTimeIntervalMicroSeconds kTimeMargin( 300000 ); //0.3 second
+                        
+                        if ( ( timeDuration > kTimeLimit.Int64() + kTimeMargin.Int64() ) ||
+                            ( timeDuration < kTimeLimit.Int64() - kTimeMargin.Int64() ) ) 
+                            {     
+                            RDebug::Print(_L("Leaving because not within margins"));
+                            TBuf<128> aBuf;
+                            aBuf.Format(_L("Actually elapsed time since last call: %i \nexpected duration: %i:%i "),
+                                I64LOW(delta_time),I64HIGH(expected_duration),
+                                I64LOW(expected_duration));
+                            RDebug::Print(aBuf);
+                            User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+                            }
+                        }
+                    
+                    
+                    iPreviousTime = time.Int64();
+                    iOldTimeDuration = timeDuration;
+                    
+                    
+                    if (iNumberOfTimeOut >20)
+                        {
+                        iCamc->Stop();
+                        // Simulates that iRecording has been completed through the 
+                        // MvruoRecordComplete callback
+                        iRecordingReady=ETrue;				
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );
+                        }
+                    else
+                        {
+                        // Wait  a second and ask for the duration again.
+                        CTimer::After( 1 * TInt32 ( 1E6 ) ); /* a second */
+                        }
+                    iNumberOfTimeOut++;
+                    break;
+                    }
+                case K_Tc6_DurationWhenPaused:
+                    {
+                    if (iResumeRecording)
+                        {
+                        TTimeIntervalMicroSeconds timeDuration = iCamc->DurationL();                   
+                        #ifdef _DEBUG
+                        TBuf<128> str;
+                        str.Format(_L("Time duration %x:%i"), I64HIGH(timeDuration.Int64()),
+                            I64LOW(timeDuration.Int64()));
+                        RDebug::Print(str);    
+                        #endif
+
+                        TInt64 delta_time = 1E6;
+                       
+                        TInt64 expected_duration = iOldDuration.Int64() + delta_time;
+                        
+                        TTimeIntervalMicroSeconds kTimeLimit( expected_duration );
+                       
+                        TTimeIntervalMicroSeconds kTimeMargin( 300000 ); //0.3 second
+                        
+                        if ( ( timeDuration > kTimeLimit.Int64() + kTimeMargin.Int64() ) ||
+                           ( timeDuration < kTimeLimit.Int64() - kTimeMargin.Int64() ) ) 
+                            { 
+                            User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+                            }            
+                        
+                        iAction = K_Tc6_none; 
+                        iCamc->Stop();
+                        iRecordingReady=ETrue;				
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );
+                        }
+                    else
+                        {
+                        iCamc->PauseL();
+                        iRecordingReady = EFalse;
+                        CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause for 5 seconds.
+                        iPaused=ETrue;
+                        iResumeRecording = EFalse;
+                        }
+                    break;
+                    }
+                default:
+                    iCamc->Stop();
+                    // Simulates that iRecording has been completed through the 
+                    // MvruoRecordComplete callback
+                    iRecordingReady=ETrue;				
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+            }
+        }
+        
+        if ( iClosed )
+            {
+            iCamc->Stop();
+            CActiveScheduler::Stop();
+            }
+        
+    }
+    
+void CCamcTestClient_6::CheckControllerImplementationInformationL(const CMMFControllerImplementationInformation & aReturnedResult )
+    {
+    // Check if returned controller implementation information correspond
+    // to what we expect
+    
+    
+    // Check for the supported play formats:
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.PlayFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    // Video recorder doesn't support any Play formats.
+    if ( nbItems != 0 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    // Check for the supported Recorded Formats
+        
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.RecordFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    if ( nbItems !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    TBuf<100> name;
+    // Format name
+    name = formatArray[0]->DisplayName();
+    if ((name != _L("3GPP File Format")))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format UID
+    name = formatArray[0]->Uid().Name();
+    if (name != _L("[101f8504]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format Supplier   
+    name = formatArray[0]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    //Format Version
+    if (formatArray[0]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    // Supported Medias UID by the Format
+    {
+        
+    const RArray<TUid> & supportedUids = formatArray[0]->SupportedMediaIds();
+    // Only one format UID is currently supported
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    
+    //Supported Files extensions
+    {
+    const CDesC8Array & names =
+        formatArray[0]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3gp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    //Supported Mime types
+    {
+    const CDesC8Array & names =
+        formatArray[0]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }   
+    }
+}
+    
+   
+void CCamcTestClient_6::CheckControllerImplementationInformationNewL(const CMMFControllerImplementationInformation & aReturnedResult )
+    {
+    // Check if returned controller implementation information correspond
+    // to what we expect
+    
+    
+    // Check for the supported play formats:
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.PlayFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    // Video recorder doesn't support any Play formats.
+    if ( nbItems != 0 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    // Check for the supported Recorded Formats
+        
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.RecordFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    if ( nbItems !=2 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    TBuf<100> name;
+    // Format name
+    name = formatArray[0]->DisplayName();
+    if ((name != _L("3GPP File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->DisplayName();
+    if ((name != _L("3GPP2 File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format UID
+    name = formatArray[0]->Uid().Name();
+    if (name != _L("[101f8504]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = formatArray[1]->Uid().Name();
+//    if (name != _L("[101F86D6]"))
+//        {
+//        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+//        }
+    
+    //Format Supplier   
+    name = formatArray[0]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    //Format Version
+    if (formatArray[0]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    if (formatArray[1]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+ 
+    
+    // Supported Medias UID by the Format
+    {        
+    const RArray<TUid> & supportedUids = formatArray[0]->SupportedMediaIds();
+    // 3gpp
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    {
+    const RArray<TUid> & supportedUids = formatArray[1]->SupportedMediaIds();
+    // 3gpp2
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    
+
+    //Supported Files extensions
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3gp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3g2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+
+    
+    //Supported Mime types
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }  
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }  
+
+    }
+}
+    
+   
+void CCamcTestClient_6::CheckControllerImplementationInformationNewMPEG4L(const CMMFControllerImplementationInformation & aReturnedResult )
+    {
+    // Check if returned controller implementation information correspond
+    // to what we expect
+    
+    
+    // Check for the supported play formats:
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.PlayFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    // Video recorder doesn't support any Play formats.
+    if ( nbItems != 0 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    // Check for the supported Recorded Formats
+        
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.RecordFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    if ( nbItems !=3 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    TBuf<100> name;
+    // Format name
+    name = formatArray[0]->DisplayName();
+    if ((name != _L("3GPP File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->DisplayName();
+    if ((name != _L("3GPP2 File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+ 
+    name = formatArray[2]->DisplayName();
+    if ((name != _L("MPEG-4 File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format UID
+    name = formatArray[0]->Uid().Name();
+    if (name != _L("[101f8504]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = formatArray[1]->Uid().Name();
+    name = formatArray[2]->Uid().Name();
+//    if (name != _L("[101F86D6]"))
+//        {
+//        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+//        }
+    
+    //Format Supplier   
+    name = formatArray[0]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    name = formatArray[2]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    //Format Version
+    if (formatArray[0]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    if (formatArray[1]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+ 
+    if (formatArray[2]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    // Supported Medias UID by the Format
+    {        
+    const RArray<TUid> & supportedUids = formatArray[0]->SupportedMediaIds();
+    // 3gpp
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    {
+    const RArray<TUid> & supportedUids = formatArray[1]->SupportedMediaIds();
+    // 3gpp2
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    {
+    const RArray<TUid> & supportedUids = formatArray[2]->SupportedMediaIds();
+    // mp4
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    
+
+    //Supported Files extensions
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3gp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3g2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    {
+    // mp4
+    const CDesC8Array & names =
+        formatArray[2]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".mp4"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+
+    
+    //Supported Mime types
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }  
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }  
+    {
+    // mp4
+    const CDesC8Array & names =
+        formatArray[2]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/mp4"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }  
+
+    }
+}
+
+void CCamcTestClient_6::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_6::MvruoOpenComplete( TInt aError )
+    {
+    
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_6::MvruoPrepareComplete( TInt aError )
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_6::MvruoRecordComplete( TInt aError )
+    {
+    
+    if (iAction == K_Tc6_RecordWhenPrepareComplete )
+        {
+        if ( (aError ==  KErrDiskFull) || (aError == KErrCompletion ) ) 
+            {
+            // KErrCompletion if there is more space than needed for 60 min recording.
+            // Otherwise KErrDiskFull
+            aError = KErrNone;
+            }
+        else
+            {
+            aError = KErrGeneral;
+            }
+        }
+    
+    if ( ( aError ) && ( aError != KErrCompletion ) )
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_6::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_6::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+    
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_7.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,588 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_7.h"
+#include "camctest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_7::CCamcTestClient_7 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_7::~CCamcTestClient_7 ()
+    {
+    Cancel();
+    
+    delete iWaitScheduler;
+    delete iCamc;   
+    iCamc = NULL;
+    delete iCamera;
+    iCamera= NULL;
+    delete iCamera2;
+    iCamera2= NULL;
+    }
+
+CCamcTestClient_7* CCamcTestClient_7::NewL()
+    {
+    CCamcTestClient_7* self = new(ELeave) CCamcTestClient_7;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_7::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    // It takes some time to free the camera.
+    // Wait that it is free.
+    TInt err;
+    do
+        {
+        // Create a new Camera API implementation object, if supported
+        TRAP( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+        if ( err == KErrNotSupported )
+            {
+            PRINT( ( _L( "CCamcTestClient_7::ConstructL() CCamera::New2L return code=%d" ), err ) ); 
+
+            // Create old Camera API implementation object.
+            TRAP( err, iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ ) );
+            }
+        else if ( !err )
+            {
+            PRINT( ( _L( "CCamcTestClient_7::ConstructL() using new MCameraObserver2" )) ); 
+            }
+        }
+        while (err != KErrNone);
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_7::Start_Active_ObjectL ( TestClient_7_Actions aAction )
+    {
+    
+    // This reserve the camera, starts the active object.
+
+    iAction = aAction;    //iAction might be set to NULL after action has been executed
+    //	iTimeout = aTimeout;
+    iTimeout = (TInt) 1E6; /* 1 Second */
+    
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+    // Reserve the Camera.
+    iCamera->Reserve();
+	iWaitScheduler->Start();
+    
+    RDebug::Print(_L("CamcTest_7::Start_Active_ObjectL PowerOn Completed starting CActiveScheduler") );
+    CActiveScheduler::Start();
+    
+
+    // The Active Scheduler has finished.
+    // Any Errors?
+
+    if (iError)
+        {
+        RDebug::Print(_L("CamcTest_7::Start_Active_ObjectL leaves with %d"), iError);
+        User::Leave(iError);
+        }
+    }
+
+
+void CCamcTestClient_7::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        RDebug::Print(_L("CamcTest_7::RunTrappedL leaves with %d"), err);
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_7::RunLTrappedL()
+    {
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+
+        RDebug::Print(_L("iCamc->Prepare1"));
+        iCamc->Prepare();
+        }
+    else if ( iPrepareReady ) 
+        {
+        RDebug::Print(_L("iCamc->Record1"));
+        iPrepareReady = EFalse;
+        iCamc->Record();
+        CTimer::After( iTimeout );
+        }
+    
+    else if ( iRecordingReady )
+        {
+        RDebug::Print(_L("CamcTest_7::RunTrapped iRecordingReady") );
+        iRecordingReady = EFalse;
+        
+        iClosed=1;
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        RDebug::Print(_L("iCamc->Record1"));
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        
+        switch(iAction)
+            {
+            case K_Tc7_ReleaseCameraWhileRecording:
+                {
+                // We are now recording
+                iCamera->Release();
+                iAction = K_Tc7_none;
+                CTimer::After( (TInt) 10E6 );
+                break;
+                }
+            case K_Tc7_PowerOffCameraWhileRecording:
+                {
+                // We are now recording
+                RDebug::Print(_L("Powering off the camera"));
+                iCamera->PowerOff();
+                iAction = K_Tc7_none;  
+                CTimer::After( (TInt) 20E6 );
+                break;
+                }
+            case K_Tc7_ReleaseCameraCloseRecorderUseCamera:
+                {
+                // We are now recording
+                switch(iCameraReleasedState)
+                    {       
+                    case ENothingReleased:
+                        {
+                        iCamera->Release();
+                        CTimer::After( (TInt) 1E6 );
+                        iCameraReleasedState = ECameraReleased;
+                        break;    
+                        }
+                    case ECameraReleased:
+                        {
+                        iCamc->Close();   
+                        CTimer::After( (TInt) 1E6 );
+                        iCameraReleasedState = ECamcStopped;
+                        break;                   
+                        }
+                    case ECamcStopped:
+                        {
+                        // Try to use the camera   
+                        // Create a new Camera API implementation object, if supported
+                        TRAPD( err, iCamera2 = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+                        if ( err )
+                            {
+                            PRINT( ( _L( "CCamcTestClient_7::RunLTrappedL() CCamera::New2L return code=%d" ), err ) ); 
+
+                            // Create old Camera API implementation object.
+                            iCamera2 = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+                            }
+                        else 
+                            {
+                            PRINT( ( _L( "CCamcTestClient_7::RunLTrappedL() using new MCameraObserver2" )) ); 
+                            }
+                        iCamera2->Reserve();
+                        iAction = K_Tc7_none;
+                        break;
+                        }
+                    default:
+                        break;
+                    }
+                break;
+                }
+
+            default:
+                {
+                RDebug::Print(_L("CamcTest_7::RunTrappedL default"));
+                iCamc->Close();
+                // Simulates that iRecording has been completed through the 
+                // MvruoRecordComplete callback
+                iRecordingReady=ETrue;	
+                iCamera->Release();
+                CTimer::After( (TInt) 1E6 );
+                }
+            }
+        
+
+        
+        }
+    
+    
+    if ( iClosed )
+        {
+        RDebug::Print(_L("CamcTest_7::RunTrappedL iClosed"));
+        iCamc->Close();
+        CActiveScheduler::Stop();
+        }
+    }
+
+
+
+void CCamcTestClient_7::DoCancel()
+    {
+    RDebug::Print(_L("CamcTest_7::DoCancel") );
+    iCamc->Stop();
+    iCamc->Close();
+    //delete iCamc;
+    //iCamc = NULL;
+    }
+
+////////////////////////////////////////////////////////
+// MVideoRecorderUtilityObserver Callback functions
+
+void CCamcTestClient_7::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {
+        RDebug::Print(_L("CamcTest_7::MvruoOpenComplete leaves with %d"), aError );        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_7::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         RDebug::Print(_L("CamcTest_7::MvruoPrepareComplete leaves with %d"), aError );
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_7::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         RDebug::Print(_L("CamcTest_7::MvruoRecordComplete leaves with %d"), aError );
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_7::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+
+////////////////////////////////////////////////////////
+// MCameraObserver Callback functions
+
+
+void CCamcTestClient_7::ReserveComplete(TInt aError)
+    {
+
+    // The Camera is now reserved for us.
+
+    if (aError)
+        {
+            SomethingInActiveObjectIsLeaving(aError);  
+        }
+
+    if (iCamera2 && iWaitScheduler->IsStarted())
+        {
+        iCamera2->PowerOn();
+        }
+    else if (iCamera && iWaitScheduler->IsStarted())
+        {
+        iCamera->PowerOn();
+        }
+    
+    }
+
+void CCamcTestClient_7::PowerOnComplete(TInt aError)
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	}  
+    	     
+    // If no errors, continue tests.
+    switch(iAction)
+        {
+        case K_Tc7_ReleaseCameraWhileRecording:
+        case K_Tc7_PowerOffCameraWhileRecording: 
+        case K_Tc7_ReleaseCameraCloseRecorderUseCamera:
+            {
+              
+            RDebug::Print(_L("CamcTest_7::case1 OpenFileL in"));
+            // Start the Camcorder.
+            TUid controllerUid = {TC7_CONTROLLER_UID};	
+            TUid formatUid = {TC7_VIDEO_FORMAT_UID};
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err, iCamc->OpenFileL(
+                file,	                     	// File
+                iCamera->Handle(),				//CameraHandle
+                controllerUid,					//Controller UID
+                formatUid						//Format UID
+                ));
+
+            if (err)
+                {
+                RDebug::Print(_L("CamcTest_7::case1 OpenFileL leaves with %d"), err); //FIXME
+                SomethingInActiveObjectIsLeaving(err);
+                }
+            RDebug::Print(_L("CamcTest_7::case1 OpenFileL out"));
+            break;
+            }
+        case K_Tc7_OpenFileWhenCameraIsNotAvailable:
+            {  
+           
+            // Start the Camcorder.
+            TUid controllerUid = {TC7_CONTROLLER_UID};	
+            TUid formatUid = {TC7_VIDEO_FORMAT_UID};
+   
+            RDebug::Print(_L("CamcTest_7::case2 OpenFileL in"));
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err, iCamc->OpenFileL(
+                file,	
+                0,			    // CameraHandle = 0 ==> Get a valid camera
+                                // There shouldn't be any left.
+                controllerUid,					
+                formatUid						
+                ));
+
+            if (err)
+                {
+                RDebug::Print(_L("CamcTest_7::case2 OpenFileL leaves with %d"), err); //FIXME
+                SomethingInActiveObjectIsLeaving(err);
+                }
+            RDebug::Print(_L("CamcTest_7::case2 OpenFileL out"));
+            break;
+            }
+        case K_Tc7_OpenFileWithVideoFormatNULL :
+            {
+            // Start the Camcorder.
+            TUid controllerUid = {TC7_CONTROLLER_UID};	
+   
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err, iCamc->OpenFileL(
+                file,	
+                 iCamera->Handle(),			 
+                controllerUid,					
+                KNullUid	  // VideoFormat NULL					
+                ));
+
+            if (err)
+                {
+                    SomethingInActiveObjectIsLeaving(err);
+                }
+
+            break;
+            }
+        default:
+            CTimer::After( (TInt) 1E6 );   
+        }
+        
+        
+    }
+void CCamcTestClient_7::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {    
+
+    // do nothing Here
+    }
+void CCamcTestClient_7::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt aError)
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+
+    // If no errors, do nothing
+    }
+void CCamcTestClient_7::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt aError )
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    
+    // If no errors, do nothing
+    }
+
+
+void CCamcTestClient_7::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTestClient_7::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTestClient_7::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTestClient_7::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTestClient_7::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTestClient_7::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTestClient_7::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTestClient_7::VideoBufferReady() returning" )));
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_8.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,498 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_8.h"
+#include <e32def.h>
+#include <AudioPreference.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+CCamcTestClient_8::CCamcTestClient_8 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_8::~CCamcTestClient_8 ()
+    {
+    Cancel();
+
+    delete iCamc;   
+    }
+
+CCamcTestClient_8* CCamcTestClient_8::NewL(const TDesC &aFileName, TInt *aError ,
+                                           TInt * aNumberOfOpenedCamc, TInt aCameraHandle )
+    {
+    CCamcTestClient_8* self = new(ELeave) CCamcTestClient_8;
+    CleanupStack::PushL(self);
+    self->ConstructL( aFileName, aError , aNumberOfOpenedCamc, aCameraHandle );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_8::ConstructL( const TDesC &aFileName , TInt *aError ,
+                                   TInt * aNumberOfOpenedCamc, TInt aCameraHandle )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iError = aError;
+
+    // Start the Camcorder.
+    TUid controllerUid = {TC8_CONTROLLER_UID};	
+    TUid formatUid = {TC8_VIDEO_FORMAT_UID};
+    iFileName = aFileName;
+    iNumberOfOpenedCamc = aNumberOfOpenedCamc;
+    // Register to the number of openCam
+    (*aNumberOfOpenedCamc)++; 
+
+    iCamc->OpenFileL(
+        aFileName,		                //File
+        aCameraHandle,				     //CameraHandle
+        controllerUid,					//Controller UID
+        formatUid						//Format UID
+        );
+
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_8::Start_Active_Object ( TestClient_8_Actions aAction,
+                                            CCamcTestClient_8 * aClient )
+    {
+    
+    // This reserve the camera, starts the active object.
+
+    iAction = aAction;    //iAction might be set to NULL after action has been executed
+    //	iTimeout = aTimeout;
+    iTimeout = (TInt) 1E6; /* 1 Second */
+
+    iOtherClient = aClient;
+
+    }
+
+
+void CCamcTestClient_8::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_8::RunLTrappedL()
+    {
+    TBool closeNow = EFalse;
+    TBuf<128> str;
+    str = iFileName;
+    if ( iOpenReady ) 
+        {         
+#ifdef _DEBUG
+        str.Append(_L(": Opened"));
+        RDebug::Print(str); 
+#endif
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+
+        switch (iAction)
+            {  
+            case K_Tc8_MultipleInstance002_AO2:
+                {
+                // Wait that the instance 1 is in prepared state.
+                WaitForOtherObject();
+                break;
+                }
+            case K_Tc8_MultipleInstance004_AO2:
+                {
+                // Wait that the instance 1 is recording
+                WaitForOtherObject();
+                break;
+                }
+            case K_Tc8_MultipleInstance005_AO2:
+                {
+                // Wait that the instance 1 has finished recording
+                WaitForOtherObject();
+                break;          
+                }
+            case K_Tc8_MultipleInstance006_AO2:
+                {
+                // Wait that the instance 1 is in paused state
+                WaitForOtherObject();
+                break;
+                }
+            default:
+                {
+                iCamc->Prepare();   
+                break;
+                }
+            }
+        }
+    else if ( iPrepareReady ) 
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Prepared"));
+        RDebug::Print(str); 
+#endif
+        iPrepareReady = EFalse;
+
+        switch (iAction)
+             {
+            case K_Tc8_MultipleInstance001_AO1:   
+            case K_Tc8_MultipleInstance002_AO1: 
+            case K_Tc8_MultipleInstance003_AO1:
+                {
+                // Wait forever in that state.
+                ReachedWaitingState();
+                break;           
+                }
+            case K_Tc8_MultipleInstance001_AO2:
+                {
+                // If both instance are prepared, test is passed.
+                WaitForOtherObject();
+                break;
+                }
+            default:
+                {
+                // Start recording
+                iCamc->Record();
+                CTimer::After( 5 * TInt(1E6) );
+                }
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Recording Ready"));
+        RDebug::Print(str); 
+#endif
+        iRecordingReady = EFalse;
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance005_AO1:  
+                {
+                if (!iRecordingReadyTimer)
+                    {
+                    RDebug::Print(_L("CamcTest_8::Multiple5 iRecordingReady in"));
+                    // It takes some time to free the camera.
+                    // Give 10 seconds 
+                      iRecordingReady = ETrue;  
+                      iRecordingReadyTimer = ETrue;
+                      CTimer::After ( 10 * TInt (1E6) );
+                    }
+                else
+                    {
+                    RDebug::Print(_L("CamcTest_8::Multiple5 ReachedWaitingState in"));
+                    // Wait forever
+                    ReachedWaitingState();   
+                    }
+                break; 
+                }
+            default:
+                break;
+            }
+        }
+    else if ( iPaused ) //resume
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Paused"));
+        RDebug::Print(str); 
+#endif
+        iPaused = EFalse;
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance006_AO1:
+                {
+                // Wait forever in that state.
+                ReachedWaitingState();
+                break;     
+                }
+            default:
+                {
+                iCamc->Record();
+                break;
+                }
+            }
+        }
+    else if (  iEmittedRequest )
+        {       
+#ifdef _DEBUG
+        str.Append(_L(": Waiting is over"));
+        RDebug::Print(str); 
+#endif
+        // The request has been fulfilled
+        iEmittedRequest = EFalse;
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance002_AO2:
+                {
+                // Instance 1 has reached the prepared state.
+                // Close both.
+                iOtherClient->Close();
+                closeNow = ETrue;
+                break;          
+                }
+            case K_Tc8_MultipleInstance004_AO2:
+                {
+                // Instance 1 is now recording.
+                // Prepare the 2nd camcorder.
+                iCamc->Prepare();
+                break;
+                }
+            case K_Tc8_MultipleInstance005_AO2:
+                {
+                // Instance 1 has finished recording.
+                // Prepare the 2nd camcorder.
+                RDebug::Print(_L("CamcTest_8::Multiple5 iCamc->Prepare in"));
+
+                iCamc->Prepare();
+                break;       
+                }
+            case K_Tc8_MultipleInstance006_AO2:
+                {
+                // Instance 1 is now paused.
+                // Prepare the 2nd camcorder.
+                iCamc->Prepare();
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(0,User::Panic(_L("Test Client"),1));
+                break;
+                }
+                
+            }
+        }
+    else if ( iClosed )
+        {           
+#ifdef _DEBUG
+        str.Append(_L(": Closed"));
+        RDebug::Print(str); 
+#endif
+        (*iNumberOfOpenedCamc)--;
+        if (*iNumberOfOpenedCamc == 0)
+            {
+            // Everything is closed, we can stop the active scheduler    
+            CActiveScheduler::Stop();
+            }
+        }
+    else //timer
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Recording"));
+        RDebug::Print(str); 
+#endif
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance004_AO1:
+                // Wait forever in that state.
+                {
+                ReachedWaitingState();
+                break;     
+                }
+            case K_Tc8_MultipleInstance006_AO1:
+                {
+                iCamc->PauseL();
+                iPaused = ETrue;
+                CTimer::After( (TInt) 1E6 ); // Pause for 1 sec.
+                break;
+                }
+            default:
+                {
+                iCamc->Stop();
+                iRecordingReady = ETrue;
+                CTimer::After( (TInt) 1E6 );
+                }
+            }
+        }
+    
+    
+    if (closeNow)
+        {
+        iCamc->Close();
+        CTimer::After( (TInt) 1E6 );
+        iClosed = ETrue;
+        }
+    
+    }
+
+
+
+void CCamcTestClient_8::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+////////////////////////////////////////////////////////
+// MVideoRecorderUtilityObserver Callback functions
+
+void CCamcTestClient_8::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_8::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_8::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_8::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+
+void CCamcTestClient_8::Close()
+    {
+    // We are requested by an other object to close.
+        iCamc->Close();
+        CTimer::After( (TInt) 1E6 );
+        iClosed = ETrue;
+    }
+
+
+void CCamcTestClient_8::ReachedWaitingState()
+    {
+    // We have reach a state were we wait for the other object to generate a 
+    // TellMeWhenYourInCorrectState request.
+
+    iReachedWaitingState = ETrue;
+    if (iRequestPending)
+        {
+        // Serve the request
+       // TRequestStatus* status = &iReceivedRequest;
+        User::RequestComplete(iReceivedRequest, KErrNone);
+        }
+
+    }
+
+
+void CCamcTestClient_8::WaitForOtherObject()
+    {
+    // One object (the client) generates a request to the other object
+    iOtherClient->TellMeWhenYouAreInCorrectState(iStatus);
+    SetActive();
+    if (iStatus != KRequestPending)
+        {
+        // If the client was already in correct state, we complete the request ourselves.
+        TRequestStatus * aReq = &iStatus;
+        User::RequestComplete(aReq, KErrNone);
+        }
+    iEmittedRequest = ETrue;
+    }
+
+void CCamcTestClient_8::TellMeWhenYouAreInCorrectState(TRequestStatus &aRequest)
+    {
+    if (iReachedWaitingState)
+        {
+        // Already waiting !
+        aRequest = 0; // Something else then KRequestPending.
+        iRequestPending = EFalse;
+        }
+    else
+        {
+        aRequest = KRequestPending;    
+        iRequestPending = ETrue;        
+        }
+    iReceivedRequest= &aRequest;
+    }
+
+
+void CCamcTestClient_8::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        *iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+    
+    
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_9.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,709 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_9.h"
+#include "CamCControllerCustomCommands.h"
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include <mmf/server/mmffile.h>
+#include <AudioPreference.h>
+#include "camctest.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+const TInt KMaxVideoLength = 3600;
+
+// MACROS
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_9::CCamcTestClient_9 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_9::~CCamcTestClient_9 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_9* CCamcTestClient_9::NewL()
+    {
+    CCamcTestClient_9* self = new(ELeave) CCamcTestClient_9;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_9::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iNewFileName = EFalse;
+    iRecord2ndTime = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_9::Start_Active_ObjectL ( TestClient9Actions aAction, TInt aCameraHandle )
+    {
+    
+    TFileName file;
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    
+    if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat )
+        {
+        AddDriveLetterToPath(_L("recordQCIF.3g2"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUidG2,
+            _L8("video/H263-2000"),
+            TFourCC(' ', 'A', 'M', 'R') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat )
+        {
+        AddDriveLetterToPath(_L("recordQCIF.mp4"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUidMP4,
+            _L8("video/mp4v-es; profile-level-id=3"),
+            TFourCC(' ', 'A', 'A', 'C') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat )
+        {
+        AddDriveLetterToPath(_L("recordCIF.mp4"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUidMP4,
+            _L8("video/H264; profile-level-id=42800D"),
+            TFourCC(' ', 'A', 'A', 'C') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat )
+        {
+        AddDriveLetterToPath(_L("recordCIF.mp4"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUidMP4,
+            _L8("video/H264; profile-level-id=64400D"),
+            TFourCC(' ', 'A', 'A', 'C') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }    
+    else
+        {       
+        AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUid,
+            _L8("video/H263-2000"),
+            TFourCC(' ', 'A', 'M', 'R') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_9::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err ) 
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_9::RunLTrappedL()
+    {
+    if ( iOpenReady )  
+        { 
+        iOpenReady = EFalse;
+        switch ( iAction )
+            {
+            case K_Tc9_PrepareWhenControllerReadyWhitoutSetting:
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting:
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting:
+                {
+                break;
+                }
+            case K_TC9_NewFileNameWhenInternalStop:
+                {
+                iCamc->SetMaxClipSizeL(TC9_FILE_SIZE_LIMIT) ; 
+                break;
+                }
+            case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat:
+            case K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat:
+            case K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat:                
+                {
+                iCamc->SetVideoFrameSizeL(TSize(352,288));
+                iCamc->SetVideoFrameRateL(TReal32(15));
+                iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE );
+                iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE_AAC ));
+                break;
+                }
+            default:
+                {
+                // Set default parameters. They can be overwritten depending on the test case. 
+                iCamc->SetVideoFrameSizeL(TSize(176,144));
+                iCamc->SetVideoFrameRateL(TReal32(15));
+                iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE );
+                iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE ));
+                break;
+                }
+
+            }
+        
+        switch ( iAction )
+            {
+            case  K_Tc9_PrepareWhenControllerReadyWhitoutSetting:
+                {
+                break;
+                }
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting:
+                {
+                iCamc->SetVideoBitRateL(TInt(50000));
+                break;
+                }
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting:
+                {
+                iCamc->SetVideoFrameSizeL(TSize(176,144));
+                break;
+                }
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0:
+                {
+                iCamc->SetMaxClipSizeL( 0 );
+                break;
+                }
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize:
+                {
+                iCamc->SetMaxClipSizeL( KMMFNoMaxClipSize );
+                break;
+                }
+            case K_Tc9_OpenFileInAFolderNonExistent:
+                {               
+                AddDriveLetterToPath(_L("non-existent-folder\\recordQCIF.3gp"), iFileName);
+                TMMFFileParams params;
+                params.iPath = iFileName;
+                TPckgC<TMMFFileParams> pckg(params);
+                    
+                TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                if (ret != 0)
+                    {
+                    User::Leave(K_Tc9_ValueNotExpected);
+                    }
+                iAction = K_Tc9_none;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        iCamc->Prepare();
+            
+        }
+    else if ( iPrepareReady ) 
+        {
+        TBool record = EFalse;
+        switch ( iAction )
+            {
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0:
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize:
+                {
+                iPrepareReady = EFalse;
+                iCamc->Record();
+                record = EFalse;
+                break;
+                }
+            case K_TC9_NewFileNameWhenPreparedNotRecording:
+                {
+                if (!iNewFileName)
+                    {
+                    AddDriveLetterToPath(_L("NewFileName.3gp"),iFileName);
+                    
+                    TMMFFileParams params;
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;
+                }
+            case K_TC9_NewFileNameWhenInternalStop :
+                {
+                iPrepareReady = EFalse;
+                iCamc->Record(); // No timer need, will eventually stop because of filesize limit.
+                break;
+                }
+            
+            default:
+                {
+                record = ETrue;
+                break;
+                }
+            }
+        if ( record )
+            {
+            iPrepareReady = EFalse;
+            iCamc->Record();
+            CTimer::After( iTimeout );
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+        TBool close = EFalse;
+        iRecordingReady = EFalse;
+
+        TMMFFileParams params;
+        switch ( iAction )
+            {
+            case K_Tc9_RecordTimeAvailWhenRecordingReady:
+                {
+                // Compare if default size limit is correctly returned by 
+                // a RecordTimeAvailableL      
+                TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                TInt64 timeRemainingInSec = timeRemaining.Int64()/1E6; //Max time is 3600s = 60min
+                
+                PRINT((_L("CCamCTest_9::RecordTimeAvailable5: timeRemainingInSec: %d "), I64INT(timeRemainingInSec  )));
+                
+                
+                
+                // Duration value depends on available disk drive space.
+                // Get the free space of the disk drive:
+
+                RFs fsSession;
+                fsSession.Connect();
+                TVolumeInfo volumeInfo;
+                TInt err = fsSession.Volume(volumeInfo,EDriveC);
+                fsSession.Close();
+                if (err)
+                    {
+                    User::Leave( KErrGeneral) ;
+                    }
+
+                // Possible duration = available disk space/videobitrate
+                TInt64 calculatedDuration = volumeInfo.iFree / TInt64((TC9_VIDEO_BIT_RATE+TC9_AUDIO_BIT_RATE)/8);
+                
+                // If there is more space than the max length of the video -> 
+                // set the calculatedDuration to max length
+                if ( calculatedDuration > KMaxVideoLength) 
+                    {
+                    calculatedDuration = KMaxVideoLength;
+                    }
+                
+                RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 timeRemaining is %d "), I64INT(timeRemainingInSec ));
+                RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 calculatedDuration is %d "), I64INT(calculatedDuration ) );
+                // Allows 5% error margin:
+                if ( ( timeRemainingInSec > calculatedDuration*1.05 ) ||
+                    ( timeRemainingInSec < calculatedDuration*0.95 ) )
+                    {
+                    RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 is leaving, because timeRemaining != Calculated ") );          
+                    User::Leave( K_Tc9_ValueNotWithinRange ) ; 
+                    }
+                close = ETrue;
+                break;
+                }
+                
+            case K_TC9_NewFileNameWhenRecordSecondTime : 
+                {
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+                    
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;          
+                }
+
+            case K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat : 
+                {
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.3g2"), iFileName );
+                    
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;          
+                }
+
+            case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat :
+            case K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat:
+            case K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat:                
+                {
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.mp4"), iFileName );
+                    
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;          
+                }
+
+            case K_TC9_NewFileNameWhenInternalStop : 
+                {             
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+
+                    iCamc->Prepare();
+                    }
+                else
+                    {
+                    close = ETrue;
+                    }
+                break;
+
+                }               
+            default:
+                {
+                close = ETrue;
+                break;
+                }
+            }
+        if (close)
+            {
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After( 1000 );
+            }
+        }
+
+    else 
+        {
+          RunLContinuedL();
+        }
+        
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    }
+
+void CCamcTestClient_9::RunLContinuedL()
+// This function exist to skip a MS VC6 bug/feature
+// Without this, VC6 would complains about stack abuse. 
+    {
+        if ( iPaused ) //resume
+        {
+        switch ( iAction )
+            {
+            case K_TC9_NewFileNameWhenPaused : 
+                {
+                    
+                AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+                    
+                iAction=K_Tc9_none;     
+                
+                TMMFFileParams params;
+                params.iPath = iFileName;
+                TPckgC<TMMFFileParams> pckg(params);
+                
+                TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                if (err)
+                    {
+                    User::Leave(err);
+                    }
+                break;
+                }
+            default:   
+                iPaused = EFalse;
+                iCamc->Record();
+            }
+        }
+    
+    else //timer
+        {
+        switch ( iAction )
+            {
+            case K_TC9_NewFileNameWhenRecording : 
+                {
+                AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+                
+                TMMFFileParams params;
+                params.iPath = iFileName;
+                TPckgC<TMMFFileParams> pckg(params);
+                
+                TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                if (err)
+                    {
+                    User::Leave(err);
+                    }
+                break;
+                }            
+            case K_TC9_NewFileNameWhenPaused:
+                {
+                iCamc->PauseL();
+                CTimer::After(2 * TInt32 ( 1E6 ) ); // Pause for 2 seconds.
+                iPaused=ETrue;
+                break;
+                }
+            default:
+                iCamc->Stop();        // Simulates that iRecording has been completed through the 
+                // MvruoRecordComplete callback
+                iRecordingReady=ETrue;				
+                CTimer::After( 1000 );
+            }       
+        }
+    
+    
+    }
+
+
+
+void CCamcTestClient_9::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+
+void CCamcTestClient_9::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL();
+        }
+    }
+
+void CCamcTestClient_9::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL();
+        }
+    }
+
+void CCamcTestClient_9::MvruoRecordComplete( TInt aError )
+    {
+    switch( iAction)
+        {
+        case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0 :
+        case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize :
+            {
+            if ( (aError ==  KErrDiskFull) || (aError == KErrCompletion ) )
+                {
+                // KErrCompletion if there is more space than needed for 60 min recording.
+                // Otherwise KErrDiskFull
+                aError = KErrNone;
+                }
+            else
+                {
+                aError = KErrGeneral;
+                }
+            break;
+            }
+        case K_TC9_NewFileNameWhenInternalStop :
+            {
+            if (aError == KErrCompletion)
+                {
+                // That's expected case.
+                aError = KErrNone;
+                }
+            else
+                {
+                aError = KErrGeneral;
+                }
+            break;
+            }
+        }
+
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL();
+        }
+    }
+
+void CCamcTestClient_9::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_9::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_visualcheck.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,911 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_visualcheck.h"
+#include <AudioPreference.h>
+
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_visualcheck::CCamcTestClient_visualcheck () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_visualcheck::~CCamcTestClient_visualcheck ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    Cancel();
+    delete iCamc;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    }
+
+CCamcTestClient_visualcheck* CCamcTestClient_visualcheck::NewL()
+    {
+    CCamcTestClient_visualcheck* self = new(ELeave) CCamcTestClient_visualcheck;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_visualcheck::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    i2ndTime = EFalse;
+    iDoublePause = EFalse;
+    iStartRecording2ndTime = EFalse;
+   
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_visualcheck::Start_Active_ObjectL ( TestClientVCActions aAction )
+    {
+    
+    TInt camHandle = 0;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    TBuf<50> fileName;
+    
+#if ( defined (__WINS__) || defined (__WINSCW__) )
+    _LIT(KFileName101,"c:\\recordQCIF_101.3gp");
+    _LIT(KFileName102,"c:\\recordQCIF_102.3gp");
+    _LIT(KFileName103,"c:\\recordQCIF_103.3gp");
+    _LIT(KFileName104,"c:\\recordQCIF_104.3gp");
+    _LIT(KFileName105,"c:\\recordQCIF_105.3gp");
+    _LIT(KFileName106,"c:\\recordQCIF_106.3gp");
+    _LIT(KFileName107,"c:\\recordQCIF_107.3gp");
+    _LIT(KFileName108_a,"c:\\recordQCIF_108_a.3gp");
+    _LIT(KFileName108_b,"c:\\recordQCIF_108_b.3gp");
+    _LIT(KFileName109,"c:\\recordQCIF_109.3gp");
+    _LIT(KFileName110,"c:\\recordQCIF_110.3gp");
+    _LIT(KFileName111,"c:\\recordQCIF_111.3gp");
+    _LIT(KFileName112,"c:\\recordQCIF_112.3gp");
+    _LIT(KFileName113,"c:\\recordQCIF_113.3gp");
+    _LIT(KFileName114,"c:\\recordQCIF_114.3gp");
+    _LIT(KFileName115,"c:\\recordQCIF_115.3gp");
+    _LIT(KFileName116,"c:\\recordQCIF_116.3gp");
+    _LIT(KFileName117,"c:\\recordQCIF_117.3g2");
+    _LIT(KFileName118,"c:\\recordQCIF_118.3g2");
+    _LIT(KFileName119,"c:\\recordQCIF_119.3gp");
+    _LIT(KFileName120,"c:\\recordQCIF_120.3g2");
+    _LIT(KFileName121,"c:\\recordQCIF_121.mp4");
+#else 
+    _LIT(KFileName101,"E:\\recordQCIF_101.3gp");
+    _LIT(KFileName102,"E:\\recordQCIF_102.3gp");
+    _LIT(KFileName103,"E:\\recordQCIF_103.3gp");
+    _LIT(KFileName104,"E:\\recordQCIF_104.3gp");
+    _LIT(KFileName105,"E:\\recordQCIF_105.3gp");
+    _LIT(KFileName106,"E:\\recordQCIF_106.3gp");
+    _LIT(KFileName107,"E:\\recordQCIF_107.3gp");
+    _LIT(KFileName108_a,"E:\\recordQCIF_108_a.3gp");
+    _LIT(KFileName108_b,"E:\\recordQCIF_108_b.3gp");
+    _LIT(KFileName109,"E:\\recordQCIF_109.3gp");
+    _LIT(KFileName110,"E:\\recordQCIF_110.3gp");
+    _LIT(KFileName111,"E:\\recordQCIF_111.3gp");
+    _LIT(KFileName112,"E:\\recordQCIF_112.3gp");
+    _LIT(KFileName113,"E:\\recordQCIF_113.3gp");
+    _LIT(KFileName114,"E:\\recordQCIF_114.3gp");
+    _LIT(KFileName115,"C:\\recordQCIF_115.3gp");
+    _LIT(KFileName116,"E:\\recordQCIF_116.3gp");
+    _LIT(KFileName117,"E:\\recordQCIF_117.3g2");
+    _LIT(KFileName118,"E:\\recordQCIF_118.3g2");
+    _LIT(KFileName119,"E:\\recordQCIF_119.3gp");
+    _LIT(KFileName120,"E:\\recordQCIF_120.3g2");
+    _LIT(KFileName121,"E:\\recordQCIF_121.mp4");
+#endif
+    switch(iAction)
+        {
+        case K_VC_test_case_101:
+            {
+            fileName = KFileName101;
+            break;
+            }
+        case K_VC_test_case_102:
+            {
+            fileName = KFileName102;
+            break;
+            }
+        case K_VC_test_case_103:
+            {
+            fileName = KFileName103;
+            break;
+            }
+        case K_VC_test_case_104:
+            {
+            fileName = KFileName104;
+            break;
+            }
+        case K_VC_test_case_105:
+            {
+            fileName = KFileName105;
+            break;
+            }
+        case K_VC_test_case_106:
+            {
+            fileName = KFileName106;
+            break;
+            }
+        case K_VC_test_case_107:
+            {
+            fileName = KFileName107;
+            break;
+            }
+        case K_VC_test_case_108_a:
+            {
+            fileName = KFileName108_a;
+            break;
+            }
+        case K_VC_test_case_108_b:
+            {
+            fileName = KFileName108_b;
+            break;
+            }
+        case K_VC_test_case_109:
+            {
+            fileName = KFileName109;
+            break;
+            }
+        case K_VC_test_case_110:
+            {
+            fileName = KFileName110;
+            break;
+            }
+        case K_VC_test_case_111:
+            {
+            fileName = KFileName111;
+            break;
+            }
+        case K_VC_test_case_112:
+            {
+            fileName = KFileName112;
+            break;
+            }
+        case K_VC_test_case_113:
+            {
+            fileName = KFileName113;
+            break;
+            }
+        case K_VC_test_case_114:
+            {
+            fileName = KFileName114;
+            break;
+            }
+        case K_VC_test_case_115:
+            {
+            fileName = KFileName115;
+            break;
+            }
+        case K_VC_test_case_116:
+            {
+            fileName = KFileName116;
+            break;
+            }
+        case K_VC_test_case_117:
+            {
+            fileName = KFileName117;
+            break;
+            }
+        case K_VC_test_case_118:
+            {
+            fileName = KFileName118;
+            break;
+            }
+        case K_VC_test_case_119:
+            {
+            fileName = KFileName119;
+            break;
+            }
+        case K_VC_test_case_120:
+            {
+            fileName = KFileName120;
+            break;
+            }
+        case K_VC_test_case_121:
+            {
+            fileName = KFileName121;
+            break;
+            }
+        default:
+            break;
+        }
+    
+        switch(iAction)
+            {
+            case K_VC_test_case_108_a:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/H263-2000; profile=0; level=45"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_117:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUidG2,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/H263-2000"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_118:
+            case K_VC_test_case_120:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUidG2,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/mp4v-es"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_119:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/mp4v-es"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_121:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/mp4v-es; profile-level-id=3"),
+                    TFourCC(' ', 'A', 'A', 'C') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            default:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/H263-2000"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;          
+                }
+          }
+
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+    
+    void CCamcTestClient_visualcheck::RunL()
+        {
+        
+        // Trap RunL, to catch if the AO leaves.
+        // A Walkaround...
+        // RunError() should be used in this case, but
+        // Apparently, it is not possible to use the AO RunError() virtual function
+        // for that purpose, it is not called.
+        
+        TRAPD( err,RunLTrappedL() );
+        if ( err )
+            {
+            SomethingInActiveObjectIsLeaving(err);
+            }
+        }
+    
+    void CCamcTestClient_visualcheck::RunLTrappedL()
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("CamCTestClient VisualCheck:RunL"));
+#endif
+        if ( iOpenReady ) 
+            {
+            iOpenReady = EFalse;
+            
+            switch(iAction)
+                {  
+                case K_VC_test_case_101:
+                    {
+                    break; 
+                    }
+                case K_VC_test_case_102:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(3));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_test_case_103:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(6700); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_test_case_104:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(5150); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break; 
+                    }
+                case K_VC_test_case_105:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(1));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(7400); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_106:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(3));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(4750); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_107:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_test_case_108_a:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(8));
+                    iCamc->SetVideoBitRateL(TInt(128000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break;              
+                    }
+                case K_VC_test_case_108_b:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(1));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break;              
+                    }
+                case K_VC_test_case_109:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(3));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_test_case_110:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(42000));    
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_111:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }
+                case K_VC_test_case_112:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_113:
+                    {
+                    iCamc->SetMaxClipSizeL(50);
+                    break; 
+                    }
+                case K_VC_test_case_114:
+                    {
+                    break; 
+                    }
+                case K_VC_test_case_115:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    break;
+                    }    
+                case K_VC_test_case_116:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_test_case_117:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }    
+                case K_VC_test_case_118:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_test_case_119:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetMaxClipSizeL(95000);
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(5150); 
+                    break;
+                    }    
+                 case K_VC_test_case_120:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }    
+                case K_VC_test_case_121:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(352,288));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(384000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    break;
+                    }
+               default:
+                    break;
+            }
+            
+            
+            
+            iCamc->Prepare();
+        }
+        else if ( iPrepareReady ) 
+            {
+            iPrepareReady = EFalse;    
+            iCamc->Record();
+            switch(iAction)
+                {
+                case K_VC_test_case_101:
+                    {
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );  // Records for 30 sec
+                    break;
+                    }
+                case K_VC_test_case_102:
+                case K_VC_test_case_103:
+                case K_VC_test_case_104:
+                case K_VC_test_case_105:
+                case K_VC_test_case_106:
+                case K_VC_test_case_108_a:
+                case K_VC_test_case_117:
+                case K_VC_test_case_119:
+                case K_VC_test_case_113:
+                    {
+                    // The timeout will be generated by the SetMaxClipSize.
+                    break;
+                    }
+                case K_VC_test_case_114:
+                    {
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );  // Records for 1 sec
+                    break;
+                    }
+                case K_VC_test_case_116:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );  // Records for 10 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+                default:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;          
+                    }
+                }
+            }
+        else if ( iRecordingReady )
+            {
+            
+            iRecordingReady = EFalse;
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After(1000);
+            }
+        else if (iClosed)
+            {
+            CActiveScheduler::Stop();
+            }
+        else if ( iPaused ) //resume
+            {
+            switch(iAction)
+                {
+                case K_VC_test_case_107:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec.
+                    iPaused = EFalse;
+                    iAction = K_VC_none;         
+                    break;
+                    }
+                case K_VC_test_case_109: 
+                case K_VC_test_case_118: 
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iAction = K_VC_none;
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(  2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_test_case_112:
+                    {
+                    iCamc->Record();
+                    iPaused = EFalse;  
+                    break;
+                    }
+                case K_VC_test_case_115:
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        iAction = K_VC_none;
+                        // Record until disk full
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(   2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_test_case_121:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec.
+                    iPaused = EFalse;
+                    iAction = K_VC_none;         
+                    break;
+                    }
+                default:
+                    break;
+                }
+            }
+        else //timer
+            {
+            switch(iAction)
+                {     
+                case K_VC_test_case_107:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec
+                    break;
+                    }
+                case K_VC_test_case_108_a: 
+                    {
+                    if ( i2ndTime )
+                        {
+                        // Volume down
+                        iCamc->SetGainL( 1 );
+                        iAction = K_VC_none;
+                        }
+                    else 
+                        {                
+                        // Volume Up
+                        TInt aSetGain;
+                        aSetGain = iCamc->MaxGainL();
+                        iCamc->SetGainL( aSetGain );
+                        CTimer::After( 15 * TInt32 ( 1E6 ) );
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_test_case_108_b: 
+                    {
+                    if ( i2ndTime )
+                        {
+                        // Volume down
+                        iCamc->SetGainL( 1 );
+                        iAction = K_VC_none;
+                        }
+                    else 
+                        {                
+                        // Volume Up
+                        TInt aSetGain;
+                        aSetGain = iCamc->MaxGainL();
+                        iCamc->SetGainL( aSetGain );
+                        CTimer::After( 15 * TInt32 ( 1E6 ) );
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_test_case_109:      
+                case K_VC_test_case_115:
+                case K_VC_test_case_118:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;          
+                    
+                    if ( i2ndTime )
+                        {
+                        CTimer::After( 30 * TInt32 ( 1E6 ) ); // Pauses for 30s
+                        }
+                    else 
+                        {                
+                        CTimer::After( 10 * TInt32 ( 1E6 ) ); // Pauses for 10s
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_test_case_110:
+                    {
+                    iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_10  );
+                    break;
+                    }
+                case K_VC_test_case_111:
+                    {
+                    iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_11  );
+                    iAction = K_VC_none;
+                    break;
+                    }
+                case K_VC_test_case_112:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_VC_test_case_116:
+                    {
+                    if(iStartRecording2ndTime)
+                        {
+                        iPrepareReady = ETrue;    
+                        CTimer::After( 10 * TInt32 ( 1E6 ) );
+                        iAction = K_VC_none;    
+                        }
+                    else
+                        {
+                        iCamc->Stop();
+                        CTimer::After( 3 * TInt32 ( 1E6 ) );
+                        iStartRecording2ndTime = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_test_case_120:
+                    {
+                    iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_20  );
+                    iAction = K_VC_none;
+                    break;
+                    }
+                case K_VC_test_case_121:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec
+                    break;
+                    }
+                default:
+                    iCamc->Stop();
+                    // Simulates that iRecording has been completed through the 
+                    // MvruoRecordComplete callback
+                    iRecordingReady=ETrue;				
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    
+                }
+            }
+        
+}
+
+void CCamcTestClient_visualcheck::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+
+void CCamcTestClient_visualcheck::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheck::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheck::MvruoRecordComplete( TInt aError )
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck:Record Complete"));
+#endif
+    if ((aError) && (aError != KErrCompletion))
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheck::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_visualcheck::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: SomethingInActiveObjectIsLeaving "));
+#endif
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+    
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestClient_visualcheckdsp.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,903 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CamcTestClient_visualcheckdsp.h"
+#include <AudioPreference.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_visualcheckdsp::CCamcTestClient_visualcheckdsp () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_visualcheckdsp::~CCamcTestClient_visualcheckdsp ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    Cancel();
+    delete iCamc;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    }
+
+CCamcTestClient_visualcheckdsp* CCamcTestClient_visualcheckdsp::NewL()
+    {
+    CCamcTestClient_visualcheckdsp* self = new(ELeave) CCamcTestClient_visualcheckdsp;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_visualcheckdsp::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    i2ndTime = EFalse;
+    iDoublePause = EFalse;
+    iStartRecording2ndTime = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_visualcheckdsp::Start_Active_ObjectL ( TestClientVCdspActions aAction, TInt aCameraHandle )
+    {
+    
+    iUiLevelCameraHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    TBuf<50> fileName;
+    
+#if ( defined (__WINS__) || defined (__WINSCW__) )
+    _LIT(KFileName1,"c:\\recordQCIF_dsp_1.3gp");
+    _LIT(KFileName2,"c:\\recordQCIF_dsp_2.3gp");
+    _LIT(KFileName3,"c:\\recordQCIF_dsp_3.3gp");
+    _LIT(KFileName4,"c:\\recordQCIF_dsp_4.3gp");
+    _LIT(KFileName5,"c:\\recordQCIF_dsp_5.3gp");
+    _LIT(KFileName6,"c:\\recordQCIF_dsp_6.3gp");
+    _LIT(KFileName7,"c:\\recordQCIF_dsp_7.3gp");
+    _LIT(KFileName8,"c:\\recordQCIF_dsp_8.3gp");
+    _LIT(KFileName9_a,"c:\\recordQCIF_dsp_9_a.3gp");
+    _LIT(KFileName9_b,"c:\\recordQCIF_dsp_9_b.3gp");
+    _LIT(KFileName10,"c:\\recordQCIF_dsp_10.3gp");
+    _LIT(KFileName11,"c:\\recordQCIF_dsp_11.3gp");
+    _LIT(KFileName12,"c:\\recordQCIF_dsp_12.3gp");
+    _LIT(KFileName14,"c:\\recordQCIF_dsp_14.3gp");
+    _LIT(KFileName15,"c:\\recordQCIF_dsp_15.3gp");
+    _LIT(KFileName16,"c:\\recordQCIF_dsp_16.3gp");
+    _LIT(KFileName17,"c:\\recordQCIF_dsp_17.3gp");
+    _LIT(KFileName17_A,"c:\\recordQCIF_dsp_17_a.3gp");
+    _LIT(KFileName18,"c:\\recordQCIF_dsp_18.3g2");
+    _LIT(KFileName19,"c:\\recordQCIF_dsp_19.3g2");
+    _LIT(KFileName20,"c:\\recordQCIF_dsp_20.3g2");
+    _LIT(KFileName21,"c:\\recordQCIF_dsp_21.mp4");
+#else 
+    _LIT(KFileName1,"E:\\recordQCIF_dsp_1.3gp");
+    _LIT(KFileName2,"E:\\recordQCIF_dsp_2.3gp");
+    _LIT(KFileName3,"E:\\recordQCIF_dsp_3.3gp");
+    _LIT(KFileName4,"E:\\recordQCIF_dsp_4.3gp");
+    _LIT(KFileName5,"E:\\recordQCIF_dsp_5.3gp");
+    _LIT(KFileName6,"E:\\recordQCIF_dsp_6.3gp");
+    _LIT(KFileName7,"E:\\recordQCIF_dsp_7.3gp");
+    _LIT(KFileName8,"E:\\recordQCIF_dsp_8.3gp");
+    _LIT(KFileName9_a,"E:\\recordQCIF_dsp_9_a.3gp");
+    _LIT(KFileName9_b,"E:\\recordQCIF_dsp_9_b.3gp");
+    _LIT(KFileName10,"E:\\recordQCIF_dsp_10.3gp");
+    _LIT(KFileName11,"E:\\recordQCIF_dsp_11.3gp");
+    _LIT(KFileName12,"E:\\recordQCIF_dsp_12.3gp");
+    _LIT(KFileName14,"E:\\recordQCIF_dsp_14.3gp");
+    _LIT(KFileName15,"C:\\recordQCIF_dsp_15.3gp");
+    _LIT(KFileName16,"E:\\recordQCIF_dsp_16.3gp");
+    _LIT(KFileName17,"E:\\recordQCIF_dsp_17.3gp");
+    _LIT(KFileName17_A,"E:\\recordQCIF_dsp_17_a.3gp");
+    _LIT(KFileName18,"E:\\recordQCIF_dsp_18.3g2");
+    _LIT(KFileName19,"E:\\recordQCIF_dsp_19.3g2");
+    _LIT(KFileName20,"E:\\recordQCIF_dsp_20.3g2");
+    _LIT(KFileName21,"E:\\recordQCIF_dsp_21.mp4");
+#endif
+    switch(iAction)
+        {
+        case K_VC_dsp_test_case_1:
+            {
+            fileName = KFileName1;
+            break;
+            }
+        case K_VC_dsp_test_case_2:
+            {
+            fileName = KFileName2;
+            break;
+            }
+        case K_VC_dsp_test_case_3:
+            {
+            fileName = KFileName3;
+            break;
+            }
+        case K_VC_dsp_test_case_4:
+            {
+            fileName = KFileName4;
+            break;
+            }
+        case K_VC_dsp_test_case_5:
+            {
+            fileName = KFileName5;
+            break;
+            }
+        case K_VC_dsp_test_case_6:
+            {
+            fileName = KFileName6;
+            break;
+            }
+        case K_VC_dsp_test_case_7:
+            {
+            fileName = KFileName7;
+            break;
+            }
+        case K_VC_dsp_test_case_8:
+            {
+            fileName = KFileName8;
+            break;
+            }
+        case K_VC_dsp_test_case_9_a:
+            {
+            fileName = KFileName9_a;
+            break;
+            }
+        case K_VC_dsp_test_case_9_b:
+            {
+            fileName = KFileName9_b;
+            break;
+            }
+        case K_VC_dsp_test_case_10:
+            {
+            fileName = KFileName10;
+            break;
+            }
+        case K_VC_dsp_test_case_11:
+            {
+            fileName = KFileName11;
+            break;
+            }
+        case K_VC_dsp_test_case_12:
+            {
+            fileName = KFileName12;
+            break;
+            }
+        case K_VC_dsp_test_case_14:
+            {
+            fileName = KFileName14;
+            break;
+            }
+        case K_VC_dsp_test_case_15:
+            {
+            fileName = KFileName15;
+            break;
+            }
+        case K_VC_dsp_test_case_16:
+            {
+            fileName = KFileName16;
+            break;
+            }
+        case K_VC_dsp_test_case_17:
+            {
+            fileName = KFileName17;
+            break;
+            }
+        case K_VC_dsp_test_case_17_a:
+            {
+            fileName = KFileName17_A;
+            break;
+            }
+        case K_VC_dsp_test_case_18:
+            {
+            fileName = KFileName18;
+            break;
+            }
+        case K_VC_dsp_test_case_19:
+            {
+            fileName = KFileName19;
+            break;
+            }
+        case K_VC_dsp_test_case_20:
+            {
+            fileName = KFileName20;
+            break;
+            }
+        case K_VC_dsp_test_case_21:
+            {
+            fileName = KFileName21;
+            break;
+            }
+        default:
+            break;
+        }
+    
+    TInt err = KErrNone;
+    switch ( iAction )
+        {
+        case K_VC_dsp_test_case_9_a :
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000; profile=0; level=45"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            break;
+        case K_VC_dsp_test_case_17 :
+        case K_VC_dsp_test_case_17_a :
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/mp4v-es"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            break;
+        case K_VC_dsp_test_case_18:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidG2,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            break;
+        case K_VC_dsp_test_case_19:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidG2,
+                _L8("video/mp4v-es"),
+                TFourCC(' ', 'Q', '1', '3') ));
+            break;
+        case K_VC_dsp_test_case_20:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidG2,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'Q', '1', '3') ));
+            break;
+        case K_VC_dsp_test_case_21:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidMP4,
+                _L8("video/mp4v-es; profile-level-id=3"),
+                TFourCC(' ', 'A', 'A', 'C') ));
+            break;
+        default:
+            {
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            }
+        }
+    if (err)
+        {
+        User::Leave(99);
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+    
+    void CCamcTestClient_visualcheckdsp::RunL()
+        {
+        
+        // Trap RunL, to catch if the AO leaves.
+        // A Walkaround...
+        // RunError() should be used in this case, but
+        // Apparently, it is not possible to use the AO RunError() virtual function
+        // for that purpose, it is not called.
+        
+        TRAPD( err,RunLTrappedL() );
+        if ( err )
+            {
+            SomethingInActiveObjectIsLeaving(err);
+            }
+        }
+    
+    void CCamcTestClient_visualcheckdsp::RunLTrappedL()
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("CamCTestClient VisualCheck:RunL"));
+#endif
+        if ( iOpenReady ) 
+            {
+            iOpenReady = EFalse;
+            
+            switch(iAction)
+                {  
+                case K_VC_dsp_test_case_1:
+                    {
+                    break; 
+                    }
+                case K_VC_dsp_test_case_2:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_dsp_test_case_3:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(6700); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_dsp_test_case_4:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(5150); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break; 
+                    }
+                case K_VC_dsp_test_case_5:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(7400); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_6:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(4750); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_7:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_8:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break;              
+                    }
+                case K_VC_dsp_test_case_9_a:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(128000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_b:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_10:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(42000));    
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_11:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_15:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    break;
+                    }    
+                case K_VC_dsp_test_case_16:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_dsp_test_case_17:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_dsp_test_case_17_a:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_18:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_dsp_test_case_19:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetMaxClipSizeL(300000);
+                    //bitrate setting TBD
+                    iCamc->SetAudioBitRateL(6800); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_20:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    //bitrate setting TBD
+                    iCamc->SetAudioBitRateL(6800); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_21:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(352,288));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(384000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(32000); 
+                    break;
+                    }
+                default:
+                    break;
+            }
+            
+            
+            
+            iCamc->Prepare();
+        }
+        else if ( iPrepareReady ) 
+            {
+            iPrepareReady = EFalse;    
+            iCamc->Record();
+            switch(iAction)
+                {
+                case K_VC_dsp_test_case_1:
+                    {
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );  // Records for 30 sec
+                    break;
+                    }
+                case K_VC_dsp_test_case_2:
+                case K_VC_dsp_test_case_3:
+                case K_VC_dsp_test_case_4:
+                case K_VC_dsp_test_case_5:
+                case K_VC_dsp_test_case_6:
+                case K_VC_dsp_test_case_19:
+                    {
+                    // The timeout will be generated by the SetMaxClipSize.
+                    break;
+                    }
+                case K_VC_dsp_test_case_14:
+                    {
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_VC_dsp_test_case_16:
+                case K_VC_dsp_test_case_17:
+                case K_VC_dsp_test_case_17_a:
+                case K_VC_dsp_test_case_18:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );  // Records for 10 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                    {
+                    CTimer::After( 4 * TInt32 ( 1E6 ) );  // Records for 4 sec
+                    iStartRecording2ndTime = EFalse;
+                    }
+                    break;
+                case K_VC_dsp_test_case_20:
+                    {
+                    CTimer::After( 15 * TInt32 ( 1E6 ) );  // Records for 15 sec + pause + another 15 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+                case K_VC_dsp_test_case_21:
+                    {
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );  // Records for 30 sec + pause + another 30 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+
+                default:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;          
+                    }
+                }
+            }
+        else if ( iRecordingReady )
+            {
+            iRecordingReady = EFalse;
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After(1000);
+            }
+        else if (iClosed)
+            {
+            CActiveScheduler::Stop();
+            }
+        else if ( iPaused ) //resume
+            {
+            switch(iAction)
+                {
+                case K_VC_dsp_test_case_7:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec.
+                    iPaused = EFalse;
+                    iAction = K_VC_dsp_none;         
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_a: 
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iAction = K_VC_dsp_none;
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(  2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_b: 
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iAction = K_VC_dsp_none;
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(  2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                case K_VC_dsp_test_case_19:
+                    {
+                    iCamc->Record();
+                    iPaused = EFalse;  
+                    break;
+                    }
+                case K_VC_dsp_test_case_20:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 15 * TInt32 ( 1E6 ) ); // Records for 15 sec.
+                    iPaused = EFalse;  
+                    iAction = K_VC_dsp_none;
+                    break;
+                    }
+                case K_VC_dsp_test_case_21:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 30 * TInt32 ( 1E6 ) ); // Records for 30 sec.
+                    iPaused = EFalse;  
+                    iAction = K_VC_dsp_none;
+                    break;
+                    }
+                case K_VC_dsp_test_case_15:
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        iAction = K_VC_dsp_none;
+                        // Record until disk full
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(   2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                default:
+                    break;
+                }
+            }
+        else //timer
+            {
+            switch(iAction)
+                {     
+                case K_VC_dsp_test_case_7:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec
+                    break;
+                    }
+                case K_VC_dsp_test_case_8: 
+                    {
+                    if ( i2ndTime )
+                        {
+                        // Volume down
+                        iCamc->SetGainL( 1 );
+                        iAction = K_VC_dsp_none;
+                        }
+                    else 
+                        {                
+                        // Volume Up
+                        TInt aSetGain;
+                        aSetGain = iCamc->MaxGainL();
+                        iCamc->SetGainL( aSetGain );
+                        CTimer::After( 15 * TInt32 ( 1E6 ) );
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_a:      
+                case K_VC_dsp_test_case_9_b:      
+                case K_VC_dsp_test_case_15:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;          
+                    
+                    if ( i2ndTime )
+                        {
+                        CTimer::After( 30 * TInt32 ( 1E6 ) ); // Pauses for 30s
+                        }
+                    else 
+                        {                
+                        CTimer::After( 10 * TInt32 ( 1E6 ) ); // Pauses for 10s
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_10:
+                    {
+                    iCamc->SetVideoBitRateL( VIDEO_BIT_RATE_10  );
+                    break;
+                    }
+                case K_VC_dsp_test_case_11:
+                case K_VC_dsp_test_case_17:
+                case K_VC_dsp_test_case_17_a:
+                    {
+                    iCamc->SetVideoBitRateL( VIDEO_BIT_RATE_11  );
+                    iAction = K_VC_dsp_none;
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                case K_VC_dsp_test_case_19:
+                case K_VC_dsp_test_case_20:
+                case K_VC_dsp_test_case_21:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_VC_dsp_test_case_16:
+                    {
+                    if(iStartRecording2ndTime)
+                        {
+                        iPrepareReady = ETrue;    
+                        CTimer::After( 10 * TInt32 ( 1E6 ) );
+                        iAction = K_VC_dsp_none;    
+                        }
+                    else
+                        {
+                        iCamc->Stop();
+                        CTimer::After( 3 * TInt32 ( 1E6 ) );
+                        iStartRecording2ndTime = ETrue;
+                        }
+                    break;
+                    }
+                default:
+                    iCamc->Stop();
+                    // Simulates that iRecording has been completed through the 
+                    // MvruoRecordComplete callback
+                    iRecordingReady=ETrue;				
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    
+                }
+            }
+        
+}
+
+void CCamcTestClient_visualcheckdsp::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_visualcheckdsp::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheckdsp::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheckdsp::MvruoRecordComplete( TInt aError )
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck:Record Complete"));
+#endif
+    if ((aError) && (aError != KErrCompletion))
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheckdsp::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_visualcheckdsp::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: SomethingInActiveObjectIsLeaving "));
+#endif
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+    
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+
+#include "CamcTestTop.h"
+#include "CamcTest_1.h"
+#include "CamcTest_2.h"
+#include "CamcTest_3.h"
+#include "CamcTest_4.h"
+#include "CamcTest_5.h"
+#include "CamcTest_6.h"
+#include "CamcTest_7.h"
+#include "CamcTest_8.h"
+#include "CamcTest_9.h"
+#include "CamcTest_visualcheckdsp.h"
+#include "CamcTest_visualcheck.h"
+#include <e32des8.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+//////////////////
+// CppUnit things
+//////////////////
+
+#ifndef EKA2
+// Starting point of the DLL (Always needed) 
+GLDEF_C TInt E32Dll(TDllReason)
+    {
+    return(KErrNone);
+    }
+#endif
+// Exactly one exported function returning the suite of 
+// test functions for the test runner in the framework.
+// (Always needed)
+//
+
+
+
+
+EXPORT_C MTest* CreateTopFct ()
+    {
+    MTest * testSuite = NULL;
+    TRAPD(err, testSuite = CCamcTestTop::suiteL() ) ;
+    if (err)
+        {
+        User::Panic(_L("suiteL has left !"), 99);
+        }
+    return ( testSuite );
+    }
+
+ 
+CCamcTestTop::~CCamcTestTop()
+    {
+    }
+
+
+MTest* CCamcTestTop::suiteL ()
+    {
+    CTestSuite *suite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    suite->addTestL(CCamcTest_1::suiteL());
+    suite->addTestL(CCamcTest_2::suiteL());
+    suite->addTestL(CCamcTest_3::suiteL());
+    suite->addTestL(CCamcTest_4::suiteL());
+    suite->addTestL(CCamcTest_5::suiteL());   
+    suite->addTestL(CCamcTest_6::suiteL());
+    suite->addTestL(CCamcTest_7::suiteL());    
+    suite->addTestL(CCamcTest_8::suiteL());
+    suite->addTestL(CCamcTest_9::suiteL());
+
+    // Visual checks are flagged out because tests are very long !
+    
+    // Only one of these suite should be selected, depending on 
+    // HW used for the test.
+    // suite->addTestL(CCamcTest_visualcheckdsp::suiteL()); 
+    // suite->addTestL(CCamcTest_visualcheck::suiteL()); 
+
+    return suite;
+    
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_1.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,881 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_1.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTest_1::CCamcTest_1 ()
+    {
+    }
+
+
+
+CCamcTest_1::~CCamcTest_1 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_1::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_1::NewL( );
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_1::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_1::setUp() using new MCameraObserver2" )) ); 
+       }
+
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();
+    }
+
+
+void CCamcTest_1::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;
+	REComSession::FinalClose();
+    
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       OpenFileL tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_1::OpenFileL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_001
+    //   Action :
+    //       CtrUid = OK
+    //   Output : 
+    //       OpenFile = OK
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,		//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+
+void CCamcTest_1::OpenFileL_002_L()
+    {
+    
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_002
+    //   
+    //     Action :
+    //        CtrUid = None (0x0)
+    //        FileName = OK
+    //     Output : 
+    //        OpenFile Leaves with KErrNotFound
+    //        or Callback is called with error msg
+    //    Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////   
+    
+    TUid controllerUid = {0x0};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+
+    // Function may leave with KErrNotFound, that's ok
+    if (err==KErrNotFound)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotFound, iCamcTestClient->WaitForCallbackWithErrors() );
+
+    }
+
+void CCamcTest_1::OpenFileL_003_L()
+    {
+    
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_003
+    //   
+    //     Action :
+    //        CtrUid = none
+    //        FileName = Extension not OK to find the controller
+    //     Output : 
+    //        OpenFile = Leave with KErrArgument 
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////    
+    
+    ////////////////////////////////////////
+    // Due to functionality changes, Test case is not relevant anymore
+    ////////////////////////////////////////
+    assertL(0);
+    
+    //TUid controllerUid = {0};	
+    //TUid formatUid = {0};
+    
+    //TRAPD(err,
+    //    iCamcTestClient->Test_OpenFileL(
+    //   _L("c:\\recordQCIF.txt"),		// File
+    //    0,								//CameraHandle
+    //    controllerUid,					//Controller UID
+    //    formatUid,						//Format UID
+    //    //TFourCC('2', '6', '3', 'B'),	//Video Type
+    //    _L8("video/3gpp"),
+    //    KMMFFourCCCodeNULL				//Audio Type
+    //    ));
+    
+    // OpenFile should not succeed...
+    // assertL (err==KErrArgument);
+    }
+
+void CCamcTest_1::OpenFileL_004_L()
+    {
+    
+    ///////////////////////////////////////
+    //	   ID: CAMC_API.OPENFILEL_004
+    //    
+    //     Action :
+    //	        CtrUid  = incorrect
+    //     Output : 
+    //         OpenFile = Leaves 
+    //           or MvruoOpenComplete return with an error
+    //         
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////   
+    
+    TUid controllerUid = {0x101F5023};   // This is a real Controller UID
+    // The Rubik Audio Controller
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+
+    // Function may leave with KErrNotFound, that's ok
+    if (err==KErrNotFound)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotFound, iCamcTestClient->WaitForCallbackWithErrors() );
+    
+    }
+
+void CCamcTest_1::OpenFileL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_005
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        NEW_MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_006_L()
+    {
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_006
+    //
+    //   Action :
+    //      Incorrect Video format UID
+    //   Output : 
+    //      OpenFile = Leaves with KErrNotSupported
+    //           or MvruoOpenComplete return with an error
+    //   Precondition :
+    //      CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {0x101f5c51};  // This is an audio Format, not supported
+    // by the video controller.
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+    // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+
+    }
+
+
+void CCamcTest_1::OpenFileL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_008
+    //   
+    //     Action :
+    //        Video Mime Type Supported
+    //     Output : 
+    //        OpenFile = OK
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_009_L()
+    {
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_009
+    //  
+    //    Action :
+    //       Video Mime Type = Not Present
+    //    Output : 
+    //       OpenFile = OK
+    //    Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid      			    	//Format UID
+        );
+    }
+
+void CCamcTest_1::OpenFileL_010_L()
+    {
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_010
+    //
+    //  Action :
+    //    VideoMimeType Unsupported
+    //  Output : 
+    //    OpenFile Leaves
+    //           or MvruoOpenComplete return with an error
+    //  Precondition :
+    //    CVideoRecorderUtility is ready
+    ///////////////////////////////////////  
+    
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        _L8("video/3gpp"),              //Usupported type...
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+    
+     // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+ 
+    }
+
+
+void CCamcTest_1::OpenFileL_011_L()
+    {   
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_011
+    //
+    //  Action :
+    //    Give a valid Camera Handler
+    //  Output : 
+    //    OK
+    //  Precondition :
+    //    Camera already used by someone else
+    ///////////////////////////////////////  
+    
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_1::OpenFileL_011_L CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_1::OpenFileL_011_L() using new MCameraObserver2" )) ); 
+       }
+    
+    
+    CleanupStack::PushL(iCamera);	
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iCamera->Handle(),				//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        );
+    
+    CleanupStack::PopAndDestroy();
+    
+    }
+
+void CCamcTest_1::OpenFileL_017_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_017
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_NEW};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3g2"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_018_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_018
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_NEW};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3g2"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        NEW_MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_020_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_020
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_MP4};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.mp4"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MPEG4_MIME_VIDEO_FORMAT,
+        ACC_AUDIO_FORMAT  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_021_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_021
+    //   Action :
+    //       videoFormat Unsupported
+    //   Output : 
+    //    OpenFile Leaves
+    //           or MvruoOpenComplete return with an error
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_MP4};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.mp4"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        UNSUPPORTED_VIDEO_FORMAT,
+        AMR_AUDIO_FORMAT  				//Audio Type
+        ));
+
+    // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+
+    }
+
+void CCamcTest_1::OpenFileL_030_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_030
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};  
+    TUid formatUid = {VIDEO_FORMAT_UID_MP4};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordVGA.mp4"),       // File
+        iUiLevelCameraHandle,                               //CameraHandle
+        controllerUid,                  //Controller UID
+        formatUid,                      //Format UID
+        H264_MIME_BASELINE_VIDEO_FORMAT,
+        ACC_AUDIO_FORMAT                //Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_031_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_031
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};  
+    TUid formatUid = {VIDEO_FORMAT_UID_MP4};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordVGA.mp4"),       // File
+        iUiLevelCameraHandle,                               //CameraHandle
+        controllerUid,                  //Controller UID
+        formatUid,                      //Format UID
+        H264_MIME_HIGH_VIDEO_FORMAT,
+        ACC_AUDIO_FORMAT                //Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       OpenDescL tests
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_1::OpenDesL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENDESCL_001
+    //   
+    //     Action :
+    //        Call to openDesc
+    //     Output : 
+    //        OpenDesc Leaves, unsupported.
+    //           or MvruoOpenComplete return with an error
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    /////////////////////////////////////// 
+    
+    TUid controllerUid = {0x101F8503};   
+    TUid formatUid = {0};
+    TBuf8 <100> myDescriptor;	 
+    TRAPD(err,iCamcTestClient->Test_OpenDesL(
+        myDescriptor,		// Descriptor
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        _L8("video/H263-2000"),
+        KMMFFourCCCodeNULL				//Audio Type
+        ));
+    
+    // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+ 
+    }
+
+// //////////////////////////////////////////////////////////////////
+//                       OpenUrlL tests
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_1::OpenUrlL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENURLL_001
+    //   
+    //     Action :
+    //        Call to openUrl
+    //     Output : 
+    //        OpenDesc Leaves, unsupported.
+    //           or MvruoOpenComplete return with an error
+    //  Precondition :
+    //        CVideoRecorderUtility is ready
+    /////////////////////////////////////// 
+    
+    TUid controllerUid = {0x101F8503};   
+    TUid formatUid = {0};	 
+    TRAPD(err,iCamcTestClient->Test_OpenUrlL(
+        _L("http:\\nokia.com"),		    // Descriptor
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        _L8("video/H263-2000"),
+        KMMFFourCCCodeNULL				//Audio Type
+        ));
+    
+     // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+ 
+    }
+
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_1::ReserveComplete(TInt aError)
+    {
+    RDebug::Print(_L("CCamcTest_1::ReserveComplete"));
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);  
+        return;
+        }
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+	    }
+    }
+
+void CCamcTest_1::PowerOnComplete(TInt aError)
+    {   
+    RDebug::Print(_L("CCamcTest_1::PowerOnComplete"));
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);  
+        return;
+        } 
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+    	{
+    	 iWaitScheduler->AsyncStop();
+	    }        
+	}
+
+void CCamcTest_1::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_1::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt aError)
+    {    
+    TBuf<128> str;
+    str.Format(_L("CCamcTest_1::ImageReady %i"), aError);
+    RDebug::Print(str);   
+    }
+void CCamcTest_1::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt aError )
+    {
+    TBuf<128> str;
+    str.Format(_L("CCamcTest_1::FrameBufferReady %i"), aError);
+    RDebug::Print(str);  
+    }
+
+void CCamcTest_1::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.  
+    
+    TBuf<128> str;
+    str.Format(_L("CCamcTest_1::Something In Active Object is leaving %i"), aError);
+    RDebug::Print(str);   
+
+    // Stop the active object scheduler.
+    iError=aError;
+    CActiveScheduler::Stop();
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_1::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_1::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_1::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_1::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_1::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_1::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_1::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_1::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_1::VideoBufferReady() returning" )));
+    }
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_1::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_1"));
+
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_001"), &OpenFileL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_002"), &OpenFileL_002_L));
+    // OPENFILEL_003 is not a valid test case.
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_004"), &OpenFileL_004_L));
+    // OPENFILEL_005 is not relevent in current configuration.
+      
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_005"), &OpenFileL_005_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_006"), &OpenFileL_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_008"), &OpenFileL_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_009"), &OpenFileL_009_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_010"), &OpenFileL_010_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_011"), &OpenFileL_011_L));
+  
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_017"), &OpenFileL_017_L));
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_018"), &OpenFileL_018_L));   
+#endif
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_020"), &OpenFileL_020_L));   
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_021"), &OpenFileL_021_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_030"), &OpenFileL_030_L));   
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_031"), &OpenFileL_031_L));      
+#endif
+    
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENDESCL_001"), &OpenDesL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENURLL_001"), &OpenUrlL_001_L));
+    
+    
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_2.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1216 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL, State transition tests
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_2.h"
+#include "CamcTest.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_2::CCamcTest_2 ()
+    {
+    }
+
+
+CCamcTest_2::~CCamcTest_2 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_2::setUpL ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest 2: SetUpL"));
+#endif
+    iCamcTestClient = CCamcTestClient_2::NewL( );
+
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_2::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_2::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    }
+
+
+void CCamcTest_2::tearDown ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest 2: TearDown Start"));
+#endif
+    delete iCamcTestClient;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest 2: TearDown Stop"));
+#endif
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;    
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+
+// //////////////////////////////////////////////////////////////////
+//                       Close tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::Close_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_001
+    //   Action :
+    //        Close when controller is open
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_002
+    //  Action :
+    //      Close before the controller has been open
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenControllerNotReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_003
+    //   Action :
+    //        Close when the controller is in prepared state 
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_004
+    //   Action :
+    //        Close after Recording is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenRecordingReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_005
+    //   Action :
+    //        Close when Recording
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenRecording, iUiLevelCameraHandle);
+
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+
+    AddDriveLetterToPath(_L("recordQCIF.3gp"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    
+    AddDriveLetterToPath(_L("CamcorderTmpDir"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNotFound, err );
+
+    AddDriveLetterToPath(_L("CamcorderTMP"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNotFound, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+
+void CCamcTest_2::Close_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_007
+    //   Action :
+    //        Close when the controller is in prepared state 
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenPrepareReadyUsingAACandMPEG4, iUiLevelCameraHandle);
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       Prepare tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::Prepare_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_001
+    //   Action :
+    //        Prepare when controller is open
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Prepare_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_002
+    //   Action :
+    //        Prepare before the controller has been open
+    //   Output : 
+    //        OK
+    //////////////////////////////////////  
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Prepare_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_003
+    //   Action :
+    //        Call Prepare() when already prepared
+    //	      No video attributes set before calling the 2nd prepare.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Prepare_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_004
+    //   Action :
+    //        Prepare after Recording is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenRecordingReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Prepare_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_005
+    //   Action :
+    //       Prepare when Recording
+    //   Output : 
+    //        Should leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Prepare_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_006
+    //   Action :
+    //        Call Prepare() when already prepared
+    //		Set the video attributes before calling the 2nd prepare.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenPrepareReadySetVideoAttributes, iUiLevelCameraHandle);
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       Record tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::Record_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_001
+    //   Action :
+    //        Record when controller is open, but not prepared.
+    //   Output : 
+    //        Leave KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenControllerReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Record_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_002
+    //   Action :
+    //        Record before the controller has been open
+    //   Output : 
+    //        Leave KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenControllerNotReady, iUiLevelCameraHandle)); 
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Record_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_003
+    //   Action :
+    //        Record when controller is prepared
+    //   Output : 
+    //        OK, file is recorded
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Record_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_004
+    //   Action :
+    //        Record when 1st recording is over.
+    //		No preparation.
+    //		
+    //   Output : 
+    //        Leave
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenRecordingReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Record_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_005
+    //   Action :
+    //        Record when already recording.
+    //		
+    //   Output : 
+    //        Ignores Record command
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenRecording, iUiLevelCameraHandle);
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetPriorityL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetPriorityL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_001
+    //   Action :
+    //        SetPriorityL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetPriorityL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_002
+    //   Action :
+    //        SetPriorityL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetPriorityL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_003
+    //   Action :
+    //        SetPriorityL when prepare is ready
+    //        Call prepare
+    //        Ask for the value of priority
+    //   Output : 
+    //        OK
+    //////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetPriorityL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_004
+    //   Action :
+    //        SetPriorityL while recording
+    //		
+    //   Output : 
+    //        Leaves with KErrNotReady
+    ////////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenRecording, iUiLevelCameraHandle)  );
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoFrameRateL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoFrameRateL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_001
+    //   Action :
+    //        SetVideoFrameRateL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ////////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoFrameRateL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_002
+    //   Action :
+    //        SetVideoFrameRateL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameRateL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_003
+    //   Action :
+    //        SetVideoFrameRateL when prepare is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoFrameRateL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_004
+    //   Action :
+    //        SetVideoFrameRateL while recording
+    //		
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenRecording, iUiLevelCameraHandle);
+    }
+
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoFrameSizeL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoFrameSizeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_001
+    //   Action :
+    //        SetVideoFrameSizeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_002
+    //   Action :
+    //        SetVideoFrameSizeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_003
+    //   Action :
+    //        SetVideoFrameSizeL when prepare is ready
+    //        Start Recording
+    //   Output : 
+    //        Leave with KErrNotReady?
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_004
+    //   Action :
+    //        SetVideoFrameSizeL while recording
+    //		
+    //   Output : 
+    //        Leaves with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_007
+    //   Action :
+    //        SetVideoFrameSizeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenControllerReady_MPEG4, iUiLevelCameraHandle);
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoBitRateL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_001
+    //   Action :
+    //        SetVideoBitRateL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoBitRateL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_002
+    //   Action :
+    //        SetVideoBitRateL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoBitRateL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_003
+    //   Action :
+    //        SetVideoBitRateL when prepare is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoBitRateL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_004
+    //   Action :
+    //        SetVideoBitRateL while recording
+    //		
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenRecording, iUiLevelCameraHandle);
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetAudioBitRateL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetAudioBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_001
+    //   Action :
+    //        SetAudioBitRateL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioBitRateL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_002
+    //   Action :
+    //        SetAudioBitRateL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioBitRateL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_003
+    //   Action :
+    //        SetAudioBitRateL when prepare is ready
+    //        Call prepare
+    //        Ask for bit rate.
+    //   Output : 
+    //        Bit rate is same as set.
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioBitRateL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_004
+    //   Action :
+    //        SetAudioBitRateL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetAudioEnabledL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetAudioEnabledL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_001
+    //   Action :
+    //        SetAudioEnabledL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioEnabledL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_002
+    //   Action :
+    //        SetAudioEnabledL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    /////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioEnabledL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_003
+    //   Action :
+    //        SetAudioEnabledL when prepare is ready
+    //   Output : 
+    //        Leave with KErrNotReady
+    ////////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioEnabledL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_004
+    //   Action :
+    //        SetAudioEnabledL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetMaxClipSizeL tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_2::SetMaxClipSizeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_001
+    //   Action :
+    //        SetMaxClipSizeL when controller is open, but not prepared.
+    //   Output : 
+    //        Size is reached. KErrCompletion is received
+    //////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenControllerReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrCompletion, err );
+    }
+
+
+void CCamcTest_2::SetMaxClipSizeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_002
+    //   Action :
+    //        SetMaxClipSizeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetMaxClipSizeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_003
+    //   Action :
+    //        SetMaxClipSizeL when prepare is ready
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetMaxClipSizeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_004
+    //   Action :
+    //        SetMaxClipSizeL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoTypeL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_001
+    //   Action :
+    //        SetVideoTypeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_002
+    //   Action :
+    //        SetVideoTypeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_003
+    //   Action :
+    //        SetVideoTypeL when prepare is ready
+    //        Record
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoTypeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_004
+    //   Action :
+    //        SetVideoTypeL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetAudioTypeL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetAudioTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_001
+    //   Action :
+    //        SetAudioTypeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    /////////////////////////////////////// 
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_002
+    //   Action :
+    //        SetAudioTypeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_003
+    //   Action :
+    //        SetAudioTypeL when prepare is ready
+    //        Record
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioTypeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_004
+    //   Action :
+    //        SetAudioTypeL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_2::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_2::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_2::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_2::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_2::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_2::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_2::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_2::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_2::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_2::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_2::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_2::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_2::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_2::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_2::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_2::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_2::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_2::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_2::VideoBufferReady() returning" )));
+    }
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+MTest* CCamcTest_2::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("State Transition tests (CamcTest2)"));
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_001"), &Close_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_002"), &Close_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_003"), &Close_003_L)); 
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_004"), &Close_004_L)); 
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_005"), &Close_005_L));
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_007"), &Close_007_L)); 
+#endif
+#endif
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_001"), &Prepare_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_002"), &Prepare_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_003"), &Prepare_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_004"), &Prepare_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_005"), &Prepare_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_006"), &Prepare_006_L));
+   
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_001"), &Record_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_002"), &Record_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_003"), &Record_003_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_004"), &Record_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_005"), &Record_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_001"), &SetPriorityL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_002"), &SetPriorityL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_003"), &SetPriorityL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_004"), &SetPriorityL_004_L));
+    
+  
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_001"), &SetVideoFrameRateL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_002"), &SetVideoFrameRateL_002_L));     
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_003"), &SetVideoFrameRateL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_004"), &SetVideoFrameRateL_004_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_001"), &SetVideoFrameSizeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_002"), &SetVideoFrameSizeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_003"), &SetVideoFrameSizeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_004"), &SetVideoFrameSizeL_004_L));
+
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_007"), &SetVideoFrameSizeL_007_L));
+#endif
+#endif
+   
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_001"), &SetVideoBitRateL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_002"), &SetVideoBitRateL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_003"), &SetVideoBitRateL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_004"), &SetVideoBitRateL_004_L));
+
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_001"), &SetAudioBitRateL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_002"), &SetAudioBitRateL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_003"), &SetAudioBitRateL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_004"), &SetAudioBitRateL_004_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_001"), &SetAudioEnabledL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_002"), &SetAudioEnabledL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_003"), &SetAudioEnabledL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_004"), &SetAudioEnabledL_004_L));
+    
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_001"), &SetMaxClipSizeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_002"), &SetMaxClipSizeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_003"), &SetMaxClipSizeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_004"), &SetMaxClipSizeL_004_L));
+    
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_001"), &SetVideoTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_002"), &SetVideoTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_003"), &SetVideoTypeL_003_L));  
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_004"), &SetVideoTypeL_004_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_001"), &SetAudioTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_002"), &SetAudioTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_003"), &SetAudioTypeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_004"), &SetAudioTypeL_004_L));
+    
+    return suite;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_3.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL, Tests for memory Failures
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_3.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+///////////////////////////////////////////////////////////////////
+// Tests for memory Failures
+//
+// Should be used together with CppUnit Memory Failure option.
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_3::CCamcTest_3 ()
+    {
+    }
+
+
+
+CCamcTest_3::~CCamcTest_3 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_3::setUpL ()
+    {
+    // Do nothing in the setUp to get Memory Failure functionality
+    }
+
+
+void CCamcTest_3::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       Memory Failure tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_3::NewL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.NEWL_001
+    //   Action :
+    //       CppUnit will generate all possible Memory Failure
+    //       Problems.
+    //   Output : 
+    //       Function should leave gracefully.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+    
+
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_3::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_3::setUp() using new MCameraObserver2" )) ); 
+       }
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+
+    iCamcTestClient = CCamcTestClient_3::NewL( iUiLevelCameraHandle );
+    
+    delete iWaitScheduler;
+    delete iUiLevelCamera;       
+    // Succeed, if it doesn't leave.
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_3::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_3::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_3::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_3::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_3::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_3::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_3::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_3::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_3::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_3::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_3::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_3::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_3::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_3::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_3::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_3::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_3::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_3::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_3::VideoBufferReady() returning" )));
+    }
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_3::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_3"));
+    
+    suite->addTestL(CTestCaller<CCamcTest_3>::NewL(_L8("CAMC_API.NEWL_001"), &NewL_001_L));
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_4.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,361 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL, State transition tests
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_4.h"
+#include "CamcTest.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+///////////////////////////////////////////////////////////////////
+// Automated API Tests 
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_4::CCamcTest_4 ()
+    {
+    }
+
+
+
+CCamcTest_4::~CCamcTest_4 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_4::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_4::NewL( );
+
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_4::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_4::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();       
+    }
+
+
+void CCamcTest_4::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;      
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       RecordTimeAvailableL tests
+// //////////////////////////////////////////////////////////////////
+
+// Allows a 10% margin for the filesize
+#define TC4_ALLOWED_MARGIN ( TC4_FILE_SIZE_LIMIT * 0.1 )
+
+void CCamcTest_4::RecordTimeAvailableL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_001
+    //   Action :
+    //       Ask time available frequently using timer
+    //   Output : 
+    //       Value is decreasing all the time
+    //   Precondition :
+    //       File Size limit set.
+    //       Recording
+    ///////////////////////////////////////
+
+
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailSizeLimit, iUiLevelCameraHandle );
+
+    /* Check if size is according to previously set Size limit */
+    RFile file; 
+    TInt filesize;
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    err = file.Size(filesize);
+    
+    file.Close();
+    fsSession.Close();
+
+    if ( ( filesize > TC4_FILE_SIZE_LIMIT + TC4_ALLOWED_MARGIN ) ||
+        (filesize < TC4_FILE_SIZE_LIMIT - TC4_ALLOWED_MARGIN ) )
+        {
+        assertL(0);
+        }
+    }
+
+
+void CCamcTest_4::RecordTimeAvailableL_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_002
+    //   Action :
+    //       Ask time available frequently using timer
+    //   Output : 
+    //       Value is decreasing all the time
+    //   Precondition :
+    //       File Size limit is NOT set.
+    //       Recording
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailNoSizeLimit, iUiLevelCameraHandle  );
+
+    }
+
+void CCamcTest_4::RecordTimeAvailableL_003_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_003
+    //   Action :
+    //       Not recording, size limit set
+    //       Asking RecordTimeAvailable()
+    //   Output : 
+    //       Value is proportional to size limit set
+    //   Precondition :
+    //       File Size limit is set.
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailNotRecordingSizeLimit, iUiLevelCameraHandle  );
+
+    }
+
+void CCamcTest_4::RecordTimeAvailableL_004_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_004
+    //   Action :    
+    //       Asking RecordTimeAvailable()
+    //   Output : 
+    //       Value is acceptable
+    //   Precondition :    
+    //       Not recording, size limit NOT set
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailNotRecordingNoSizeLimit, iUiLevelCameraHandle  );
+
+    }
+
+void CCamcTest_4::RecordTimeAvailableL_006_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_006
+    //   Action :    
+    //       Asking RecordTimeAvailable(), every seconds,
+    //       and keep in memory last value for Time Remaining
+    //   Output : 
+    //       Value is acceptable. Last value of Time Remaining <= 5 sec.
+    //   Precondition :    
+    //       Recording, size limit NOT set
+    ///////////////////////////////////////
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailUntilDiskFull, iUiLevelCameraHandle  ));
+    assertTIntsEqualL( KErrDiskFull, err );
+
+    }
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_4::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_4::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_4::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_4::PowerOnComplete"));
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_4::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_4::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_4::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_4::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_4::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_4::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_4::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_4::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_4::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_4::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_4::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_4::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_4::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_4::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_4::VideoBufferReady() returning" )));
+    }
+
+
+
+MTest* CCamcTest_4::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_4"));
+
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_001"), &RecordTimeAvailableL_001_L));
+#if ! (defined (__WINS__) || defined (__WINSCW__) )
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_002"), &RecordTimeAvailableL_002_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_003"), &RecordTimeAvailableL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_004"), &RecordTimeAvailableL_004_L));
+
+    // RecordTimeAvailableL_006, only to be tested on HW
+    // Removed from MuDo tests
+#if ! (defined (__WINS__) || defined (__WINSCW__) )
+//    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_006"), &RecordTimeAvailableL_006_L));
+#endif
+  
+    return suite;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_5.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,996 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_5.h"
+#include "CamcTest.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_5::CCamcTest_5 ()
+    {
+    }
+
+CCamcTest_5::~CCamcTest_5 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_5::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_5::NewL( );
+    
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_5::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_5::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    }
+
+
+void CCamcTest_5::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;        
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       Memory Failure tests
+// //////////////////////////////////////////////////////////////////
+
+/******************************/
+/*NUMBER OF META DATA ENTRIES */
+/******************************/
+
+void CCamcTest_5::NumberOfMetaDataEntriesL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.NUMBEROFMETADATAENTRIESL_001
+    //   Action :
+    //       Call NumberOfMetaDataEntriesL() when not recording
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       Not recording
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_NumberOfMetaDataEntriesWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::NumberOfMetaDataEntriesL_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.NUMBEROFMETADATAENTRIESL_002
+    //   Action :
+    //       Call NumberOfMetaDataEntriesL() when recording
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       Recording
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_NumberOfMetaDataEntriesWhenRecording, iUiLevelCameraHandle);
+    }
+
+/*******************************/
+/*      META DATA ENTRY        */
+/*******************************/
+
+void CCamcTest_5::MetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.METADATAENTRYL_001
+    //   Action :
+    //        Call MetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrNotSupported
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_MetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_5::MetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.METADATAENTRYL_002
+    //   Action :
+    //        Call MetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrNotSupported
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_MetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+/*******************************/
+/*    ADD META DATA ENTRY      */
+/*******************************/
+
+void CCamcTest_5::AddMetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.ADDMETADATAENTRYL_001
+    //   Action :
+    //        Call AddMetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_AddMetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_5::AddMetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.ADDMETADATAENTRYL_002
+    //   Action :
+    //        Call AddMetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_AddMetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+/********************************/
+/*    REMOVE META DATA ENTRY    */
+/********************************/
+
+void CCamcTest_5::RemoveMetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REMOVEMETADATAENTRYL_001
+    //   Action :
+    //        Call RemoveMetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_RemoveMetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+void CCamcTest_5::RemoveMetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REMOVEMETADATAENTRYL_002
+    //   Action :
+    //        Call RemoveMetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_RemoveMetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/*********************************/
+/*    REPLACE META DATA ENTRY    */
+/*********************************/
+
+void CCamcTest_5::ReplaceMetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REPLACEMETADATAENTRYL_001
+    //   Action :
+    //        Call ReplaceMetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_ReplaceMetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+void CCamcTest_5::ReplaceMetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REPLACEMETADATAENTRYL_002
+    //   Action :
+    //        Call ReplaceMetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_ReplaceMetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*        SET PRIORITY            */
+/**********************************/
+
+void CCamcTest_5::SetPriorityL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_005
+    //   Action :
+    //        Set wrong SetPriorityL() 
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetPriorityWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*         GET PRIORITY           */
+/**********************************/
+
+void CCamcTest_5::GetPriorityL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.GETPRIORITYL_001
+    //   Action :
+    //       Call GetPriorityL() when not set
+    //   Output : 
+    //       
+    //   Precondition :
+    //       Not set
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetPriorityWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*         SET VIDEO FRAME RATE   */
+/**********************************/
+
+void CCamcTest_5::SetVideoFrameRateL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_005
+    //   Action :
+    //        Set wrong SetVideoFrameRateL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetVideoFrameRateWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*         VIDEO FRAME RATE       */
+/**********************************/
+
+void CCamcTest_5::VideoFrameRateL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VIDEOFRAMERATEL_001
+    //   Action :
+    //       Call VideoFrameRateL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_VideoFrameRateWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET VIDEO BIT RATE      */
+/**********************************/
+
+void CCamcTest_5::SetVideoBitRateL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_005
+    //   Action :
+    //        Set wrong SetVideoBitRateL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetVideoBitRateWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*         VIDEO BIT RATE         */
+/**********************************/
+
+void CCamcTest_5::VideoBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VIDEOBITRATEL_001
+    //   Action :
+    //       Call VideoBitRateL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_VideoBitRateWhenNotSet, iUiLevelCameraHandle);
+
+    }
+
+/**********************************/
+/*        SET AUDIO BIT RATE      */
+/**********************************/
+
+void CCamcTest_5::SetAudioBitRateL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_005
+    //   Action :
+    //        Set wrong SetAudioBitRateL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetAudioBitRateWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*        AUDIO BIT RATE          */
+/**********************************/
+
+void CCamcTest_5::AudioBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.AUDIOBITRATEL_001
+    //   Action :
+    //       Call AudioBitRateL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_AudioBitRateWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET AUDIO ENABLED       */
+/**********************************/
+
+void CCamcTest_5::SetAudioEnabledL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_005
+    //   Action :
+    //        SetAudioEnabledL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetAudioEnabledWhenOpenNotPrepared, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        AUDIO ENABLED           */
+/**********************************/
+
+void CCamcTest_5::AudioEnabledL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOENABLEDL_001
+    //   Action :
+    //        AudioEnabledL when not set
+    //   Output : 
+    //        
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_AudioEnabledWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET VIDEO FRAME SIZE    */
+/**********************************/
+
+void CCamcTest_5::SetVideoFrameSizeL_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_006
+    //   Action :
+    //        Set wrong SetVideoFrameSizeL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetVideoFrameSizeWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*        GET VIDEO FRAME SIZE    */
+/**********************************/
+
+void CCamcTest_5::GetVideoFrameSizeL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.GETVIDEOFRAMESIZEL_001
+    //   Action :
+    //       Call GetVideoFrameSizeL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetVideoFrameSizeWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*            PAUSE               */
+/**********************************/
+
+void CCamcTest_5::PauseL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PAUSEL_001
+    //   Action :
+    //        Pauses recording per request when recording
+    //   Output : 
+    //        Leave?
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_PauseWhenRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::PauseL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PAUSEL_001
+    //   Action :
+    //        Ignores request to pause when not recording
+    //   Output : 
+    //        Leave?
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_PauseWhenStopped, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET MAX CLIP SIZE    */
+/**********************************/
+
+void CCamcTest_5::SetMaxClipSizeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_005
+    //   Action :
+    //        Set invalid size for SetMaxClipSizeL when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetMaxClipSizeLWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*          SET GAIN              */
+/**********************************/
+
+void CCamcTest_5::SetGainL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETGAINL_001
+    //   Action :
+    //        Set acceptable & ask, SetGainL when not recording.
+    //   Output : 
+    //        compare
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetGainWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::SetGainL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETGAINL_002
+    //   Action :
+    //        Set wrong SetGainL()
+    //   Output : 
+    //        The value is corrected inside the Video Recorder, 
+    //        the user is not warned of his error.
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetGainWhenNotRecordingAndSetWrong, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::SetGainL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETGAINL_003
+    //   Action :
+    //        Set acceptable & ask, SetGainL when recording.
+    //   Output : 
+    //        compare
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetGainWhenRecording, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*              GAIN              */
+/**********************************/
+
+void CCamcTest_5::GainL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.GAINL_001
+    //   Action :
+    //       Call GainL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_GainWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*           MAX GAIN             */
+/**********************************/
+
+void CCamcTest_5::MaxGainL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.MAXGAINL_001
+    //   Action :
+    //       Call MaxGainL() when not recording
+    //   Output : 
+    //       Function should retrun 0???
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_MaxGainWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::MaxGainL_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.MAXGAINL_002
+    //   Action :
+    //       Call MaxGainL() when recording
+    //   Output : 
+    //       Function should retrun 0???
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_MaxGainWhenRecording, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*             STOP               */
+/**********************************/
+
+void CCamcTest_5::Stop_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_001
+    //   Action :
+    //        Call stop when recording
+    //   Output : 
+    //        Video Recording is stopped.
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::Stop_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_002
+    //   Action :
+    //        Call Stop when not recording or paused
+    //   Output : 
+    //        Nothing
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::Stop_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_003
+    //   Action :
+    //        Stop + start timer + close + prepare
+    //   Output : 
+    //        New prepare complete, Prepare ready in 2 seconds
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingNewPrepareCorrect, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::Stop_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_004
+    //   Action :
+    //        Stop + close + open file
+    //   Output : 
+    //        File can be opened for reading
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingAfterOpenFile, iUiLevelCameraHandle);
+
+/* File can be opened for reading */
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::Stop_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_005
+    //   Action :
+    //        Stop + close + open file
+    //   Output : 
+    //        File can be opened for reading
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingAfterOpenFileNew, iUiLevelCameraHandle);
+
+/* File can be opened for reading */
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3g2"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::Stop_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_007
+    //   Action :
+    //        Stop + close + open file
+    //   Output : 
+    //        File can be opened for reading
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4, iUiLevelCameraHandle);
+
+/* File can be opened for reading */
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.mp4"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::GetSupportedVideoTypes_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDVIDEOTYPESL_001
+    //   Action :
+    //        GetSupportedVideoTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedVideoTypesWhenOpenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::GetSupportedVideoTypes_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDVIDEOTYPESL_002
+    //   Action :
+    //        GetSupportedVideoTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedVideoTypesWhenOpenNotRecordingNew, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::GetSupportedAudioTypes_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDAUDIOTYPESL_001
+    //   Action :
+    //        GetSupportedAudioTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAMR, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::GetSupportedAudioTypes_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDAUDIOTYPESL_003
+    //   Action :
+    //        GetSupportedAudioTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAAC, iUiLevelCameraHandle);
+    }
+    
+    
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_5::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_5::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_5::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_5::PowerOnComplete"));
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_5::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_5::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_5::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+  
+// -----------------------------------------------------------------------------
+// CCamcTest_5::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_5::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_5::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_5::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_5::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_5::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_5::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_5::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_5::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_5::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_5::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_5::VideoBufferReady() returning" )));
+    }
+
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_5::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_5"));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.NUMBEROFMETADATAENTRIESL_001"), &NumberOfMetaDataEntriesL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.NUMBEROFMETADATAENTRIESL_002"), &NumberOfMetaDataEntriesL_002_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.METADATAENTRYL_001"), &MetaDataEntryL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.METADATAENTRYL_002"), &MetaDataEntryL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.ADDMETADATAENTRYL_001"), &AddMetaDataEntryL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.ADDMETADATAENTRYL_002"), &AddMetaDataEntryL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REMOVEMETADATAENTRYL_001"), &RemoveMetaDataEntryL_001_L));   
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REMOVEMETADATAENTRYL_002"), &RemoveMetaDataEntryL_002_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REPLACEMETADATAENTRYL_001"), &ReplaceMetaDataEntryL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REPLACEMETADATAENTRYL_002"), &ReplaceMetaDataEntryL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETPRIORITYL_005"), &SetPriorityL_005_L));     
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETPRIORITYL_001"), &GetPriorityL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_005"), &SetVideoFrameRateL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.VIDEOFRAMERATEL_001"), &VideoFrameRateL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_005"), &SetVideoBitRateL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.VIDEOBITRATEL_001"), &VideoBitRateL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_005"), &SetAudioBitRateL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.AUDIOBITRATEL_001"), &AudioBitRateL_001_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_005"), &SetAudioEnabledL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.AUDIOENABLEDL_001"), &AudioEnabledL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_006"), &SetVideoFrameSizeL_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETVIDEOFRAMESIZEL_001"), &GetVideoFrameSizeL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.PAUSEL_001"), &PauseL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.PAUSEL_002"), &PauseL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_005"), &SetMaxClipSizeL_005_L));
+     
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETGAINL_001"), &SetGainL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETGAINL_002"), &SetGainL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETGAINL_003"), &SetGainL_003_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GAINL_001"), &GainL_001_L));
+   
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.MAXGAINL_001"), &MaxGainL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.MAXGAINL_002"), &MaxGainL_002_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_001"), &Stop_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_002"), &Stop_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_003"), &Stop_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_004"), &Stop_004_L));
+    
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_005"), &Stop_005_L));
+#endif
+#ifndef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDVIDEOTYPESL_001"), &GetSupportedVideoTypes_001_L));
+#else
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDVIDEOTYPESL_002"), &GetSupportedVideoTypes_002_L));
+#endif
+
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    // MP4 AAC + AMR
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDAUDIOTYPESL_003"), &GetSupportedAudioTypes_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_007"), &Stop_007_L));
+#endif
+    // AMR-only
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDAUDIOTYPESL_001"), &GetSupportedAudioTypes_001_L));
+
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_6.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,989 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_6.h"
+#include "CamcTest.h"
+#include <bldvariant.hrh>
+
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+CCamcTest_6::CCamcTest_6 ()
+    {
+    }
+
+
+
+CCamcTest_6::~CCamcTest_6 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_6::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_6::NewL( );
+    
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_6::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_6::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    }
+
+
+void CCamcTest_6::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;      
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+/***************************/
+/*           PAUSE         */
+/***************************/
+
+void CCamcTest_6::PauseL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PAUSEL_003
+    //   Action :
+    //        Call pause when stopped
+    //   Output : 
+    //        Leave?
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_PauseWhenStopped, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*  SET VIDEO FRAME SIZE  */
+/**************************/
+
+void CCamcTest_6::SetVideoFrameSizeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_005
+    //   Action :
+    //        SetVideoFrameSizeL when paused
+    //		
+    //   Output : 
+    //        Leaves with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoFrameSizeLWhenPaused, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+/**************************/
+/*    SET AUDIO ENABLED   */
+/**************************/
+
+void CCamcTest_6::SetAudioEnabledL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_005
+    //   Action :
+    //        SetAudioEnabledL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioEnabledLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*   SET MAX CLIP SIZE    */
+/**************************/ 
+
+void CCamcTest_6::SetMaxClipSizeL_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_006
+    //   Action :
+    //        Set invalid size for SetMaxClipSizeL when controller open
+    //   Output : 
+    //        Leave with KErrNotReady??
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetMaxClipSizeLWhenControllerReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+// Allows a 10% margin for the filesize
+#define TC6_ALLOWED_MARGIN 0.1 
+
+void CCamcTest_6::SetMaxClipSizeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_007
+    //   Action :
+    //        SetMaxClipSizeL when prepare is ready
+    //   Output : 
+    //        Check file size 
+    ///////////////////////////////////////    
+    
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetMaxClipSizeLWhenPrepareReady, iUiLevelCameraHandle);
+    
+/* Check if size is according to previously set Size limit */
+    RFile file; 
+    TInt filesize;
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    err = file.Size(filesize);
+    file.Close();
+    fsSession.Close();
+    if ( ( filesize > TC6_FILE_SIZE_LIMIT * (1 + TC6_ALLOWED_MARGIN ) ) ||
+        ( filesize < TC6_FILE_SIZE_LIMIT * (1 - TC6_ALLOWED_MARGIN ) ) )
+        {
+        assertL(0);
+        }
+    }
+
+/**************************/
+/*       RECORD           */
+/**************************/ 
+
+void CCamcTest_6::Record_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_006
+    //   Action :
+    //        Record when PrepareComplete, no size limit
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_RecordWhenPrepareComplete, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::Record_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_007
+    //   Action :
+    //        Record when paused
+    //   Output : 
+    //        OK, No error in callback ???
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_RecordWhenPaused, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*       VIDEO TYPE       */
+/**************************/ 
+
+void CCamcTest_6::VideoTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_001
+    //   Action :
+    //        Call VideoType when opened with specified type, not recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_002
+    //   Action :
+    //        Call VideoType when opened Without Specifying VideoType, not recording
+    //   Output : 
+    //        must be sensible ??
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_003
+    //   Action :
+    //        Call VideoType when opened with specified type, recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithMimeAndRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_004
+    //   Action :
+    //        Call VideoType when open with NULL, not recording. 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_005
+    //   Action :
+    //        Call VideoType 
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*       AUDIO TYPE       */
+/**************************/ 
+
+void CCamcTest_6::AudioTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOTYPEL_001
+    //   Action :
+    //        Call AudioType when open with fourCC, not recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_AudioTypeLWhenOpenWithfourCCAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::AudioTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOTYPEL_002
+    //   Action :
+    //        Call AudioType when open without specifying the audio type, not recording
+    //   Output : 
+    //        must be sensible ??
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::AudioTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOTYPEL_003
+    //   Action :
+    //        Call AudioType when open with fourCC, recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_AudioTypeLWhenOpenWithfourCCAndRecording, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*     SET VIDEO TYPE     */
+/**************************/ 
+
+void CCamcTest_6::SetVideoTypeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_005
+    //   Action :
+    //        Call SetVideoType when open without specifying the videoType. 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetVideoTypeL_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_006
+    //   Action : 
+    //        SetVideoTypeL called with "video/mp4v-es; profile=8" 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWithProfile8, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetVideoTypeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_007
+    //   Action :
+    //        SetVideoType when not recording, set wrong 
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_6::SetVideoTypeL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_008
+    //   Action :
+    //        SetVideoTypeL called with "video/H263-2000; profile=0" 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWithProfile, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetVideoTypeL_009_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_009
+    //   Action :
+    //        SetVideoTypeL called with "video/mp4v-es; profile-level-id=3" 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWithProfile3, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*     SET AUDIO TYPE     */
+/**************************/ 
+
+void CCamcTest_6::SetAudioTypeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_005
+    //   Action :
+    //        Call SetAudioType when open Without Specifying Audio Type, not recording. 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetAudioTypeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_007
+    //   Action :
+    //        SetAudioType when not recording, set wrong 
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioTypeLWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_6::SetAudioTypeL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_008
+    //   Action :
+    //        Call SetAudioType when open with fourCC, not recording. 
+    //   Output : 
+    //        compare (seted different acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC, iUiLevelCameraHandle);
+    }
+
+
+/***************************************/
+/*CONTROLLER IMPLEMENTATION INFORMATION*/
+/***************************************/
+
+void CCamcTest_6::ControllerImplementationInformationL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_001
+    //   Action :
+    //        ControllerImplementationInformationL when not open
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenNotOpen, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_6::ControllerImplementationInformationL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_002
+    //   Action :
+    //        ControllerImplementationInformationL when open
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenOpen, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::ControllerImplementationInformationL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_003
+    //   Action :
+    //        ControllerImplementationInformationL when open
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenOpenNew, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::ControllerImplementationInformationL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_004
+    //   Action :
+    //        ControllerImplementationInformationL when open
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4, iUiLevelCameraHandle);
+    }
+
+
+
+/**************************/
+/*         DURATION       */
+/**************************/ 
+
+void CCamcTest_6::DurationL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.DURATIONL_001
+    //   Action :
+    //        DurationL when recording
+    //   Output : 
+    //        Must be close to timeout*n time
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_DurationWhenRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::DurationL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.DURATIONL_002
+    //   Action :
+    //        DurationL when not recording
+    //   Output : 
+    //        Value must be 0
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_DurationWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::DurationL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.DURATIONL_003
+    //   Action :
+    //        Recording paused then resumed 
+    //   Output : 
+    //        Pause, Resume and Ask Duration frequently using timer
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_DurationWhenPaused, iUiLevelCameraHandle);
+    }
+
+
+/**************************/
+/*     Registration       */
+/**************************/ 
+
+
+void CCamcTest_6::MMFRegistration_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_001
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationL ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+void CCamcTest_6::MMFRegistration_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_002
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for :Controller UID, Version, Supplier, 
+    //        Supported Media UIDs and Formats
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp2"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewL ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+void CCamcTest_6::MMFRegistration_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_003
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewL ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+void CCamcTest_6::MMFRegistration_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_004
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/mp4"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewMPEG4L ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+
+void CCamcTest_6::MMFRegistration_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_005
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp2"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewMPEG4L ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+
+void CCamcTest_6::MMFRegistration_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_006
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewMPEG4L ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_6::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_6::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_6::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_6::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_6::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_6::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_6::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+  
+// -----------------------------------------------------------------------------
+// CCamcTest_6::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_6::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_6::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_6::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_6::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_6::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_6::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_6::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_6::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_6::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_6::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_6::VideoBufferReady() returning" )));
+    }
+
+
+
+/*********************************************************************************************/
+
+
+MTest* CCamcTest_6::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_6")); 
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.PAUSEL_003"), &PauseL_003_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_005"), &SetVideoFrameSizeL_005_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_005"), &SetAudioEnabledL_005_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_006"), &SetMaxClipSizeL_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_007"), &SetMaxClipSizeL_007_L));
+
+    // Record_006, only to be tested on HW
+    // Removed from MuDo tests
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+//    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.RECORD_006"), &Record_006_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.RECORD_007"), &Record_007_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_001"), &VideoTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_002"), &VideoTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_003"), &VideoTypeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_004"), &VideoTypeL_004_L));
+   
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_005"), &VideoTypeL_005_L));
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.AUDIOTYPEL_001"), &AudioTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.AUDIOTYPEL_002"), &AudioTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.AUDIOTYPEL_003"), &AudioTypeL_003_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_005"), &SetVideoTypeL_005_L));
+   
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_006"), &SetVideoTypeL_006_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_007"), &SetVideoTypeL_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_008"), &SetVideoTypeL_008_L));
+
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_009"), &SetVideoTypeL_009_L));
+#endif
+#endif
+    
+    
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_005"), &SetAudioTypeL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_007"), &SetAudioTypeL_007_L));   
+
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_008"), &SetAudioTypeL_008_L));
+#endif
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_001"), &ControllerImplementationInformationL_001_L));   
+#ifndef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_003"), &ControllerImplementationInformationL_003_L));   
+#else
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_004"), &ControllerImplementationInformationL_004_L));   
+#endif
+
+#ifndef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_002"), &MMFRegistration_002_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_003"), &MMFRegistration_003_L));   
+#else
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_004"), &MMFRegistration_004_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_005"), &MMFRegistration_005_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_006"), &MMFRegistration_006_L));   
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.DURATIONL_001"), &DurationL_001_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.DURATIONL_002"), &DurationL_002_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.DURATIONL_003"), &DurationL_003_L));   
+
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_7.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_7.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+///////////////////////////////////////////////////////////////////
+// Tests for Cooperation with Camera API
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_7::CCamcTest_7 ()
+    {
+    }
+
+
+
+CCamcTest_7::~CCamcTest_7 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_7::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_7::NewL( );
+    }
+
+
+void CCamcTest_7::tearDown ()
+    {   
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+void CCamcTest_7::OpenFileL_007_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_007
+    //
+    //   Action :
+    //      Video Format UID = NULL
+	//   Output : 
+    //      Recording works, Doesn't leave.
+    //   Precondition :
+    //      CVideoRecorderUtility is ready
+    /////////////////////////////////////// 
+    
+    iCamcTestClient->Start_Active_ObjectL( K_Tc7_OpenFileWithVideoFormatNULL );
+    }
+
+void CCamcTest_7::OpenFileL_013_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.OPENFILE_13
+    //   Action :
+    //       Application release the camera while Camcorder still
+    //       records
+    //   Output : 
+    //       Recording continues till the end.
+    //   Precondition :
+    //       Camera Reserved, CamC recording
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc7_ReleaseCameraWhileRecording);
+ 
+    }
+
+void CCamcTest_7::OpenFileL_014_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.OPENFILE_014
+    //   Action :
+    //       Application powers off the camera while Camcorder still
+    //       records
+    //   Output : 
+    //       Recording stops with KErrNotReady.
+    //   Precondition :
+    //       Camera Reserved, CamC recording
+    ///////////////////////////////////////
+    
+    TRAPD(err, 
+        iCamcTestClient->Start_Active_ObjectL( K_Tc7_PowerOffCameraWhileRecording ) );
+    assertTIntsEqualL( KErrNotReady, err );
+
+    }
+
+void CCamcTest_7::OpenFileL_015_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.OPENFILE_015
+    //   Action :
+    //       Camera is used by an other application,
+    //       Call to OpenFileL()
+    //   Output : 
+    //       Should leave.
+    //   Precondition :
+    //       Camera Reserved by an other application.
+    ///////////////////////////////////////
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL( K_Tc7_OpenFileWhenCameraIsNotAvailable ));
+    assertTIntsEqualL( KErrInUse, err );
+    
+    }
+
+void CCamcTest_7::Close_006_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.CLOSE_006
+    //   Action :
+    //       Application release the camera while Camcorder still
+    //       records
+    //       Camcorder is Closed
+    //   Output : 
+    //       The Camera can be used by somebody else.
+    //   Precondition :
+    //       Camera Reserved, CamC recording
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL( K_Tc7_ReleaseCameraCloseRecorderUseCamera);
+
+    
+    // Succeed, if it doesn't leave.
+    }
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+MTest* CCamcTest_7::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_7"));   
+    
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_007"), &OpenFileL_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_013"), &OpenFileL_013_L));
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_014"), &OpenFileL_014_L));
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_015"), &OpenFileL_015_L));
+// Removed from MuDo tests
+//    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.CLOSE_006"), &Close_006_L));
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_8.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,471 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_8.h"
+#include "CamcTest.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+///////////////////////////////////////////////////////////////////
+// Tests for Cooperation with Camera API
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_8::CCamcTest_8 ()
+    {
+    }
+
+
+
+CCamcTest_8::~CCamcTest_8 ()
+    {
+    delete iCamcTestClient1; // To mute PCLINT
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; // To mute PCLINT
+    iCamcTestClient2 = NULL;
+    }
+
+
+void CCamcTest_8::setUpL ()
+    {
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_8::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_8::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();        
+    }
+
+
+void CCamcTest_8::tearDown ()
+    {   
+    delete iWaitScheduler;
+    delete iUiLevelCamera;    
+        
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+void CCamcTest_8::MultipleInstance_001_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_001
+    //
+    //   Action :
+    //      1 Camcorder is in Prepared state
+    //      A 2nd Camcorder is instanciated with same file name.
+	//   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError,&numberOfCamcOpen, iUiLevelCameraHandle);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError,&numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance001_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance001_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1;      
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+
+    }
+
+
+void CCamcTest_8::MultipleInstance_002_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_002
+    //
+    //   Action :
+    //      1 Camcorder is in Prepared state
+    //      A 2nd Camcorder is instanciated with different file name.
+    //   Output : 
+    //      OK
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file ,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance002_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance002_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+    assertTIntsEqualL( KErrNone, iError );
+    delete iCamcTestClient1;      
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2;   
+    iCamcTestClient2 = NULL;
+    }
+
+void CCamcTest_8::MultipleInstance_003_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_003
+    //
+    //   Action :
+    //      1 Camcorder is in Prepared state
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+    
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance003_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance003_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1;       
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2;   
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    }
+
+
+
+void CCamcTest_8::MultipleInstance_004_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_004
+    //
+    //   Action :
+    //      1 Camcorder is Recording
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+    
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance004_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance004_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1; 
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    }
+
+
+
+void CCamcTest_8::MultipleInstance_005_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_005
+    //
+    //   Action :
+    //      1 Camcorder has finished Recording
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leaves with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file ,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance005_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance005_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+    
+    delete iCamcTestClient1; 
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    assertTIntsEqualL( KErrHardwareNotAvailable, iError );
+    }
+
+
+void CCamcTest_8::MultipleInstance_006_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_006
+    //
+    //   Action :
+    //      1 Camcorder is Recording
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance006_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance006_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1;  
+    iCamcTestClient1 = NULL;      
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    }
+    
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_8::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_8::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_8::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_8::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_8::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_8::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_8::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+    
+  
+// -----------------------------------------------------------------------------
+// CCamcTest_8::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_8::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_8::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_8::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_8::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_8::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_8::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_8::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_8::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_8::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_8::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_8::VideoBufferReady() returning" )));
+    }
+
+
+
+
+MTest* CCamcTest_8::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_8"));   
+
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_001"), &MultipleInstance_001_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_002"), &MultipleInstance_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_003"), &MultipleInstance_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_004"), &MultipleInstance_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_005"), &MultipleInstance_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_006"), &MultipleInstance_006_L));
+    
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_9.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,716 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_9.h"
+#include "CamcTest.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// Allows a 10% margin for the filesize
+#define TC9_ALLOWED_MARGIN ( TC9_FILE_SIZE_LIMIT * 0.1 )
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+CCamcTest_9::CCamcTest_9 ()
+    {
+    }
+
+
+
+CCamcTest_9::~CCamcTest_9 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_9::setUpL ()
+    {
+        {
+        iCamcTestClient = CCamcTestClient_9::NewL( );
+        }
+    // Do nothing in the setUp to get Memory Failure functionality
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_9::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_9::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();     
+    }
+
+
+void CCamcTest_9::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;     
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       Prepare tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_9::Prepare_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_007
+    //   Action :
+    //        Prepare when controller is open.
+    //        Call prepare, without setting anything (using all defaults)
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_PrepareWhenControllerReadyWhitoutSetting, iUiLevelCameraHandle);
+    }
+    
+void CCamcTest_9::Prepare_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_008
+    //   Action :
+    //        Prepare when controller is open. Call prepare, setting 
+    //        only VideoBitRate (using defaults for the other parameters)
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_9::Prepare_009_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_009
+    //   Action :
+    //        Prepare when controller is open. Call prepare, setting 
+    //        only VideoFrameSize (using defaults for the other parameters)
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_9::RecordTimeAvailableL_005_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_005
+    //   Action :    
+    //       Asking RecordTimeAvailable()
+    //       Once Recording is ready
+    //   Output : 
+    //       Value must be sensible
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL( K_Tc9_RecordTimeAvailWhenRecordingReady, iUiLevelCameraHandle );
+    }
+
+/**************************/
+/*   SET MAX CLIP SIZE    */
+/**************************/ 
+
+void CCamcTest_9::SetMaxClipSizeL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_008
+    //   Action :
+    //        SetMaxClipSizeL when controller is open. Set size = 0
+    //   Output : 
+    //        Must record until disk full.
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_SetMaxClipSizeLWhenControllerReadySize0, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_9::SetMaxClipSizeL_009_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_009
+    //   Action :
+    //        SetMaxClipSizeL when controller is open. Set size = KMMFNoMaxClipSize
+    //   Output : 
+    //        Must record until disk full.
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*     NEW FILE NAME      */
+/**************************/ 
+
+void CCamcTest_9::NewFileName_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_001
+    //   Action :
+    //        Set NewFileName when prepared, not recording 
+    //   Output : 
+    //        New video, which have new name.
+    ///////////////////////////////////////    
+    TInt err;
+
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    
+    TFileName fileName;
+    AddDriveLetterToPath(_L("NewFileName.3gp"),fileName);
+    err = fsSession.Delete( fileName );
+
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenPreparedNotRecording, iUiLevelCameraHandle);
+
+    err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_9::NewFileName_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_002
+    //   Action :
+    //        Set NewFileName when recorded ready 
+    //   Output : 
+    //        Record two videos, and the second one have new name.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.3gp"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTime, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+void CCamcTest_9::NewFileName_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_003
+    //   Action :
+    //        Set NewFileName when recording 
+    //   Output : 
+    //        Leave.
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_9::NewFileName_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_004
+    //   Action :
+    //        Set NewFileName when paused 
+    //   Output : 
+    //        Leave.
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenPaused, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_9::NewFileName_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_005
+    //   Action :
+    //        One video is recorded. It ends because of filesize reached.
+    //        A second video is recorded, changing the filename using custom
+    //        command, no OpenFile(). 
+    //   Output : 
+    //        FileSize of both video is ok.
+    ///////////////////////////////////////    
+       
+    RFile file; 
+    TInt filesize,err;
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName1, fileName2;
+  
+    TRAPD(leavingCode,
+        {
+        AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName1);
+        err = fsSession.Delete( fileName1 ); 
+        AddDriveLetterToPath(_L("NewFileName.3gp"),fileName2);
+        err = fsSession.Delete( fileName2 ); 
+        
+        // Start the test case
+        iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenInternalStop, iUiLevelCameraHandle);
+        
+        // Check if size of files is according to previously set Size limit 
+        err = file.Open(fsSession,fileName1,EFileShareAny);
+        assertTIntsEqualL( KErrNone, err );
+        err = file.Size(filesize);
+        file.Close();
+        
+        if ( ( filesize > TC9_FILE_SIZE_LIMIT + TC9_ALLOWED_MARGIN ) ||
+            (filesize < TC9_FILE_SIZE_LIMIT - TC9_ALLOWED_MARGIN ) )
+            {
+            assertL(0);
+            }
+
+        err = file.Open(fsSession,fileName2,EFileShareAny);
+        assertTIntsEqualL( KErrNone, err );
+        err = file.Size(filesize);
+        file.Close();
+        
+        if ( ( filesize > TC9_FILE_SIZE_LIMIT + TC9_ALLOWED_MARGIN ) ||
+            (filesize < TC9_FILE_SIZE_LIMIT - TC9_ALLOWED_MARGIN ) )
+            {
+            assertL(0);
+            }
+        } ); //End of TRAPD
+    
+    fsSession.Close();
+    User::LeaveIfError(leavingCode);
+    }
+
+void CCamcTest_9::NewFileName_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_006
+    //   Action :
+    //        Custom command sent, prepare(), and record() 
+    //   Output : 
+    //        2nd recorded file has the name 
+    //        requested in the custom command.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3g2"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.3g2"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+void CCamcTest_9::NewFileName_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_007
+    //   Action :
+    //        Custom command sent, prepare(), and record() 
+    //   Output : 
+    //        2nd recorded file has the name 
+    //        requested in the custom command.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.mp4"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.mp4"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+void CCamcTest_9::NewFileName_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_008
+    //   Action :
+    //        Custom command sent, prepare(), and record() 
+    //   Output : 
+    //        2nd recorded file has the name 
+    //        requested in the custom command.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordCIF.mp4"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.mp4"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+void CCamcTest_9::NewFileName_009_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_009
+    //   Action :
+    //        Custom command sent, prepare(), and record() 
+    //   Output : 
+    //        2nd recorded file has the name 
+    //        requested in the custom command.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordCIF.mp4"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.mp4"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+
+/*****************************/
+/*      OPEN FILE            */
+/*****************************/
+
+void CCamcTest_9::OpenFileL_016_L()
+    {
+    
+    ///////////////////////////////////////
+    //	 ID: CAMC_API.OPENFILEL_016
+    //    
+    //   Action :FileOpen with FileName "foo/filename.3gp", ie a folder
+    //             that doesn't exists. Then normal recording procedure.
+    //	        
+    //   Output :Folder is created, video is correctly recorded. 
+    //             (Existence of the video checked)
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_OpenFileInAFolderNonExistent, iUiLevelCameraHandle);  
+    
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("non-existent-folder\\recordQCIF.3gp"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_9::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_9::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_9::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_9::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_9::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_9::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_9::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_9::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_9::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_9::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_9::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_9::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_9::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_9::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_9::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_9::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_9::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_9::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_9::VideoBufferReady() returning" )));
+    }
+
+
+MTest* CCamcTest_9::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_9"));
+
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.PREPARE_007"), &Prepare_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.PREPARE_008"), &Prepare_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.PREPARE_009"), &Prepare_009_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLEL_005"), &RecordTimeAvailableL_005_L));
+    
+    // SetMaxClipSizeL_008 and SetMaxClipSizeL_009, only to be tested on HW
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_008"), &SetMaxClipSizeL_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_009"), &SetMaxClipSizeL_009_L));
+#endif
+    
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_001"), &NewFileName_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_002"), &NewFileName_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_003"), &NewFileName_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_004"), &NewFileName_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_005"), &NewFileName_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_006"), &NewFileName_006_L));
+    
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_007"), &NewFileName_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_008"), &NewFileName_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_009"), &NewFileName_009_L));    
+#endif
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.OPENFILEL_016"), &OpenFileL_016_L));
+   
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_visualcheck.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,697 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_visualcheck.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_visualcheck::CCamcTest_visualcheck ()
+    {
+    }
+
+
+
+CCamcTest_visualcheck::~CCamcTest_visualcheck ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_visualcheck::setUpL ()
+    {
+#ifdef _DEBUG
+      RDebug::Print(_L("CamCTest VisualCheck: SetUpL"));
+#endif
+      iCamcTestClient = CCamcTestClient_visualcheck::NewL( );
+    // Do nothing in the setUp to get Memory Failure functionality
+    }
+
+
+void CCamcTest_visualcheck::tearDown ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheck: TearDown Start"));
+#endif
+    delete iCamcTestClient;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheck: TearDown Stop"));
+#endif
+    iCamcTestClient = NULL;
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//           Visual check tests for NON HW accelerated encoder
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_visualcheck::VisualCheck_101_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_101
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              30s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_101);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_102_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_102
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    3
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_102);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_103_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_103
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    5
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      6.7
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_103);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_104_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_104
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    10
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      5.15
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_104);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_105_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_105
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    1
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      7.4
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_105);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_106_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_106
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    3
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      4.75
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_106);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_107_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_107
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              60s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_107);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_108_A_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_108_A
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      128000
+    //       Video Frame-Rate:    8
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    Volume up
+    //       Dynamic change 2:    Volume down
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_108_a);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_108_B_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_108_B
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    1
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    Volume up
+    //       Dynamic change 2:    Volume down
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_108_b);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_109_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_109_B
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    3
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_109);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_110_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_110
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 64000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_110);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_111_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_111
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 500
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_111);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_112_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_112
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    5
+    //       Picture size:        subQCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_112);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_113_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_113
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): 50 bytes
+    //       Length:              None
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    //
+    //   !!! Obsolete Test !!!
+    //
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_113);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_114_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_114
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              1s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_114);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_115_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_115
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): None
+    //       Length:              Until disk "full"
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_115));
+    assertTIntsEqualL( KErrDiskFull, err );
+    }
+
+void CCamcTest_visualcheck::VisualCheck_116_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_116
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              -
+    //       Dynamic change 1:    Stop Recording + Start a new record without prepare
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_116);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_117_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_117
+    //   Action :
+    //       Format:              3g2
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_117);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_118_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_118
+    //   Action :
+    //       Format:              3g2
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + resume
+    //       Dynamic change 2:    Pause + resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_118);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_119_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_119
+    //   Action :
+    //       Format:              3gp
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    7
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      5,15
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_119);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_120_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_120
+    //   Action :
+    //       Format:              3g2
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    10
+    //       Picture size:        subQCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 500
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_120);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_121_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_121
+    //   Action :
+    //       Format:              mp4
+    //       Video:               video/mp4v-es; profile-level-id=3
+    //       Video Bit-rate:      384000
+    //       Video Frame-Rate:    15
+    //       Picture size:        CIF
+    //       Audio:               AAC
+    //       Audio Bit-rate:      None
+    //       Size limit (kbytes): None
+    //       Length:              60s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_121);
+    }
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_visualcheck::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_visualcheck"));
+
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_101"), &VisualCheck_101_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_102"), &VisualCheck_102_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_103"), &VisualCheck_103_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_104"), &VisualCheck_104_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_105"), &VisualCheck_105_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_106"), &VisualCheck_106_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_107"), &VisualCheck_107_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_108_A"), &VisualCheck_108_A_L));
+    //Old Test VisualCheck_108
+    //suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_108_B"), &VisualCheck_108_B_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_109"), &VisualCheck_109_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_110"), &VisualCheck_110_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_111"), &VisualCheck_111_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_112"), &VisualCheck_112_L));
+    // Test 113 considered as obsolete.
+    //  suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_113"), &VisualCheck_113_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_114"), &VisualCheck_114_L));
+  
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+     suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_115"), &VisualCheck_115_L));
+#endif   
+     
+     suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_116"), &VisualCheck_116_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_117"), &VisualCheck_117_L));
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_118"), &VisualCheck_118_L));
+#endif
+
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_119"), &VisualCheck_119_L));
+#endif
+
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_120"), &VisualCheck_120_L));
+#endif  
+    
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_121"), &VisualCheck_121_L));
+#endif
+
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camcordermmfplugin/tsrc/public/basic/src/camcTest_visualcheckdsp.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,806 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CamcTest_visualcheckdsp.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_visualcheckdsp::CCamcTest_visualcheckdsp ()
+    {
+    }
+
+
+
+CCamcTest_visualcheckdsp::~CCamcTest_visualcheckdsp ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_visualcheckdsp::setUpL ()
+    {
+#ifdef _DEBUG
+      RDebug::Print(_L("CamCTest VisualCheckDsp: SetUpL"));
+#endif
+      iCamcTestClient = CCamcTestClient_visualcheckdsp::NewL( );
+
+    // Do nothing in the setUp to get Memory Failure functionality
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_visualcheckdsp::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_visualcheckdsp::setUp() using new MCameraObserver2" )) ); 
+       }
+
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    
+    }
+
+
+void CCamcTest_visualcheckdsp::tearDown ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheckDsp: TearDown Start"));
+#endif
+    delete iCamcTestClient;
+
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;  
+	REComSession::FinalClose();
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheckDsp: TearDown Stop"));
+#endif
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       visual check tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_visualcheckdsp::VisualCheck_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_001
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              30s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_1, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_002
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    5
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_2, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_003_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_003
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      6.7
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_3, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_004_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_004
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      5.15
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_4, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_005_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_005
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      7.4
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_5, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_006_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_006
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      4.75
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_6, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_007_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_007
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              60s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_7, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_008_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_008
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    Volume up
+    //       Dynamic change 2:    Volume down
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_8, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_009_A_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_009_A
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      128000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_9_a, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_009_B_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_009_B
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_9_b, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_010_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_010
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 64000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_10, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_011_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_011
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 500
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_11, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_012_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_012
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_12, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_013_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_013
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): 50 bytes
+    //       Length:              None
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    //
+    //   !!! Obsolete Test !!!
+    //
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_13, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_014_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_014
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              1s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_14, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_015_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_015
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): None
+    //       Length:              Until disk "full"
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_15, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrDiskFull, err );
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_016_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_016
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    10
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              -
+    //       Dynamic change 1:    Stop Recording + Start a new record without prepare
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_16, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_017_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_017
+    //   Action :
+    //       Format:              3gp
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              10 s
+    //       Dynamic change 1:    Bitrate to 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_17, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_017_A_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_017_A
+    //   Action :
+    //       Format:              3gp
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 500
+    //       Length:              10 s
+    //       Dynamic change 1:    Bitrate to 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_17_a, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_018_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_018
+    //   Action :
+    //       Format:              3g2
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    10
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              10 s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_18, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_021_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_021
+    //   Action :
+    //       Format:              mp4
+    //       Video:               video/mp4v-es; profile-level-id=3
+    //       Video Bit-rate:      384000
+    //       Video Frame-Rate:    15
+    //       Picture size:        CIF
+    //       Audio:               AAC
+    //       Audio Bit-rate:      32000
+    //       Size limit (kbytes): None
+    //       Length:              60 s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_21, iUiLevelCameraHandle);
+    }
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_visualcheckdsp::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_5::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_visualcheckdsp::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_5::PowerOnComplete"));
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_visualcheckdsp::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_visualcheckdsp::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_visualcheckdsp::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_visualcheckdsp::VideoBufferReady() returning" )));
+    }
+
+
+
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_visualcheckdsp::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_visualcheckdsp"));
+
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_001"), &VisualCheck_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_002"), &VisualCheck_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_003"), &VisualCheck_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_004"), &VisualCheck_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_005"), &VisualCheck_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_006"), &VisualCheck_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_007"), &VisualCheck_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_008"), &VisualCheck_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_009_A"), &VisualCheck_009_A_L));
+    //Old Test VisualCheck_009
+    //suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_009_B"), &VisualCheck_009_B_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_010"), &VisualCheck_010_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_011"), &VisualCheck_011_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_012"), &VisualCheck_012_L));
+    // Test 113 considered as obsolete.
+    //suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_013"), &VisualCheck_013_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_014"), &VisualCheck_014_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_016"), &VisualCheck_016_L));
+
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+ //   suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_015"), &VisualCheck_015_L));
+#endif   
+
+#ifdef __MPEG4_VIDEO_ENCODING
+//    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_017"), &VisualCheck_017_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_017_A"), &VisualCheck_017_A_L));
+#endif
+
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_021"), &VisualCheck_021_L));
+#endif
+
+    
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/3gp_file_composer_api/3gp_file_composer_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="05d52bab1d02a2b1b56436ba4411ab1f" dataversion="2.0">
+  <name>3GP File Composer API</name>
+  <description>Interface for creating 3GP files.</description>
+  <type>c++</type>
+  <collection>CamcorderMMFPlugin</collection>
+  <libs>
+    <lib name="camc3gpsink.lib" />
+  </libs>
+  <release category="platform"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/3gp_file_composer_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                3GP File Composer API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CamC3GPDataSink.h     MW_LAYER_PLATFORM_EXPORT_PATH(CamC3GPDataSink.h)
+../inc/CamC3GPDataSinkObserver.h     MW_LAYER_PLATFORM_EXPORT_PATH(CamC3GPDataSinkObserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/3gp_file_composer_api/inc/CamC3GPDataSink.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  3GP data sink class definition
+*
+*/
+
+
+
+#ifndef __CAMC3GPDATASINK_H__
+#define __CAMC3GPDATASINK_H__
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include <mmf/common/mmffourcc.h>
+
+#include "CCMRMediaSink.h"
+#include "CamC3GPDataSinkObserver.h"
+
+// FORWARD DECLARATIONS
+class CMMFFile;
+
+// CLASS DECLARATIONS
+
+/**
+*  CCamC3GPDataSink class
+*  This is the abstract 3GP data sink class that is used by
+*  CCamC3GPDataSinkImp class.
+*
+*  @lib camc3gpsink
+*  @since 2.1
+*/
+class CCamC3GPDataSink : public CBase, public MCMRMediaSink
+    {
+    public:
+        // File format
+        enum TCamCSinkFileFormat
+            {
+            E3GPP,
+            E3GPP2,
+            EMPEG4
+            };
+
+    public: // Methods called internally or by the controller
+
+        /**
+        * Default constructor.
+        */
+		CCamC3GPDataSink() {};
+
+        /**
+        * Constructor.
+        */
+	    IMPORT_C static CCamC3GPDataSink* NewL(M3GPDataSinkObserver *aObserver);
+
+        /**
+        * Open a 3GP file for writing.
+        * @since 2.1
+        * @param aFileName File name
+        * @param aAudioCodecType Four CC code of the used audio codec
+        * @param aVideoCodecType Four CC code of the used video codec
+        * @param aFileFormat Used file format TCamCSinkFileFormat
+        * @return No return value
+        */
+        virtual void OpenFileL(TFileName aFileName, TFourCC aAudioCodecType, const TDesC8& aVideoCodecType, TCamCSinkFileFormat aFileFormat = E3GPP) = 0;
+
+        /**
+        * Open a 3GP file for writing.
+        * @since 3.2
+        * @param aMMFFile CMMFFile from MMF
+        * @param aAudioCodecType Four CC code of the used audio codec
+        * @param aVideoCodecType Four CC code of the used video codec
+        * @param aFileFormat Used file format TCamCSinkFileFormat
+        * @return No return value
+        */
+        virtual void OpenFileL(CMMFFile* aMMFFile, TFourCC aAudioCodecType, const TDesC8& aVideoCodecType, TCamCSinkFileFormat aFileFormat = E3GPP) = 0;
+
+        /**
+        * Order the sink to finalize and close the current 3GP file.
+        * @since 2.1
+        * @param None
+        * @return No return value
+        */
+        virtual void SinkStopL() = 0;
+
+        /**
+        * Set size limit of the 3GP file to be recorded in bytes.
+        * @since 2.1
+        * @param aSize Limit
+        * @return No return value
+        */
+        virtual void SetSizeLimit(TUint aSize) = 0;
+
+        /**
+        * Return the amount of time recording has been on in microseconds.
+        * @since 2.1
+        * @param None
+        * @return Elapsed time
+        */
+        virtual TTimeIntervalMicroSeconds GetElapsedTime() = 0;
+
+        /**
+        * Return the estimated remaining time for the recording in microseconds.
+        * @since 2.1
+        * @param None
+        * @return Remaining time
+        */
+        virtual TTimeIntervalMicroSeconds GetRemainingTimeL() = 0;
+
+
+    public: // Methods called from MCMRMediaSink
+
+        /**
+        * Give video frame size to sink.
+        * @since 2.1
+        * @param aSize Frame size
+        * @return Error code
+        */
+        virtual TInt SetVideoFrameSize(TSize aSize) = 0;
+
+        /**
+        * Give average video bitrate to sink.
+        * @since 2.1
+        * @param aBitRate Average bitrate
+        * @return Error code
+        */
+        virtual TInt SetAverageVideoBitRate(TInt aBitRate) = 0;
+
+        /**
+        * Give maximum video bitrate to sink.
+        * @since 2.1
+        * @param aBitRate Maximum bitrate
+        * @return Error code
+        */
+        virtual TInt SetMaxVideoBitRate(TInt aBitRate) = 0;
+
+        /**
+        * Give average audio bitrate to sink.
+        * @since 2.1
+        * @param aBitRate Average bitrate
+        * @return Error code
+        */
+        virtual TInt SetAverageAudioBitRate(TInt aBitRate) = 0;
+
+        /**
+        * Write an audio/video buffer to the sink.
+        * @since 2.1
+        * @param aBuffer Buffer containing audio/video data
+        * @return Errorcode
+        */
+        virtual void WriteBufferL(CCMRMediaBuffer* aBuffer) = 0;
+   };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/3gp_file_composer_api/inc/CamC3GPDataSinkObserver.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  3GP data sink observer class definition
+*
+*/
+
+
+#ifndef     __CAMC3GPDATASINKOBSERVER_H__
+#define     __CAMC3GPDATASINKOBSERVER_H__
+
+
+//  INCLUDES
+
+#include <e32base.h>
+
+
+//  CLASS DEFINITIONS
+
+class M3GPDataSinkObserver
+    {
+    public:
+
+        /**
+        * When the 3GP data sink notices that the disk is getting full, it
+        * calls this method (implemented by the controller) to indicate that
+        * the file composer has stopped saving.
+        * @since 2.1
+        * @param None
+        * @return No return value
+        */
+        virtual void MfcoDiskFullL() = 0;
+
+        /**
+        * When the 3GP data sink notices that the file size limit has been
+        * reached, it calls this method (implemented by the controller) to
+        * indicate that the file composer has stopped saving.
+        * Size limit of the file has been reached.
+        * @since 2.1
+        * @param None
+        * @return No return value
+        */
+        virtual void MfcoSizeLimitReachedL() = 0;
+    };
+
+
+#endif      //  __CAMC3GPDATASINKOBSERVER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/asynchronous_file_saving_queue_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="f9651a3f92b94af2f2bb11754579a115" dataversion="2.0">
+<name>Asynchronous File Saving Queue API</name>
+<description>API for saving image files asynchronously</description>
+<type>c++</type>
+<collection>CamAppEngine</collection>
+<libs><lib name="asynchfsq.lib"/>
+</libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Asynchronous File Saving Queue API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/asynchfsq.h     MW_LAYER_PLATFORM_EXPORT_PATH(asynchfsq.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/inc/asynchfsq.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+
+#ifndef ASYNCHFSQ_H
+#define ASYNCHFSQ_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32base.h>
+
+
+//   FOR DEBUGGING
+#if defined (_DEBUG)
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)        RDebug::Print(AAA,BBB,CC)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+#endif           
+
+
+// CONSTANTS
+
+// Type of action the FSQ will perform
+enum TFSQActionType
+    {
+    EFileSave,
+    EWebUpload,
+    EFileSaveAndWebUpload
+    };
+    
+// Web service schema definition
+enum TFSQSchemaType
+    {
+    ENullSchemaType,
+    ENokiaPictureUploadSchema1v0
+    };    
+
+
+// FORWARD DECLARATIONS
+class MAsynchFSQObserver;
+class CAsynchFSQAtom;
+
+
+// CLASS DECLARATIONS
+
+/**
+* CAsynchFSQ observer class.
+* Mixin base class for the clients of the asynchronous file manager.
+*
+* @since 3.2
+*/
+class MAsynchFSQObserver
+    {
+    public:
+
+        /**
+        * Callback function which gets called after each thread event.
+        * @return void
+        */
+        virtual void MAsynchFSQEvent( TInt aError ) = 0;
+        
+    };
+    
+/**
+* Asynchronous file manager queue and related operations.
+*
+* @since 3.2
+*/
+class CAsynchFSQ : CBase 
+    {
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CAsynchFSQ* NewL();
+                 
+        /**
+        * Destructor.
+        */
+        virtual ~CAsynchFSQ();
+
+    public: // New functions
+        
+        /**
+        * Starts async copy operation
+        */
+        IMPORT_C TInt SaveAndDestroy( TDesC8& aData, const TDesC& aPath,
+                                      TBool aOverwrite = ETrue );
+
+        /**
+        * Notifies the queue that the client wishes to start the thread manually
+        */ 
+        IMPORT_C void SetManualStart( TBool aManualStart );
+
+        /**
+        * Starts the saving thread
+        *   If iManualStart is not activated, this is essentially a NO-OP
+        */ 
+        IMPORT_C TInt Go();
+                            
+        /**
+        * Deletes a file from the file system
+        */ 
+        IMPORT_C TInt Delete( const TDesC& aPath );
+        
+        /**
+        * Renames a file in the file system
+        */
+        IMPORT_C TInt Rename( const TDesC& aOld, const TDesC& aNew );
+
+        /**
+        * Sets the thread priority
+        */
+        IMPORT_C void SetPriority( TInt aPriority );
+        
+        /**
+        * Sets the callback
+        */
+        IMPORT_C void SetCallback( MAsynchFSQObserver* aCallback );
+        
+        /**
+        * Returns the number of actions left for the queue to perform
+        */
+        IMPORT_C TInt ActionsLeft();
+        
+        /**
+        * Cancels any ongoing activity and clears the threads.
+        */
+        IMPORT_C void Cancel();
+        
+        /**
+        * Used to indicate a state change from a data atom
+        */
+        void Notify( TInt aError );
+        
+   private: 
+   
+        /**
+        * C++ default constructor.
+        */
+        CAsynchFSQ();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Adds one index to the end of each queue.
+        */
+        TInt Enqueue( TFSQActionType aActionType, TDesC8& aData, 
+                      const TDesC& aPath, const TDesC& aURL, 
+                      TFSQSchemaType aSchema, const TDesC& aUserName, 
+                      const TDesC& aPassword );
+        
+    private:    // Data
+    
+        // Data queues
+        RPointerArray<CAsynchFSQAtom> iQueue;
+        
+        // Is overwriting allowed?
+        TBool iOverwrite;
+        
+        // Does the client start the activity?
+        TBool iManualStart;
+        
+        // Most recent callback
+        MAsynchFSQObserver* iCallback;
+        
+        // Performance modifiers
+        TInt iPriority;
+        
+    };
+
+#endif // CAsynchFSQ_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Bwinscw/STIFAFSQTestu.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModule@@XZ @ 1 NONAME ; class CTestModule * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Eabi/STIFAFSQTestu.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CAFSQTestAsynchSaveE @ 4 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 5 NONAME ; #<TI>#
+	_ZTI19CAFSQTestAsynchSave @ 6 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 7 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 8 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CAFSQTestAsynchSaveE @ 9 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 10 NONAME ; #<VT>#
+	_ZTV19CAFSQTestAsynchSave @ 11 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 12 NONAME ; #<VT>#
+
Binary file camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles.jpg has changed
Binary file camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles2.jpg has changed
Binary file camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles3.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET        STIFAFSQTest.dll
+TARGETTYPE    dll
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY    CAP_GENERAL_DLL
+VENDORID      VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          StifFSQTestTop.cpp
+SOURCE          AFSQTestAsynchSave.cpp
+SOURCE          AFSQTestAdd.cpp
+SOURCE          AFSQTestDelete.cpp
+SOURCE          AFSQTestRename.cpp
+
+// STIF TFW files
+SOURCEPATH    ../src/TestFramework
+SOURCE        testCase.cpp
+SOURCE        AssertFailure.cpp
+SOURCE        TestSuite.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/TestFramework
+USERINCLUDE     ../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         sysutil.lib
+LIBRARY         fbscli.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         AsynchFSQ.lib
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,38 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Asynchronous File Saving Queue interface/integration tests
+;
+; Languages
+; =========
+&EN
+
+; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
+; ==================================================================================================
+#{"STIFAFSQTEST"},(0x101FB3E7),1,0,1,TYPE=SA
+
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\STIFAFSQTest.dll"      -"$:\sys\bin\STIFAFSQTest.dll"
+
+"..\data\mmc\StifAFSQTest\Nibbles.jpg"      -"F:\testing\data\StifAFSQTest\Nibbles.jpg"
+"..\data\mmc\StifAFSQTest\Nibbles2.jpg"     -"F:\testing\data\StifAFSQTest\Nibbles2.jpg"
+"..\data\mmc\StifAFSQTest\Nibbles3.jpg"     -"F:\testing\data\StifAFSQTest\Nibbles3.jpg"
+
+; eof
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+StifAFSQTest.mmp 
+
+PRJ_MMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestAsynchSave.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AsynchFSQTest test module.
+*
+*/
+
+
+#ifndef AFSQ_TEST_ASYNCH_SAVE_H
+#define AFSQ_TEST_ASYNCH_SAVE_H
+
+
+// INCLUDES
+
+#include <e32base.h>
+#include "asynchfsq.h"
+#include "TestFramework/test.h"
+#include "TestFramework/testCase.h"
+#include "TestFramework/testCaller.h"
+#include "TestFramework/testSuite.h"
+
+// CONSTANTS
+
+enum TTestCaseNumber
+    {
+    ECONSTRUCT001p1,
+    EDESTRUCT001p1,
+    EPRIORITY001p1,
+    EADD001p1,
+    EADD002p1,
+    EADD003p1,
+    EADD004p1,
+    EADD005p1,
+    EADD006p1,
+    EADD007p1,
+    EDEL001p1,
+    EDEL002p1,
+    EDEL003p1,
+    EDEL004p1,
+    EDEL005p1,
+    EDEL006p1,
+    EREN001p1,
+    EREN002p1,
+    EREN003p1,
+    EREN004p1,
+    EREN005p1,
+    EREN006p1,
+    ECANCEL001p1
+    };
+
+
+// MACROS
+
+#define KNibbles TFileName(_L("F:\\testing\\data\\StifAFSQTest\\Nibbles.jpg"));
+#define KNibbles2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\Nibbles2.jpg"));
+#define KNibbles3 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\Nibbles3.jpg"));
+
+#define KNibblesCANCEL001 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+
+#define KNibblesADD001 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+#define KNibblesADD002 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD002.jpg"));
+#define KNibblesADD003 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD003.jpg"));
+#define KNibblesADD004A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD004A.jpg"));
+#define KNibblesADD004B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD004B.jpg"));
+#define KNibblesADD005A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD005A.jpg"));
+#define KNibblesADD005B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD005B.jpg"));
+#define KNibblesADD006 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD006.jpg"));
+#define KNibblesADD007 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD007.jpg"));
+
+#define KNibblesDEL001 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL001.jpg"));
+#define KNibblesDEL002 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL002.jpg"));
+#define KNibblesDEL003A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL003A.jpg"));
+#define KNibblesDEL003B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL003B.jpg"));
+#define KNibblesDEL003C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL003C.jpg"));
+#define KNibblesDEL004A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL004A.jpg"));
+#define KNibblesDEL004B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL004B.jpg"));
+#define KNibblesDEL004C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL004C.jpg"));
+#define KNibblesDEL005A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL005A.jpg"));
+#define KNibblesDEL005B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL005B.jpg"));
+#define KNibblesDEL005C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL005C.jpg"));
+#define KNibblesDEL006A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL006A.jpg"));
+#define KNibblesDEL006B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL006B.jpg"));
+#define KNibblesDEL006C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL006C.jpg"));
+
+#define KNibblesREN001A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN001A.jpg"));
+#define KNibblesREN001B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN001B.jpg"));
+#define KNibblesREN002A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN002A.jpg"));
+#define KNibblesREN002B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN002B.jpg"));
+#define KNibblesREN003A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003A.jpg"));
+#define KNibblesREN003B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003B.jpg"));
+#define KNibblesREN003C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003C.jpg"));
+#define KNibblesREN003A2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003A2.jpg"));
+#define KNibblesREN004A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004A.jpg"));
+#define KNibblesREN004B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004B.jpg"));
+#define KNibblesREN004C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004C.jpg"));
+#define KNibblesREN004A2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004A2.jpg"));
+#define KNibblesREN005A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005A.jpg"));
+#define KNibblesREN005B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005B.jpg"));
+#define KNibblesREN005C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005C.jpg"));
+#define KNibblesREN005A2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005A2.jpg"));
+#define KNibblesREN006A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006A.jpg"));
+#define KNibblesREN006B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006B.jpg"));
+#define KNibblesREN006C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006C.jpg"));
+#define KNibblesREN006B2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006B2.jpg"));
+#define KNibblesREN006C2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006C2.jpg"));
+
+
+// CLASS DECLARATION
+
+class CAFSQTestAsynchSave : public CTestCase,
+                            public MAsynchFSQObserver
+    {
+    public:
+
+        CAFSQTestAsynchSave ();
+        ~CAFSQTestAsynchSave ();
+
+        // Allocate the resources for one test function
+        void setUpL ();
+
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+
+    protected:
+    
+        // stalling function
+        void WaitForAsynchCompleteL();
+
+        // Own test functions that use assertions and may leave:
+        
+        //constructor
+        void TestFileManNewLReturnsNotNullL();   
+    
+        //add
+        void TestAddEmptyObjectToQueueL();
+        void TestAddObjectToEmptyQueueL();
+        void TestAddObjectToEmptyQueueWillSaveL();
+        void TestAddObjectToNonEmptyQueueL();
+        void TestAddObjectToNonEmptyQueueWillSaveL();
+        void TestAddObjectThatExistsAlreadyL();
+        void TestAddObjectToEmptyQueueLManualStart();
+    
+        //delete
+        void TestDeleteFromEmptyNotExistL();
+        void TestDeleteFromEmptyExistsL();
+        void TestDeleteNonEmptyExistsButNotInQueueL();
+        void TestDeleteNonEmptyNotExistAndNotInQueueL();
+        void TestDeleteInQueueNotActiveL();
+        void TestDeleteInQueueActiveL();
+    
+        //destructor
+        void TestDestructorL();
+        
+        //priority
+        void TestSetPriorityL();
+        
+        //cancel
+        void TestCancelL();
+        
+        //rename
+        void TestRenameFromEmptyNotExistL();
+        void TestRenameFromEmptyExistsL();
+        void TestRenameNonEmptyExistsButNotInQueueL();
+        void TestRenameNonEmptyNotExistAndNotInQueueL();
+        void TestRenameInQueueNotActiveL();
+        void TestRenameInQueueActiveL();
+    
+    protected:  // from MAsynchFSQObserver
+    
+        void MAsynchFSQEvent( TInt aError );
+    
+    private:
+    
+        CAsynchFSQ* iFSQ;
+        CActiveScheduler* iScheduler;
+        TTestCaseNumber currentTest;
+        TBool delayedBool;
+        TBool wait;
+        // Needed for synchronization
+        RMutex iMutex;
+        TInt assertion;
+        TInt numSaved;
+        TInt numToSave;
+        
+    };
+
+#endif // AFSQ_TEST_ASYNCH_SAVE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef AFSQ_TEST_TOP_H
+#define AFSQ_TEST_TOP_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+#include "TestFramework/testCase.h"
+#include "TestFramework/testCaller.h"
+#include "TestFramework/testSuite.h"
+
+EXPORT_C  MTest* CreateTopFct();
+
+class CAFSQTestTop : public CTestSuite
+    {
+    public:
+	    CAFSQTestTop();
+        ~CAFSQTestTop();
+
+	    // A function to collect and return a suite of tests
+	    static MTest* suiteL();
+
+    protected:
+
+    private:
+
+    };
+
+#endif // AFSQ_TEST_TOP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/STIFAFSQTest.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef STIFAFSQTEST_H
+#define STIFAFSQTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+// CONSTANTS
+
+// MACROS
+
+// Logging path
+_LIT( KSTIFAFSQTestLogPath, "\\logs\\testframework\\STIFAFSQTest\\" ); 
+// Log file
+_LIT( KSTIFAFSQTestLogFile, "STIFAFSQTest.txt" ); 
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CSTIFAFSQTest;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+/**
+*  CSTIFAFSQTest test class for STIF Test Framework TestScripter.
+*  This STIF test module provides basic FSQ tests 
+*
+*  @lib STIFAFSQTest.dll
+*  @since Series60_31
+*/
+NONSHARABLE_CLASS(CSTIFAFSQTest) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static STIFAFSQTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~STIFAFSQTest();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line 
+        * @since Series60_31
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWLANTests( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since Series60_31
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+        virtual TInt SearchNetworkL( CStifItemParser& aItem );
+        
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+       
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+       
+    protected:  // Friend classes
+       
+    private:    // Friend classes
+       
+    };
+
+#endif      // STIFAFSQTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/StifFSQTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFramework/testSuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS( CTestModule ) 
+        :public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+        void AllocFailureSimulation ( TBool aSwitchedOn );
+
+        void RunTestCaseInOOMLoopL( const TInt aCaseNumber, TTestResult& aResult );
+            
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+       RHeap::TAllocFail iAllocFailureType;
+       TInt iAllocFailureRate;    	    	  	
+       TInt iCurrentAllocFailureRate;    	    	  	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/AssertFailure.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/TestResult.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/test.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCaller.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFramework/testCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCase.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testSuite.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAdd.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,530 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.001
+    // 
+    // Action : Test that adding an null object to the queue will return an error.
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD001p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    HBufC8 * myData = HBufC8::NewL(1000);
+    delete myData;
+    myData = NULL;
+    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        TFileName add001 = KNibblesADD001;
+        error = iFSQ->SaveAndDestroy( *myData, add001);
+        );
+    TRAPD( err2,
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL isKErrArgument=%d notErr=%d notErr2=%d"), (error == KErrArgument), !err, !err2 );
+    
+    //do not delay assert because queue should not be active
+    assertL( (error == KErrArgument) && !err && !err2);
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.002
+    // 
+    // Action : Test that adding an object to an empty queue will at least start OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD002p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add002 = KNibblesADD002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add002, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add002);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add002 );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.003
+    // 
+    // Action : Test that adding an object to an empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.    
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL in") );
+
+    currentTest = EADD003p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add003 = KNibblesADD003;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add003, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add003);
+        }
+    aFs.Close();
+    
+    TRAP_IGNORE(  
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add003 );
+        buf = NULL; // transfer ownership
+        );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.004
+    // 
+    // Action : Test that adding an object to a non empty queue will at least start OK.
+    //      
+    // Output : An error code.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+   
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add004A = KNibblesADD004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004A);
+        }
+
+    // Delete the file if it exists
+    TFileName add004B = KNibblesADD004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add004A );
+        buf = NULL; // transfer ownership
+        error2 = iFSQ->SaveAndDestroy( *buf2, add004B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL isKErrNone=%d is2KErrNone=%d notErr=%d"), (error == KErrNone), (error2 == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && (!err) );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.005
+    // 
+    // Action : Test that adding an object to a non empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL in") );
+
+    //TInt error = KErrNone;
+    currentTest = EADD005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add005A = KNibblesADD005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005A);
+        }
+
+    // Delete the file if it exists
+    TFileName add005B = KNibblesADD005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add005A );
+        buf = NULL; // transfer ownership
+        iFSQ->SaveAndDestroy( *buf2, add005B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL notErr=%d"), !err );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.006
+    // 
+    // Action : Test that adding an object to an empty queue which exists int the file
+    //          system will report KErrAlreadyExists.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlready in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD006p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName add006 = KNibblesADD006;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add006, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add006);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, add006, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	
+    // Reuse the file name, to write where it exists.
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add006, EFalse );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL out") );
+    }
+
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.007
+    // 
+    // Action : Test that adding an object to an empty manual queue will be OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD007p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add007 = KNibblesADD007;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add007, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add007);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SetManualStart( ETrue );
+        error = iFSQ->SaveAndDestroy( *buf, add007 );
+        buf = NULL; // transfer ownership 
+        error2 = iFSQ->Go();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart isKErrNone=%d notErr=%d"), ((error == KErrNone) && (error2 == KErrNone)), !err );
+   
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart out") );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAsynchSave.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,636 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+CAFSQTestAsynchSave::CAFSQTestAsynchSave()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave in") );
+    
+    // Create a mutex for synchronization purpose
+    iMutex.CreateLocal();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave out") );
+    }
+
+CAFSQTestAsynchSave::~CAFSQTestAsynchSave()
+    {
+    // Nothing to do
+    }
+
+void CAFSQTestAsynchSave::setUpL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::setUpL in") );
+    }
+
+void CAFSQTestAsynchSave::tearDown()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::tearDown in") );
+    }
+
+void CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001
+    // 
+    // Action : Test that cfileman::newl returns a value.
+    //      
+    // Output : A handle to the requested object.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL in") );
+
+    currentTest = ECONSTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL isNotNull=%d notErr=%d"), (iFSQ!=NULL), !err);
+    assertL( (iFSQ != NULL) && !err );
+    delete iFSQ;
+    iFSQ = NULL;
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDestructorL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDESTRUCTOR.001
+    // 
+    // Action : Test that delete works
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL in") );
+
+    currentTest = EDESTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL out") );
+    }
+    
+void CAFSQTestAsynchSave::TestSetPriorityL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTSETPRIORITY.001
+    // 
+    // Action : Test that setting the priority doesn't fail
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL in") );
+
+    currentTest = EPRIORITY001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetPriority( EPriorityMore );
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL out") );
+    }   
+    
+void CAFSQTestAsynchSave::TestCancelL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTCANCEL.001
+    // 
+    // Action : Test that canceling will....
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL in") );
+
+    TInt error = KErrNone;
+    currentTest = ECANCEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName cancel001 = KNibblesCANCEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, cancel001, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, cancel001);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, cancel001 );
+        buf = NULL; // transfer ownership 
+        iFSQ->Cancel();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    // do not wait for callback to assert, since we have canceled
+    delayedBool = ( (error == KErrNone) && !err );
+    assertL( delayedBool );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL out") );
+    }
+    
+void CAFSQTestAsynchSave::WaitForAsynchCompleteL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL in") );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL starting AS now") );
+    CActiveScheduler::Start();
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL closing") );
+    //close up and assert
+    User::After( TTimeIntervalMicroSeconds32(1000000) );
+    if( iFSQ )
+        {
+        delete iFSQ;
+        iFSQ = NULL; 
+        }
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL we are asserting the following: %d"), assertion );
+        
+    assertL( assertion );
+       
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL out") );
+    }
+
+void CAFSQTestAsynchSave::MAsynchFSQEvent( TInt aError )
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, waiting"));
+    User::After( TTimeIntervalMicroSeconds32(2000000) );
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, done waiting"));
+
+    numSaved++;
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, numToSave=%d"),numToSave);
+
+    switch( currentTest )
+        {
+        case EADD002p1:
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            
+        case EADD003p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            
+            //check that the file exists
+            RFs fsSession;
+            TInt connectErr = fsSession.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) connectErr=%d"), connectErr );
+            RFile file;
+            TFileName add003 = KNibblesADD003;
+            TInt fileErr = file.Open(fsSession, add003, EFileRead);
+            file.Close();
+            fsSession.Close();
+
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) aErrorIsKErrNone=%d !fileErr=%d"), (aError == KErrNone), !fileErr );
+            assertion = ( (aError == KErrNone) && !fileErr);
+            break;        
+            }           
+        case EADD004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add004A = KNibblesADD004A;
+                TFileName add004B = KNibblesADD004B;
+                TInt fileErr1 = file1.Open(fsSession, add004A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add004B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) delayedBool=%d !aError=%d !fileErr1=%d !fileErr2=%d"), delayedBool, !aError, !fileErr1, !fileErr2 );
+                assertion = ( delayedBool && !aError && !fileErr1 && !fileErr2);
+                }
+            break;
+            }
+        case EADD005p1:
+            {        
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add005A = KNibblesADD005A;
+                TFileName add005B = KNibblesADD005B;
+                TInt fileErr1 = file1.Open(fsSession, add005A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add005B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+                    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) isaErrorKErrNone=%d"), (aError==KErrNone) );
+                assertion = ( aError == KErrNone );
+                }
+            break;
+            }        
+        case EADD007p1:
+            {        
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            }                
+        case EDEL003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del003A = KNibblesDEL003A;
+                TInt fileError = file3.Open(fsSession2, del003A, EFileRead);
+                file3.Close();
+                fsSession2.Close();
+    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) delayedBool=%d !aError=%d fileError=%d"), delayedBool, !aError, !(!fileError) );
+                assertion = ( delayedBool && !aError && !(!fileError) );
+                }
+            break;
+            }    
+        case EDEL004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EDEL005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del005A = KNibblesDEL005A;
+                TInt fileError = file3.Open(fsSession2, del005A, EFileRead);
+                file3.Close();
+            
+                //check that file was saved
+                RFile file4;
+                TFileName del005B = KNibblesDEL005B;
+                TInt fileError2 = file4.Open(fsSession2, del005B, EFileRead);
+                file4.Close();
+                
+                //check that file was saved
+                RFile file5;
+                TFileName del005C = KNibblesDEL005C;
+                TInt fileError3 = file5.Open(fsSession2, del005C, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) delayedBool=%d !aError=%d fileError=%d !fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !fileError2, !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !fileError2 && !fileError3 );
+                }
+            break;
+            }    
+        case EDEL006p1:
+            {
+            //check that file was saved
+            RFs fsSession2;
+            TInt connectErr = fsSession2.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) connectErr=%d"), connectErr );
+            RFile file5;
+            TFileName del006A = KNibblesDEL006A;
+            TInt fileError3 = file5.Open(fsSession2, del006A, EFileRead);
+            file5.Close();
+            
+            if( iFSQ->ActionsLeft() == 0 )
+                {
+                //we should be done with the rest...
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                
+                //check that file was deleted
+                RFile file3;
+                TFileName del006C = KNibblesDEL006C;
+                TInt fileError = file3.Open(fsSession2, del006C, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName del006B = KNibblesDEL006B;
+                TInt fileError2 = file4.Open(fsSession2, del006B, EFileRead);
+                file4.Close();
+                
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) delayedBool=%d !aError=%d fileError=%d fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !(!fileError2), !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !(!fileError2) && !fileError3 );
+                }
+                
+            fsSession2.Close();
+            break;
+            }    
+        case EREN003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren003A2 = KNibblesREN003A2;
+                TInt fileError = file3.Open(fsSession2, ren003A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren003B = KNibblesREN003B;
+                TInt fileError2 = file4.Open(fsSession2, ren003B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren003A = KNibblesREN003A;
+                TInt fileError3 = file5.Open(fsSession2, ren003A, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) );
+                }
+            break;
+            }    
+        case EREN004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EREN005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren005A2 = KNibblesREN005A2;
+                TInt fileError = file3.Open(fsSession2, ren005A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren005B = KNibblesREN005B;
+                TInt fileError2 = file4.Open(fsSession2, ren005B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren005A = KNibblesREN005A;
+                TInt fileError3 = file5.Open(fsSession2, ren005A, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren005C = KNibblesREN005C;
+                TInt fileError4 = file6.Open(fsSession2, ren005C, EFileRead);
+                file6.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4 );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 );
+                }
+            break;
+            }    
+        case EREN006p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren006C2 = KNibblesREN006C2;
+                TInt fileError = file3.Open(fsSession2, ren006C2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren006B2 = KNibblesREN006B2;
+                TInt fileError2 = file4.Open(fsSession2, ren006B2, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren006B = KNibblesREN006B;
+                TInt fileError3 = file5.Open(fsSession2, ren006B, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren006A = KNibblesREN006A;
+                TInt fileError4 = file6.Open(fsSession2, ren006A, EFileRead);
+                file6.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file7;
+                TFileName ren006C = KNibblesREN006C;
+                TInt fileError5 = file7.Open(fsSession2, ren006C, EFileRead);
+                file7.Close();
+                
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d !!fileError5=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4, !(!fileError5) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 && !(!fileError5) );
+                }
+            break;
+            }
+        case EADD006p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            assertion = ( delayedBool && ( aError == KErrAlreadyExists ));
+            break;
+            }
+        case ECANCEL001p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            // do nothing, we are waiting for cancel
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1)"));
+            break;
+            }
+        default:
+            break;
+        }
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent out") );
+    }
+
+MTest* CAFSQTestAsynchSave::suiteL ()
+    {
+    // An own static function to collect the test functions into one 
+    // suite of tests. The framework will run the tests and free the
+    // memory allocated for the test suite.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL in") );
+    
+    // Always use NewL (Do not use NewLC here)
+    CTestSuite *suite = CTestSuite::NewL( _L8("CAFSQTestAsynchSave") );
+
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001"), &TestFileManNewLReturnsNotNullL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDESTRUCTOR.001"), &TestDestructorL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTSETPRIORITY.001"), &TestSetPriorityL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTCANCEL.001"), &TestCancelL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.001"), &TestAddEmptyObjectToQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.002"), &TestAddObjectToEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.003"), &TestAddObjectToEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.004"), &TestAddObjectToNonEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.005"), &TestAddObjectToNonEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.006"), &TestAddObjectThatExistsAlreadyL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.007"), &TestAddObjectToEmptyQueueLManualStart ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.001"), &TestDeleteFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.002"), &TestDeleteFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.003"), &TestDeleteNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.004"), &TestDeleteNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.005"), &TestDeleteInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.006"), &TestDeleteInQueueActiveL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.001"), &TestRenameFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.002"), &TestRenameFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.003"), &TestRenameNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.004"), &TestRenameNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.005"), &TestRenameInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.006"), &TestRenameInQueueActiveL ) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL returning") );
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestDelete.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,692 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.001
+    // 
+    // Action : Test that cfileman::delete returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL in") );
+	
+    currentTest = EDEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName del001 = KNibblesDEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del001, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del001);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del001 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.002
+    // 
+    // Action : Test that delete works if file exists and queue empty
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL in") );
+
+    currentTest = EDEL002p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName del002 = KNibblesDEL002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del002, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del002);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del002, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del002 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL fsConnectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, del002, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+    
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL errorIsKErrNone=%d notErr=%d isFileError=%d"), (error == KErrNone), !err, !(!(fileError )) );
+    
+    assertL( (error == KErrNone) && !err && (fileError!=KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.003
+    // 
+    // Action : Test that delete will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EDEL003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2, EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3, EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del003A = KNibblesDEL003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003A);
+        }
+
+    // Delete the file if it exists
+    TFileName del003B = KNibblesDEL003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del003C = KNibblesDEL003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003C);
+        }
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	aFs.Close();
+	delete buf;
+	buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del003C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del003A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.004
+    // 
+    // Action : Test that delete will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL in") );
+
+    currentTest = EDEL004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del004A = KNibblesDEL004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004A);
+        }
+
+    // Delete the file if it exists
+    TFileName del004B = KNibblesDEL004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del004C = KNibblesDEL004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del004C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004C);
+        }
+
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del004C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del004A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.005
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL in") );
+	
+    currentTest = EDEL005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del005A = KNibblesDEL005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005A);
+        }
+
+    // Delete the file if it exists
+    TFileName del005B = KNibblesDEL005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del005C = KNibblesDEL005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005C);
+        }
+
+    aFs.Close();
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del005A );
+        buf = NULL;
+        error = iFSQ->Delete( del005A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.006
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL in") );
+	
+    currentTest = EDEL006p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del006A = KNibblesDEL006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006A);
+        }
+
+    // Delete the file if it exists
+    TFileName del006B = KNibblesDEL006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del006C = KNibblesDEL006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006C);
+        }
+
+    aFs.Close();
+	    
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del006A );
+        buf = NULL;
+        errorA = iFSQ->Delete( del006B );
+        errorB = iFSQ->Delete( del006C );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL out") );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestRename.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,746 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.001
+    // 
+    // Action : Test that cfileman::rename returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL in") );
+	
+    currentTest = EREN001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName ren001A = KNibblesREN001A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren001A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren001A);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren001B = KNibblesREN001B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren001A, ren001B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.002
+    // 
+    // Action : Test that rename works if file exists and queue empty
+    //      
+    // Output : A KErrNone.  
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL in") );
+	 
+    currentTest = EREN002p1;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName ren002A = KNibblesREN002A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren002A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren002A);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren002A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete file
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren002B = KNibblesREN002B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren002A, ren002B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL connectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, ren002B, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL errorIsKErrNone=%d notErr=%d !fileError=%d"), (error == KErrNone), !err, !(fileError ) );
+    
+    assertL( (error == KErrNone) && !err && (fileError==KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL out") );   
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.003
+    // 
+    // Action : Test that rename will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EREN003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren003A = KNibblesREN003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003B = KNibblesREN003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003C = KNibblesREN003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren003A2 = KNibblesREN003A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren003A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A2);
+        }    
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren003C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren003A, ren003A2);
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.004
+    // 
+    // Action : Test that rename will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL in") );
+	
+    currentTest = EREN004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    TInt connectError = User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren004A = KNibblesREN004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004B = KNibblesREN004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004C = KNibblesREN004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren004C,EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004C);
+        }
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TFileName ren004A2 = KNibblesREN004A2;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren004C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren004A, ren004A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.005
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL in") );
+	
+    currentTest = EREN005p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren005A = KNibblesREN005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005B = KNibblesREN005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005C = KNibblesREN005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005C);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005A2 = KNibblesREN005A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren005A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A2);
+        }    
+
+    aFs.Close();
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren005A );
+        buf = NULL;
+        error = iFSQ->Rename( ren005A, ren005A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueActiveL()
+{
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.006
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence?
+    //          This case checks that the file ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL in") );
+	
+    currentTest = EREN006p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren006A = KNibblesREN006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren006B = KNibblesREN006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C = KNibblesREN006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006B2 = KNibblesREN006B2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren006B2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B2);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C2 = KNibblesREN006C2;
+    RFile deleter5;
+    TInt isDeleted5 = deleter5.Open(aFs, ren006C2, EFileRead);
+    deleter5.Close();
+    if ( isDeleted5 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 5th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C2);
+        }                
+
+    aFs.Close();
+
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren006A );
+        buf = NULL;
+        errorA = iFSQ->Rename( ren006B, ren006B2 );
+        errorB = iFSQ->Rename( ren006C, ren006C2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL out") );
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/STIFAFSQTestBlocks.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: STIFAFSQTestBlocks.cpp
+*
+*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/StifFSQTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "../inc/StifFSQTestTop.h"
+#include "../inc/TestFramework/testSuite.h"
+#include "../inc/AFSQTestTop.h"
+#include "../inc/AFSQTestAsynchSave.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+    
+    TRAP_IGNORE(
+        CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+        
+    	// Stack size
+    	param->iTestThreadStackSize= 2*16384; // 2*16K stack
+
+    	// Heap sizes
+    	param->iTestThreadMinHeap = 4096;   // 4K heap min
+    	param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    	aTestModuleParam = param;
+	);
+	
+    return KErrNone;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL( CAFSQTestAsynchSave::suiteL() );    
+    
+
+    
+    // SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+
+    /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+    // Next is a temporary solution for Stif memory leak error
+    //TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksMem);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksRequests);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles);
+
+    if ( iAllocFailureType != RHeap::ENone )
+        {
+        RunTestCaseInOOMLoopL( aCaseNumber, aResult );
+        }
+    else
+        {
+        iTestSuite->ExecuteTestL( aResult, aCaseNumber );
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return KErrNone; 
+    }
+
+
+/*
+*/    
+
+void CTestModule::RunTestCaseInOOMLoopL( const TInt aCaseNumber,
+                                        TTestResult& aResult )
+    {
+
+    // 
+    TInt error = KErrNone; 
+    aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+
+    for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+        {      
+        // Switches on alloc failure simulation if the parameters are set for it
+        AllocFailureSimulation( ETrue ); 
+        RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+        TRAP( error, iTestSuite->ExecuteTestL( aResult, aCaseNumber ) );
+        if ( error == KErrNoMemory )
+            {
+            error = KErrNone;
+            }
+        }
+    
+    //
+    AllocFailureSimulation( EFalse );
+    User::LeaveIfError( error ); 
+    }
+
+
+/*
+*/    
+
+void CTestModule::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CTestModule::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+#ifndef EKA2
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/AssertFailure.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "TestFramework/AssertFailure.h"
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+                                      TInt aLineNumber,
+                                      const TDesC8& aFileName)
+    {
+    CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+                                       TInt aLineNumber,
+                                       const TDesC8& aFileName)
+
+    {
+    CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+    CleanupStack::PushL(self);
+    self->ConstructL(aMessage, aFileName);
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self=NewLC(aAssertFailure);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self = new(ELeave)CAssertFailure;
+    CleanupStack::PushL(self);
+    self->ConstructL(aAssertFailure);
+    return self;
+    }
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+                                 const TDesC8& aFileName)
+    {
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+    }
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+    {
+    iLineNumber = aAssertFailure.iLineNumber;
+    iMessage = aAssertFailure.iMessage->AllocL();
+    iFileName = aAssertFailure.iFileName->AllocL();
+    }
+
+CAssertFailure::CAssertFailure ()
+    {
+    }
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+    {
+    }
+
+CAssertFailure::~CAssertFailure () 
+    {
+    delete iFileName;
+    delete iMessage;
+    }
+
+const TDesC8& CAssertFailure::What() const
+    {
+    return *iMessage;
+    }
+
+TInt CAssertFailure::LineNumber()  const
+    {
+    return iLineNumber;
+    }
+
+const TDesC8& CAssertFailure::FileName()  const
+    {
+    return *iFileName;
+    }
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+    {
+    iMyHeapCellCount = aHeapCellCount;
+    }
+
+TInt CAssertFailure::MyHeapCellCount ()
+    {
+    return iMyHeapCellCount;
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/TestSuite.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/TestFramework/testSuite.h"
+#include <StifTestModule.h>
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/testCase.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include <utf.h>
+
+#include "../inc/TestFramework/testCase.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "../inc/TestFramework/TestCase.h"
+#include "../inc/TestFramework/TestResult.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include "../inc/TestFramework/CppUnitLog.h"
+#endif
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/cae_extentension_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="acf6a16935ae7142aec592119a60f037" dataversion="2.0">
+<name>CAE Extentension API</name>
+<description>Interface that every ECom Plug-in extension of the Camera Application Engine should implement. It is used by the Camera Application Engine to create/initialize and to destroy the extension.  At creation phase the ECom Plug-in extension using a callback can find out what the Camera Application Engine supports or in other terms is it compatible with it and register its custom and extension interfaces to the Camera Application Engine. The callback is used for registering custom extensions, registering services and querying supported callbacks, services and properties of the Camera Application Engine. Services that Camera Application Engine's ECom Plug-in extensions can provide to the Camera Application Engine are mainly related to some events happened in the Camera Application Engine like changing the settings of Camera Application Engine, aquiring a new still image etc. When a certain event happens in Camera Application Engine all the related services  registered by the ECom Plug-in extensions are called by the Camera Application Engine.</description>
+<type>c++</type>
+<collection>CamAppEngine</collection>
+<libs><lib name="CaeEngine.lib"/>
+</libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                CAE Extentension API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CaeEngineExtInterface.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(CaeEngineExtInterface.hrh)
+../inc/CaeEngineExtInterface.h     MW_LAYER_PLATFORM_EXPORT_PATH(CaeEngineExtInterface.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,313 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface for extensions
+*
+*/
+
+
+
+#ifndef CAEENGINEEXTINTERFACE_H
+#define CAEENGINEEXTINTERFACE_H
+
+//  INCLUDES
+
+#include <e32std.h>
+#include <fbs.h>
+#include <ecom/ecom.h>
+
+#include "CaeEngineExtInterface.hrh"
+
+// CONSTANTS
+
+// Common UID that identifies all Cae extensions
+const TUid KExtensionInterfaceUid = {KExtensionInterfaceUidValue};
+
+// Common string that identifies all Cae extensions
+_LIT8( KExtensionTypeStringDesc, KExtensionTypeString);
+
+// Global flags for extension handling. Affect how the engine handles extensions. 
+enum TCaeExtFlags
+        {
+        ECaeExtFlagRequireFullColorSnapInputImage =        0x00000001
+        /* \todo Not yet implemented
+        ECaeExtFlagRequireStillImageAsBitmap =             0x00000002,
+        ECaeExtFlagRequireImageFormatHeader =              0x00000004
+        */
+        };
+
+
+// FORWARD DECLARATIONS
+
+class MExtensionCallbackInterface;
+class MExtension;
+
+
+// CLASS DECLARATIONS
+
+/**
+* Main extension interface class.	
+*/
+
+class MExtension
+	{
+	public:
+        /**
+        * Create the extension. Create the object, get pointers to callback interfaces
+		* and possibly add extension interfaces to the engine.
+        * @since 2.8
+        * @param aImplementationUid The uid for ECom to find the correct dll that implements this extension
+        * @param aEngine Pointer to the callback interface in the engine. Delivered to the extension.
+        * @return MExtension Pointer to the extension. Returned to the engine.
+        */
+ 		static MExtension* NewExtensionL( TUid aImplementationUid, MExtensionCallbackInterface* aEngine );
+
+        /**
+        * Virtual destructor. 
+        * @since 2.8
+        */
+		virtual ~MExtension() { REComSession::DestroyedImplementation (iDtor_ID_Key); };
+
+	private:
+
+		// The ID used by ECom for destroying this dll
+		TUid	iDtor_ID_Key;
+	};
+
+
+/**
+* Main callback interface implemented in the engine. The extension uses this
+* interface to add to and remove own interface implementations from the engine 
+* lists. Also, pointers to the callback interfaces implemented in the engine, 
+* can be fetched.  The extension usually calls this interface during creation. 
+*/
+
+class MExtensionCallbackInterface
+	{
+	public:
+        /**
+        * Check that the interface is supported by the engine. 
+        * @since 2.8
+        * @param aInterfaceUid Uid for the interface.
+        * @return TBool Whether the interface is supported.
+        */
+		virtual TBool IsInterfaceSupported( TUid aInterfaceUid ) = 0;
+
+        /**
+        * Add an extension implemented interface to the list in engine. 
+		* The engine starts to call this interface.
+        * @since 2.8
+        * @param aInterfaceUid Uid for the interface.
+        * @param aExtensionUid Uid for the extension that implements the interface.
+        * @param aInterfacePtr Pointer to the interface implementation.
+        * @param aPriority Priority of the interface. Interfaces with bigger priority value are called first.
+        * @return TInt Error code.
+        */
+		virtual TInt AddExtensionInterface( TUid aInterfaceUid, TUid aExtensionUid, TAny* aImplementationPtr, TInt aInitialPriority = 0 ) = 0;
+
+        /**
+        * Remove an extension implemented interface from the list in engine. 
+		* The engine stops calling this interface.
+        * @since 2.8
+        * @param aInterfaceUid Uid for the interface.
+        * @param aInterfacePtr Pointer to the interface implementation.
+        * @return TInt Error code.
+        */
+		virtual TInt RemoveExtensionInterface( TUid aInterfaceUid, TAny* aImplementationPtr ) = 0;
+
+        /**
+        * Add an extension implemented custom interface to the list in engine. 
+		* The custom interface is not called by the engine. It is called by the application.
+		* The engine gives the pointer to the application when requested.
+		* Note that there is no remove method for a custom interface because there is not 
+		* specified a way to tell to the application when the interface had been removed.
+        * @since 2.8
+        * @param aInterfaceUid Specific uid for the interface.
+        * @param aInterfacePtr Pointer to the interface implementation.
+        * @return TInt Error code.
+        */
+		virtual TInt AddCustomInterface( TUid aInterfaceUid, TAny* aImplementationPtr ) = 0;
+
+        /**
+        * Get an engine implemented callback interface. An extension can call this interface. 
+        * @since 2.8
+        * @param aInterfaceUid Specific uid for the interface.
+        * @return TAny* Pointer to the callback interface.
+        */
+		virtual TAny* GetCallbackInterface( TUid aInterfaceUid ) = 0;
+
+        /**
+        * Register flags which affect general extension handling in the engine. 
+        * Flags must be deregisterd when no longer needed as they can affect
+        * to the engine performance. Each registered flag must be deregistered, 
+        * and only once. All the flags that are in registered state when 
+        * the class is deleted, must be deregistered in the class destructor
+        * method. 
+        * @since 2.8
+        * @param aFlags Flags to register.
+        * @return void.
+        */
+		virtual void RegisterFlags( TUint32 aFlags ) = 0;
+
+        /**
+        * Deregister flags which have been registered before. It is not allowed
+        * to deregister flags that have not been registered earlier.  
+        * @since 2.8
+        * @param aFlags Flags to deregister.
+        * @return void.
+        */
+		virtual void DeregisterFlags( TUint32 aFlags ) = 0;
+	};
+
+
+/**
+* Image processing interface. The engine calls this interface when it gets 
+* a new view finder or captured image from the camera. The extension that 
+* implements this can manipulate the image before it is given to the 
+* application. 
+*/
+
+const TInt KCaeExtProcessImageInterfaceUidValue = 0x101F856A;
+const TUid KCaeExtProcessImageInterfaceUid = { KCaeExtProcessImageInterfaceUidValue };
+
+class MCaeExtProcessImageInterface
+	{
+	public:
+        /**
+        * Process the view finder bitmap. 
+        * @since 2.8
+        * @param aFrame The VF frame bitmap.
+        * @param aError Error code
+        */
+		virtual void ProcessViewFinderFrame( CFbsBitmap& aFrame, TInt& aError ) = 0;
+
+        /**
+        * Process the captured image from the camera. The function can be synchronous or 
+		* asynchronous.
+        * @since 2.8
+        * @param aCaeStatus The status of the finished operation.
+        * @param aBitmap The captured image, if it is a bitmap.
+        * @param aImageData The captured image, if it is a formatted image.
+        * @param aImageHeader The header of the captured image (e.g. Exif header).
+        * @return TBool Whether the operation is asynchronous.
+        */
+		virtual TBool ProcessCapturedImage( TRequestStatus& aCaeStatus, CFbsBitmap*& aBitmap, HBufC8*& aImageData, HBufC8*& aImageHeader ) = 0;
+		
+        /**
+        * Process the snap image. The function can be synchronous or asynchronous.
+        * Modifications should be done on aSnapBitmap. If it is null the extension 
+        * can create it using aStillBitmap as a source.
+        * @since 2.8
+        * @param aCaeStatus The status of the finished operation.
+        * @param aBitmap The still image as a bitmap. Image can be NULL.
+        * @param aSnapBitmap Returned snap bitmap. Image can be NULL.
+        * @return TBool Whether the operation is asynchronous.
+        */
+		virtual TBool ProcessSnapImage( TRequestStatus& aCaeStatus, CFbsBitmap*& aStillBitmap, CFbsBitmap*& aSnapBitmap ) = 0;
+		
+        /**
+        * Process the still image. The function can be synchronous or asynchronous.
+        * @since 2.8
+        * @param aCaeStatus The status of the finished operation.
+        * @param aBitmap The still image, if it is a bitmap.
+        * @param aImageData The still image, if it is a formatted image.
+        * @param aImageHeader The header of the captured image (e.g. Exif header).
+        * @return TBool Whether the operation is asynchronous.
+        */
+		virtual TBool ProcessStillImage( TRequestStatus& aCaeStatus, CFbsBitmap*& aBitmap, HBufC8*& aImageData, HBufC8*& aImageHeader ) = 0;
+		
+        /**
+        * Cancel the asynchronous operation. 
+        * @since 2.8
+        */
+		virtual void CaeExtensionCancel() = 0;
+	};
+
+
+/**
+* Settings interface. The engine calls this when settings should be saved or 
+* restored. Note that not all settings type of exttensions need to implement this
+* interface.
+*/
+
+const TInt KCaeExtSettingsInterfaceUidValue = 0x101F8569;
+const TUid KCaeExtSettingsInterfaceUid = { KCaeExtSettingsInterfaceUidValue };
+
+class MCaeExtSettingsInterface
+	{
+	public:
+
+        /**
+        * Restore previously saved settings.
+        * @since 2.8
+        */
+		virtual void ResetToPreviousSettingsL() = 0;				
+
+        /**
+        * Restore default settings.
+        * @since 2.8
+        */
+		virtual void ResetToDefaultsL() = 0;
+	};
+
+
+/**
+* Engine info interface. Implemented by the engine. The extension can get info 
+* about the current engine state.
+*/
+
+const TInt KCaeExtEngineInfoCallbackInterfaceUidValue = 0x101F856B;
+const TUid KCaeExtEngineInfoCallbackInterfaceUid = { KCaeExtEngineInfoCallbackInterfaceUidValue };
+
+class MCaeExtEngineInfoCallbackInterface
+    {
+    public: 
+        /**
+        * Get current still image size. 
+        * @since 2.8
+        * @return TSize Still image size in pixels.
+        */
+		virtual TSize McaeExtStillImageSize() = 0;
+
+        /**
+        * Get current snap image size. 
+        * @since 2.8
+        * @return TSize Snap image size in pixels.
+        */
+		virtual TSize McaeExtSnapImageSize() = 0;
+
+        /**
+        * Get current view finder size. 
+        * @since 2.8
+        * @return TSize View finder size in pixels.
+        */
+		virtual TSize McaeExtViewFinderSize() = 0;
+
+        /**
+        * Checks that the camera power is on. If it is not, the function leaves with 
+		* KErrNotReady.
+        * @since 2.8
+        * return void.
+        */
+		virtual void McaeExtCheckPowerL() = 0;
+
+        /**
+        * Get display index. 
+        * @since 2.8
+        * @return TInt Display index.
+        */
+		virtual TInt McaeExtDisplayIndex() = 0;
+    };
+
+
+#endif // CAEENGINEEXTINTERFACE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.hrh	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface for extensions
+*
+*/
+
+
+
+#ifndef CAEENGINEEXTINTERFACE_HRH
+#define CAEENGINEEXTINTERFACE_HRH
+
+// CONSTANTS
+
+// Common constants for all extensions
+#define KExtensionInterfaceUidValue		0x101F856B
+#define KExtensionTypeString			"CAE_EXTENSION"
+
+#endif // CAEENGINEEXTINTERFACE_HRH
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/camera_application_engine_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="aed9a2d75c3f9d5ba94afea582303289" dataversion="2.0">
+<name>Camera Application Engine API</name>
+<description>Interface for using camera application engine.</description>
+<type>c++</type>
+<collection>CamAppEngine</collection>
+<libs><lib name="CaeEngine.lib"/>
+</libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to Camera Application Engine API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CaeEngine.h     MW_LAYER_PLATFORM_EXPORT_PATH(CaeEngine.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/inc/CaeEngine.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1383 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAEENGINE_H
+#define CAEENGINE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <gdi.h>
+#include <ecam.h>
+
+// FORWARD DECLARATIONS
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class CFbsBitmap;
+
+// CONSTANTS
+
+// Service UIDs. Services are usually implemented in plug-in extension modules.
+
+const TUid KCaeProcessImageServiceUid = { 0x101F856A };
+const TUid KCaeSettingsServiceUid = { 0x101F8569 };
+
+
+// CLASS DECLARATIONS
+
+/**
+* The feature list item. The features that implement each service are sorted according 
+* to the calling order in the engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.8
+*/
+
+struct TCaeOrderedFeatureListItem
+    {
+    /** The UID of the service interface */
+    TUid iServiceUid; 
+
+    /** The UID of the feature. It identifies the extension that implements this service. */
+    TUid iFeatureUid;
+    };
+
+typedef RArray<TCaeOrderedFeatureListItem> RCaeOrderedFeatureList;
+
+/**
+* Information about camera and the engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class TCamAppEngineInfo
+    {
+    
+    public:
+        // Camera Application Engine options.
+        enum TOptions
+            {
+            /** No options supported */
+            ENoCaeOptionsSupported      = 0x0000, 
+            /** Still capturing burst mode flag */
+            EStillBurstSupported        = 0x0001,
+            /** Ev compensation flag */
+            EEvCompensationSupported    = 0x0002
+            };
+
+    public:
+
+        // Camera hardware version present.
+        TVersion iHardwareVersion;
+        // Camera driver software version present.
+        TVersion iSoftwareVersion;
+        // Actual orientation of the camera.
+        TCameraInfo::TCameraOrientation iOrientation;
+
+        // Bitfield of CCamera::TOptions available. 
+        TUint32 iOptionsSupported;
+        // Bitfield of CCamera::TFlash modes available.
+        TUint32 iFlashModesSupported;
+        // Bitfield of CCamera::TExposure modes available.
+        TUint32 iExposureModesSupported;
+        // Bitfield of CCamera::TWhiteBalance modes available.
+        TUint32 iWhiteBalanceModesSupported;
+
+        // Minimum zoom value allowed. Must be negative or 
+        // zero (for not supported).
+        TInt iMinZoom;
+        // Maximum zoom value allowed. Must be positive or 
+        // zero (for not supported).
+        TInt iMaxZoom;
+        // Maximum digital zoom value allowed. Must be positive or 
+        // zero (for not supported).
+        TInt iMaxDigitalZoom;
+
+        // Image size multiplier corresponding to minimum zoom value. 
+        // Must be between 0 and 1 inclusive.
+        TReal32 iMinZoomFactor;
+        // Image size multiplier corresponding to maximum zoom value. 
+        // Must be greater than or equal to 1.
+        TReal32 iMaxZoomFactor;
+        // Image size multiplier corresponding to maximum digital zoom value. 
+        // Must be greater than or equal to 1.
+        TReal32 iMaxDigitalZoomFactor;
+
+        // Count of still image capturing sizes allowed.
+        TInt iNumImageSizesSupported;
+        // Bitfield of still image CCamera::TFormat values supported.
+        TUint32 iImageFormatsSupported;
+    
+        // Count of still image capturing quality levels initialized.
+        TInt iNumStillQualityLevelsSupported;
+        // Count of video recording quality levels initialized.
+        TInt iNumVideoQualityLevelsSupported;
+
+        // Bitfield of CCaeEngine::TOptions available. 
+        TUint32 iCaeOptionsSupported;
+
+        // Integer (e.g. -9) that corresponds to minimum EV compensation value.
+        TInt iMinEvCompensation;
+        // Integer (e.g. 9) that corresponds to maximum EV compensation value.
+        TInt iMaxEvCompensation;
+        // Minimum camera EV compensation value (e.g. -3.0).
+        TReal32 iMinEvCompensationValue;
+        // Maximum camera EV compensation value (e.g. 3.0).
+        TReal32 iMaxEvCompensationValue;
+    };
+
+
+/**
+* Camera Application Engine observer class.
+* Mixin base class for the clients of the engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class MCamAppEngineObserver
+    {
+
+    public:
+
+        /**
+        * Called asynchronously when CCaeEngine::Init(), CCaeEngine::PowerOn(), 
+        * or CCaeEngine::Reserve() completes.
+        * Indicates if Camera Application Engine is ready for operation, 
+        * the camera is reserved and its power is switched on.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoInitComplete( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when preparing of still image 
+        * capturing completes after 
+        * PrepareStillCaptureL() has been called.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoStillPrepareComplete( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when preparing of video recording completes 
+        * after PrepareVideoRecordingL() has been called.
+        * May be called second time with an error code after a successful preparation 
+        * if video recording loses its prepared state for some reason (e.g. audio HW 
+        * is reserved for some other application).
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoPrepareComplete( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when a view finder bitmap is ready for display 
+        * CCaeEngine::StartViewFinderBitmapsL(...) has been called. 
+        * Called repeatedly until CCaeEngine::StopViewFinder() is called.  
+        * The bitmap should be drawn synchronously as it will be re-used as soon as this function returns.
+        * @since 2.1
+        * @param aFrame Reference to a bitmap containing view finder data. Does not transfer ownership.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoViewFinderFrameReady( CFbsBitmap& aFrame, 
+            TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when CCaeEngine::CaptureStill() is called and 
+        * snap-image for displaying is ready.
+        * @since 2.1
+        * @param aBitmap Constant reference to a bitmap set on success for Symbian OS bitmap formats. 
+        * Does not transfer ownership. Bitmap contents can not be changed.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoSnapImageReady( const CFbsBitmap& aBitmap, 
+            TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when CCaeEngine::CaptureStill() is called and 
+        * image for storaging is ready.
+        * Depending on the prepared image data format, delivers either 
+        * Symbian OS bitmap image or an image in another format, not both. 
+        * The bitmap/the other format image must be used and deleted before 
+        * returning.
+        * @since 2.1
+        * @param aBitmap Pointer to a bitmap transferring ownership and set on success 
+        * for Symbian OS bitmap formats.
+        * @param aData Pointer to image data transferring ownership and set on success 
+        * for non-Symbian OS bitmap or other image data formats.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoStillImageReady( CFbsBitmap* aBitmap, 
+            HBufC8* aData, 
+            TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is running 
+        * after CCaeEngine::StartVideoRecording() or 
+        * CCaeEngine::ResumeVideoRecording() has been called.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingOn( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is paused after 
+        * CCaeEngine::PauseVideoRecording() has been called.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingPaused( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is completed 
+        * after CCaeEngine::StopVideoRecording() has been called or 
+        * recording has been completed for some other reason.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * if aError == KErrDiskFull, then disk storage is full.
+        * if aError == KErrCompletion, then clip max size was reached.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingComplete( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously and repeatedly with timed intervals 
+        * when video clip recording is running after 
+        * CCaeEngine::StartVideoRecording() or 
+        * CCaeEngine::ResumeVideoRecording() has been called.
+        * Also, called once by video recording pause operation 
+        * by CCaeEngine::PauseVideoRecording() and stop operation 
+        * by CCaeEngine::StopVideoRecording().
+        * @since 2.1
+        * @param aTimeElapsed Returns recording time elapsed from video recording start.
+        * @param aTimeRemaining Returns estimated video recording time left 
+        * limited by storage capacity or max clip size.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingTimes( 
+            TTimeIntervalMicroSeconds aTimeElapsed, 
+            TTimeIntervalMicroSeconds aTimeRemaining, 
+            TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when video recording is stopped and the CCaeEngine::SetAsyncVideoStopMode()
+        * has been enabled. After this client may play sounds etc. while waiting the
+        * McaeoVideoRecordingComplete call.
+        * @since 5.0
+        * @return void
+        */
+        virtual void McaeoVideoRecordingStopped() 
+            {
+            
+            };
+    };
+
+
+/**
+* Camera Application Engine still burst observer class.
+* Mixin base class for the clients of Camera Application Engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class MCaeStillBurstObserver
+    {
+
+    public:
+
+        /**
+        * Called asynchronously (multiple times) when still image burst 
+        * capturing is running and an image is captured after 
+        * CCaeEngine::CaptureStill() has been called. 
+        * Called once for every still image capture during the burst (just before the capture).
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaesboStillBurstCaptureMoment( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when still image burst capturing is completed 
+        * after CCaeEngine::CaptureStill() has been called.
+        * Before completion the engine has delivered all the captured images 
+        * using McaeoSnapImageReady() and McaeoStillImageReady() methods of 
+        * MCamAppEngineObserver.
+        * @since 2.1
+        * @param aImageCountDelivered Count of delivered burst images.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaesboStillBurstComplete( 
+            TInt aImageCountDelivered, 
+            TInt aError ) = 0;
+    };
+    
+    
+/**
+* The Camera Application Engine interface (abstract base class).
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class CCaeEngine : public CBase
+    {
+    
+    public: // Enumerations
+
+        // Possible operation modes.
+        enum TOperationMode
+            {
+            EOperationModeStill     = 0x00, // Still capturing mode (default).
+            EOperationModeVideo     = 0x01  // Video recording mode.
+            };
+
+        // Possible viewfinder types.
+        enum TViewFinder
+            {
+            EViewFinderBitmaps      = 0x00, // Bitmap-based (default).
+            EViewFinderDirect       = 0x01  // Direct Screen Access.
+            };
+
+        // Possible zooming modes.
+        enum TZoomMode
+            {
+            EZoomModeDigital        = 0x00, // Digital zoom (default).
+            EZoomModeOptical        = 0x01, // Optical zoom.
+            EZoomModeOpticalDigital = 0x02  // Optical+digital zoom.
+            };
+
+        // Possible snap image generating modes.
+        enum TSnapImageSource
+            {
+            ESnapImageSourceOriginal, // Create snap image from the captured (JPEG/Exif) image.
+            ESnapImageSourceThumbnail // Create snap image from the thumbnail of the captured (Exif) image.
+            };
+
+    public: // Creation
+
+        /**
+        * A static (factory) function to create the class instance.
+        * @since 2.1
+        * @return Pointer to a fully constructed CCaeEngine object. 
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C static CCaeEngine* NewL();
+
+        /**
+        * Sets the Camera Application Engine observer.
+        * @since 2.1
+        * @param aObserver Reference to Camera Application Engine observer.
+        * @return void
+        */
+        virtual void SetCamAppEngineObserver( 
+            MCamAppEngineObserver& aObserver ) = 0;
+
+    public: // General methods
+
+        /**
+        * Gets information about the supported Camera Application Engine and 
+        * Camera features.
+        * @since 2.1
+        * @param aInfo Info about supported features.
+        * @return void
+        */
+        virtual void GetInfo( TCamAppEngineInfo& aInfo ) const = 0;
+
+        /**
+        * Initializes Camera Application Engine for still image capturing. 
+        * Reserves the camera and switches the camera power on. 
+        * Intialization must be done before all other operations, except 
+        * SetCamAppEngineObserver and GetInfo. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @param aCreateSnapImage Boolean indicating if "snap-images" 
+        * should be created, leading to calls of McaeoSnapImageReady.
+        * @return void
+        */
+        virtual void InitL( TBool aCreateSnapImage = ETrue ) = 0;
+
+        /**
+        * Initialize the engine for still image capturing. 
+        * Switches also camera power on. 
+        * Intialization must be done before all other operations, except 
+        * SetCamAppEngineObserver and GetInfo. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @param aSdUidStillQltyLevels Still capturing quality levels Shared Data initialization file UID.
+        * @param aCreateSnapImage Boolean indicating if "snap-images" should be created 
+        * leading to calls of McaeoSnapImageReady.
+        * @return void
+        */
+        virtual void InitL( TUid aSdUidStillQltyLevels, 
+                            TBool aCreateSnapImage = ETrue ) = 0;
+
+        /**
+        * Initializes video recording. 
+        * The initialization must be done before video recording operations.
+        * @since 2.1
+        * @return void
+        */
+        virtual void InitVideoRecorderL() = 0;
+
+        /**
+        * Initializes video recording. 
+        * The initialization must be done before video recording operations.
+        * @since 2.1
+        * @param aSdUidVideoQltyLevels Video recording quality levels Shared Data initialization file UID.
+        * @return void
+        */
+        virtual void InitVideoRecorderL( TUid aSdUidVideoQltyLevels ) = 0;
+
+        /**
+        * Reserves the camera into use and switches the camera power on. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @return void
+        */
+        virtual void Reserve() = 0;
+        
+        /**
+        * Switches the camera power off and releases the camera.
+        * @since 2.1
+        * @return void
+        */
+        virtual void Release() = 0;
+
+        /**
+        * Switches the camera power on. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @return void
+        */
+        virtual void PowerOn() = 0;
+        
+        /**
+        * Switches the camera power off.
+        * @since 2.1
+        * @return void
+        */
+        virtual void PowerOff() = 0;
+
+    public: // Camera settings
+
+        /**
+        * Sets the zoom mode.
+        * @since 2.1
+        * @param aZoomMode Zoom mode to set.
+        * @return void
+        */
+        virtual void SetZoomModeL( TZoomMode aZoomMode = EZoomModeDigital ) = 0;
+
+        /**
+        * Gets the current zoom mode.
+        * @since 2.1
+        * @return The current zoom mode.
+        */
+        virtual TZoomMode ZoomMode() const = 0;
+
+        /**
+        * Sets the zoom value.
+        * @since 2.1
+        * @param aZoomValue Index of the zoom factor to set.
+        * @return void
+        */
+        virtual void SetZoomValueL( TInt aZoomValue = 0 ) = 0;
+
+        /**
+        * Gets the current zoom value.
+        * @since 2.1
+        * @return Index of the current zoom factor.
+        */
+        virtual TInt ZoomValue() const = 0;
+
+        /**
+        * Sets the brightness.
+        * @since 2.1
+        * @param aBrightness Brightness value in the range ECam.h SetBrightnessL allows.
+        * @return void
+        */
+        virtual void SetBrightnessL( TInt aBrightness = 0 ) = 0; 
+
+        /**
+        * Gets the current brightness setting.
+        * @since 2.1
+        * @return Brightness value.
+        */
+        virtual TInt Brightness() const = 0;
+
+        /**
+        * Sets the contrast.
+        * @since 2.1
+        * @param aContrast Contrast value in the range ECam.h SetContrastL allows.
+        * @return void
+        */
+        virtual void SetContrastL( TInt aContrast = 0 ) = 0; 
+        
+        /**
+        * Gets the current contrast setting.
+        * @since 2.1
+        * @return Contrast value.
+        */
+        virtual TInt Contrast() const = 0;
+
+        /**
+        * Sets the exposure mode.
+        * @since 2.1
+        * @param aExposureMode Exposure mode in the range ECam.h SetExposureL allows.
+        * @return void
+        */
+        virtual void SetExposureModeL( 
+            CCamera::TExposure aExposureMode = CCamera::EExposureAuto ) = 0;
+
+        /**
+        * Gets the current exposure mode.
+        * @since 2.1
+        * @return Exposure mode.
+        */
+        virtual CCamera::TExposure ExposureMode() const = 0;
+
+        /**
+        * Sets the white balance mode.
+        * @since 2.1
+        * @param aWhiteBalanceMode White balance mode in the range ECam.h SetWhiteBalanceL allows.
+        * @return void
+        */
+        virtual void SetWhiteBalanceModeL( 
+            CCamera::TWhiteBalance aWhiteBalanceMode = CCamera::EWBAuto ) = 0;
+
+        /**
+        * Gets the current white balance mode.
+        * @since 2.1
+        * @return White balance mode.
+        */
+        virtual CCamera::TWhiteBalance WhiteBalanceMode() const = 0;
+
+        /**
+        * Sets the flash mode.
+        * @since 2.1
+        * @param aFlashMode Flash mode in the range ECam.h SetFlashL allows.
+        * @return void
+        */
+        virtual void SetFlashModeL( 
+            CCamera::TFlash aFlashMode = CCamera::EFlashNone ) = 0;
+
+        /**
+        * Gets the current flash mode.
+        * @since 2.1
+        * @return Flash mode.
+        */
+        virtual CCamera::TFlash FlashMode() const = 0;
+
+        /**
+        * Resets to the default setting values.
+        * Resets the following settings: exposure mode, white balance mode, 
+        * zoom mode, zoom value, flash mode, brightness, and contrast. 
+        * @since 2.1
+        * @return void
+        */
+        virtual void ResetToDefaultsL() = 0;
+    
+    public: // View finder
+
+        /**
+        * Sets/resets view finder image mirroring.
+        * @since 2.1
+        * @param aMirror Boolean indicating whether view finder image should be mirrored or not.
+        * @return void
+        */
+        virtual void SetViewFinderMirrorL( TBool aMirror = EFalse ) = 0;
+
+        /**
+        * Queries if view finder image mirroring is on.
+        * @since 2.1
+        * @return Boolean indicating whether view finder image is currently mirrored or not.
+        */
+        virtual TBool ViewFinderMirror() const = 0;
+
+        /**
+        * Starts the bitmap-based view finder.
+        * The engine starts to call observer method McaeoViewFinderFrameReady() repeatedly.
+        * @since 2.1
+        * @param aSize Desired view finder size.
+        * @return void
+        */
+        virtual void StartViewFinderBitmapsL( TSize& aSize ) = 0;
+
+        /**
+        * Starts the bitmap-based view finder.
+        * The engine starts to call observer method McaeoViewFinderFrameReady() repeatedly.
+        * @since 2.1
+        * @param aSize Desired view finder size.
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void StartViewFinderBitmapsL(
+            TSize& aSize, 
+            TRect& aCropRect ) = 0;
+
+        /**
+        * Starts the direct screen access view finder.
+        * @since 2.1
+        * @param aWs Window server session.
+        * @param aScreenDevice Software device screen.
+        * @param aWindow Client-side handle to a server-side window.
+        * @param aScreenRect Portion of screen in screen co-ordinates.
+        * @return void
+        */
+        virtual void StartViewFinderDirectL( 
+            RWsSession& aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase& aWindow, 
+            TRect& aScreenRect ) = 0;
+        
+        /**
+        * Starts the direct screen access view finder.
+        * @since 2.1
+        * @param aWs Window server session.
+        * @param aScreenDevice Software device screen.
+        * @param aWindow Client-side handle to a server-side window.
+        * @param aScreenRect Portion of screen in screen co-ordinates.
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase& aWindow, 
+            TRect& aScreenRect, 
+            TRect& aCropRect ) = 0;
+
+        /**
+        * Stops the view finder.
+        * @since 2.1
+        * @return void
+        */
+        virtual void StopViewFinder() = 0;
+
+        /**
+        * Queries if view finder is running.
+        * @since 2.1
+        * @return Boolean indicating whether view finder is running or not.
+        */
+        virtual TBool IsViewFinding() const = 0;
+
+        /**
+        * Gets the current view finder size.
+        * @since 2.1
+        * @param aSize View finder size.
+        * @return void
+        */
+        virtual void GetViewFinderSize( TSize& aSize ) = 0;
+
+    public: // Still image capturing
+
+        /**
+        * Prepares Camera Application Engine for still image capture on 
+        * specified quality level.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aStillQualityIndex Still image quality level index.
+        * Imaging parameters linked to quality levels are defined by Shared Data ini-file. 
+        * @return void
+        */
+        virtual void PrepareStillCaptureL( TInt aStillQualityIndex ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for still image capture on 
+        * specified quality level.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aStillQualityIndex Still image quality level index. 
+        * Can have values 0 ... TCamAppEngineInfo::iNumStillQualityLevelsSupported - 1
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL( 
+            TInt aStillQualityIndex, 
+            const TRect& aCropRect ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for still image capture with 
+        * specified image size and format.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCompressionQuality Still image compression quality [0...100].
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            const TSize& aSize, 
+            CCamera::TFormat aFormat,  
+            TInt aCompressionQuality ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for still image capture with specified image size and format.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCompressionQuality Still image compression quality [0...100].
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            const TSize& aSize, 
+            CCamera::TFormat aFormat,  
+            TInt aCompressionQuality, 
+            const TRect& aCropRect ) = 0;
+
+        /**
+        * Gets the current prepared still quality level index.
+        * @since 2.1
+        * @return Still quality level index.
+        */
+        virtual TInt StillQualityIndex() const = 0;
+
+        /**
+        * Gets the still image frame size for the specified quality level.
+        * @since 2.1
+        * @param aStillQualityIndex Still capture quality index.
+        * @param aSize Still image frame size.
+        * @return void
+        */
+        virtual void GetStillFrameSize(
+            TInt aStillQualityIndex, 
+            TSize& aSize ) const = 0;
+
+        /**
+        * Gets the estimated still image size in bytes for the 
+        * specified quality level.
+        * @since 2.1
+        * @param aStillQualityIndex Still capture quality index.
+        * @return Estimated still capturing image size in bytes.
+        */
+        virtual TInt EstimatedStillSizeInBytes( 
+            TInt aStillQualityIndex ) const = 0;
+
+        /**
+        * Captures a still image or a still image burst.
+        * Calls first observer method McaeoSnapImageReady() and then 
+        * McaeoStillImageReady().
+        * McaeoSnapImageReady() is not called if engine initialization 
+        * has been done 
+        * with parameter aCreateSnapImage == EFalse.
+        * @since 2.1
+        * @return void
+        */
+        virtual void CaptureStill() = 0;
+
+        /**
+        * Cancels the on-going still image (single/burst) capture request.
+        * @since 2.1
+        * @return void
+        */
+        virtual void CancelCaptureStill() = 0;
+
+    public: // Video recording
+
+        /**
+        * Sets the file name for the video clip to be recorded.
+        * @since 2.1
+        * @param aVideoClipFileName File name.
+        * @return void
+        */
+        virtual void SetVideoRecordingFileNameL( 
+            const TDesC& aVideoClipFileName ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for video recording on 
+        * specified quality level.
+        * Calls observer method McaeoVideoPrepareComplete().
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index. 
+        * Can have values 0 ... TCamAppEngineInfo::iNumVideoQualityLevelsSupported - 1
+        * @return void
+        */
+        virtual void PrepareVideoRecordingL( TInt aVideoQualityIndex ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for video recording with 
+        * specified recording parameters.
+        * Calls observer method McaeoVideoPrepareComplete().
+        * @since 2.1
+        * @param aFrameSize Frame size.
+        * @param aFrameRate Frame rate.
+        * @param aBitRate Bit rate.
+        * @param aAudioEnabled Boolean indicating whether audio should be enabled or not.
+        * @param aMimeType MIME type.
+        * @param aPreferredSupplier Preferred supplier of video encoder.
+        * @param aVideoType Video type.
+        * @param aAudioType Audio type.
+        * @return void
+        */
+        virtual void PrepareVideoRecordingL( 
+            const TSize& aFrameSize, 
+            TReal32 aFrameRate, 
+            TInt aBitRate, 
+            TBool aAudioEnabled,
+            const TDesC8& aMimeType, 
+            const TDesC& aPreferredSupplier, 
+            const TDesC8& aVideoType = KNullDesC8, 
+            const TDesC8& aAudioType = KNullDesC8 ) = 0;
+        /**
+        * Closes (prepared) video recording to free resources.
+        * @since 2.1
+        * @return void
+        */
+        virtual void CloseVideoRecording() = 0;
+
+        /**
+        * Gets the current prepared video quality level index.
+        * @since 2.1
+        * @return Video quality level index.
+        */
+        virtual TInt VideoQualityIndex() const = 0;
+        
+        /**
+        * Gets the video frame size for the specified video quality level.
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index.
+        * @return Video frame size.
+        */
+        virtual void GetVideoFrameSize(
+            TInt aVideoQualityIndex, 
+            TSize& aSize ) const = 0;
+
+        /**
+        * Gets the video frame rate for the specified video quality level.
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index.
+        * @return Video frame rate.
+        */
+        virtual TReal32 VideoFrameRate( TInt aVideoQualityIndex ) const = 0;
+
+        /**
+        * Gets the estimated video recording bit rate including audio bit rate 
+        * for the specified video quality level.
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index.
+        * @return Video recording bit rate rate including audio bit rate.
+        */
+        virtual TInt EstimatedVideoRecordingBitRateL( 
+            TInt aVideoQualityIndex ) const = 0;
+
+        /**
+        * Sets the maximum size in bytes for a video clip.
+        * @since 2.1
+        * @param aMaxClipSizeInBytes Maximum video clip size measured in bytes.
+        * If set to 0, then no limit but the available storage space.
+        * @return void
+        */
+        virtual void SetVideoClipMaxSizeL( TInt aMaxClipSizeInBytes = 0 ) = 0;
+        
+        /**
+        * Gets the current maximum size in bytes for a video clip.
+        * @since 2.1
+        * @return Video clip maximum size.
+        */
+        virtual TInt VideoClipMaxSize() const = 0;
+
+        /**
+        * Sets audio enabled or disabled for video recording.
+        * @since 2.1
+        * @param aAudioEnabled Boolean indicating whether audio should be enabled or not for video recording.
+        * @return void
+        */
+        virtual void SetVideoAudioL( TBool aAudioEnabled ) = 0;
+        
+        /**
+        * Queries if audio is enabled or disabled for video recording.
+        * @since 2.1
+        * @return Boolean indicating whether audio is enabled or disabled for video recording.
+        */
+        virtual TBool VideoAudio() const = 0;
+
+        /**
+        * Sets the time interval for video recording time info.
+        * @since 2.1
+        * @param aInterval Time interval in microseconds for video recording time info.
+        * If zero is given as interval, then video recording time is not generated.
+        * @return void
+        */
+        virtual void SetVideoTimesIntervalL( 
+            TTimeIntervalMicroSeconds aInterval ) = 0;
+
+        /**
+        * Gets the current time interval for video recording time info.
+        * @since 2.1
+        * @return Time interval in microseconds for video recording time info.
+        */
+        virtual TTimeIntervalMicroSeconds VideoTimesInterval() const = 0;
+
+        /**
+        * Starts video recording.
+        * Calls observer method McaeoVideoRecordingOn().
+        * @since 2.1
+        * @return void
+        */
+        virtual void StartVideoRecording() = 0;
+
+        /**
+        * Stops video recording.
+        * Calls observer method McaeoVideoRecordingComplete().
+        * @since 2.1
+        * @return void
+        */
+        virtual void StopVideoRecording() = 0;
+
+        /**
+        * Pauses video recording.
+        * Calls observer method McaeoVideoRecordingPaused().
+        * @since 2.1
+        * @return void
+        */
+        virtual void PauseVideoRecording() = 0;
+
+        /**
+        * Resumes video recording after pause.
+        * Calls observer method McaeoVideoRecordingOn().
+        * @since 2.1
+        * @return void
+        */
+        virtual void ResumeVideoRecording() = 0;
+
+        /**
+        * Gets the remaining video recording time before recording has started.
+        * @since 2.1
+        * @return Remaining video recording time.
+        */
+        virtual TTimeIntervalMicroSeconds RemainingVideoRecordingTime() 
+            const = 0;
+
+        /**
+        * Queries if video recording is running.
+        * @since 2.1
+        * @return Boolean indicating whether video recording is running or not.
+        */
+        virtual TBool IsVideoRecording() const = 0;
+
+    public: // New overloading method for preparing video recording
+
+        /**
+        * Prepares Camera Application Engine for video recording with specified recording parameters.
+        * Calls observer method McaeoVideoPrepareComplete().
+        * @since 2.1
+        * @param aFrameSize Frame size.
+        * @param aFrameRate Frame rate.
+        * @param aBitRate Bit rate.
+        * @param aAudioEnabled Boolean indicating whether audio should be enabled or not.
+        * @param aAudioBitRate Audio bit rate.
+        * @param aMimeType MIME type.
+        * @param aPreferredSupplier Preferred supplier of video encoder.
+        * @param aVideoType Video type.
+        * @param aAudioType Audio type.
+        * @return void
+        */
+        virtual void PrepareVideoRecordingL(
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            TInt          aAudioBitRate, 
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType, 
+            const TDesC8& aAudioType ) = 0;
+
+    public: // Still image burst capturing
+
+        /**
+        * Sets the Camera Application Engine still image burst capturing 
+        * observer.
+        * @since 2.1
+        * @param aObserver Camera Application Engine still burst observer.
+        * @return void
+        */
+        virtual void SetCaeStillBurstObserver( 
+            MCaeStillBurstObserver& aObserver ) = 0;
+
+        /**
+        * Sets the image count for still image (burst) capturing.
+        * Note: Inputting value 1 switches back to normal still capturing.
+        * @since 2.1
+        * @param aImageCount The desired count of images to capture (in a burst). 
+        * @return The count of images to be captured (in a burst).
+        */
+        virtual TInt SetStillCaptureImageCountL( TInt aImageCount ) = 0;
+
+        /**
+        * Gets the image count for still image (burst) capturing.
+        * @since 2.1
+        * @return Count of images to capture (in a burst).
+        */
+        virtual TInt StillCaptureImageCount() const = 0;
+
+        /**
+        * Sets the time interval between single captures in still burst.
+        * @since 2.1
+        * @param aInterval Time interval in microseconds.
+        * @return void
+        */
+        virtual void SetStillBurstCaptureIntervalL( 
+            TTimeIntervalMicroSeconds aInterval ) = 0;
+
+        /**
+        * Gets the time interval between single captures in still burst.
+        * @since 2.1
+        * @return Time interval in microseconds.
+        */
+        virtual TTimeIntervalMicroSeconds StillBurstCaptureInterval() const = 0;
+
+        /**
+        * Stops still image burst capturing. 
+        * Delivers the burst images captured before call. 
+        * This is different from CancelCaptureStill that cancels the operation and 
+        * prevents delivering the captured image.
+        * @since 2.1
+        * @return void
+        */
+        virtual void StopStillBurstCapture() = 0;
+
+    public: 
+
+        /**
+        * Prepare Camera Application Engine for still image capture on 
+        * specified quality level with desired snap image size. 
+        * The returned snap image size is always equal or bigger in both 
+        * dimensions than the given size. The returned size is stepwise 
+        * downscaled from the captured image size. The parameter aSnapSize 
+        * is ignored if the image format does not support it in the engine.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aStillQualityIndex Still image quality level index. 
+        * Can have values 0 ... TCamAppEngineInfo::iNumStillQualityLevelsSupported - 1
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            TInt aStillQualityIndex, 
+            TSize& aSnapSize ) = 0;
+
+        /**
+        * Prepare Camera Application Engine for still image capture with 
+        * specified image size, format, and desired snap image size. 
+        * The returned snap image size is always equal or bigger in both 
+        * dimensions than the given size. The returned size is stepwise 
+        * downscaled  from the captured image size. The parameter aSnapSize 
+        * is ignored if the image format does not support it in the engine.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCompressionQuality Still image compression quality [0...100].
+        * @param aCropRect Desired cropping/clipping rectangle. The size (0,0) means that this parameter is ignored.
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            const TSize& aSize, 
+            CCamera::TFormat aFormat,  
+            TInt aCompressionQuality, 
+            const TRect& aCropRect,
+            TSize& aSnapSize ) = 0;
+
+        /**
+        * Sets the exposure value (EV) compensation index.
+        * @since 2.1
+        * @param aEvIndex Exposure value compensation index to set.
+        * @return void
+        */
+        virtual void SetEvCompensationL( TInt aEvIndex = 0 ) = 0;
+
+        /**
+        * Gets the current exposure value (EV) compensation index.
+        * @since 2.1
+        * @return Exposure value compensation index.
+        */
+        virtual TInt EvCompensation() const = 0;
+                
+        /**
+        * Sets snap image creation on/off.
+        * @since 2.1
+        * @param aCreateSnapImage Boolean indicating if "snap-images" for
+        * displaying should be created, leading to calls of McaeoSnapImageReady.
+        * @return void
+        */
+        virtual void SetSnapImageCreation( 
+            TBool aCreateSnapImage = ETrue ) = 0;
+        
+        /** 
+        * A static (factory) function to create the class instance.
+        * @since 2.6
+        * @param aCameraIndex Index from 0 to CamerasAvailable()-1 inclusive 
+        * specifying the camera device to use.
+        * @return Pointer to a fully constructed CCaeEngine object. 
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C static CCaeEngine* NewL( 
+            TInt aCameraIndex );
+        
+        /** 
+        * Gets the number of cameras on the device.
+        * @since 2.6
+        * @return Count of cameras present on the device. 
+        */
+        IMPORT_C static TInt CamerasAvailable();
+        
+        /** 
+        * Enumerates through the available image capture sizes. 
+        * Returns the image size based on the specified size index and format. 
+        * The largest image resolution is returned for index 0, the smallest 
+        * for index TCamAppEngineInfo::iNumImageSizesSupported-1.
+        * The size index must be in the range 0 to 
+        * TCamAppEngineInfo::iNumImageSizesSupported-1 inclusive.
+        * @since 2.6
+        * @param aSize Returned image size.
+        * @param aSizeIndex Size index.
+        * @param aFormat The image format. 
+        * @return void
+        */
+        virtual void EnumerateStillCaptureSizes(
+            TSize& aSize, 
+            TInt aSizeIndex, 
+            CCamera::TFormat aFormat ) const = 0;
+        
+        /** 
+        * Sets the quality value to use with JPEG and Exif image formats. 
+        * @since 2.6
+        * @param aQuality The quality value to use, clamped to the range 1 to 100.
+        * @return void
+        */
+        virtual void SetJpegQuality(
+            TInt aQuality ) = 0;
+        
+        /** 
+        * Gets the currently set JPEG quality value.
+        * Returns 0 if not previously prepared or set.
+        * @since 2.6
+        * @return The currently set JPEG quality value. 
+        */
+        virtual TInt JpegQuality() const = 0;
+
+        /**
+        * Gets a custom interface. The client has to cast the returned pointer.
+        * @since 2.6
+        * @return  "TAny*" Custom interface pointer. NULL if the requested interface is not supported.
+        */
+        virtual TAny* CustomInterface(
+        	TUid aInterface ) = 0;
+
+        /** 
+        * Sets the size of the snap image bitmap.
+        * @since 2.8
+        * @param aSize The size of the snap bitmap. Corrected size is returned. 
+        * @return void
+        */
+        virtual void SetSnapImageSizeL(
+            TSize& aSize ) = 0;
+         /** 
+        * Sets the color mode of the snap image bitmap
+        * @since 2.8
+        * @param aMode The color mode of the snap bitmap.
+        * @return void
+        */
+        virtual void SetSnapImageColorMode(
+            TDisplayMode aMode ) = 0;
+
+        /**
+        * Gets array of features per interfaces. Each feature is ordered in
+        * the current calling order e.g. when certain image prosessing 
+        * operation is applied to the captured image. If SetOrder() has not yet
+        * been called, the returned order is the default order.
+        * @since 2.8
+        * @param aOrderedFeatureArray Feature array sorted by the current calling order in an interface.
+        * @return  void
+        */
+        virtual void GetOrderL( RCaeOrderedFeatureList& aOrderedFeatureList ) = 0;
+
+        /**
+        * Sets array of features per interfaces. Each feature should be ordered
+        * according to the wanted calling order e.g. to define when certain image 
+        * prosessing operation is applied to the captured image. If this method
+        * leaves, the internal array has not been changed.
+        * @since 2.8
+        * @param aOrderedFeatureArray Feature array sorted by the wanted calling order in an interface.
+        * @return void. 
+        */
+        virtual void SetOrderL( const RCaeOrderedFeatureList& aOrderedFeatureList ) = 0;
+
+        /** 
+        * A static (factory) function to create the class instance.
+        * @since 2.6
+        * @param aCameraIndex Index from 0 to CamerasAvailable()-1 inclusive 
+        * specifying the camera device to use.
+        * @param aDisplayIndex Display index specifying the display to use.
+        * @return Pointer to a fully constructed CCaeEngine object. 
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C static CCaeEngine* NewL( 
+            TInt aCameraIndex, TInt aDisplayIndex );
+        /** 
+        * Sets the source of the snap image bitmap.
+        * @since 2.8
+        * @param aSnapImageSource The source of the snap image bitmap.
+        * @return void
+        */
+        virtual void SetSnapImageSourceL(
+            TSnapImageSource aSnapImageSource ) = 0;
+
+        /** 
+        * Sets the specific image codec implementation to be used in decoding and encoding.
+        * @since 3.1
+        * @param aDecoderUid The UID of the specific image decoder to be used. KNullUid means the default decoder.
+        * @param aEncoderUid The UID of the specific image encoder to be used. KNullUid means the default encoder.
+        * @return void
+        */
+        virtual void SetImageCodecsL( 
+        	TUid aDecoderUid, TUid aEncoderUid ) = 0;
+
+        /** 
+        * Enumerate Video Frame Size.
+        * @since 3.2
+        * @param aSize enumerated size
+        * @return size index of camera HW. Returns -1 if aSize is not supported.
+        */
+        virtual TInt EnumerateVideoFrameSizeL(const TSize& aSize) = 0;
+        
+        /** 
+        * Gets the device-unique handle of camera object owned by the CCaeEngine.
+        * @since 3.2
+        * @return  Camera object handle
+        */
+        virtual TInt CCameraHandle() const = 0;
+
+        /**
+        * Set CamAppEngine internal camera state to reserved and power state on. 
+        * This method is used when client uses Camera-API directly through the duplicate instance in still mode,
+        * but wants to use CAE in video recording mode without using the CAE InitL.
+        * @since 3.2
+        * @return void
+        */
+        virtual void EnableVideoRecording() = 0;
+        
+        /**
+        * Set CamAppEngine internal camera state to released and power state off.
+        * @since 3.2
+        * @return void
+        */
+        virtual void DisableVideoRecording() = 0;
+
+        /** 
+        * Sets CAE to Extension processing mode.
+        * @since 3.2
+        * @param aExtModeActive Boolean indicating if extension mode is enabled or disabled.
+        * @param aCreateSnapImage Boolean indicating if "snap-images" should be created by CAE.
+        * @return void
+        */
+        virtual void SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage ) = 0;
+
+        /** 
+        * Process extension for view finder.
+        * @since 3.2
+        * @param aFrame The view finder frame bitmap that is processed.
+        * @return void
+        */
+        virtual void ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame ) = 0;
+
+        /** 
+        * Process extension for snap image.
+        * @since 3.2
+        * @param aSnapImage The bitmap of snap image. Does not transfer ownership.
+        * @return void
+        */
+        virtual void ProcessExtSnapImageL( CFbsBitmap& aSnapImage ) = 0;
+        
+        /** 
+        * Process extension for captured image.
+        * @since 3.2
+        * @param aBitmap The captured bitmap image. Does not transfer ownership.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @return void
+        */
+        virtual void ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage ) = 0;
+
+        /** 
+        * Process extension for captured image.
+        * @since 3.2
+        * @param aImageData The captured image, if it is a formatted image and type of HBufC8. Ownership is transferred.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @return void
+        */
+        virtual void ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage ) = 0;
+
+        /** 
+        * Process extension for captured image.
+        * @since 3.2
+        * @param aImageDataDes The captured image, if it is a formatted image and type of TDesC8. Does not transfer ownership.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @return void
+        */
+        virtual void ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage ) = 0;
+
+        /** 
+        * Cancels extensions processing
+        * @since 3.2
+        * @return void
+        */
+        virtual void ProcessExtCancel() = 0;
+
+        /** 
+        * Get list of skipped extensions. Application may define which extensions are skipped during image processing. 
+        * @since 3.2
+        * @param aSkippedExtensions The list of skipped extensions TUid. 
+        * @return void
+        */
+        virtual void SkippedExtensionListL( RCaeOrderedFeatureList& aSkippedExtensions ) = 0;
+
+        /** 
+        * Set list of skipped extensions. Application may define which extensions are skipped during image processing.
+        * The GetOrderL() returns the list of all installed extensions.
+        * @since 3.2
+        * @param aSkippedExtensions The list of installed and skipped extensions TUid. 
+        * @return void
+        */
+        virtual void SetSkippedExtensionList( RCaeOrderedFeatureList& aSkippedExtensions ) = 0;
+
+        /** 
+        * Set asynchronous video recording stop mode. When Enabled then StopVideoRecording will return quickly and
+        * MCamAppEngineObserver callbacks McaeoVideoRecordingStopped and McaeoVideoRecordingComplete
+        * are called asynchronously.
+        * @since 5.0
+        * @param aAsyncVideoStopEnabled The async stop state. 
+        * @return error code KErrNone if supported by the video framework and mode was changed.
+        */
+        virtual TInt SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled ) = 0;
+
+    };
+
+#endif // CAEENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/EABI/STIFCaeTestU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,36 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CTestCallerI15CCaeTestReleaseE @ 4 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CCaeTestStillStatesE @ 5 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CCaeTestVideoStatesE @ 6 NONAME ; #<TI>#
+	_ZTI11CTestCallerI21CCaeTestStillSettingsE @ 7 NONAME ; #<TI>#
+	_ZTI11CTestCallerI21CCaeTestVideoSettingsE @ 8 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 9 NONAME ; #<TI>#
+	_ZTI14CCaeTestClient @ 10 NONAME ; #<TI>#
+	_ZTI15CCaeTestRelease @ 11 NONAME ; #<TI>#
+	_ZTI19CCaeTestStillStates @ 12 NONAME ; #<TI>#
+	_ZTI19CCaeTestVideoStates @ 13 NONAME ; #<TI>#
+	_ZTI20CCaeTestStatesClient @ 14 NONAME ; #<TI>#
+	_ZTI21CCaeTestStillSettings @ 15 NONAME ; #<TI>#
+	_ZTI21CCaeTestVideoSettings @ 16 NONAME ; #<TI>#
+	_ZTI22CCaeTestSettingsClient @ 17 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 18 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 19 NONAME ; #<VT>#
+	_ZTV11CTestCallerI15CCaeTestReleaseE @ 20 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CCaeTestStillStatesE @ 21 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CCaeTestVideoStatesE @ 22 NONAME ; #<VT>#
+	_ZTV11CTestCallerI21CCaeTestStillSettingsE @ 23 NONAME ; #<VT>#
+	_ZTV11CTestCallerI21CCaeTestVideoSettingsE @ 24 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 25 NONAME ; #<VT>#
+	_ZTV14CCaeTestClient @ 26 NONAME ; #<VT>#
+	_ZTV15CCaeTestRelease @ 27 NONAME ; #<VT>#
+	_ZTV19CCaeTestStillStates @ 28 NONAME ; #<VT>#
+	_ZTV19CCaeTestVideoStates @ 29 NONAME ; #<VT>#
+	_ZTV20CCaeTestStatesClient @ 30 NONAME ; #<VT>#
+	_ZTV21CCaeTestStillSettings @ 31 NONAME ; #<VT>#
+	_ZTV21CCaeTestVideoSettings @ 32 NONAME ; #<VT>#
+	_ZTV22CCaeTestSettingsClient @ 33 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 34 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface/integration tests
+*
+*/
+
+
+#if defined(__S60_)
+        #include <platform_paths.hrh>
+#endif
+
+TARGET        STIFCaeTest.dll
+TARGETTYPE    dll
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY    CAP_GENERAL_DLL
+VENDORID      VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../EABI/ 
+#elif defined( WINSCW )
+deffile Bwinscw/ 
+#elif defined( WINS )
+deffile Bwins/ 
+#else
+deffile Bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          StifCaeTestTop.cpp
+SOURCE          CaeTestClient.cpp
+SOURCE          CaeTestStillStates.cpp
+SOURCE          CaeTestVideoStates.cpp
+SOURCE          CaeTestStatesClient.cpp
+SOURCE          CaeTestStillSettings.cpp
+SOURCE          CaeTestVideoSettings.cpp
+SOURCE          CaeTestSettingsClient.cpp
+SOURCE          CaeTestRelease.cpp
+
+// STIF TFW files
+SOURCEPATH    ../src
+SOURCE        TestFrameWork/TestCase.cpp
+SOURCE        TestFrameWork/AssertFailure.cpp
+SOURCE        TestFrameWork/TestSuite.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/TestFrameWork
+USERINCLUDE     ../../../../camappengine/Engine/Inc
+USERINCLUDE     ../../../../camappengine/StillConverter/Inc
+USERINCLUDE	    ../../../../inc      // MW level inc dir
+
+
+
+#if defined(__S60_)
+    MW_LAYER_SYSTEMINCLUDE
+#else
+    SYSTEMINCLUDE   /epoc32/include 
+#endif
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         fbscli.lib
+LIBRARY         ECAM.lib
+LIBRARY         caeengine.lib
+LIBRARY         stiftestinterface.lib
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,34 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Camera Application Engine interface/integration tests
+;
+; Languages
+; =========
+&EN
+
+; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
+; ==================================================================================================
+#{"STIFCAETEST"},(0x101FB3E7),1,0,1,TYPE=SA
+
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\stifcaetest.dll"      -"$:\sys\bin\stifcaetest.dll"
+
+; eof
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 - 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface/integration tests
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+StifCaeTest.mmp 
+
+PRJ_MMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestClient.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,845 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestClient.h
+*
+*/
+#ifndef CAE_TEST_CLIENT_H
+#define CAE_TEST_CLIENT_H
+
+#include <e32base.h>
+#include <f32file.h>
+#include <gdi.h>
+
+
+#include "CaeEngine.h"
+
+#include "CaeTestVariation.h"
+
+#include "ECamColorToneCustomInterface.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+const TInt KNormalTimingDelay = 1000;
+const TInt KLongTimingDelay = 5*1000;
+
+const TInt KImgWidthSubQCIF  = 128; 
+const TInt KImgHeightSubQCIF = 96; 
+
+const TInt KImgWidthQCIF     = 176; 
+const TInt KImgHeightQCIF    = 144; 
+
+const TInt KImgWidthCIF      = 352; 
+const TInt KImgHeightCIF     = 288; 
+
+const TInt KImgWidthQQVGA    = 160; 
+const TInt KImgHeightQQVGA   = 120; 
+
+const TInt KImgWidthQVGA     = 320; 
+const TInt KImgHeightQVGA    = 240; 
+
+const TInt KImgWidthVGA      = 640; 
+const TInt KImgHeightVGA     = 480; 
+
+const TInt KImgWidthSVGA      = 800; 
+const TInt KImgHeightSVGA     = 600; 
+
+const TInt KImgWidthTooBig   = 4096; 
+const TInt KImgHeightTooBig  = 4096; 
+
+const TInt KImgWidthMP1      = 1152; 
+const TInt KImgHeightMP1     = 864; 
+
+const TInt KImgWidthMP1M3      = 1280; 
+const TInt KImgHeightMP1M3     = 960; 
+
+const TInt KImgWidthMP2        = 1600; 
+const TInt KImgHeightMP2       = 1200; 
+
+const TInt KImgWidthMP3        = 2048; 
+const TInt KImgHeightMP3       = 1536; 
+
+const TInt KMaxVideoCodecSet     = 10; 
+
+enum TestClientLeavingCodes
+    {
+    KErrGetNotEqualToValuePreviouslySet = 98
+    };
+
+#if ( defined (__WINS__) || defined (__WINSCW) )
+#define KFileNameBase _L("c:\\")
+_LIT(KProcessFileName, "c:\\CaeTestClient.dat");
+_LIT(KiSnapFileName, "C:\\cae_test_out_snapimage.mbm");
+_LIT(KiStillFileName, "C:\\cae_test_out_stillimage.jpg");
+_LIT(KiVideoFileName, "C:\\cae_test_out_videoclip.3gp");
+_LIT(KiVideoFileName2, "C:\\cae_test_out_videoclip2.3gp");
+_LIT(KiVideoFileName3, "C:\\cae_test_out_videoclip3.3gp");
+_LIT(KiVideoFileName4, "C:\\cae_test_out_videoclip4.3gp");
+#else
+#define KFileNameBase _L("e:\\temp\\")
+_LIT(KProcessFileName, "e:\\temp\\CaeTestClient.dat");
+_LIT(KiSnapFileName, "e:\\temp\\cae_test_out_snapimage.mbm");
+_LIT(KiStillFileName, "e:\\temp\\cae_test_out_stillimage.jpg");
+_LIT(KiVideoFileName, "e:\\temp\\cae_test_out_videoclip.3gp");
+_LIT(KiVideoFileName2, "e:\\temp\\cae_test_out_videoclip2.3gp");
+_LIT(KiVideoFileName3, "e:\\temp\\cae_test_out_videoclip3.3gp");
+_LIT(KiVideoFileName4, "e:\\temp\\cae_test_out_videoclip4.3gp");
+#endif
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+#if MIRAGE_X_PROD1
+const TInt KDefaultStillImageWidth = KImgWidthMP1;
+const TInt KDefaultStillImageHeight = KImgHeightMP1;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatExif;
+#elif (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
+const TInt KDefaultStillImageWidth = KImgWidthMP1M3;
+const TInt KDefaultStillImageHeight = KImgHeightMP1M3;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatExif;
+#elif MIRAGE_X_PROD7
+const TInt KDefaultStillImageWidth = KImgWidthMP2;
+const TInt KDefaultStillImageHeight = KImgHeightMP2;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatExif;
+#else
+const TInt KDefaultStillImageWidth = KImgWidthVGA;
+const TInt KDefaultStillImageHeight = KImgHeightVGA;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatFbsBitmapColor16M;
+#endif
+
+const TInt KSymbianJpegDecoderValue = 0x101F45D7;
+const TInt KSymbianJpegEncoderValue = 0x101F45D9;
+
+const TInt KOptimizedJpegDecoderValue = 0x101FF555;
+const TInt KOptimizedJpegEncoderValue = 0x101FF554;
+
+
+class CCaeTestClient : public CTimer /* also CActive */, 
+                       public MCamAppEngineObserver, 
+                       public MCameraObserver,
+                       public MCameraObserver2,
+                       public MCaeStillBurstObserver
+    {
+    public:
+        
+        enum TestClientActions
+            {
+	        ENone,
+            EDefault, 
+
+            EEncodingError,
+            EDecodingError,
+            EPowerError,
+            EReserveError,
+            EStillCaptureError,
+            EVideoRecorderOpenError,
+            EVideoRecorderPrepareError,
+            EVideoRecordingCompleteError,
+            EPrepareVideoSettingsError,
+            ESnapImageError, 
+            EStillImageError,
+            EStillConvertError1, 
+            EStillConvertError2, 
+            EStillConvertError3, 
+
+            EInit, 
+            EInitVideoRecorder, 
+            EInitVideoRecorderWithUid, 
+            EGetInfo,
+            ESwitchPowerOnWhenInitialized, 
+            ESwitchPowerOnWhenStillPrepared, 
+            ESwitchPowerOffWhenStillPrepared, 
+            ESwitchPowerOffWhenVfRunning, 
+            ESwitchPowerOnWhenVideoPrepared, 
+            ESwitchPowerOnWhenRecordingVideo, 
+            ESwitchPowerOffWhenVideoPrepared, 
+            ESwitchPowerOffWhenRecordingVideo, 
+            EGetStillQualityIndexWhenEngineInitialized, 
+            EGetStillQualityIndexWhenPrepared, 
+            EGetVideoQualityIndexWhenEngineInitialized, 
+            EGetVideoQualityIndexWhenPrepared, 
+            EStartVideoRecordingWhenInitialized, 
+            EStartVideoRecordingWhenRecording, 
+            EStopVideoRecordingWhenInitialized, 
+            EStopVideoRecordingWhenPrepared, 
+            EIsVideoRecordingWhenPrepared, 
+            EIsVideoRecordingWhenRecording, 
+            ECaptureStillWhenEngineInitialized, 
+
+            EStartVfWhenInitNotReady,
+            EStartStillOpModeWhenInitNotReady,
+            EStartVideoOpModeWhenInitNotReady,
+            
+            ECancelCaptureStillWhenInitialized, 
+
+            ESwitchPowerOffAndOn,
+            EPowerOffPowerOff,
+            ERelease,
+            EReleaseRelease,
+            EReserveReserve,
+            EReleaseReserve,
+            EReleaseReserveCapture,
+            EReleaseReserveRecord,
+            
+            EDestroyEngineWhenStillPrepareReady,
+            EDestroyEngineWhenSnapImageReady,
+            EDestroyEngineWhenStillCaptureReady,
+            EDestroyEngineWhenSnapImageReadyInStillBurst,
+            EDestroyEngineWhenStillImageReadyInStillBurst,
+            EDestroyEngineWhenStillBurstReady, 
+            EDestroyEngineWhenVideoPrepareReady,
+            EDestroyEngineWhenVideoRecordingOn,
+            EDestroyEngineWhenVideoRecordingPaused,
+            EDestroyEngineWhenVideoRecordingReady,
+            
+            EEnumerateCaptureSizes, 
+            
+            ESpecifiedPrepareStill, 
+            ESpecifiedPrepareStillWhenPrepared, 
+            ESpecifiedPrepareAndCaptureStill, 
+            ESpecifiedPrepareAndCaptureStill2nd, 
+            EPrepareStillCapturing,
+            EPrepareStillCapturingWhenPrepared, 
+            EPrepareAndCaptureStill,
+            EPrepareAndCaptureAndCancelStill, 
+            EPrepareAndCaptureAndCancelStillAtSnap,  
+
+            EStartAndStopVfWhenStillPreparedAndCaptured, 
+            EPrepareStillCaptureWhenPowerOff, 
+            EPrepareStillCaptureWhenRecording,
+
+            EPrepareCroppedStillCapturing, 
+
+            EPrepareAndCaptureStillBurst,
+            ESpecPrepAndCaptureStillBurst, 
+            EPrepareAndSetStillBurstCaptureInterval,
+            EPrepareAndCaptureAndCancelStillBurst, 
+            EPrepareAndCaptureAndCancelStillBurstAtMoment, 
+            EPrepareAndCaptureAndCancelStillBurstAtSnap, 
+            EPrepareAndCaptureAndStopStillBurst,
+            EPrepareAndCaptureCaptureStillBurst,
+            ESpecPrepAndCaptureCaptureStillBurst,  
+            EPrepareAndCaptureStillBurstCaptureStill,
+            ESpecPrepAndCaptureStillBurstCaptureStill, 
+
+            EPrepareAndCaptureStillBurstExif,
+            EPrepareAndCaptureAndCancelStillBurstExif,
+			EStartVfPrepareCaptureStillStartAndStopVfExif,
+			EStartVfPrepareCaptureStillStartAndStopVfSnapExif,
+			ECaptureStillSetSnapSizeExif,
+			ECaptureStillSetSnapColorModeExif,
+            ECaptureStillAfterPowerOff,
+            ECaptureStillAfterPowerOffOn,
+            
+            ESetVideoFileNameWhenInitialized, 
+            ESetVideoFileNameWhenNotInitialized, 
+            ESetEmptyVideoFileNameWhenInitialized, 
+            ESetVideoFileNameWhenPrepared,
+            ESetVideoFileNameWhenRecording,
+
+            ESpecifiedPrepareVideo, 
+            ESpecifiedPrepareVideoWhenPrepared, 
+            ESpecifiedPrepareAndRecordVideo, 
+            ESpecifiedPrepareAndRecordVideoNoInit, 
+            EPrepareVideoRecording,
+            EPrepareVideoRecordingWhenPrepared,
+            EPrepareAndRecordVideo,
+            EPrepareRecordPauseStopVideo, 
+            EPrepareRecordPauseResumeStopVideo,
+            EPrepareRecordPausePauseStopVideo, 
+            EPauseVideoWhenPrepared, 
+            EResumeVideoWhenPrepared,
+            EResumeVideoWhenNotPaused, 
+            EStartAndStopVfWhenVideoPreparedAndRecorded,
+            ESpecifiedPrepareAudioBrAndRecordVideo,
+            ESpecifiedPrepareAudioBrAndRecordVideoAT0,
+            ESpecifiedPrepareAudioBrAndRecordVideoATInv,
+   
+            EStartStillOpModeStopVf, 
+            EStartStillOpModeCaptureStartAndStopVf, 
+
+            EStartVideoOpModeStopVf, 
+            EStartVideoOpModeRecordStartAndStopVf, 
+
+            EStartAndStopVf,
+            EStartAndStopCroppedVf,
+            EStartAndStopDirectVf, 
+            EStartAndStopCroppedDirectVf,
+            ESetViewFinderMirror,
+            EStartVfPrepareCaptureStillStartAndStopVf,
+            EStartVfPrepareRecordVideoStartAndStopVf, 
+            EStartVfStartVf,
+            EStartVfWhenPowerOff,
+
+            ESetExposureModeWhenInitialized,
+			ESetEvCompensationWhenInitialized,
+            ESetWhiteBalanceModeWhenInitialized,
+            ESetFlashModeWhenInitialized,
+            ESetDigiZoomWhenInitialized, 
+            ESetBrightnessWhenInitialized, 
+            ESetContrastWhenInitialized,
+            ESetClipMaxSizeWhenVideoNotPrepared,
+
+            ESetExposureModeWhenStillPrepared,
+			ESetEvCompensationWhenStillPrepared,
+            ESetWhiteBalanceModeWhenStillPrepared,
+            ESetFlashModeWhenStillPrepared,
+            ESetDigiZoomWhenStillPrepared, 
+            ESetBrightnessWhenStillPrepared, 
+            ESetContrastWhenStillPrepared,
+            ESetJpegQualityWhenStillPrepared, 
+            ESetJpegCodecWhenStillPrepared, 
+
+            ESetExposureModeWhenVideoPrepared,
+            ESetEvCompensationWhenVideoPrepared,
+            ESetWhiteBalanceModeWhenVideoPrepared,
+            ESetFlashModeWhenVideoPrepared,            
+            ESetDigiZoomWhenVideoPrepared, 
+            ESetBrightnessWhenVideoPrepared, 
+            ESetContrastWhenVideoPrepared, 
+            ESetClipMaxSizeWhenVideoPrepared, 
+            ESetAudioWhenVideoPrepared,
+            EGetAudioWhenVideoNotInitialized,
+            ESetVideoTimesIntervalWhenVideoPrepared,
+
+            ESetExposureModeWhenVideoRecording,
+			ESetEvCompensationWhenVideoRecording,
+            ESetWhiteBalanceModeWhenVideoRecording,
+            ESetFlashModeWhenVideoRecording,            
+            ESetDigiZoomWhenVideoRecording, 
+            ESetBrightnessWhenVideoRecording, 
+            ESetContrastWhenVideoRecording,
+            ESetClipMaxSizeWhenVideoRecording,
+            ESetClipMaxSizeWhenVideoNotInitialized,
+            ESetAudioWhenVideoRecording,
+            ESetAudioWhenVideoNotInitialized,
+            ESetVideoTimesIntervalWhenVideoRecording,
+
+            EResetToDefaults,
+
+            EGetStillFrameSizeWhenInitialized,
+            EEstimatedStillSizeInBytesWhenInitialized,
+            EGetStillFrameSizeWhenPrepared,
+            EEstimatedStillSizeInBytesWhenPrepared,
+
+			ESetSnapImageSizeBeforePrepare,
+			ESetSnapImageSizeDuringAndAfterPrepare,
+
+            EGetVideoFrameSizeWhenInitialized,
+            EVideoFrameRateWhenInitialized,
+            EEstimatedVideoRecordingBitRateWhenInitialized,
+            EGetVideoFrameSizeWhenPrepared,
+            EVideoFrameRateWhenPrepared,
+            EEstimatedVideoRecordingBitRateWhenPrepared,
+
+            ECaptureCapture,
+            ESpecPrepCaptureCapture, 
+            ECaptureRecord,
+            ERecordCapture,
+            ERecordRecord,
+
+            ERecordCaptureComplexSequence1,
+            ERecordCaptureComplexSequence2, 
+
+            ERemainingTimeWhenVideoPrepared,
+            ERemainingTimeWhenVideoNotInitialized,
+
+            EGetCustomInterface,
+            ESetColorTone,
+            ESetColorToneWrongParams,
+            ESetColorToneVideoRecording,
+            ESetColorToneRelease,
+
+            EInitUid,
+
+            ESetDisplayIndex,
+            ESetCameraIndexLow,
+            ESetCameraIndexHigh,
+            
+            EEnumerateVideoFrameSize,
+			ECCameraHandle,
+			
+			EProcessExtViewFinderFrameReady,
+			EProcessExtSnapImage,
+			EProcessExtCapturedImage,
+			EProcessExtCapturedImageTDesC8,
+			EProcessExtCapturedImageCFbsBitmap,
+			EProcessExtCapturedImageBurst,
+			EProcessExtCapturedImageBurstTDesC8,
+			EProcessExtCancel,
+			EProcessExtCancel2,
+			EInstalledExtensionList,
+			ESkippedExtensionList,
+			ESetSkippedExtensionList,
+			EProcessExtCapturedImageNoInit
+            };
+
+        enum TestClientOpMode
+            {
+	        EClientOpModeStill,
+            EClientOpModeVideo
+            };
+
+    public:
+        
+        static CCaeTestClient* NewL();
+        
+        virtual ~CCaeTestClient();
+
+        void SetSnapImageCreation( TBool aCreateSnapImage );
+
+        void SetRunningWithViewFinder( TBool aRunWithViewFinder );
+
+        void SetViewFinderSize( const TSize& aSize );
+        
+        void SetStillQualityLevelIndex( TInt aQualityLevelIndex );
+        
+        void SetVideoQualityLevelIndex( TInt aQualityLevelIndex );
+        
+        void SetStillFormat( CCamera::TFormat aFormat );
+        
+        void SetStillCompressionQuality( TInt aCompressionQuality );
+
+        void SetStillFrameSize( const TSize& aSize );
+
+		void SetSnapImageSize( const TSize& aSize );
+
+        void SetSnapImageSource( CCaeEngine::TSnapImageSource aSnapImageSource );
+
+		void SetSnapImageColorMode( TDisplayMode aMode );
+
+		void SetImageCodecs( TUid aDecoderUid, TUid aEncoderUid );
+
+		void SetCropRect( const TRect& aRect );
+
+        void SetStillBurstLength( TInt aLength );
+        
+        void SetVideoFrameSize( const TSize& aSize );
+        
+        void SetVideoFrameRate( TReal32 aFrameRate );
+        
+        void SetVideoBitRate( TInt aBitRate );
+
+        void SetVideoAudio( TBool aAudioEnabled );
+        
+        void SetAudioBitRate( TInt aAudioBitRate );
+
+        void SetFileNameBase( const TFileName& aFileNameBase );
+
+        void SetVfFileName( const TFileName& aFileName ); 
+
+        void SetVideoStopMode( TBool aAsyncVideoStopEnabled );
+
+        void SetVfFileCountToSave( TInt aCountOfVfFilesToSave );
+
+        void SetSnapFileName( const TFileName& aFileName );
+
+        void SetStillFileName( const TFileName& aFileName );
+        
+        void SetVideoFileName( const TFileName& aFileName );
+
+        void SetTimeout( TTimeIntervalMicroSeconds32 aTimeout );
+
+        void SetStillBurstCaptureInterval( TTimeIntervalMicroSeconds aInterval );
+        
+        void SetExposureMode( TInt aExposureMode );
+
+        void SetEvCompensation( TInt aEvCompensation );
+
+        void SetWhiteBalanceMode( TInt aWhiteBalanceMode );
+
+        void SetFlashMode( TInt aFlashMode );
+
+        void SetBrightness( TInt aBrightness );
+
+        void SetContrast( TInt aContrast );
+
+        void SetZoomMode( TInt aZoomMode );
+
+        void SetDigiZoomValue( TInt aDigiZoomValue );
+
+        void SetVideoClipMaxSize( TInt aMaxClipSizeInBytes );
+
+        void SetVideoTimesInterval( TTimeIntervalMicroSeconds aInterval );
+
+        void SetOpMode( TestClientOpMode aOpMode );
+        
+        void SetDisplayIndex( TInt aDisplayIndex );
+
+        void SetStopOnErrorInMcaeoSnapImageReady( TBool aStopOnError );
+        
+        void SetStopOnErrorInMcaeoStillImageReady( TBool aStopOnError );
+        
+        void GetInfo( TCamAppEngineInfo& aInfo ) const;
+        
+        void GetStillFrameSize( TSize& aSize ) const;
+
+        TInt EstimatedStillSizeInBytes() const;
+
+        void GetVideoFrameSize( TSize& aSize ) const;
+
+        TReal32 VideoFrameRate() const;
+        
+        TInt EstimatedVideoRecordingBitRate() const;
+
+
+        TReal32 ViewFinderFrameFrequency();
+    
+        TInt CountInitComplete();
+
+        TInt CountStillPrepareComplete();
+
+        TInt CountStillBurstOn();
+
+        TInt CountStillBurstCaptureMoment();
+
+        TInt CountStillBurstComplete();
+
+        TInt CountImageDeliveredStillBurstComplete();
+
+        TInt CountVideoPrepareComplete();
+
+        TInt CountViewFinderFrameReady();
+
+        TInt CountSnapImageReady();
+
+        TInt CountStillImageReady();
+
+        TInt CountVideoRecordingOn();
+
+        TInt CountVideoRecordingComplete();
+
+        TInt CountVideoRecordingStopped();
+
+        TInt CountVideoRecordingPaused();
+
+        TInt CountVideoRecordingTimes();
+
+        void SetCustomInterfaceUid( TUid aCustomInterface );
+
+        TAny* CustomInterfacePointer();
+
+        void SetColorToneValue( MCameraColorToneSettings::TColorTone );
+
+        void SetVideoCodecSet( TInt aValue );
+
+    public:
+
+        virtual void RunTestActionL( TestClientActions aAction ) = 0;
+
+
+    public:
+        // from observer
+
+        void McaeoInitComplete( TInt aError );
+
+        void McaeoStillPrepareComplete( TInt aError );
+
+        void McaesboStillBurstCaptureMoment( TInt aError );
+
+        void McaesboStillBurstComplete( TInt aImageCountDelivered, 
+                                        TInt aError );
+
+        void McaeoVideoPrepareComplete( TInt aError );
+
+        void McaeoViewFinderFrameReady( CFbsBitmap& aFrame, TInt aError );
+
+        void McaeoSnapImageReady( const CFbsBitmap& aBitmap, TInt aError );
+
+        void McaeoStillImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError );
+
+        void McaeoVideoRecordingOn( TInt aError );
+
+        void McaeoVideoRecordingComplete( TInt aError );
+
+        void McaeoVideoRecordingStopped();
+
+        void McaeoVideoRecordingPaused( TInt aError );
+
+	    void McaeoVideoRecordingTimes( TTimeIntervalMicroSeconds aTimeElapsed, 
+                                       TTimeIntervalMicroSeconds aTimeRemaining, 
+                                       TInt aError );
+
+
+    protected:
+
+	    CCaeTestClient();
+
+        void ConstructL();
+
+    protected:
+        
+        void InitStateVariables();
+
+        void StopOnError( TInt aError );
+
+
+    private:
+        
+        // from CActive
+        void RunL();
+        
+        // from CActive
+        void DoCancel();
+
+    private:
+        
+        virtual void RunTrappedL() = 0;
+        
+    private: // From MCameraObserver / ECam.h
+
+        void ReserveComplete( 
+            TInt aError );
+
+        void PowerOnComplete( 
+            TInt aError );
+
+        void ViewFinderFrameReady( 
+            CFbsBitmap& aFrame );
+
+        void ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aData, 
+            TInt        aError );
+
+        void FrameBufferReady( 
+            MFrameBuffer* /*aFrameBuffer*/, 
+            TInt          /*aError*/ ) {}; // Empty default because not in use.
+
+
+        /**
+        * From MCameraObserver2 Informs that client should handle a event
+        */
+        void HandleEvent(const TECAMEvent& aEvent);
+
+        /**
+        * From MCameraObserver2 Informs that viewfinder frame is ready
+        */
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+        /**
+        * From MCameraObserver2 Informs that a new captured image is ready
+        */
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    
+        /**
+        * From MCameraObserver2 Informs that a new captured video is ready
+        */
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+
+    protected:
+
+        // Camera Application Engine.
+        CCaeEngine* iCamAppEngine;
+        CCamera*    iCameraDup;
+
+        // Output data file.
+        RFile iFile; 
+        RFs   iFsSession;
+
+        // Camera Application Engine info object.
+        TCamAppEngineInfo iInfo;
+
+        // File name base (e.g. "e:\\")
+        TFileName               iFileNameBase;
+
+        // View finder image file name.
+        TFileName               iVfFileName;
+        
+        // Still image filename.
+        TFileName               iSnapFileName;
+        TFileName               iStillFileName;
+        TFileName               iVideoFileName;
+        TFileName               iVideoFileName2;
+        TFileName               iVideoFileName3;
+        TFileName               iVideoFileName4;
+
+        // For counting View Finder frames.
+        TInt                    iVfFrameCount;
+        TInt                    iVfFrameCountToSave;
+
+        // For counting Snap images.
+        TInt                    iSnapImageCount;
+
+        TInt                    iImageCountToCapture;
+        
+        TRect                   iCropRect;
+
+        TSize                   iSizeEmpty;
+
+        TInt  iError;
+
+        TBool iStop;
+
+        TBool iCreateSnapImage;
+
+        TBool iRunWithViewFinder;
+        TBool iStopViewFinder;
+
+        TBool iRunlForSnapImage;
+        TBool iRunlForStillImage;
+        
+        TBool iStopWhenCompleted;
+        TBool iContinueWhenCompleted;
+
+        TBool iInitReady;
+        TBool iPowerOn;
+        
+        TBool iViewFinderStarted;
+        TBool iViewFindingUsed;
+        
+        TBool iStillPrepareReady;
+        TBool iSnapImageReady;
+        TBool iStillCaptureReady;
+        TBool iStillCapturingOn;
+        TBool iStillCaptured;
+
+        TBool iStillBurstCaptureMoment;
+        TBool iStillBurstReady;
+        TBool iStopStillBurst;
+        TBool iCancelStillBurst;
+        TBool iCancelStillBurstAfterVfFrame;
+
+        TBool iVideoPrepareReady;
+        TBool iVideoRecordingReady;
+        TBool iVideoRecordingPaused;
+        TBool iVideoRecordingResumed;
+        TBool iVideoRecordingOn;
+        TBool iVideoRecorded;
+
+        TBool iStoppedOnError;
+
+        TInt  iCancelCount;
+
+        TInt  iCountInitComplete;
+        TInt  iCountStillPrepareComplete;
+        TInt  iCountStillBurstCaptureMoment;
+        TInt  iCountStillBurstComplete;
+        TInt  iCountVideoPrepareComplete;
+        TInt  iCountViewFinderFrameReady;
+        TInt  iCountSnapImageReady;
+        TInt  iCountStillImageReady;
+        TInt  iCountVideoRecordingOn;
+        TInt  iCountVideoRecordingComplete;
+        TInt  iCountVideoRecordingStopped;
+        TInt  iCountVideoRecordingPaused;
+        TInt  iCountVideoRecordingTimes;
+
+        TInt  iImageCountPreparedForStillBurst;
+        TInt  iImageCountDeliveredForStillBurst;
+
+        TTimeIntervalMicroSeconds32     iTimeout;
+        TTimeIntervalMicroSeconds     iStillBurstCaptureInterval;
+
+        TTime iNextRunLTime;
+
+        TestClientOpMode iOpMode;
+
+	    TestClientActions    iAction;
+	    TestClientActions    iSavedAction;
+
+        TBool   iSaveSnapImage; 
+        TBool   iSaveStillImage; 
+        TBool   iSaveVideoClip; 
+        TBool   iAcceptVideoCompletionError;
+        TBool   iStopOnErrorInMcaeoSnapImageReady;
+        TBool   iStopOnErrorInMcaeoStillImageReady;
+
+        // TBool   iDestroyTheEngineInSnapImageReady;
+        // TBool   iDestroyTheEngineInStillImageReady;
+        
+        TInt    iActionCycle;
+
+        TInt    iStillQualityLevelIndex;
+        TInt    iVideoQualityLevelIndex;
+
+        TSize   iViewFinderSize;
+
+        TSize   iStillFrameSize;
+
+        TSize   iSnapImageSize;
+        
+        CCaeEngine::TSnapImageSource iSnapImageSource;
+
+        CCamera::TFormat    iStillDataFormat;
+        TDisplayMode		iSnapImageColorMode;
+
+        TInt    iStillCompressionQuality;
+        
+        TUid 	iImageDecoderUid;
+        TUid 	iImageEncoderUid;
+
+        TInt    iStillBurstLength;
+
+        TSize   iVideoFrameSize;
+        TReal32 iVideoFrameRate;
+        TInt    iVideoBitRate;
+        TBool   iVideoAudioEnabled;
+        TInt    iAudioBitRate;
+        TInt    iVideoMaxClipSizeInBytes;
+
+        TTimeIntervalMicroSeconds iVideoTimesInterval;
+
+        TInt    iExposureMode;
+        TInt    iEvCompensation;
+        TInt    iWhiteBalanceMode;
+        TInt    iFlashMode;
+        TInt    iZoomMode;
+        TInt    iDigiZoomValue;
+        TInt    iBrightness;
+        TInt    iContrast;
+
+        TInt    iDisplayIndex;
+
+        TSize   iStillFrameSizeSet;
+        TInt    iEstimatedStillSizeInBytesSet;
+        TSize   iVideoFrameSizeSet;
+        TReal32 iVideoFrameRateSet;
+        TInt    iEstimatedVideoBitRateSet;
+
+        TUid    iCustomInterfaceUid;
+        TAny*   iCustomInterfacePointer;
+        MCameraColorToneSettings::TColorTone iColorToneValue;
+        TUint32 iTestedColorTones;
+        TBool   iReleaseDone;
+        TBool   iReserveDone;
+
+        TInt    iVideoCodecSet;
+        const TDesC8* iMimeTypeSet[KMaxVideoCodecSet];
+        const TDesC*  iPreferredSupplierSet[KMaxVideoCodecSet];
+        const TDesC8* iVideoTypeSet[KMaxVideoCodecSet];
+        const TDesC8* iAudioTypeSet[KMaxVideoCodecSet];
+
+        TInt iCameraHandle;
+        
+        CFbsBitmap* iBitmapSave;
+        HBufC8* iDataSave;
+        TBool iBitmapSendDone;
+        TBool iExtensionMode;
+        
+        TBool iVideoStopModeCommand;
+        TBool iAsyncVideoStopEnabled;
+
+
+    };
+
+#endif // CAE_TEST_CLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestRelease.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestRelease.h
+*
+*/
+#ifndef CAE_TEST_RELEASE_H
+#define CAE_TEST_RELEASE_H
+
+
+#include <e32base.h>
+#include "CaeTestVariation.h"
+
+#include "CaeTestStatesClient.h"
+#include "CaeTestSettingsClient.h"
+
+class CCaeTestRelease : public CTestCase
+{
+public:
+
+	CCaeTestRelease ();
+    ~CCaeTestRelease ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestInitL();
+    void TestInitVideoRecorderL();
+    void TestPowerOffAndOnL();
+    void TestReleaseAndReserveL();
+    void TestCCameraHandleL();
+
+    void TestPowerOnWhenInitializedL();
+    void TestPowerOnWhenStillCapturePreparedL();
+    void TestPowerOffWhenStillCapturePreparedL();
+    void TestPowerOffWhenViewfinderRunningL();
+    void TestPowerOnWhenVideoRecordingPreparedL();
+    void TestPowerOnWhenRecordingL();
+    void TestPowerOffWhenVideoRecordingPreparedL();
+    void TestPowerOffWhenRecordingL();
+
+    void TestViewFinderStartAndStopQqvgaL();
+    void TestViewFinderStartAndStopSubqcifL();
+    void TestCroppedViewFinderStartAndStopL();
+    void TestViewFinderDirectStartAndStopL();
+    void TestCroppedViewFinderDirectStartAndStopL();
+
+    void TestCaptureQualityLevel0L();
+    void TestCaptureQualityLevel1L();
+    void TestCaptureQualityLevel2L();
+
+    void TestCaptureVga16ML();
+    void TestCaptureVga64KL();
+    void TestCaptureVga4KL();
+
+    void TestCaptureQqvga16ML();
+    void TestCaptureQqvga64KL();
+    void TestCaptureQqvga4KL();
+
+    void TestCaptureMp1_16ML();
+    void TestCaptureMp1_64KL();
+    void TestCaptureMp1_4KL();
+    
+    void TestCaptureJpegMp1L();
+
+    void TestCaptureMp1M3_16ML();
+    void TestCaptureMp1M3_64KL();
+    void TestCaptureMp1M3_4KL();
+    
+    void TestCaptureJpegMp1M3L();
+
+    void TestCaptureMp2_16ML();
+    void TestCaptureMp2_64KL();
+    void TestCaptureMp2_4KL();
+    void TestCaptureJpegMp2L();
+    void TestCaptureExifMp2L();
+    void TestCaptureExifSVGAL();
+
+	void TestCaptureCodecL();
+	void TestCaptureCodec2L();
+
+    void TestCaptureCaptureL();
+    void TestCaptureCaptureSpecPrepL();
+
+    void TestPrepareStillCapture0L();
+    void TestPrepareStillCapture1L();
+    void TestPrepareStillCapture2L();
+    void TestPrepareStillCapture0WhenPreparedL();
+    void TestSpecPrepareSCSupportedFormatWhenInitializedL();
+
+    void TestCaptureStillWhenEngineInitializedL();
+
+    void TestCaptureStillBurst3L();
+    void TestCaptureStillBurst0L();
+    void TestCaptureStillBurst100L();
+
+    void TestCancelCaptureStillBurst3L();
+    void TestStopCaptureStillBurstAfter2L();
+    
+    void TestSpecPrepCaptureStillBurst3L();
+    
+    void TestCaptureStillBurstInterval0L();
+    void TestCaptureStillBurstInterval1000000L();
+    void TestCaptureStillBurstIntervalM1L();
+
+	void TestCaptureStillBurstExif3L();
+	void TestCaptureStillBurstExif6L();
+	void TestCaptureStillBurstExif6NSL();
+	void TestCaptureStillBurstExif6_ThumbnailL();
+	void TestCaptureStillBurstExif100L();
+	void TestCaptureStillBurstExif6VfL();
+	void TestCaptureStillBurstExif6VfCancelL();
+
+    void TestCaptureVgaExifL();
+    void TestCaptureQqvgaExifL();
+	void TestCaptureVgaSnapOneHalfExifL();
+	void TestCaptureVgaSnapOneFourthExifL();
+	void TestCaptureVgaSnapOneEighthExifL();
+	void TestCaptureVgaSnapExifL();
+	void TestCaptureVgaSnapOneEighthJpegL();
+	void TestCaptureVgaSnapOneEighthExif2L();
+	void TestCaptureVgaSnapColor16MExifL();
+    void TestCaptureAfterPowerOffL();
+
+    void TestPrepareVideoRecording0L();
+    void TestPrepareVideoRecording1L();
+    void TestPrepareVideoRecording2L();
+    void TestPrepareVideoRecording0WhenPreparedL();
+    void TestSpecPrepareVRSupportedFormatWhenVRInitializedL();
+   
+    void TestRecordQualityLevel0L();
+    void TestRecordQualityLevel1L();
+    void TestRecordQualityLevel2L();
+
+    void TestStartAndStopVideoRecordingSubQcifL();
+    void TestStartAndStopVideoRecordingSubQcifNoInitL();
+    void TestStartAndStopVideoRecordingQcifL();
+
+    void TestSCDigiZoomVal0L();
+    void TestSCDigiZoomVal1VgaL();
+    void TestSCDigiZoomVal1QqvgaL();
+    void TestSCDigiZoomInitializedVal0L();
+    void TestSCDigiZoomInitializedVal1VgaL();
+    void TestSCDigiZoomInitializedVal1QqvgaL();
+    void TestVRDigiZoomVal0L();
+    void TestVRDigiZoomVal1L();
+    void TestVRDigiZoomRecordingVal0L();
+    void TestVRDigiZoomRecordingVal1L(); 
+    
+    void TestStartAndStopVRWhenTooBigSizeSubQcifL();
+
+    void TestGetInfoL();
+    void TestGetInfoPROD1MirageXL();
+    void TestGetInfoPROD2MirageXL();
+    void TestGetInfoPROD3MirageXPL();
+    void TestGetInfoPROD4MirageXL();
+    void TestGetInfoPROD6MirageXL();
+    void TestGetInfoPROD7Unagi2ML();
+    void TestGetInfoPROD8MirageXL();
+    void TestGetInfoPROD9HWL();
+    void TestGetInfoDevlonHWL();
+
+    void TestRecordPauseResumeStopL();
+
+    void TestSCExposureMode0L();
+    void TestSCExposureMode1L();
+    void TestSCExposureModeInitialized0L();
+    void TestSCExposureModeInitialized1L();
+
+    void TestVRExposureMode0L();
+    void TestVRExposureMode1L();
+    void TestVRExposureModeRecording0L();
+    void TestVRExposureModeRecording1L();
+
+	void TestSCEvCompensation0L();
+	void TestSCEvCompensationMaxL();
+	void TestSCEvCompensationMinL();
+	void TestSCEvCompensationInitialized0L();
+	void TestSCEvCompensationInitializedMaxL();
+	void TestSCEvCompensationInitializedMinL();
+	void TestSCEvCompensationInitializedInvalidL();
+
+	void TestVREvCompensationMinL();
+	void TestVREvCompensationRecordingMaxL();
+
+    void TestSCWhiteBalanceMode0L();
+    void TestSCWhiteBalanceModeInitialized0L();
+
+    void TestVRWhiteBalanceMode0L();
+    void TestVRWhiteBalanceModeRecording0L();
+
+    void TestSCContrast50L();
+    void TestSCContrastInitialized50L();
+
+    void TestSCBrightness50L();
+    void TestSCBrightnessInitialized50L();
+
+    void TestVRContrast50L();
+    void TestVRContrastRecording50L();
+
+    void TestVRBrightness50L();
+    void TestVRBrightnessRecording50L();
+
+    void TestVideoClipMaxSize10000L();
+    void TestVideoClipMaxSize10000_2L();
+    
+    void TestCancelCaptureStillL();
+
+    void TestGetStillQualityIndexWhenEngineInitializedL();
+    void TestGetStillQualityIndexWhenPreparedL();
+    void TestGetVideoQualityIndexWhenEngineInitializedL();
+    void TestGetVideoQualityIndexWhenPreparedL();
+
+    void TestRemainingTimeWhenVideoPreparedL();
+
+    void TestPrepareAudioBitRateVR5000L();
+    void TestPrepareAudioBitRateVR128L();
+    void TestPrepareAudioBitRateVR128InvVtypeL();
+
+    void TestCaptureVga16M_NoSnapL();
+    void TestCaptureQualityLevel0_NoSnapL();
+    void TestCaptureVgaExif_NoSnapL();
+    void TestCaptureStillBurst3_NoSnapL();
+    void TestSpecPrepCaptureStillBurst3_NoSnapL();
+    void TestCaptureStillBurstExif3_NoSnapL();
+    
+    void TestEnumerateCaptureSizesL();
+    void TestSetJpegQuality50L();
+    void TestSCCustomInterfaceL();    
+    
+    void TestFlashMode0L();
+    void TestFlashMode1L();
+    void TestFlashMode2L();
+    
+    void TestSCColorToneNormalL();
+    void TestSCColorToneSepiaL();
+    void TestSCColorToneGrayscaleL();
+    void TestSCColorToneNegativeL();
+    void TestVRColorToneL();
+    void TestSCColorToneWrongParams1L();
+    void TestSCColorToneWrongParams2L();
+    void TestSCColorToneReleaseL();
+
+    void TestSetDisplayIndexL();
+    void TestEnumerateVideoFrameSize001L();
+    void TestSecondaryCamera001L();
+    void TestProcessExtViewFinderFrameReadyL();
+    void TestProcessExtSnapImageL();
+    void TestProcessExtCapturedImageL();
+    void TestProcessExtCapturedImage2L();
+    void TestProcessExtCapturedImage3L();
+    void TestProcessExtCapturedImage4L();
+    void TestProcessExtCancelL();
+    void TestProcessExtCancel2L();
+    void TestProcessExtCapturedImageBurstL();
+    void TestProcessExtCapturedImageBurst2L();
+    void TestInstalledExtensionListL();
+    void TestSkippedExtensionListL();
+    void TestSetSkippedExtensionListL();
+    
+    void TestRecordAsyncStop001L();
+    void TestRecordAsyncStop002L();
+
+private:
+    CCaeTestStatesClient * iStatesClient;
+    CCaeTestSettingsClient * iSettingsClient;
+};
+
+#endif // CAE_TEST_RELEASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestSettingsClient.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestSettingsClient.h
+*
+*/
+#ifndef CAE_TEST_SETTINGS_CLIENT_H
+#define CAE_TEST_SETTINGS_CLIENT_H
+
+#include <e32base.h>
+#include "CaeTestClient.h"
+
+class CCaeTestSettingsClient : public CCaeTestClient
+    {
+    public:
+        static CCaeTestSettingsClient* NewL();
+        ~CCaeTestSettingsClient();
+
+    public:
+        void RunTestActionL( TestClientActions aAction );
+
+    protected:
+	    CCaeTestSettingsClient();
+        void ConstructL();
+
+    private:
+        void RunTrappedL();
+    };
+
+#endif // CAE_TEST_SETTINGS_CLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStatesClient.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStatesClient.h
+*
+*/
+#ifndef CAE_TEST_STATES_CLIENT_H
+#define CAE_TEST_STATES_CLIENT_H
+
+#include <e32base.h>
+#include "CaeTestClient.h"
+
+class CCaeTestStatesClient : public CCaeTestClient
+    {
+    
+    public:
+        static CCaeTestStatesClient* NewL();
+        ~CCaeTestStatesClient();
+
+    public:
+        void RunTestActionL( TestClientActions aAction );
+
+    protected:
+	    CCaeTestStatesClient();
+        void ConstructL();
+
+    private:
+        void RunTrappedL();
+    };
+
+#endif // CAE_TEST_STATES_CLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillSettings.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillSettings.h
+*
+*/
+#ifndef CAE_TEST_STILL_SETTINGS_H
+#define CAE_TEST_STILL_SETTINGS_H
+
+
+#include <e32base.h>
+
+#include "CaeTestSettingsClient.h"
+
+class CCaeTestStillSettings : public CTestCase
+{
+public:
+
+	CCaeTestStillSettings();
+    ~CCaeTestStillSettings();
+
+	// Allocate the resources for one test function
+    void setUpL();
+
+	// Free the resources reserved in setUpL()
+	void tearDown();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestDigiZoomVal2L();
+    void TestDigiZoomValNeg1L();
+    void TestOpticalZoomValMinL();
+    void TestOpticalZoomValMaxL();
+    void TestDigiZoomMode0L();
+    
+    void TestOpticalZoomMode1L();
+    void TestOpticalDigiZoomMode2L();
+    
+    void TestDigiZoomModeNeg1L();
+    
+    void TestBrightness0L();
+    void TestBrightness100L();
+    void TestBrightnessNeg100L();
+    void TestBrightness101L();
+    void TestBrightnessNeg101L();
+    
+    void TestContrast0L();
+    void TestContrast100L();
+    void TestContrastNeg100L();
+    void TestContrast101L();
+    void TestContrastNeg101L();
+    
+    void TestExposureMode2L();
+    void TestExposureMode4L();
+    void TestExposureModeNeg1L();
+    void TestExposureMode5L();
+    
+    void TestWhiteBalanceMode1L();
+    void TestWhiteBalanceMode2L();
+    void TestWhiteBalanceMode4L();
+    void TestWhiteBalanceMode8L();
+    void TestWhiteBalanceMode10L();
+    void TestWhiteBalanceModeNeg1L();
+    void TestWhiteBalanceMode5L();
+
+    void TestFlashMode4L();
+    void TestFlashMode8L();
+    void TestFlashModeNeg1L();
+    void TestFlashMode5L();
+    void TestFlashMode6L();
+    void TestFlashMode9L();
+    void TestFlashMode10L();
+    
+    void TestExposureModeInitialized2L();
+    void TestWhiteBalanceModeInitialized2L();
+    void TestFlashModeInitialized2L();
+    void TestDigiZoomInitializedMode0L();
+    
+    void TestGetInfo();
+    
+    void TestResetToDefaultsL();
+    void TestSetViewFinderMirrorL();
+
+    void TestGetStillFrameSizeWhenInitializedL();
+    void TestGetStillFrameSizeWhenPreparedL();
+    
+    void TestEstimatedStillSizeInBytesWhenInitializedL();
+    void TestEstimatedStillSizeInBytesWhenPreparedL();
+    void TestSetSnapImageSizeBeforePrepareL();
+    void TestSetSnapImageSizeDuringAndAfterPrepareL();
+
+    void TestInitUidL();
+    void TestSetJpegQuality0L();
+    void TestSetJpegQuality101L();
+
+    void TestCaptureStillBurstIntervalM2L();
+    
+    void TestSetJpegCodecInvalidL();
+
+private:
+    CCaeTestSettingsClient* iSettingsClient;
+};
+
+#endif // CAE_TEST_STILL_SETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillStates.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillStates.h
+*
+*/
+#ifndef CAE_TEST_STILL_STATES_H
+#define CAE_TEST_STILL_STATES_H
+
+
+#include <e32base.h>
+
+#include "CaeTestStatesClient.h"
+
+class CCaeTestStillStates : public CTestCase
+{
+public:
+
+	CCaeTestStillStates ();
+    ~CCaeTestStillStates ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestPrepareStillCaptureNeg1L();   
+    void TestPrepareStillCapture3L();
+    void TestSpecPrepareSCUnsupportedFormatWhenInitializedL();
+    void TestSpecPrepareSCSupportedFormatWhenPreparedL();
+
+    void TestPrepareCroppedStillCapturingL();
+    void TestPrepareStillCaptureWhenPowerOffL();
+    void TestCaptureAfterPowerOffOnL();
+
+    void TestPrepareStillCaptureWhenRecordingL();
+    void TestPrepareStillCaptrureWrongSizeL();
+
+    void TestReleaseL();
+    void TestReleaseReleaseL();
+    void TestReserveL();
+    void TestReleaseReserveCaptureL();
+
+    void TestPowerOffPowerOffL();
+    void TestStartVfStartVfL();
+    void TestStartVfWhenPowerOffL();
+    
+    void TestCancelCaptureStillWhenInitializedL();
+    void TestCancelCaptureStillAtSnapL();
+
+    void TestCaptureCaptureStillBurst3L();
+    void TestSpecPrepCaptureCaptureStillBurst3L();
+    void TestCaptureStillBurst3CaptureStillL();
+    void TestSpecPrepCaptureStillBurst3CaptureStillL();
+    void TestCancelCaptureStillBurst3AtSnapL();
+    void TestCancelCaptureStillBurst3AtMomentL();
+	void TestCaptureStillBurstMp2Exif100IgnoreErrorsL();
+	void TestCaptureStillBurstMp1Exif100IgnoreErrorsL();
+	void TestCaptureStillBurstVgaBitmap100IgnoreErrorsL();
+	void TestCaptureStillBurstVgaJpeg100IgnoreErrorsL();
+
+    void TestDestroy1L();
+    void TestDestroy2L();
+    void TestDestroy3L();
+    void TestDestroy4L();
+    void TestDestroy5L();
+    void TestDestroy6L();
+    void TestDestroy7L();
+    
+    void TestEncodingErrorL();
+    void TestPowerErrorL();
+    void TestReserveErrorL();
+    void TestStillCaptureErrorL();
+    void TestSnapImageErrorL();
+    void TestStillImageErrorL();
+    void TestStillConvertError1L();
+    void TestStillConvertError2L();
+    void TestStillConvertError3L();
+    void TestSetCameraIndexLowL();
+    void TestSetCameraIndexHighL();
+
+private:
+
+    CCaeTestStatesClient * iStatesClient;
+};
+
+#endif // CAE_TEST_STILL_STATES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestTop.h
+*
+*/
+#ifndef CAE_TEST_TOP_H
+#define CAE_TEST_TOP_H
+
+#include <e32base.h>
+#include "CaeTestVariation.h"
+
+EXPORT_C  MTest* CreateTopFct();
+
+class CCaeTestTop : public CTestSuite
+    {
+    public:
+	    CCaeTestTop();
+        ~CCaeTestTop();
+
+	    // A function to collect and return a suite of tests
+	    static MTest* suiteL();
+
+    protected:
+
+    private:
+
+    };
+
+#endif // CAE_TEST_TOP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVariation.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cae Test DLL
+*
+*/
+
+
+#ifndef __CAETESTVARIATION_H
+#define __CAETESTVARIATION_H
+
+//  INCLUDES
+
+#ifdef USING_CPPUNIT_FRAMEWORK
+     /* CppUnit headers */
+    #include <CppUnit/Test.h>
+    #include <CppUnit/TestCase.h>
+    #include <CppUnit/TestCaller.h>
+    #include <CppUnit/TestSuite.h>
+#else
+    /* STIF TFW headers */
+    #include "TestFrameWork/test.h"
+    #include "TestFrameWork/testCase.h"
+    #include "TestFrameWork/testCaller.h"
+    #include "TestFrameWork/testSuite.h"
+#endif
+
+
+// CONSTANTS
+
+// Enable/disable test case image and video writing to memory card
+#define WRITE_SNAPIMAGE_TO_FILE     0
+#define WRITE_STILLIMAGE_TO_FILE    0
+#define WRITE_VIDEOCLIP_TO_FILE     1
+#define WRITE_VF_TO_FILE            0
+#define WRITE_VIDEOTIMES_TO_FILE    0
+
+// Select symbian (1) or optimized (0) jpeg codecs
+
+#if ( defined (__WINS__) || defined (__WINSCW) )
+#define SYMBIAN_CODECS  1
+#else
+#define SYMBIAN_CODECS  0
+#endif
+
+// MACROS
+
+// Select only one of these (if any).
+#define MIRAGE_X_PROD1 0
+#define MIRAGE_X_PROD2 0
+#define MIRAGE_X_PROD3 0
+#define MIRAGE_X_PROD4 0
+#define MIRAGE_X_PROD5 0
+#define MIRAGE_X_PROD6 0
+#define MIRAGE_X_PROD7 0
+#define MIRAGE_X_PROD8 0
+#define MIRAGE_X_PROD9 0
+#define HW_DEVLON 1 
+#define HW_DEVLON52 0
+
+#define VIDEO_RECORDING_TEST_CASES  1
+#define SECONDARY_CAMERA_TEST_CASES 0
+
+
+
+#if (MIRAGE_X_PROD1) || (MIRAGE_X_PROD2) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD5) || (MIRAGE_X_PROD6) || (MIRAGE_X_PROD8) ||\
+     (MIRAGE_X_PROD9) || (HW_DEVLON) || (HW_DEVLON52)
+    #define MIRAGE_X 1
+#else
+    #define MIRAGE_X 0
+#endif
+
+#if (MIRAGE_X_PROD7)
+    #define UNAGI_2M 1
+#else
+    #define UNAGI_2M 0
+#endif
+
+#if ((!MIRAGE_X) && (!UNAGI_2M)) || (MIRAGE_X_PROD5)
+    // S60 2.1 interface
+    #define CAE_INTERFACE_21
+#endif
+
+#if (MIRAGE_X_PROD3) || (MIRAGE_X_PROD4) 
+    #define COLOR_TONE_TEST_CASES 1
+#endif
+
+// For OOM testing in CppUnit. Set to 1 if you want this on. Set to 0 if not. 
+#define CAE_OOM_TESTING_HARNESS 0
+
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoSettings.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoSettings.h
+*
+*/
+#ifndef CAE_TEST_VIDEO_SETTINGS_H
+#define CAE_TEST_VIDEO_SETTINGS_H
+
+
+#include <e32base.h>
+
+#include "CaeTestSettingsClient.h"
+
+class CCaeTestVideoSettings : public CTestCase
+{
+public:
+
+	CCaeTestVideoSettings ();
+    ~CCaeTestVideoSettings ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestDigiZoomVal2L();
+    void TestDigiZoomNegVal1L();
+    void TestDigiZoomMode0L();
+    void TestOpticalZoomMode1L();
+    void TestOpticalDigiZoomMode2L();
+    void TestDigiZoomNegMode1L();
+    void TestBrightness0L();
+    void TestBrightness100L();
+    void TestBrightnessNeg100L();
+    void TestBrightness101L();
+    void TestBrightnessNeg101L();
+    void TestContrast0L();
+    void TestContrast100L();
+    void TestContrastNeg100L();
+    void TestContrast101L();
+    void TestContrastNeg101L();
+    void TestExposureMode2L();
+    void TestExposureMode4L();
+    void TestExposureModeNeg1L();
+    void TestExposureMode5L();
+    void TestWhiteBalanceMode1L();
+    void TestWhiteBalanceMode2L();
+    void TestWhiteBalanceMode4L();
+    void TestWhiteBalanceMode8L();
+    void TestWhiteBalanceMode10L();
+    void TestWhiteBalanceModeNeg1L();
+    void TestWhiteBalanceMode5L();
+    void TestWhiteBalanceMode12L();
+    void TestFlashMode0L();
+    void TestFlashMode1L();
+    void TestFlashMode2L();
+    void TestFlashMode4L();
+    void TestFlashMode8L();
+    void TestFlashModeNeg1L();
+    void TestFlashMode5L();
+    void TestVideoClipMaxSize0L();
+    void TestVideoClipMaxSizeNeg1L();
+    void TestVideoClipMaxSize10001L(); 
+    void TestVideoClipMaxSizeWhenVideoNotPrepared0L();
+    void TestVideoClipMaxSizeWhenVideoNotPrepared5000L();
+    void TestVideoAudioETrueL();
+    void TestVideoAudioEFalseL();
+    void TestExposureModeRecording2L();
+    void TestWhiteBalanceModeRecording2L();
+    void TestFlashModeRecording2L();
+    void TestDigiZoomRecordingMode0L();
+    void TestVideoClipMaxSizeRecording10000L();
+    void TestVideoClipMaxSizeNotInitialized10000L();
+    void TestVideoAudioRecordingETrueL();
+    void TestVideoAudioNotInitializedL();
+    void TestGetVideoAudioNotInitializedL();
+
+    void TestSetVideoFileNameL();
+    void TestSetEmptyVideoFileNameL();
+    void TestSetVideoFileNameWhenPreparedL();
+    void TestSetVideoFileNameWhenNotInitializedL();
+    void TestSetVideoFileNameWhenRecordingL();
+
+    void TestSetVideoTimeIntervalSubQcifL();
+    void TestSetVideoTimeIntervalSubQcifWhenPreparedL();
+    void TestSetVideoTimeIntervalSubQcifWhenRecordingL();
+    void TestSetZeroVideoTimeIntervalSubQcifWhenPreparedL();
+    void TestSetVideoTimeIntervalNegativeL();
+    void TestSetVideoTimeIntervalHugeL();
+    
+    void TestGetVideoFrameSizeWhenInitializedL();
+    void TestGetVideoFrameSizeWhenPreparedL();
+    void TestVideoFrameRateWhenInitializedL();
+    void TestVideoFrameRateWhenPreparedL();
+    void TestEstimatedVideoRecordingBitRateWhenInitializedL();
+    void TestEstimatedVideoRecordingBitRateWhenPreparedL();
+
+
+private:
+    CCaeTestSettingsClient * iSettingsClient;
+};
+
+#endif // CAE_TEST_VIDEO_SETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoStates.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoStates.h
+*
+*/
+#ifndef CAE_TEST_VIDEO_STATES_H
+#define CAE_TEST_VIDEO_STATES_H
+
+
+#include <e32base.h>
+
+#include "CaeTestStatesClient.h"
+
+class CCaeTestVideoStates : public CTestCase
+{
+public:
+
+	CCaeTestVideoStates ();
+    ~CCaeTestVideoStates ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+
+    void TestPrepareAndRecordQualityLevel0L();
+    void TestPrepareAndRecordQualityLevel1L();
+    void TestPrepareAndRecordQualityLevel2L();
+
+    void TestVideoRecordingQcif60000Fr10NoAudioNoVfL();
+    void TestVideoRecordingQcif60000Fr10WithAudioNoVfL();
+    void TestVideoRecordingQcif60000Fr10NoAudioWithVfL();
+    void TestVideoRecordingQcif60000Fr10WithAudioWithVfL();
+
+    void TestRecordPauseStopL();
+    void TestPauseWhenPreparedL();
+    void TestRecordPausePauseStopL();
+
+    void TestResumeWhenPreparedL();
+    void TestResumeWhenNotPausedL();
+
+    void TestPrepareVideoRecordingNeg1L();   
+    void TestPrepareVideoRecording3L();
+    void TestSpecPrepareVRUnsupportedFormatWhenVRInitializedL();
+    void TestSpecPrepareVRSupportedFormatWhenPreparedL();
+
+    void TestStartVideoRecordingWhenVRInitializedL();
+    void TestStartVideoRecordingWhenRecordingL();
+
+    void TestStopVideoRecordingWhenVRInitializedL();
+    void TestStopVideoRecordingWhenPreparedL();
+
+    void TestCaptureRecordL();
+    void TestRecordCaptureL();
+    void TestRecordRecordL();
+
+    void TestRecordCaptureComplexSequence1L();
+    void TestRecordCaptureComplexSequence2L();
+
+    void TestReleaseReserveRecordL();
+
+    void TestDestroy1L();
+    void TestDestroy2L();
+    void TestDestroy3L();
+    void TestDestroy4L();
+
+    void TestVideoRecorderOpenErrorL();
+    void TestVideoRecorderPrepareErrorL();
+    void TestVideoRecordingCompleteErrorL();
+    void TestPrepareVideoSettingsErrorL();
+
+    void TestPrepareAudioBitRateVR0L();
+    void TestPrepareAudioBitRateVR5150L();
+    void TestPrepareAudioBitRateVR12200L();
+    void TestPrepareAudioBitRateVR20000L();
+    void TestPrepareAudioBitRateVR12200AudioType0L();
+    void TestPrepareAudioBitRateVR12200AudioTypeInvL();
+
+    void TestInitVideoRecorderWithUidL();
+    void TestRemainingTimeWhenVideoNotInitializedL();
+
+    	// Own test functions that use assertions and may leave (SET 1)
+
+    void TestPrepareAndRecordQualityLevel0QL();
+    void TestPrepareAndRecordQualityLevel1QL();
+    void TestPrepareAndRecordQualityLevel2QL();
+
+    void TestVideoRecordingQcif60000Fr10NoAudioNoVfQL();
+    void TestVideoRecordingQcif60000Fr10WithAudioNoVfQL();
+    void TestVideoRecordingQcif60000Fr10NoAudioWithVfQL();
+    void TestVideoRecordingQcif60000Fr10WithAudioWithVfQL();
+
+    void TestRecordPauseStopQL();
+    void TestPauseWhenPreparedQL();
+    void TestRecordPausePauseStopQL();
+
+    void TestResumeWhenPreparedQL();
+    void TestResumeWhenNotPausedQL();
+
+    void TestPrepareVideoRecordingNeg1QL();   
+    void TestPrepareVideoRecording3QL();
+    void TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQL();
+    void TestSpecPrepareVRSupportedFormatWhenPreparedQL();
+
+    void TestStartVideoRecordingWhenVRInitializedQL();
+    void TestStartVideoRecordingWhenRecordingQL();
+
+    void TestStopVideoRecordingWhenVRInitializedQL();
+    void TestStopVideoRecordingWhenPreparedQL();
+
+    void TestCaptureRecordQL();
+    void TestRecordCaptureQL();
+    void TestRecordRecordQL();
+
+    void TestRecordCaptureComplexSequence1QL();
+    void TestRecordCaptureComplexSequence2QL();
+
+    void TestReleaseReserveRecordQL();
+
+    void TestDestroy1QL();
+    void TestDestroy2QL();
+    void TestDestroy3QL();
+    void TestDestroy4QL();
+
+    void TestVideoRecorderOpenErrorQL();
+    void TestVideoRecorderPrepareErrorQL();
+    void TestVideoRecordingCompleteErrorQL();
+    void TestPrepareVideoSettingsErrorQL();
+
+    void TestPrepareAudioBitRateVR0QL();
+    void TestPrepareAudioBitRateVR5150QL();
+    void TestPrepareAudioBitRateVR12200QL();
+    void TestPrepareAudioBitRateVR20000QL();
+    void TestPrepareAudioBitRateVR12200AudioType0QL();
+    void TestPrepareAudioBitRateVR12200AudioTypeInvQL();
+
+    void TestInitVideoRecorderWithUidQL();
+
+
+    	// Own test functions that use assertions and may leave (SET 2)
+
+    void TestPrepareAndRecordQualityLevel0Q4L();
+    void TestPrepareAndRecordQualityLevel1Q4L();
+    void TestPrepareAndRecordQualityLevel2Q4L();
+
+    void TestVideoRecordingQcif60000Fr10NoAudioNoVfQ4L();
+    void TestVideoRecordingQcif60000Fr10WithAudioNoVfQ4L();
+    void TestVideoRecordingQcif60000Fr10NoAudioWithVfQ4L();
+    void TestVideoRecordingQcif60000Fr10WithAudioWithVfQ4L();
+
+    void TestRecordPauseStopQ4L();
+    void TestPauseWhenPreparedQ4L();
+    void TestRecordPausePauseStopQ4L();
+
+    void TestResumeWhenPreparedQ4L();
+    void TestResumeWhenNotPausedQ4L();
+
+    void TestPrepareVideoRecordingNeg1Q4L();   
+    void TestPrepareVideoRecording3Q4L();
+    void TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQ4L();
+    void TestSpecPrepareVRSupportedFormatWhenPreparedQ4L();
+
+    void TestStartVideoRecordingWhenVRInitializedQ4L();
+    void TestStartVideoRecordingWhenRecordingQ4L();
+
+    void TestStopVideoRecordingWhenVRInitializedQ4L();
+    void TestStopVideoRecordingWhenPreparedQ4L();
+
+    void TestCaptureRecordQ4L();
+    void TestRecordCaptureQ4L();
+    void TestRecordRecordQ4L();
+
+    void TestRecordCaptureComplexSequence1Q4L();
+    void TestRecordCaptureComplexSequence2Q4L();
+
+    void TestReleaseReserveRecordQ4L();
+
+    void TestDestroy1Q4L();
+    void TestDestroy2Q4L();
+    void TestDestroy3Q4L();
+    void TestDestroy4Q4L();
+
+    void TestVideoRecorderOpenErrorQ4L();
+    void TestVideoRecorderPrepareErrorQ4L();
+    void TestVideoRecordingCompleteErrorQ4L();
+    void TestPrepareVideoSettingsErrorQ4L();
+
+    void TestPrepareAudioBitRateVR0Q4L();
+    void TestPrepareAudioBitRateVR5150Q4L();
+    void TestPrepareAudioBitRateVR12200Q4L();
+    void TestPrepareAudioBitRateVR20000Q4L();
+    void TestPrepareAudioBitRateVR12200AudioType0Q4L();
+    void TestPrepareAudioBitRateVR12200AudioTypeInvQ4L();
+
+    void TestInitVideoRecorderWithUidQ4L();
+
+
+private:
+    CCaeTestStatesClient * iStatesClient;
+};
+
+#endif // CAE_TEST_VIDEO_STATES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/StifCaeTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  StifCaeTestTop.h
+*
+*
+*/
+
+
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFrameWork/testSuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS( CTestModule ) 
+        :public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+        void AllocFailureSimulation ( TBool aSwitchedOn );
+
+        void RunTestCaseInOOMLoopL( const TInt aCaseNumber, TTestResult& aResult );
+            
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+       RHeap::TAllocFail iAllocFailureType;
+       TInt iAllocFailureRate;    	    	  	
+       TInt iCurrentAllocFailureRate;    	    	  	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/AssertFailure.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AssertFailure.h
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/TestResult.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestResult
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/test.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MTest
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCaller.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestCaller
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFrameWork/testCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCase.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestCase
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testSuite.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestSuite
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestClient.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1691 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestClient.cpp
+*
+*/
+
+#include <fbs.h>
+
+#include "CaeTestClient.h"
+#include "CaeTestVariation.h"
+
+// Set 0
+_LIT8(KVideoMimeType, "video/3gpp");
+_LIT(KVideoPreferredSupplier, "Nokia");
+_LIT8(KVideoType, "video/H263-2000");
+_LIT8(KVideoAudioType, " AMR");
+// Set 1 for 2.7 
+_LIT8(KVideoMimeType1, "video/3gpp2");
+_LIT(KVideoPreferredSupplier1, "Nokia");
+_LIT8(KVideoType1, "video/H263-2000"); // H.263 video
+_LIT8(KVideoAudioType1, " AMR");       // AMR audio
+// Set 2 for 2.7 AAC
+_LIT8(KVideoMimeType2, "video/3gpp2");
+_LIT(KVideoPreferredSupplier2, "Nokia");
+_LIT8(KVideoType2, "video/mp4v-es");   // MPEG-4 video
+_LIT8(KVideoAudioType2, " AAC");       // AAC audio
+// Set 3 for 2.8
+_LIT8(KVideoMimeType3, "video/3gpp");
+_LIT(KVideoPreferredSupplier3, "Nokia");
+_LIT8(KVideoType3, "video/H263-2000; profile=0; level=45");
+_LIT8(KVideoAudioType3, " AMR");
+
+
+CCaeTestClient::CCaeTestClient () : 
+    CTimer( CActive::EPriorityStandard )
+    {
+    }
+
+
+CCaeTestClient::~CCaeTestClient()
+    {
+    Cancel();
+    delete iCameraDup;
+    delete iCamAppEngine;
+    
+    iFsSession.Close();
+    RFbsSession::Disconnect();
+    delete iBitmapSave;
+    delete iDataSave;
+
+    }
+
+
+void CCaeTestClient::ConstructL()
+    {
+    // Initializing: FBS session, bitmaps and so on.
+    User::LeaveIfError( FbsStartup() ); // Ensure Fbserv has started up OK
+    User::LeaveIfError( RFbsSession::Connect() );
+ 
+    // Connect and open output data file.
+    #if ( WRITE_VIDEOTIMES_TO_FILE )
+    User::LeaveIfError( iFsSession.Connect() );
+    User::LeaveIfError( iFile.Replace( iFsSession, KProcessFileName, EFileShareAny ) );
+    TInt aPos;
+    User::LeaveIfError( iFile.Seek( ESeekEnd, aPos ) );
+    iFile.Write( _L8( "CaeTestClient output data\n" ) );
+    iFile.Close();
+    #endif
+
+    iSnapFileName  = KiSnapFileName;
+    iStillFileName = KiStillFileName;
+    iVideoFileName = KiVideoFileName;
+    iVideoFileName2 = KiVideoFileName2;
+    iVideoFileName3 = KiVideoFileName3;
+    iVideoFileName4 = KiVideoFileName4;
+    
+    iCreateSnapImage = ETrue;
+    
+    TRect emptyRect( 0, 0, 0, 0 );
+    iCropRect = emptyRect;
+
+    TSize sizeEmpty;
+    iSizeEmpty = sizeEmpty;
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iViewFinderSize    = sizeSubQcif;
+
+    iStillFrameSize    = TSize( KDefaultStillImageWidth, KDefaultStillImageHeight );
+
+	iSnapImageSize = TSize(0, 0);
+
+    iSnapImageSource = CCaeEngine::ESnapImageSourceOriginal;
+    iStillDataFormat = KDefaultStillDataFormat;
+	iSnapImageColorMode = (TDisplayMode)0;
+
+    iStillCompressionQuality = 95;
+
+    iStillBurstLength = 1;
+
+    iVideoFrameSize = sizeSubQcif;
+    iBitmapSave = NULL;
+    iDataSave = NULL;
+
+    iCamAppEngine = CCaeEngine::NewL();
+
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+    if ( iAction != ESpecifiedPrepareAndRecordVideoNoInit )
+        {
+        // For testing with the version inputting camera index and 
+        // CCaeEngine::CamerasAvailable().
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        if ( CCaeEngine::CamerasAvailable() > 0 ) 
+            {
+            iCamAppEngine = CCaeEngine::NewL( 0 );
+            }
+        else 
+            {
+            User::Leave( KErrHardwareNotAvailable );
+            }
+    
+        }
+#endif
+
+    iCamAppEngine->SetCamAppEngineObserver( *this );
+    iCamAppEngine->SetCaeStillBurstObserver( *this );
+
+    iTimeout = 500000;
+
+	iCamAppEngine->GetInfo( iInfo );
+
+    iOpMode = EClientOpModeStill;
+
+	iStopOnErrorInMcaeoSnapImageReady = ETrue;
+	iStopOnErrorInMcaeoStillImageReady = ETrue;
+
+    iVideoCodecSet = 0; // default set in use
+
+    //set 0
+    iMimeTypeSet[0]          = &KVideoMimeType;
+    iPreferredSupplierSet[0] = &KVideoPreferredSupplier;
+    iVideoTypeSet[0]         = &KVideoType;
+    iAudioTypeSet[0]         = &KVideoAudioType;
+
+    //set 1
+    iMimeTypeSet[1]          = &KVideoMimeType1;
+    iPreferredSupplierSet[1] = &KVideoPreferredSupplier1;
+    iVideoTypeSet[1]         = &KVideoType1;
+    iAudioTypeSet[1]         = &KVideoAudioType1;
+
+    //set 2
+    iMimeTypeSet[2]          = &KVideoMimeType2;
+    iPreferredSupplierSet[2] = &KVideoPreferredSupplier2;
+    iVideoTypeSet[2]         = &KVideoType2;
+    iAudioTypeSet[2]         = &KVideoAudioType2;
+
+    //set 3
+    iMimeTypeSet[3]          = &KVideoMimeType3;
+    iPreferredSupplierSet[3] = &KVideoPreferredSupplier3;
+    iVideoTypeSet[3]         = &KVideoType3;
+    iAudioTypeSet[3]         = &KVideoAudioType3;
+
+    CTimer::ConstructL();
+    CActiveScheduler::Add( this );
+    }
+
+
+void CCaeTestClient::InitStateVariables()
+    {
+    iError = KErrNone;
+
+    iStop                   = EFalse;
+
+    iStopWhenCompleted      = EFalse;
+    iContinueWhenCompleted  = EFalse;
+
+    iStopViewFinder         = EFalse;
+    
+    iRunlForSnapImage       = EFalse;
+    iRunlForStillImage      = EFalse;
+
+    iInitReady              = EFalse;
+    iPowerOn                = EFalse;
+
+    iViewFinderStarted      = EFalse;
+    iViewFindingUsed        = EFalse;
+
+    iStillPrepareReady      = EFalse;
+    iSnapImageReady         = EFalse;
+    iStillCaptureReady      = EFalse;
+    iStillCapturingOn       = EFalse;
+    iStillCaptured          = EFalse;
+
+    iStillBurstCaptureMoment = EFalse;
+    iStillBurstReady        = EFalse;
+    iStopStillBurst         = EFalse;
+    iCancelStillBurst       = EFalse;
+    iCancelStillBurstAfterVfFrame = EFalse;
+    
+    iVideoPrepareReady      = EFalse;
+    iVideoRecordingReady    = EFalse;
+    iVideoRecordingPaused   = EFalse;
+    iVideoRecordingResumed  = EFalse;
+    iVideoRecordingOn       = EFalse;
+    iVideoRecorded          = EFalse;
+
+	iStoppedOnError			= EFalse;
+
+    iAcceptVideoCompletionError = EFalse;    
+
+    iVfFrameCount           = 0;
+    
+    iImageCountToCapture    = 1;
+    
+    iCancelCount            = 0;
+    
+    iCountInitComplete              = 0;
+    iCountStillPrepareComplete      = 0;
+    iCountStillBurstCaptureMoment   = 0;
+    iCountStillBurstComplete        = 0;
+    iCountVideoPrepareComplete      = 0;
+    iCountViewFinderFrameReady      = 0;
+    iCountSnapImageReady            = 0;
+    iCountStillImageReady           = 0;
+    iCountVideoRecordingOn          = 0;
+    iCountVideoRecordingComplete    = 0;
+    iCountVideoRecordingStopped     = 0;
+    iCountVideoRecordingPaused      = 0;
+    iCountVideoRecordingTimes       = 0;
+
+    #ifdef CAE_TEST_VERSION
+    CaeSetMcaeseoHBufC8ImageReadyError( KErrNone );
+    CaeSetMcaeseoHBufC8ImageReadyError( KErrNone );
+    CaeSetPowerOnCompleteError( KErrNone );
+    CaeSetReserveCompleteError( KErrNone );
+    CaeSetImageReadyError( KErrNone );
+    CaeSetMvruoOpenCompleteError( KErrNone );
+    CaeSetMvruoPrepareCompleteError( KErrNone );
+    CaeSetMvruoRecordCompleteError( KErrNone );
+    CaeSetPrepareVideoSettingsError( KErrNone );
+    CaeSetCreateAndDeliverSnapImageError( KErrNone );
+    CaeSetCreateAndDeliverStillImageError( KErrNone );
+    CaeSetConvertCFbsBitmapToHBufC8Error( KErrNone );
+    CaeSetConvertHBufC8ToCFbsBitmapError( KErrNone );
+    CaeSetStillConvertError( KErrNone );
+    #endif // CAE_TEST_VERSION
+
+    iReleaseDone = EFalse;
+    iReserveDone = EFalse;
+
+    iNextRunLTime.HomeTime();
+
+    iExtensionMode        = EFalse;
+    iBitmapSendDone       = EFalse;
+
+    }
+
+
+void CCaeTestClient::SetSnapImageCreation( TBool aCreateSnapImage )
+    {
+    iCreateSnapImage = aCreateSnapImage;
+    }
+
+
+void CCaeTestClient::SetRunningWithViewFinder( TBool aRunWithViewFinder )
+    {
+    iRunWithViewFinder = aRunWithViewFinder;
+    }
+
+
+void CCaeTestClient::SetViewFinderSize( const TSize& aSize )
+    {
+    iViewFinderSize = aSize;
+    }
+
+
+void CCaeTestClient::SetStillQualityLevelIndex( TInt aQualityLevelIndex )
+    {
+    iStillQualityLevelIndex = aQualityLevelIndex;
+    }
+
+
+void CCaeTestClient::SetVideoQualityLevelIndex( TInt aQualityLevelIndex )
+    {
+    iVideoQualityLevelIndex = aQualityLevelIndex;
+    }
+
+
+void CCaeTestClient::SetStillFormat( CCamera::TFormat aFormat )
+    {
+    iStillDataFormat = aFormat;
+    }
+
+
+void CCaeTestClient::SetStillCompressionQuality( TInt aCompressionQuality )
+    {
+    iStillCompressionQuality = aCompressionQuality;
+    }
+
+
+void CCaeTestClient::SetStillFrameSize( const TSize& aSize )
+    {
+    iStillFrameSize = aSize;
+    }
+
+
+void CCaeTestClient::SetSnapImageSize( const TSize& aSize )
+    {
+    iSnapImageSize = aSize;
+    }
+
+
+void CCaeTestClient::SetSnapImageSource( CCaeEngine::TSnapImageSource aSnapImageSource )
+    {
+    iSnapImageSource = aSnapImageSource;
+    }
+
+
+void CCaeTestClient::SetSnapImageColorMode( TDisplayMode aMode )
+    {
+    iSnapImageColorMode = aMode;
+    }
+
+
+void CCaeTestClient::SetImageCodecs( TUid aDecoderUid, TUid aEncoderUid )
+    {
+    iImageDecoderUid = aDecoderUid;
+    iImageEncoderUid = aEncoderUid;
+    }
+
+
+void CCaeTestClient::SetCropRect( const TRect& aRect )
+    {
+    iCropRect = aRect;
+    }
+
+
+void CCaeTestClient::SetStillBurstLength( TInt aLength )
+    {
+    iStillBurstLength = aLength;
+    }
+
+
+void CCaeTestClient::SetVideoFrameSize( const TSize& aSize )
+    {
+    iVideoFrameSize = aSize;
+    }
+
+
+void CCaeTestClient::SetVideoFrameRate( TReal32 aFrameRate )
+    {
+    iVideoFrameRate = aFrameRate;
+    }
+
+
+void CCaeTestClient::SetVideoBitRate( TInt aBitRate )
+    {
+    iVideoBitRate = aBitRate;
+    }
+
+
+void CCaeTestClient::SetVideoAudio( TBool aAudioEnabled )
+    {
+    iVideoAudioEnabled = aAudioEnabled;
+    }
+
+
+void CCaeTestClient::SetAudioBitRate( TInt aAudioBitRate )
+    {
+    iAudioBitRate = aAudioBitRate;
+    }
+
+
+void CCaeTestClient::SetFileNameBase( const TFileName& aFileNameBase ) 
+    {
+    iFileNameBase = aFileNameBase;
+    }
+
+
+void CCaeTestClient::SetVfFileName( const TFileName& aFileName ) 
+    {
+    iVfFileName = iFileNameBase;
+    iVfFileName.Append ( aFileName );
+#if ( WRITE_VF_TO_FILE )
+    iVfFrameCountToSave = 1;
+#else
+    iVfFrameCountToSave = 0;
+#endif
+    }
+
+void CCaeTestClient::SetVideoStopMode( TBool aAsyncVideoStopEnabled )
+    {
+    iVideoStopModeCommand = ETrue; // mark for new command
+    iAsyncVideoStopEnabled = aAsyncVideoStopEnabled; // new stop mode
+    }
+
+
+void CCaeTestClient::SetVfFileCountToSave( TInt aCountOfVfFilesToSave ) 
+    {
+    iVfFrameCountToSave = aCountOfVfFilesToSave;
+#if ( WRITE_VF_TO_FILE )
+    iVfFrameCountToSave = aCountOfVfFilesToSave;
+#else
+    iVfFrameCountToSave = 0;
+#endif
+    }
+
+
+void CCaeTestClient::SetSnapFileName( const TFileName& aFileName ) 
+    {
+    iSnapFileName = iFileNameBase;
+    iSnapFileName.Append ( aFileName );
+#if ( WRITE_SNAPIMAGE_TO_FILE )
+    iSaveSnapImage = ETrue;
+#else
+    iSaveSnapImage = EFalse;
+#endif
+    }
+
+
+void CCaeTestClient::SetStillFileName( const TFileName& aFileName ) 
+    {
+    iStillFileName = iFileNameBase;
+    iStillFileName.Append ( aFileName );
+#if ( WRITE_STILLIMAGE_TO_FILE )
+    iSaveStillImage = ETrue;
+#else
+    iSaveStillImage = EFalse;
+#endif
+    }
+
+
+void CCaeTestClient::SetVideoFileName( const TFileName& aFileName ) 
+    {
+    iVideoFileName = iFileNameBase;
+    iVideoFileName.Append ( aFileName );
+#if ( WRITE_VIDEOCLIP_TO_FILE )
+    iSaveVideoClip = ETrue;
+#else
+    iSaveVideoClip = EFalse;
+#endif
+    }
+
+
+void CCaeTestClient::SetTimeout( TTimeIntervalMicroSeconds32 aTimeout )
+    {
+	iTimeout = aTimeout;
+    }
+
+
+void CCaeTestClient::SetStillBurstCaptureInterval( TTimeIntervalMicroSeconds aInterval )
+    {
+    iStillBurstCaptureInterval = aInterval;
+    }
+
+
+void CCaeTestClient::SetExposureMode( TInt aExposureMode )
+    {
+    iExposureMode = aExposureMode;
+    }
+
+
+void CCaeTestClient::SetEvCompensation( TInt aEvCompensation )
+    {
+    iEvCompensation = aEvCompensation;
+    }
+
+
+void CCaeTestClient::SetWhiteBalanceMode( TInt aWhiteBalanceMode )
+    {
+    iWhiteBalanceMode = aWhiteBalanceMode;
+    }
+
+
+void CCaeTestClient::SetFlashMode( TInt aFlashMode )
+    {
+    iFlashMode = aFlashMode;
+    }
+
+
+void CCaeTestClient::SetBrightness( TInt aBrightness )
+    {
+    iBrightness = aBrightness;
+    }
+
+
+void CCaeTestClient::SetContrast( TInt aContrast )
+    {
+    iContrast = aContrast;
+    }
+
+
+void CCaeTestClient::SetZoomMode( TInt aZoomMode )
+    {
+    iZoomMode = aZoomMode;
+    }
+
+
+void CCaeTestClient::SetDigiZoomValue( TInt aDigiZoomValue )
+    {
+    iDigiZoomValue = aDigiZoomValue;
+    }
+
+void CCaeTestClient::SetVideoClipMaxSize( TInt aMaxClipSizeInBytes )
+    {
+    iVideoMaxClipSizeInBytes = aMaxClipSizeInBytes;
+    }
+
+
+void CCaeTestClient::SetVideoTimesInterval( TTimeIntervalMicroSeconds aInterval )
+    {
+    iVideoTimesInterval = aInterval;
+    }
+
+
+void CCaeTestClient::SetOpMode( TestClientOpMode aOpMode )
+    {
+    iOpMode = aOpMode;
+    }
+  
+
+void CCaeTestClient::SetDisplayIndex( TInt aDisplayIndex )
+    {
+    iDisplayIndex = aDisplayIndex;
+    }
+  
+
+void CCaeTestClient::SetStopOnErrorInMcaeoSnapImageReady( TBool aStopOnError )
+    {
+    iStopOnErrorInMcaeoSnapImageReady = aStopOnError;
+    }
+
+
+void CCaeTestClient::SetStopOnErrorInMcaeoStillImageReady( TBool aStopOnError )
+    {
+    iStopOnErrorInMcaeoStillImageReady = aStopOnError;
+    }
+
+
+void CCaeTestClient::GetInfo( TCamAppEngineInfo& aInfo ) const
+    {
+    aInfo = iInfo;
+    }
+
+
+void CCaeTestClient::GetStillFrameSize( TSize& aSize ) const
+    {
+    aSize = iStillFrameSizeSet;
+    }
+
+
+TInt CCaeTestClient::EstimatedStillSizeInBytes() const
+    {
+    return iEstimatedStillSizeInBytesSet;
+    }
+
+
+void CCaeTestClient::GetVideoFrameSize( TSize& aSize ) const
+    {
+    aSize = iVideoFrameSizeSet;
+    }
+
+
+TReal32 CCaeTestClient::VideoFrameRate() const
+    {
+    return iVideoFrameRateSet;
+    }
+
+TInt CCaeTestClient::EstimatedVideoRecordingBitRate() const
+    {
+    return iEstimatedVideoBitRateSet;
+    }
+
+
+TReal32 CCaeTestClient::ViewFinderFrameFrequency()
+    {
+    return 15.0;
+    }
+
+
+TInt CCaeTestClient::CountInitComplete()
+    {
+    return iCountInitComplete;
+    }
+
+
+TInt CCaeTestClient::CountStillPrepareComplete()
+    {
+    return iCountStillPrepareComplete;
+    }
+
+
+TInt CCaeTestClient::CountStillBurstCaptureMoment()
+    {
+    return iCountStillBurstCaptureMoment;
+    }
+
+
+TInt CCaeTestClient::CountStillBurstComplete()
+    {
+    return iCountStillBurstComplete;
+    }
+
+TInt CCaeTestClient::CountImageDeliveredStillBurstComplete()
+    {
+    return iImageCountDeliveredForStillBurst;
+    }
+
+
+TInt CCaeTestClient::CountVideoPrepareComplete()
+    {
+    return iCountVideoPrepareComplete;
+    }
+
+
+TInt CCaeTestClient::CountViewFinderFrameReady()
+    {
+    return iCountViewFinderFrameReady;
+    }
+
+
+TInt CCaeTestClient::CountSnapImageReady()
+    {
+    return iCountSnapImageReady;
+    }
+
+
+TInt CCaeTestClient::CountStillImageReady()
+    {
+    return iCountStillImageReady;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingOn()
+    {
+    return iCountVideoRecordingOn;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingComplete()
+    {
+    return iCountVideoRecordingComplete;
+    }
+
+TInt CCaeTestClient::CountVideoRecordingStopped()
+    {
+    return iCountVideoRecordingStopped;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingPaused()
+    {
+    return iCountVideoRecordingPaused;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingTimes()
+    {
+    return iCountVideoRecordingTimes;
+    }
+
+void CCaeTestClient::SetCustomInterfaceUid( TUid aCustomInterfaceUid )
+    {
+    iCustomInterfaceUid = aCustomInterfaceUid;
+    }
+
+TAny* CCaeTestClient::CustomInterfacePointer()
+    {
+    return iCustomInterfacePointer;
+    }
+
+void CCaeTestClient::SetColorToneValue( MCameraColorToneSettings::TColorTone aValue)
+    {
+    iColorToneValue = aValue;
+    }
+
+void CCaeTestClient::SetVideoCodecSet( TInt aValue)
+    {
+    iVideoCodecSet = aValue;
+    }
+
+// Trap RunL, to catch if the AO leaves.
+// A Walkaround...
+// RunError() should be used in this case, but
+// Apparently, it is not possible to use the AO RunError() virtual function
+// for that purpose, it is not called.
+void CCaeTestClient::RunL()
+    {
+    TRAPD( error, RunTrappedL() );
+	if ( error )
+	    {
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::RunL() RunTrappedL leaved! %d" ), error );
+        #endif
+        StopOnError( error );
+        // After the Stop, execution should continue at the end of RunTestAction()
+        }
+    }
+
+
+void CCaeTestClient::DoCancel()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::DoCancel() entering" ) );
+    #endif
+	
+    if ( iCamAppEngine->IsViewFinding() )
+	    {
+        iCamAppEngine->StopViewFinder();
+        iViewFinderStarted = EFalse;
+        }
+    
+    iCamAppEngine->CancelCaptureStill();
+    
+    if ( iCamAppEngine->IsVideoRecording() ) 
+        {
+        iCamAppEngine->StopVideoRecording();
+        }
+    
+    delete iCamAppEngine;
+	iCamAppEngine = NULL;
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::DoCancel() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoInitComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete() entering: %d" ), iCountInitComplete );
+    #endif
+
+    iCountInitComplete++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        if ( !(iAction == ECaptureStillAfterPowerOffOn && iStopWhenCompleted) ) 
+            {
+            iInitReady = ETrue;
+            }
+        iPowerOn   = ETrue;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoStillPrepareComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete() entering: %d" ), iCountStillPrepareComplete );
+    #endif
+
+    iCountStillPrepareComplete++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete(): error detected" ) );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iStillPrepareReady = ETrue;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoPrepareComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete() entering: %d" ), iCountVideoPrepareComplete );
+    #endif
+
+    iCountVideoPrepareComplete++;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iVideoPrepareReady = ETrue;
+
+        if ( iVideoStopModeCommand ) // New command should be sent once
+            {
+            iVideoStopModeCommand = EFalse;
+            TInt err = iCamAppEngine->SetAsyncVideoStopMode( iAsyncVideoStopEnabled );
+            if ( err ) 
+                {
+	            #ifdef _DEBUG
+                RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete(): error detected in SetAsyncVideoStopMode: %d" ), err );
+                #endif
+                StopOnError( err );
+                }
+            }
+        
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoViewFinderFrameReady( CFbsBitmap& aFrame, TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady() entering: %d" ), iCountViewFinderFrameReady );
+    #endif
+    TSize sizeEmpty;
+
+    iCountViewFinderFrameReady++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iViewFinderStarted = ETrue;
+
+        iVfFrameCount++;
+
+
+		if ( iCancelStillBurstAfterVfFrame && ( iCountStillBurstCaptureMoment == 2 ) )
+			{
+			iCamAppEngine->CancelCaptureStill();
+            iStop = ETrue;
+			CTimer::After( KNormalTimingDelay );
+			}
+        
+        // TSize viewFinderSize;
+        // iCamAppEngine->GetViewFinderSize( viewFinderSize );
+        // AsyncAssert( viewFinderSize==iViewFinderSize, KErrGeneral );
+
+        if ( iVfFrameCount <= iVfFrameCountToSave ) 
+            {
+            TFileName fn( iVfFileName );
+            TInt length = fn.Length();
+            TBuf<4> ext;
+            ext = fn.Right( 4 );
+            fn.SetLength( length  - 4 );
+            TBuf<10> num;
+            num.Num( iVfFrameCount - 1 );
+            fn.Append( _L("_") );
+            fn.Append( num );
+            fn.Append( ext );
+
+            #ifdef _DEBUG
+            RDebug::Print( fn );
+            #endif
+
+            iError = aFrame.Save( fn );
+            if ( iError ) 
+                {
+                StopOnError( iError );
+                }
+            } 
+            
+        // Create a duplicate bitmap and save it
+        if ( iAction == EProcessExtViewFinderFrameReady  &&
+            !iBitmapSave &&
+            aFrame.SizeInPixels() != sizeEmpty ) 
+            {
+            iBitmapSave = new CFbsBitmap;
+            if ( iBitmapSave )
+                {
+                TInt err = iBitmapSave->Duplicate( aFrame.Handle() );
+                if ( err ) 
+                    {
+//                        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): Duplicate error:%d" ), err);
+                        delete iBitmapSave;
+                        iBitmapSave = NULL;
+//                        User::Leave( KErrNoMemory );
+                     }
+                }
+            else
+                {
+//                LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): new CFbsBitmap failed" ));
+//                User::Leave( KErrNoMemory );
+                }
+            }
+                       
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoSnapImageReady( const CFbsBitmap& aBitmap, TInt aError ) 
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady() entering: %d" ), iCountSnapImageReady );
+    #endif
+    TSize sizeEmpty;
+
+    iCountSnapImageReady++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady(): error detected: %d" ), aError );
+        #endif
+		if (iStopOnErrorInMcaeoSnapImageReady)
+			{
+			StopOnError( aError );
+			}
+        }
+    else
+        {
+        if ( iSaveSnapImage && ( iCountSnapImageReady < 10 ) )
+            {
+            if ( aBitmap.SizeInPixels() != iSizeEmpty ) 
+                {
+                // create bitmap 3 as a duplicate of bitmap 2
+                CFbsBitmap* bitmapSave = new CFbsBitmap;
+                if ( bitmapSave )
+                    {
+                    iError = bitmapSave->Duplicate( aBitmap.Handle() );
+                    if ( iError ) 
+                        {
+                        delete bitmapSave;
+                        bitmapSave = NULL;
+                        StopOnError( iError );
+                        }
+
+                    TFileName fn( iSnapFileName );
+                    TInt length = fn.Length();
+                    TBuf<4> ext;
+                    ext = fn.Right( 4 );
+                    fn.SetLength( length  - 4 );
+                    TBuf<10> num;
+                    num.Num( iCountSnapImageReady - 1 );
+                    fn.Append( _L("_") );
+                    fn.Append( num );
+                    fn.Append( ext );
+
+	                #ifdef _DEBUG
+                    RDebug::Print( fn );
+                    #endif
+
+                    iError = bitmapSave->Save( fn );
+
+                    delete bitmapSave;
+                    bitmapSave = NULL;
+
+                    if ( iError ) 
+                        {
+                        StopOnError( iError );
+                        }
+                    }
+                }
+            }
+        // Extension mode
+        // Create a duplicate bitmap and save it
+        if ( (iAction == EProcessExtSnapImage || iAction == EProcessExtCapturedImageBurst ||
+            iAction == EProcessExtCapturedImageBurstTDesC8 || iAction == EProcessExtCapturedImageCFbsBitmap) &&
+            !iBitmapSave &&
+            aBitmap.SizeInPixels() != sizeEmpty ) 
+            {
+            iBitmapSave = new CFbsBitmap;
+            if ( iBitmapSave )
+                {
+                TInt err = iBitmapSave->Duplicate( aBitmap.Handle() );
+                if ( err ) 
+                    {
+//                        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): Duplicate error:%d" ), err);
+                        delete iBitmapSave;
+                        iBitmapSave = NULL;
+//                        User::Leave( KErrNoMemory );
+                     }
+                }
+            else
+                {
+//                LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): new CFbsBitmap failed" ));
+//                User::Leave( KErrNoMemory );
+                }
+            if ( iExtensionMode &&  // If CAE is switched to ext mode
+                iAction == EProcessExtSnapImage )   // Only snap image is sent in this test case
+                {
+                CTimer::After( KNormalTimingDelay ); // start timer for next action
+                }
+            }
+
+        if ( iRunlForSnapImage && ( iCountSnapImageReady < 2 ) )
+            {
+            iSnapImageReady = ETrue;
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoStillImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError ) 
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady() entering: %d" ), iCountStillImageReady );
+    #endif
+
+    iCountStillImageReady++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+        if ( aBitmap )
+            {
+            delete aBitmap;
+            aBitmap = NULL;
+            }
+    
+        if ( aData ) 
+            {
+            delete aData;
+            aData = NULL;
+            }
+
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady(): error detected: %d" ), aError );
+        #endif
+		if (iStopOnErrorInMcaeoStillImageReady)
+			{
+			StopOnError( aError );
+			}
+        }
+    else
+        {
+        if ( ( aBitmap == NULL ) && ( aData == NULL ) ) 
+            {
+            StopOnError( KErrBadHandle );
+            }
+
+        if ( iSaveStillImage  && ( iCountStillImageReady < 10 ) )
+            {
+            TFileName fn( iStillFileName );
+            TInt length = fn.Length();
+            TBuf<4> ext;
+            ext = fn.Right( 4 );
+            fn.SetLength( length  - 4 );
+            TBuf<10> num;
+            num.Num( iCountStillImageReady - 1 );
+            fn.Append( _L("_") );
+            fn.Append( num );
+            fn.Append( ext );
+
+	        #ifdef _DEBUG
+            RDebug::Print( fn );
+            #endif
+
+            if ( aBitmap ) 
+                {
+                aBitmap->Save( fn );
+                }
+            else if ( aData ) 
+                {
+                RFs fsSession;
+                RFile file;
+                if ( fsSession.Connect() == KErrNone )
+                    {
+                    file.Replace( fsSession, fn, EFileWrite );
+                    file.Write( aData->Des() );
+                    file.Close();
+                    fsSession.Close();
+                    }
+                }
+            }
+            
+        // Extension mode handling, don't delete image data
+        if ( (iAction == EProcessExtCapturedImage ||
+            iAction == EProcessExtCapturedImageTDesC8 ||
+            iAction == EProcessExtCapturedImageCFbsBitmap ||
+            iAction == EProcessExtCancel2 ||
+            iAction == EProcessExtCapturedImageBurst ||
+            iAction == EProcessExtCapturedImageBurstTDesC8 ||
+            iAction == EProcessExtCapturedImageNoInit)  &&
+            !iDataSave )
+            {
+            // save captured image for extension testing
+            iDataSave = aData;
+            aData = NULL;
+            }
+
+    
+        if ( aBitmap )
+            {
+            delete aBitmap;
+            aBitmap = NULL;
+            }
+    
+        if ( aData ) 
+            {
+            delete aData;
+            aData = NULL;
+            }
+
+        if ( iRunlForStillImage || ( !iRunlForSnapImage && ( iImageCountToCapture == 1 ) ) )
+            {
+            iStillCaptureReady = ETrue;
+            iStillCapturingOn = EFalse;
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaesboStillBurstCaptureMoment( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment() entering: %d" ), iCountStillBurstCaptureMoment );
+    #endif
+
+    iCountStillBurstCaptureMoment++;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+
+    if ( iStopStillBurst && ( iCountStillBurstCaptureMoment >= 3 ) )
+        {
+        iCamAppEngine->StopStillBurstCapture();
+        }
+    else if ( iCancelStillBurst && ( iCountStillBurstCaptureMoment >= 2 ) ) 
+        {
+        iStillBurstCaptureMoment = ETrue;
+        iCancelCount++;
+        iCamAppEngine->CancelCaptureStill();
+        CTimer::After( KNormalTimingDelay );
+        }
+	else if (iRunWithViewFinder && ( iCountStillBurstCaptureMoment == iStillBurstLength) )
+		{
+		// View finder is running and the last burst image will be taken
+		if ( iCountViewFinderFrameReady < ( iStillBurstLength - 1 ) )
+			{
+			// Error! There should be at least one VF frame between every burst image
+			#ifdef _DEBUG
+			RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment() Error! Not enought VF frames during the burst! %d" ), iCountViewFinderFrameReady);
+			#endif
+			StopOnError( KErrGeneral );
+			}
+		}
+    #if CAE_OOM_TESTING_HARNESS
+    else
+        {
+        // For OOM testing in CppUnit.
+        TInt* memTest = new TInt( 1 );
+        if ( !memTest ) 
+            {
+            #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment(): OOM test, calling CancelCaptureStill()" ) );
+            #endif
+            iCamAppEngine->CancelCaptureStill();
+            StopOnError( KErrNoMemory );
+            }
+        else 
+            {
+            delete memTest;
+            }
+        }
+    #endif
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaesboStillBurstComplete( TInt aImageCountDelivered, 
+                                                TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete() entering: %d" ), iCountStillBurstComplete );
+    #endif
+
+    iCountStillBurstComplete++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    iImageCountDeliveredForStillBurst = aImageCountDelivered;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iStillBurstReady = ETrue;
+        iStillCapturingOn = EFalse;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingOn( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingOn() entering: %d" ), iCountVideoRecordingOn );
+    #endif
+
+    iCountVideoRecordingOn++;
+    
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingOn(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iVideoRecordingOn = ETrue;
+        iVideoRecordingPaused = EFalse;
+        CTimer::After( iTimeout );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingOn() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingComplete() entering: %d" ), iCountVideoRecordingComplete );
+    #endif
+
+    iCountVideoRecordingComplete++;
+
+    if ( aError ) 
+        {
+        if ( !iAcceptVideoCompletionError || aError != KErrCompletion )
+            {
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingComplete(): error detected: %d" ), aError );
+            #endif
+            StopOnError( aError );
+            }
+        else
+            {
+            iVideoRecordingReady = ETrue;
+            iVideoRecordingOn = EFalse;
+            // No CTimer::After call here because there's one pending  
+            // from McaeoVideoRecordingOn.
+            }
+        }
+    else
+        {
+        iVideoRecordingReady = ETrue;
+        iVideoRecordingOn = EFalse;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingComplete() returning" ) );
+    #endif
+    }
+
+void CCaeTestClient::McaeoVideoRecordingStopped()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingStopped() entering: %d" ), iCountVideoRecordingStopped );
+    #endif
+
+    iCountVideoRecordingStopped++;
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingStopped() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingPaused( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingPaused() entering: %d" ), iCountVideoRecordingPaused );
+    #endif
+
+    iCountVideoRecordingPaused++;
+    
+    if ( aError && iAction != EPrepareRecordPausePauseStopVideo ) // Note double pause test exception
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingPaused(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        // Start CTimer only once, not two times for double pause test
+        if ( !iVideoRecordingPaused )
+            {
+            iVideoRecordingPaused = ETrue;
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingPaused() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingTimes( TTimeIntervalMicroSeconds aTimeElapsed, 
+                                               TTimeIntervalMicroSeconds aTimeRemaining, 
+                                               TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingTimes() entering: %d" ), iCountVideoRecordingTimes );
+    #endif
+
+    iCountVideoRecordingTimes++;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingTimes(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+
+    TBuf8<128> textVideoTimes;
+    
+    _LIT(KVideoTimesTitle, "Video times (elapsed remaining):\n");
+    _LIT(KSpaceSeparator, " ");
+
+    textVideoTimes.Append( KVideoTimesTitle );
+    textVideoTimes.AppendNum( aTimeElapsed.Int64() );
+    textVideoTimes.Append( KSpaceSeparator );
+    textVideoTimes.AppendNum( aTimeRemaining.Int64() );
+    textVideoTimes.Append( _L("\n") );
+
+    // Save video times info to data file. 
+    #if ( WRITE_VIDEOTIMES_TO_FILE )
+    const TDesC8& text = textVideoTimes;
+    TInt err = iFile.Open( iFsSession, KProcessFileName, EFileWrite );
+    TInt aPos;
+    err = iFile.Seek( ESeekEnd, aPos );
+    iFile.Write( text );
+    iFile.Close();
+    #endif
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingTimes() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::StopOnError( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::StopOnError(): Error: %d" ), aError );
+    #endif
+
+	__ASSERT_ALWAYS( !iStoppedOnError, User::Invariant());
+
+    // Error => mark down the error code and stop.
+    iError = aError;
+
+    if ( iCamAppEngine->IsViewFinding() )
+	    {
+        iCamAppEngine->StopViewFinder();
+        iViewFinderStarted = EFalse;
+        }
+
+    iCamAppEngine->CancelCaptureStill();
+
+    if ( iCamAppEngine->IsVideoRecording() ) 
+        {
+        iCamAppEngine->StopVideoRecording();
+        }
+    
+    CActiveScheduler::Stop();
+
+	iStoppedOnError = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ReserveComplete
+// Camera reservation is complete. 
+// Called asynchronously when CCamera::Reserve() completes.
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ReserveComplete(                                 
+    TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ReserveComplete() entering, aError=%d" ), aError );
+    #endif
+
+    if ( aError == KErrNone )
+        {
+        iCameraDup->PowerOn();
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ReserveComplete() returning" ));
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOnComplete
+// Indicates camera power on is complete.
+// Called on completion of CCamera:PowerOn().
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::PowerOnComplete( 
+    TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::PowerOnComplete() entering, aError=%d" ), aError );
+    #endif
+    if ( !aError)
+        {
+        iInitReady = ETrue;
+        iPowerOn   = ETrue;
+        }
+    CTimer::After( KNormalTimingDelay ); // This will start the test case AO to run
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::PowerOnComplete() returning" ) );
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ViewFinderFrameReady
+// Transfers the current view finder image from the camera. The frame is 
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ViewFinderFrameReady( 
+    CFbsBitmap& /*aFrame*/ )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ViewFinderFrameReady() entering" ) );
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ImageReady
+// Transfers the current image from the camera. 
+// Called asynchronously when CCamera::CaptureImage() completes.
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ViewFinderFrameReady() entering %d" ), aError );
+    #endif
+    if ( aBitmap )
+        delete aBitmap;
+    if ( aImageData )
+        delete aImageData;
+    aError++;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCaeTestClient::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCaeTestClient::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCaeTestClient::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCaeTestClient::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCaeTestClient::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCaeTestClient::ViewFinderReady() NOT HANDLED err=%d"), aError ));
+
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCaeTestClient::ImageBufferReady() NOT HANDLED, err=%d" ), aError ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCaeTestClient::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCaeTestClient::VideoBufferReady() NOT HANDLED entering, err=%d" ), aError ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    
+    PRINT(( _L( "CCaeTestClient::VideoBufferReady() returning" )));
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestRelease.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,6459 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestRelease.cpp
+*
+*/
+
+#include "CaeTestRelease.h"
+#include <f32file.h>
+#include <e32base.h>
+#include <e32svr.h>
+
+
+const TReal32 KViewFinderFrameFrequencyMinimum = 15.0;
+
+
+
+CCaeTestRelease::CCaeTestRelease ()
+    {
+    }
+
+
+
+CCaeTestRelease::~CCaeTestRelease ()
+    {
+    }
+
+
+void CCaeTestRelease::setUpL ()
+    {
+    iStatesClient = CCaeTestStatesClient::NewL( );
+
+    iStatesClient->SetFileNameBase( KFileNameBase );
+
+    iSettingsClient = CCaeTestSettingsClient::NewL();
+
+    iSettingsClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestRelease::tearDown ()
+    {
+    // pointers in other test e.g. still states tests etc. are not cleared
+    delete iStatesClient; 
+    iStatesClient = NULL;
+    delete iSettingsClient;   
+    iSettingsClient = NULL;
+//    User::After(30000000);
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/********************************************************/
+/*                   GENERAL TESTS                      */
+/********************************************************/
+
+void CCaeTestRelease::TestInitL()
+    {
+    // ID: CAE.GEN.INITL.001
+	//
+    // General
+    // 
+    // Action : Test call InitL() when instatiation is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EInit );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestInitVideoRecorderL()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.001
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorder );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffAndOnL()
+    {
+    // ID: CAE.GEN.POWEROFFANDON.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off and on when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffAndOn );
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    }
+
+void CCaeTestRelease::TestReleaseAndReserveL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.001
+	//
+    // General
+    // 
+    // Action : Release vapauttaa kameran muiden sovellusten käyttöön.
+    //          Reserve varaa kameran (uudestaan) ja palauttaa entiset asetukset (kontrasti,....) voimaan. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserve );
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    }
+
+void CCaeTestRelease::TestCCameraHandleL()
+    {
+    // ID: CAE.GEN.CCAMERAHANDLE.001
+	//
+    // General
+    // 
+    // Action : Test call CCameraHandle when instatiation is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECCameraHandle );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*            STILL CAPTURE GENERAL TESTS               */
+/********************************************************/
+
+void CCaeTestRelease::TestPowerOnWhenInitializedL()
+    {
+    // ID: CAE.GEN-SC.POWERON.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenInitialized );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOnWhenStillCapturePreparedL()
+    {
+    // ID: CAE.GEN-SC.POWERON.002
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when still capture prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenStillPrepared );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffWhenStillCapturePreparedL()
+    {
+    // ID: CAE.GEN-SC.POWEROFF.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off when still capture prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenStillPrepared );// here we have to put the correct action
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffWhenViewfinderRunningL()
+    {
+    // ID: CAE.GEN-SC.POWEROFF.002
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off when viewfinder running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenVfRunning );// here we have to put the correct action
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*           VIDEO RECORDING GENERAL TESTS              */
+/********************************************************/
+
+void CCaeTestRelease::TestPowerOnWhenVideoRecordingPreparedL()
+    {
+    // ID: CAE.GEN-VR.POWERON.003
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when video recording prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenVideoPrepared );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOnWhenRecordingL()
+    {
+    // ID: CAE.GEN.VR.POWERON.004
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when recording.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenRecordingVideo );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffWhenVideoRecordingPreparedL()
+    {
+    // ID: CAE.GEN-VR.POWEROFF.003
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off video recording prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenVideoPrepared );// here we have to put the correct action
+    }
+
+void CCaeTestRelease::TestPowerOffWhenRecordingL()
+    {
+    // ID: CAE.GEN-VR.POWEROFF.004
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off when recording.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenRecordingVideo );// here we have to put the correct action
+    }
+
+/********************************************************/
+/*                    VIEW FINDER                       */
+/********************************************************/
+
+void CCaeTestRelease::TestViewFinderStartAndStopQqvgaL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDER.QQVGA.001
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop QQVGA view finder when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetViewFinderSize( sizeQqvga );
+    iStatesClient->SetTimeout( 10000000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopVf );
+
+    TReal32 viewFinderFrameFrequency = iStatesClient->ViewFinderFrameFrequency();
+
+    assertL( viewFinderFrameFrequency >= KViewFinderFrameFrequencyMinimum );
+    }
+
+void CCaeTestRelease::TestViewFinderStartAndStopSubqcifL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDER.SUBQCIF.002
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop SUBQCIF view finder when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubqcif );
+    iStatesClient->SetTimeout( 10000000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopVf );
+
+    TReal32 viewFinderFrameFrequency = iStatesClient->ViewFinderFrameFrequency();
+
+    assertL( viewFinderFrameFrequency >= KViewFinderFrameFrequencyMinimum );
+    }
+
+void CCaeTestRelease::TestCroppedViewFinderStartAndStopL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDER.CROPPED.003
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop cropped view finder when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetViewFinderSize( sizeQqvga );
+    iStatesClient->SetTimeout( 100000 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopCroppedVf ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrNotSupported );
+
+    TReal32 viewFinderFrameFrequency = iStatesClient->ViewFinderFrameFrequency();
+
+    assertL( viewFinderFrameFrequency >= KViewFinderFrameFrequencyMinimum );
+    }
+
+void CCaeTestRelease::TestViewFinderDirectStartAndStopL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDERDIRECT.001
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop view finder direct when initialization is done.
+	//      
+	// Output : Leave.  
+    
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopDirectVf ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+#if (HW_DEVLON)
+    assertL( error != KErrNotSupported );  // Returns error because illegal parameters (NULL)
+#else
+    assertL( error == KErrNotSupported );
+#endif
+    }
+
+void CCaeTestRelease::TestCroppedViewFinderDirectStartAndStopL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDERDIRECT.002
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop cropped view finder direct when initialization is done.
+	//      
+	// Output : Leave.  
+    
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopCroppedDirectVf ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+#if (HW_DEVLON)
+    assertL( error == KErrNotSupported );  // Not supported
+#else
+    assertL( error == KErrNotSupported );
+#endif
+    }
+
+/********************************************************/
+/*              STILL CAPTURE QUALITY LEVEL             */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureQualityLevel0L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGVGA90.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_ql_0_vga90.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureQualityLevel1L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGVGA50.009
+
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 1 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+    
+    iStatesClient->SetStillFileName( _L("cae_ql_1_vga50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+    }
+
+
+void CCaeTestRelease::TestCaptureQualityLevel2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGQQVGA90.010
+
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 2 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 2 );
+    
+    iStatesClient->SetStillFileName( _L("cae_ql_2_qqvga90.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+    }
+
+
+/********************************************************/
+/*                    STILL CAPTURE                     */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureVga16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA16M.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 16M  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureVga64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA64K.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 64K  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureVga64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillFileName( _L("cae_vga64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureVga64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureVga4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA4K.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 4K 
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillFileName( _L("cae_vga4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureQqvga16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA16M.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture QQVGA 16M  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_qqvga16M.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    }
+
+
+void CCaeTestRelease::TestCaptureQqvga64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA64K.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture QQVGA 64K  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    }
+
+
+void CCaeTestRelease::TestCaptureQqvga4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA4K.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture QQVGA 4K 
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1_16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1.16M.011
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1MegaPixel 16M  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1_16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1_64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1.64K.012
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1MegaPixel 64K  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1_64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1_4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1.4K.013
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1Mega Pixel 4K 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1_4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureJpegMp1L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGMP1.014
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1MegaPixel Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iStatesClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_jpegmp1_50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1M3_16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1M3.16M.018
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3MegaPixel 16M  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+    // Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1m3_16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1M3_64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1M3.64K.019
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3MegaPixel 64K  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1m3_64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1M3_4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1M3.4K.020
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3Mega Pixel 4K 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1m3_4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureJpegMp1M3L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGMP1M3.021
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3MegaPixel Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iStatesClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_jpegmp1m3_50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp2_16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP2.16M.025
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel 16M  
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+    // Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp2_16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp2_64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP2.64K.026
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel 64K  
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureMp2_64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp2_64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureMp2_64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureMp2_4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP2.4K.027
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 Mega Pixel 4K 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp2_4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureJpegMp2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEG.MP2.028
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iStatesClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_jpegmp2_50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureExifMp2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.EXIF.MP2.029
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel Exif 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetStillCompressionQuality( 95 );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_exifmp2_95.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureExifSVGAL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.EXIF.SVGA.030
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture SVGA (800x600) Exif 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetStillCompressionQuality( 30 );
+
+    TSize sizeSVGA( KImgWidthSVGA, KImgHeightSVGA );
+
+    iStatesClient->SetStillFrameSize( sizeSVGA );
+
+    iStatesClient->SetStillFileName( _L("cae_exif_svga_30.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureCodecL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.CODEC.031
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture an image 
+    //          when codec has been set to default.
+	//      
+    //
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetStillFileName( _L("cae_exif_codec.jpg") );
+   
+    iSettingsClient->SetImageCodecs( KNullUid, KNullUid );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegCodecWhenStillPrepared );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureCodec2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.CODEC.032
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture an image 
+    //          when codec has been set to specific uid.
+	//      
+    //
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetStillFileName( _L("cae_exif_codec.jpg") );
+    
+    #if ( SYMBIAN_CODECS )
+    iSettingsClient->SetImageCodecs( TUid::Uid( KSymbianJpegDecoderValue ), TUid::Uid( KSymbianJpegEncoderValue ) );
+    #else
+    iSettingsClient->SetImageCodecs( TUid::Uid( KOptimizedJpegDecoderValue ), TUid::Uid( KOptimizedJpegEncoderValue ) );
+    #endif
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegCodecWhenStillPrepared );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureCaptureL()
+    {
+	// ID:      CAE.SC.CAPTURECAPTURE.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Capture photo two times successively
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillFileName( _L("cae_capturecapture_ql0.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestRelease::TestCaptureCaptureSpecPrepL()
+    {
+	// ID:      CAE.SC.CAPTURECAPTURE.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Capture photo two times successively
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeQqvga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFileName( _L("cae_capturecapture_vga16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepCaptureCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+void CCaeTestRelease::TestCaptureAfterPowerOffL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.POWEROFF.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image after poweroff.
+	//      
+	// Output : No leave
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    //iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_poweroff.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_poweroff.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillAfterPowerOff );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+/********************************************************/
+/*              PREPARE STILL CAPTURE                   */
+/********************************************************/
+
+void CCaeTestRelease::TestPrepareStillCapture0L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing );
+    }
+
+void CCaeTestRelease::TestPrepareStillCapture1L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing );
+    }
+
+void CCaeTestRelease::TestPrepareStillCapture2L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing );
+    }
+
+void CCaeTestRelease::TestPrepareStillCapture0WhenPreparedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality 
+    //          level when already prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturingWhenPrepared );//we have to put correct action
+    }
+
+void CCaeTestRelease::TestSpecPrepareSCSupportedFormatWhenInitializedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format supported by Camera API implementation. 
+	//          Initialization is done.
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill );//verified if is correct action
+    }
+
+/********************************************************/
+/*           STILL CAPTURE ENGINE INITIALIZED           */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureStillWhenEngineInitializedL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Capture still image. Engine initialization is done.
+	//      
+	// Output : Leave.   
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillWhenEngineInitialized ) );// verified if is correct action
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error != KErrNone );
+    }
+
+
+/********************************************************/
+/*                    STILL BURST CAPTURE               */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst3.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurst0L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.0.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture  
+    //          images in a burst when BurstLength has to small value, 
+    //          when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 0;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );    
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurst100L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.100.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture  
+    //          images in a burst when BurstLength has to big value, 
+    //          when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 100;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TInt error = KErrNone;
+	TRAP( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst ) );
+    assertL( error == KErrNoMemory );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+
+    // assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCancelCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and cancel still burst, initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancel.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancel.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == 1 ); // 3.1 and later
+    //assertL( iStatesClient->CountStillBurstCaptureMoment() == 0 ); // 3.0 and earlier 
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+void CCaeTestRelease::TestStopCaptureStillBurstAfter2L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.STOP2.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and stop still burst, when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 5;
+    const TInt KStillBurstStoppedLength = 2;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_stop.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_stop.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndStopStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstStoppedLength + 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstStoppedLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstStoppedLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestSpecPrepCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+    //          Preparation is done using explicitly specified image format parameters.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_spburst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_spburst3.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstInterval0L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.0.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode, 
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval 
+    //          and capture three images in a burst when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_snap_vga16M_burst_intvl_0.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_vga16M_burst_intvl_0.jpg") );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+    
+    TTimeIntervalMicroSeconds burstInterval( 0 );
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndSetStillBurstCaptureInterval );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iSettingsClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstInterval1000000L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.1000000.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode,
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval  
+    //          and capture three images in a burst, when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_snap_vga16M_burst_intvl_1000000.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_vga16M_burst_intvl_1000000.jpg") );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+   
+    TTimeIntervalMicroSeconds burstInterval( 1000000 );
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndSetStillBurstCaptureInterval );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iSettingsClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstIntervalM1L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.M1.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode,
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval  
+    //          and capture three images in a burst, when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+   
+    TTimeIntervalMicroSeconds burstInterval( -1 );
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndSetStillBurstCaptureInterval ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrArgument );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == 0 );
+    assertL( iSettingsClient->CountSnapImageReady() == 0 );
+    assertL( iSettingsClient->CountStillImageReady() == 0 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 0 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstExif3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          VGA Exif images in a burst when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst3_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst3_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountViewFinderFrameReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstExif6NSL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution. Test will not stop on errors in call-backs
+    //          and this will test the completeStillBurst() call if run out of memory.
+	//          in cppUnit memory tests.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountViewFinderFrameReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6_ThumbnailL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution. Exif image thumbnails are decoded to snap images.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_7_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_7_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetSnapImageSource( CCaeEngine::ESnapImageSourceThumbnail );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountViewFinderFrameReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif100L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.100.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture  
+    //          exif images in a burst when BurstLength has to big value, 
+    //          when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 100;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TInt error = KErrNone;
+	TRAP( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+    assertL( error == KErrNoMemory );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6VfL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution. The view finder is running during the burst.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6VfCancelL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.CANCEL.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and cancel the burst after   
+    //          the first capture. Intention is to test the situation when the burst is pending
+	//			the view finder to occur before it continues and cancel the burst at that 
+	//			point. Uses default image resolution. The view finder is running 
+	//          during the burst.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == 2 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+/********************************************************/
+/*              STILL CAPTURE EXIF                      */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureVgaExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfExif );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureQqvgaExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA.EXIF.002
+
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Qqvga Exif 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_qqvga_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneHalfExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled to 1/2 on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_2_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 176, 208 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_2_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneFourthExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/4 on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_4_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 88, 104 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_4_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneEighthExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/8 on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is given but not downscaled on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 176, 250 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneEighthJpegL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.JPEG.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Jpeg 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/8 on Jpeg decoding.
+    //          This is same as CAE.SC.CAPTURESTILL.VGA.EXIF.005 but format is Jpeg.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg ); // test Jpeg format too
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_jpeg.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_jpeg.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+void CCaeTestRelease::TestCaptureVgaSnapOneEighthExif2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/8 on Exif decoding. The snap 
+	//			image size is set only after prepare.
+	//      
+	// Output : OK. Visual check of snap file size.
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_exif2.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_exif2.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillSetSnapSizeExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapColor16MExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.009
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          when initialization is done and viewfinder is running.
+	//			The snap image color mode is set to EColor16M.
+	//      
+	// Output : OK. Visual check of snap file color mode.
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_color_mode_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageColorMode( EColor16M );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_color_mode_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillSetSnapColorModeExif );
+    }
+
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestRelease::TestPrepareVideoRecording0L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.001
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepare_vr_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording );
+        
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareVideoRecording1L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.002
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepare_vr_1.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareVideoRecording2L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.003
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepare_vr_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareVideoRecording0WhenPreparedL()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.004
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality 
+    //          level when already prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepared_vr_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecordingWhenPrepared );//we have to put correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+void CCaeTestRelease::TestSpecPrepareVRSupportedFormatWhenVRInitializedL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.007
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_initialized.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+/********************************************************/
+/*             VIDEO RECORDING QUALITY LEVEL            */
+/********************************************************/
+
+void CCaeTestRelease::TestRecordQualityLevel0L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done and viewfinder is running.
+	//      
+	// Output : No leave. File cae_ql_0.3gp.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetVfFileName( _L("cae_video_ql_0_vfimg.mbm") ); 
+
+    // iStatesClient->SetVfFileCountToSave( 150 );
+        
+    iStatesClient->SetTimeout( 30000000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_ql_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestRecordQualityLevel1L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done and viewfinder is running.
+	//      
+	// Output : No leave. File cae_ql_1.3gp.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_ql_1.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestPrepareAudioBitRateVR128L()
+    {
+	// ID:      CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002
+    //
+    // Group:   Record.
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          Use high video bitrate. This is for PROD7.
+	//      
+	// Output : No leave. File cae_subqcif_VideoBitRate_128000.3gp.   
+
+    TSize sizeSubQcif( 176, 144 );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 15.0 ) );
+
+    iStatesClient->SetVideoBitRate( TInt( 128000 ) );
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+    // 3: AMR audio, H.263 video, video type video/H263-2000; profile=0; level=45
+    // 0: AMR audio, H.263 video, video type video/H263-2000
+    iStatesClient->SetVideoCodecSet( 3 ); 
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_VideoBitRate_128000.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareAudioBitRateVR128InvVtypeL()
+    {
+	// ID:      CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003
+    //
+    // Group:   Record.
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          Use high video bitrate and invalid videotype.
+	//      
+	// Output : Leave   
+
+    TSize sizeSubQcif( 176, 144 );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 15.0 ) );
+
+    iStatesClient->SetVideoBitRate( TInt( 128000 ) );
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+    // 3: AMR audio, H.263 video, video type video/H263-2000; profile=0; level=45
+    // 0: AMR audio, H.263 video, video type video/H263-2000
+    iStatesClient->SetVideoCodecSet( 0 ); 
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_VideoBitRate_128000inv.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    assertL( err != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestRelease::TestRecordQualityLevel2L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done and viewfinder is running.
+	//      
+	// Output : No leave. File cae_q2_0.3gp.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_ql_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*            START AND STOP VIDEO RECORDING            */
+/********************************************************/
+
+void CCaeTestRelease::TestStartAndStopVideoRecordingSubQcifL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.001
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording subQCIF sized video works. 
+    //          Video recording prepared for subQCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestStartAndStopVideoRecordingQcifL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 50000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*             STILL CAPTURE DIGITAL ZOOM VALUE         */
+/********************************************************/
+
+void CCaeTestRelease::TestSCDigiZoomVal0L()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.001
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.  
+ 
+    RDebug::Print(_L("XYZ:TestSCDigiZoomVal0L start"));
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_val_0_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_val_0_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared );
+ 
+    RDebug::Print(_L("XYZ:TestSCDigiZoomVal0L ending"));
+}
+
+void CCaeTestRelease::TestSCDigiZoomVal1VgaL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.002_vga
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_val_1_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_val_1_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCDigiZoomVal1QqvgaL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.002_qqvga
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 2 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_val_1_qqvga.mbm") );
+    
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_val_1_qqvga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCDigiZoomInitializedVal0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.005
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_initialized_val_0_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_val_0_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+void CCaeTestRelease::TestSCDigiZoomInitializedVal1VgaL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.012_vga
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_initialized_val_1_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_val_1_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+void CCaeTestRelease::TestSCDigiZoomInitializedVal1QqvgaL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.012_qqvga
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 2 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_initialized_val_1_qqvga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_val_1_qqvga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING DIGITAL ZOOM VALUE       */
+/********************************************************/
+
+void CCaeTestRelease::TestVRDigiZoomVal0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.006
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRDigiZoomVal1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.007
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRDigiZoomRecordingVal0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.010
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_recording_val_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVRDigiZoomRecordingVal1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.011
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_recording_val_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoRecording );
+}
+
+/********************************************************/
+/*        START AND STOP VIDEO RECORDING DISK FULL      */
+/********************************************************/
+
+void CCaeTestRelease::TestStartAndStopVRWhenTooBigSizeSubQcifL()
+    {
+	// ID: CAE.VR.STARTSTOPVRTOOBIGSIZE.SUBQCIF.001
+    //
+    // Group:   Record
+    // 
+    // Action : 
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 100000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    //iStatesClient->SetVideoFileName( _L("cae_too_big_subqcif.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo ) );//we have to put correct action
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrDiskFull );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                     GET INFO                         */
+/********************************************************/
+
+void CCaeTestRelease::TestGetInfoL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.001
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 1;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 2.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 2;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+void CCaeTestRelease::TestGetInfoPROD1MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.002
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD1 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 3;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 4.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 4;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+void CCaeTestRelease::TestGetInfoPROD2MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.003
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD2 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureBacklight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 52;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 6.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+void CCaeTestRelease::TestGetInfoPROD3MirageXPL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.004
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD3 Mirage XP**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone |
+                                  CCamera::EFlashAuto | 
+                                  CCamera::EFlashForced;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBCloudy | 
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 3;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 4.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3; // 4 with HW version of Camera API !
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+void CCaeTestRelease::TestGetInfoPROD4MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.005
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD4 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone | 
+                                           CCamera::EFlashAuto |
+                                           CCamera::EFlashForced;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureBacklight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 52;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 6.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+void CCaeTestRelease::TestGetInfoPROD6MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.006
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD6 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EViewFinderMirrorSupported;
+
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+    								 CCamera::EExposureNight; 
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 52;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 6.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+void CCaeTestRelease::TestGetInfoPROD7Unagi2ML()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.007
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD7 Unagi 2M **
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EViewFinderMirrorSupported;
+                               //TCameraInfo::EContrastSupported |
+                               //TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone | 
+                                  CCamera::EFlashAuto |
+                                  CCamera::EFlashForced |
+                                  CCamera::EFlashRedEyeReduce;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureBacklight |
+                                     CCamera::EExposureSport;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBCloudy |
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 71;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 20.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 4;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+
+void CCaeTestRelease::TestGetInfoPROD8MirageXL()
+
+    {
+
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.008
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD8 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );   
+
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );  
+
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported;                               
+    assertL( info.iOptionsSupported == optionsSupported );
+  
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+    								 CCamera::EExposureNight |
+    								 CCamera::EExposureSport |
+                                     CCamera::EExposureCenter;
+                                     
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBCloudy |
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 71;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 20.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 5;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+    
+
+void CCaeTestRelease::TestGetInfoPROD9HWL()
+
+    {
+
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.009
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD9 HW **
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );   
+
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );  
+
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported;                               
+    assertL( info.iOptionsSupported == optionsSupported );
+  
+    TUint32 flashModesSupported =           CCamera::EFlashAuto     |
+                                            CCamera::EFlashForced   |
+                                            CCamera::EFlashRedEyeReduce;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+    								 CCamera::EExposureNight |
+    								 CCamera::EExposureBacklight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureSuperNight;
+                                     
+    RDebug::Print(_L("info.iExposureModesSupported = 0x%x / 0x%x"), info.iExposureModesSupported, exposureModesSupported);
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 40;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 4.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+    TInt numImageSizesSupported = 3;
+#else
+    TInt numImageSizesSupported = 4;
+#endif
+    RDebug::Print(_L("info.iNumImageSizesSupported = %d"), info.iNumImageSizesSupported);
+
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+    
+
+void CCaeTestRelease::TestGetInfoDevlonHWL()
+    {
+
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.010
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For Devlon HW **
+    //      
+    // Output : OK. Note only interfaces are tested, not the content itself anymore
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );   
+
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );  
+
+//    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+//    assertL( info.iOrientation == orientation );
+    RDebug::Print(_L("info.iOrientation = 0x%x"), info.iOrientation);
+
+//    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+//                               TCameraInfo::EImageCaptureSupported |
+//                               TCameraInfo::EVideoCaptureSupported;                               
+//    assertL( info.iOptionsSupported == optionsSupported );
+    RDebug::Print(_L("info.iOptionsSupported = 0x%x"), info.iOptionsSupported);
+  
+//    TUint32 flashModesSupported =           CCamera::EFlashAuto     |
+//                                            CCamera::EFlashForced   |
+//                                            CCamera::EFlashRedEyeReduce;
+//    assertL( info.iFlashModesSupported == flashModesSupported );
+    RDebug::Print(_L("info.iFlashModesSupported = 0x%x"), info.iFlashModesSupported);
+
+//    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+//    								 CCamera::EExposureNight |
+//    								 CCamera::EExposureBacklight |
+//                                     CCamera::EExposureCenter;
+                                     
+//    assertL( info.iExposureModesSupported == exposureModesSupported );
+    RDebug::Print(_L("info.iExposureModesSupported = 0x%x"), info.iExposureModesSupported);
+
+//    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+//                                         CCamera::EWBDaylight |
+//                                         CCamera::EWBTungsten |
+//                                         CCamera::EWBFluorescent;
+
+//    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+    RDebug::Print(_L("info.iWhiteBalanceModesSupported = 0x%x"), info.iWhiteBalanceModesSupported);
+
+//    TInt minzoom = 0;
+//    assertL( info.iMinZoom == minzoom );
+    RDebug::Print(_L("info.iMinZoom = 0x%x"), info.iMinZoom);
+
+//    TInt maxZoom = 0;
+//    assertL( info.iMaxZoom == maxZoom );
+    RDebug::Print(_L("info.iMaxZoom = 0x%x"), info.iMaxZoom);
+
+//    TInt maxDigitalZoom = 40;
+//    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    RDebug::Print(_L("info.iMaxDigitalZoom = 0x%x"), info.iMaxDigitalZoom);
+
+//    TReal32 minZoomFactor = 0.0;
+//    assertL( info.iMinZoomFactor == minZoomFactor );
+    RDebug::Print(_L("info.minZoomFactor = 0x%x"), info.iMinZoomFactor);
+
+//    TReal32 maxZoomFactor = 0.0;
+//    assertL( info.iMaxZoomFactor == maxZoomFactor );
+    RDebug::Print(_L("info.iMaxZoomFactor = 0x%x"), info.iMaxZoomFactor);
+
+//    TReal32 maxDigitalZoomFactor = 4.0;
+//    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+    RDebug::Print(_L("info.iMaxDigitalZoomFactor = 0x%x"), info.iMaxDigitalZoomFactor);
+
+//#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+//    TInt numImageSizesSupported = 3;
+//#else
+//    TInt numImageSizesSupported = 4;
+//#endif
+//    RDebug::Print(_L("info.iNumImageSizesSupported = %d"), info.iNumImageSizesSupported);
+
+//    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+    RDebug::Print(_L("info.iNumImageSizesSupported = 0x%x"), info.iNumImageSizesSupported);
+
+//    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+//                                    CCamera::EFormatFbsBitmapColor64K |
+//                                    CCamera::EFormatFbsBitmapColor16M |
+//                                    CCamera::EFormatExif;
+
+//    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+    RDebug::Print(_L("info.iImageFormatsSupported = 0x%x"), info.iImageFormatsSupported);
+
+//    TInt numStillQualityLevelsSupported = 3;
+//    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+    RDebug::Print(_L("info.iNumStillQualityLevelsSupported = 0x%x"), info.iNumStillQualityLevelsSupported);
+
+//    TInt numVideoQualityLevelsSupported = 3;
+//    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+    RDebug::Print(_L("info.iNumVideoQualityLevelsSupported = 0x%x"), info.iNumVideoQualityLevelsSupported);
+
+    }
+    
+
+/********************************************************/
+/*               RESUME VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestRelease::TestRecordPauseResumeStopL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording after pause. 
+    //          Video recording.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resume.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseResumeStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*             STILL CAPTURE EXPOSURE MODE              */
+/********************************************************/
+
+void CCaeTestRelease::TestSCExposureMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.001
+    //
+    // Action : Test auto exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCExposureMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.002
+    //
+    // Action : Test night exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_1.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCExposureModeInitialized0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.015
+    //
+    // Action : Test auto exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_initialized_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenInitialized );
+}
+
+void CCaeTestRelease::TestSCExposureModeInitialized1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.016
+    //
+    // Action : Test night exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_initialized_1.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenInitialized );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING EXPOSURE MODE            */
+/********************************************************/
+
+void CCaeTestRelease::TestVRExposureMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.008
+    //
+    // Action : Test auto exposure mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRExposureMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.009
+    //
+    // Action : Test night exposure mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRExposureModeRecording0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.017
+    //
+    // Action : Test auto exposure mode setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_recording_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVRExposureModeRecording1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.018
+    //
+    // Action : Test night exposure mode setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_recording_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoRecording );
+}
+
+/********************************************************/
+/*             STILL CAPTURE EV COMPENSATION            */
+/********************************************************/
+
+void CCaeTestRelease::TestSCEvCompensation0L()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETEVCOMP.001
+    // 
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.  
+ 
+    iSettingsClient->SetEvCompensation( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_0.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationMaxL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETEVCOMP.002
+    // 
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_max.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_max.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationMinL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETEVCOMP.003
+    // 
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_min.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_min.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+
+void CCaeTestRelease::TestSCEvCompensationInitialized0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.004
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+    iSettingsClient->SetEvCompensation( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_initialized_0.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_initialized_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationInitializedMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.005
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_initilized_max.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_initilized_max.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationInitializedMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.006
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_initialized_min.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_initialized_min.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationInitializedInvalidL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.007
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation + 1 );
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+	assertL(error == KErrNotSupported);
+}
+
+
+
+/********************************************************/
+/*             VIDEO RECORDING EV COMPENSATION          */
+/********************************************************/
+
+void CCaeTestRelease::TestVREvCompensationMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.001
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_min.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestVREvCompensationRecordingMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.002
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_max.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+
+/* UNUSED
+
+void CCaeTestRelease::TestVREvCompensation0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.001
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetEvCompensation( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVREvCompensationMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.002
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_max.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVREvCompensationRecording0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.004
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetEvCompensation( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVREvCompensationRecordingMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.006
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_min.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVREvCompensationRecordingInvalidL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.007
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation - 1 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_invalid.3gp") );
+    
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording ) );
+	assertL(error == KErrNotSupported);
+}
+
+*/
+
+/********************************************************/
+/*           STILL CAPTURE WHITE BALANCE MODE           */
+/********************************************************/
+
+void CCaeTestRelease::TestSCWhiteBalanceMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.001
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCWhiteBalanceModeInitialized0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.019
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_initialized_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenInitialized );
+}
+
+/********************************************************/
+/*           VIDEO RECORDING WHITE BALANCE MODE         */
+/********************************************************/
+
+void CCaeTestRelease::TestVRWhiteBalanceMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.010
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRWhiteBalanceModeRecording0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.020
+    //
+    // Action : Test white balance setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_recording_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoRecording );
+}
+
+/********************************************************/
+/*             STILL CAPTURE CONTRAST                   */
+/********************************************************/
+
+void CCaeTestRelease::TestSCContrast50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.001
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestSCContrastInitialized50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.007
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_initialized_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             STILL CAPTURE BRIGHTNESS                 */
+/********************************************************/
+
+void CCaeTestRelease::TestSCBrightness50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.001
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestSCBrightnessInitialized50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.007
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_initialized_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CONTRAST                 */
+/********************************************************/
+
+void CCaeTestRelease::TestVRContrast50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.008
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetContrast( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_contrast_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestVRContrastRecording50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.014
+    //
+    // Action : Test contrast setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetContrast( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_contrast_recording_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoRecording ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING BRIGHTNESS               */
+/********************************************************/
+
+void CCaeTestRelease::TestVRBrightness50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.008
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_brightness_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestVRBrightnessRecording50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.014
+    //
+    // Action : Test brightness setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_brightness_recording_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoRecording ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CLIP MAX SIZE            */
+/********************************************************/
+
+void CCaeTestRelease::TestVideoClipMaxSize10000L()
+    {
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.002
+    //
+    // Action : Test video clip max size setting with recording.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 20000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_10000.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    assertL( err == KErrCompletion );
+    }
+
+/********************************************************/
+/*               CANCEL CAPTURE STILL                   */
+/********************************************************/
+
+void CCaeTestRelease::TestCancelCaptureStillL()
+    {
+	// ID: CAE.SC.CANCELCAPTURESTILL.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Cancel on-going still image capture request, 
+    //          when already prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+/********************************************************/
+/*               GET QUALITY INDEX                      */
+/********************************************************/
+
+void CCaeTestRelease::TestGetStillQualityIndexWhenEngineInitializedL()
+    {
+	// ID: CAE.SC.GETSTILLQUALITYINDEX.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still quality index, when engine is initialized.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetStillQualityIndexWhenEngineInitialized );
+    }
+
+void CCaeTestRelease::TestGetStillQualityIndexWhenPreparedL()
+    {
+	// ID: CAE.SC.GETSTILLQUALITYINDEX.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still quality index, when still image capture is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetStillQualityIndexWhenPrepared );
+    }
+
+void CCaeTestRelease::TestGetVideoQualityIndexWhenEngineInitializedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.GETVIDEOQUALITYINDEX.001
+    //
+    // Action : Get video quality index, when engine is initialized.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetVideoQualityIndexWhenEngineInitialized );
+}
+
+void CCaeTestRelease::TestGetVideoQualityIndexWhenPreparedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.GETVIDEOQUALITYINDEX.002
+    //
+    // Action : Get video quality index, when video recording is prepared.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetVideoQualityIndexWhenPrepared );
+}
+
+/********************************************************/
+/*            REMAINING VIDEO RECORDING TIME            */
+/********************************************************/
+
+void CCaeTestRelease::TestRemainingTimeWhenVideoPreparedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.REMAININGVIDEORECORDINGTIME.001
+    //
+    // Action : Get RemainingVideoRecordingTime, when video recording is prepared.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERemainingTimeWhenVideoPrepared );
+}
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestRelease::TestPrepareAudioBitRateVR5000L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.001
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    iStatesClient->SetAudioBitRate( TInt( 5000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5000.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/************************************************************************/
+/*   STILL AND STILL BURST CAPTURE - snap-image creation switched off   */
+/************************************************************************/
+
+void CCaeTestRelease::TestCaptureVga16M_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA16M.015
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 16M  
+    //          image when initialization is done. 
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    // iStatesClient->SetStillFileName( _L("cae_vga16M_NoSnap.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureQualityLevel0_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGVGA90.016
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    // iStatesClient->SetStillFileName( _L("cae_ql_0_vga90_NoSnap.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaExif_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.017
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif 
+    //          image when initialization is done and viewfinder is running.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    // iStatesClient->SetStillFileName( _L("cae_vga_exif_NoSnap.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurst3_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    // iStatesClient->SetStillFileName( _L("cae_vga16M_burst3_NoSnap.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestSpecPrepCaptureStillBurst3_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+    //          Preparation is done using explicitly specified image format parameters.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    // iStatesClient->SetStillFileName( _L("cae_qqvga16M_spburst3_NoSnap.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif3_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.3.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          VGA Exif images in a burst when initialization is done.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    // iStatesClient->SetStillFileName( _L("cae_burst3_exif_NoSnap.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestEnumerateCaptureSizesL()
+    {
+	// ID: CAE.GEN.ENUMERATE.001
+    //
+    // Group:   General
+    // 
+    // Action : Test to enumerate still capture sizes. Tests the largest image size only.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+#if (MIRAGE_X_PROD1)
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+#elif (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3)
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+#elif (MIRAGE_X_PROD7)
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+#elif (MIRAGE_X_PROD6) || (MIRAGE_X_PROD8) || (MIRAGE_X_PROD9)
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+#elif (HW_DEVLON)
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+    TSize sizeMp3( KImgWidthMP3, KImgHeightMP3 );
+    iStatesClient->SetStillFrameSize( sizeMp3 );
+#else
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+    iStatesClient->SetStillFrameSize( sizeVga ); 
+#endif
+
+		// ignore errors if correct resolution was not found
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EEnumerateCaptureSizes ) );
+
+		if ( err )
+        {
+        RDebug::Print(_L("CCaeTestRelease::TestEnumerateCaptureSizesL() failed = %d, ignored"), err);
+        }
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 0 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestRelease::TestSetJpegQuality50L()
+    {
+	// ID: CAE.SET-SC.SETJPEGQUALITY.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iSettingsClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iSettingsClient->SetStillFrameSize( sizeVga );
+
+    // iSettingsClient->SetStillFileName( _L("cae_jpeg_quality_setting_50.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestStatesClient::ESetJpegQualityWhenStillPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCCustomInterfaceL()
+    {
+	// ID: CAE.GEN.CUSTOMINTERFACE.001
+    //
+    // Group:   General
+    // 
+    // Action : Test custom interface with illegal UID values -1, 0 and 1.
+	//      
+	// Output : Returns 0 with illegal UID values.   
+
+    TUid interfaceUid;
+
+    interfaceUid.iUid = -1;
+    iStatesClient->SetCustomInterfaceUid( interfaceUid );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetCustomInterface );
+    assertL( iStatesClient->CustomInterfacePointer() == 0 );
+
+    interfaceUid.iUid = 0;
+    iStatesClient->SetCustomInterfaceUid( interfaceUid );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetCustomInterface );
+    assertL( iStatesClient->CustomInterfacePointer() == 0 );
+
+    interfaceUid.iUid = 1;
+    iStatesClient->SetCustomInterfaceUid( interfaceUid );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetCustomInterface );
+    assertL( iStatesClient->CustomInterfacePointer() == 0 );
+    }
+
+/******************************/
+/*        FLASH MODE          */
+/******************************/
+
+void CCaeTestRelease::TestFlashMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.001
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+	const TInt KSetVal = 0;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestFlashMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.002
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestFlashMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.003
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestSCColorToneNormalL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.001
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ENormal parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENormal );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_normal1.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_normal.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneSepiaL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.002
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ESepia parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ESepia );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_sepia.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_sepia.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneGrayscaleL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.003
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with EGrayscale parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::EGrayscale );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_grayscale.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_grayscale.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneNegativeL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.004
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ENegative parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENegative );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_negative.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_negative.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestVRColorToneL()
+    {
+	// ID: CAE.SET-VR.COLORTONE.005
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with video recording. Test case will start video recording
+    //          and then sets every supported color tone with 5 second interval. Total execution time is 
+    //          then with 4 color tones 20 seconds. Test case will report interface failures. Color tone 
+    //          fuctionality must be checked manually from .3gp file.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_colortone.3gp") );
+    iStatesClient->SetTimeout( 5000000 ); // time for one color, then change
+    
+    // this walue is set before exiting
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENormal );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneVideoRecording );
+
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneWrongParams1L()
+    {
+	// ID: CAE.SET-SC.COLORTONE.006
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with illegal Color Tone parameter 2^31.
+    //          Should leave with code KErrNotSupported.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( (MCameraColorToneSettings::TColorTone) 0x80000000 );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_wrong_params.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_wrong_params.jpg") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneWrongParams ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrNotSupported );
+    }
+
+void CCaeTestRelease::TestSCColorToneWrongParams2L()
+    {
+	// ID: CAE.SET-SC.COLORTONE.007
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with illegal Color Tone parameter 0x07.
+    //          Should leave with code KErrArgument.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( (MCameraColorToneSettings::TColorTone) 0x07 );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_wrong_params.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_wrong_params.jpg") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneWrongParams ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrArgument );
+    }
+
+void CCaeTestRelease::TestSCColorToneReleaseL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.008
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ENegative parameter when
+    //          Release() and Reserve() has been used. After Reserve() the default 
+    //          values should be set (ENormal) by CameraAPI
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENegative );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_release.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_release.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneRelease );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 2 ); // reserve() calls once McaeoInitComplete
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+/********************************************************/
+/*           DISPLAY INDEX                              */
+/********************************************************/
+
+void CCaeTestRelease::TestSetDisplayIndexL()
+    {
+	// ID: CAE.SC.SETDISPLAYINDEX.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Set display index to 1 and capture a still image.
+	//      
+	// Output : No errors. Snap image should be enhanced.  
+
+    iStatesClient->SetDisplayIndex( 1 );
+    iStatesClient->SetSnapFileName( _L("cae_snap_disp_index_1.mbm") );
+    //iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetDisplayIndex );
+    }
+
+/********************************************************/
+/*             VIDEO RECORDING ENUMERATE FRAME SIZES    */
+/********************************************************/
+
+void CCaeTestRelease::TestEnumerateVideoFrameSize001L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.ENUMERATEVIDEOFRAMESIZE.001
+    //
+    // Action : Test that enumerate can be called with correct and incorrect frame sizes
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEnumerateVideoFrameSize );
+}
+
+
+/********************************************************/
+/*             Extension mode test cases                */
+/********************************************************/
+
+void CCaeTestRelease::TestProcessExtViewFinderFrameReadyL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtViewFinderFrameReadyL.001
+    //
+    // Action : Test extension mode ProcessExtViewFinderFrameReadyL normal operation
+	//      
+	// Output : No leave.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+    iSettingsClient->SetViewFinderSize( sizeQqvga );
+	iSettingsClient->SetRunningWithViewFinder( ETrue );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtViewFinderFrameReady );
+}
+
+void CCaeTestRelease::TestProcessExtSnapImageL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtSnapImageL.001
+    //
+    // Action : Test extension mode ProcessExtSnapImageL normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtSnapImage );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImageL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.001
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with HBufC8 param 
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImage );
+}
+
+
+void CCaeTestRelease::TestProcessExtCapturedImage2L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.002
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with TDesC8 param
+    //          Test that Relese() can be called
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageTDesC8 );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImage3L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.003
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with CFbsBitmap param
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageCFbsBitmap );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImage4L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.004
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with HBufC8 param 
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageNoInit );
+}
+
+void CCaeTestRelease::TestProcessExtCancelL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCancel.001
+    //
+    // Action : Test extension mode ProcessExtCancel call before extension interface is used
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCancel );
+}
+
+
+void CCaeTestRelease::TestProcessExtCancel2L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCancel.002
+    //
+    // Action : Test extension mode ProcessExtCancel normal operation. Cancell is called when extension
+    //          processing is in progress
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCancel2 );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImageBurstL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageBurstL.001
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal burst operation with HBufC8 param
+    //          One image is captured and then it is sent as 6 burst images to extension handling.
+    //          Also snap images are sent 6 times.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillBurstLength( 6 );
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageBurst );
+    assertL( iSettingsClient->CountStillImageReady() == 6 );
+    assertL( iSettingsClient->CountSnapImageReady() == 6 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImageBurst2L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageBurstL.002
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal burst operation with TDesC8 param 
+    //          One image is captured and then it is sent as 6 burst images to extension handling
+    //          Also snap images are sent 6 times.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillBurstLength( 6 );
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageBurstTDesC8 );
+    assertL( iSettingsClient->CountSnapImageReady() == 6 );
+    assertL( iSettingsClient->CountStillImageReady() == 6 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+}
+
+void CCaeTestRelease::TestInstalledExtensionListL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.InstalledExtensionList.001
+    //
+    // Action : Test extension mode InstalledExtensionList normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EInstalledExtensionList );
+}
+
+void CCaeTestRelease::TestSkippedExtensionListL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.SkippedExtensionListL.001
+    //
+    // Action : Test extension mode SkippedExtensionList normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESkippedExtensionList );
+}
+
+void CCaeTestRelease::TestSetSkippedExtensionListL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.SetSkippedExtensionList.001
+    //
+    // Action : Test extension mode SetSkippedExtensionList normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetSkippedExtensionList );
+}
+
+
+void CCaeTestRelease::TestStartAndStopVideoRecordingSubQcifNoInitL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.NOINIT.001
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording subQCIF sized video works. 
+    //          Video recording prepared for subQCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_noinit.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideoNoInit );
+
+    assertL( iStatesClient->CountInitComplete() == 0 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+
+void CCaeTestRelease::TestSecondaryCamera001L()
+    {
+	// ID: CAE.SC.SecondaryCamera.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing for secondary camera and capture Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For PROD9 320x240 camera **
+    //
+	// Output : OK.   
+
+    TSize sizeQVGA( KImgWidthQVGA, KImgHeightQVGA );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+    iStatesClient->SetStillCompressionQuality( 80 );
+    iStatesClient->SetStillFrameSize( sizeQVGA ); // only supported size
+    iStatesClient->SetSnapImageSize( TSize( 240, 180 ) ); // no action, cae returns qvga if no adis
+    iStatesClient->SetSnapImageSource( CCaeEngine::ESnapImageSourceThumbnail ); // no action as C-API returns bitmap
+    iStatesClient->SetStillFileName( _L("cae_jpegsecond_001.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill2nd );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestRecordAsyncStop001L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.AsyncStop.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when async stop is enabled.
+	//      
+	// Output : No leave.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetVfFileName( _L("cae_video_asyncstop_001.mbm") ); 
+
+    iStatesClient->SetVideoStopMode( ETrue ); 
+
+    iStatesClient->SetTimeout( 30000000 );
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_video_asyncstop_001.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingStopped() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestRecordAsyncStop002L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.AsyncStop.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when async stop is disabled.
+	//      
+	// Output : No leave.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetVfFileName( _L("cae_video_asyncstop_001.mbm") ); 
+
+    iStatesClient->SetVideoStopMode( EFalse ); 
+
+    iStatesClient->SetTimeout( 30000000 );
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_video_asyncstop_001.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingStopped() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+#if 1
+    
+MTest* CCaeTestRelease::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestRelease") );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.INITL.001"), &TestInitL ) );
+    
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.001"), &TestInitVideoRecorderL ) );
+#endif
+    
+#if (!MIRAGE_X) && (!UNAGI_2M) 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.001"), &TestGetInfoL ) );
+#endif
+
+#if MIRAGE_X_PROD1 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.002"), &TestGetInfoPROD1MirageXL ) );
+#endif
+    
+#if MIRAGE_X_PROD2 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.003"), &TestGetInfoPROD2MirageXL ) );
+#endif
+    
+#if MIRAGE_X_PROD3 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.004"), &TestGetInfoPROD3MirageXPL ) );
+#endif
+    
+#if MIRAGE_X_PROD4 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.005"), &TestGetInfoPROD4MirageXL ) );
+#endif
+
+#if MIRAGE_X_PROD6 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.006"), &TestGetInfoPROD6MirageXL ) );
+#endif
+
+#if MIRAGE_X_PROD7 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.007"), &TestGetInfoPROD7Unagi2ML ) );
+#endif
+
+#if MIRAGE_X_PROD8 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.008"), &TestGetInfoPROD8MirageXL ) );
+#endif
+
+#if MIRAGE_X_PROD9 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.009"), &TestGetInfoPROD9HWL ) );
+#endif
+
+#if HW_DEVLON 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.010"), &TestGetInfoDevlonHWL ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.POWEROFFANDON.001"), &TestPowerOffAndOnL ) );
+     
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.001"), &TestReleaseAndReserveL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWERON.001"), &TestPowerOnWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWERON.002"), &TestPowerOnWhenStillCapturePreparedL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWERON.003"), &TestPowerOnWhenVideoRecordingPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWERON.004"), &TestPowerOnWhenRecordingL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWEROFF.001"), &TestPowerOffWhenStillCapturePreparedL ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWEROFF.002"), &TestPowerOffWhenViewfinderRunningL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWEROFF.003"), &TestPowerOffWhenVideoRecordingPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWEROFF.004"), &TestPowerOffWhenRecordingL ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDER.QQVGA.001"), &TestViewFinderStartAndStopQqvgaL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDER.SUBQCIF.002"), &TestViewFinderStartAndStopSubqcifL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDER.CROPPED.003"), &TestCroppedViewFinderStartAndStopL ) );
+#if !( (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDERDIRECT.001"), &TestViewFinderDirectStartAndStopL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDERDIRECT.002"), &TestCroppedViewFinderDirectStartAndStopL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.001"), &TestCaptureStillWhenEngineInitializedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA16M.002"), &TestCaptureVga16ML ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA64K.003"), &TestCaptureVga64KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA4K.004"), &TestCaptureVga4KL ) );
+
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA16M.005"), &TestCaptureQqvga16ML ) ); 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA64K.006"), &TestCaptureQqvga64KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA4K.007"), &TestCaptureQqvga4KL ) );
+#endif
+    
+#if MIRAGE_X_PROD1 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1.16M.011"), &TestCaptureMp1_16ML ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1.64K.012"), &TestCaptureMp1_64KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1.4K.013"), &TestCaptureMp1_4KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGMP1.014"), &TestCaptureJpegMp1L ) );    
+
+#endif
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1M3.16M.018"), &TestCaptureMp1M3_16ML ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1M3.64K.019"), &TestCaptureMp1M3_64KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1M3.4K.020"), &TestCaptureMp1M3_4KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGMP1M3.021"), &TestCaptureJpegMp1M3L ) );    
+
+#endif // (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3)
+
+#if MIRAGE_X_PROD7
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP2.16M.025"), &TestCaptureMp2_16ML ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP2.64K.026"), &TestCaptureMp2_64KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP2.4K.027"), &TestCaptureMp2_4KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEG.MP2.028"), &TestCaptureJpegMp2L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.EXIF.MP2.029"), &TestCaptureExifMp2L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.EXIF.SVGA.030"), &TestCaptureExifSVGAL ) );    
+#endif // MIRAGE_X_PROD7
+
+#if MIRAGE_X_PROD8
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.CODEC.031"), &TestCaptureCodecL ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.CODEC.032"), &TestCaptureCodec2L ) );
+#endif // MIRAGE_X_PROD8
+        
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGVGA90.008"), &TestCaptureQualityLevel0L ) );
+   
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGVGA50.009"), &TestCaptureQualityLevel1L ) );
+
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGQQVGA90.010"), &TestCaptureQualityLevel2L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURECAPTURE.001"), &TestCaptureCaptureL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURECAPTURE.002"), &TestCaptureCaptureSpecPrepL ) );
+    
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.001"), &TestPrepareStillCapture0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.002"), &TestPrepareStillCapture1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.003"), &TestPrepareStillCapture2L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.004"), &TestPrepareStillCapture0WhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.007"), &TestSpecPrepareSCSupportedFormatWhenInitializedL ) );
+    
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.001"), &TestPrepareVideoRecording0L ) );
+
+#if !( (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.002"), &TestPrepareVideoRecording1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.003"), &TestPrepareVideoRecording2L ) );    
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.004"), &TestPrepareVideoRecording0WhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.007"), &TestSpecPrepareVRSupportedFormatWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.001"), &TestRecordQualityLevel0L ) );  
+
+#if !( (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.002"), &TestRecordQualityLevel1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.003"), &TestRecordQualityLevel2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.001"), &TestStartAndStopVideoRecordingSubQcifL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.002"), &TestStartAndStopVideoRecordingQcifL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.001"), &TestSCDigiZoomVal0L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.002_vga"), &TestSCDigiZoomVal1VgaL ) );
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.002_qqvga"), &TestSCDigiZoomVal1QqvgaL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.005"), &TestSCDigiZoomInitializedVal0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.012_vga"), &TestSCDigiZoomInitializedVal1VgaL ) );
+
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.012_qqvga"), &TestSCDigiZoomInitializedVal1QqvgaL ) );
+#endif
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.006"), &TestVRDigiZoomVal0L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.007"), &TestVRDigiZoomVal1L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.010"), &TestVRDigiZoomRecordingVal0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.011"), &TestVRDigiZoomRecordingVal1L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.001"), &TestRecordPauseResumeStopL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.001"), &TestSCExposureMode0L ) );
+
+#if !MIRAGE_X_PROD6 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.002"), &TestSCExposureMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.016"), &TestSCExposureModeInitialized1L ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.015"), &TestSCExposureModeInitialized0L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+#if !MIRAGE_X_PROD6 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.008"), &TestVRExposureMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.009"), &TestVRExposureMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.018"), &TestVRExposureModeRecording1L ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.017"), &TestVRExposureModeRecording0L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.001"), &TestSCEvCompensation0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.002"), &TestSCEvCompensationMaxL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.003"), &TestSCEvCompensationMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.004"), &TestSCEvCompensationInitialized0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.005"), &TestSCEvCompensationInitializedMaxL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.006"), &TestSCEvCompensationInitializedMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.007"), &TestSCEvCompensationInitializedInvalidL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEVCOMP.001"), &TestVREvCompensationMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEVCOMP.002"), &TestVREvCompensationRecordingMaxL ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.001"), &TestSCWhiteBalanceMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.019"), &TestSCWhiteBalanceModeInitialized0L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.010"), &TestVRWhiteBalanceMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.020"), &TestVRWhiteBalanceModeRecording0L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.001"), &TestSCBrightness50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.007"), &TestSCBrightnessInitialized50L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.008"), &TestVRBrightness50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.014"), &TestVRBrightnessRecording50L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.001"), &TestSCContrast50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.007"), &TestSCContrastInitialized50L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.008"), &TestVRContrast50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.014"), &TestVRContrastRecording50L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.002"), &TestVideoClipMaxSize10000L ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CANCELCAPTURESTILL.001"), &TestCancelCaptureStillL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.GETSTILLQUALITYINDEX.001"), &TestGetStillQualityIndexWhenEngineInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.GETSTILLQUALITYINDEX.002"), &TestGetStillQualityIndexWhenPreparedL ) );
+    
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.GETVIDEOQUALITYINDEX.001"), &TestGetVideoQualityIndexWhenEngineInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.GETVIDEOQUALITYINDEX.002"), &TestGetVideoQualityIndexWhenPreparedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.REMAININGVIDEORECORDINGTIME.001"), &TestRemainingTimeWhenVideoPreparedL ) );
+    
+//    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVRTOOBIGSIZE.SUBQCIF.001"), &TestStartAndStopVRWhenTooBigSizeSubQcifL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.001"), &TestPrepareAudioBitRateVR5000L ) );
+
+#if (MIRAGE_X_PROD7)
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002"), &TestPrepareAudioBitRateVR128L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003"), &TestPrepareAudioBitRateVR128InvVtypeL ) );
+#endif
+
+#endif
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.001"), &TestCaptureStillBurst3L ) );   
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.0.002"), &TestCaptureStillBurst0L ) );
+
+//    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.100.003"), &TestCaptureStillBurst100L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.004"), &TestCancelCaptureStillBurst3L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.STOP2.005"), &TestStopCaptureStillBurstAfter2L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.006"), &TestSpecPrepCaptureStillBurst3L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.0.001"), &TestCaptureStillBurstInterval0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.1000000.002"), &TestCaptureStillBurstInterval1000000L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.M1.003"), &TestCaptureStillBurstIntervalM1L ) );
+#endif
+
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+
+#ifdef __CAMERA_BURST_MODE
+	// Exif burst test
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.3.001"), &TestCaptureStillBurstExif3L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.002"), &TestCaptureStillBurstExif6L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.100.003"), &TestCaptureStillBurstExif100L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.004"), &TestCaptureStillBurstExif6VfL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.CANCEL.005"), &TestCaptureStillBurstExif6VfCancelL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.006"), &TestCaptureStillBurstExif6NSL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.007"), &TestCaptureStillBurstExif6_ThumbnailL ) );
+#endif
+
+	// Exif tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.001"), &TestCaptureVgaExifL ) );	
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA.EXIF.002"), &TestCaptureQqvgaExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.003"), &TestCaptureVgaSnapOneHalfExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.004"), &TestCaptureVgaSnapOneFourthExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.005"), &TestCaptureVgaSnapOneEighthExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.006"), &TestCaptureVgaSnapExifL ) );
+
+    // Jpeg tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.JPEG.007"), &TestCaptureVgaSnapOneEighthJpegL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.008"), &TestCaptureVgaSnapOneEighthExif2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.009"), &TestCaptureVgaSnapColor16MExifL ) );
+#endif // (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+
+    // Test cases for snap-image creation switched off.
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA16M.015"), &TestCaptureVga16M_NoSnapL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGVGA90.016"), &TestCaptureQualityLevel0_NoSnapL ) );
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+    // Exif tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.017"), &TestCaptureVgaExif_NoSnapL ) );	
+#endif
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.007"), &TestCaptureStillBurst3_NoSnapL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.008"), &TestSpecPrepCaptureStillBurst3_NoSnapL ) );
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+    // Exif tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.3.004"), &TestCaptureStillBurstExif3_NoSnapL ) );
+#endif
+#endif // __CAMERA_BURST_MODE
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.ENUMERATE.001"), &TestEnumerateCaptureSizesL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETJPEGQUALITY.001"), &TestSetJpegQuality50L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.CUSTOMINTERFACE.001"), &TestSCCustomInterfaceL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.001"), &TestFlashMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.002"), &TestFlashMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.003"), &TestFlashMode2L ) );
+
+#if COLOR_TONE_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.001"), &TestSCColorToneNormalL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.002"), &TestSCColorToneSepiaL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.003"), &TestSCColorToneGrayscaleL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.004"), &TestSCColorToneNegativeL ) );
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.COLORTONE.005"), &TestVRColorToneL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.006"), &TestSCColorToneWrongParams1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.007"), &TestSCColorToneWrongParams2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.008"), &TestSCColorToneReleaseL ) );
+#endif // COLOR_TONE_TEST_CASES
+
+//#if (MIRAGE_X_PROD7)
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SETDISPLAYINDEX.001"), &TestSetDisplayIndexL ) );
+//#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.POWEROFF.001"), &TestCaptureAfterPowerOffL ) );
+
+    // new tests after 3.2
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.ENUMERATEVIDEOFRAMESIZE.001"), &TestEnumerateVideoFrameSize001L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.CCAMERAHANDLE.001"), &TestCCameraHandleL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtViewFinderFrameReadyL.001"), &TestProcessExtViewFinderFrameReadyL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtSnapImageL.001"), &TestProcessExtSnapImageL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.001"), &TestProcessExtCapturedImageL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.002"), &TestProcessExtCapturedImage2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.003"), &TestProcessExtCapturedImage3L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.004"), &TestProcessExtCapturedImage4L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCancel.001"), &TestProcessExtCancelL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCancel.002"), &TestProcessExtCancel2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageBurstL.001"), &TestProcessExtCapturedImageBurstL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageBurstL.002"), &TestProcessExtCapturedImageBurst2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.InstalledExtensionList.001"), &TestInstalledExtensionListL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SkippedExtensionListL.001"), &TestSkippedExtensionListL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SetSkippedExtensionList.001"), &TestSetSkippedExtensionListL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.NOINIT.001"), &TestStartAndStopVideoRecordingSubQcifNoInitL ) );
+#endif
+
+#if ( ((MIRAGE_X_PROD9) || (HW_DEVLON)) && (SECONDARY_CAMERA_TEST_CASES) ) 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SecondaryCamera.001"), &TestSecondaryCamera001L ) );
+#endif
+
+    // Asynchronous video stop test cases
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.AsyncStop.001"), &TestRecordAsyncStop001L ) );  
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.AsyncStop.002"), &TestRecordAsyncStop002L ) );  
+
+    return suite;
+    }
+
+#else
+
+
+MTest* CCaeTestRelease::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestRelease") );
+
+    
+    return suite;
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestSettingsClient.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1597 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestSettingsClient.cpp
+*
+*/
+#include <fbs.h>
+
+#include "CaeTestSettingsClient.h"
+//#include "mmcleanup.h"
+
+//_LIT8(KVideoMimeType, "video/3gpp");
+//_LIT(KVideoPreferredSupplier, "Nokia");
+//_LIT8(KVideoType, "video/H263-2000");
+//_LIT8(KVideoAudioType, " AMR");
+
+const TUid KSdUidQltyLevels = {KNullUidValue};
+const TUid KSdIllegalUidQltyLevels = {666};
+
+CCaeTestSettingsClient::CCaeTestSettingsClient() 
+    {
+    }
+
+
+CCaeTestSettingsClient::~CCaeTestSettingsClient()
+    {
+    }
+
+
+CCaeTestSettingsClient* CCaeTestSettingsClient::NewL()
+    {
+    CCaeTestSettingsClient* self = new(ELeave) CCaeTestSettingsClient;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CCaeTestSettingsClient::ConstructL()
+    {
+    CCaeTestClient::ConstructL();
+
+    iRunWithViewFinder = EFalse;
+    }
+
+
+void CCaeTestSettingsClient::RunTestActionL( TestClientActions aAction )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestVideoSettingsClient::RunTestActionL() entering" ) );
+    #endif
+    
+    iAction = aAction;
+	iSavedAction = aAction;
+
+    // Initialize all state variables.
+    InitStateVariables();
+
+    iCamAppEngine->InitL( KSdUidQltyLevels );
+
+	// Main part of program is a wait loop.
+	// This function completes when the scheduler stops.
+	CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTestActionL() leaving (error detected)" ) );
+        #endif
+        User::Leave( iError );
+        }
+	
+    #ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTestActionL() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestSettingsClient::RunTrappedL()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTrappedL() entering" ) );
+    #endif
+
+    if ( iStop ) 
+        {
+        if ( iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StopViewFinder();
+            iViewFinderStarted = EFalse;
+            }
+        iCamAppEngine->CancelCaptureStill();
+        iCamAppEngine->CloseVideoRecording();
+        delete iBitmapSave;
+        iBitmapSave = NULL;
+        delete iDataSave;
+        iDataSave = NULL;
+        CActiveScheduler::Stop();
+        }
+    else if ( iInitReady ) 
+		{
+        
+        if ( iAction != ESetVideoFileNameWhenNotInitialized &&
+             iAction != ESetAudioWhenVideoNotInitialized &&
+             iAction != ESetClipMaxSizeWhenVideoNotInitialized &&
+             iAction != EGetAudioWhenVideoNotInitialized )
+            {
+            iCamAppEngine->InitVideoRecorderL( KSdUidQltyLevels );
+            }
+
+        User::After( 1000000 ); // Give some time for camera drivers to settle.
+
+        switch ( iAction )
+            {
+            case EGetInfo:
+                iCamAppEngine->GetInfo( iInfo );
+                iStop = ETrue;
+                break;
+            case ESetVideoFileNameWhenInitialized:
+            case ESetVideoFileNameWhenNotInitialized:
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iStop = ETrue;
+                break;
+            case ESetEmptyVideoFileNameWhenInitialized:
+                iCamAppEngine->SetVideoRecordingFileNameL( _L("") );
+                iStop = ETrue;
+                break;
+            case ESetDigiZoomWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                break;
+            case ESetBrightnessWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenInitialized:
+                {
+                iAction = EDefault;
+
+                //Test before setting, value is unknown?
+                TInt contrast = iCamAppEngine->Contrast();
+
+                iCamAppEngine->SetContrastL( iContrast );
+
+                //Test immediately that value is right
+                contrast = iCamAppEngine->Contrast();
+                if ( contrast != iContrast )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetExposureModeWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenInitialized:
+                {
+                // Read value before setting, should be zero if not supported
+                TInt evCompensation = iCamAppEngine->EvCompensation();
+                if ( evCompensation != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                }
+                break;
+            case ESetWhiteBalanceModeWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case EResetToDefaults:
+                // iAction = EDefault;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                if ( TCameraInfo::EBrightnessSupported & iInfo.iOptionsSupported )
+		            {
+                    iCamAppEngine->SetBrightnessL( iBrightness );
+                    }
+                if ( TCameraInfo::EContrastSupported & iInfo.iOptionsSupported )
+		            {
+                    iCamAppEngine->SetContrastL( iContrast );
+                    }
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetViewFinderMirror:
+                {
+                TBool mirrorVF = iCamAppEngine->ViewFinderMirror();
+                if ( mirrorVF )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                iAction = EDefault;
+                iCamAppEngine->SetViewFinderMirrorL( ETrue );
+                break;
+            case EGetStillFrameSizeWhenInitialized:
+                // Test with invalid quality level index.
+                iCamAppEngine->GetStillFrameSize( -1, iStillFrameSizeSet );
+                iCamAppEngine->GetStillFrameSize( 666, iStillFrameSizeSet );
+                // Test with valid quality level index.
+                iCamAppEngine->GetStillFrameSize( iStillQualityLevelIndex, iStillFrameSizeSet );
+                iStop = ETrue;
+                break;
+            case EEstimatedStillSizeInBytesWhenInitialized:
+                // Test with invalid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( -1 );
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( 666 );
+                // Test with valid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( iStillQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case EGetVideoFrameSizeWhenInitialized:
+                {
+                // test first with invalid index values: negative and too big, should not modify data
+                    TSize tempFrameSize1( KImgWidthQCIF, KImgHeightQCIF );
+                    TSize tempFrameSize2( KImgWidthQCIF, KImgHeightQCIF );
+
+                    iCamAppEngine->GetVideoFrameSize( -1, tempFrameSize1 );
+                    if ( tempFrameSize1 != tempFrameSize2 )
+                        {
+                        User::Leave ( KErrArgument );
+                        }
+                    iCamAppEngine->GetVideoFrameSize( 666, tempFrameSize1 );
+                    if ( tempFrameSize1 != tempFrameSize2 )
+                        {
+                        User::Leave ( KErrArgument );
+                        }
+                    iCamAppEngine->GetVideoFrameSize( iVideoQualityLevelIndex, iVideoFrameSizeSet );
+                    iStop = ETrue;
+                }
+                break;
+            case EVideoFrameRateWhenInitialized:
+                {
+                // test first with invalid index values: negative and too big, should return 0
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( -1 );
+                if ( iVideoFrameRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( 666 );
+                if ( iVideoFrameRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                }
+                break;
+            case EEstimatedVideoRecordingBitRateWhenInitialized:
+                // test first with invalid index values: negative and too big, should return 0
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( -1 );
+                if ( iEstimatedVideoBitRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( 666 );
+                if ( iEstimatedVideoBitRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case ESetClipMaxSizeWhenVideoNotPrepared:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            /*
+            case EPrepareAndSetStillBurstCaptureInterval:
+                iAction = EDefault;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+			    break;
+            */
+            case EInitUid:
+                iCamAppEngine->InitL( KSdIllegalUidQltyLevels );// will leave
+                iStop = ETrue;
+                break;
+            case ESetAudioWhenVideoNotInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
+                break;
+            case ESetClipMaxSizeWhenVideoNotInitialized:
+                iAction = ENone;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            case EGetAudioWhenVideoNotInitialized:
+                {
+                iStop = ETrue;
+                TBool audio = iCamAppEngine->VideoAudio();
+                if ( audio != EFalse )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                }
+                break;
+            case EEnumerateVideoFrameSize:
+                {
+                iStop = ETrue;
+                TInt enumIndVGA;
+                TInt enumIndCIF;
+                TInt enumIndQCIF;
+                TInt enumIndBIG;
+                TInt enumIndZERO;
+                TSize sizeVGA( KImgWidthVGA, KImgHeightVGA );
+                TSize sizeCIF( KImgWidthCIF, KImgHeightCIF );
+                TSize sizeQCIF( KImgWidthQCIF, KImgHeightQCIF );
+                TSize sizeBIG( KImgWidthTooBig, KImgHeightTooBig );
+                TSize sizeZERO( 0, 0 );
+
+                enumIndVGA  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeVGA );
+                enumIndCIF  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeCIF );
+                enumIndQCIF = iCamAppEngine->EnumerateVideoFrameSizeL( sizeQCIF );
+                enumIndBIG  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeBIG );
+                enumIndZERO = iCamAppEngine->EnumerateVideoFrameSizeL( sizeZERO );
+
+                if ( ( enumIndVGA < 0 && enumIndCIF < 0 && enumIndQCIF < 0 ) ||
+                    enumIndBIG >= 0 || enumIndZERO >= 0 )
+                    {
+                    User::Leave ( KErrNotSupported );
+                    }
+                }
+                break;
+                
+            case EInstalledExtensionList:
+                {
+                RCaeOrderedFeatureList installedExtensions1;
+                RCaeOrderedFeatureList installedExtensions2;
+                TCaeOrderedFeatureListItem item;
+
+                // call the get function
+                iCamAppEngine->GetOrderL( installedExtensions1 );
+
+                // test that cae resets the parameter before usage
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                installedExtensions2.Append( item );
+                iCamAppEngine->GetOrderL( installedExtensions2 );
+                
+                // Check that the both arrays are the same
+                if ( installedExtensions1.Count() != installedExtensions2.Count() )
+                    {
+                    installedExtensions1.Reset();
+                    installedExtensions2.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
+                    User::Leave ( KErrArgument );
+                    }
+                for(TInt i=0; i < installedExtensions1.Count(); i++ )
+                    {
+                    if ( installedExtensions1[i].iServiceUid != installedExtensions2[i].iServiceUid ||
+                        installedExtensions1[i].iFeatureUid != installedExtensions2[i].iFeatureUid )
+                        {
+                        installedExtensions1.Reset();
+                        installedExtensions2.Reset();
+                        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE the array is not same" ) );
+                        User::Leave ( KErrArgument );
+                        }
+                    }
+                installedExtensions1.Reset();
+                installedExtensions2.Reset();
+                iStop = ETrue;
+                }
+                break;
+
+            case ESkippedExtensionList:
+                {
+                RCaeOrderedFeatureList skippedExtensions1;
+                RCaeOrderedFeatureList skippedExtensions2;
+                TCaeOrderedFeatureListItem item;
+                // call get function twice
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                // test that cae resets non-empty parameter
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                skippedExtensions2.Append( item );
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions2 );
+                // Check that the both arrays are the same
+                if ( skippedExtensions1.Count() != skippedExtensions2.Count() )
+                    {
+                    skippedExtensions1.Reset();
+                    skippedExtensions2.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
+                    User::Leave ( KErrArgument );
+                    }
+                for(TInt i=0; i < skippedExtensions1.Count(); i++ )
+                    {
+                    if ( skippedExtensions1[i].iServiceUid != skippedExtensions2[i].iServiceUid ||
+                        skippedExtensions1[i].iFeatureUid != skippedExtensions2[i].iFeatureUid )
+                        {
+                        skippedExtensions1.Reset();
+                        skippedExtensions2.Reset();
+                        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: array is not same" ) );
+                        User::Leave ( KErrArgument );
+                        }
+                    }
+                skippedExtensions1.Reset();
+                skippedExtensions2.Reset();
+                iStop = ETrue;
+                }
+                break;
+                
+            case ESetSkippedExtensionList:
+                {
+                RCaeOrderedFeatureList skippedExtensions1;
+                RCaeOrderedFeatureList skippedExtensions2;
+                TCaeOrderedFeatureListItem item;
+
+                // call set function twice
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                
+                // read and verify
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                if ( skippedExtensions1.Count() != 0 )
+                    {
+                    skippedExtensions1.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: get/set error" ) );
+                    User::Leave ( KErrArgument );
+                    }
+
+                // Add one UID
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                skippedExtensions1.Append( item );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                
+                // read and verify
+                skippedExtensions1.Reset();
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                if ( skippedExtensions1.Count() != 0 )
+                    {
+                    skippedExtensions1.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: set inv. error" ) );
+                    User::Leave ( KErrArgument );
+                    }
+
+                // call the get function to get installed extensions
+                iCamAppEngine->GetOrderL( skippedExtensions1 );
+
+                // Add one invalid UID and set all skipped
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                skippedExtensions1.Append( item );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+
+                // read and verify that both arrays are the same
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                iCamAppEngine->GetOrderL( skippedExtensions2 );
+
+                // Check that the both arrays are the same
+                if ( skippedExtensions1.Count() != skippedExtensions2.Count() )
+                    {
+                    skippedExtensions1.Reset();
+                    skippedExtensions2.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
+                    User::Leave ( KErrArgument );
+                    }
+                for(TInt i=0; i < skippedExtensions1.Count(); i++ )
+                    {
+                    if ( skippedExtensions1[i].iServiceUid != skippedExtensions2[i].iServiceUid ||
+                        skippedExtensions1[i].iFeatureUid != skippedExtensions2[i].iFeatureUid )
+                        {
+                        skippedExtensions1.Reset();
+                        skippedExtensions2.Reset();
+                        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: array is not same" ) );
+                        User::Leave ( KErrArgument );
+                        }
+                    }
+
+                skippedExtensions1.Reset();
+                skippedExtensions2.Reset();
+                iStop = ETrue;
+                }
+                break;
+
+            default:
+                 //iVideoRecordingOn = EFalse;
+                 //iCamAppEngine->StopVideoRecording();
+                break;
+            }
+
+        User::After( 1000000 ); // Give some time for camera drivers to settle.
+        
+        if ( ( iAction != ENone ) && !iStop)
+            {
+            iInitReady = EFalse;
+            iViewFinderStarted = EFalse;
+            iStillPrepareReady = EFalse;
+            iVideoPrepareReady = EFalse;
+            switch ( iOpMode )
+                {
+                case EClientOpModeStill:
+					switch ( iAction )
+						{
+						case ESetEvCompensationWhenInitialized:
+						case ESetEvCompensationWhenStillPrepared:
+						case ESetJpegQualityWhenStillPrepared:
+						case EProcessExtCapturedImageBurst:
+						case EProcessExtCapturedImageBurstTDesC8:
+							if ( iAction == ESetEvCompensationWhenInitialized )
+								{
+								iAction = EDefault;
+								}
+							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+																 iStillDataFormat, 
+																 iStillCompressionQuality );
+							break;
+						case ESetSnapImageSizeBeforePrepare:
+							iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
+							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+																 iStillDataFormat, 
+																 iStillCompressionQuality );
+							break;
+						case ESetSnapImageSizeDuringAndAfterPrepare:
+							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+																 iStillDataFormat, 
+																 iStillCompressionQuality,
+																 TRect(),
+																 iSnapImageSize );
+							break;
+		    			case ESetJpegCodecWhenStillPrepared: 
+                			iCamAppEngine->SetImageCodecsL( iImageDecoderUid, iImageEncoderUid );
+                			iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     			 iStillDataFormat, 
+                                                     			 iStillCompressionQuality );
+			    			break;
+						default:
+							iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+							break;
+						}
+			        break;
+                case EClientOpModeVideo:
+                    iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+			        break;
+                default:
+                    User::Leave( KErrNotSupported );
+                    break;
+               }
+            }
+        else
+            {
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+    else if ( iStillPrepareReady ) 
+		{
+
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            // User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+        iStillPrepareReady = EFalse;
+
+	    TBool capture = EFalse;
+
+        switch ( iAction )
+            {
+            case ESetDigiZoomWhenStillPrepared:
+                {
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                /*TInt zoomValue1 =*/ iCamAppEngine->ZoomValue();
+				iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                /*TInt zoomValue2 =*/ iCamAppEngine->ZoomValue();
+                }
+                break;
+            case ESetBrightnessWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetContrastL( iContrast );
+                break;
+            case ESetExposureModeWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                break;
+            case ESetWhiteBalanceModeWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetJpegQualityWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+                iCamAppEngine->SetJpegQuality( iStillCompressionQuality );
+#endif
+                break;
+            case EResetToDefaults:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->ResetToDefaultsL();
+                {
+                CCaeEngine::TZoomMode zoomModeR = iCamAppEngine->ZoomMode();
+                if ( zoomModeR != CCaeEngine::EZoomModeDigital )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt zoomValueR = iCamAppEngine->ZoomValue();
+                if ( zoomValueR != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt brightnessR = iCamAppEngine->Brightness();
+                if ( brightnessR != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt contrastR = iCamAppEngine->Contrast();
+                if ( contrastR != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt exposuremodeR = iCamAppEngine->ExposureMode();
+                if ( exposuremodeR != CCamera::EExposureAuto )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt whitebalancemodeR = iCamAppEngine->WhiteBalanceMode();
+                if ( whitebalancemodeR != CCamera::EWBAuto )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt flashmodeR = iCamAppEngine->FlashMode();
+                if ( flashmodeR != CCamera::EFlashNone )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetViewFinderMirror:
+                {
+                iAction = EDefault;
+                TBool mirrorVF = iCamAppEngine->ViewFinderMirror();
+                capture = ETrue;
+                if ( !mirrorVF )
+                    {
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case EGetStillFrameSizeWhenPrepared:
+                // Test with invalid quality level index.
+                iCamAppEngine->GetStillFrameSize( -1, iStillFrameSizeSet );
+                iCamAppEngine->GetStillFrameSize( 666, iStillFrameSizeSet );
+                // Test with valid quality level index.
+                iCamAppEngine->GetStillFrameSize( iStillQualityLevelIndex, iStillFrameSizeSet );
+                iStop = ETrue;
+                break;
+            case ESetSnapImageSizeDuringAndAfterPrepare:
+				iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
+                capture = ETrue;
+                break;
+            case EEstimatedStillSizeInBytesWhenPrepared:
+                // Test with invalid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( -1 );
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( 666 );
+                // Test with valid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( iStillQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case EPrepareAndSetStillBurstCaptureInterval:
+                {
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                iCamAppEngine->SetStillBurstCaptureIntervalL( iStillBurstCaptureInterval );
+                /*TInt imgCount =*/ iCamAppEngine->StillCaptureImageCount();
+                capture = ETrue;
+                // "prepare-version" of burst mode
+                // iCamAppEngine->PrepareStillBurstL( iStillBurstLength );
+                }
+                break;
+            default:
+                capture = ETrue;
+                break;
+            }
+
+        if ( capture )
+			{
+            iStillCaptureReady = EFalse;
+            iStillCapturingOn = ETrue;
+            iStillCaptured = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->CaptureStill()" ) );
+            #endif
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+			iCamAppEngine->CaptureStill();
+			}
+        else 
+            {
+            CTimer::After( KNormalTimingDelay );
+            }
+        
+		}
+    else if ( iVideoPrepareReady ) 
+		{
+
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            // User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+		TBool record( EFalse );
+
+        iVideoPrepareReady = EFalse;
+
+        switch ( iAction )
+            {
+            case ESetDigiZoomWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                break;
+            case ESetBrightnessWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetContrastL( iContrast );
+                break;
+            case ESetExposureModeWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                break;
+            case ESetWhiteBalanceModeWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetVideoTimesIntervalWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetVideoTimesIntervalL( iVideoTimesInterval );
+                break;
+            case ESetVideoFileNameWhenPrepared:
+                iAction = EDefault;
+                iCamAppEngine->StopViewFinder();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+			    break;
+            case ESetClipMaxSizeWhenVideoPrepared:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            case ESetAudioWhenVideoPrepared:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
+                break;
+            case EGetVideoFrameSizeWhenPrepared:
+                iCamAppEngine->GetVideoFrameSize( iVideoQualityLevelIndex, iVideoFrameSizeSet );
+                iStop = ETrue;
+                break;
+            case EVideoFrameRateWhenPrepared:
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case EEstimatedVideoRecordingBitRateWhenPrepared:
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            default:
+                // iVideoPrepareReady = EFalse;
+                record = ETrue;
+                break;
+            }
+        /*
+        iVideoRecordingReady = EFalse;
+        iVideoRecordingOn = EFalse;
+        iVideoRecorded = ETrue;
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StartVideoRecording()" ) );
+        #endif
+		iCamAppEngine->StartVideoRecording();
+        */
+        if ( record )
+			{
+            iVideoRecordingReady = EFalse;
+            iVideoRecordingOn = EFalse;
+            iVideoRecorded = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StartVideoRecording()" ) );
+            #endif
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+			iCamAppEngine->StartVideoRecording();
+			}
+        else if ( iAction != EDefault ) 
+            {
+            CTimer::After( KNormalTimingDelay );
+            }
+		}
+	else if ( iSnapImageReady )
+	    {
+	    iSnapImageReady = EFalse;
+	    }
+	else if ( iStillCaptureReady )
+	    {
+        // Check here if the settings were taken into use.
+        // (For settings with a get-method.)
+        switch ( iSavedAction )
+            {
+            case ESetDigiZoomWhenStillPrepared:
+            case ESetDigiZoomWhenInitialized:
+                {
+                CCaeEngine::TZoomMode zoomMode = iCamAppEngine->ZoomMode();
+                if ( zoomMode != CCaeEngine::EZoomModeDigital )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt zoomValue = iCamAppEngine->ZoomValue();
+                if ( zoomValue != iDigiZoomValue )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetBrightnessWhenStillPrepared:
+            case ESetBrightnessWhenInitialized:
+                {
+                TInt brightness = iCamAppEngine->Brightness();
+                if ( brightness != iBrightness )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetContrastWhenStillPrepared:
+            case ESetContrastWhenInitialized:
+                {
+                TInt contrast = iCamAppEngine->Contrast();
+                if ( contrast != iContrast )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+
+                // Test poweroff case, contrast should be 0
+                iCamAppEngine->PowerOff();
+                contrast = iCamAppEngine->Contrast();
+                if ( contrast != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                }
+                break;
+            case ESetExposureModeWhenStillPrepared:
+            case ESetExposureModeWhenInitialized:
+                {
+                TInt exposuremode = iCamAppEngine->ExposureMode();
+                if ( exposuremode != iExposureMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetEvCompensationWhenStillPrepared:
+            case ESetEvCompensationWhenInitialized:
+                {
+                TInt evCompensation = iCamAppEngine->EvCompensation();
+                if ( evCompensation != iEvCompensation )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetJpegQualityWhenStillPrepared:
+                {
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+                TInt jpegQuality = iCamAppEngine->JpegQuality();
+                if ( ( iStillCompressionQuality >= 1 ) && ( iStillCompressionQuality <= 100 ) )
+                    {
+                    if ( jpegQuality != iStillCompressionQuality )
+                        {
+                        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                        }
+                    }
+                else
+                    {
+                    // Test clamping to the range 1-100.
+                    if ( iStillCompressionQuality < 1 )
+                        {
+                        if ( jpegQuality != 1 )
+                            {
+                            User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                            }
+                        }
+                    else if ( iStillCompressionQuality > 100 )
+                        {
+                        if ( jpegQuality != 100 )
+                            {
+                            User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                            }
+                        }
+                    }
+#endif
+                }
+                break;            
+            case ESetWhiteBalanceModeWhenStillPrepared:
+            case ESetWhiteBalanceModeWhenInitialized:
+                {
+                TInt whitebalancemode = iCamAppEngine->WhiteBalanceMode();
+                if ( whitebalancemode != iWhiteBalanceMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetFlashModeWhenStillPrepared:
+            case ESetFlashModeWhenInitialized:
+                {
+                TInt flashmode = iCamAppEngine->FlashMode();
+                if ( flashmode != iFlashMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case EPrepareAndSetStillBurstCaptureInterval:
+                break;
+            default:
+                break;
+            }
+
+        iStillCaptureReady = EFalse;
+        
+	    // #ifdef _DEBUG
+        // RDebug::Print( _L( "Cae: CCaeTestStillSettingsClient: calling iCamAppEngine->StartViewFinderBitmapsL()" ) );
+        // #endif
+        // iViewFindingUsed = ETrue;
+        // iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+
+        if ( iAction == EProcessExtViewFinderFrameReady ||
+            iAction == EProcessExtSnapImage ||
+            iAction == EProcessExtCapturedImage ||
+            iAction == EProcessExtCapturedImageTDesC8 ||
+            iAction == EProcessExtCapturedImageCFbsBitmap ||
+            iAction == EProcessExtCapturedImageBurst ||
+            iAction == EProcessExtCapturedImageBurstTDesC8 ||
+            iAction == EProcessExtCancel ||
+            iAction == EProcessExtCancel2 )
+            {
+            if ( iAction == EProcessExtCapturedImageTDesC8 )
+                {
+                // Test also that release should not stop the extension mode operation
+                iCamAppEngine->Release();
+                }
+            iCamAppEngine->SetCaeExtensionModeL( ETrue, EFalse );
+            iExtensionMode = ETrue;
+            CTimer::After( iTimeout );
+            }
+        else if ( iAction == EProcessExtCapturedImageNoInit )
+            {
+            // test images are captured now, delete observer1 engine and create a new
+            delete iCamAppEngine;
+            iCamAppEngine = NULL;
+            iCamAppEngine = CCaeEngine::NewL( 0 );
+            iCamAppEngine->SetCamAppEngineObserver( *this );
+            iCamAppEngine->SetCaeStillBurstObserver( *this );
+        	iCamAppEngine->GetInfo( iInfo );
+        
+            // Move cae to extension mode without initl or prepare call    
+            iCamAppEngine->SetCaeExtensionModeL( ETrue, EFalse );
+            iExtensionMode = ETrue;
+            CTimer::After( iTimeout );
+            }
+        else if ( iStillBurstLength == 1 )
+            {
+            iStop = ETrue;
+            CTimer::After( iTimeout );
+            }
+	    }
+
+	else if ( iStillBurstReady )
+	    {
+        iStillBurstReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndSetStillBurstCaptureInterval:
+		    default:
+                iAction = ENone;
+                {
+                TTimeIntervalMicroSeconds stillburstcaptureinterval = 
+                iCamAppEngine->StillBurstCaptureInterval();
+                if ( stillburstcaptureinterval != iStillBurstCaptureInterval )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    }
+        }
+
+	else if ( iVideoRecordingOn )
+	    {
+        switch ( iAction )
+            {
+            case ESetDigiZoomWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                break;
+            case ESetBrightnessWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetContrastL( iContrast );
+                break;
+            case ESetExposureModeWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                break;
+            case ESetWhiteBalanceModeWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetVideoTimesIntervalWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoTimesIntervalL( iVideoTimesInterval );
+                break;
+            case ESetClipMaxSizeWhenVideoRecording:
+                iAction = ENone;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            case ESetAudioWhenVideoRecording:
+                iAction = ENone;
+                iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
+                break;
+            case ESetVideoFileNameWhenRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iStop = ETrue;
+                break;
+            case ESetVideoTimesIntervalWhenVideoPrepared:
+                iAction = ENone;
+                iVideoRecordingOn = EFalse;
+                iCamAppEngine->PauseVideoRecording();
+                break;
+
+            default:
+                iAction = ENone;
+                iVideoRecordingOn = EFalse;
+                iCamAppEngine->StopVideoRecording();
+                break;
+            }
+            
+        if ( iAction != ENone )
+            {
+            CTimer::After( iTimeout );
+            }
+	    }
+	else if ( iVideoRecordingPaused )
+	    {
+        iAction = ENone;
+        iVideoRecordingPaused = EFalse;
+        iCamAppEngine->ResumeVideoRecording();
+	    }
+	else if ( iVideoRecordingReady )
+	    {
+        // Check here if the settings were taken into use.
+        // (For settings with a get-method.)
+        switch ( iSavedAction )
+            {
+            case ESetDigiZoomWhenVideoPrepared:
+            case ESetDigiZoomWhenVideoRecording:
+                {
+                CCaeEngine::TZoomMode zoomMode = iCamAppEngine->ZoomMode();
+                if ( zoomMode != CCaeEngine::EZoomModeDigital )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt zoomValue = iCamAppEngine->ZoomValue();
+                if ( zoomValue != iDigiZoomValue )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetBrightnessWhenVideoPrepared:
+            case ESetBrightnessWhenVideoRecording:
+                {
+                TInt brightness = iCamAppEngine->Brightness();
+                if ( brightness != iBrightness )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+
+                // Test poweroff case, brightness should be 0
+                iCamAppEngine->PowerOff();
+                brightness = iCamAppEngine->Brightness();
+                if ( brightness != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                }
+                break;
+            case ESetContrastWhenVideoPrepared:
+            case ESetContrastWhenVideoRecording:
+                {
+                TInt contrast = iCamAppEngine->Contrast();
+                if ( contrast != iContrast )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetExposureModeWhenVideoPrepared:
+            case ESetExposureModeWhenVideoRecording:
+                {
+                TInt exposuremode = iCamAppEngine->ExposureMode();
+                if ( exposuremode != iExposureMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetEvCompensationWhenVideoPrepared:
+            case ESetEvCompensationWhenVideoRecording:
+                {
+                TInt evCompensation = iCamAppEngine->EvCompensation();
+                if ( evCompensation != iEvCompensation )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetWhiteBalanceModeWhenVideoPrepared:
+            case ESetWhiteBalanceModeWhenVideoRecording:
+                {
+                TInt whitebalancemode = iCamAppEngine->WhiteBalanceMode();
+                if ( whitebalancemode != iWhiteBalanceMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetFlashModeWhenVideoPrepared:
+            case ESetFlashModeWhenVideoRecording:
+                {
+                TInt flashmode = iCamAppEngine->FlashMode();
+                if ( flashmode != iFlashMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetClipMaxSizeWhenVideoNotPrepared:
+            case ESetClipMaxSizeWhenVideoPrepared:
+                {
+                TInt clipmaxsize = iCamAppEngine->VideoClipMaxSize();
+                if ( iVideoMaxClipSizeInBytes >= 0 )
+                    {
+                    if ( clipmaxsize != iVideoMaxClipSizeInBytes )
+                        {
+                        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                        }
+                    }
+                else
+                    {
+                    if ( clipmaxsize != 0 )
+                        {
+                        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                        }
+                    }
+                }
+                break;
+            case ESetAudioWhenVideoPrepared:
+                {
+                TBool audio = iCamAppEngine->VideoAudio();
+                if ( audio != iVideoAudioEnabled )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetVideoTimesIntervalWhenVideoPrepared:
+                {
+                TTimeIntervalMicroSeconds timesinterval = 
+                    iCamAppEngine->VideoTimesInterval();
+                if ( timesinterval != iVideoTimesInterval )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            default:
+                break;
+            }
+
+		iAction = ENone;
+        iVideoRecordingReady = EFalse;
+        iStopViewFinder = ETrue;
+        CTimer::After( KNormalTimingDelay );
+
+	    }
+    else if ( !iStillCaptured && !iVideoRecorded && 
+              !iVideoRecordingOn && !iStopViewFinder ) 
+        {
+        switch ( iAction )
+		    {
+            case EStartVfPrepareCaptureStillStartAndStopVf:
+                if ( !iStillPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->PrepareStillCaptureL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                break;
+            case EStartVfPrepareRecordVideoStartAndStopVf:
+                if ( !iVideoPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->PrepareVideoRecordingL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                break;
+            case ESwitchPowerOffWhenVfRunning:
+                iCamAppEngine->PowerOff();
+                iStopViewFinder = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            default:
+			    break;
+		    }
+        }
+	else if ( iStopViewFinder ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StopViewFinder()" ) );
+        #endif
+        iCamAppEngine->StopViewFinder();
+        iViewFinderStarted = EFalse;
+        iStop = ETrue;
+        CTimer::After( KNormalTimingDelay );
+        }
+	else if ( iExtensionMode ) 
+        {
+        switch ( iAction )
+		    {
+            case EProcessExtViewFinderFrameReady:
+            if ( !iBitmapSendDone && iBitmapSave )
+                {
+                // send the original bitmap to ext handling
+                // before sending the iBitmapSave bust be cleared because callback
+                // writes the handled bitmap back there
+                iBitmapSendDone = ETrue;
+                CFbsBitmap* tempBitmap = iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->ProcessExtViewFinderFrameReadyL( *tempBitmap );
+                // delete tempBitmap;
+                delete tempBitmap;
+                tempBitmap = NULL;
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is new handled bitmap
+                if ( !iBitmapSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after ProcessExtViewFinderFrameReadyL" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // bitmap, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                }
+
+                CTimer::After( KLongTimingDelay );
+                break;
+                
+            case EProcessExtSnapImage:
+            if ( !iBitmapSendDone && iBitmapSave )
+                {
+                // send the original snap bitmap to ext handling
+                // before sending the iBitmapSave bust be cleared because callback
+                // writes the handled bitmap back there
+                iBitmapSendDone = ETrue;
+                CFbsBitmap* tempBitmap = iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->ProcessExtSnapImageL( *tempBitmap );
+                // delete tempBitmap;
+                delete tempBitmap;
+                tempBitmap = NULL;
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is new handled bitmap
+                if ( !iBitmapSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after EProcessExtSnapImage" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // bitmap, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                }
+                break;
+                
+            case EProcessExtCapturedImage:
+            case EProcessExtCapturedImageTDesC8:
+		    case EProcessExtCapturedImageCFbsBitmap:
+            case EProcessExtCapturedImageNoInit:
+            if ( !iBitmapSendDone && iDataSave )
+                {
+                // send the original image to ext handling
+                // before sending the iDataSave must be cleared because callback
+                // writes the handled bitmap back there
+                // Note that iBitmapSendDone flag is used even though this there is no bitmap involved
+                iBitmapSendDone = ETrue;
+                HBufC8* tempData = iDataSave;
+                CleanupStack::PushL( tempData );
+                iDataSave = NULL;
+                if ( iAction == EProcessExtCapturedImage || iAction == EProcessExtCapturedImageNoInit)
+                    {
+                    // Test interface with HBufC8, CAE takes ownership of data
+                    iCamAppEngine->ProcessExtCapturedImageL( tempData, EFalse );
+                    }
+                else if ( iAction == EProcessExtCapturedImageTDesC8 )
+                    {
+                    // Test interface with TDesC8
+                    // Create new pointer
+                    TDesC8* tempDataDes = tempData;
+                    tempData = NULL;
+                    iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, EFalse );
+                    delete tempDataDes; // CAE makes own copy of this type
+                    tempDataDes = NULL;
+                    }
+                else if ( iAction == EProcessExtCapturedImageCFbsBitmap )
+                    {
+                    // Test interface with CFbsBitmap
+                    // Create new pointer
+
+                    CFbsBitmap* tempBitmap = iBitmapSave;
+                    CleanupStack::PushL( tempBitmap );
+                    iBitmapSave = NULL;
+                    delete tempData; // not used in this test case
+                    tempData = NULL;
+                    // CAE makes own copy of bitmap data (duplicate)
+                    iCamAppEngine->ProcessExtCapturedImageL( *tempBitmap, EFalse );
+                    CleanupStack::PopAndDestroy( tempBitmap );
+                    }
+                CleanupStack::Pop( /*tempData*/ );
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is new handled image
+                if ( !iDataSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCapturedImage" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // image data, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iDataSave;
+                iDataSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                }
+                break;
+                
+            case EProcessExtCancel:
+                iCamAppEngine->ProcessExtCancel();
+                iAction = EDefault;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                break;
+            case EProcessExtCancel2:
+
+                if ( iDataSave )
+                    {
+                    // send the original image to ext handling
+                    iBitmapSendDone = ETrue;
+                    HBufC8* tempData = iDataSave;
+                    iDataSave = NULL;
+                    // Test interface with TDesC8
+                    TDesC8* tempDataDes = tempData;
+                    tempData = NULL;
+                    iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, EFalse );
+                    delete tempDataDes; // CAE makes own copy of this type
+                    tempDataDes = NULL;
+                    }
+                else
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCancel2" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                
+                // Cancel image processing
+                iCamAppEngine->ProcessExtCancel();
+                
+                // return back to normal mode
+                iAction = EDefault;
+                delete iDataSave;
+                iDataSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                
+                // start timer as all activities are stopped
+                CTimer::After( KNormalTimingDelay );
+                break;
+
+            case EProcessExtCapturedImageBurst:
+            case EProcessExtCapturedImageBurstTDesC8:
+            if ( !iBitmapSendDone && iDataSave && iBitmapSave )
+                {
+                // send the original snap bitmap and image to ext handling
+                // before sending the iBitmapSave and iDataSave must be cleared because callback
+                // writes the handled bitmap back there
+
+                iBitmapSendDone = ETrue;
+                CFbsBitmap* tempBitmap = iBitmapSave;
+                iBitmapSave = NULL;
+                HBufC8* tempData = iDataSave;
+                iDataSave = NULL;
+              
+                // Change CAE state to burst mode
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                iCountSnapImageReady = 0;  // Reset image counters
+                iCountStillImageReady = 0;
+                
+                // Send all burst snapimages and main images at once
+
+                for ( TInt i=0; i < iStillBurstLength; i++ )              
+                    {
+                    // Send bitmap
+                    iCamAppEngine->ProcessExtSnapImageL( *tempBitmap );
+                   
+                    // Copy main image
+                    HBufC8* msg =  HBufC8::NewL( tempData->Size());
+                    *msg = *tempData;
+
+                    // Send main image copy
+                    if ( iAction == EProcessExtCapturedImageBurst )
+                        {
+                        // Test interface with HBufC8
+                        iCamAppEngine->ProcessExtCapturedImageL( msg, i >= (iStillBurstLength - 1) );
+                        }
+                  else
+                        {
+                        // Test interface with TDesC8
+                        // Create new pointer
+                        TDesC8* tempDataDes = msg;
+                        msg = NULL;
+                        iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, i >= (iStillBurstLength - 1) );
+                        delete tempDataDes; // CAE makes own copy of this type
+                        tempDataDes = NULL;
+                        }
+                    }
+
+                delete tempBitmap;
+                tempBitmap = NULL;
+                delete tempData;
+                tempData = NULL;
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is at least one new handled image (snap + main)
+                //
+                if ( !iBitmapSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after EProcessExtCapturedImageBurst" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                if ( !iDataSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCapturedImageBurst" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // image data, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iBitmapSave;
+                iBitmapSave = NULL;
+                delete iDataSave;
+                iDataSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                }
+                break;
+
+            default:
+                break;
+		    }
+
+        }
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTrappedL() returning" ) );
+    #endif
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStatesClient.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1844 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStatesClient.cpp
+*
+*/
+#include <fbs.h>
+#include <w32std.h>
+
+#include "CaeTestStatesClient.h"
+
+//_LIT8(KVideoMimeType, "video/3gpp");
+//_LIT(KVideoPreferredSupplier, "Nokia");
+//_LIT8(KVideoType, "video/H263-2000");
+//_LIT8(KVideoAudioType, " AMR");
+_LIT8(KVideoAudioTypeInv, " TOYOTA");
+const TUid KIllegalUidQltyLevels = {666};
+
+
+CCaeTestStatesClient::CCaeTestStatesClient() 
+    {
+    }
+
+
+CCaeTestStatesClient::~CCaeTestStatesClient()
+    {
+    }
+
+
+CCaeTestStatesClient* CCaeTestStatesClient::NewL()
+    {
+    CCaeTestStatesClient* self = new(ELeave) CCaeTestStatesClient;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CCaeTestStatesClient::ConstructL()
+    {
+    CCaeTestClient::ConstructL();
+
+    iRunWithViewFinder = EFalse;
+    }
+
+
+void CCaeTestStatesClient::RunTestActionL( TestClientActions aAction )
+    {
+
+    iAction = aAction;
+
+    iActionCycle = 0;
+
+    // Initialize all state variables.
+    InitStateVariables();
+
+    #ifdef CAE_TEST_VERSION
+    switch ( iAction )
+		{
+        case EEncodingError:
+            CaeSetMcaeseoHBufC8ImageReadyError( KErrAbort );
+            break;
+        case EDecodingError:
+            CaeSetMcaesdoCFbsBitmapImageReadyError( KErrAbort );
+            break;
+        case EPowerError:
+            CaeSetPowerOnCompleteError( KErrAbort );
+            break;
+        case EReserveError:
+            CaeSetReserveCompleteError( KErrAbort );
+            break;
+        case EStillCaptureError:
+            CaeSetImageReadyError( KErrAbort );
+            break;
+        case EVideoRecorderOpenError:
+            CaeSetMvruoOpenCompleteError( KErrAbort );
+            break;
+        case EVideoRecorderPrepareError:
+            CaeSetMvruoPrepareCompleteError( KErrAbort );
+            break;
+        case EVideoRecordingCompleteError:
+            CaeSetMvruoRecordCompleteError( KErrAbort );
+            break;
+        case EPrepareVideoSettingsError:
+            CaeSetPrepareVideoSettingsError( KErrAbort );
+            break;
+        case ESnapImageError:
+            CaeSetCreateAndDeliverSnapImageError( KErrAbort );
+            break;
+        case EStillImageError:
+            CaeSetCreateAndDeliverStillImageError( KErrAbort );
+            break;
+        case EStillConvertError1:
+            CaeSetConvertCFbsBitmapToHBufC8Error( KErrAbort );
+            break;
+        case EStillConvertError3:
+            CaeSetConvertHBufC8ToCFbsBitmapError( KErrAbort );
+            break;
+        case EStillConvertError2:
+            CaeSetStillConvertError( KErrAbort );
+            break;
+        default:
+            break;
+        }
+    #endif // CAE_TEST_VERSION
+
+
+    switch (iAction)
+        {
+    case ESetDisplayIndex:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( 0, iDisplayIndex );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+        break;
+    case ESetCameraIndexLow:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( -1, iDisplayIndex );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+        break;
+    case ESetCameraIndexHigh:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( 123456, iDisplayIndex );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+        break;
+    case ESpecifiedPrepareAndCaptureStill2nd:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( 1 );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+ 
+    default:
+        break;
+        }
+
+    
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+    if ( iAction != ESpecifiedPrepareAndCaptureStill &&
+        iAction != ESpecifiedPrepareAndRecordVideoNoInit )
+        {
+        // Normal case
+        // This starts operations and state changes.
+        if ( iCreateSnapImage ) 
+            {
+            iCamAppEngine->InitL();
+            }
+        else 
+            {
+            iCamAppEngine->InitL();
+            iCamAppEngine->SetSnapImageCreation( EFalse );
+            }
+        }
+    else if ( iAction == ESpecifiedPrepareAndCaptureStill ||
+            iAction == ESpecifiedPrepareAndCaptureStill2nd )
+        {
+        // 
+        // This starts operations and state changes.
+        if ( iCreateSnapImage ) 
+            {
+            iCamAppEngine->InitL( EFalse );
+            iCamAppEngine->SetSnapImageCreation( ETrue );
+            }
+        else 
+            {
+            iCamAppEngine->InitL( ETrue );
+            iCamAppEngine->SetSnapImageCreation( EFalse );
+            }
+        }
+    else if ( iAction == ESpecifiedPrepareAndRecordVideoNoInit )
+        {
+        // No CAE init here, used in 3.2 in case only CAE video features are used
+
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() reading cameraHandle" ) );
+        #endif
+
+        TInt cameraHandle = iCamAppEngine->CCameraHandle();
+
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() creating obs2 NewDuplicate2L cameraHandle=%d" ),cameraHandle );
+        #endif
+
+        // Create a new Camera API duplicate object, if supported
+        TRAPD( err, iCameraDup = CCamera::NewDuplicate2L( static_cast<MCameraObserver2&>(*this), cameraHandle ) );
+        if ( err )
+            {
+        	#ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() CCamera::NewDuplicate2L return code=%d" ), err ); 
+            #endif
+
+            // Create old Camera API duplicate object.
+            iCameraDup = CCamera::NewDuplicateL( static_cast<MCameraObserver&>(*this), cameraHandle );
+            }
+        else
+            {
+        	#ifdef _DEBUG
+            RDebug::Print( ( _L( "Cae: CCaeTestStatesClient::RunTestActionL() using duplicated MCameraObserver2" )) ); 
+            #endif
+            }
+
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() calling reserve iCameraDup=%x" ),iCameraDup );
+        #endif
+
+        iCameraDup->Reserve(); // Poweron called after this in reservecomplete
+
+        // Give C-API time to complete operation
+        User::After( 500000 );
+        
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() calling cae disable/enable videorecording" ) );
+        #endif
+
+        // Let CAE know that camera HW reservation is done,
+        // this will initialize some CAE flags so that video mode can be used
+        iCamAppEngine->DisableVideoRecording(); // Just to test release before reserve
+        iCamAppEngine->EnableVideoRecording(); // 
+        iCamAppEngine->DisableVideoRecording(); // test release 
+        iCamAppEngine->EnableVideoRecording(); // reserve again
+        iCamAppEngine->EnableVideoRecording(); // double reserve
+
+        } 
+#else   // CAE_INTERFACE_21
+        // This starts operations and state changes.
+        if ( iCreateSnapImage ) 
+            {
+            iCamAppEngine->InitL();
+            }
+        else 
+            {
+            iCamAppEngine->InitL( EFalse );
+            }
+#endif
+        
+	// Main part of program is a wait loop.
+	// This function completes when the scheduler stops.
+	CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() leaving (error detected)" ) );
+        #endif
+        User::Leave( iError );
+        }
+	
+    #ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestStatesClient::RunTrappedL()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() entering, iAction=%d" ),iAction );
+    #endif
+
+    // This is for timing critical cases
+    TTime currentTime; 
+    currentTime.HomeTime();
+    if ( iNextRunLTime.MicroSecondsFrom( currentTime ) > TTimeIntervalMicroSeconds(0) )
+        {
+        CTimer::At( iNextRunLTime );
+        return;
+        }
+
+    if ( iAction == ENone || iStop ) 
+        {
+        if ( iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StopViewFinder();
+            iViewFinderStarted = EFalse;
+            }
+        iCamAppEngine->CancelCaptureStill();
+        iCancelCount++;
+        iCamAppEngine->CloseVideoRecording();
+        CActiveScheduler::Stop();
+        }
+    else if ( iInitReady ) 
+		{
+        iInitReady = EFalse;
+        iViewFinderStarted = EFalse;        
+
+        switch ( iAction )
+		    {
+            case EInit:
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ECCameraHandle:
+                iStop = ETrue;
+                iCameraHandle = iCamAppEngine->CCameraHandle();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EInitVideoRecorder:
+                iCamAppEngine->InitVideoRecorderL();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EInitVideoRecorderWithUid:
+                iCamAppEngine->InitVideoRecorderL(KIllegalUidQltyLevels);
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOnWhenInitialized:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iInitReady = ETrue;
+                    iCamAppEngine->PowerOn();
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                break;
+            case ESwitchPowerOffAndOn:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->PowerOff();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PowerOn();
+                    }
+                break;
+            case EPowerOffPowerOff:
+                iCamAppEngine->PowerOff();
+                iCamAppEngine->PowerOff();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EStartVfWhenPowerOff:
+                iCamAppEngine->PowerOff();
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                if( iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave ( KErrGeneral );
+                    }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay ); // Give some time for all Active objects to react to this command.
+                break;
+            case ERelease:
+                iCamAppEngine->Release();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EReleaseRelease:
+                iCamAppEngine->Release();
+                iCamAppEngine->Release();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EReserveReserve:
+                iCamAppEngine->Reserve();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay ); // needed because this Reserve after InitL does do nothing (no call-back)
+                break;
+            case EReleaseReserve:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->Release();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->Reserve();
+                    }
+                break;
+            case EReleaseReserveCapture:
+                if ( iContinueWhenCompleted ) 
+                    {
+                    iStillPrepareReady = EFalse;
+                    iVideoPrepareReady = EFalse;
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->Release();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iContinueWhenCompleted = ETrue;
+                    iCamAppEngine->Reserve();
+                    }
+                break;
+            case EReleaseReserveRecord:
+                if ( iContinueWhenCompleted ) 
+                    {
+                    iStillPrepareReady = EFalse;
+                    iVideoPrepareReady = EFalse;
+                    iCamAppEngine->InitVideoRecorderL();
+                    iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->Release();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iContinueWhenCompleted = ETrue;
+                    iCamAppEngine->Reserve();
+                    }
+                break;
+            case EStartVideoRecordingWhenInitialized:
+                iCamAppEngine->StartVideoRecording();
+                break;
+            case EStopVideoRecordingWhenInitialized:
+                iCamAppEngine->StopVideoRecording();
+                break;
+            case EGetStillQualityIndexWhenEngineInitialized:
+                {
+                TInt stillQualityIndex = iCamAppEngine->StillQualityIndex();
+                if ( stillQualityIndex != -1 ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EGetVideoQualityIndexWhenEngineInitialized:
+                {
+                TInt videoQualityIndex = iCamAppEngine->VideoQualityIndex();
+                if ( videoQualityIndex != -1 ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EEnumerateCaptureSizes:
+                {
+                TSize stillFrameSize;
+                // Tests to get the largest image size (index value 0).
+                iCamAppEngine->EnumerateStillCaptureSizes( stillFrameSize, 0, iStillDataFormat );
+                if ( stillFrameSize != iStillFrameSize )
+                    {
+                    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() got stillFrameSize w=%d, h=%d, leaving -2" ), stillFrameSize.iWidth, stillFrameSize.iHeight );
+                    #endif
+                    
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareStillCapturing:
+            case EPrepareStillCapturingWhenPrepared:
+            case EPrepareAndCaptureStill:
+            case EPrepareAndCaptureAndCancelStill:
+            case EPrepareAndCaptureAndCancelStillAtSnap:
+            // Burst
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstCaptureStill:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+            case EPrepareAndCaptureAndStopStillBurst:
+            case EPrepareAndCaptureCaptureStillBurst:
+            // 
+            case EStartAndStopVfWhenStillPreparedAndCaptured:
+            case ECaptureCapture:
+            case ECaptureRecord:
+            case ESwitchPowerOnWhenStillPrepared:
+            case ESwitchPowerOffWhenStillPrepared:
+            case EGetStillQualityIndexWhenPrepared:
+            case EEncodingError:
+            case EStillCaptureError:
+            case EStillConvertError1:
+            case EStillConvertError2:
+            case EStillConvertError3:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+			    break;
+            case EPrepareCroppedStillCapturing:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                {
+                TRect cropRect; 
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex, cropRect );
+                }
+			    break;
+            case EPrepareStillCaptureWhenPowerOff:
+                iCamAppEngine->PowerOff();
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+			    break;
+            case EPrepareVideoRecording:
+            case EPrepareVideoRecordingWhenPrepared:
+            case EPrepareAndRecordVideo:
+            case EStartAndStopVfWhenVideoPreparedAndRecorded:
+            case ERecordRecord:
+            case ERecordCapture:
+            case ERecordCaptureComplexSequence1:
+            case ERecordCaptureComplexSequence2:
+            case ESwitchPowerOnWhenVideoPrepared:
+            case ESwitchPowerOffWhenVideoPrepared:
+            case ESwitchPowerOnWhenRecordingVideo:
+            case ESwitchPowerOffWhenRecordingVideo:
+            case EStartVideoRecordingWhenRecording:
+            case EStopVideoRecordingWhenPrepared:
+            case EPauseVideoWhenPrepared:
+            case EResumeVideoWhenPrepared:
+            case EResumeVideoWhenNotPaused:
+            case EPrepareRecordPauseStopVideo:
+            case EPrepareRecordPauseResumeStopVideo:
+            case EPrepareRecordPausePauseStopVideo:
+            case EGetVideoQualityIndexWhenPrepared:
+            case ERemainingTimeWhenVideoPrepared:
+            case EVideoRecorderOpenError:
+            case EVideoRecorderPrepareError:
+            case EVideoRecordingCompleteError:
+            case EPrepareVideoSettingsError:
+            case EPrepareStillCaptureWhenRecording:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+			    break;
+            case ESpecifiedPrepareStill:
+            case ESpecPrepCaptureCapture:
+            case ESpecifiedPrepareStillWhenPrepared:
+            case ESpecifiedPrepareAndCaptureStill:
+            case ESpecifiedPrepareAndCaptureStill2nd:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case EStartVfPrepareCaptureStillStartAndStopVfExif:
+            case EStillImageError:
+		    case ESetDisplayIndex:
+            // Burst
+            case ESpecPrepAndCaptureStillBurst:
+            case ESpecPrepAndCaptureCaptureStillBurst:
+            case ESpecPrepAndCaptureStillBurstCaptureStill:
+            // "Destroy Engine"
+            case EDestroyEngineWhenStillPrepareReady:
+            case EDestroyEngineWhenSnapImageReady:
+            case EDestroyEngineWhenStillCaptureReady:
+            case EDestroyEngineWhenStillBurstReady:
+            case EDestroyEngineWhenSnapImageReadyInStillBurst:
+            case EDestroyEngineWhenStillImageReadyInStillBurst:
+            case ECaptureStillSetSnapSizeExif:
+            case ECaptureStillAfterPowerOff:
+            case ECaptureStillAfterPowerOffOn:
+            case ESnapImageError:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     iStillDataFormat, 
+                                                     iStillCompressionQuality );
+			    break;
+			case EStartVfPrepareCaptureStillStartAndStopVfSnapExif:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     iStillDataFormat, 
+                                                     iStillCompressionQuality,
+													 iCropRect,
+													 iSnapImageSize);
+			    break;
+            case ECaptureStillSetSnapColorModeExif:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     iStillDataFormat, 
+                                                     iStillCompressionQuality );
+				iCamAppEngine->SetSnapImageColorMode( EColor16M );
+			    break;
+            case ESpecifiedPrepareVideo: 
+            case ESpecifiedPrepareVideoWhenPrepared: 
+            case ESpecifiedPrepareAndRecordVideo: 
+            case ESpecifiedPrepareAndRecordVideoNoInit: 
+            // "Destroy Engine"
+            case EDestroyEngineWhenVideoPrepareReady:
+            case EDestroyEngineWhenVideoRecordingOn:
+            case EDestroyEngineWhenVideoRecordingPaused:
+            case EDestroyEngineWhenVideoRecordingReady:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled, 
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       *iAudioTypeSet[iVideoCodecSet] );
+                }
+			    break;
+            case ESpecifiedPrepareAudioBrAndRecordVideo:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled,
+                                                       iAudioBitRate,
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       *iAudioTypeSet[iVideoCodecSet] );
+                }
+			    break;
+            case ESpecifiedPrepareAudioBrAndRecordVideoAT0:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                const TDesC8& audioType = KNullDesC8;
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled,
+                                                       iAudioBitRate,
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       audioType );
+                }
+			    break;
+            case ESpecifiedPrepareAudioBrAndRecordVideoATInv:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                const TDesC8& audioType = KVideoAudioTypeInv;
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled,
+                                                       iAudioBitRate,
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       audioType );
+                }
+			    break;
+            case EStartAndStopVf:  
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EStartAndStopCroppedVf:  
+                iViewFindingUsed = ETrue;
+                {
+                TRect emptyRect;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize, emptyRect );
+                }
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EStartAndStopDirectVf:  
+                iViewFindingUsed = ETrue;
+                {
+                RWsSession*      wsSession = NULL;
+                CWsScreenDevice* wsScreenDevice = NULL;
+                RWindowBase*     windowBase = NULL;
+                TRect*           tRect = NULL;
+                iCamAppEngine->StartViewFinderDirectL( *wsSession,
+                                                       *wsScreenDevice,
+                                                       *windowBase,
+                                                       *tRect);
+                }
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EStartAndStopCroppedDirectVf:  
+                iViewFindingUsed = ETrue;
+                {
+                RWsSession*      wsSession = NULL;
+                CWsScreenDevice* wsScreenDevice = NULL;
+                RWindowBase*     windowBase = NULL;
+                TRect*           screenRect = NULL;
+                TRect*           cropRect = NULL;
+                iCamAppEngine->StartViewFinderDirectL( *wsSession,
+                                                       *wsScreenDevice,
+                                                       *windowBase,
+                                                       *screenRect,
+                                                       *cropRect );
+                }
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case ESwitchPowerOffWhenVfRunning:
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                CTimer::After( iTimeout );
+                break;
+            case EStartVfPrepareCaptureStillStartAndStopVf:
+            case EStartVfPrepareRecordVideoStartAndStopVf:
+            case ESetColorToneVideoRecording:
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                CTimer::After( 500000 );
+                break;
+            case EIsVideoRecordingWhenPrepared:
+                break;
+            case ECaptureStillWhenEngineInitialized:
+                iCamAppEngine->CaptureStill();
+                break;
+            case ECancelCaptureStillWhenInitialized:
+                iCamAppEngine->CancelCaptureStill();
+                iCancelCount++;
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;            
+            case EStartVfStartVf:
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+                
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+            case EGetCustomInterface:
+                iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid );
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESetColorTone:
+            case ESetColorToneWrongParams:
+            case ESetColorToneRelease:
+                if ( iAction == ESetColorToneRelease && iReleaseDone )
+                    {
+                    // Do the Reserve, note that engine will call
+                    // CCaeTestClient::McaeoInitComplete when camera is ready
+                    iReleaseDone = EFalse;
+                    iReserveDone = ETrue;
+                    iInitReady   = ETrue; // continue in this case on next run
+                    iCamAppEngine->Reserve();
+                    // No timer call here, McaeoInitComplete does it
+                    }
+                else if ( iAction == ESetColorToneRelease && iReserveDone )
+                    {
+                    // state flags to defaults, release/reserve is done now
+                    iReleaseDone = EFalse;
+                    iReserveDone = EFalse;
+
+                    // Verify that settings are reset to default after reserve
+                    MCameraColorToneSettings* CTptr = NULL;
+                    CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                    if ( CTptr->ColorTone() != MCameraColorToneSettings::ENormal )
+                        {
+                    	    #ifdef _DEBUG
+                            RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() Error:ColorTone settings not reset after release()" ));
+                            #endif
+                            iStop = ETrue;
+                            CTimer::After( KNormalTimingDelay );
+                        }
+                    else
+                        {
+                        // all ok, capture a picture and verify manually normal settings
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        }
+                    }
+                else
+                    {
+                    iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid );
+                    if ( !iCustomInterfacePointer )
+                        {               // Interface not supported, exit test case
+                	    #ifdef _DEBUG
+                        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() CustomInterface returns 0 for uid %x" ), iCustomInterfaceUid.iUid );
+                        #endif
+                        iStop = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        }
+                    else
+                        {
+                        MCameraColorToneSettings* CTptr = NULL;
+                        TUint32 supportedCT = 0 ;
+
+                        // cast the TAny pointer to the real color tone interface pointer and
+                        // read the bitmap of supported color tones
+                        CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                        supportedCT = CTptr->SupportedColorTones();
+
+                        // Check that given parameter is supported by the interface
+                        if ( (iColorToneValue & supportedCT) ||
+                            iColorToneValue == MCameraColorToneSettings::ENormal ||
+                            iAction == ESetColorToneWrongParams)
+                            {
+                            // then set the new color tone and verify that it has been set
+                            CTptr->SetColorToneL( iColorToneValue );
+                            if ( CTptr->ColorTone() == iColorToneValue )
+                                {
+                                if ( iAction == ESetColorToneRelease )
+                                    {
+                                    // Do now release and then on next run the reserve
+                                    iCamAppEngine->Release();
+                                    iReleaseDone = ETrue;
+                                    iReserveDone = EFalse;
+                                    iInitReady   = ETrue; // this keeps the same switch active
+                                    CTimer::After( KNormalTimingDelay );
+                                    }
+                                else
+                                    {
+                                    // all ok, capture a picture and verify manually changes
+                                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                                    }
+                                }
+                            else // Value not set
+                                {
+                            	#ifdef _DEBUG
+                                RDebug::Print( _L( "Cae: ESetColorTone: color iColorToneValue not set to: %d" ), iColorToneValue );
+                                #endif
+                                iStop = ETrue;
+                                CTimer::After( KNormalTimingDelay );
+                                }
+                            }
+                        else // Value not supported
+                            {
+                       	    #ifdef _DEBUG
+                            RDebug::Print( _L( "Cae: ESetColorTone: color iColorToneValue not supported: %d" ), iColorToneValue );
+                            #endif
+                            iStop = ETrue;
+                            CTimer::After( KNormalTimingDelay );
+                            }
+                        }
+                    }
+                break;
+#endif
+            case ERemainingTimeWhenVideoNotInitialized:
+                {
+                iAction = ENone;
+                TTimeIntervalMicroSeconds zeroRemainingTime( 0 );
+                TTimeIntervalMicroSeconds remainingTime( 1 );
+                remainingTime = iCamAppEngine->RemainingVideoRecordingTime();
+                if ( remainingTime != zeroRemainingTime )
+                    {
+                    User::Leave( KErrArgument );
+                    }
+                CTimer::After( KNormalTimingDelay );
+                }
+                break;
+            default:
+			    break;
+		    }
+		}
+    else if ( iStillPrepareReady ) 
+		{
+        
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+        iStillPrepareReady = EFalse;
+
+		TBool capture = EFalse;
+
+		switch ( iAction )
+			{
+            case ESwitchPowerOnWhenStillPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOn();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOffWhenStillPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOff();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EGetStillQualityIndexWhenPrepared:
+                {
+                TInt stillQualityIndex = iCamAppEngine->StillQualityIndex();
+                if ( stillQualityIndex != iStillQualityLevelIndex ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EStartStillOpModeStopVf:
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case ESpecifiedPrepareStill:
+            case EPrepareStillCapturing:
+                iAction = ENone;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareStillCapturingWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                break;
+            case ESpecifiedPrepareStillWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                         iStillDataFormat, 
+                                                         iStillCompressionQuality );
+                    }
+                break;
+            // Burst
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case ESpecPrepAndCaptureStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+            case EPrepareAndCaptureAndStopStillBurst:
+            case EPrepareAndCaptureCaptureStillBurst:
+            case ESpecPrepAndCaptureCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstCaptureStill:
+            case ESpecPrepAndCaptureStillBurstCaptureStill:
+            case EDestroyEngineWhenStillBurstReady:
+            case EDestroyEngineWhenSnapImageReadyInStillBurst:
+            case EDestroyEngineWhenStillImageReadyInStillBurst:
+                if ( iImageCountToCapture == 1 ) 
+                    {
+                    iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                    }
+                if ( iSnapImageSource != CCaeEngine::ESnapImageSourceOriginal )
+                    {
+                    iCamAppEngine->SetSnapImageSourceL( iSnapImageSource );
+                    }
+                capture = ETrue;
+                break;
+			case ECaptureStillSetSnapSizeExif:
+				iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
+                capture = ETrue;
+			    break;
+            case ECaptureStillAfterPowerOff:
+				iCamAppEngine->PowerOff();
+                capture = ETrue;
+                iStop = ETrue;  // Engine cancels capture if power is not on
+                CTimer::After( KNormalTimingDelay );
+			    break;
+            case ECaptureStillAfterPowerOffOn:
+                if ( iStopWhenCompleted ) 
+                    {
+                    if ( iCountStillPrepareComplete <= 1 )
+                        {
+                        iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                             iStillDataFormat, 
+                                                             iStillCompressionQuality );
+                        }
+                    else
+                        {
+                        capture = ETrue;
+                        }
+                    //CTimer::After( KNormalTimingDelay );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->PowerOff();
+                    iPowerOn = EFalse;
+                    iStillPrepareReady = ETrue; // come back here on next run
+                    CTimer::After( KLongTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PowerOn();
+                    iStillPrepareReady = ETrue; // come back here on next run
+//                    CTimer::After( KLongTimingDelay*100 );
+                    }
+			    break;
+			case EDestroyEngineWhenStillPrepareReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+			default:
+                capture = ETrue;
+                break;
+			}
+        
+        // Special treatments for some specific test actions:
+        switch ( iAction ) 
+            {
+            case EPrepareAndCaptureAndStopStillBurst:
+                iStopStillBurst = ETrue;
+                break;
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+                iCancelStillBurst = ETrue;
+                break;
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+				// Cancel still burst after next view finder frame
+                iCancelStillBurstAfterVfFrame = ETrue; 
+                break;
+            case EPrepareAndCaptureAndCancelStillAtSnap:
+                iRunlForSnapImage = ETrue;
+                // Added delay so that the encoder has always time to finish before the next RunTrappedL.
+                // Before is was not so deterministic.
+                iNextRunLTime.HomeTime();
+                iNextRunLTime += TTimeIntervalMicroSeconds32(KLongTimingDelay*1000);
+                break;  
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+            case EDestroyEngineWhenSnapImageReady:
+            case EDestroyEngineWhenSnapImageReadyInStillBurst:
+                iRunlForSnapImage = ETrue;
+                break;
+            case EDestroyEngineWhenStillImageReadyInStillBurst:
+                iRunlForStillImage = ETrue; 
+                break;
+            default:
+                break;               
+            }
+        
+        // Capture still if requested for the test action.
+        if ( capture )
+			{
+            iStillCaptureReady = EFalse;
+            iStillCapturingOn = ETrue;
+            iStillCaptured = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->CaptureStill()" ) );
+            #endif
+			iCamAppEngine->CaptureStill();
+			}
+
+        if ( iAction == EPrepareAndCaptureAndCancelStill || 
+             iAction == EPrepareAndCaptureAndCancelStillBurst )
+            {
+            iCamAppEngine->CancelCaptureStill();
+            iCancelCount++;
+            iStop = ETrue;
+            CTimer::After( KNormalTimingDelay );
+            }
+
+		}
+    else if ( iVideoPrepareReady ) 
+		{
+
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+        iVideoPrepareReady = EFalse;
+
+        TBool record = EFalse;
+
+		switch ( iAction )
+			{
+            case ESwitchPowerOnWhenVideoPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOn();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOffWhenVideoPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOff();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EGetVideoQualityIndexWhenPrepared:
+                {
+                TInt videoQualityIndex = iCamAppEngine->VideoQualityIndex();
+                if ( videoQualityIndex != iVideoQualityLevelIndex ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareVideoRecording:
+            case ESpecifiedPrepareVideo:
+                iAction = ENone;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareVideoRecordingWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                break;
+            case ESpecifiedPrepareVideoWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                           iVideoFrameRate, 
+                                                           iVideoBitRate, 
+                                                           iVideoAudioEnabled, 
+                                                           *iMimeTypeSet[iVideoCodecSet], 
+                                                           *iPreferredSupplierSet[iVideoCodecSet],
+                                                           *iVideoTypeSet[iVideoCodecSet], 
+                                                           *iAudioTypeSet[iVideoCodecSet] );
+                    }
+                break;
+            case EPauseVideoWhenPrepared:
+                iCamAppEngine->PauseVideoRecording();
+                break;
+            case EResumeVideoWhenPrepared:
+                iCamAppEngine->ResumeVideoRecording();
+                break;
+            case EStopVideoRecordingWhenPrepared:
+                iCamAppEngine->StopVideoRecording();
+                break;
+            case EStartVideoOpModeStopVf:
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EIsVideoRecordingWhenPrepared:
+                iAction = ENone;
+                {
+                TBool isRecording = iCamAppEngine->IsVideoRecording();
+                if ( isRecording ) 
+                    {
+                    User::Leave ( KErrGeneral );
+                    }
+                }
+                break;
+            case ERemainingTimeWhenVideoPrepared:
+                {
+                iAction = ENone;
+                TTimeIntervalMicroSeconds remainingTime( 0 );
+                remainingTime = iCamAppEngine->RemainingVideoRecordingTime();
+                CTimer::After( KNormalTimingDelay );
+                }
+                break;
+			case EDestroyEngineWhenVideoPrepareReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+			    
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+            case ESetColorToneVideoRecording:
+                iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid );
+                if ( !iCustomInterfacePointer )
+                    {               // Interface not supported, exit test case
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() CustomInterface returns 0 for uid %x" ), iCustomInterfaceUid.iUid );
+                    #endif
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else
+                    {
+                    MCameraColorToneSettings* CTptr = NULL;
+
+                    // cast the TAny pointer to the real color tone interface pointer and
+                    // read the bitfield of supported color tones. All of them are tested once.
+                    CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                    iTestedColorTones = CTptr->SupportedColorTones();
+                    record = ETrue;
+                    }
+				break;
+#endif
+            default:
+                record = ETrue;
+				break;
+			}
+        
+        if ( record )
+			{
+            iVideoRecordingReady = EFalse;
+            iVideoRecordingOn = EFalse;
+            iVideoRecorded = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StartVideoRecording()" ) );
+            #endif
+			iCamAppEngine->StartVideoRecording();
+			}
+		}
+	else if ( iSnapImageReady )
+	    {
+	    iSnapImageReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureAndCancelStillAtSnap: 
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+                iCamAppEngine->CancelCaptureStill();
+                iCancelCount++;
+                if ( iCancelCount == 1 )
+                    {
+                    iCountSnapImageReady--;
+                    // To test that preparing does not ruin cancelling.
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); 
+                    }
+                else 
+                    {
+                    iCountSnapImageReady++;
+                    iStillCapturingOn = ETrue;
+                    iStillCaptured = ETrue;
+                    if ( iAction == EPrepareAndCaptureAndCancelStillAtSnap ) 
+                        {
+                        iRunlForStillImage = ETrue;
+                        }
+    			    iAction = ENone;
+    			    iCamAppEngine->CaptureStill();
+                    }
+                break;
+			case EDestroyEngineWhenSnapImageReady:
+			case EDestroyEngineWhenSnapImageReadyInStillBurst:
+			    iRunlForSnapImage = EFalse;
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+			default:
+			    iRunlForSnapImage = EFalse;
+			    break;
+			}
+	    }
+	else if ( iStillCaptureReady )
+	    {
+	    iStillCaptureReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureStill:
+            case ESpecifiedPrepareAndCaptureStill:
+            case ESpecifiedPrepareAndCaptureStill2nd:
+            case ESetColorTone:
+            case ESetColorToneWrongParams:
+		    case ESetDisplayIndex:
+                iAction = ENone;
+                CTimer::After( KNormalTimingDelay );
+			    break;
+		    case ECaptureCapture:
+		    case ESpecPrepCaptureCapture:
+			    iAction = ENone;
+                iStillCapturingOn = ETrue;
+                iStillCaptured = ETrue;
+			    iCamAppEngine->CaptureStill();
+			    break;
+            case ECaptureRecord:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+			    break;
+		    case ERecordCaptureComplexSequence1:
+		    case ERecordCaptureComplexSequence2:
+                iVideoRecordingReady = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case ESpecPrepAndCaptureStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:            
+            case EPrepareAndCaptureAndStopStillBurst:
+                break;
+			case EDestroyEngineWhenStillCaptureReady:
+			case EDestroyEngineWhenStillImageReadyInStillBurst:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+                iAction = ENone;
+                iViewFindingUsed = ETrue;
+	            #ifdef _DEBUG
+                RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StartViewFinderBitmapsL()" ) );
+                #endif
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+			    break;	
+		    }
+		    
+		iRunlForStillImage = EFalse;
+	    
+	    }
+	else if ( iStillBurstCaptureMoment ) 
+        {
+        iStillBurstCaptureMoment = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+                // Note: Cancelling is done in the callback.
+                if ( iCancelCount == 1 )
+                    {
+                    // To test that preparing does not ruin cancelling.
+                    // The burst emerging from this is also cancelled!
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); 
+                    }
+                else 
+                    {
+    			    iAction = ENone;
+                    iStillCapturingOn = ETrue;
+                    iStillCaptured = ETrue;
+                    // Do not cancel this burst!
+                    iCancelStillBurst = EFalse;
+    			    iCamAppEngine->CaptureStill();
+                    }
+                break;
+			default:
+			    break;
+			}
+        }
+    else if ( iStillBurstReady )
+	    {
+        iStillBurstReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureCaptureStillBurst:
+            case ESpecPrepAndCaptureCaptureStillBurst:
+			    iAction = ENone;
+                iStillCapturingOn = ETrue;
+                iStillCaptured = ETrue;
+			    iCamAppEngine->CaptureStill();
+			    break;
+            case EPrepareAndCaptureStillBurstCaptureStill:
+            case ESpecPrepAndCaptureStillBurstCaptureStill:
+                // Re-set the image count to one to perform single image capture.
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+			    iAction = ENone;
+                iStillCapturingOn = ETrue;
+                iStillCaptured = ETrue;
+			    iCamAppEngine->CaptureStill();
+			    break;
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case ESpecPrepAndCaptureStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndStopStillBurst:
+                iAction = ENone;
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    case ERecordCaptureComplexSequence1:
+		    case ERecordCaptureComplexSequence2:
+                iVideoRecordingReady = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+			case EDestroyEngineWhenStillBurstReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+                iAction = ENone;
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    }
+        }
+	else if ( iVideoRecordingOn )
+	    {
+	    
+        switch ( iAction )
+		    {
+            case ESwitchPowerOnWhenRecordingVideo:
+                iVideoRecordingOn = EFalse;
+                iAction = ENone;
+                iCamAppEngine->PowerOn();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOffWhenRecordingVideo:
+                iVideoRecordingOn = EFalse;
+                iAction = ENone;
+                iCamAppEngine->PowerOff();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareRecordPauseStopVideo:
+            case EPrepareRecordPauseResumeStopVideo:
+                iVideoRecordingOn = EFalse;
+                if ( !iVideoRecordingResumed ) 
+                    {
+                    iCamAppEngine->PauseVideoRecording();
+                    }
+                else 
+                    {
+                    iCamAppEngine->StopVideoRecording();
+                    }
+                break;
+            case EPrepareRecordPausePauseStopVideo:
+                iVideoRecordingOn = EFalse;
+                if ( !iVideoRecordingResumed ) 
+                    {
+                    iCamAppEngine->PauseVideoRecording();
+                    iCamAppEngine->PauseVideoRecording();
+                    }
+                else 
+                    {
+                    iCamAppEngine->StopVideoRecording();
+                    }
+                break;
+            case EResumeVideoWhenNotPaused:
+                iCamAppEngine->ResumeVideoRecording();
+                break;
+            case EStartVideoRecordingWhenRecording:
+                iCamAppEngine->StartVideoRecording();
+                break;
+            case EIsVideoRecordingWhenRecording:
+                iVideoRecordingOn = EFalse;
+                iAction = ENone;
+                {
+                TBool isRecording = iCamAppEngine->IsVideoRecording();
+                if ( !isRecording ) 
+                    {
+                    User::Leave ( KErrGeneral );
+                    }
+                }
+                break;
+            case EPrepareStillCaptureWhenRecording:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                break;
+			case EDestroyEngineWhenVideoRecordingOn:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+            case EDestroyEngineWhenVideoRecordingPaused:
+                iVideoRecordingOn = EFalse;
+                iCamAppEngine->PauseVideoRecording();
+                break;
+                
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+            case ESetColorToneVideoRecording:
+                {
+                    MCameraColorToneSettings* CTptr = NULL;
+
+                    if ( iTestedColorTones == 0) // All colors tested?
+                        {
+                        //Set the default color tone and stop
+                        CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                        CTptr->SetColorToneL( iColorToneValue );
+                        iCamAppEngine->StopVideoRecording();
+                        }
+                    else
+                        {
+                        TInt i, nextColor;
+
+                        // Find out next not tested color
+                        for ( i = 0, nextColor = 0; i < 32; i++ )
+                            {
+                            nextColor = (1 << i);
+                            if ( nextColor &  iTestedColorTones )
+                                {
+                                iTestedColorTones &= ~nextColor; // Remove this color (bit)
+                                break;
+                                }
+                            }
+                        // cast the TAny pointer to the real color tone interface pointer and
+                        // then set the new color tone and verify that it has been set
+                        CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                        CTptr->SetColorToneL( (MCameraColorToneSettings::TColorTone) nextColor );
+
+                        if ( CTptr->ColorTone() == nextColor )
+                            {
+                            CTimer::After( iTimeout ); // all ok, continue video recording
+                            }
+                        else
+                            {
+                          	#ifdef _DEBUG
+                            RDebug::Print( _L( "Cae: ESetColorToneVideoRecording: color not set to: %d" ), nextColor );
+                            #endif
+                            iStop = ETrue;
+                            CTimer::After( KNormalTimingDelay );
+                            }
+                        }
+                    break;
+                }
+#endif
+            default:
+                iCamAppEngine->StopVideoRecording();
+			    break;	
+		    }
+	    }
+	else if ( iVideoRecordingPaused )
+	    {
+        
+        switch ( iAction )
+		    {
+            case EPrepareRecordPauseStopVideo:
+            case EPrepareRecordPausePauseStopVideo:
+                iStop = ETrue;
+                iCamAppEngine->StopVideoRecording();
+                break;
+			case EDestroyEngineWhenVideoRecordingPaused:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+                iCamAppEngine->ResumeVideoRecording();
+                iVideoRecordingResumed = ETrue;
+			    break;	
+		    }
+	    }
+	else if ( iVideoRecordingReady )
+	    {
+		switch ( iAction )
+		    {
+		    case ERecordRecord:
+                iAction = EDefault;
+			    iVideoRecordingReady = EFalse;
+                iVideoRecordingOn = EFalse;
+                iVideoRecorded = ETrue;
+                // This leads to video prepare and then recording with the new name.
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 );
+			    break;
+            case ERecordCapture:
+                iAction = EDefault;
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                break;
+		    case ERecordCaptureComplexSequence1:
+            	#ifdef _DEBUG
+                RDebug::Print( _L( "Cae: ERecordCaptureComplexSequence1 case: %d" ), iActionCycle );
+                #endif
+			    iVideoRecordingReady = EFalse;
+                iVideoRecordingOn = EFalse;
+                iVideoRecorded = ETrue;
+		        switch ( iActionCycle )
+		            {
+		            case 0:
+                        // This leads to video prepare and then recording with the new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 );
+                        break;
+		            case 1:
+                        // Accept video recording completion error because max clip size.
+                        iAcceptVideoCompletionError = ETrue;
+                        // This leads to video prepare and then recording with the previously given name.
+                        iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                        break;
+                    /*
+		            case 2:
+                        // This leads to video recording with the previous name.
+                        iVideoPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+                    */
+		            case 2:
+                        // This leads to video prepare and then recording with the new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName3 );
+                        break;
+		            case 3:
+		                // This leads to single still image capture.
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 4:
+                        // Note, this is re-initialization of video recorder.
+                        // Leads to video prepare and then recording with new name.
+                        iAcceptVideoCompletionError = EFalse;
+                        iCamAppEngine->InitVideoRecorderL();
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName4 );
+                        iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                        break;
+		            case 5:
+		                // This leads to single still image capture.
+                        iCamAppEngine->CloseVideoRecording();
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 6:
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                        // Accept video recording completion error because max clip size.
+                        iAcceptVideoCompletionError = ETrue;
+                        iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                        iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                        break;
+		            case 7:
+                        // Note, this is re-initialization of the whole engine.
+                        // Leads to video prepare and then recording with the original name.
+                        iAcceptVideoCompletionError = EFalse;
+                        iCamAppEngine->InitL();
+                        break;
+                    default:
+                        iStop = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+                    }
+                iActionCycle++;
+                break;
+		    case ERecordCaptureComplexSequence2:
+            	#ifdef _DEBUG
+                RDebug::Print( _L( "Cae: ERecordCaptureComplexSequence2 case: %d" ), iActionCycle );
+                #endif
+			    iVideoRecordingReady = EFalse;
+                iVideoRecordingOn = EFalse;
+                iVideoRecorded = ETrue;
+		        switch ( iActionCycle )
+		            {
+		            case 0:
+                        // This leads to still burst capture.
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 1:
+                        // This leads to single image capture.
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                        iStillPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+		            case 2:
+                        // This leads to single image capture.
+                        iStillPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+		            case 3:
+                        // This leads to still burst capture.
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                        iStillPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+		            case 4:
+                        // This leads to video prepare and then recording with new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 );
+                        break;
+		            case 5:
+		                // This leads to single image capture.
+                        iCamAppEngine->CloseVideoRecording();
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 6:
+		                // This leads to video prepare and then recording with new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName3 );
+                        // Accept video recording completion error because max clip size.
+                        iAcceptVideoCompletionError = ETrue;
+                        iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                        iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                        break;
+		            case 7:
+                        // This leads to video prepare and then recording with new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName4 );
+                        break;
+                    default:
+                        iStop = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+                    }
+                iActionCycle++;
+                break;
+			case EDestroyEngineWhenVideoRecordingReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+			    iAction = ENone;
+                iVideoRecordingReady = EFalse;
+                iStopViewFinder = ETrue;
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    }
+	    }
+    else if ( !iStillCaptured && !iVideoRecorded && !iVideoRecordingOn && !iStopViewFinder ) 
+        {
+        switch ( iAction )
+		    {
+            case EStartVfPrepareCaptureStillStartAndStopVf:
+                if ( !iStillPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->PrepareStillCaptureL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                break;
+            case EStartVfPrepareRecordVideoStartAndStopVf:
+            case ESetColorToneVideoRecording:
+                if ( !iVideoPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->PrepareVideoRecordingL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                break;
+            case ESwitchPowerOffWhenVfRunning:
+                iCamAppEngine->PowerOff();
+                iStopViewFinder = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            default:
+			    break;
+		    }
+        }
+	else if ( iStopViewFinder ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StopViewFinder()" ) );
+        #endif
+        iCamAppEngine->StopViewFinder();
+        // Test IsViewFinding()
+        if ( iCamAppEngine->IsViewFinding() )
+            {
+            User::Leave( KErrGeneral );
+            }
+        // Test GetViewFinderSize()
+        TSize sizeVF;
+        iCamAppEngine->GetViewFinderSize( sizeVF );
+        if ( sizeVF != iViewFinderSize )           
+            {
+            User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+            }
+
+        iViewFinderStarted = EFalse;
+        iAction = ENone;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() returning" ) );
+    #endif
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillSettings.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1628 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillSettings.cpp
+*
+*/
+
+#include "CaeTestStillSettings.h"
+#include <f32file.h>
+
+
+CCaeTestStillSettings::CCaeTestStillSettings ()
+    {
+    }
+
+
+CCaeTestStillSettings::~CCaeTestStillSettings ()
+    {
+    }
+
+
+void CCaeTestStillSettings::setUpL ()
+    {
+	iSettingsClient = CCaeTestSettingsClient::NewL( );
+
+    iSettingsClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestStillSettings::tearDown ()
+    {
+    delete iSettingsClient;    
+    iSettingsClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/////////////////////////////////////////////////////////////////////
+//                       Capture tests
+/////////////////////////////////////////////////////////////////////
+
+/******************************/
+/*    DIGITAL ZOOM VALUE      */
+/******************************/
+
+void CCaeTestStillSettings::TestDigiZoomVal2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.003
+    // 
+    // Action : Test out-of-bounds digital zoom value.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom + 1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_val_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestStillSettings::TestDigiZoomValNeg1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.004
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( -1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_val_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestStillSettings::TestOpticalZoomValMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.005
+    // 
+    // Action : Test out-of-bounds optical zoom value.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( -1 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestStillSettings::TestOpticalZoomValMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.006
+    // 
+    // Action : Test out-of-bounds optical zoom value.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( 99999 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/******************************/
+/*    DIGITAL ZOOM MODE      */
+/******************************/
+
+void CCaeTestStillSettings::TestDigiZoomMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.001
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 0 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ); 
+}
+
+void CCaeTestStillSettings::TestOpticalZoomMode1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.002
+    //
+    // Action : Test optical zoom mode.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestStillSettings::TestOpticalDigiZoomMode2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.003
+    //
+    // Action : Test optical digital zoom mode.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 2 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestStillSettings::TestDigiZoomModeNeg1L()
+    {
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.004
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( -1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+    }
+
+
+/******************************/
+/*       BRIGHTNESS           */
+/******************************/
+
+void CCaeTestStillSettings::TestBrightness0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.002
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.  
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 0 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightness100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.003
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightnessNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.004
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_-100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightness101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.005
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_brightness_101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightnessNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.006
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_brightness_-101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+
+/******************************/
+/*          CONTRAST          */
+/******************************/
+
+void CCaeTestStillSettings::TestContrast0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.002
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 0 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrast100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.003
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrastNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.004
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_-100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrast101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.005
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_contrast_101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrastNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.006
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_contrast_-101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+
+/******************************/
+/*      EXPOSURE MODE         */
+/******************************/
+
+
+void CCaeTestStillSettings::TestExposureMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.003
+    //
+    // Action : Test exposure mode 2.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestExposureMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.004
+    //
+    // Action : Test exposure mode 4
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 4;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_4.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestExposureModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.005
+    //
+    // Action : Test invalid exposure mode
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_exposure_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestExposureMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.006
+    //
+    // Action : Test combined exposure modes.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_exposure_mode_5.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+    if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err != KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/******************************/
+/*    WHITE BALANCE MODE      */
+/******************************/
+
+void CCaeTestStillSettings::TestWhiteBalanceMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.002
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : No leave, if supported. Leave, if not supported.    
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.003
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.004
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+	
+	const TInt KSetVal = 4;
+	
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_4.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.005
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_8.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode10L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.006
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 0x10;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_10.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.007
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.008
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_5.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported || err == KErrArgument );
+}
+
+
+/******************************/
+/*        FLASH MODE          */
+/******************************/
+
+void CCaeTestStillSettings::TestFlashMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.004
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_4.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestFlashMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.005
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_8.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestFlashModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.006
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestFlashMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.007
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_5.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestFlashMode6L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.008
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 6;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_6.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+void CCaeTestStillSettings::TestFlashMode9L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.009
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 9;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_9.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+void CCaeTestStillSettings::TestFlashMode10L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.010
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 10;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_10.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+
+/******************************/
+/*        INITIALIZED         */
+/******************************/
+
+void CCaeTestStillSettings::TestExposureModeInitialized2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.007
+    //
+    // Action : Test exposure mode.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_initialized_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenInitialized ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceModeInitialized2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.009
+    //
+    // Action : Test white balance mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_initialized_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenInitialized ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestStillSettings::TestFlashModeInitialized2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.008
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_initialized_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenInitialized ) );
+
+#if (MIRAGE_X_PROD3) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD7) ||(MIRAGE_X_PROD9)
+    assertL( err == KErrNone );
+#else
+    assertL( err != KErrNone );
+#endif
+}
+
+void CCaeTestStillSettings::TestDigiZoomInitializedMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.005
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+	const TInt KSetVal = 0;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+/******************************/
+/*          GET INFO          */
+/******************************/
+
+void CCaeTestStillSettings::TestGetInfo()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.001
+    // 
+    // Action : Call GetInfo. Engine initialized
+	//      
+	// Output : OK.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+}
+
+/********************************************************/
+/*                  RESET TO DEFAULTS                   */
+/********************************************************/
+
+void CCaeTestStillSettings::TestResetToDefaultsL()
+    {
+	// ID: CAE.GEN.RESETTODEFAULTSL.001
+    //
+    // Group:   General Settings
+    // 
+    // Action :  Resets the following settings: exposure mode, white balance mode, 
+    //           zoom mode, zoom value, flash mode, brightness, and contrast.
+    //
+	// Output : OK.   
+
+    iSettingsClient->SetContrast( 50 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+#if MIRAGE_X_PROD7
+    iSettingsClient->SetDigiZoomValue( 0 );
+#else
+    iSettingsClient->SetDigiZoomValue( 1 );
+#endif
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EResetToDefaults );
+    }
+
+
+/********************************************************/
+/*                  VIEW FINDER MIRROR                  */
+/********************************************************/
+
+void CCaeTestStillSettings::TestSetViewFinderMirrorL()
+    {
+	// ID:      CAE.VF.SETVIEWFINDERMIRROR.001
+    //
+    // Group:   View Finder
+    // 
+    // Action:  Test view finder mirror when initialization is done.
+	//      
+	// Output:  No leave if supported, leave if not supported. 
+    
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetViewFinderMirror ) );
+    if ( TCameraInfo::EViewFinderMirrorSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+    }
+
+/********************************************************/
+/*               GET STILL FRAME SIZE                   */
+/********************************************************/
+
+void CCaeTestStillSettings::TestGetStillFrameSizeWhenInitializedL()
+    {
+	// ID: CAE.SC.GETSTILLFRAMESIZE.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still image frame size for the specified quality level.  
+    //          Initialization is done.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetStillFrameSizeWhenInitialized );
+    
+    TSize size( 640, 480 );
+
+    TSize stillFrameSize;
+    iSettingsClient->GetStillFrameSize( stillFrameSize );
+    if ( stillFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestStillSettings::TestGetStillFrameSizeWhenPreparedL()
+    {
+	// ID: CAE.SC.GETSTILLFRAMESIZE.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still image frame size for the specified quality level,  
+    //          when prepared.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetStillFrameSizeWhenPrepared );
+
+    TSize size( 640, 480 );
+
+    TSize stillFrameSize;
+    iSettingsClient->GetStillFrameSize( stillFrameSize );
+    if ( stillFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+/********************************************************/
+/*            ESTIMATED STILL SIZE IN BYTES             */
+/********************************************************/
+
+void CCaeTestStillSettings::TestEstimatedStillSizeInBytesWhenInitializedL()
+    {
+	// ID: CAE.SC.ESTIMATEDSTILLSIZEINBYTES.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get the estimated still image size in bytes 
+    //          (for the specified quality level).  
+    //          Initialization is done.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedStillSizeInBytesWhenInitialized);
+
+    TInt stillByteSize;
+    stillByteSize = iSettingsClient->EstimatedStillSizeInBytes();
+    if ( stillByteSize != 90000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }    
+    }
+
+void CCaeTestStillSettings::TestEstimatedStillSizeInBytesWhenPreparedL()
+    {
+	// ID: CAE.SC.ESTIMATEDSTILLSIZEINBYTES.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Get the estimated still image size in bytes 
+    //          (for the specified quality level),  
+    //          when prepared.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedStillSizeInBytesWhenPrepared);
+
+    TInt stillByteSize;
+    stillByteSize = iSettingsClient->EstimatedStillSizeInBytes();
+    if ( stillByteSize != 90000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }    
+    }
+/********************************************************/
+/*             SET SNAP IMAGE SIZE                      */
+/********************************************************/
+
+void CCaeTestStillSettings::TestSetSnapImageSizeBeforePrepareL()
+    {
+	// ID: CAE.SC.SETSNAPIMAGESIZE.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Set the snap image size before preparing.  
+	//      
+	// Output : Should return KErrNotReady.  
+    
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetSnapFileName( _L("cae_set_snap_size1.mbm") );
+
+    iSettingsClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    TRAPD(err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetSnapImageSizeBeforePrepare ));
+    
+    assertL( err == KErrNotReady );
+
+    }
+
+void CCaeTestStillSettings::TestSetSnapImageSizeDuringAndAfterPrepareL()
+    {
+	// ID: CAE.SC.SETSNAPIMAGESIZE.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Set the snap image size before preparing.  
+	//      
+	// Output : Ok. Visual check snap image size.  
+    
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetSnapFileName( _L("cae_set_snap_size2.mbm") );
+
+    iSettingsClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetSnapImageSizeDuringAndAfterPrepare );
+    
+    }
+
+
+void CCaeTestStillSettings::TestInitUidL()
+    {
+	// ID: CAE.SC.INITUID.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get the estimated still image size in bytes 
+    //          (for the specified quality level),  
+    //          when prepared.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EInitUid) );
+
+    assertL( err == KErrNotSupported );
+
+    }
+
+void CCaeTestStillSettings::TestSetJpegQuality0L()
+    {
+	// ID: CAE.SET-SC.SETJPEGQUALITY.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+    //          This test case is for boundary value testing.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iSettingsClient->SetStillCompressionQuality( 0 );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iSettingsClient->SetStillFrameSize( sizeVga );
+
+    // iSettingsClient->SetStillFileName( _L("cae_jpeg_quality_setting_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegQualityWhenStillPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestStillSettings::TestSetJpegQuality101L()
+    {
+	// ID: CAE.SET-SC.SETJPEGQUALITY.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 101 
+    //          image when initialization is done and viewfinder is running.
+    //          This test case is for boundary value testing.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iSettingsClient->SetStillCompressionQuality( 101 );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iSettingsClient->SetStillFrameSize( sizeVga );
+
+    // iSettingsClient->SetStillFileName( _L("cae_jpeg_quality_setting_101.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegQualityWhenStillPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillSettings::TestCaptureStillBurstIntervalM2L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.M2.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode,
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval  
+    //          and capture three images in a burst, when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+   
+    TTimeIntervalMicroSeconds burstInterval( KMaxTUint32 );  // Test with too big value
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EPrepareAndSetStillBurstCaptureInterval ) );
+    assertL( error == KErrArgument );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == 0 );
+    assertL( iSettingsClient->CountSnapImageReady() == 0 );
+    assertL( iSettingsClient->CountStillImageReady() == 0 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 0 );
+    }
+    
+
+void CCaeTestStillSettings::TestSetJpegCodecInvalidL()
+    {
+	// ID: CAE.SET-SC.SETJPEGCODEC.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture an image 
+    //          when initialization is done and viewfinder is running.
+    //          This test case is for invalid codec uid testing.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetImageCodecs( TUid::Uid( 0x12345 ), TUid::Uid( 0x54321 ) ); // Invalid codec uids
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegCodecWhenStillPrepared ));
+    assertL( error == KErrNotFound );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 0 );
+    }
+
+    
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCaeTestStillSettings::suiteL ()
+{
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestStillSettings") );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.003"), &TestDigiZoomVal2L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.004"), &TestDigiZoomValNeg1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.005"), &TestOpticalZoomValMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.006"), &TestOpticalZoomValMaxL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.001"), &TestDigiZoomMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.002"), &TestOpticalZoomMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.003"), &TestOpticalDigiZoomMode2L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.004"), &TestDigiZoomModeNeg1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.002"), &TestBrightness0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.003"), &TestBrightness100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.004"), &TestBrightnessNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.005"), &TestBrightness101L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.006"), &TestBrightnessNeg101L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.002"), &TestContrast0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.003"), &TestContrast100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.004"), &TestContrastNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.005"), &TestContrast101L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.006"), &TestContrastNeg101L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.003"), &TestExposureMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.004"), &TestExposureMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.005"), &TestExposureModeNeg1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.006"), &TestExposureMode5L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.002"), &TestWhiteBalanceMode1L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.003"), &TestWhiteBalanceMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.004"), &TestWhiteBalanceMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.005"), &TestWhiteBalanceMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.006"), &TestWhiteBalanceMode10L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.007"), &TestWhiteBalanceModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.008"), &TestWhiteBalanceMode5L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.004"), &TestFlashMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.005"), &TestFlashMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.006"), &TestFlashModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.007"), &TestFlashMode5L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.008"), &TestFlashMode6L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.009"), &TestFlashMode9L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.010"), &TestFlashMode10L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.007"), &TestExposureModeInitialized2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.009"), &TestWhiteBalanceModeInitialized2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.008"), &TestFlashModeInitialized2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.005"), &TestDigiZoomInitializedMode0L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.GEN.GETINFO.001"), &TestGetInfo ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.GEN.RESETTODEFAULTSL.001"), &TestResetToDefaultsL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.VF.SETVIEWFINDERMIRROR.001"), &TestSetViewFinderMirrorL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.GETSTILLFRAMESIZE.001"), &TestGetStillFrameSizeWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.GETSTILLFRAMESIZE.002"), &TestGetStillFrameSizeWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.ESTIMATEDSTILLSIZEINBYTES.001"), &TestEstimatedStillSizeInBytesWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.ESTIMATEDSTILLSIZEINBYTES.002"), &TestEstimatedStillSizeInBytesWhenPreparedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.SETSNAPIMAGESIZE.001"), &TestSetSnapImageSizeBeforePrepareL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.SETSNAPIMAGESIZE.003"), &TestSetSnapImageSizeDuringAndAfterPrepareL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.INITUID.001"), &TestInitUidL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETJPEGQUALITY.002"), &TestSetJpegQuality0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETJPEGQUALITY.003"), &TestSetJpegQuality101L ) );
+
+#ifdef __CAMERA_BURST_MODE
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.M2.004"), &TestCaptureStillBurstIntervalM2L ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETJPEGCODEC.001"), &TestSetJpegCodecInvalidL ) );
+    
+    return suite;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillStates.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1263 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillStates.cpp
+*
+*/
+
+#include "CaeTestStillStates.h"
+#include <f32file.h>
+
+/*
+#if ( defined (__WINS__) || defined (__WINSCW) )
+_LIT(KProcessFileName, "c:\\stillstates.dat");
+#else
+_LIT(KProcessFileName, "e:\\stillstates.dat");
+#endif
+*/
+
+//const TReal32 KViewFinderFrameFrequencyMinimum = 13.0;
+
+
+
+CCaeTestStillStates::CCaeTestStillStates ()
+    {
+    }
+
+
+
+CCaeTestStillStates::~CCaeTestStillStates ()
+    {
+    }
+
+
+void CCaeTestStillStates::setUpL ()
+    {
+	iStatesClient = CCaeTestStatesClient::NewL();
+
+    iStatesClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestStillStates::tearDown ()
+    {
+    delete iStatesClient;    
+    iStatesClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+/********************************************************/
+/*               PREPARE STILL CAPTURE                  */
+/********************************************************/
+
+void CCaeTestStillStates::TestPrepareStillCaptureNeg1L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Try to prepare the engine for still image capture using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( -1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing ) );
+    assertL( error != KErrNone );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCapture3L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Try to prepare the engine for still image capture using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 3 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing ) );
+    assertL( error != KErrNone );
+    }
+
+void CCaeTestStillStates::TestSpecPrepareSCUnsupportedFormatWhenInitializedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format unsupported by Camera API implementation. 
+	//          Initialization is done.
+    //
+	// Output : Leave.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthTooBig, KImgHeightTooBig );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill ) );//verified if is correct action
+    assertL( error != KErrNone );
+    }
+
+void CCaeTestStillStates::TestSpecPrepareSCSupportedFormatWhenPreparedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.009
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format supported by Camera API implementation. 
+	//          Still Capture prepared.
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStillWhenPrepared );//verified if is correct action
+    }
+
+void CCaeTestStillStates::TestPrepareCroppedStillCapturingL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.011
+    //
+    // Group:   Capture
+    // 
+    // Action : 
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareCroppedStillCapturing ) );
+    assertL( error == KErrNotSupported );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCaptureWhenPowerOffL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.011
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare still capture when init is not ready
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCaptureWhenPowerOff ) );
+    assertL( error == KErrNotReady );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCaptureWhenRecordingL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.012
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare still capture when recording
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCaptureWhenRecording ) );
+    assertL( error == KErrNotReady );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCaptrureWrongSizeL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.013
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format unsupported by Camera API implementation. 
+	//          Initialization is done.
+    //
+	// Output : Leave.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize wrongSize( 600, 400 );
+
+    iStatesClient->SetStillFrameSize( wrongSize );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill ) );//verified if is correct action
+    assertL( error == KErrNotSupported );
+    }
+
+/********************************************************/
+/*                 STATE CHANGE                         */
+/********************************************************/
+
+void CCaeTestStillStates::TestReleaseL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.002
+	//
+    // General
+    // 
+    // Action : Try to release the camera module.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERelease );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestReleaseReleaseL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.003
+	//
+    // General
+    // 
+    // Action : Try to release the camera module twice.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseRelease);
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestReserveL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.004
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation.  
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReserveReserve );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestReleaseReserveCaptureL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.005
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillFileName( _L("cae_relres_ql_2.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveCapture );
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    }
+
+
+/********************************************************/
+/*                GENERAL TESTS                         */
+/********************************************************/
+
+void CCaeTestStillStates::TestPowerOffPowerOffL()
+    {
+    // ID: CAE.GEN.POWEROFFPOWEROFF.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off two time, when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPowerOffPowerOff );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestCaptureAfterPowerOffOnL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.POWEROFF.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image after poweroff + poweron.
+	//      
+	// Output : No leave, image cae_snap_1_8_vga_poweroffon captured
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    //iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_poweroff.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_poweroffon.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillAfterPowerOffOn );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStartVfStartVfL()
+    {
+	// CAE.VF.STARTVIEWFINDERSTARTVIEWFINDER.001
+    //
+    // View Finder
+    // 
+    // Action : Test start two time view finder, when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetViewFinderSize( sizeQqvga );
+
+    iStatesClient->SetTimeout( 100000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfStartVf );
+    }
+
+void CCaeTestStillStates::TestStartVfWhenPowerOffL()
+    {
+	// CAE.VF.STARTVIEWFINDERWHENPOWEROFF.001
+    //
+    // View Finder
+    // 
+    // Action : Test to start view finder when power is off, initialization is done.
+	//      
+	// Output : Leave.  
+    
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfWhenPowerOff ) );
+    assertL( error == KErrNotReady );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillWhenInitializedL()
+    {
+	// CAE.SC.CANCEL.001
+    //
+    // Capture (actually just cancelling)
+    // 
+    // Action : Test to cancel still capturing when just initialization is done.
+	//      
+	// Output : OK.  
+    
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECancelCaptureStillWhenInitialized );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillAtSnapL()
+    {
+	// CAE.SC.CANCEL.002
+    //
+    // Capture
+    // 
+    // Action : Test to cancel still capturing after snap image callback. Captures an image after cancelling.
+	//      
+	// Output : OK.  
+    
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillAtSnap );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancelling
+    assertL( iStatesClient->CountSnapImageReady() == 3 );
+    // Changed this from 2 to 3. Before it was timing dependent, giving either value. Now the case is timed better.
+    assertL( iStatesClient->CountStillImageReady() == 3 ); 
+    }
+
+
+/********************************************************/
+/*                STILL BURST TESTS                     */
+/********************************************************/
+
+
+void CCaeTestStillStates::TestCaptureCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURECAPTURESTILLBURST.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burstburst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burstburst3.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountSnapImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+void CCaeTestStillStates::TestSpecPrepCaptureCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURECAPTURESTILLBURST.3.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_spburstburst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_spburstburst3.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountSnapImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+void CCaeTestStillStates::TestCaptureStillBurst3CaptureStillL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst3capture.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst3capture.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestSpecPrepCaptureStillBurst3CaptureStillL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_qqvga16M_spburst3capture.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga16M_spburst3capture.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureStillBurstCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillBurst3AtSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and cancel still burst after snap image callback, 
+    //          initialization is done. After cancelling captures a burst.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancel.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancel.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstAtSnap );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancel
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == 3 * KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() >= KStillBurstLength + 1 );
+    assertL( iStatesClient->CountStillImageReady() >= KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillBurst3AtMomentL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and cancel still burst in the second capture moment callback.
+    //          Initialization is done. After cancelling prepares, captures burst, and cancels.
+    //          Then captures a burst that is not cancelled.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancelmom.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancelmom.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstAtMoment );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancel
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 + 1 + KStillBurstLength ) );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestCaptureStillBurstMp2Exif100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.MP2EXIF.IGNORE.100.001
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with 2 megapixel Exif images. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+void CCaeTestStillStates::TestCaptureStillBurstMp1Exif100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.MP1EXIF.IGNORE.100.001
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with one megapixel Exif images. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+
+
+void CCaeTestStillStates::TestCaptureStillBurstVgaBitmap100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.VGABITMAP.IGNORE.100.002
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with VGA bitmaps. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave    
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+
+void CCaeTestStillStates::TestCaptureStillBurstVgaJpeg100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.VGAJPEG.IGNORE.100.003
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with VGA Jpeg images. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave    
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestStillStates::TestDestroy1L()
+    {
+	// ID: CAE.SC.DESTROY.001
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine when still capture prepare is ready. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy2L()
+    {
+	// ID: CAE.SC.DESTROY.002
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after snap image callback. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy3L()
+    {
+	// ID: CAE.SC.DESTROY.003
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after snap image callback. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy4L()
+    {
+	// ID: CAE.SC.DESTROY.004
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after still image callback. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillCaptureReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy5L()
+    {
+	// ID: CAE.SC.DESTROY.005
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after still burst ready callback. 
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillBurstReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy6L()
+    {
+	// ID: CAE.SC.DESTROY.006
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after the first snap image callback in still burst. 
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReadyInStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() >= 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy7L()
+    {
+	// ID: CAE.SC.DESTROY.007
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after the first still image callback in still burst. 
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillImageReadyInStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() >= 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+
+void CCaeTestStillStates::TestEncodingErrorL()
+    {
+	// ID: CAE.SC.ERRORS.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated encoding error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EEncodingError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestPowerErrorL()
+    {
+	// ID: CAE.SC.ERRORS.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated camera power error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPowerError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 0 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestReserveErrorL()
+    {
+	// ID: CAE.SC.ERRORS.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated camera reservation error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EReserveError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 0 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestStillCaptureErrorL()
+    {
+	// ID: CAE.SC.ERRORS.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated capture error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillCaptureError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestSnapImageErrorL()
+    {
+	// ID: CAE.SC.ERRORS.005
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated snap image error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESnapImageError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestStillImageErrorL()
+    {
+	// ID: CAE.SC.ERRORS.006
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillImageError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStillConvertError1L()
+    {
+	// ID: CAE.SC.ERRORS.007
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image conversion error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError1 ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStillConvertError2L()
+    {
+	// ID: CAE.SC.ERRORS.008
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image conversion error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError2 ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStillConvertError3L()
+    {
+	// ID: CAE.SC.ERRORS.009
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image conversion error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError3 ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestStillStates::TestSetCameraIndexLowL()
+    {
+	// ID: CAE.SC.SETCAMERAINDEX.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Set camera index to -1 and capture a still image.
+	//      
+	// Output : leave
+
+    iStatesClient->SetDisplayIndex( 1 );
+    iStatesClient->SetSnapFileName( _L("cae_snap_camera_index_1.mbm") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetCameraIndexLow ) );
+    assertL( error == KErrHardwareNotAvailable );
+    }
+
+void CCaeTestStillStates::TestSetCameraIndexHighL()
+    {
+	// ID: CAE.SC.SETCAMERAINDEX.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Set camera index to too big value and capture a still image.
+	//      
+	// Output : leave
+
+    iStatesClient->SetDisplayIndex( 1 );
+    iStatesClient->SetSnapFileName( _L("cae_snap_camera_index_1.mbm") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetCameraIndexHigh ) );
+    assertL( error == KErrHardwareNotAvailable );
+    }
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCaeTestStillStates::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestStillStates") );
+
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.005"), &TestPrepareStillCaptureNeg1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.006"), &TestPrepareStillCapture3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.008"), &TestSpecPrepareSCUnsupportedFormatWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.009"), &TestSpecPrepareSCSupportedFormatWhenPreparedL ) );
+   
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.010"), &TestPrepareCroppedStillCapturingL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.011"), &TestPrepareStillCaptureWhenPowerOffL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.012"), &TestPrepareStillCaptureWhenRecordingL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.013"), &TestPrepareStillCaptrureWrongSizeL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.002"), &TestReleaseL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.003"), &TestReleaseReleaseL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.004"), &TestReserveL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.005"), &TestReleaseReserveCaptureL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.POWEROFFPOWEROFF.001"), &TestPowerOffPowerOffL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILL.POWEROFF.002"), &TestCaptureAfterPowerOffOnL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.VF.STARTVIEWFINDERSTARTVIEWFINDER.001"), &TestStartVfStartVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.VF.STARTVIEWFINDERWHENPOWEROFF.001"), &TestStartVfWhenPowerOffL ) );
+        
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CANCEL.001"), &TestCancelCaptureStillWhenInitializedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CANCEL.002"), &TestCancelCaptureStillAtSnapL ) );
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURECAPTURESTILLBURST.3.001"), &TestCaptureCaptureStillBurst3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURECAPTURESTILLBURST.3.002"), &TestSpecPrepCaptureCaptureStillBurst3L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.001"), &TestCaptureStillBurst3CaptureStillL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.002"), &TestSpecPrepCaptureStillBurst3CaptureStillL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.007"), &TestCancelCaptureStillBurst3AtSnapL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.008"), &TestCancelCaptureStillBurst3AtMomentL ) );
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
+	suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.MP1EXIF.IGNORE.100.001"), &TestCaptureStillBurstMp1Exif100IgnoreErrorsL ) );
+#endif
+#if (MIRAGE_X_PROD7)
+	suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.MP2EXIF.IGNORE.100.001"), &TestCaptureStillBurstMp2Exif100IgnoreErrorsL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.VGABITMAP.IGNORE.100.002"), &TestCaptureStillBurstVgaBitmap100IgnoreErrorsL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.VGAJPEG.IGNORE.100.003"), &TestCaptureStillBurstVgaJpeg100IgnoreErrorsL ) );
+
+#endif // __CAMERA_BURST_MODE
+
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.001"), &TestDestroy1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.002"), &TestDestroy2L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.003"), &TestDestroy3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.004"), &TestDestroy4L ) );
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.005"), &TestDestroy5L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.006"), &TestDestroy6L ) );    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.007"), &TestDestroy7L ) );
+#endif
+    
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.001"), &TestEncodingErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.002"), &TestPowerErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.003"), &TestReserveErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.004"), &TestStillCaptureErrorL ) );
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.005"), &TestSnapImageErrorL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.006"), &TestStillImageErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.007"), &TestStillConvertError1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.008"), &TestStillConvertError2L ) );
+    // suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.009"), &TestStillConvertError3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.SETCAMERAINDEX.001"), &TestSetCameraIndexLowL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.SETCAMERAINDEX.002"), &TestSetCameraIndexHighL ) );
+#endif
+    return suite;
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestTop.cpp
+*
+*/
+#include "CaeTestTop.h"
+#include "CaeTestRelease.h"
+#include "CaeTestStillSettings.h"
+#include "CaeTestStillStates.h"
+#include "CaeTestVideoStates.h"
+#include "CaeTestVideoSettings.h"
+
+#include <e32des8.h>
+
+
+// Starting point of the DLL (Always needed) 
+#ifndef EKA2
+GLDEF_C TInt E32Dll( TDllReason )
+    {
+    return( KErrNone );
+    }
+#endif
+
+// Exactly one exported function returning the suite of 
+// test functions for the test runner in the framework.
+// (Always needed)
+//
+
+
+EXPORT_C MTest* CreateTopFct()
+    {
+	return ( CCaeTestTop::suiteL() );
+    }
+
+
+CCaeTestTop::~CCaeTestTop()
+    {
+    }
+
+
+MTest* CCaeTestTop::suiteL()
+    {
+	CTestSuite *suite = CTestSuite::NewL( _L8( "Camera Application Engine Test Suite Container" ) );
+    
+    suite->addTestL( CCaeTestRelease::suiteL() );
+    
+    //suite->addTestL( CCaeTestStillStates::suiteL() );
+    //suite->addTestL( CCaeTestVideoStates::suiteL() );
+    
+  	//suite->addTestL( CCaeTestStillSettings::suiteL() );
+    //suite->addTestL( CCaeTestVideoSettings::suiteL() );
+    
+    return suite;	
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoSettings.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,2053 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoSettings.cpp
+*
+*/
+
+#include "CaeTestVideoSettings.h"
+#include <f32file.h>
+
+
+
+CCaeTestVideoSettings::CCaeTestVideoSettings()
+    {
+    }
+
+
+CCaeTestVideoSettings::~CCaeTestVideoSettings()
+    {
+    }
+
+
+void CCaeTestVideoSettings::setUpL()
+    {
+	iSettingsClient = CCaeTestSettingsClient::NewL();
+
+    iSettingsClient->SetFileNameBase( KFileNameBase );
+    }
+
+//_LIT(KVideoFileName, "videoclip.3gp");
+
+void CCaeTestVideoSettings::tearDown()
+    {
+    delete iSettingsClient;
+    iSettingsClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/********************************************************/
+/*             VIDEO RECORDING DIGITAL ZOOM VALUE       */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestDigiZoomVal2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.008
+    //
+    // Action : Test out-of-bounds digital zoom value.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom + 1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestDigiZoomNegVal1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.009
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( -1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING DIGITAL ZOOM MODE        */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestDigiZoomMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.006
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestOpticalZoomMode1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.007
+    //
+    // Action : Test optical zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );//verify if is correct action
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestOpticalDigiZoomMode2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.008
+    //
+    // Action : Test optical digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 2 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );//verify if is correct action
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestDigiZoomNegMode1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.009
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( -1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );//verify if is correct action
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING BRIGHTNESS               */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestBrightness0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.009
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_brightness_0.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightness100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.010
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightnessNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.011
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_-100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightness101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.012
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightnessNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.013
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_-101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CONTRAST                 */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestContrast0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.009
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_contrast_0.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrast100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.010
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrastNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.011
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_-100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrast101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.012
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrastNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.013
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_-101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+
+/********************************************************/
+/*             VIDEO RECORDING EXPOSURE MODE            */
+/********************************************************/
+
+
+void CCaeTestVideoSettings::TestExposureMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.010
+    //
+    // Action : Test exposure mode 2.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestVideoSettings::TestExposureMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.011
+    //
+    // Action : Test exposure mode 4
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_4.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestVideoSettings::TestExposureModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.012
+    //
+    // Action : Test invalid exposure mode
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestVideoSettings::TestExposureMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.013
+    //
+    // Action : Test combined exposure modes.
+	//      
+	// Output : Leave. 
+
+	const TInt KSetVal = 5;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    // iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_5.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err != KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*           VIDEO RECORDING WHITE BALANCE MODE         */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.011
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.012
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.013
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_4.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.014
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_8.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode10L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.015
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 0x10;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_10.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.016
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.017
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_5.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode12L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.018
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 0x12; // illegal combination of cloudy & flash
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_12.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING FLASH MODE               */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestFlashMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.009
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	const TInt KSetVal = 0;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared );
+}
+
+void CCaeTestVideoSettings::TestFlashMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.010
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.011
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.012
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_4.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.013
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_8.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.014
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_flash_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestFlashMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.015
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_flash_mode_5.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CLIP MAX SIZE            */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestVideoClipMaxSize0L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.001
+    //
+    // Action : Test video clip max size setting with video recording.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared );
+}
+
+void CCaeTestVideoSettings::TestVideoClipMaxSizeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.003
+    //
+    // Action : Test video clip max size setting with video recording.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( -1 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_-1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared );
+}
+
+/*
+void CCaeTestVideoSettings::TestVideoClipMaxSize10001L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.004
+    //
+    // Action : Test video clip max size setting with video recording.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 10000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10001 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_10001.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared ) );
+    assertL( err == KErrCompletion );
+}
+*/
+
+/********************************************************/
+/*               VIDEO RECORDING AUDIO                  */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestVideoAudioETrueL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.001
+    //
+    // Action : Test audio enable setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( ETrue );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_true.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoPrepared );
+}
+
+void CCaeTestVideoSettings::TestVideoAudioEFalseL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.002
+    //
+    // Action : Test audio enable setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( EFalse );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_false.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoPrepared );
+}
+
+
+/********************************************************/
+/*                    VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestExposureModeRecording2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.014
+    //
+    // Action : Test exposure mode
+	//      
+	// Output : No leave if mode is supported. Leave if not supported.  
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_recording_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoRecording ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceModeRecording2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.018
+    //
+    // Action : Test white balance setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_recording_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoRecording ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashModeRecording2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.016
+    //
+    // Action : Test flash mode setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_recording_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoRecording ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestDigiZoomRecordingMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.010    // ID:      CAE.SET-VR.SETZOOMMODEL.006
+    //
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_recording_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoRecording );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestVideoClipMaxSizeRecording10000L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.005
+    //
+    // Action : Test video clip max size setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10000 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_recording_10000.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoRecording ) );
+    assertL( err == KErrNotReady );
+}
+
+void CCaeTestVideoSettings::TestVideoClipMaxSizeNotInitialized10000L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.006
+    //
+    // Action : Test video clip max size setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10000 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_recording_10000.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoNotInitialized ) );
+    assertL( err == KErrNotReady );
+}
+
+void CCaeTestVideoSettings::TestVideoAudioRecordingETrueL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.003
+    //
+    // Action : Test audio enable setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( ETrue );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_recording_true.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoRecording ) );
+    assertL( err == KErrNotReady );
+}
+
+void CCaeTestVideoSettings::TestVideoAudioNotInitializedL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.004
+    //
+    // Action : Test audio enable setting with video not initialized.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( ETrue );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_recording_notinit.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoNotInitialized ) );
+    assertL( err == KErrNotReady );
+}
+void CCaeTestVideoSettings::TestGetVideoAudioNotInitializedL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.GET-VR.GETVIDEOAUDIO.005
+    //
+    // Action : Test video audio
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( EFalse );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_notinit.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetAudioWhenVideoNotInitialized );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING FILE NAME       */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestSetVideoFileNameL()
+    {
+	// Group:   Settings.
+    //
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.001
+    // 
+    // Action : Try to set valid file name for the video clip to be recorded. 
+    //          Video recorder initialization is done .
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videoclip.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenInitialized );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+
+void CCaeTestVideoSettings::TestSetEmptyVideoFileNameL()
+    {
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.002
+    // 
+    // Action : Try to set invalid (empty) file name for the video clip to be recorded. 
+    //          Video recorder initialization is done .
+	//      
+	// Output : Leave.    
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    //iSettingsClient->SetVideoFileName( _L("") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEmptyVideoFileNameWhenInitialized ) );
+    assertL( err != KErrNone );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+
+void CCaeTestVideoSettings::TestSetVideoFileNameWhenPreparedL()
+    {
+	// Group:   Settings.
+    //
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.003
+    // 
+    // Action : Set Video File Name when prepared
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videoclip.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenPrepared );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoFileNameWhenNotInitializedL()
+    {
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.004
+    // 
+    // Action : Try to set file name for the video clip to be recorded. 
+    //          Video recorder initialization is not done .
+	//      
+	// Output : Leave.    
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videoclipnoi.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenNotInitialized ) );
+    assertL( err != KErrNone );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 ); // This is not videoinit counter
+    }
+
+void CCaeTestVideoSettings::TestSetVideoFileNameWhenRecordingL()
+    {
+	// Group:   Settings.
+    //
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.005
+    // 
+    // Action : Set Video File Name when recording
+	//      
+	// Output : Leave. 
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videocliprec.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenRecording ) );
+    assertL( err != KErrNone );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*             VIDEO RECORDING TIME INTERVAL            */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalSubQcifWhenPreparedL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.001
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Inform about video recording time elapsed.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_prepared_subqcif.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( 400000 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingOn() == 2 );
+    assertL( iSettingsClient->CountVideoRecordingPaused() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingTimes() >= 3 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalSubQcifWhenRecordingL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.002
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video recording. 
+    //          Inform about video recording time elapsed.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_recording_subqcif.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( 400000 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoRecording ) );
+    assertL( err == KErrNotReady );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingOn() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingTimes() >= 2 );
+
+    }
+
+void CCaeTestVideoSettings::TestSetZeroVideoTimeIntervalSubQcifWhenPreparedL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.003
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Inform about video recording time elapsed.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_zero_prepared_subqcif.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( 0 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingOn() == 2 );
+    assertL( iSettingsClient->CountVideoRecordingPaused() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingTimes() == 0 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalNegativeL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.004
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Set illegal interval
+	//      
+	// Output : Leave.
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_prepared_subqcif_neg.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( -1 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared ) );
+    assertL( err == KErrArgument );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalHugeL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.005
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Set illegal interval
+	//      
+	// Output : Leave.
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_prepared_subqcif_neg.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( KMaxTUint32 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared ) );
+    assertL( err == KErrArgument );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    }
+
+/********************************************************/
+/*                 GET VIDEO FRAME SIZE                 */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestGetVideoFrameSizeWhenInitializedL()
+    {
+	// ID:      CAE.VR.GETVIDEOFRAMESIZE.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame size of the specified 
+    //          quality level, when initialization is done.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetVideoFrameSizeWhenInitialized ) );
+    assertL( err == KErrNone );
+
+    TSize size( KImgWidthQCIF, KImgHeightQCIF );
+
+    TSize videoFrameSize;
+    iSettingsClient->GetVideoFrameSize( videoFrameSize );
+    if ( videoFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestVideoSettings::TestGetVideoFrameSizeWhenPreparedL()
+    {
+	// ID:      CAE.VR.GETVIDEOFRAMESIZE.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame size of the specified 
+    //          quality level, when prepared.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetVideoFrameSizeWhenPrepared );
+
+    TSize size( KImgWidthQCIF, KImgHeightQCIF );
+
+    TSize videoFrameSize;
+    iSettingsClient->GetVideoFrameSize( videoFrameSize );
+    if ( videoFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+/********************************************************/
+/*                  VIDEO FRAME RATE                    */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestVideoFrameRateWhenInitializedL()
+    {
+	// ID:      CAE.VR.VIDEOFRAMERATE.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame rate of the specified 
+    //          quality level, when initialization is done.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EVideoFrameRateWhenInitialized ));
+    assertL( err == KErrNone );
+
+    TReal32 expectedResult( 15.0 );
+
+    TReal32 videoFrameRate = iSettingsClient->VideoFrameRate();
+    if ( videoFrameRate != expectedResult )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestVideoSettings::TestVideoFrameRateWhenPreparedL()
+    {
+	// ID:      CAE.VR.VIDEOFRAMERATE.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame rate of the specified 
+    //          quality level, when prepared.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EVideoFrameRateWhenPrepared );
+
+    TReal32 expectedResult( 15.0 );
+
+    TReal32 videoFrameRate = iSettingsClient->VideoFrameRate();
+    if ( videoFrameRate != expectedResult )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+/********************************************************/
+/*          ESTIMATED VIDEO RECORDING BIT RATE           */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestEstimatedVideoRecordingBitRateWhenInitializedL()
+    {
+	// ID:      CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the estimated video recording bit rate including audio bit rate 
+    //          (for specified video quality level) when initialization is done.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedVideoRecordingBitRateWhenInitialized ) );
+    assertL( err == KErrNone );
+
+    TInt videoBitRate;
+    videoBitRate = iSettingsClient->EstimatedVideoRecordingBitRate();
+    if ( videoBitRate != 78000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestVideoSettings::TestEstimatedVideoRecordingBitRateWhenPreparedL()
+    {
+	// ID:      CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the estimated video recording bit rate including audio bit rate 
+    //          (for specified video quality level) when prepared.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedVideoRecordingBitRateWhenPrepared );
+
+    TInt videoBitRate;
+    videoBitRate = iSettingsClient->EstimatedVideoRecordingBitRate();
+    if ( videoBitRate != 78000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCaeTestVideoSettings::suiteL ()
+{
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestVideoSettings") );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.001"), &TestVideoClipMaxSize0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.003"), &TestVideoClipMaxSizeNeg1L ) );	
+
+// NOT IN USE:    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.004"), &TestVideoClipMaxSize10001L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.008"), &TestDigiZoomVal2L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.009"), &TestDigiZoomNegVal1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.006"), &TestDigiZoomMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.007"), &TestOpticalZoomMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.008"), &TestOpticalDigiZoomMode2L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.009"), &TestDigiZoomNegMode1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.009"), &TestBrightness0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.010"), &TestBrightness100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.011"), &TestBrightnessNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.012"), &TestBrightness101L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.013"), &TestBrightnessNeg101L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.009"), &TestContrast0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.010"), &TestContrast100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.011"), &TestContrastNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.012"), &TestContrast101L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.013"), &TestContrastNeg101L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.010"), &TestExposureMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.011"), &TestExposureMode4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.012"), &TestExposureModeNeg1L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.013"), &TestExposureMode5L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.011"), &TestWhiteBalanceMode1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.012"), &TestWhiteBalanceMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.013"), &TestWhiteBalanceMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.014"), &TestWhiteBalanceMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.015"), &TestWhiteBalanceMode10L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.016"), &TestWhiteBalanceModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.017"), &TestWhiteBalanceMode5L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.018"), &TestWhiteBalanceMode12L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.009"), &TestFlashMode0L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.010"), &TestFlashMode1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.011"), &TestFlashMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.012"), &TestFlashMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.013"), &TestFlashMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.014"), &TestFlashModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.015"), &TestFlashMode5L ) );	
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.001"), &TestVideoAudioETrueL ) );
+       
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.002"), &TestVideoAudioEFalseL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.014"), &TestExposureModeRecording2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.018"), &TestWhiteBalanceModeRecording2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.016"), &TestFlashModeRecording2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.010"), &TestDigiZoomRecordingMode0L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.005"), &TestVideoClipMaxSizeRecording10000L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.006"), &TestVideoClipMaxSizeNotInitialized10000L ) );
+    
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.003"), &TestVideoAudioRecordingETrueL ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.004"), &TestVideoAudioNotInitializedL ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.GET-VR.GETVIDEOAUDIO.005"), &TestGetVideoAudioNotInitializedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.001"), &TestSetVideoFileNameL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.002"), &TestSetEmptyVideoFileNameL ) );  
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.003"), &TestSetVideoFileNameWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.004"), &TestSetVideoFileNameWhenNotInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.005"), &TestSetVideoFileNameWhenRecordingL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.001"), &TestSetVideoTimeIntervalSubQcifWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.002"), &TestSetVideoTimeIntervalSubQcifWhenRecordingL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.003"), &TestSetZeroVideoTimeIntervalSubQcifWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.004"), &TestSetVideoTimeIntervalNegativeL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.005"), &TestSetVideoTimeIntervalHugeL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.GETVIDEOFRAMESIZE.001"), &TestGetVideoFrameSizeWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.GETVIDEOFRAMESIZE.002"), &TestGetVideoFrameSizeWhenPreparedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.VIDEOFRAMERATE.001"), &TestVideoFrameRateWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.VIDEOFRAMERATE.002"), &TestVideoFrameRateWhenPreparedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.001"), &TestEstimatedVideoRecordingBitRateWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.002"), &TestEstimatedVideoRecordingBitRateWhenPreparedL ) );
+    
+    return suite;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoStates.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4006 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoStates.cpp
+*
+*/
+
+#include "CaeTestVideoStates.h"
+#include <f32file.h>
+
+
+//const TReal32 KViewFinderFrameFrequencyMinimum = 13.0;
+
+
+CCaeTestVideoStates::CCaeTestVideoStates ()
+    {
+    }
+
+
+CCaeTestVideoStates::~CCaeTestVideoStates ()
+    {
+    }
+
+
+void CCaeTestVideoStates::setUpL ()
+    {
+	iStatesClient = CCaeTestStatesClient::NewL( );
+
+    iStatesClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestVideoStates::tearDown ()
+    {
+    delete iStatesClient;    
+    iStatesClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/********************************************************/
+/*  VIDEO RECORDING PREPARE AND RECORD QUALITY LEVEL    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel0L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_0.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetTimeout( 5000000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel1L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_1.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->SetTimeout( 5000000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_1.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel2L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_2.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetTimeout( 5000000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*  VIDEO RECORDING SPECIAL PREPARE AND RECORD          */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioNoVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioNoVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+    iStatesClient->SetVideoAudio( EFalse ); // Audio does not work in emulator, error -9
+#else
+    iStatesClient->SetVideoAudio( ETrue );
+#endif
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioWithVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_vf.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioWithVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.006
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+    iStatesClient->SetVideoAudio( EFalse );// Audio does not work in emulator, error -9
+#else
+    iStatesClient->SetVideoAudio( ETrue );
+#endif
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio_vf.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PAUSE VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRecordPauseStopL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPauseWhenPreparedL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Call Pause when video is prepared but video recordind is not started.
+	//      
+	// Output : Leave..   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPauseVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestRecordPausePauseStopL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording twice.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPausePauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 2 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              RESUME VIDEO RECORDING                  */
+/********************************************************/
+
+void CCaeTestVideoStates::TestResumeWhenPreparedL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resume.3gp") );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestResumeWhenNotPausedL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resume.3gp") );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenNotPaused ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareVideoRecordingNeg1L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.005
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( -1 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_-1.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareVideoRecording3L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.006
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 3 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_3.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRUnsupportedFormatWhenVRInitializedL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.008
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format unsupported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : Leave.    
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    TSize sizeTooBig( KImgWidthTooBig, KImgHeightTooBig );
+    iStatesClient->SetVideoFrameSize( sizeTooBig );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_unsupported_format.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo ) );//verified if is correct action
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRSupportedFormatWhenPreparedL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.009
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation when video recording is prepared already. .
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iStatesClient->SetVideoFrameSize( sizeSubqcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_prepared.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideoWhenPrepared );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+/********************************************************/
+/*              START VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenVRInitializedL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.001
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenRecordingL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.002
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Video recording on.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenRecording ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    }
+
+/********************************************************/
+/*              STOP VIDEO RECORDING                    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenVRInitializedL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.001
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenPreparedL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.002
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Video recording prepared.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_stop_vr_prepared.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenPrepared ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                    STATE CHANGE                      */
+/********************************************************/
+
+void CCaeTestVideoStates::TestCaptureRecordL()
+    {
+	// ID:      CAE.STATECHANGE.CAPTURERECORD.002
+    //
+    // Group:   Capture & Record.
+    // 
+    // Action : Capture photo first and then record video successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordCaptureL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURE.003
+    //
+    // Group:   Record & Capture.
+    // 
+    // Action : Record video first and then capture photo successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordRecordL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDRECORD.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Record video two times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 2000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    // This should equal 2 because before 2nd recording we change the file name 
+    // and it needs preparation.
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence1L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence1 );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 7 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 7 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 7 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence2L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively. Contains also still bursts!
+	//      
+	// Output : No leave.    
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapFileName( _L("cae_complex2.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_complex2.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence2 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 4 /*3*/ );
+    assertL( iStatesClient->CountVideoRecordingOn() == 4 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 4 );
+    assertL( iStatesClient->CountSnapImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestReleaseReserveRecordL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.006
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_relres_ql_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestVideoStates::TestDestroy1L()
+    {
+	// ID: CAE.VR.DESTROY.001
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy2L()
+    {
+	// ID: CAE.VR.DESTROY.002
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is on.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingOn );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy3L()
+    {
+	// ID: CAE.VR.DESTROY.003
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is paused.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingPaused );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy4L()
+    {
+	// ID: CAE.VR.DESTROY.004
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is completed.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecorderOpenErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder opening.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderOpenError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecorderPrepareErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderPrepareError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecordingCompleteErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recording completion.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecordingCompleteError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestVideoStates::TestPrepareVideoSettingsErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder settings preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoSettingsError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR0L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 0 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_0.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR5150L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 5150 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5150.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR20000L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 20000 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_20000.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioType0L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.006
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type 0
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200AT0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoAT0 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioTypeInvL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.007
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type
+	//      
+	// Output : Leave
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200ATInv.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoATInv ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      MISC tests                                      */
+/********************************************************/
+void CCaeTestVideoStates::TestInitVideoRecorderWithUidL()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.002
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done with Uid.
+	//      
+	// Output : Leave, Uid init is not supported.
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorderWithUid ));
+    assertL( err == KErrNotSupported );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*        AMR audio tests (set 1 )                      */
+/********************************************************/
+/********************************************************/
+/*  VIDEO RECORDING PREPARE AND RECORD QUALITY LEVEL    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel0QL()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.Q.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_0.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_0Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel1QL()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_1.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_1Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel2QL()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_2.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_2Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*  VIDEO RECORDING SPECIAL PREPARE AND RECORD          */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioNoVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fpsQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioNoVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audioQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioWithVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_vfQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioWithVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.006
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio_vfQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PAUSE VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRecordPauseStopQL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPauseWhenPreparedQL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Call Pause when video is prepared but video recordind is not started.
+	//      
+	// Output : Leave..   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPauseVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestRecordPausePauseStopQL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording twice.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPausePauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 2 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              RESUME VIDEO RECORDING                  */
+/********************************************************/
+
+void CCaeTestVideoStates::TestResumeWhenPreparedQL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestResumeWhenNotPausedQL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenNotPaused ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareVideoRecordingNeg1QL()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.005
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( -1 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_-1Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareVideoRecording3QL()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.006
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 3 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_3Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.008
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format unsupported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : Leave.    
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    TSize sizeTooBig( KImgWidthTooBig, KImgHeightTooBig );
+    iStatesClient->SetVideoFrameSize( sizeTooBig );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_unsupported_formatQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo ) );//verified if is correct action
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRSupportedFormatWhenPreparedQL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.009
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation when video recording is prepared already. .
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iStatesClient->SetVideoFrameSize( sizeSubqcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_preparedQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideoWhenPrepared );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+/********************************************************/
+/*              START VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenVRInitializedQL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q.001
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenRecordingQL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Video recording on.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenRecording ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    }
+
+/********************************************************/
+/*              STOP VIDEO RECORDING                    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenVRInitializedQL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q.001
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenPreparedQL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Video recording prepared.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_stop_vr_preparedQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenPrepared ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                    STATE CHANGE                      */
+/********************************************************/
+
+void CCaeTestVideoStates::TestCaptureRecordQL()
+    {
+	// ID:      CAE.STATECHANGE.CAPTURERECORD.Q.002
+    //
+    // Group:   Capture & Record.
+    // 
+    // Action : Capture photo first and then record video successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordCaptureQL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURE.Q.003
+    //
+    // Group:   Record & Capture.
+    // 
+    // Action : Record video first and then capture photo successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordRecordQL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDRECORD.Q.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Record video two times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 2000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    // This should equal 2 because before 2nd recording we change the file name 
+    // and it needs preparation.
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence1QL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence1 );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 7 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 7 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 7 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence2QL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively. Contains also still bursts!
+	//      
+	// Output : No leave.    
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapFileName( _L("cae_complex2Q.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_complex2Q.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence2 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 4 /*3*/ );
+    assertL( iStatesClient->CountVideoRecordingOn() == 4 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 4 );
+    assertL( iStatesClient->CountSnapImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestReleaseReserveRecordQL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.Q.006
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoFileName( _L("cae_relres_ql_2Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestVideoStates::TestDestroy1QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.001
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy2QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is on.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingOn );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy3QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.003
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is paused.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingPaused );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy4QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.004
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is completed.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecorderOpenErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder opening.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderOpenError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecorderPrepareErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderPrepareError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecordingCompleteErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recording completion.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecordingCompleteError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestVideoStates::TestPrepareVideoSettingsErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder settings preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoSettingsError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR0QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 0 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_0Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR5150QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 5150 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5150Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR20000QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 20000 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_20000Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioType0QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.006
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type 0
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200AT0Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoAT0 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioTypeInvQL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.007
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type
+	//      
+	// Output : Leave
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200ATInvQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoATInv ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      MISC tests                                      */
+/********************************************************/
+void CCaeTestVideoStates::TestInitVideoRecorderWithUidQL()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.Q.002
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done with Uid.
+	//      
+	// Output : Leave, Uid init is not supported.
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorderWithUid ));
+    assertL( err == KErrNotSupported );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+
+
+
+
+/********************************************************/
+/*      AAC audio tests (set 2 )                      */
+/********************************************************/
+/********************************************************/
+/*  VIDEO RECORDING PREPARE AND RECORD QUALITY LEVEL    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel0Q4L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.Q4.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_0.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_0Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel1Q4L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q4.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_1.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_1Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel2Q4L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q4.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_2.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_2Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*  VIDEO RECORDING SPECIAL PREPARE AND RECORD          */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioNoVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fpsQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioNoVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audioQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioWithVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_vfQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioWithVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.006
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio_vfQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PAUSE VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRecordPauseStopQ4L()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q4.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPauseWhenPreparedQ4L()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q4.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Call Pause when video is prepared but video recordind is not started.
+	//      
+	// Output : Leave..   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPauseVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestRecordPausePauseStopQ4L()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q4.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording twice.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPausePauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 2 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              RESUME VIDEO RECORDING                  */
+/********************************************************/
+
+void CCaeTestVideoStates::TestResumeWhenPreparedQ4L()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q4.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestResumeWhenNotPausedQ4L()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q4.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenNotPaused ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareVideoRecordingNeg1Q4L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.005
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( -1 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_-1Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareVideoRecording3Q4L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.006
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 3 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_3Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQ4L()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.008
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format unsupported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : Leave.    
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    TSize sizeTooBig( KImgWidthTooBig, KImgHeightTooBig );
+    iStatesClient->SetVideoFrameSize( sizeTooBig );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_unsupported_formatQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo ) );//verified if is correct action
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRSupportedFormatWhenPreparedQ4L()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.009
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation when video recording is prepared already. .
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iStatesClient->SetVideoFrameSize( sizeSubqcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_preparedQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideoWhenPrepared );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+/********************************************************/
+/*              START VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenVRInitializedQ4L()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q4.001
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenRecordingQ4L()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Video recording on.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenRecording ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    }
+
+/********************************************************/
+/*              STOP VIDEO RECORDING                    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenVRInitializedQ4L()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q4.001
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenPreparedQ4L()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Video recording prepared.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_stop_vr_preparedQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenPrepared ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                    STATE CHANGE                      */
+/********************************************************/
+
+void CCaeTestVideoStates::TestCaptureRecordQ4L()
+    {
+	// ID:      CAE.STATECHANGE.CAPTURERECORD.Q4.002
+    //
+    // Group:   Capture & Record.
+    // 
+    // Action : Capture photo first and then record video successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordCaptureQ4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURE.Q4.003
+    //
+    // Group:   Record & Capture.
+    // 
+    // Action : Record video first and then capture photo successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordRecordQ4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDRECORD.Q4.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Record video two times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 2000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    // This should equal 2 because before 2nd recording we change the file name 
+    // and it needs preparation.
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence1Q4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q4.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence1 );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 7 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 7 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 7 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence2Q4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q4.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively. Contains also still bursts!
+	//      
+	// Output : No leave.    
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapFileName( _L("cae_complex2Q4.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_complex2Q4.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence2 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 4 /*3*/ );
+    assertL( iStatesClient->CountVideoRecordingOn() == 4 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 4 );
+    assertL( iStatesClient->CountSnapImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestReleaseReserveRecordQ4L()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.Q4.006
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoFileName( _L("cae_relres_ql_2Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestVideoStates::TestDestroy1Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.001
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy2Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is on.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingOn );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy3Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.003
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is paused.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingPaused );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy4Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.004
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is completed.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecorderOpenErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder opening.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderOpenError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecorderPrepareErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderPrepareError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecordingCompleteErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recording completion.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecordingCompleteError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestVideoStates::TestPrepareVideoSettingsErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder settings preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoSettingsError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR0Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 0 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_0Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR5150Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 5150 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5150Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR20000Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 20000 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_20000Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioType0Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.006
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type 0
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200AT0Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoAT0 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioTypeInvQ4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.007
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type
+	//      
+	// Output : Leave
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200ATInvQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoATInv ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      MISC tests                                      */
+/********************************************************/
+void CCaeTestVideoStates::TestInitVideoRecorderWithUidQ4L()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.Q4.002
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done with Uid.
+	//      
+	// Output : Leave, Uid init is not supported.
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorderWithUid ));
+    assertL( err == KErrNotSupported );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*            REMAINING VIDEO RECORDING TIME            */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRemainingTimeWhenVideoNotInitializedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.REMAININGVIDEORECORDINGTIME.002
+    //
+    // Action : Get RemainingVideoRecordingTime, when video recording is not initialized.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERemainingTimeWhenVideoNotInitialized );
+}
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+
+MTest* CCaeTestVideoStates::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestVideoStates") ); 
+
+    // AMR audio, H.263 video
+#if (!MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.004"), &TestPrepareAndRecordQualityLevel0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.005"), &TestPrepareAndRecordQualityLevel1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.006"), &TestPrepareAndRecordQualityLevel2L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.003"), &TestVideoRecordingQcif60000Fr10NoAudioNoVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.004"), &TestVideoRecordingQcif60000Fr10WithAudioNoVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.005"), &TestVideoRecordingQcif60000Fr10NoAudioWithVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.006"), &TestVideoRecordingQcif60000Fr10WithAudioWithVfL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.001"), &TestRecordPauseStopL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.002"), &TestPauseWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.003"), &TestRecordPausePauseStopL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.002"), &TestResumeWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.003"), &TestResumeWhenNotPausedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.005"), &TestPrepareVideoRecordingNeg1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.006"), &TestPrepareVideoRecording3L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.008"), &TestSpecPrepareVRUnsupportedFormatWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.009"), &TestSpecPrepareVRSupportedFormatWhenPreparedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.001"), &TestStartVideoRecordingWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.002"), &TestStartVideoRecordingWhenRecordingL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.001"), &TestStopVideoRecordingWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.002"), &TestStopVideoRecordingWhenPreparedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.CAPTURERECORD.002"), &TestCaptureRecordL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURE.003"), &TestRecordCaptureL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDRECORD.004"), &TestRecordRecordL ) );
+        
+    // These "complex sequences" take quite long, probably a minute or more.
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.005"), &TestRecordCaptureComplexSequence1L ) );
+    
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.006"), &TestRecordCaptureComplexSequence2L ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.006"), &TestReleaseReserveRecordL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002"), &TestPrepareAudioBitRateVR0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003"), &TestPrepareAudioBitRateVR5150L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.004"), &TestPrepareAudioBitRateVR12200L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.005"), &TestPrepareAudioBitRateVR20000L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.006"), &TestPrepareAudioBitRateVR12200AudioType0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.007"), &TestPrepareAudioBitRateVR12200AudioTypeInvL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.001"), &TestDestroy1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.002"), &TestDestroy2L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.003"), &TestDestroy3L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.004"), &TestDestroy4L ) );
+ 
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.002"), &TestInitVideoRecorderWithUidL ) );
+
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.001"), &TestVideoRecorderOpenErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.002"), &TestVideoRecorderPrepareErrorL ) );
+    // suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.003"), &TestVideoRecordingCompleteErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.004"), &TestPrepareVideoSettingsErrorL ) );
+    #endif
+#endif //!MIRAGE_X_PROD3
+
+    // AMR audio, H.263 video
+#if (MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.Q.004"), &TestPrepareAndRecordQualityLevel0QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q.005"), &TestPrepareAndRecordQualityLevel1QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q.006"), &TestPrepareAndRecordQualityLevel2QL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.003"), &TestVideoRecordingQcif60000Fr10NoAudioNoVfQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.004"), &TestVideoRecordingQcif60000Fr10WithAudioNoVfQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.005"), &TestVideoRecordingQcif60000Fr10NoAudioWithVfQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.006"), &TestVideoRecordingQcif60000Fr10WithAudioWithVfQL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q.001"), &TestRecordPauseStopQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q.002"), &TestPauseWhenPreparedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q.003"), &TestRecordPausePauseStopQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q.002"), &TestResumeWhenPreparedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q.003"), &TestResumeWhenNotPausedQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.005"), &TestPrepareVideoRecordingNeg1QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.006"), &TestPrepareVideoRecording3QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.008"), &TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.009"), &TestSpecPrepareVRSupportedFormatWhenPreparedQL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q.001"), &TestStartVideoRecordingWhenVRInitializedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q.002"), &TestStartVideoRecordingWhenRecordingQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q.001"), &TestStopVideoRecordingWhenVRInitializedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q.002"), &TestStopVideoRecordingWhenPreparedQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.CAPTURERECORD.Q.002"), &TestCaptureRecordQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURE.Q.003"), &TestRecordCaptureQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDRECORD.Q.004"), &TestRecordRecordQL ) );
+        
+    // These "complex sequences" take quite long, probably a minute or more.
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q.005"), &TestRecordCaptureComplexSequence1QL ) );
+    
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q.006"), &TestRecordCaptureComplexSequence2QL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.Q.006"), &TestReleaseReserveRecordQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.002"), &TestPrepareAudioBitRateVR0QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.003"), &TestPrepareAudioBitRateVR5150QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.004"), &TestPrepareAudioBitRateVR12200QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.005"), &TestPrepareAudioBitRateVR20000QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.006"), &TestPrepareAudioBitRateVR12200AudioType0QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.007"), &TestPrepareAudioBitRateVR12200AudioTypeInvQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.001"), &TestDestroy1QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.002"), &TestDestroy2QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.003"), &TestDestroy3QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.004"), &TestDestroy4QL ) );
+ 
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.Q.002"), &TestInitVideoRecorderWithUidQL ) );
+
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.001"), &TestVideoRecorderOpenErrorQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.002"), &TestVideoRecorderPrepareErrorQL ) );
+    // suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.003"), &TestVideoRecordingCompleteErrorQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.004"), &TestPrepareVideoSettingsErrorQL ) );
+    #endif
+#endif //MIRAGE_X_PROD3
+
+    // AAC audio, MPEG-4 video
+#if (MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.Q4.004"), &TestPrepareAndRecordQualityLevel0Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q4.005"), &TestPrepareAndRecordQualityLevel1Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q4.006"), &TestPrepareAndRecordQualityLevel2Q4L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.003"), &TestVideoRecordingQcif60000Fr10NoAudioNoVfQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.004"), &TestVideoRecordingQcif60000Fr10WithAudioNoVfQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.005"), &TestVideoRecordingQcif60000Fr10NoAudioWithVfQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.006"), &TestVideoRecordingQcif60000Fr10WithAudioWithVfQ4L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q4.001"), &TestRecordPauseStopQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q4.002"), &TestPauseWhenPreparedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q4.003"), &TestRecordPausePauseStopQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q4.002"), &TestResumeWhenPreparedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q4.003"), &TestResumeWhenNotPausedQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.005"), &TestPrepareVideoRecordingNeg1Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.006"), &TestPrepareVideoRecording3Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.008"), &TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.009"), &TestSpecPrepareVRSupportedFormatWhenPreparedQ4L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q4.001"), &TestStartVideoRecordingWhenVRInitializedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q4.002"), &TestStartVideoRecordingWhenRecordingQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q4.001"), &TestStopVideoRecordingWhenVRInitializedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q4.002"), &TestStopVideoRecordingWhenPreparedQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.CAPTURERECORD.Q4.002"), &TestCaptureRecordQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURE.Q4.003"), &TestRecordCaptureQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDRECORD.Q4.004"), &TestRecordRecordQ4L ) );
+        
+    // These "complex sequences" take quite long, probably a minute or more.
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q4.005"), &TestRecordCaptureComplexSequence1Q4L ) );
+    
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q4.006"), &TestRecordCaptureComplexSequence2QL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.Q4.006"), &TestReleaseReserveRecordQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.002"), &TestPrepareAudioBitRateVR0Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.003"), &TestPrepareAudioBitRateVR5150Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.004"), &TestPrepareAudioBitRateVR12200Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.005"), &TestPrepareAudioBitRateVR20000Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.006"), &TestPrepareAudioBitRateVR12200AudioType0Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.007"), &TestPrepareAudioBitRateVR12200AudioTypeInvQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.001"), &TestDestroy1Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.002"), &TestDestroy2Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.003"), &TestDestroy3Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.004"), &TestDestroy4Q4L ) );
+ 
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.Q4.002"), &TestInitVideoRecorderWithUidQ4L ) );
+
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.001"), &TestVideoRecorderOpenErrorQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.002"), &TestVideoRecorderPrepareErrorQ4L ) );
+    // suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.003"), &TestVideoRecordingCompleteErrorQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.004"), &TestPrepareVideoSettingsErrorQ4L ) );
+    #endif
+#endif //MIRAGE_X_PROD3
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.REMAININGVIDEORECORDINGTIME.002"), &TestRemainingTimeWhenVideoNotInitializedL ) );
+
+    return suite;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/StifCaeTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,359 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cae Test DLL
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "StifCaeTestTop.h"
+#include "TestFrameWork/testSuite.h"
+#include "CaeTestTop.h"
+#include "CaeTestRelease.h"
+#include "CaeTestStillSettings.h"
+#include "CaeTestStillStates.h"
+#include "CaeTestVideoStates.h"
+#include "CaeTestVideoSettings.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+
+    // Stack size
+    param->iTestThreadStackSize= 2*16384; // 2*16K stack
+
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    aTestModuleParam = param;
+
+    return KErrNone;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL( CCaeTestRelease::suiteL() );    
+    
+    //iTestSuite->addTestL( CCaeTestStillStates::suiteL() );
+    //iTestSuite->addTestL( CCaeTestVideoStates::suiteL() );
+    //iTestSuite->addTestL( CCaeTestStillSettings::suiteL() );
+    //iTestSuite->addTestL( CCaeTestVideoSettings::suiteL() );
+
+    
+    //SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+
+    /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+    // Next is a temporary solution for Stif memory leak error
+     TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksMem);
+     TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksRequests);
+     TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles);
+
+    if ( iAllocFailureType != RHeap::ENone )
+        {
+        RunTestCaseInOOMLoopL( aCaseNumber, aResult );
+        }
+    else
+        {
+        iTestSuite->ExecuteTestL( aResult, aCaseNumber );
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return KErrNone; 
+    }
+
+
+/*
+*/    
+
+void CTestModule::RunTestCaseInOOMLoopL( const TInt aCaseNumber,
+                                        TTestResult& aResult )
+    {
+
+    // 
+    TInt error = KErrNone; 
+    aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+
+    for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+        {      
+        // Switches on alloc failure simulation if the parameters are set for it
+        AllocFailureSimulation( ETrue ); 
+        RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+        TRAP( error, iTestSuite->ExecuteTestL( aResult, aCaseNumber ) );
+        if ( error == KErrNoMemory )
+            {
+            error = KErrNone;
+            }
+        }
+    
+    //
+    AllocFailureSimulation( EFalse );
+    User::LeaveIfError( error ); 
+    }
+
+
+/*
+*/    
+
+void CTestModule::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CTestModule::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+#ifndef EKA2
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/AssertFailure.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AssertFailure.cpp
+*
+*/
+
+
+#include "AssertFailure.h"
+
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+									  TInt aLineNumber,
+									  const TDesC8& aFileName)
+	{
+	CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+									   TInt aLineNumber,
+									   const TDesC8& aFileName)
+
+	{
+	CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+	CleanupStack::PushL(self);
+	self->ConstructL(aMessage, aFileName);
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self=NewLC(aAssertFailure);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self = new(ELeave)CAssertFailure;
+	CleanupStack::PushL(self);
+	self->ConstructL(aAssertFailure);
+	return self;
+	}
+
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+								 const TDesC8& aFileName)
+	{
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+	}
+
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+	{
+	iLineNumber = aAssertFailure.iLineNumber;
+	iMessage = aAssertFailure.iMessage->AllocL();
+	iFileName = aAssertFailure.iFileName->AllocL();
+	}
+
+
+CAssertFailure::CAssertFailure ()
+	{
+	}
+
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+	{
+	}
+
+
+CAssertFailure::~CAssertFailure () 
+	{
+    delete iFileName;
+	delete iMessage;
+	}
+
+
+const TDesC8& CAssertFailure::What() const
+	{
+	return *iMessage;
+	}
+
+
+TInt CAssertFailure::LineNumber()  const
+	{
+	return iLineNumber;
+	}
+
+
+const TDesC8& CAssertFailure::FileName()  const
+	{
+	return *iFileName;
+	}
+
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+	{
+	iMyHeapCellCount = aHeapCellCount;
+	}
+	
+
+TInt CAssertFailure::MyHeapCellCount ()
+	{
+	return iMyHeapCellCount;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestCase.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: TestCase.cpp
+*
+*/
+
+
+#include <utf.h>
+
+#include "TestFrameWork/testCase.h"
+#include "TestFrameWork/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "TestCase.h"
+#include "TestResult.h"
+#include "AssertFailure.h"
+#include "CppUnitLog.h"
+#endif
+
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestSuite.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: TestSuite.cpp
+*
+*/
+
+
+
+#include "TestFrameWork/testSuite.h"
+#include <StifTestModule.h>
+
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/custom_onboard_camera_api/custom_onboard_camera_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="e85dd3cb506ee5530c7574f14f94e89d" dataversion="2.0">
+<name>Custom Onboard Camera API</name>
+<description>Interface used by Camera Application Engine and should be provided by Onboard Camera API customInterface</description>
+<type>c++</type>
+<collection>CamAppEngine</collection>
+<libs></libs>
+<release category="platform" sinceversion="0" deprecatedsince="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>yes</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/custom_onboard_camera_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Custom Onboard Camera API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ECamColorToneCustomInterface.h     MW_LAYER_PLATFORM_EXPORT_PATH(ECamColorToneCustomInterface.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/custom_onboard_camera_api/inc/ECamColorToneCustomInterface.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Custom interface for Color Tone setting
+*
+*/
+
+
+#ifndef ECAMCOLORTONECUSTOMINTERFACE_H
+#define ECAMCOLORTONECUSTOMINTERFACE_H
+
+#include <e32base.h>
+
+// CONSTANTS
+
+const TUid KCameraColorToneSettingsUid = { 0x101F87C0 };
+
+// CLASS DECLARATION
+
+/**
+*  Custom interface for Color Tone setting.
+*
+*  @lib CamExt.lib
+*/
+class MCameraColorToneSettings
+    {
+
+    public: 
+
+        /**
+        * List of color tones
+        */
+        enum TColorTone
+            {
+            ENormal         = 0x00,
+            ESepia          = 0x01,
+            EGrayscale      = 0x02,
+            ENegative       = 0x04
+            };
+ 
+        /**
+        * Gives the current color tone setting value
+        * @return TColorTone
+        */
+        virtual TColorTone ColorTone() const = 0;
+
+        /**
+        * Sets color tone
+        * @param aValue new color tone
+        * @return void
+        */
+        virtual void SetColorToneL( TColorTone aValue ) = 0;
+
+        /**
+        * Gives the bitfield of supported color tones
+        * @return the bitfield that contains supported TColorTone features
+        */
+        virtual TUint32 SupportedColorTones() const = 0;
+
+    };
+
+#endif //ECAMCOLORTONECUSTOMINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Includes all the Domain API specific bld.inf files, which 
+*                export files.
+*
+*/
+
+
+
+#include "../media_recorder_sink_api/group/bld.inf"
+#include "../cae_extentension_api/group/bld.inf"
+#include "../camera_application_engine_api/group/bld.inf"
+#include "../custom_onboard_camera_api/group/bld.inf"
+#include "../imaging_configuration_manager_api/group/bld.inf"
+#include "../media_recorder_api/group/bld.inf"
+#include "../3gp_file_composer_api/group/bld.inf"
+#include "../asynchronous_file_saving_queue_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Imaging Configuration Manager API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/imagingconfigmanager.h     MW_LAYER_PLATFORM_EXPORT_PATH(imagingconfigmanager.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/imaging_configuration_manager_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="bfafa5e2c1835c4d51f4e1b87d2ab71c" dataversion="2.0">
+  <name>Imaging Configuration Manager API</name>
+  <description>Interface to provide Central Repository centralized easily configurable product specific settings to clients such as Camcorder UI, Camcorder MMF Plug-in and Video Editor Engine</description>
+  <type>c++</type>
+  <collection>configmanagers</collection>
+  <libs>
+    <lib name="imagingconfigmanager.lib" />
+  </libs>
+  <release category="platform"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/inc/imagingconfigmanager.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Configuration manager using Central Repository for retrieving
+*                settings for clients such as CamcorderMMFPlugin
+*
+*/
+
+
+#ifndef IMAGINGCONFIGMANAGER_H
+#define IMAGINGCONFIGMANAGER_H
+
+#include <mmf/common/mmfutilities.h>
+
+const TUint KMaxStringLength = 256; //Used for all text fields in setting sets
+const TUint KBasicQualityGranularity = 100; // the "multiplier" used for
+                                              // getting each level. e.g.
+                                              // level 1=100, level 2=200, ...
+const TUint KNumberOfNominalLevels = 3; // How many basic levels of quality
+                                        // there is.
+
+/*
+ * Video quality set structure
+ * 
+ * @since S60 v3.2
+ */
+class TVideoQualitySet
+    {
+    public:
+        // Enum level for the Quality set, used as ID
+        TUint iVideoQualitySetLevel;
+        // Video file format mime type, e.g. "video/3gpp"
+        TText8 iVideoFileMimeType[ KMaxStringLength ];
+        // Video codec mime type, e.g. "video/mp4v-es"
+        TText8 iVideoCodecMimeType[ KMaxStringLength ];
+        // Video picture width in pixels (luminance), resolution width
+        TInt iVideoWidth;
+        // Video picture height in pixels (luminance), resolution height
+        TInt iVideoHeight;
+        // Video framerate in fps
+        TReal iVideoFrameRate;
+        // Video bitrate in bps
+        TInt iVideoBitRate;
+        // Video encoder UID
+        TUid iVideoEncoderUID;
+        // Random access point rate, in pictures per second. For example, to
+        // request a random access point every ten seconds, set the value to
+        // 0.1. Random access means in video case usually that an INTRA frame
+        // is forced by the encoder to make the video accessible at that time
+        // without depending on the previous frames
+        TReal iRandomAccessRate;
+        // Video's pixel aspect ratio numerator, e.g. in PAL 16:11 pixel
+        // aspect ratio means that this value is set to 16
+        TUint iVideoPixelAspectRatioNum; 
+        // Video's pixel aspect ratio denominator, e.g. in PAL 16:11 pixel
+        // aspect ratio means that this value is set to 11
+        TUint iVideoPixelAspectRatioDenom;
+        // Preferred supplier for the MMF camcorder plug-in (e.g. "Nokia")
+        TText8 iPreferredSupplier[ KMaxStringLength ];
+
+        // Audio codec FourCC, e.g. " AMR"
+        TFourCC iAudioFourCCType;
+        // Audio bitrate in bps
+        TInt iAudioBitRate;
+        // Audio sampling rate in Hz
+        TInt iAudioSamplingRate;
+        // Number of audio channels; in practice mono(1) vs stereo(2)
+        TInt iAudioChannels;
+        // Audio encoder UID
+        TUid iAudioEncoderUID;
+        // Video recording A/V sync start delay (ms), only used by
+        // CamcorderMMFPlugIn, but depends on the qualityset
+        TInt iAVSyncStartDelay;
+        // Video recording A/V sync resume delay (ms), only used by
+        // CamcorderMMFPlugIn, but depends on the qualityset
+        TInt iAVSyncResumeDelay;
+        // A non-zero ID telling unique combination of camera (primary/
+        // secondary) and/or display (cover UI/main display) and/or rotation
+        // setting combined into a number for separating each setting set
+        // type from others
+        TUint iCameraDisplayId;
+        // Camcorder specific field that can be either 1(true) or 0(false)
+        // meaning if the current quality settings set should be shown on
+        // Camcorder UI or not
+        TUint iCamcorderVisible;
+	};
+
+/*
+ * Camcorder MMF Plug-in Specific settings structure
+ * 
+ * @since S60 v3.2
+ */
+class TCamcorderMMFPluginSettings
+	{
+	public:
+		// Video framerate in nightmode (fps)
+		TReal iVideoNightFrameRate;
+		// Video bitrate scaler for remaining time calculation during
+		// first 3seconds.
+		TReal iCMRAvgVideoBitRateScaler;
+		// Video Complexity Setting
+		TInt iVideoComplexitySetting;
+		// Quality is more important in camcorder than delay
+		TReal iCMRLatencyQualityTradeoff;
+		// range is [0...100]
+		TUint iCMRPictureQuality;
+		// Try to maintain the frame-rate,
+		// 1.0 means the picture quality is sacrificed 
+		// "all the way" to match the target fps
+		TReal iCMRQualityTemporalTradeoff;
+		// number of camera buffers to use when using HW accelerated encoder
+		TUint iCMRNumCameraBuffers;
+		// number of camera buffers to use when using SW encoder
+		TUint iCMRNumCameraBuffersARM;		
+		// min number of output (bitstream) buffers
+		TUint iCMRMinNumOutputBuffers;
+	};
+
+
+/*
+ * Image quality set structure
+ * 
+ * @since S60 v3.2
+ */
+class TImageQualitySet
+    {
+    public:
+        // Enum level for the Quality set, used as ID
+        TUint iImageQualitySetLevel;
+        // Image file format mime type, e.g. "image/jpeg"
+        TText8 iImageFileMimeType[ KMaxStringLength ];
+        // Image picture width in pixels, resolution width
+        TInt iImageWidth;
+        // Image picture height in pixels, resolution height
+        TInt iImageHeight;
+        // Image extension, e.g. ".jpg"
+        TText8 iImageFileExtension[ KMaxStringLength ];
+        // Image encoder UID
+        TUid iImageEncoderUID;
+        // Compression quality, determines wether file size or image quality
+        // is preferred over the other
+        TInt iCompressionQuality;
+        // Estimated image size, in bytes
+        TInt iEstimatedSize;
+        // A non-Zero ID telling unique combination of camera (primary/
+        // secondary) and/or display (cover UI/main display) and/or rotation
+        // setting combined into a number for separating each setting set type
+        // from others
+        TUint iCameraDisplayId;
+        // Camcorder specific field that can be either 1(true) or 0(false)
+        // meaning if the current quality settings set should be shown on
+        // Camcorder UI or not
+        TUint iCamcorderVisible;
+    };
+
+/**
+ *  API class for getting imaging configurations and settings
+ *
+ *  This class can be used to query supported Video and Image quality settings
+ *  (defined above) and CamcorderMMFPlugin settings.
+ *
+ *  @lib imagingconfigmanager.lib
+ *  @since S60 v3.2
+ */
+class CImagingConfigManager : public CBase
+    {
+    public:
+        /*
+         * Enumeration for nominal quality levels. Client must use these
+         * enumerations to get quality sets. However, if
+         * NumberOfQualityLevels() below indicates there are more than
+         * KNumberOfNominalLevels, client can use values in-between the
+         * nominal values to get set for some other quality level. It is
+         * however up to the implementation of the API to map such
+         * intermediate values to actual levels.
+         */
+        enum TQualityLevels
+            {
+            // client can try asking values in between these but the class may
+            // round the values depending on the availability
+            EQualityMin = 0,      // EQualityLow might not be the lowest.
+                                  // Level cannot go below this value
+            EQualityLow = 100,    // use this e.g. when MMS compatible
+                                  // settings are needed for video
+            EQualityNormal = 200, // use this when normal quality settings
+                                  // are needed, i.e. typically higher quality
+                                  // than MMS in Video, but possibly not the
+                                  // highest still
+            EQualityHigh = 300    // use this when highest possible quality
+                                  // settings are needed
+            };
+
+        /**
+         * Create new CImagingConfigManager object
+         *
+         * Possible leave codes: KErrGeneral & KErrNoMemory + possibly other
+         *                       CenRep Error codes
+         *
+         * @since S60 v3.2
+         * @return Allocated and initialized CImagingConfigManager object
+         */
+        IMPORT_C static CImagingConfigManager* NewL();
+
+        /**
+         * Create new CImagingConfigManager object
+         *
+         * Possible leave codes: KErrGeneral & KErrNoMemory + possibly other
+         *                       CenRep Error codes
+         *
+         * @since S60 v3.2
+         * @return Allocated and initialized CImagingConfigManager object
+         */
+        IMPORT_C static CImagingConfigManager* NewLC();
+
+        
+        /**
+         * Destructor
+         *
+         * @since S60 v3.2
+         */
+        ~CImagingConfigManager();
+
+        /**
+         * Get number of defined video quality levels. This is always at least
+         * KNumberOfNominalLevels but can be higher
+         *
+         * @since S60 v3.2
+         * @return Number of video quality levels
+         */
+        IMPORT_C TInt NumberOfVideoQualityLevels() const;
+
+        /**
+         * Get an array of quality levels that are in use with the current
+         * product (for the given CameraDisplayId or for all levels)
+         *
+         * Possible leave codes: KErrGeneral & KErrNoMemory
+         *
+         * @since S60 v3.2
+         * @param aLevels Returns an array of video quality levels
+         * @param aCameraDisplayID Unique ID for some camera-display
+         *        combination. If 0, then all levels are returned.
+         * @return KErrNone if no error, otherwise error message ID
+         */
+        IMPORT_C TInt GetVideoQualityLevelsL( CArrayFixFlat<TUint>& aLevels,
+                                              TUint aCameraDisplayID = 0 );
+
+        /**
+         * Get quality set associated with the given level. The level should
+         * be between EQualityHigh and EQualityMin, but these are just for
+         * guidance in general. These are specified in their own documentation
+         * more specifically. If there is no set associated with given
+         * intermediate level, then set from a nearest level is returned.
+         *
+         * @since S60 v3.2
+         * @param aSet Returned video quality set
+         * @param aLevel Level for which a quality set if requested
+         * @param aCameraDisplayID Unique ID for some camera-display
+         *        combination. If 0, then ignored and the smallest ID is
+         *        returned with given aLevel
+         * @return KErrNone if no error, otherwise error message ID
+         */
+        IMPORT_C TInt GetVideoQualitySet( TVideoQualitySet& aSet,
+                                          TInt aLevel,
+                                          TUint aCameraDisplayID = 0 );
+
+        /**
+         * Get quality set associated with the given video resolution, its
+         * MIME-type and audio fourCC. Both of these are needed to be uniquely
+         * able to select a single quality setting set. If certain pixel
+         * aspect ratio is wanted for the video, it can be requested with
+         * aVideoPixelAspectRatioNum and aVideoPixelAspectRatioDenom
+         * parameters. Otherwise they should be set to zero.
+         *
+         * @since S60 v3.2
+         * @param aSet Returned video quality set
+         * @param aVideoResolution Size of the video resolution that is
+         *        requested
+         * @param aVideoCodecMimeType MIME type of the video codec
+         * @param aVideoPixelAspectRatioNum Numerator of video's pixel aspect
+         *        ratio
+         * @param aVideoPixelAspectRatioDenom Denominator of video's pixel
+         *        aspect ratio
+         * @param aAudioFourCCType Four Character Code of the audio type
+         * @param aCameraDisplayID Unique ID for some camera-display
+         *        combination. If 0, then ignored and the smallest ID is
+         *        returned for the given parameters
+         * @return KErrNone if no error, otherwise error message ID
+         */
+        IMPORT_C TInt GetVideoQualitySet( TVideoQualitySet& aSet,
+                                  const TSize& aVideoResolution,
+                                  const TDesC8& aVideoCodecMimeType,
+                                  TUint aVideoPixelAspectRatioNum,
+                                  TUint aVideoPixelAspectRatioDenom,
+                                  TFourCC aAudioFourCCType,
+                                  TUint aCameraDisplayID = 0 );
+
+        /**
+         * Get all settings for Camcorder
+         *
+         * @since S60 v3.2
+         * @param aSet Returned setting set for CamcorderMMFPlugin
+         * @return KErrNone if no error, otherwise error message ID
+         */
+        IMPORT_C TInt GetCamcorderMMFPluginSettings(
+                                TCamcorderMMFPluginSettings& aSet) const;
+
+        /**
+         * Get number of defined image quality levels. This is always at least
+         * KNumberOfNominalLevels but can be higher
+         *
+         * @since S60 v3.2
+         * @return Number of image quality levels
+         */
+        IMPORT_C TInt NumberOfImageQualityLevels() const;
+
+        /**
+         * Get an array of quality levels that are in use with the current
+         * product (for the given CameraDisplayId or for all levels)
+         *
+         * Possible leave codes: KErrGeneral & KErrNoMemory
+         *
+         * @since S60 v3.2
+         * @param aLevels Returns an array of image quality levels
+         * @param aCameraDisplayID Unique ID for some camera-display
+         *        combination. If 0, then all levels are returned.
+         * @return KErrNone if no error, otherwise error message ID
+         */
+        IMPORT_C TInt GetImageQualityLevelsL( CArrayFixFlat<TUint>& aLevels,
+                                              TUint aCameraDisplayID = 0 );
+
+        /**
+         * Get image quality set associated with the given level. The level
+         * should be between EQualityHigh and EQualityMin. One the defined
+         * nominal levels should be used especially if NumberOfQualityLevels()
+         * == KNumberOfNominalLevels. If there is no set associated with given
+         * intermediate level, then set from a nearest level is returned.
+         *
+         * @since S60 v3.2
+         * @param aSet Returned image quality set
+         * @param aLevel Level for which a quality set if requested
+         * @param aCameraDisplayID Unique ID for some camera-display
+         *        combination. If 0, then ignored and the smallest ID is
+         *        returned with given aLevel
+         * @return KErrNone if no error, otherwise error message ID
+         */
+        IMPORT_C TInt GetImageQualitySet( TImageQualitySet& aSet,
+                                          TInt aLevel,
+                                          TUint aCameraDisplayID = 0 );
+
+        /**
+         * Get quality set associated with the given image resolution. Leaves
+         * if there is no defined set for the resolution.
+         *
+         * @since S60 v3.2
+         * @param aSet Returned image quality set
+         * @param aImageResolution Size of the image resolution that is
+         *        requested
+         * @param aCameraDisplayID Unique ID for some camera-display
+         *        combination. If 0, then ignored and the smallest ID is
+         *        returned with given aLevel
+         * @return KErrNone if no error, otherwise error message ID
+         */
+        IMPORT_C TInt GetImageQualitySet( TImageQualitySet& aSet,
+                                          const TSize& aImageResolution,
+                                          TUint aCameraDisplayID = 0 );
+        
+    private:
+        /**
+         * Default constructor, doing nothing
+         */
+        CImagingConfigManager();
+
+        /**
+         * Actual constructor where the reading from the Central Repository
+         * happens
+         */
+        void ConstructL();
+        
+        /**
+         * Helper function to check if the given value is negative
+         */
+        TBool CheckIfNegative( const TInt aValue ) const;
+        
+        /**
+         * Helper function to get the right part of a string starting after
+         * the given key word
+         */
+        TPtrC GetRightPartL( const TPtr& aPtr, const TDesC& aSearchable ) const;
+        
+        /**
+         * Helper function to get the left part of a string before the colon
+         */
+        TPtrC GetLeftPart( const TPtrC& aPtrc ) const;
+        
+        /**
+         * Helper function to copy TPtrC to TText8*
+         */
+        void SetTextStringL( const TPtrC& aPtr, TText8* aStringToFill ) const;
+        
+        /**
+         * Method for sorting level numbers in ascending order
+         */
+        TInt SortLevels(CArrayFixFlat<TUint>& aLevels);
+
+    private: // data
+        /**
+         * Video quality setting sets are stored internally to this pointer
+         * Own
+         */
+        CArrayFixFlat< TVideoQualitySet >* iVideoQualitySets;
+        
+        /**
+         * Camcorder MMF Plug-in's settings are stored here
+         * Own
+         */
+        TCamcorderMMFPluginSettings iCamcorderMMFPluginSettings;
+        
+        /**
+         * Image quality setting sets are stored internally to this pointer
+         * Own
+         */
+        CArrayFixFlat< TImageQualitySet >* iImageQualitySets;
+    };
+
+#endif //IMAGINGCONFIGMANAGER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/Bmarm/ICMSTIFU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/Bwins/ICMSTIFU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/EABI/ICMSTIFU.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/group/ICMSTIF.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  imaging_configuration_manager_api
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          ICMSTIF.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+DEFFILE         ICMSTIF.DEF
+
+VENDORID        VID_DEFAULT
+
+CAPABILITY      CAP_GENERAL_DLL
+
+SOURCEPATH      ../src
+SOURCE          ICMSTIF.cpp
+
+USERINCLUDE     ../inc 
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         imagingconfigmanager.lib
+
+LANG            SC
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/group/ICMSTIF.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,34 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: imaging_configuration_manager_api
+;
+; Languages
+; =========
+&EN
+
+; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
+; ==================================================================================================
+#{"STIFICMTEST"},(0x101FB3E7),1,0,1,TYPE=SA
+
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\ICMSTIF.dll"      -"$:\sys\bin\ICMSTIF.dll"
+
+; eof
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  imaging_configuration_manager_api
+*
+*/
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+ICMSTIF.mmp
+
+PRJ_MMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/inc/ICMSTIF.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ICMSTIF test module.
+*
+*/
+
+
+
+#ifndef ICMSTIF_H
+#define ICMSTIF_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include "imagingconfigmanager.h"
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+// Function pointer related internal definitions
+// Hack around known GCC bug.
+#ifndef __GCC32__
+#define GETPTR
+#else
+#define GETPTR &
+#endif  
+#define ENTRY(str,func) {(TText*)L##str, GETPTR func}
+
+
+// Logging path
+_LIT( KICMSTIFLogPath, "\\logs\\testframework\\ICMSTIF\\" ); 
+// Log file
+_LIT( KICMSTIFLogFile, "ICMSTIF.txt" ); 
+
+// FORWARD DECLARATIONS
+class CICMSTIF;
+
+// DATA TYPES
+typedef TInt (CICMSTIF::* TestFunction)(TTestResult&);    
+
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText* iCaseName;
+        TestFunction iMethod;
+    };
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;    
+        TestFunction iMethod;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {        
+        };
+
+    };
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// CLASS DECLARATION
+
+/**
+*  This a ICMSTIF class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CICMSTIF) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CICMSTIF* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CICMSTIF();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the ICMSTIF. 
+        *       It is called once for every instance of ICMSTIF after
+        *       its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of ICMSTIF.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from ICMSTIF. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& /* aFailureType */,
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; User may add implementation for OOM test 
+        * environment initialization. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL. User may add implementation 
+        * for OOM test warning handling. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */);
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CICMSTIF();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        /**
+        * Test cases
+        */
+		TInt TestCase_001L( TTestResult& aResult );
+		TInt TestCase_002L( TTestResult& aResult );
+		TInt TestCase_003L( TTestResult& aResult );
+		TInt TestCase_004L( TTestResult& aResult );
+		TInt TestCase_005L( TTestResult& aResult );
+		TInt TestCase_006L( TTestResult& aResult );
+		TInt TestCase_007L( TTestResult& aResult );
+		TInt TestCase_008L( TTestResult& aResult );
+		TInt TestCase_009L( TTestResult& aResult );
+		TInt TestCase_010L( TTestResult& aResult );
+		TInt TestCase_OOML( TTestResult& aResult );
+		
+		
+		void AllocFailureSimulation (TBool aSwitchedOn);
+		void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+
+    public:     // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        CStifLogger * iLog;
+        RHeap::TAllocFail iAllocFailureType;
+        TInt iAllocFailureRate;
+        TInt iCurrentAllocFailureRate;
+        TBool iMemTestEnabled;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // ICMSTIF_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/imaging_configuration_manager_api/tsrc/src/ICMSTIF.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1102 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ICMSTIF class member functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <StifTestInterface.h>
+#include "ICMSTIF.h"
+
+#include <e32debug.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::CICMSTIF
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CICMSTIF::CICMSTIF()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::ConstructL
+// Symbian 2nd phase constructor can leave.
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CICMSTIF::ConstructL()
+    {
+    iLog = CStifLogger::NewL( KICMSTIFLogPath, 
+                          KICMSTIFLogFile);
+/*    // SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+    iMemTestEnabled = ETrue;*/
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CICMSTIF* CICMSTIF::NewL()
+    {
+    CICMSTIF* self = new (ELeave) CICMSTIF;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CICMSTIF::~CICMSTIF()
+    { 
+    delete iLog;
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CICMSTIF::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo CICMSTIF::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    ICMSTIF.cpp file and to ICMSTIF.h 
+    *    header file.
+    * 2) Add entry to following KCases array either by using FUNCENTRY or 
+    *    ENTRY macro. 
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    * FUNCENTRY macro takes only test case function name as a parameter and uses
+    * that as a test case name and test case function name.
+    */
+    
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+		ENTRY( "TestCase001", TestCase_001L ),
+		ENTRY( "TestCase002", TestCase_002L ),
+        ENTRY( "TestCase003", TestCase_003L ),
+        ENTRY( "TestCase004", TestCase_004L ),
+        ENTRY( "TestCase005", TestCase_005L ),
+        ENTRY( "TestCase006", TestCase_006L ),
+        ENTRY( "TestCase007", TestCase_007L ),
+        ENTRY( "TestCase008", TestCase_008L ),
+        ENTRY( "TestCase009", TestCase_009L ),
+        ENTRY( "TestCase010", TestCase_010L ),
+        ENTRY( "TestOOM", TestCase_OOML )
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        return null;
+        }
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    return tmp;
+     
+    }
+    
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_001L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//     
+TInt CICMSTIF::TestCase_001L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+	delete icm;
+	CImagingConfigManager* icm2 = CImagingConfigManager::NewLC();
+	CleanupStack::Pop( icm2 );
+    aResult.iResult = KErrNone;
+    aResult.iResultDes = _L("CImagingConfigManager creations with NewL and NewLC succeeded both.");
+
+    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_002L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_002L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    if(icm->NumberOfVideoQualityLevels() < 1 || icm->NumberOfVideoQualityLevels() > 100)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("NumberOfVideoQualityLevels() didn't return value between 1-100.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+		aResult.iResultDes = _L("NumberOfVideoQualityLevels() OK.");
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_003L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_003L( TTestResult& aResult )
+	{
+	_LIT8(KFileMime, "video/3gpp");
+	_LIT8(KVideoCodecMimeType, "video/H263-2000");
+	_LIT8(KPreferredSupplier, "Nokia");
+	const TUint32 KAudioFourCCType = 0x524D4120;
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    CArrayFixFlat<TUint>* levels = new( ELeave ) CArrayFixFlat< TUint >( 1 );
+    TVideoQualitySet videoset;
+    icm->GetVideoQualityLevelsL(*levels);
+    
+    if(levels->Count() != 10 || levels->At(0) != 98
+                             || levels->At(1) != 99 || levels->At(2) != 200
+                             || levels->At(3) != 201 || levels->At(4) != 202 || levels->At(5) != 203
+                             || levels->At(6) != 301 || levels->At(7) != 302 || levels->At(8) != 303
+                             || levels->At(9) != 304 )
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetVideoQualityLevelsL()->At didn't return the expected values.");
+        }
+    else
+        {
+        icm->GetVideoQualitySet( videoset, /*100*/levels->At(1) );
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        TInt length3 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoCodecMimeType[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iPreferredSupplier[i] == '\0')
+                {
+                length3 = i;
+                break;
+                }
+            }
+        if( videoset.iVideoQualitySetLevel != 99 ||
+            memcompare(videoset.iVideoFileMimeType, length1, KFileMime().Ptr(), KFileMime().Length()) ||
+            memcompare(videoset.iVideoCodecMimeType, length2, KVideoCodecMimeType().Ptr(), KVideoCodecMimeType().Length()) ||
+            videoset.iVideoWidth != 176 ||
+            videoset.iVideoHeight != 144 ||
+            videoset.iVideoFrameRate != 15.0 ||
+            videoset.iVideoBitRate != 60000 ||
+            videoset.iVideoEncoderUID.iUid != 0 ||
+            videoset.iRandomAccessRate != 0.2 ||
+            videoset.iVideoPixelAspectRatioNum != 12 ||
+            videoset.iVideoPixelAspectRatioDenom != 11 ||
+            memcompare(videoset.iPreferredSupplier, length3, KPreferredSupplier().Ptr(), KPreferredSupplier().Length()) ||
+            videoset.iAudioFourCCType.FourCC() != KAudioFourCCType ||
+            videoset.iAudioBitRate != 12200 ||
+            videoset.iAudioSamplingRate != 8000 ||
+            videoset.iAudioChannels != 1 ||
+            videoset.iAudioEncoderUID.iUid != 0 ||
+            videoset.iAVSyncStartDelay != -200 ||
+            videoset.iAVSyncResumeDelay != 0 ||
+            videoset.iCameraDisplayId != 2 ||
+            videoset.iCamcorderVisible != 100)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetVideoQualitySetL() OK.");
+            }
+        }
+    delete levels;
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_004L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_004L( TTestResult& aResult )
+	{
+	_LIT8(KFileMime, "video/3gpp");
+	_LIT8(KVideoCodecMimeType, "video/H263-2000");
+	_LIT8(KPreferredSupplier, "Nokia");
+	const TUint32 KAudioFourCCType = 0x524D4120;
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TVideoQualitySet videoset;
+    TSize resolution(176,144);
+    icm->GetVideoQualitySet(videoset, resolution, KVideoCodecMimeType(), 0, 0, TFourCC(KAudioFourCCType));
+    
+    if(videoset.iVideoHeight != resolution.iHeight ||
+       videoset.iVideoWidth != resolution.iWidth ||
+       videoset.iVideoQualitySetLevel != 99)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected value.");
+        }
+    else
+        {
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        TInt length3 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoCodecMimeType[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iPreferredSupplier[i] == '\0')
+                {
+                length3 = i;
+                break;
+                }
+            }
+        if( memcompare(videoset.iVideoFileMimeType, length1, KFileMime().Ptr(), KFileMime().Length()) ||
+            memcompare(videoset.iVideoCodecMimeType, length2, KVideoCodecMimeType().Ptr(), KVideoCodecMimeType().Length()) ||
+            videoset.iVideoWidth != 176 ||
+            videoset.iVideoHeight != 144 ||
+            videoset.iVideoFrameRate != 15.0 ||
+            videoset.iVideoBitRate != 60000 ||
+            videoset.iVideoEncoderUID.iUid != 0 ||
+            videoset.iRandomAccessRate != 0.2 ||
+            videoset.iVideoPixelAspectRatioNum != 12 ||
+            videoset.iVideoPixelAspectRatioDenom != 11 ||
+            memcompare(videoset.iPreferredSupplier, length3, KPreferredSupplier().Ptr(), KPreferredSupplier().Length()) ||
+            videoset.iAudioFourCCType.FourCC() != KAudioFourCCType ||
+            videoset.iAudioBitRate != 12200 ||
+            videoset.iAudioSamplingRate != 8000 ||
+            videoset.iAudioChannels != 1 ||
+            videoset.iAudioEncoderUID.iUid != 0 ||
+            videoset.iAVSyncStartDelay != -200 ||
+            videoset.iAVSyncResumeDelay != 0 ||
+            videoset.iCameraDisplayId != 2 ||
+            videoset.iCamcorderVisible != 100)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetVideoQualitySetL() OK.");
+            }
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_005L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_005L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TCamcorderMMFPluginSettings ccorSettings;
+    icm->GetCamcorderMMFPluginSettings(ccorSettings);
+    
+    if(ccorSettings.iVideoNightFrameRate != 5.00 ||
+       ccorSettings.iCMRAvgVideoBitRateScaler != 0.9 ||
+       ccorSettings.iVideoComplexitySetting != 1 ||
+       ccorSettings.iCMRLatencyQualityTradeoff != 1.0 ||
+       ccorSettings.iCMRPictureQuality != 50 ||
+       ccorSettings.iCMRQualityTemporalTradeoff != 0.8 ||
+       ccorSettings.iCMRNumCameraBuffers != 2 ||
+       ccorSettings.iCMRNumCameraBuffersARM != 1 ||
+       ccorSettings.iCMRMinNumOutputBuffers != 4)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetCamcorderMMFPluginSettingsL() didn't return expected value.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+    	aResult.iResultDes = _L("GetCamcorderMMFPluginSettingsL() OK.");
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_006L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_006L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    if(icm->NumberOfImageQualityLevels() != 27)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("NumberOfImageQualityLevels() didn't return 27 as expected.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+		aResult.iResultDes = _L("NumberOfImageQualityLevels() OK.");
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_007L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_007L( TTestResult& aResult )
+	{
+	_LIT8(KImageFileMimeType, "image/jpeg");
+	_LIT8(KImageFileExtension, ".jpg");
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    CArrayFixFlat<TUint>* levels = new( ELeave ) CArrayFixFlat< TUint >( 1 );
+    TImageQualitySet imageset;
+    icm->GetImageQualityLevelsL(*levels, 2);
+    
+    if(levels->Count() != 24 || levels->At(0) != 99 || levels->At(1) != 100 || levels->At(2) != 101
+                           || levels->At(3) != 102 || levels->At(4) != 103 || levels->At(5) != 104
+                           || levels->At(6) != 105 || levels->At(7) != 106 || levels->At(8) != 199
+                           || levels->At(9) != 200 || levels->At(10) != 201 || levels->At(11) != 202
+                           || levels->At(12) != 203 || levels->At(13) != 204 || levels->At(14) != 205
+                           || levels->At(15) != 206 || levels->At(16) != 299 || levels->At(17) != 300
+                           || levels->At(18) != 301 || levels->At(19) != 302 || levels->At(20) != 303
+                           || levels->At(21) != 304 || levels->At(22) != 305 || levels->At(23) != 306)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetImageQualityLevelsL()->At didn't return expected value.");
+        }
+    else
+        {
+        icm->GetImageQualitySet( imageset, levels->At(1) );
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileExtension[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        if( memcompare(imageset.iImageFileMimeType, length1, KImageFileMimeType().Ptr(), KImageFileMimeType().Length()) ||
+            memcompare(imageset.iImageFileExtension, length2, KImageFileExtension().Ptr(), KImageFileExtension().Length()) ||
+            imageset.iImageWidth < 160 ||
+            imageset.iImageWidth > 13333 ||
+            imageset.iImageHeight < 120 ||
+            imageset.iImageHeight > 10000 ||
+            imageset.iCompressionQuality < 10 ||
+            imageset.iCompressionQuality > 100 ||
+            imageset.iEstimatedSize < 1024 ||
+            imageset.iEstimatedSize > 10240000 ||
+            imageset.iCameraDisplayId > 10000 ||
+            imageset.iCamcorderVisible > 10000)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetImageQualityLevelsL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetImageQualityLevelsL() OK.");
+            }
+        }
+    delete levels;
+	delete icm;
+    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_008L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_008L( TTestResult& aResult )
+	{
+	_LIT8(KImageFileMimeType, "image/jpeg");
+	_LIT8(KImageFileExtension, ".jpg");
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TImageQualitySet imageset;
+    TSize resolution(1280,960);
+    icm->GetImageQualitySet(imageset, resolution, 2);
+    
+    if(imageset.iImageHeight != resolution.iHeight ||
+       imageset.iImageWidth != resolution.iWidth ||
+       imageset.iImageQualitySetLevel > 10000)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetImageQualitySetL() resolution didn't return expected value.");
+        }
+    else
+        {
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileExtension[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        if( memcompare(imageset.iImageFileMimeType, length1, KImageFileMimeType().Ptr(), KImageFileMimeType().Length()) ||
+            memcompare(imageset.iImageFileExtension, length2, KImageFileExtension().Ptr(), KImageFileExtension().Length()) ||
+            imageset.iCompressionQuality < 10 ||
+            imageset.iCompressionQuality > 100 ||
+            imageset.iEstimatedSize < 1024 ||
+            imageset.iEstimatedSize > 10240000 ||
+            imageset.iCameraDisplayId > 10000 ||
+            imageset.iCamcorderVisible > 10000)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetImageQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetImageQualitySetL() OK.");
+            }
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_009L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_009L( TTestResult& aResult )
+	{
+	_LIT8(KFileMime, "video/3gpp");
+	_LIT8(KVideoCodecMimeType, "video/H263-2000");
+	_LIT8(KPreferredSupplier, "Nokia");
+	const TUint32 KAudioFourCCType = 0x524D4120;
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TVideoQualitySet videoset;
+    TSize resolution(176,144);
+    icm->GetVideoQualitySet( videoset, 125 );// This should return video set num 99
+    
+    if(videoset.iVideoHeight != resolution.iHeight ||
+       videoset.iVideoWidth != resolution.iWidth ||
+       videoset.iVideoQualitySetLevel != 99)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected value.");
+        }
+    else
+        {
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        TInt length3 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoCodecMimeType[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iPreferredSupplier[i] == '\0')
+                {
+                length3 = i;
+                break;
+                }
+            }
+        if( memcompare(videoset.iVideoFileMimeType, length1, KFileMime().Ptr(), KFileMime().Length()) ||
+            memcompare(videoset.iVideoCodecMimeType, length2, KVideoCodecMimeType().Ptr(), KVideoCodecMimeType().Length()) ||
+            videoset.iVideoWidth != 176 ||
+            videoset.iVideoHeight != 144 ||
+            videoset.iVideoFrameRate != 15.0 ||
+            videoset.iVideoBitRate != 60000 ||
+            videoset.iVideoEncoderUID.iUid != 0 ||
+            videoset.iRandomAccessRate != 0.2 ||
+            videoset.iVideoPixelAspectRatioNum != 12 ||
+            videoset.iVideoPixelAspectRatioDenom != 11 ||
+            memcompare(videoset.iPreferredSupplier, length3, KPreferredSupplier().Ptr(), KPreferredSupplier().Length()) ||
+            videoset.iAudioFourCCType.FourCC() != KAudioFourCCType ||
+            videoset.iAudioBitRate != 12200 ||
+            videoset.iAudioSamplingRate != 8000 ||
+            videoset.iAudioChannels != 1 ||
+            videoset.iAudioEncoderUID.iUid != 0 ||
+            videoset.iAVSyncStartDelay != -200 ||
+            videoset.iAVSyncResumeDelay != 0 ||
+            videoset.iCameraDisplayId != 2 ||
+            videoset.iCamcorderVisible != 100)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetVideoQualitySetL() OK.");
+            }
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_010L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_010L( TTestResult& aResult )
+	{
+	_LIT8(KImageFileMimeType, "image/jpeg");
+	_LIT8(KImageFileExtension, ".jpg");
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TImageQualitySet imageset;
+    
+    icm->GetImageQualitySet( imageset, 305, 2 );
+    TInt length1 = KMaxStringLength;
+    TInt length2 = KMaxStringLength;
+    for( TInt i=0; i<KMaxStringLength; i++)
+        {
+        if(imageset.iImageFileMimeType[i] == '\0')
+            {
+            length1 = i;
+            break;
+            }
+        }
+    for( TInt i=0; i<KMaxStringLength; i++)
+        {
+        if(imageset.iImageFileExtension[i] == '\0')
+            {
+            length2 = i;
+            break;
+            }
+        }
+    if( memcompare(imageset.iImageFileMimeType, length1, KImageFileMimeType().Ptr(), KImageFileMimeType().Length()) ||
+        memcompare(imageset.iImageFileExtension, length2, KImageFileExtension().Ptr(), KImageFileExtension().Length()) ||
+        imageset.iImageWidth < 160 ||
+        imageset.iImageWidth > 13000 ||
+        imageset.iImageHeight < 120 ||
+        imageset.iImageHeight > 10000 ||
+        imageset.iCompressionQuality < 10 ||
+        imageset.iCompressionQuality > 100 ||
+        imageset.iEstimatedSize < 1024 ||
+        imageset.iEstimatedSize > 10240000 ||
+        imageset.iCameraDisplayId > 10000 ||
+        imageset.iCamcorderVisible > 10000)
+        {
+        aResult.iResult = KErrGeneral;
+	    aResult.iResultDes = _L("GetImageQualityLevelsL() didn't return expected values.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+		aResult.iResultDes = _L("GetImageQualityLevelsL() OK.");
+        }
+
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_OOML
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_OOML( TTestResult& aResult )
+    {
+    TInt error = KErrNone;
+    _LIT(KTestCase, "TestCase0??");
+    
+    for( TInt i = 0; Case(i).iMethod != NULL && !error; i++ )
+        {
+        // Get the pointer to test case function
+        TCaseInfo tmp = Case(i);
+        if(KErrNotFound == tmp.iCaseName.Match(KTestCase()))
+            {
+            break;
+            }
+        SetAllocFailureSimulation( RHeap::EDeterministic, 1 ); // Enable OOM test loop
+        aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+        for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+            {      
+            // Switches on alloc failure simulation if the parameters are set for it
+            AllocFailureSimulation( ETrue ); 
+            RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+
+            iMethod = tmp.iMethod;        
+            
+            TRAP( error, ( this->*iMethod )( aResult ) );
+            if ( error == KErrNoMemory )
+                {
+                error = KErrNone;
+                }
+            }
+        AllocFailureSimulation( EFalse );
+        }
+
+    SetAllocFailureSimulation( RHeap::ENone, 1 ); // Disable OOM test loop
+    User::LeaveIfError( error );
+    return KErrNone;
+    }
+
+
+/*
+*/    
+
+void CICMSTIF::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CICMSTIF::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CICMSTIF::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CICMSTIF::RunTestCaseL(
+    const TInt aCaseNumber ,
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        execStatus  = ( this->*iMethod )( aResult );                  
+        }
+    else
+        {        
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+TBool CICMSTIF::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& /* aFirstMemFailure */, 
+                                TInt& /* aLastMemFailure */ ) 
+    {
+    _LIT( KOOMTestQueryL, "CICMSTIF::OOMTestQueryL" );
+    iLog->Log( KOOMTestQueryL ); 
+
+    return EFalse;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CICMSTIF::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CICMSTIF::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//                  
+void CICMSTIF::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CICMSTIF::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, 
+                                TUint32& aParameterValid )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 2*16384; // 32K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    aTestModuleParam = param;
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// E32Dll is a DLL entry point function
+// Returns: KErrNone: No error
+// -----------------------------------------------------------------------------
+//
+#ifndef EKA2 // Hide Dll entry point to EKA2
+GLDEF_C TInt E32Dll(
+    TDllReason /*aReason*/) // Reason
+    {
+    return(KErrNone);
+
+    }
+#endif // EKA2
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Media Recorder API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CCMRMediaRecorderObserver.h     MW_LAYER_PLATFORM_EXPORT_PATH(CCMRMediaRecorderObserver.h)
+../inc/CCMRMediaRecorder.h     MW_LAYER_PLATFORM_EXPORT_PATH(CCMRMediaRecorder.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/inc/CCMRMediaRecorder.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,433 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media recorder API
+*
+*/
+
+
+#ifndef CCMRMEDIARECORDER_H
+#define CCMRMEDIARECORDER_H
+
+//  INCLUDES
+#include "CCMRMediaRecorderObserver.h"
+#include <mmf/common/mmffourcc.h>
+#include <mmf/devvideo/devvideoconstants.h>
+
+// CONSTANTS
+const TInt KCMRUseDefault(-1);
+
+// FORWARD DECLARATIONS
+class MDataSource;
+class MCMRMediaSink;
+class TCCMRVideoCodingOptions;
+class CDesC8Array;
+class TMMFPrioritySettings;
+class TRateControlOptions;
+
+// CLASS DECLARATION
+
+
+/**
+*  Abstract Media recorder interface
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRMediaRecorder : public CBase
+    {    
+    
+    public:  // Constants
+        
+        // Recorder states
+        enum TRecorderState
+            {   
+                EStateNone = 0,
+                EStateOpen,
+                EStatePreparing,
+                EStateReadyToRecord,
+                EStateRecording,
+                EStatePaused,
+                EStateStopping,
+                EStatePausing
+            };
+
+    public:        
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CCMRMediaRecorder* NewL();
+        
+        // CBase provides a virtual destructor        
+
+    public:  // New functions
+        
+        /**
+        * Open the recorder: Creates A/V recorders & other needed components
+        * @since 2.1
+        * @param aObserver          Mediarecorder observer
+        * @param aAudioSource       MMF audio source
+        * @param aSink              MCMRMediaSink for data output
+        * @param aCameraHandle      Camera handle
+        * @param aVideoMimeType     Video codec MIME-type (default: KNullDesC8 => use default codec)
+        * @param aAudioType         Audio coded FourCC (default: KFourCCNULL => use default codec)
+        */
+        virtual void OpenL(MCMRMediaRecorderObserver *aObserver, 
+                           MDataSource* aAudioSource, 
+                           MCMRMediaSink *aSink, TInt aCameraHandle,
+                           const TDesC8& aVideoMimeType = KNullDesC8,
+                           TFourCC aAudioType = KFourCCNULL) = 0;
+
+        /**
+        * Returns the current state of the recorder  
+        * @since 2.1
+        * @param void
+        * @return TRecorderState The State
+        */
+        virtual TRecorderState State() = 0;
+        
+        // Settings
+
+        /**
+        * Set video codec to be used (overrides the one given in OpenL)
+        * @since 2.1
+        * @param  aVideoMimeType    video mime type
+        * @return void
+        */
+        virtual void SetVideoCodecL( const TDesC8& aVideoMimeType ) = 0;
+
+        /**
+        * Get the currently used video codec
+        * @since 2.1
+        * @param  aVideoMimeType    Used codec as mime type
+        * @return void
+        */
+        virtual void GetVideoCodecL( TDes8& aVideoMimeType ) = 0;
+
+        /**
+        * Get supported & installed video codecs
+        * This can be called also when the recorder is not open
+        * @since 2.1
+        * @param  aVideoMimeTypes   List of supported & installed video codecs as mime type
+        * @return void
+        */
+        virtual void GetSupportedVideoCodecsL( CDesC8Array& aVideoMimeTypes ) = 0;
+
+        /**
+        * Set audio codec to be used (overrides the one given in OpenL)
+        * @since 2.1
+        * @param  aAudioType        Audio codec as FourCC
+        * @return void
+        */
+        virtual void SetAudioCodecL( const TFourCC& aAudioType ) = 0;
+
+        /**
+        * Get the currently used audio codec
+        * @since 2.1
+        * @param  aAudioType        Used codec as FourCC
+        * @return void
+        */
+        virtual void GetAudioCodecL( TFourCC& aAudioType ) = 0;
+
+        /**
+        * Get supported & installed audio codecs
+        * @since 2.1
+        * @param  aAudioTypes   List of supported & installed audio codecs
+        * @return void
+        */
+        virtual void GetSupportedAudioCodecsL( RArray<TFourCC>& aAudioTypes ) = 0;
+
+        /**
+        * Set new maximum total (audio+video) bitrate
+        * @since 2.1
+        * @param aBitRate New bitrate
+        * @return void
+        */
+        virtual void SetMaxTotalBitRateL(TInt aBitRate) = 0;
+
+        /**
+        * Get current maximum total (audio+video) bitrate
+        * @since 2.1
+        * @param void
+        * @return TInt Bitrate (-1 means max bitrate has not been set)
+        */
+        virtual TInt MaxTotalBitRateL() const = 0;
+
+        /**
+        * Set new video frame size. Possible only when not recording
+        * @since 2.1
+        * @param aSize New size
+        * @return void
+        */
+        virtual void SetVideoFrameSizeL(const TSize& aSize) = 0;
+
+        /**
+        * Get current video frame size
+        * @since 2.1
+        * @param aSize Current size (Output)        
+        * @return void
+        */
+        virtual void GetVideoFrameSizeL(TSize& aSize) const = 0;
+
+        /**
+        * Set new video frame rate (encoding and capturing). 
+        * Possible to change also when recording but then 
+        * affects only to encoding rate and cannot increase 
+        * higher than capturing rate set in the initialization.
+        * @since 2.1
+        * @param aFrameRate New frame rate
+        * @return void
+        */
+        virtual void SetVideoFrameRateL(TReal32 aFrameRate) = 0;
+
+        /**
+        * Get current video frame rate
+        * @since 2.1
+        * @param void
+        * @return TReal32 Frame rate
+        */
+        virtual TReal32 VideoFrameRateL() = 0;        
+
+        /**
+        * Set new target video bitrate. Possible to change
+        * also when recording.
+        * @since 2.1
+        * @param aBitRate Target bitrate in bps, or KMMFVariableVideoBitRate
+        * @return void
+        */
+        virtual void SetVideoBitRateL(TInt aBitRate) = 0;
+
+        /**
+        * Get current target video bitrate
+        * @since 2.1
+        * @param void
+        * @return TInt Target bitrate in bps, or KMMFVariableVideoBitRate
+        */
+        virtual TInt VideoBitRateL() = 0;
+
+        /**
+        * Set misc video coding options
+        * @since 2.1
+        * @param  aOptions      video coding options
+        * @return void
+        */
+        virtual void SetVideoCodingOptionsL(const TCCMRVideoCodingOptions& aOptions) = 0;
+
+        /**
+        * Set bitrate for audio codec. If we use AMR-NB, the given bitrate
+        * is interpreted proprietarily: bitrates that are not exactly AMR bitrates 
+        * mean that voice activity detection is used and the actual AMR bitrate is 
+        * the given bitrate rounded upwards to the next AMR bitrate. 
+        * E.g. aBitRate = 5500 means the AMR bit-rate is 5900 and VAD is enabled
+        * @since 2.1
+        * @param aBitRate New bitrate
+        * @return void
+        */
+        virtual void SetAudioBitRateL(TInt aBitRate) = 0;
+
+        /**
+        * Gets the current target audio bitrate  
+        * @since 2.1
+        * @param void
+        * @return TInt Bitrate
+        */
+        virtual TInt AudioBitRateL() = 0;
+
+        /**
+        * Toggles audio recording on/off
+        *      NOTE: This cannot be used during recording!
+        * @since 2.1
+        * @param aEnabled If ETrue, audio will be recorded
+        * @return void        
+        */
+        virtual void SetAudioEnabledL(TBool aEnabled) = 0;
+
+        /**
+        * Query whether audio recording is enabled
+        * @since 2.1
+        * @param void
+        * @return TBool Result
+        */
+        virtual TBool AudioEnabledL() const = 0;
+        
+        /**
+        * Set new audio recording input gain
+        * @since 2.1
+        * @param aGain New gain
+        * @return void
+        */
+        virtual void SetGainL(TInt aGain) = 0;
+
+        /**
+        * Get current audio recording gain
+        * @since 2.1
+        * @param void
+        * @return TInt Gain
+        */
+        virtual TInt GainL() const = 0;
+
+        /**
+        * Get maximum audio recording gain
+        * @since 2.1
+        * @param void
+        * @return TInt Max. gain value
+        */
+        virtual TInt MaxGainL() const = 0;   
+        
+        /**
+        * Set audio priority settings
+        * @since 2.1
+        * @param  aPrioritySettings audio priority settings
+        * @return void
+        */
+        virtual void SetAudioPriorityL(const TMMFPrioritySettings& aPrioritySettings) = 0;
+
+
+        // Recording control
+        
+        /**
+        * Prepares the recorder, for minimising latency in starting
+        * @since 2.1
+        * @param void
+        * @return TInt Max. gain value
+        */
+        virtual void PrepareL() = 0;
+
+        /**
+        * Starts recording audio and video        
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void RecordL() = 0;
+
+        /**
+        * Stops recording audio and video
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void StopL() = 0;
+
+        /**
+        * Pauses recording
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void PauseL() = 0;
+
+        /**
+        * Resumes recording from Pause
+        * @since 2.1
+        * @param void
+        * @return void
+        */
+        virtual void ResumeL() = 0;
+        
+        // Dynamic settings during recording
+
+        /**
+        * Sets the video bitrate control options for a whole bitstream.
+        * This method can only be called after the media recorder has been prepared or during recording. 
+        *
+        * @since 3.2
+        * @param	"aOptions"	"Bitrate control options."
+        * @return void
+        */
+        virtual void SetVideoRateControlOptionsL(const TRateControlOptions& aOptions) = 0;
+        
+        /**
+        * Gets current video bit-rate control options for a whole bitstream.
+        * This method can only be called after the media recorder has been prepared or during recording. 
+        *
+        * @since 3.2
+        * @param	"aOptions"	"Current bitrate control options."
+        * @return void
+        */
+        virtual void GetVideoRateControlOptionsL(TRateControlOptions& aOptions) = 0;
+
+        // Video encoder overrides
+
+        /**
+        * Set video encoder using its UID. Usage optional.
+        * This overrides Media Recorder internal search for encoder based on set video mime type ( SetVideoCodecL() ).
+        *
+        * @since 3.2.3
+        * @param    "aEncoder"  "Video encoder UID."
+        * @return void
+        */
+        virtual void SetPreferredVideoEncoderL(TUid& aEncoder) = 0;
+
+        /**
+        * Set video encoder output format encapsulation for H.264 / AVC. Usage optional.
+        * This overrides Media Recorder internal default preferences for TVideoDataUnitEncapsulation
+        * if used encoder supports multiple encapsulations.
+        *
+        * Default for H.264 / AVC is: EDuGenericPayload
+        *
+        * @since 3.2.3
+        * @param    "aCapsulation"  "Encapsulation for coded video data units."
+        * @return void
+        */
+        virtual void SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation) = 0;
+        
+        /**
+        * Set video encoder target segment size. Usage optional.
+        * Exposes CMMFDevVideoRecord::SetSegmentTargetSize (devvideorecord.h) to MediaRecorder clients.
+        * Typically used in video sharing use case instead of local video recording.
+        * @since 5.2
+        * @param  "aLayer"            "Layer number. Layers are numbered [0…n-1], where n is the number of layers 
+        *                             available. Use zero if layered bit-rate scalability is not used."
+        * @param  "aSizeBytes"        "Segment target size in bytes. Set to zero to use unlimited segment size. The
+        *                             segment size in bytes should include all data that is typically stored or
+        *                             transmitted for each segment in the format currently in use. This includes all
+        *                             related headers."
+        * @param  "aSizeMacroblocks"  "Segment target size in number of macroblocks per segment. Set to zero to 
+        *                             use unlimited segment size."
+        * @return TBool
+        */            
+        virtual void SetSegmentTargetSizeL(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks ) = 0;
+    };
+
+
+/**
+*  Video coding options used in SetVideoCodingOptionsL
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class TCCMRVideoCodingOptions
+    {
+    public:
+        TCCMRVideoCodingOptions() : iSyncIntervalInPicture(0), iMinRandomAccessPeriodInSeconds(KCMRUseDefault), iExpectedBitErrorRate(0.0), iExpectedPacketLossRate(0.0)
+            {}
+
+    public:
+        // Segment interval in picture. In H.263 baseline this means number of non-empty GOB headers (1=every GOB has a header), 
+        // in MB-based systems number of MBs per segment. Default is 0 == no segments inside picture
+        // Coding standard & used profile etc. limit the value.
+        TInt              iSyncIntervalInPicture;
+        // Time between random access points
+        TInt              iMinRandomAccessPeriodInSeconds;
+        // Bit error rate; if nonzero sets error resilience coding options (e.g. Adaptive Intra Refresh) on
+        TReal             iExpectedBitErrorRate;
+        // Packet loss rate; if nonzero sets error resilience coding options (e.g. Adaptive Intra Refresh) on
+        TReal             iExpectedPacketLossRate;
+    };
+
+
+#endif // CCMRMEDIARECORDER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/inc/CCMRMediaRecorderObserver.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media recorder observer interface
+*
+*/
+
+
+#ifndef CCMRMEDIARECORDEROBSERVER_H
+#define CCMRMEDIARECORDEROBSERVER_H
+
+// CLASS DECLARATION
+
+/**
+*  Media recorder observer interface
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+
+class MCMRMediaRecorderObserver 
+    {
+    public:
+
+        /**
+        * Informs the user that PrepareL() has been completed with or
+        * without errors. If aError != KErrNone, media recorder remains in 
+        * open state
+        * @since 2.1
+        * @param aError     Error code
+        * @return void
+        */
+        virtual void MmroPrepareComplete(TInt aError) = 0;    
+
+        /**
+        * Informs the user about a state change. 
+        * Useful to find out when a new prepare is needed after 
+        * a setting was changed
+        * @since 2.1
+        * @param aState     New state (CCMRMediaRecorder - TRecorderState)
+        * @param aError     Error code
+        * @return void
+        */
+        virtual void MmroStateChange(TInt aState, TInt aError) = 0;
+
+        /**
+        * Informs the user about a temporary runtime error. 
+        * Recording can't continue right now but it may
+        * be possible to continue later (e.g. audio HW was 
+        * taken by a higher priority application)
+        * @since 2.1
+        * @param aError     Error code
+        * @return void
+        */
+        virtual void MmroTemporaryError(TInt aError) = 0;    
+
+        /**
+        * Informs the user about a fatal runtime error (e.g. OOM). 
+        * MediaRecorder must be deleted and recreated.
+        * @since 2.1
+        * @param aError     Error code
+        * @return void
+        */
+        virtual void MmroFatalError(TInt aError) = 0;
+    
+    };
+
+#endif  // CCMRMEDIARECORDEROBSERVER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/media_recorder_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="e5ee5042b465d1611fc682f0eb7cbee2" dataversion="2.0">
+<name>Media Recorder API</name>
+<description>Interface for recording encoded audio and video.</description>
+<type>c++</type>
+<collection>CamcorderMMFPlugin</collection>
+<libs><lib name="camcmediarecorder.lib"/>
+</libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/BWINS/CPPUNITCAMCTESTU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateTopFct@@YAPAVMTest@@XZ @ 1 NONAME ; class MTest * __cdecl CreateTopFct(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/BWINS/StifCamcTestU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModule@@XZ @ 1 NONAME ; class CTestModule * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/EABI/StifCamcTestU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,76 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CCamcTest_1 @ 4 NONAME ; #<TI>#
+	_ZTI11CCamcTest_2 @ 5 NONAME ; #<TI>#
+	_ZTI11CCamcTest_3 @ 6 NONAME ; #<TI>#
+	_ZTI11CCamcTest_4 @ 7 NONAME ; #<TI>#
+	_ZTI11CCamcTest_5 @ 8 NONAME ; #<TI>#
+	_ZTI11CCamcTest_6 @ 9 NONAME ; #<TI>#
+	_ZTI11CCamcTest_7 @ 10 NONAME ; #<TI>#
+	_ZTI11CCamcTest_8 @ 11 NONAME ; #<TI>#
+	_ZTI11CCamcTest_9 @ 12 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_1E @ 13 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_2E @ 14 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_3E @ 15 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_4E @ 16 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_5E @ 17 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_6E @ 18 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_7E @ 19 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_8E @ 20 NONAME ; #<TI>#
+	_ZTI11CTestCallerI11CCamcTest_9E @ 21 NONAME ; #<TI>#
+	_ZTI11CTestCallerI21CCamcTest_visualcheckE @ 22 NONAME ; #<TI>#
+	_ZTI11CTestCallerI24CCamcTest_visualcheckdspE @ 23 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 24 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_1 @ 25 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_2 @ 26 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_3 @ 27 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_4 @ 28 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_5 @ 29 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_6 @ 30 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_7 @ 31 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_8 @ 32 NONAME ; #<TI>#
+	_ZTI17CCamcTestClient_9 @ 33 NONAME ; #<TI>#
+	_ZTI21CCamcTest_visualcheck @ 34 NONAME ; #<TI>#
+	_ZTI24CCamcTest_visualcheckdsp @ 35 NONAME ; #<TI>#
+	_ZTI27CCamcTestClient_visualcheck @ 36 NONAME ; #<TI>#
+	_ZTI30CCamcTestClient_visualcheckdsp @ 37 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 38 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 39 NONAME ; #<VT>#
+	_ZTV11CCamcTest_1 @ 40 NONAME ; #<VT>#
+	_ZTV11CCamcTest_2 @ 41 NONAME ; #<VT>#
+	_ZTV11CCamcTest_3 @ 42 NONAME ; #<VT>#
+	_ZTV11CCamcTest_4 @ 43 NONAME ; #<VT>#
+	_ZTV11CCamcTest_5 @ 44 NONAME ; #<VT>#
+	_ZTV11CCamcTest_6 @ 45 NONAME ; #<VT>#
+	_ZTV11CCamcTest_7 @ 46 NONAME ; #<VT>#
+	_ZTV11CCamcTest_8 @ 47 NONAME ; #<VT>#
+	_ZTV11CCamcTest_9 @ 48 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_1E @ 49 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_2E @ 50 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_3E @ 51 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_4E @ 52 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_5E @ 53 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_6E @ 54 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_7E @ 55 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_8E @ 56 NONAME ; #<VT>#
+	_ZTV11CTestCallerI11CCamcTest_9E @ 57 NONAME ; #<VT>#
+	_ZTV11CTestCallerI21CCamcTest_visualcheckE @ 58 NONAME ; #<VT>#
+	_ZTV11CTestCallerI24CCamcTest_visualcheckdspE @ 59 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 60 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_1 @ 61 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_2 @ 62 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_3 @ 63 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_4 @ 64 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_5 @ 65 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_6 @ 66 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_7 @ 67 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_8 @ 68 NONAME ; #<VT>#
+	_ZTV17CCamcTestClient_9 @ 69 NONAME ; #<VT>#
+	_ZTV21CCamcTest_visualcheck @ 70 NONAME ; #<VT>#
+	_ZTV24CCamcTest_visualcheckdsp @ 71 NONAME ; #<VT>#
+	_ZTV27CCamcTestClient_visualcheck @ 72 NONAME ; #<VT>#
+	_ZTV30CCamcTestClient_visualcheckdsp @ 73 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 74 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/group/StifCamcTest.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+#include <platform_paths.hrh>
+
+TARGET        StifCamcTest.dll
+TARGETTYPE    dll
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY	CAP_GENERAL_DLL MultimediaDD
+VENDORID      VID_DEFAULT
+
+SOURCEPATH    ../src
+
+SOURCE        camcTest.cpp
+SOURCE        StifCamcTestTop.cpp
+
+SOURCE        camcTest_1.cpp
+SOURCE        camcTestClient_1.cpp
+SOURCE        camcTest_2.cpp
+SOURCE        camcTestClient_2.cpp
+SOURCE        camcTest_3.cpp
+SOURCE        camcTestClient_3.cpp
+SOURCE        camcTest_4.cpp
+SOURCE        camcTestClient_4.cpp
+SOURCE        camcTest_5.cpp
+SOURCE        camcTestClient_5.cpp
+SOURCE        camcTest_6.cpp
+SOURCE        camcTestClient_6.cpp
+SOURCE        camcTest_7.cpp
+SOURCE        camcTestClient_7.cpp
+SOURCE        camcTest_8.cpp
+SOURCE        camcTestClient_8.cpp
+SOURCE        camcTest_9.cpp
+SOURCE        camcTestClient_9.cpp
+
+SOURCE        camcTest_visualcheckdsp.cpp
+SOURCE        camcTestClient_visualcheckdsp.cpp
+SOURCE        camcTest_visualcheck.cpp
+SOURCE        camcTestClient_visualcheck.cpp
+
+
+//  TestFrameWork files 
+SOURCE        TestFrameWork/TestCase.cpp
+SOURCE        TestFrameWork/AssertFailure.cpp
+SOURCE        TestFrameWork/TestSuite.cpp
+
+USERINCLUDE   ..
+USERINCLUDE   ../inc
+USERINCLUDE   ../inc/TestFrameWork
+USERINCLUDE   ../../../../camcordermmfplugin/controller/Inc
+USERINCLUDE   ../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE	/epoc32/include/libc
+
+LIBRARY       euser.lib
+LIBRARY       efsrv.lib
+LIBRARY       stiftestinterface.lib
+LIBRARY		  mediaclientvideo.lib
+LIBRARY       MMFControllerFramework.lib 
+LIBRARY       bafl.lib 
+LIBRARY       ecam.lib
+LIBRARY		ecom.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/group/StifCamcTest.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,34 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: media_recorder_api
+;
+; Languages
+; =========
+&EN
+
+; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
+; ==================================================================================================
+#{"STIFMMFPTEST"},(0x101FB3E7),1,0,1,TYPE=SA
+
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\StifCamcTest.dll"      -"$:\sys\bin\StifCamcTest.dll"
+
+; eof
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+StifCamcTest.mmp
+
+PRJ_MMPFILES
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/StifCamcTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*
+*/
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This file contains the header file of DemoModule of 
+    STIF TestFramework.
+
+-------------------------------------------------------------------------------
+*/
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFrameWork/testSuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS(CTestModule):public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+        
+            
+	public: //Data
+	    // None
+    	
+	protected: // Data
+        // None
+    	
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+    	
+    public: // Friend classes
+        // None
+    	
+    protected: // Friend classes
+        // None
+    	
+    private: // Friend classes
+        // None
+    	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/AssertFailure.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/TestResult.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/test.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/testCaller.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFrameWork/testCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/testCase.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/TestFrameWork/testSuite.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+/* Choose proper header file, depending on which test framework 
+   the tests are built for */
+
+#ifndef CAMCTEST_H
+#define CAMCTEST_H
+
+#ifdef USING_CPPUNIT_FRAMEWORK
+
+ /* CppUnit headers */
+#include <CppUnit/Test.h>
+#include <CppUnit/TestCase.h>
+#include <CppUnit/TestCaller.h>
+#include <CppUnit/TestSuite.h>
+
+#else
+
+  /* STIF TFW headers */
+#include "TestFrameWork/test.h"
+#include "TestFrameWork/testCase.h"
+#include "TestFrameWork/testCaller.h"
+#include "TestFrameWork/testSuite.h"
+
+#endif
+
+
+//////////////////
+// Utility function
+//////////////////
+
+void AddDriveLetterToPath(const TDesC &aFileName,TDes &aFileNameWithPath ) ;
+
+//////////////////
+// Defines
+//////////////////
+
+#if ( defined ( __MPEG4_AAC_ENCODING) ) && ( defined (__MPEG4_VIDEO_ENCODING) )
+#define MP4_FILE_FORMAT_SUPPORTED
+#else
+#undef MP4_FILE_FORMAT_SUPPORTED
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTestTop.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTTOP_H
+#define __CAMCTESTTOP_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "Camctest.h"
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+IMPORT_C  MTest* CreateTopFct ();
+class CCamcTestTop : public CTestSuite
+{
+public:
+
+	CCamcTestTop ();
+    ~CCamcTestTop ();
+
+
+	// A function to collect and return a suite of tests
+	 static MTest* suiteL ();
+
+
+protected:
+
+private:
+
+};
+
+
+
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_1.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+#ifndef __CAMCTEST_1_H
+#define __CAMCTEST_1_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include "camcTest.h"
+#include <videorecorder.h>
+#include <ecam.h>
+#include "camctestclient_1.h"
+
+// CONSTANTS
+
+#define CONTROLLER_UID 0x101f8503
+#define VIDEO_FORMAT_UID 0x101f8504
+#define VIDEO_FORMAT_UID_NEW 0x101F86D6
+#define VIDEO_FORMAT_UID_MP4 0x101F873D
+
+#define MIME_VIDEO_FORMAT _L8("video/H263-2000")
+#define NEW_MIME_VIDEO_FORMAT _L8("video/mp4v-es")
+#define MPEG4_MIME_VIDEO_FORMAT _L8("video/mp4v-es; profile-level-id=3")
+#define NO_AUDIO_FOURCC KMMFFourCCCodeNULL
+#define ACC_AUDIO_FORMAT TFourCC( ' ','A','A','C' )
+#define AMR_AUDIO_FORMAT TFourCC( ' ','A','M','R' )
+#define UNSUPPORTED_VIDEO_FORMAT _L8("video/unSupport")
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTest_1 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_1 ();
+        ~CCamcTest_1 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void OpenFileL_001_L();
+        void OpenFileL_002_L();
+        void OpenFileL_003_L();
+        void OpenFileL_004_L();	
+        void OpenFileL_005_L();
+        
+        void OpenFileL_006_L();
+        void OpenFileL_008_L();
+        void OpenFileL_009_L();	
+        void OpenFileL_010_L();
+        
+        void OpenFileL_011_L();
+        void OpenFileL_017_L();
+        void OpenFileL_018_L();
+        void OpenFileL_019_L();
+        void OpenFileL_020_L();
+        void OpenFileL_021_L();
+        
+        void OpenDesL_001_L();
+        void OpenUrlL_001_L();
+                
+    private:       
+        
+        enum TCamCTest_1_Actions
+            {
+            KCamcorderInDuplicatedMode
+            };
+
+        CCamcTestClient_1 * iCamcTestClient;
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+
+        // Variables and functions for Camera API 
+        void SomethingInActiveObjectIsLeaving (TInt aError);
+        CCamera *iCamera; 
+        TCamCTest_1_Actions iTestCase;
+        TInt iError;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_2.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_2_H
+#define __CAMCTEST_2_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+#include <ecam.h>
+#include <videorecorder.h>
+
+#include "camctestclient_2.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_2 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_2 ();
+        ~CCamcTest_2 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void Close_001_L();
+        void Close_002_L();
+        void Close_003_L();
+        void Close_004_L();
+        void Close_005_L();
+        void Close_007_L();
+        
+        void Prepare_001_L();
+        void Prepare_002_L();
+        void Prepare_003_L();
+        void Prepare_004_L();
+        void Prepare_005_L();
+        void Prepare_006_L();
+        
+        void Record_001_L();
+        void Record_002_L();
+        void Record_003_L();
+        void Record_004_L();
+        void Record_005_L();
+                
+        void SetPriorityL_001_L();
+        void SetPriorityL_002_L();
+        void SetPriorityL_003_L();
+        void SetPriorityL_004_L();
+        
+        
+        void SetVideoFrameRateL_001_L();
+        void SetVideoFrameRateL_002_L();
+        void SetVideoFrameRateL_003_L();
+        void SetVideoFrameRateL_004_L();
+        
+        void SetVideoFrameSizeL_001_L();
+        void SetVideoFrameSizeL_002_L();
+        void SetVideoFrameSizeL_003_L();
+        void SetVideoFrameSizeL_004_L();
+        void SetVideoFrameSizeL_007_L();
+        
+        void SetVideoBitRateL_001_L();
+        void SetVideoBitRateL_002_L();
+        void SetVideoBitRateL_003_L();
+        void SetVideoBitRateL_004_L();
+        
+        
+        void SetAudioBitRateL_001_L();
+        void SetAudioBitRateL_002_L();
+        void SetAudioBitRateL_003_L();
+        void SetAudioBitRateL_004_L();
+        
+        void SetAudioEnabledL_001_L();
+        void SetAudioEnabledL_002_L();
+        void SetAudioEnabledL_003_L();
+        void SetAudioEnabledL_004_L();
+        
+        
+        void SetMaxClipSizeL_001_L();
+        void SetMaxClipSizeL_002_L();
+        void SetMaxClipSizeL_003_L();
+        void SetMaxClipSizeL_004_L();
+        
+        
+        void SetVideoTypeL_001_L();
+        void SetVideoTypeL_002_L();
+        void SetVideoTypeL_003_L();
+        void SetVideoTypeL_004_L();
+        
+        void SetAudioTypeL_001_L();
+        void SetAudioTypeL_002_L();
+        void SetAudioTypeL_003_L();
+        void SetAudioTypeL_004_L();
+        
+    private:
+        CCamcTestClient_2 * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_3.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_3_H
+#define __CAMCTEST_3_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "camcTest.h"
+
+
+#include <videorecorder.h>
+#include "camctestclient_3.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTest_3 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_3 ();
+        ~CCamcTest_3 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+       
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+       
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void NewL_001_L();
+       
+        
+    private:
+        
+        CCamcTestClient_3 * iCamcTestClient;
+
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_4.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_4_H
+#define __CAMCTEST_4_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_4.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_4 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_4 ();
+        ~CCamcTest_4 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);      
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void RecordTimeAvailableL_001_L();
+        void RecordTimeAvailableL_002_L();
+        void RecordTimeAvailableL_003_L();
+        void RecordTimeAvailableL_004_L();
+        void RecordTimeAvailableL_006_L();
+       
+        
+    private:
+        
+        CCamcTestClient_4 * iCamcTestClient;
+
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_5.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_5_H
+#define __CAMCTEST_5_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_5.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTest_5 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_5 ();
+        ~CCamcTest_5 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void NumberOfMetaDataEntriesL_001_L();
+        void NumberOfMetaDataEntriesL_002_L();
+        void MetaDataEntryL_001_L();
+        void MetaDataEntryL_002_L();
+        void AddMetaDataEntryL_001_L();
+        void AddMetaDataEntryL_002_L();
+        void RemoveMetaDataEntryL_001_L();
+        void RemoveMetaDataEntryL_002_L();
+        void ReplaceMetaDataEntryL_001_L();
+        void ReplaceMetaDataEntryL_002_L();
+        void SetPriorityL_005_L();
+        void GetPriorityL_001_L();
+        void SetVideoFrameRateL_005_L();
+        void VideoFrameRateL_001_L();
+        void SetVideoBitRateL_005_L();
+        void VideoBitRateL_001_L();
+        void SetAudioBitRateL_005_L();
+        void AudioBitRateL_001_L();
+        void SetAudioEnabledL_005_L();
+        void AudioEnabledL_001_L();
+        void SetVideoFrameSizeL_006_L();
+        void GetVideoFrameSizeL_001_L();
+        void PauseL_001_L();
+        void PauseL_002_L();
+        void SetMaxClipSizeL_005_L();
+        void SetGainL_001_L();
+        void SetGainL_002_L();
+        void SetGainL_003_L();
+        void GainL_001_L();
+        void MaxGainL_001_L();
+        void MaxGainL_002_L();
+        void Stop_001_L();
+        void Stop_002_L();
+        void Stop_003_L();
+        void Stop_004_L();
+        void Stop_005_L();
+        void Stop_006_L();
+        void Stop_007_L();
+        void GetSupportedVideoTypes_001_L();
+        void GetSupportedVideoTypes_002_L();
+        void GetSupportedAudioTypes_001_L();
+        void GetSupportedAudioTypes_002_L();
+        void GetSupportedAudioTypes_003_L();
+
+    private:
+        
+        CCamcTestClient_5 * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_6.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_6_H
+#define __CAMCTEST_6_H
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include <ecam.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_6.h"
+
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_6 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_6 ();
+        ~CCamcTest_6 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);         
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void PauseL_003_L();
+
+        void SetVideoFrameSizeL_005_L();
+
+        void SetAudioEnabledL_005_L();
+
+        void SetMaxClipSizeL_006_L();
+        void SetMaxClipSizeL_007_L();
+
+        void Record_006_L();
+        void Record_007_L();
+
+        void VideoTypeL_001_L();
+        void VideoTypeL_002_L();
+        void VideoTypeL_003_L();
+        void VideoTypeL_004_L();
+        void VideoTypeL_005_L();
+
+        void AudioTypeL_001_L();
+        void AudioTypeL_002_L();
+        void AudioTypeL_003_L();
+
+        void SetVideoTypeL_005_L();
+        void SetVideoTypeL_006_L();
+        void SetVideoTypeL_007_L();
+        void SetVideoTypeL_008_L();
+        void SetVideoTypeL_009_L();
+
+        void SetAudioTypeL_005_L();
+        void SetAudioTypeL_006_L();
+        void SetAudioTypeL_007_L();
+        void SetAudioTypeL_008_L();
+
+        void ControllerImplementationInformationL_001_L();
+        void ControllerImplementationInformationL_002_L();
+        void ControllerImplementationInformationL_003_L();
+        void ControllerImplementationInformationL_004_L();
+
+        void MMFRegistration_001_L();
+        void MMFRegistration_002_L();
+        void MMFRegistration_003_L();
+        void MMFRegistration_004_L();
+        void MMFRegistration_005_L();
+        void MMFRegistration_006_L();
+
+        void DurationL_001_L();
+        void DurationL_002_L();
+        void DurationL_003_L();
+                    
+    private:
+        
+        CCamcTestClient_6 * iCamcTestClient;
+
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;          
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_7.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_7_H
+#define __CAMCTEST_7_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_7.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTest_7 : public CTestCase
+    {
+    public:
+        
+        CCamcTest_7 ();
+        ~CCamcTest_7 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void OpenFileL_007_L();
+        void OpenFileL_013_L();
+        void OpenFileL_014_L();    
+        void OpenFileL_015_L();
+        void Close_006_L();
+        
+    private:
+        
+        CCamcTestClient_7 * iCamcTestClient;
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_8.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_8_H
+#define __CAMCTEST_8_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <ecam.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_8.h"
+
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTest_8 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_8 ();
+        ~CCamcTest_8 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);         
+
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void MultipleInstance_001_L();   
+        void MultipleInstance_002_L(); 
+        void MultipleInstance_003_L();
+        void MultipleInstance_004_L();
+        void MultipleInstance_005_L();
+        void MultipleInstance_006_L();
+        
+    private:
+        
+        CCamcTestClient_8 * iCamcTestClient1;   
+        CCamcTestClient_8 * iCamcTestClient2;
+        TInt iError;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;         
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_9.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_9_H
+#define __CAMCTEST_9_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <ecam.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_9.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTest_9 : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_9 ();
+        ~CCamcTest_9 ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);         
+        
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+        void Prepare_007_L();
+        void Prepare_008_L();
+        void Prepare_009_L();
+        void RecordTimeAvailableL_005_L();
+        void SetMaxClipSizeL_008_L();
+        void SetMaxClipSizeL_009_L();
+        void NewFileName_001_L();
+        void NewFileName_002_L();
+        void NewFileName_003_L();
+        void NewFileName_004_L();
+        void NewFileName_005_L();
+        void NewFileName_006_L();
+        void NewFileName_007_L();
+        void OpenFileL_016_L();
+        
+    private:
+        
+        CCamcTestClient_9 * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+    	CActiveSchedulerWait *iWaitScheduler;           
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_visualcheck.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_VISUALCHECK_H
+#define __CAMCTEST_VISUALCHECK_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include "camctestclient_visualcheck.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTest_visualcheck : public CTestCase
+    {
+    public:
+        
+        CCamcTest_visualcheck ();
+        ~CCamcTest_visualcheck ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+
+       void VisualCheck_101_L();
+       void VisualCheck_102_L();
+       void VisualCheck_103_L();
+       void VisualCheck_104_L();
+       void VisualCheck_105_L();
+       void VisualCheck_106_L();
+       void VisualCheck_107_L();
+       void VisualCheck_108_A_L();
+       void VisualCheck_108_B_L();
+       void VisualCheck_109_L();
+       void VisualCheck_110_L();
+       void VisualCheck_111_L();
+       void VisualCheck_112_L();
+       void VisualCheck_113_L();
+       void VisualCheck_114_L();
+       void VisualCheck_115_L();
+       void VisualCheck_116_L();
+       void VisualCheck_117_L();
+       void VisualCheck_118_L();
+       void VisualCheck_119_L();
+       void VisualCheck_120_L();
+       void VisualCheck_121_L();
+
+    private:
+        
+        CCamcTestClient_visualcheck * iCamcTestClient;
+        
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camcTest_visualcheckdsp.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTEST_VISUALCHECKDSP_H
+#define __CAMCTEST_VISUALCHECKDSP_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <ecam.h>
+#include <videorecorder.h>
+#include "camctestclient_visualcheckdsp.h"
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTest_visualcheckdsp : public CTestCase, public MCameraObserver, public MCameraObserver2
+    {
+    public:
+        
+        CCamcTest_visualcheckdsp ();
+        ~CCamcTest_visualcheckdsp ();
+        
+        // Allocate the resources for one test function
+        void setUpL ();
+        
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+        
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+        
+        // Camera API callbacks
+        void ReserveComplete(TInt aError);
+        void PowerOnComplete(TInt aError);
+        void ViewFinderFrameReady(CFbsBitmap& aFrame);
+        void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+        void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);        
+        
+        // Camera API V2 callbacks
+        void HandleEvent(const TECAMEvent& aEvent);
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+        
+    protected:
+        
+        // Own test functions that use assertions and may leave:
+
+       void VisualCheck_001_L();
+       void VisualCheck_002_L();
+       void VisualCheck_003_L();
+       void VisualCheck_004_L();
+       void VisualCheck_005_L();
+       void VisualCheck_006_L();
+       void VisualCheck_007_L();
+       void VisualCheck_008_L();
+       void VisualCheck_009_A_L();
+       void VisualCheck_009_B_L();
+       void VisualCheck_010_L();
+       void VisualCheck_011_L();
+       void VisualCheck_012_L();
+       void VisualCheck_013_L();
+       void VisualCheck_014_L();
+       void VisualCheck_015_L();
+       void VisualCheck_016_L();
+       void VisualCheck_017_L();
+       void VisualCheck_017_A_L();
+       void VisualCheck_018_L();
+       void VisualCheck_019_L();
+       void VisualCheck_020_L();
+       void VisualCheck_021_L();
+
+    private:
+        
+        CCamcTestClient_visualcheckdsp * iCamcTestClient;
+        
+        TInt iUiLevelCameraHandle;
+        CCamera *iUiLevelCamera;
+        CActiveSchedulerWait *iWaitScheduler; 
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_1.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_1_H
+#define __CAMCTESTCLIENT_1_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTestClient_1 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+
+    static CCamcTestClient_1* NewL( );
+    ~CCamcTestClient_1 ();
+	
+
+    void Test_OpenFileL(const TDesC& aFileName, 
+                        TInt aCameraHandle, 
+                        TUid aControllerUid, 
+                        TUid aVideoFormat,
+                        const TDesC8 & aVideoType,
+                        TFourCC aAudioType);
+		
+	void Test_OpenFileL(const TDesC& aFileName, 
+									 TInt aCameraHandle, 
+									 TUid aControllerUid, 
+									 TUid aVideoFormat);
+
+
+	void Test_OpenDesL(TDes8& aDescriptor, 
+									 TInt aCameraHandle, 
+									 TUid aControllerUid, 
+									 TUid aVideoFormat,
+									 const TDesC8 & aVideoType,
+									 TFourCC aAudioType);
+	
+	void Test_OpenUrlL(const TDesC& aUrl, 
+									 TInt aCameraHandle, 
+									 TUid aControllerUid, 
+									 TUid aVideoFormat,
+									 const TDesC8 & aVideoType,
+									 TFourCC aAudioType);
+    
+    TInt WaitForCallbackWithErrors();
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+
+protected:
+
+
+private:
+
+	CCamcTestClient_1 ();
+    void ConstructL();
+
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+
+    TInt  iNrPauses;
+    TInt  iPauseCount;
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TInt iError;
+
+    TBool iStopWhenOpenComplete;
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_2.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_2_H
+#define __CAMCTESTCLIENT_2_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC2_AUDIO_TYPE TFourCC(' ', 'A', 'M', 'R')
+#define TC2_VIDEO_FRAME_RATE 10
+#define TC2_VIDEO_FRAME_SIZE TSize(128,96)
+#define TC2_CIF_VIDEO_FRAME_SIZE TSize(352,288)
+#define TC2_VIDEO_BIT_RATE TInt(40000) 
+#define TC2_AUDIO_BIT_RATE TInt(12200)
+#define TC2_AUDIO_ENABLED EFalse
+#define TC2_VIDEO_TYPE _L8("video/H263-2000")
+
+#define TC2_VIDEO_TYPES_ARRAY  \
+    {     _L8("video/H263-2000"), \
+          _L8("video/H263-2000; profile=0"), \
+          _L8("video/H263-2000; profile=0; level=10") }
+#define TC2_VIDEO_TYPES_ARRAY_LENGTH 3
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION 
+
+
+class CCamcTestClient_2 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+
+public:
+    
+  
+enum TestClient2Actions
+    {
+	Knone,
+    KcloseWhenControllerReady,
+	KcloseWhenControllerNotReady,
+	KcloseWhenPrepareReady,
+	KcloseWhenRecordingReady,
+	KcloseWhenRecording,
+    KcloseWhenPrepareReadyUsingAACandMPEG4,
+
+	KprepareWhenControllerReady,
+	KprepareWhenControllerNotReady,
+	KprepareWhenPrepareReady,
+	KprepareWhenRecordingReady,
+	KprepareWhenRecording,
+	KprepareWhenPrepareReadySetVideoAttributes,
+
+	KrecordWhenControllerReady,
+	KrecordWhenControllerNotReady,
+	KrecordWhenPrepareReady,
+	KrecordWhenRecordingReady,
+	KrecordWhenRecording,
+
+	KSetPriorityLWhenControllerReady,
+	KSetPriorityLWhenControllerNotReady,	
+	KSetPriorityLWhenPrepareReady,
+	KSetPriorityLWhenRecording,
+
+	KSetVideoFrameRateLWhenControllerReady,
+	KSetVideoFrameRateLWhenControllerNotReady,	
+	KSetVideoFrameRateLWhenPrepareReady,
+	KSetVideoFrameRateLWhenRecording,
+	
+	KSetVideoFrameSizeLWhenControllerReady,
+	KSetVideoFrameSizeLWhenControllerReady_MPEG4,
+	KSetVideoFrameSizeLWhenControllerNotReady,	
+	KSetVideoFrameSizeLWhenPrepareReady,
+	KSetVideoFrameSizeLWhenRecording,
+
+	KSetVideoBitRateLWhenControllerReady,
+	KSetVideoBitRateLWhenControllerNotReady,	
+	KSetVideoBitRateLWhenPrepareReady,
+	KSetVideoBitRateLWhenRecording,
+	
+	KSetAudioBitRateLWhenControllerReady,
+	KSetAudioBitRateLWhenControllerNotReady,	
+	KSetAudioBitRateLWhenPrepareReady,
+    KSetAudioBitRateLWhenRecording,
+    
+   	KSetAudioEnabledLWhenControllerReady,
+    KSetAudioEnabledLWhenControllerNotReady,	
+    KSetAudioEnabledLWhenPrepareReady,
+    KSetAudioEnabledLWhenRecording,
+    
+    KSetMaxClipSizeLWhenControllerReady,
+    KSetMaxClipSizeLWhenControllerNotReady,	
+    KSetMaxClipSizeLWhenPrepareReady,
+    KSetMaxClipSizeLWhenRecording,
+    
+    KSetVideoTypeLWhenControllerReady,
+    KSetVideoTypeLWhenControllerNotReady,	
+    KSetVideoTypeLWhenPrepareReady,
+    KSetVideoTypeLWhenRecording,
+    
+    KSetAudioTypeLWhenControllerReady,
+    KSetAudioTypeLWhenControllerNotReady,	
+    KSetAudioTypeLWhenPrepareReady,
+    KSetAudioTypeLWhenRecording
+    };
+
+    static CCamcTestClient_2* NewL( );
+	~CCamcTestClient_2 ();
+
+	void Start_Active_ObjectL(TestClient2Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+protected:
+
+private:
+
+
+enum TestClient2LeavingCodes
+    {
+    KErrGetNotEqualToValuePreviouslySet = 98
+    };
+
+	CCamcTestClient_2 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient2Actions iAction;
+    TestClient2Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TBool iSecondTime;
+};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_3.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_3_H
+#define __CAMCTESTCLIENT_3_H
+
+
+//  INCLUDES
+
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+
+class CCamcTestClient_3 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    
+
+    static CCamcTestClient_3* NewL(TInt aCameraHandle );
+    ~CCamcTestClient_3 ();
+
+
+
+
+protected:
+
+private:
+
+    enum TestClient3Actions
+        {
+        K_Tc3_none
+        };
+    CCamcTestClient_3 ();
+    void ConstructL(TInt aCameraHandle );
+
+    void Start_Active_ObjectL(TestClient3Actions aAction, TInt aCameraHandle );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient3Actions iAction;
+    TestClient3Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_4.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_4_H
+#define __CAMCTESTCLIENT_4_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32def.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC4_FILE_SIZE_LIMIT 250000 //250k bytes
+#define TC4_VIDEO_BIT_RATE TInt(40000) 
+#define TC4_AUDIO_BIT_RATE TInt(12200)
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_4 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    
+    enum TestClient4Actions
+        {
+        K4RecordTimeAvailSizeLimit,
+        K4RecordTimeAvailNoSizeLimit,
+        K4RecordTimeAvailNotRecordingSizeLimit,  
+        K4RecordTimeAvailNotRecordingNoSizeLimit,
+        K4RecordTimeAvailUntilDiskFull
+        };
+    
+    enum TestClient4LeavingCodes
+        {
+        K4UnexpectedErr = 99,
+        K4ValueNotDecreasingErr,
+        K4ValueNotWithinRange,
+        K4ErrExpectingADifferentValue = 101
+        };
+
+    static CCamcTestClient_4* NewL( );
+	~CCamcTestClient_4 ();
+
+	void Start_Active_ObjectL(TestClient4Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+
+protected:
+
+private:
+
+	CCamcTestClient_4 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient4Actions iAction;
+    TestClient4Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TInt iNumberOfTimeOut;
+    TTimeIntervalMicroSeconds iOldTimeRemaining;
+    TInt64 iTimeRemainingInSec;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_5.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_5_H
+#define __CAMCTESTCLIENT_5_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC5_VIDEO_FRAME_RATE_WRONG 0
+#define TC5_VIDEO_BIT_RATE_WRONG TInt(-50) // Voluntarily Incoherent value
+#define TC5_AUDIO_BIT_RATE_WRONG TInt(1) // Voluntarily Incoherent value
+#define TC5_AUDIO_ENABLED EFalse
+#define TC5_VIDEO_FRAME_SIZE_WRONG TSize(128,0) // Voluntarily Incoherent value
+#define TC5_CIF_VIDEO_FRAME_SIZE TSize(352,288)
+
+// AMR
+#define TC5_AUDIO_TYPE_1 TFourCC( ' ', 'A', 'M', 'R' )
+//AAC
+#define TC5_AUDIO_TYPE_3 TFourCC( ' ', 'A', 'A', 'C' )
+
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient5Actions
+    {
+	K_Tc5_none,
+	K_Tc5_NumberOfMetaDataEntriesWhenNotRecording,
+	K_Tc5_NumberOfMetaDataEntriesWhenRecording,
+    K_Tc5_MetaDataEntryWhenNotRecording,
+    K_Tc5_MetaDataEntryWhenRecording,
+    K_Tc5_AddMetaDataEntryWhenNotRecording,
+    K_Tc5_AddMetaDataEntryWhenRecording,
+    K_Tc5_RemoveMetaDataEntryWhenNotRecording,
+    K_Tc5_RemoveMetaDataEntryWhenRecording,
+    K_Tc5_ReplaceMetaDataEntryWhenNotRecording,
+    K_Tc5_ReplaceMetaDataEntryWhenRecording,
+    K_Tc5_SetPriorityWhenNotRecording,
+    K_Tc5_GetPriorityWhenNotSet,
+    K_Tc5_SetVideoFrameRateWhenOpenNotPrepared,
+    K_Tc5_VideoFrameRateWhenNotSet,
+    K_Tc5_SetVideoBitRateWhenOpenNotPrepared,
+    K_Tc5_VideoBitRateWhenNotSet,
+    K_Tc5_SetAudioBitRateWhenOpenNotPrepared,
+    K_Tc5_AudioBitRateWhenNotSet,
+    K_Tc5_SetAudioEnabledWhenOpenNotPrepared,
+    K_Tc5_AudioEnabledWhenNotSet,
+    K_Tc5_SetVideoFrameSizeWhenOpenNotPrepared,
+    K_Tc5_GetVideoFrameSizeWhenNotSet,
+    K_Tc5_PauseWhenRecording,
+    K_Tc5_PauseWhenStopped,
+    K_Tc5_SetMaxClipSizeLWhenNotRecording,
+    K_Tc5_SetGainWhenNotRecording,
+    K_Tc5_SetGainWhenNotRecordingAndSetWrong,
+    K_Tc5_SetGainWhenRecording,
+    K_Tc5_GainWhenNotSet,
+    K_Tc5_MaxGainWhenNotRecording,
+    K_Tc5_MaxGainWhenRecording,
+    K_Tc5_StopWhenRecording,
+    K_Tc5_StopWhenNotRecording,
+    K_Tc5_StopWhenRecordingNewPrepareCorrect,
+    K_Tc5_StopWhenRecordingAfterOpenFile,
+    K_Tc5_StopWhenRecordingAfterOpenFileNew,
+    K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4,
+    K_Tc5_GetSupportedVideoTypesWhenOpenNotRecording,
+    K_Tc5_GetSupportedVideoTypesWhenOpenNotRecordingNew,
+    K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAMR,
+    K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAAC
+    };
+
+enum TestClient5LeavingCodes
+    {
+    KErrExpectingADifferentValue = 101
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class CCamcTestClient_5 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_5* NewL( );
+	~CCamcTestClient_5 ();
+
+	void Start_Active_ObjectL(TestClient5Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+    
+protected:
+
+private:
+
+	CCamcTestClient_5 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool iPrepare2ndTime;
+
+    TestClient5Actions iAction;
+    TestClient5Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    CMMFMetaDataEntry *iMMFMetaDataEntry;
+    TInt iUiLevelCameraHandle;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_6.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_6_H
+#define __CAMCTESTCLIENT_6_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32def.h>
+#include "camcTest.h"
+
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC6_VIDEO_FRAME_SIZE TSize(128,96)
+
+// Equivalent video types.
+#define TC6_VIDEO_TYPES_ARRAY  \
+    {     _L8("video/H263-2000"), \
+          _L8("video/H263-2000; profile=0"), \
+          _L8("video/H263-2000; profile=0; level=10") }
+#define TC6_VIDEO_TYPES_ARRAY_NEW  \
+    {     _L8("video/mp4v-es"), \
+          _L8("video/mp4v-es; profile-level-id=8"), \
+	      _L8("video/mp4v-es; profile-level-id=2"), \
+	      _L8("video/mp4v-es; profile-level-id=3"), \
+          _L8("video/mp4v-es; profile-level-id=1") }
+
+#define TC6_VIDEO_TYPES_ARRAY_LENGTH 3
+#define TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW 5
+
+
+#define TC6_VIDEO_TYPE _L8("video/H263-2000")
+#define TC6_VIDEO_TYPE_PROFILE0 _L8("video/H263-2000; profile=0")
+#define TC6_VIDEO_TYPE_PROFILE8 _L8("video/mp4v-es; profile-level-id=8")
+#define TC6_VIDEO_TYPE_PROFILE3 _L8("video/mp4v-es; profile-level-id=3")
+#define TC6_VIDEO_TYPE_WRONG _L8("video/H263-2000; profile=5")
+// There is no other type supported currently,
+// TC6_VIDEO_TYPE_DIFF = TC6_VIDEO_TYPE
+//#define TC6_VIDEO_TYPE_DIFF _L8("video/mp4v-es")
+#define TC6_AUDIO_TYPE TFourCC( ' ', 'A', 'M', 'R' )
+#define TC6_AUDIO_TYPE_WRONG TFourCC( 0,0,0,0 )
+#define TC6_AAC_AUDIO_TYPE TFourCC( ' ','A','A','C' )
+#define TC6_FILE_SIZE_LIMIT 100000 // bytes
+
+#define TC6_CIF_VIDEO_FRAME_SIZE TSize(352,288)
+
+// MACROS
+
+// DATA TYPES
+enum TestClient6Actions
+    {
+	K_Tc6_none,
+    K_Tc6_PauseWhenStopped,
+    K_Tc6_SetVideoFrameSizeLWhenPaused,
+    K_Tc6_SetAudioEnabledLWhenControllerReady,
+    K_Tc6_SetMaxClipSizeLWhenControllerReady,
+    K_Tc6_SetMaxClipSizeLWhenPrepareReady,
+    K_Tc6_RecordWhenPrepareComplete,
+    K_Tc6_RecordWhenPaused,
+    K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecording,
+    K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording,
+    K_Tc6_VideoTypeLWhenOpenWithMimeAndRecording,
+    K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording,
+    K_Tc6_AudioTypeLWhenOpenWithfourCCAndNotRecording,
+    K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording,
+    K_Tc6_AudioTypeLWhenOpenWithfourCCAndRecording,
+    K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording,
+    K_Tc6_SetVideoTypeLWhenOpenWithMimeAndNotRecording,
+    K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat,
+    K_Tc6_SetVideoTypeLWhenNotRecording,
+    K_Tc6_SetVideoTypeLWithProfile,
+    K_Tc6_SetVideoTypeLWithProfile8,
+    K_Tc6_SetVideoTypeLWithProfile3,
+    K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording,
+    K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC,
+    K_Tc6_SetAudioTypeLWhenNotRecording,
+    K_Tc6_ControllerImplementationInformationWhenNotOpen,
+    K_Tc6_ControllerImplementationInformationWhenOpen, 
+    K_Tc6_ControllerImplementationInformationWhenOpenNew, 
+    K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4, 
+    K_Tc6_DurationWhenRecording,
+    K_Tc6_DurationWhenNotRecording,
+    K_Tc6_DurationWhenPaused
+    };
+
+enum TestClient6LeavingCodes
+    {
+    K_Tc6_ErrExpectingADifferentValue = 101,
+    K_Tc6_ValueNotIncreasingErr,
+    K_Tc6_ErrExpectingToLeave
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_6 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_6* NewL( );
+	~CCamcTestClient_6 ();
+
+	void Start_Active_ObjectL(TestClient6Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+    void CheckControllerImplementationInformationL (const CMMFControllerImplementationInformation & aReturnedResult );
+    void CheckControllerImplementationInformationNewL (const CMMFControllerImplementationInformation & aReturnedResult );
+    void CheckControllerImplementationInformationNewMPEG4L (const CMMFControllerImplementationInformation & aReturnedResult );
+
+protected:
+
+private:
+
+	CCamcTestClient_6 ();
+    void ConstructL ();
+   
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient6Actions iAction;
+    TestClient6Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TInt iNumberOfTimeOut;
+    TInt64 iPreviousTime;
+    TTimeIntervalMicroSeconds iOldTimeDuration;
+    TBool iResumeRecording;
+    TInt iNumberOfTimeAsked;
+    TTimeIntervalMicroSeconds iOldDuration;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_7.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_7_H
+#define __CAMCTESTCLIENT_7_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include <ecam.h>
+
+
+// CONSTANTS
+
+#define TC7_CONTROLLER_UID 0x101f8503
+#define TC7_VIDEO_FORMAT_UID 0x101f8504
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient_7_Actions
+    {
+	K_Tc7_none,
+    K_Tc7_ReleaseCameraWhileRecording,
+    K_Tc7_PowerOffCameraWhileRecording,
+    K_Tc7_ReleaseCameraCloseRecorderUseCamera,
+    K_Tc7_OpenFileWhenCameraIsNotAvailable,
+    K_Tc7_OpenFileWithVideoFormatNULL
+    };
+
+enum TCameraReleasedState
+    {
+    ENothingReleased,
+    ECamcStopped,
+    ECameraReleased
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+class CCamcTestClient_7 : public CTimer /* also CActive*/,
+                          public MVideoRecorderUtilityObserver,
+                          public MCameraObserver,
+                          public MCameraObserver2
+
+{
+public:
+    static CCamcTestClient_7* NewL( );
+	~CCamcTestClient_7 ();
+
+	void Start_Active_ObjectL ( TestClient_7_Actions aAction );
+
+protected:
+    //from MVideoRecorder observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+    // Camera API callbacks
+    void ReserveComplete(TInt aError);
+    void PowerOnComplete(TInt aError);
+    void ViewFinderFrameReady(CFbsBitmap& aFrame);
+    void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError);	
+    void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError);
+
+    // Camera API V2 callbacks
+    void HandleEvent(const TECAMEvent& aEvent);
+    void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+private:
+
+	CCamcTestClient_7 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	CCamera *iCamera, *iCamera2;
+	CActiveSchedulerWait *iWaitScheduler;   
+
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient_7_Actions iAction;
+    TInt iError;
+    TInt iCameraReleasedState;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_8.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_8_H
+#define __CAMCTESTCLIENT_8_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+#include <ecam.h>
+
+
+// CONSTANTS
+
+#define TC8_CONTROLLER_UID 0x101f8503
+#define TC8_VIDEO_FORMAT_UID 0x101f8504
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient_8_Actions
+    {
+    K_Tc8_MultipleInstance001_AO1,    
+    K_Tc8_MultipleInstance001_AO2,
+
+    K_Tc8_MultipleInstance002_AO1,    
+    K_Tc8_MultipleInstance002_AO2,
+
+    K_Tc8_MultipleInstance003_AO1,    
+    K_Tc8_MultipleInstance003_AO2,
+    
+    K_Tc8_MultipleInstance004_AO1,    
+    K_Tc8_MultipleInstance004_AO2,
+
+    K_Tc8_MultipleInstance005_AO1,    
+    K_Tc8_MultipleInstance005_AO2,
+
+    K_Tc8_MultipleInstance006_AO1,    
+    K_Tc8_MultipleInstance006_AO2
+
+    };
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_8 : public CTimer /* also CActive*/,
+                          public MVideoRecorderUtilityObserver
+
+{
+public:
+    static CCamcTestClient_8* NewL( const TDesC & aFileName, TInt *aError,
+        TInt * aNumberOfOpenedCamc, TInt aCameraHandle);
+	~CCamcTestClient_8 ();
+
+	void Start_Active_Object(TestClient_8_Actions aAction,
+                             CCamcTestClient_8 * aClient);
+    void TellMeWhenYouAreInCorrectState(TRequestStatus &aRequest);
+    void Close();
+
+
+protected:
+    //from MVideoRecorder observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+
+// Own functions
+    void WaitForOtherObject();
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+private:
+
+	CCamcTestClient_8 ();
+    void ConstructL( const TDesC &aFileName , TInt *aError,
+        TInt * aNumberOfOpenedCamc, TInt aCameraHandle);
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+    void ReachedWaitingState();
+
+    CVideoRecorderUtility * iCamc;
+    CCamcTestClient_8 * iOtherClient;
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool iReachedWaitingState;
+    TestClient_8_Actions iAction;
+    TInt *iError;
+    TRequestStatus *iReceivedRequest;
+    TBool iRequestPending; // The "server" has been requested for some thing,
+                           // but it hasn't answered yet.  
+    TBool iEmittedRequest; // The "client" has been requesting some thing.
+
+    TBuf<100> iFileName;
+
+    TInt *iNumberOfOpenedCamc;
+    TBool iRecordingReadyTimer;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_9.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_9_H
+#define __CAMCTESTCLIENT_9_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32def.h>
+#include "camcTest.h"
+
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TC9_VIDEO_BIT_RATE TInt(40000) 
+#define TC9_AUDIO_BIT_RATE TInt(12200)
+#define TC9_FILE_SIZE_LIMIT 50000
+#define TC9_AUDIO_BIT_RATE_AAC TInt(32000)
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClient9Actions
+    {
+	K_Tc9_none,
+    K_Tc9_PrepareWhenControllerReadyWhitoutSetting,
+    K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting,
+    K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting,
+    K_Tc9_RecordTimeAvailWhenRecordingReady,
+    K_Tc9_SetMaxClipSizeLWhenControllerReadySize0,
+    K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize,
+    K_TC9_NewFileNameWhenPreparedNotRecording,
+    K_TC9_NewFileNameWhenRecordSecondTime,
+    K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat,
+    K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat,
+    K_TC9_NewFileNameWhenRecording,
+    K_TC9_NewFileNameWhenPaused,
+    K_TC9_NewFileNameWhenInternalStop,
+    K_Tc9_OpenFileInAFolderNonExistent
+    };
+
+enum TestClient9LeavingCodes
+    {
+    K_Tc9_ValueNotWithinRange = 101,
+    K_Tc9_ValueNotExpected
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+class CCamcTestClient_9 : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_9* NewL( );
+	~CCamcTestClient_9 ();
+
+	void Start_Active_ObjectL ( TestClient9Actions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+protected:
+
+private:
+
+	CCamcTestClient_9 ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void RunLContinuedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TestClient9Actions iAction;
+    TestClient9Actions iSavedAction; //iSaved Action will never be changed.
+    TInt iError;
+    TTimeIntervalMicroSeconds iOldTimeRemaining;
+    TBool iNewFileName;
+    TBool iRecord2ndTime;
+    TBuf<256> iFileName;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_visualcheck.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_VISUALCHECK_H
+#define __CAMCTESTCLIENT_VISUALCHECK_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <mmf/common/mmfvideo.h>
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define TCVC_VIDEO_BIT_RATE_10 TInt(64000)
+#define TCVC_VIDEO_BIT_RATE_11 TInt(28000) 
+#define TCVC_VIDEO_BIT_RATE_20 TInt(28000) 
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClientVCActions
+    {
+    K_VC_none,
+        K_VC_test_case_101,
+        K_VC_test_case_102,
+        K_VC_test_case_103,
+        K_VC_test_case_104,
+        K_VC_test_case_105,
+        K_VC_test_case_106,
+        K_VC_test_case_107,
+        K_VC_test_case_108_a,
+        K_VC_test_case_108_b,
+        K_VC_test_case_109,
+        K_VC_test_case_110,
+        K_VC_test_case_111,
+        K_VC_test_case_112,
+        K_VC_test_case_113,
+        K_VC_test_case_114,
+        K_VC_test_case_115,
+        K_VC_test_case_116,
+        K_VC_test_case_117,
+        K_VC_test_case_118,
+        K_VC_test_case_119,
+        K_VC_test_case_120,
+        K_VC_test_case_121
+    };
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTestClient_visualcheck : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_visualcheck* NewL( );
+    ~CCamcTestClient_visualcheck ();
+
+    void Start_Active_ObjectL ( TestClientVCActions aAction );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+
+protected:
+
+private:
+
+    CCamcTestClient_visualcheck ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+    TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool i2ndTime;
+    TBool iDoublePause;
+    TBool iStartRecording2ndTime;
+    TestClientVCActions iAction;
+    TInt iError;
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/inc/camctestclient_visualcheckdsp.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#ifndef __CAMCTESTCLIENT_VISUALCHECKDSP_H
+#define __CAMCTESTCLIENT_VISUALCHECKDSP_H
+
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "camcTest.h"
+
+#include <mmf/common/mmfvideo.h>
+#include <videorecorder.h>
+
+
+// CONSTANTS
+
+#define VIDEO_BIT_RATE_10 TInt(64000)
+#define VIDEO_BIT_RATE_11 TInt(28000) 
+
+// MACROS
+
+// DATA TYPES
+
+enum TestClientVCdspActions
+    {
+    K_VC_dsp_none,
+        K_VC_dsp_test_case_1,
+        K_VC_dsp_test_case_2,
+        K_VC_dsp_test_case_3,
+        K_VC_dsp_test_case_4,
+        K_VC_dsp_test_case_5,
+        K_VC_dsp_test_case_6,
+        K_VC_dsp_test_case_7,
+        K_VC_dsp_test_case_8,
+        K_VC_dsp_test_case_9_a,
+        K_VC_dsp_test_case_9_b,
+        K_VC_dsp_test_case_10,
+        K_VC_dsp_test_case_11,
+        K_VC_dsp_test_case_12,
+        K_VC_dsp_test_case_13,
+        K_VC_dsp_test_case_14,
+        K_VC_dsp_test_case_15,
+        K_VC_dsp_test_case_16,
+        K_VC_dsp_test_case_17,
+        K_VC_dsp_test_case_17_a,
+        K_VC_dsp_test_case_18,
+        K_VC_dsp_test_case_19,
+        K_VC_dsp_test_case_20,
+        K_VC_dsp_test_case_21
+    };
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+
+
+class CCamcTestClient_visualcheckdsp : public CTimer /* also CActive*/, public MVideoRecorderUtilityObserver
+{
+public:
+    static CCamcTestClient_visualcheckdsp* NewL( );
+	~CCamcTestClient_visualcheckdsp ();
+
+	void Start_Active_ObjectL ( TestClientVCdspActions aAction, TInt aCameraHandle );
+
+    //from observer
+    void MvruoOpenComplete(TInt aError);
+    void MvruoPrepareComplete(TInt aError);
+    void MvruoRecordComplete(TInt aError);
+    void MvruoEvent(const TMMFEvent& /*aEvent*/);
+    void SomethingInActiveObjectIsLeaving (TInt aError);
+
+    
+
+protected:
+
+private:
+
+	CCamcTestClient_visualcheckdsp ();
+    void ConstructL( );
+
+    //from CActive
+    void RunL();
+    void RunLTrappedL();
+    void DoCancel();
+
+    CVideoRecorderUtility* iCamc;
+	
+	TInt  iTimeout;
+
+    TBool iOpenReady;
+    TBool iPrepareReady;
+    TBool iRecordingReady;
+    TBool iPaused;
+    TBool iClosed;
+    TBool i2ndTime;
+    TBool iDoublePause;
+    TBool iStartRecording2ndTime;
+    TestClientVCdspActions iAction;
+    TInt iError;
+    
+     TInt iUiLevelCameraHandle;
+     
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/StifCamcTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "StifCamcTestTop.h"
+#include "TestFrameWork/testSuite.h"
+
+#include "camcTest_1.h"
+#include "camcTest_2.h"
+#include "camcTest_3.h"
+#include "camcTest_4.h"
+#include "camcTest_5.h"
+#include "camcTest_6.h"
+#include "camcTest_7.h"
+#include "camcTest_8.h"
+#include "camcTest_9.h"
+#include "camcTest_visualcheckdsp.h"
+#include "camcTest_visualcheck.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+
+
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL(CCamcTest_1::suiteL());
+    iTestSuite->addTestL(CCamcTest_2::suiteL());
+    iTestSuite->addTestL(CCamcTest_3::suiteL());
+    iTestSuite->addTestL(CCamcTest_4::suiteL());
+    iTestSuite->addTestL(CCamcTest_5::suiteL());   
+    iTestSuite->addTestL(CCamcTest_6::suiteL());
+    iTestSuite->addTestL(CCamcTest_7::suiteL());    
+    iTestSuite->addTestL(CCamcTest_8::suiteL());
+    iTestSuite->addTestL(CCamcTest_9::suiteL());
+
+    // Visual checks are flagged out because tests are very long !
+    
+    // Only one of these suite should be selected, depending on 
+    // HW used for the test.
+    // iTestSuite->addTestL(CCamcTest_visualcheckdsp::suiteL()); 
+    // iTestSuite->addTestL(CCamcTest_visualcheck::suiteL()); 
+
+     /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+
+    // Return value
+    TInt execStatus = KErrNone;
+    iTestSuite->ExecuteTestL(aResult, aCaseNumber);
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+      
+    }
+    
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+    
+    
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+
+    // Stack size
+    param->iTestThreadStackSize= 32768;// 32K stack 
+
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 8*1048576;// 4M heap max
+
+    aTestModuleParam = param;
+
+    return KErrNone;
+    }
+
+#ifndef EKA2
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/TestFrameWork/AssertFailure.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+#include "AssertFailure.h"
+
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+									  TInt aLineNumber,
+									  const TDesC8& aFileName)
+	{
+	CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+									   TInt aLineNumber,
+									   const TDesC8& aFileName)
+
+	{
+	CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+	CleanupStack::PushL(self);
+	self->ConstructL(aMessage, aFileName);
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self=NewLC(aAssertFailure);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self = new(ELeave)CAssertFailure;
+	CleanupStack::PushL(self);
+	self->ConstructL(aAssertFailure);
+	return self;
+	}
+
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+								 const TDesC8& aFileName)
+	{
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+	}
+
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+	{
+	iLineNumber = aAssertFailure.iLineNumber;
+	iMessage = aAssertFailure.iMessage->AllocL();
+	iFileName = aAssertFailure.iFileName->AllocL();
+	}
+
+
+CAssertFailure::CAssertFailure ()
+	{
+	}
+
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+	{
+	}
+
+
+CAssertFailure::~CAssertFailure () 
+	{
+    delete iFileName;
+	delete iMessage;
+	}
+
+
+const TDesC8& CAssertFailure::What() const
+	{
+	return *iMessage;
+	}
+
+
+TInt CAssertFailure::LineNumber()  const
+	{
+	return iLineNumber;
+	}
+
+
+const TDesC8& CAssertFailure::FileName()  const
+	{
+	return *iFileName;
+	}
+
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+	{
+	iMyHeapCellCount = aHeapCellCount;
+	}
+	
+
+TInt CAssertFailure::MyHeapCellCount ()
+	{
+	return iMyHeapCellCount;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/TestFrameWork/TestCase.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+#include <utf.h>
+
+#include "TestFrameWork/testCase.h"
+#include "TestFrameWork/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "TestCase.h"
+#include "TestResult.h"
+#include "AssertFailure.h"
+#include "CppUnitLog.h"
+#endif
+
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/TestFrameWork/TestSuite.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: media_recorder_api
+*
+*/
+
+
+
+#include "TestFrameWork/testSuite.h"
+#include <StifTestModule.h>
+
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+#include <e32base.h>
+#include <f32file.h>
+#include "camcTest.h"
+//////////////////
+// Utility function
+//////////////////
+
+
+void AddDriveLetterToPath(const TDesC &aFileName,TDes &aFileNameWithPath ) 
+    {
+    TFileName aDrive;
+
+    Dll::FileName(aDrive);
+    TParsePtr parse(aDrive);
+    aDrive = parse.Drive();
+    if ((aDrive[0] == 'Z') || (aDrive[0] == 'z'))
+        {
+        aDrive = _L("E:");
+        }
+    aDrive.Append(_L("\\"));
+    aDrive.Append(aFileName);
+    aFileNameWithPath = aDrive;
+    RDebug::Print(_L("Recording Full Path:")); 
+    RDebug::Print(aDrive);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_1.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camctestclient_1.h"
+#include "camcTest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+
+CCamcTestClient_1::CCamcTestClient_1 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+
+CCamcTestClient_1::~CCamcTestClient_1 ()
+    {
+    Cancel();
+    iCamc->Close();
+    delete iCamc;
+    }
+
+CCamcTestClient_1* CCamcTestClient_1::NewL( )
+    {
+    CCamcTestClient_1* self = new(ELeave) CCamcTestClient_1;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_1::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    iNrPauses = 0;
+    iPauseCount = 0;
+    iTimeout = 0;
+    
+    CTimer::ConstructL();
+    
+    CActiveScheduler::Add(this);
+    }
+
+void CCamcTestClient_1::Test_OpenFileL(const TDesC& aFileName, 
+                                       TInt aCameraHandle, 
+                                       TUid aControllerUid, 
+                                       TUid aVideoFormat,
+                                       const TDesC8 & aVideoType,
+                                       TFourCC aAudioType)
+    {
+    TFileName file;
+    AddDriveLetterToPath(aFileName,file);
+    iCamc->OpenFileL( file, aCameraHandle, aControllerUid, aVideoFormat,aVideoType, aAudioType);
+    }
+
+void CCamcTestClient_1::Test_OpenFileL(const TDesC& aFileName, 
+                                       TInt aCameraHandle, 
+                                       TUid aControllerUid, 
+                                       TUid aVideoFormat)
+    {
+    TFileName file;
+    AddDriveLetterToPath(aFileName,file);
+    iCamc->OpenFileL( file, aCameraHandle, aControllerUid, aVideoFormat);
+    }
+
+void CCamcTestClient_1::Test_OpenDesL(TDes8& aDescriptor, 
+                                      TInt aCameraHandle, 
+                                      TUid aControllerUid, 
+                                      TUid aVideoFormat,
+                                      const TDesC8 & aVideoType,
+                                      TFourCC aAudioType)
+    {
+    iCamc->OpenDesL( aDescriptor, aCameraHandle, aControllerUid, aVideoFormat,aVideoType, aAudioType);
+    }
+
+void CCamcTestClient_1::Test_OpenUrlL(const TDesC& aUrl, 
+                                      TInt aCameraHandle, 
+                                      TUid aControllerUid, 
+                                      TUid aVideoFormat,
+                                      const TDesC8 & aVideoType,
+                                      TFourCC aAudioType)
+    {
+    iCamc->OpenUrlL( aUrl, 0, aCameraHandle, aControllerUid, aVideoFormat,aVideoType, aAudioType);
+    }
+
+TInt CCamcTestClient_1::WaitForCallbackWithErrors()
+    {
+    iStopWhenOpenComplete = ETrue;
+    CActiveScheduler::Start();
+    return(iError);
+    }
+
+
+void CCamcTestClient_1::RunL()
+    {
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,
+           RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_1::RunLTrappedL()
+    {
+    TBuf<100> aaa;
+    aaa.Format(_L("RunL iOpenReady:%i iPrepareReady:%i iRecordingReady:%i iPaused:%i"), 
+        iOpenReady, iPrepareReady, iRecordingReady, iPaused);
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(EFalse);
+        iCamc->Prepare();
+        }
+    
+    else if ( iPrepareReady ) 
+        {
+        iPrepareReady = EFalse;
+        iCamc->Record();
+        CTimer::After( iTimeout );
+        }
+    
+    else if ( iRecordingReady )
+        {
+        iRecordingReady = EFalse;
+        iCamc->Close();
+        
+        CActiveScheduler::Stop();
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        if ( iPauseCount < iNrPauses )
+            {
+            iPaused = ETrue;
+            iPauseCount++;
+            iCamc->PauseL();
+            //add timer
+            CTimer::After( iTimeout );
+            }
+        else 
+            {
+            iCamc->Stop();
+            
+            CActiveScheduler::Stop();
+            }
+        }
+    }
+
+void CCamcTestClient_1::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_1::MvruoOpenComplete( TInt aError )
+    {
+    if ( iStopWhenOpenComplete )
+        {
+        iError = aError;
+        CActiveScheduler::Stop();
+        return;
+        }
+
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, it cannot leave.
+        }
+    }
+
+void CCamcTestClient_1::MvruoPrepareComplete( TInt aError )
+    {    
+    TBuf<128> str;
+    str.Format(_L("CCamcTestClient_1::MvruoPrepareComplete %i"), aError);
+    RDebug::Print(str); 
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, it cannot leave.
+        }
+    }
+
+void CCamcTestClient_1::MvruoRecordComplete( TInt aError )
+    {    
+    TBuf<128> str;
+    str.Format(_L("CCamcTestClient_1::MvruoRecordComplete %i"), aError);
+    RDebug::Print(str); 
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, it cannot leave.
+        }
+    }
+
+void CCamcTestClient_1::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {   
+    RDebug::Print(_L("CCamcTestClient_1::MvruoEvent"));
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_1::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    TBuf<128> str;
+    str.Format(_L("CCamcTestClient_1::Something In Active Object is leaving %i"), aError);
+    RDebug::Print(str);   
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_2.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,837 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_2.h"
+#include <e32svr.h>
+#include <AudioPreference.h>
+#include "camcTest.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_2::CCamcTestClient_2 () : CTimer(CActive::EPriorityHigh)
+    { 
+    RDebug::Print(_L("CamCTestClient 2: Constructor"));
+    }
+
+
+CCamcTestClient_2::~CCamcTestClient_2 ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2: Destructor Start"));
+#endif
+    Cancel();
+    delete iCamc;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2: Destructor End"));
+#endif
+    }
+
+CCamcTestClient_2* CCamcTestClient_2::NewL()
+    {
+    CCamcTestClient_2* self = new(ELeave) CCamcTestClient_2;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_2::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_2::Start_Active_ObjectL ( TestClient2Actions aAction, TInt aCameraHandle )
+    {
+
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    switch ( iAction )
+        {
+        case  KcloseWhenControllerNotReady :
+            {
+            iCamc->Close();
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+            
+        case KprepareWhenControllerNotReady :
+            {
+            iCamc->Prepare();
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+            
+        case KrecordWhenControllerNotReady :
+            {
+            iCamc->Record();	
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+            
+        case KSetPriorityLWhenControllerNotReady :
+            {
+            iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime );	
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoFrameRateLWhenControllerNotReady :
+            {
+            iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoFrameSizeLWhenControllerNotReady :
+            {
+            iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoBitRateLWhenControllerNotReady :
+            {
+            iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE  );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetAudioBitRateLWhenControllerNotReady :
+            {
+            iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetAudioEnabledLWhenControllerNotReady :
+            {
+            iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetMaxClipSizeLWhenControllerNotReady :
+            {
+            iCamc->SetMaxClipSizeL( 10000 );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoTypeLWhenControllerNotReady :
+            {
+            iCamc->SetVideoTypeL( TC2_VIDEO_TYPE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetAudioTypeLWhenControllerNotReady :
+            {
+            iCamc->SetAudioTypeL(  TC2_AUDIO_TYPE );
+            CTimer::After( 1000 );	// Give some time for all Active objects to react to this
+            // Command
+            break;
+            }
+        case KSetVideoFrameSizeLWhenControllerReady_MPEG4 :
+        case KcloseWhenPrepareReadyUsingAACandMPEG4 :
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordCIF.mp4"), file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, 
+                camHandle, 
+                controllerUid,
+                formatUidMP4,
+                _L8("video/mp4v-es; profile-level-id=3"),
+                TFourCC(' ', 'A', 'A', 'C') ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            iOpenReady = EFalse;
+            
+            break;
+            }
+        default:
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, 
+                camHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            iOpenReady = EFalse;
+            
+            break;
+            }
+        }
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_2::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2:RunL"));
+#endif
+    TRAPD( err,
+        RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_2::RunLTrappedL()
+    {
+    TBool prepare = EFalse;
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue);
+
+        switch ( iAction )
+            {
+            case  KcloseWhenControllerReady:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+                
+            case  KprepareWhenControllerReady:
+                {
+                prepare = ETrue;
+                break;
+                }
+                
+            case KrecordWhenControllerReady:
+                {
+                iCamc->Record();
+                break;
+                }
+                
+            case KSetPriorityLWhenControllerReady :
+                {
+                iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoFrameRateLWhenControllerReady :
+                {
+                iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoFrameSizeLWhenControllerReady :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoFrameSizeLWhenControllerReady_MPEG4 :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_CIF_VIDEO_FRAME_SIZE );
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoBitRateLWhenControllerReady :
+                {
+                iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetAudioBitRateLWhenControllerReady :
+                {
+                iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE  );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetAudioEnabledLWhenControllerReady :
+                {
+                iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetMaxClipSizeLWhenControllerReady :
+                {
+                iCamc->SetMaxClipSizeL( 10000 );	
+                prepare = ETrue;
+                break;
+                }
+            case KSetVideoTypeLWhenControllerReady :
+                {
+                iCamc->SetVideoTypeL( TC2_VIDEO_TYPE );
+                prepare = ETrue;
+                break;
+                }
+            case KSetAudioTypeLWhenControllerReady :
+                {
+                iCamc->SetAudioTypeL( TC2_AUDIO_TYPE );
+                prepare = ETrue;
+                break;
+                }
+            default:
+                {
+                prepare = ETrue;
+                break;
+                }
+            }
+        if ( prepare )
+            {
+            iCamc->Prepare();
+            }
+        }
+    else if ( iPrepareReady ) 
+        {
+        TBool record = EFalse;
+        
+        switch ( iAction )
+            {
+            case KcloseWhenPrepareReady:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+            case KcloseWhenPrepareReadyUsingAACandMPEG4:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+
+            case  KprepareWhenPrepareReady:
+                {
+                iAction = Knone;
+                iPrepareReady = EFalse;
+                iCamc->Prepare();
+                break;
+                }
+            case  KprepareWhenPrepareReadySetVideoAttributes:
+                {
+                iAction = Knone;
+                iPrepareReady = EFalse;
+                iCamc->SetVideoFrameSizeL( TSize(176,144) );
+                iCamc->SetVideoFrameRateL( TReal32(15) );
+                iCamc->SetVideoBitRateL( TInt(50000) );
+                iCamc->SetAudioEnabledL( EFalse );
+                iCamc->Prepare();
+                break;
+                }
+            case KrecordWhenPrepareReady:
+                {
+                record = ETrue;
+                break;
+                }
+            case KSetPriorityLWhenPrepareReady :
+                {
+                if (!iSecondTime)
+                    {
+                    iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime );
+                    record = EFalse;
+                    iCamc->Prepare();
+                    iSecondTime = ETrue;
+                    }
+                else
+                    {
+                    record= ETrue;
+                    }
+                break;
+                }
+            case KSetVideoFrameRateLWhenPrepareReady :
+                {
+                iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) );
+                record = ETrue;
+                break;
+                }
+            case KSetVideoFrameSizeLWhenPrepareReady :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+                record = ETrue;
+                break;
+                }
+            case KSetVideoBitRateLWhenPrepareReady :
+                {
+                iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE );
+                record = ETrue;
+                break;
+                }
+            case KSetAudioBitRateLWhenPrepareReady :
+                {
+                iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE );
+                record = EFalse;
+                iCamc->Prepare();
+                iAction = Knone;
+                break;
+                }
+            case KSetAudioEnabledLWhenPrepareReady :
+                {
+                iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );	
+                record = ETrue;
+                break;
+                }
+            case KSetMaxClipSizeLWhenPrepareReady :
+                {
+                iCamc->SetMaxClipSizeL( 10000 );	
+                record = ETrue;
+                break;
+                }
+            case KSetVideoTypeLWhenPrepareReady :
+                {
+                iCamc->SetVideoTypeL( TC2_VIDEO_TYPE  );   
+                record = ETrue;
+                break;
+                }
+            case KSetAudioTypeLWhenPrepareReady :
+                {
+                iCamc->SetAudioTypeL( TC2_AUDIO_TYPE );   
+                record = ETrue;
+                break;
+                }   
+            case KSetMaxClipSizeLWhenControllerReady :
+                {
+                record = ETrue;
+                iTimeout = 40 * 1E6; // Wait for 10 seconds.
+                break;
+                }
+            default:
+                {
+                record = ETrue;
+                break;
+                }
+            }
+        if ( record )
+            {
+            iPrepareReady = EFalse;
+            iCamc->Record();
+            CTimer::After( iTimeout );
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+        TBool closeCam = ETrue;
+        switch ( iAction )
+            {
+            case KcloseWhenRecordingReady:
+                {
+                iAction = Knone;
+                iCamc->Close();		
+                closeCam = EFalse;     // False because we want to stop the Active scheduler
+                                       // yet
+                CTimer::After( 10000 );
+                break;
+                }
+            case  KprepareWhenRecordingReady:
+                {
+                iAction = Knone;
+                iRecordingReady = EFalse;
+                iCamc->Prepare();
+                closeCam = EFalse;
+                // Should start a new recording
+                break;
+                }
+            case  KrecordWhenRecordingReady:
+                {
+                iAction = Knone;
+                iRecordingReady = EFalse;
+                iCamc->Record();
+                closeCam = EFalse;
+                CTimer::After( (TInt) (10*1E6) );    // Starts a new recording
+                break;
+                }
+            default:
+                break;
+            }
+        // ////////////////////////////////////////////////////////////////
+        // Check here if the settings were taken into use
+        // (For functions with a get)
+        
+        switch ( iSavedAction )
+            {
+            case KSetPriorityLWhenPrepareReady :
+            case KSetPriorityLWhenRecording:
+            case KSetPriorityLWhenControllerReady :	
+                {
+                TInt priority;
+                TMdaPriorityPreference pref;
+                iCamc->GetPriorityL(priority, pref);
+                __ASSERT_ALWAYS( priority == EMdaPriorityNormal,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                __ASSERT_ALWAYS( pref == EMdaPriorityPreferenceTime, 
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet )); 
+                break;
+                }          
+            
+            case KSetVideoFrameRateLWhenPrepareReady :
+            case KSetVideoFrameRateLWhenRecording:
+            case KSetVideoFrameRateLWhenControllerReady :	
+                {
+                TReal32 frameRate;
+                frameRate = iCamc->VideoFrameRateL();
+                __ASSERT_ALWAYS( frameRate ==  TC2_VIDEO_FRAME_RATE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+                
+            case KSetVideoFrameSizeLWhenPrepareReady :   // Should have left already
+            case KSetVideoFrameSizeLWhenRecording:       // Should have left already
+                User::Panic(_L("Should never come here"),0);
+                break;
+            case KSetVideoFrameSizeLWhenControllerReady :
+                {
+                TSize frameSize;
+                iCamc->GetVideoFrameSizeL( frameSize );
+                __ASSERT_ALWAYS( frameSize==  TC2_VIDEO_FRAME_SIZE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }           
+            case KSetVideoFrameSizeLWhenControllerReady_MPEG4 :
+                {
+                TSize cifFrameSize;
+                iCamc->GetVideoFrameSizeL( cifFrameSize );
+                __ASSERT_ALWAYS( cifFrameSize==  TC2_CIF_VIDEO_FRAME_SIZE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }           
+            case KSetVideoBitRateLWhenPrepareReady :
+            case KSetVideoBitRateLWhenRecording:
+            case KSetVideoBitRateLWhenControllerReady :	
+                {
+                TInt bitRate;
+                bitRate = iCamc->VideoBitRateL();
+                __ASSERT_ALWAYS( bitRate ==  TC2_VIDEO_BIT_RATE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            case KSetAudioBitRateLWhenPrepareReady :
+            case KSetAudioBitRateLWhenControllerReady :	
+                {
+                TInt bitRate;
+                bitRate = iCamc->AudioBitRateL();
+                __ASSERT_ALWAYS( bitRate ==  TC2_AUDIO_BIT_RATE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            case KSetVideoTypeLWhenPrepareReady :  // Should have left already
+            case KSetVideoTypeLWhenRecording:      // Should have left already     
+                User::Panic(_L("Should never come here"),0);
+                break;
+            case KSetVideoTypeLWhenControllerReady :	
+                {
+                 
+                TPtrC8 videoType = iCamc->VideoFormatMimeType();
+         
+
+                TPtrC8 expectedVideoType[TC2_VIDEO_TYPES_ARRAY_LENGTH] = TC2_VIDEO_TYPES_ARRAY ;
+                TBool found = 0;
+                for (TInt i=0; i<TC2_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                    {
+                    if ( expectedVideoType[i] == videoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                __ASSERT_ALWAYS( found,
+                       User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            case KSetAudioTypeLWhenPrepareReady :  // Should have left already
+            case KSetAudioTypeLWhenRecording:      // Should have left already
+               User::Panic(_L("Should never come here"),0);
+               break;
+            case KSetAudioTypeLWhenControllerReady :	
+                {
+                TFourCC audioType;
+                audioType = iCamc->AudioTypeL();
+                __ASSERT_ALWAYS( audioType ==  TC2_AUDIO_TYPE ,
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet ));
+                break;
+                }
+            default:
+                break;
+            }
+        
+        if (closeCam)
+            {
+            iRecordingReady = EFalse;
+
+            // Close will panic if called here...
+            iCamc->Close();
+            CActiveScheduler::Stop();
+
+            }
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        switch ( iAction )
+            {
+            case KcloseWhenRecording:
+                {
+                iCamc->Close();		
+                iClosed = 1;
+                break;
+                }
+            case KprepareWhenRecording:
+                {
+                // Should leave.
+                iAction = Knone;
+                iCamc->Prepare();
+                break;
+                }
+            case KrecordWhenRecording:
+                {
+                // Should be ignored
+                iAction = Knone;
+                iCamc->Record();
+                CTimer::After ( (TInt) 1E6 ); // Wait 1 Second
+                break;
+                }
+            case KSetPriorityLWhenRecording :
+                {
+                iAction = Knone;
+                iCamc->SetPriorityL( EMdaPriorityNormal,EMdaPriorityPreferenceTime );	
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetVideoFrameRateLWhenRecording:
+                {
+                iAction = Knone;
+                iCamc->SetVideoFrameRateL( TReal32( TC2_VIDEO_FRAME_RATE ) );
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetVideoFrameSizeLWhenRecording :
+                {
+                iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
+                break;
+                }
+            case KSetVideoBitRateLWhenRecording :
+                {
+                iAction = Knone;
+                iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE );
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetAudioBitRateLWhenRecording :
+                {
+                iAction = Knone;   
+                // Should leave
+                iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE  );
+                // If it has left yet, problem !
+                User::Leave(KErrCorrupt);
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetAudioEnabledLWhenRecording :
+                {
+                iAction = Knone;
+                iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );
+                CTimer::After( iTimeout );
+                break; 
+                }
+            case KSetMaxClipSizeLWhenRecording:
+                {
+                iAction = Knone;
+                iCamc->SetMaxClipSizeL( 10000 );
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetVideoTypeLWhenRecording:
+                {
+                iAction = Knone;
+                // Should leave
+                iCamc->SetVideoTypeL( TC2_VIDEO_TYPE  ); 
+                // If it has left yet, problem !
+                User::Leave(KErrCorrupt);
+                CTimer::After( iTimeout );
+                break;
+                }
+            case KSetAudioTypeLWhenRecording:
+                {
+                iAction = Knone;  
+                // Should leave
+                iCamc->SetAudioTypeL( TC2_AUDIO_TYPE ); 
+                // If it has left yet, problem !
+                User::Leave(KErrCorrupt); 
+                CTimer::After( iTimeout );
+                break;
+                }
+                
+            default:
+                {
+                iCamc->Stop();
+                // Simulates that iRecording has been completed through the 
+                // MvruoRecordComplete callback
+                iRecordingReady=ETrue;				
+                CTimer::After( 1000 );
+                break;
+                }
+            }
+        }
+    
+    
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+}
+
+
+
+void CCamcTestClient_2::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_2::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_2::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_2::MvruoRecordComplete( TInt aError )
+    {  
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2:Record Complete"));
+#endif
+
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_2::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_2::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient 2:SomethingInActiveObjectIsLeaving"));
+#endif
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_3.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_3.h"
+#include "camcTest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_3::CCamcTestClient_3 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_3::~CCamcTestClient_3 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_3* CCamcTestClient_3::NewL(TInt aCameraHandle)
+    {
+    CCamcTestClient_3* self = new(ELeave) CCamcTestClient_3;
+    CleanupStack::PushL(self);
+    self->ConstructL(aCameraHandle );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_3::ConstructL(TInt aCameraHandle)
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add( this );
+    Start_Active_ObjectL ( K_Tc3_none, aCameraHandle );
+    }
+
+
+void CCamcTestClient_3::Start_Active_ObjectL ( TestClient3Actions aAction, TInt aCameraHandle )
+    {
+    
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+    TRAPD(err,
+        iCamc->OpenFileL( file, camHandle, 
+        controllerUid,
+        formatUid,
+        //TFourCC( '2', '6', '3', 'B' ),
+        _L8("video/H263-2000"),
+        TFourCC(' ', 'A', 'M', 'R') ));
+    
+    if (err)
+        {
+        User::Leave(99);
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+
+void CCamcTestClient_3::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_3::RunLTrappedL()
+    { 
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+        
+        iCamc->Prepare();
+        }
+    else if ( iPrepareReady ) 
+        {
+        
+        iPrepareReady = EFalse;
+        iCamc->Record();
+        CTimer::After( iTimeout );
+        }
+    
+    else if ( iRecordingReady )
+        {
+        
+        iRecordingReady = EFalse;
+        iCamc->Close();
+        iClosed =  ETrue;
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        
+        iCamc->Stop();
+        // Simulates that iRecording has been completed through the 
+        // MvruoRecordComplete callback
+        iRecordingReady=ETrue;				
+        CTimer::After( 1000 );
+        
+        }
+    
+    
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    }
+
+
+
+void CCamcTestClient_3::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_3::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL();  // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_3::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_3::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_3::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_3::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_4.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,427 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_4.h"
+#include "camcTest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+const TInt KMaxVideoLength = 3600;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_4::CCamcTestClient_4 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_4::~CCamcTestClient_4 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_4* CCamcTestClient_4::NewL()
+    {
+    CCamcTestClient_4* self = new(ELeave) CCamcTestClient_4;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_4::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_4::Start_Active_ObjectL ( TestClient4Actions aAction, TInt aCameraHandle )
+    {
+    
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+    TRAPD(err,
+        iCamc->OpenFileL(file, camHandle, 
+        controllerUid,
+        formatUid,
+        //TFourCC( '2', '6', '3', 'B' ),
+        _L8("video/H263-2000"),
+        TFourCC(' ', 'A', 'M', 'R') ));
+    
+    if (err)
+        {
+        User::Leave(K4UnexpectedErr);
+        }
+    
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    // We continue here when the AO scheduler has been stopped.
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_4::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_4::RunLTrappedL()
+    {
+    
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    else
+        if ( iOpenReady ) 
+            {
+            iOpenReady = EFalse;
+            
+            // Set default parameters. They can be overwritten depending on the test case. 
+            iCamc->SetVideoFrameSizeL(TSize(176,144));
+            iCamc->SetVideoFrameRateL(TReal32(5));
+            iCamc->SetVideoBitRateL(TInt(TC4_VIDEO_BIT_RATE));
+            iCamc->SetAudioBitRateL(TInt(TC4_AUDIO_BIT_RATE));
+            iCamc->SetAudioEnabledL(ETrue); 
+            switch (iAction)
+                {
+                case K4RecordTimeAvailSizeLimit:
+                    {
+                    iCamc->SetMaxClipSizeL(TC4_FILE_SIZE_LIMIT) ; 
+                    break;
+                    }
+                case K4RecordTimeAvailNotRecordingSizeLimit:
+                    {
+                    iCamc->SetMaxClipSizeL(TC4_FILE_SIZE_LIMIT) ; 
+                    break;
+                    }
+                default:
+                    break;
+                }
+            
+            iCamc->Prepare();
+            }
+        else if ( iPrepareReady ) 
+            {    
+            switch (iAction)
+                {
+                case K4RecordTimeAvailNotRecordingSizeLimit:
+                    {
+                    // Compare if set size limit is correctly returned by 
+                    // a RecordTimeAvailableL      
+                    TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                    TInt timeRemainingInSec = (I64LOW (( TInt64 )(timeRemaining.Int64() /1E6)));
+                    
+                    // Value must be proportional to size limit
+                    TInt calculatedDuration = (TInt)
+                       ((float)TC4_FILE_SIZE_LIMIT) * 8 / (TC4_VIDEO_BIT_RATE+TC4_AUDIO_BIT_RATE);
+                    // Allows 5% error margin:
+                    if ( ( timeRemainingInSec > calculatedDuration*1.05 ) ||
+                        ( timeRemainingInSec < calculatedDuration*0.95 ) )
+                        {          
+                        User::Leave( K4ValueNotWithinRange ) ; 
+                        }          
+                    break;
+                    }
+                case K4RecordTimeAvailNotRecordingNoSizeLimit:
+                    {
+                    // Compare if default size limit is correctly returned by 
+                    // a RecordTimeAvailableL      
+                    TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                    TInt64 timeRemainingInSec = timeRemaining.Int64()/1E6;
+                    
+                    // Duration value depends on available disk drive space.
+                    // Get the free space of the disk drive:
+                    RFs fsSession;
+                    User::LeaveIfError(fsSession.Connect());
+                    TVolumeInfo volumeInfo;
+                    TInt err = fsSession.Volume(volumeInfo,EDriveC);
+                    fsSession.Close();
+                    if (err)
+                        {
+                        User::Leave( KErrGeneral) ;
+                        }
+                    // Possible duration = available disk space/videobitrate
+                    TInt64 calculatedDuration = volumeInfo.iFree / TInt64((TC4_VIDEO_BIT_RATE+TC4_AUDIO_BIT_RATE)/8);
+                    
+                    // If there is more space than the max length of the video -> 
+                    // set the calculatedDuration to max length
+                    if ( calculatedDuration > KMaxVideoLength) 
+                        {
+                        calculatedDuration = KMaxVideoLength;
+                        }
+                    
+                    RDebug::Print(_L("CCamcTest_4::RecordTimeAvailable4 timeRemaining is %d (Should be %d)"), timeRemainingInSec, calculatedDuration );
+                    // Allows 5% error margin:
+                    if ( ( timeRemainingInSec > calculatedDuration*1.05 ) ||
+                        ( timeRemainingInSec < calculatedDuration*0.95 ) )
+                        {          
+                        User::Leave( K4ValueNotWithinRange ) ; 
+                        }
+                    break;
+                    
+                    }
+                default:
+                    break;
+                }
+            iPrepareReady = EFalse;
+            
+            iCamc->Record();
+            
+            // Set a timer 
+            // Must be >10 sec to avoid the uncertainties of the bitrates 
+            // at the beginning of a new recording.
+            CTimer::After( (TInt) (20*1E6) );
+
+            }
+        
+        else if ( iRecordingReady )
+            {
+            
+            iRecordingReady = EFalse;
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After( 1500 ); // Give time to the AO to close, will callback RunL after.
+            
+            }
+        else if ( iPaused ) //resume
+            {
+            
+            iPaused = EFalse;
+            iCamc->Record();
+            }
+        else //timer
+            {
+            
+            TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+#ifdef _DEBUG
+            TBuf<128> str;
+            str.Format(_L("Time remaining %x %x"), I64HIGH(timeRemaining.Int64()),
+                I64LOW(timeRemaining.Int64()) );
+            RDebug::Print(str);   
+#endif
+
+            if ( iAction != K4RecordTimeAvailUntilDiskFull )
+                {
+                if (( iNumberOfTimeOut != 0) && (iOldTimeRemaining <= timeRemaining))
+                    {
+                   User::Leave(K4ValueNotDecreasingErr);
+                    }
+                }
+
+            iOldTimeRemaining = timeRemaining;
+            
+            iNumberOfTimeOut++;
+            
+            switch (iAction)
+                {
+                case K4RecordTimeAvailSizeLimit:
+                    {
+                    // Do nothing, stop callback should be called when
+                    // size limit is reached.
+                    CTimer::After( (TInt) 15E6 );     // Wait 15 sec	
+                    break;
+                    }
+                case K4RecordTimeAvailNoSizeLimit:
+                    {
+                    // After 50 timers calls, stop the test
+                    // It is normal behavior.
+                    if (iNumberOfTimeOut == 15)
+                        {
+                        iCamc->Close();
+                        iClosed = ETrue;
+                        }
+                    CTimer::After( (TInt) 15E6 );     // Wait 15 sec	
+                    break;
+                    }
+
+
+            case K4RecordTimeAvailUntilDiskFull:
+                {
+                //TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                iTimeRemainingInSec = timeRemaining.Int64()/1E6;
+                CTimer::After( (TInt) (1*1E6) );
+                break;
+                }
+
+            default:
+                    // Stop the recording
+                    iCamc->Close();
+                    iClosed = ETrue;
+                    CTimer::After( (TInt) 15E6 );     // Wait 15 sec	
+                }
+            }
+        
+        
+    }
+    
+    
+    
+    void CCamcTestClient_4::DoCancel()
+        {
+        iCamc->Stop();
+        iCamc->Close();
+        delete iCamc;
+        iCamc = NULL;
+        }
+    
+    
+    void CCamcTestClient_4::MvruoOpenComplete( TInt aError )
+        {
+        if (aError)
+            {        
+            SomethingInActiveObjectIsLeaving(aError);
+            }
+        else
+            {
+            iOpenReady = ETrue;
+            RunL(); // RunL is trapped, cannot actually leave.
+            }
+        }
+    
+    void CCamcTestClient_4::MvruoPrepareComplete( TInt aError )
+        {    
+        if (aError)
+            {
+            SomethingInActiveObjectIsLeaving(aError);
+            }
+        else
+            {
+            iPrepareReady = ETrue;
+            RunL(); // RunL is trapped, cannot actually leave.
+            }
+        }
+    
+    void CCamcTestClient_4::MvruoRecordComplete( TInt aError )
+        {
+    
+        switch (iAction)
+            {
+            case K4RecordTimeAvailUntilDiskFull:
+                {
+#ifdef _DEBUG
+                TBuf<128> str;
+                str.Format(_L("K4RecordTimeAvailUntilDiskFull : Disk Full ! %i"), iTimeRemainingInSec);
+                RDebug::Print(str);   
+#endif
+                // KErrCompletion if there is more space than needed for 60 min recording.
+                // Otherwise KErrDiskFull
+                if ( (aError !=  KErrDiskFull) || (aError != KErrCompletion ) )
+                    {
+                    User::Leave(K4ErrExpectingADifferentValue);
+                    }
+                if ( iTimeRemainingInSec > 5 ) 
+                    {
+                    User::Leave(K4ValueNotWithinRange);
+                    }
+                break;
+                }
+            }
+
+        if ( (aError) && (aError != KErrCompletion) )
+            {
+            SomethingInActiveObjectIsLeaving(aError);
+            }
+        else
+            {
+            iRecordingReady = ETrue;
+            
+            if ( !IsActive() )
+                {
+                RunL(); // RunL is trapped, cannot actually leave.
+                }
+            }
+        }
+    
+    void CCamcTestClient_4::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+        {
+        /* Should be never called ... */  
+        SomethingInActiveObjectIsLeaving(99);
+        }
+    
+    void CCamcTestClient_4::SomethingInActiveObjectIsLeaving (TInt aError)
+        {
+        // Something in the active object is leaving
+        // or a fatal error has been found.
+        
+        // Stop the active object scheduler.
+#ifdef _DEBUG
+            TBuf<128> str;
+            str.Format(_L("Something is leaving %i"), aError);
+            RDebug::Print(str);   
+#endif
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_5.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,862 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_5.h"
+#include "badesca.h"
+#include "camcTest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_5::CCamcTestClient_5 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_5::~CCamcTestClient_5 ()
+    {
+    Cancel();
+    delete iCamc;
+    delete iMMFMetaDataEntry;
+    }
+
+CCamcTestClient_5* CCamcTestClient_5::NewL()
+    {
+    CCamcTestClient_5* self = new(ELeave) CCamcTestClient_5;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_5::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iPrepare2ndTime = EFalse;
+    
+    // Construct the MetaDataEntry
+    iMMFMetaDataEntry = CMMFMetaDataEntry::NewL();
+
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_5::Start_Active_ObjectL ( TestClient5Actions aAction, TInt aCameraHandle )
+    {
+    
+    iUiLevelCameraHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+
+     if ( iAction == K_Tc5_StopWhenRecordingAfterOpenFileNew )
+        {
+        TFileName file;
+        AddDriveLetterToPath(_L("recordQCIF.3g2"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, 
+            iUiLevelCameraHandle, 
+            controllerUid,
+            formatUidG2,
+            _L8("video/mp4v-es"),
+            TC5_AUDIO_TYPE_1 ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else if ( iAction == K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4 )
+        {
+        TFileName file;
+        AddDriveLetterToPath(_L("recordQCIF.mp4"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, 
+            iUiLevelCameraHandle, 
+            controllerUid,
+            formatUidMP4,
+            _L8("video/mp4v-es; profile-level-id=3"),
+            TC5_AUDIO_TYPE_3 ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else
+        {       
+        TFileName file;
+        AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, 
+            iUiLevelCameraHandle, 
+            controllerUid,
+            formatUid,
+            _L8("video/H263-2000"),
+            TFourCC(' ', 'A', 'M', 'R') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_5::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,
+        RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_5::RunLTrappedL()
+    {
+    
+     if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        return;
+        }
+
+    if ( iOpenReady ) 
+
+        {
+
+        iOpenReady = EFalse;
+
+        switch (iAction)
+            {
+            case K_Tc5_GetPriorityWhenNotSet:
+                {
+                TInt priority;
+                TMdaPriorityPreference pref;
+                iCamc->GetPriorityL(priority, pref);
+                // Currently we always set priority to KAudioPriorityVideoRecording to avoid problems caused by keypad tones if keys pressed during testing
+                if (priority != KAudioPriorityVideoRecording || pref != EMdaPriorityPreferenceTimeAndQuality)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_VideoFrameRateWhenNotSet:
+                {
+                TReal32 aValue;
+                aValue = iCamc->VideoFrameRateL();
+                if (aValue != 15.0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+ 
+            case K_Tc5_VideoBitRateWhenNotSet:
+                {
+                TInt aBit;
+                aBit = iCamc->VideoBitRateL();
+                if (aBit != 64000)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+
+            case K_Tc5_AudioBitRateWhenNotSet:
+                {
+                TInt aAudioBit;
+                aAudioBit = iCamc->AudioBitRateL();
+                if (aAudioBit <= 0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+ 
+            case K_Tc5_AudioEnabledWhenNotSet:
+                {
+                
+                TBool aEnabled;
+                aEnabled = iCamc->AudioEnabledL();
+                // By default, audio are enabled.
+                if ( !aEnabled )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_GetVideoFrameSizeWhenNotSet:
+                {
+                TSize aFrame;
+                TSize expectedFrameSize(176,144);
+
+                 iCamc->GetVideoFrameSizeL(aFrame);
+                 if (aFrame != expectedFrameSize)
+                    {
+                    
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+            case K_Tc5_GainWhenNotSet:
+                {
+                TInt aGain;
+                aGain = iCamc->GainL();
+                if ((aGain < 0) || (aGain >= 100))
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+
+            default:
+                break;
+            }
+
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+
+        switch (iAction)
+            {
+           
+            case K_Tc5_NumberOfMetaDataEntriesWhenNotRecording:
+                {
+                TInt aValue;
+                aValue = iCamc->NumberOfMetaDataEntriesL();
+                // aValue should always be 0.
+                if (aValue != 0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_MetaDataEntryWhenNotRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->MetaDataEntryL( 2 );
+                // There is a problem if we haven't left already
+                User::Leave(KErrExpectingADifferentValue);
+                break;
+                }
+
+            case K_Tc5_AddMetaDataEntryWhenNotRecording:
+                {
+                // 
+                iCamc->AddMetaDataEntryL( *iMMFMetaDataEntry );      
+                break;
+                }
+
+            case K_Tc5_RemoveMetaDataEntryWhenNotRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->RemoveMetaDataEntryL( 2 );
+                break;
+                }
+
+            case K_Tc5_ReplaceMetaDataEntryWhenNotRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->ReplaceMetaDataEntryL( 2, *iMMFMetaDataEntry );
+                break;
+                }
+
+            case K_Tc5_SetPriorityWhenNotRecording:
+                {
+                // Set Invalid Priority.
+                iCamc->SetPriorityL( EMdaPriorityMin-100,EMdaPriorityPreferenceTime );
+                break;
+                }
+ 
+            case K_Tc5_SetVideoFrameRateWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetVideoFrameRateL( TReal32(TC5_VIDEO_FRAME_RATE_WRONG) );
+                break;
+                }
+
+            case K_Tc5_SetVideoBitRateWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetVideoBitRateL( TC5_VIDEO_BIT_RATE_WRONG );
+                break;
+                }
+
+            case K_Tc5_SetAudioBitRateWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetAudioBitRateL( TC5_AUDIO_BIT_RATE_WRONG );
+                break;
+                }
+
+            case K_Tc5_SetAudioEnabledWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetAudioEnabledL( TC5_AUDIO_ENABLED );
+                break; 
+                }
+
+            case K_Tc5_SetVideoFrameSizeWhenOpenNotPrepared:
+                {
+                // 
+                iCamc->SetVideoFrameSizeL( TC5_VIDEO_FRAME_SIZE_WRONG );
+                break;
+                }
+
+            case K_Tc5_SetMaxClipSizeLWhenNotRecording:
+                {
+                iCamc->SetMaxClipSizeL( -10 ); // A wrong value	              
+                break;
+                }
+
+            case K_Tc5_SetGainWhenNotRecording:
+                {
+                // 
+                iCamc->SetGainL( 1 );
+                break;
+                }
+
+            case K_Tc5_SetGainWhenNotRecordingAndSetWrong:
+                {
+                //
+                TInt aSetGain;
+                aSetGain = iCamc->MaxGainL();
+                RDebug::Print(_L("CCamcTest_5::SetGain2 MaxGain is %d "), aSetGain );
+                iCamc->SetGainL( aSetGain+1 );
+                break; 
+                }
+                
+            case K_Tc5_MaxGainWhenNotRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->MaxGainL();
+                RDebug::Print(_L("CCamcTest_5::MaxGain MaxGain is %d (Should be 0-100)"), aGain );
+                if ((aGain <= 0) || (aGain >= 100))
+                    {
+                    User::Leave(KErrExpectingADifferentValue);          
+                    }
+                break;
+                }
+
+            case K_Tc5_StopWhenNotRecording:
+                {
+                iCamc->Stop();
+                //iAction = K_Tc5_none;
+                break;
+                }
+            case K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4:
+                {
+                iCamc->SetVideoFrameSizeL( TC5_CIF_VIDEO_FRAME_SIZE );
+                break;
+                }
+
+            default:
+                break;
+            }
+
+        iCamc->Prepare();
+        }
+
+    else if ( iPrepareReady ) 
+
+        {      
+        TBool prepare = ETrue;
+        switch (iAction)
+            {
+            //Compare
+            case K_Tc5_SetAudioEnabledWhenOpenNotPrepared:
+                {
+                TInt aEnabled;
+                aEnabled = iCamc->AudioEnabledL();
+
+                TBool ok = TC5_AUDIO_ENABLED; // To avoid a warning.
+                if ( ( aEnabled && (!ok) ) || ( (!aEnabled) && ok ) ) 
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+
+                break;
+                }
+
+            //Compare
+            case K_Tc5_SetGainWhenNotRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->GainL();
+                RDebug::Print(_L("CCamcTest_5::SetGain1 Gain is %d (Should be 1)"), aGain );
+                // aSetGain should be the same with previously set 
+                if (aGain != 1)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+
+            case K_Tc5_StopWhenRecordingNewPrepareCorrect:
+                {
+                if ( iPrepare2ndTime )
+
+                    {
+                    // If we are here, the 2nd prepare was ready before the 
+                    // 2s timeout ---> Test passed
+                    iCamc->Stop();
+                    CActiveScheduler::Stop();
+                    prepare =EFalse;
+                    }
+                break;
+                }
+                
+            case K_Tc5_GetSupportedVideoTypesWhenOpenNotRecording:
+                {
+                CDesC8ArrayFlat * spprtVideoTypes = new (ELeave) CDesC8ArrayFlat (1);
+                CleanupStack::PushL(spprtVideoTypes);
+                iCamc->GetSupportedVideoTypesL( *spprtVideoTypes );
+                TInt index;
+                if (spprtVideoTypes->Count() < 2)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                if ( spprtVideoTypes->Find(_L8("video/H263-2000"), index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtVideoTypes->Find(_L8("video/H263-2000; profile=0") ,index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                CleanupStack::PopAndDestroy();
+                break;                
+                }
+                
+            case K_Tc5_GetSupportedVideoTypesWhenOpenNotRecordingNew:
+                {
+                CDesC8ArrayFlat * spprtVideoTypes = new (ELeave) CDesC8ArrayFlat (1);
+                CleanupStack::PushL(spprtVideoTypes);
+                iCamc->GetSupportedVideoTypesL( *spprtVideoTypes );
+                TInt index;
+                if (spprtVideoTypes->Count() < 4)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                if ( spprtVideoTypes->Find(_L8("video/H263-2000"), index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtVideoTypes->Find(_L8("video/H263-2000; profile=0") ,index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+
+                if ( spprtVideoTypes->Find(_L8("video/mp4v-es"), index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtVideoTypes->Find(_L8("video/mp4v-es; profile-level-id=8") ,index ) == KErrNotFound )
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                CleanupStack::PopAndDestroy();
+                break;
+                }
+            case K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAMR:
+                {
+                RArray<TFourCC> spprtAudioTypes;
+                spprtAudioTypes.Reset();
+                iCamc->GetSupportedAudioTypesL( spprtAudioTypes );
+                if (spprtAudioTypes.Count() != 1)
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                
+                if (spprtAudioTypes.Find(TC5_AUDIO_TYPE_1) == KErrNotFound )
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                spprtAudioTypes.Close();
+                break;                
+                }
+            case K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAAC:
+                {
+                RArray<TFourCC> spprtAudioTypes;
+                spprtAudioTypes.Reset();
+                iCamc->GetSupportedAudioTypesL( spprtAudioTypes );
+                if (spprtAudioTypes.Count() != 2)
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }         
+                if ( spprtAudioTypes.Find( TC5_AUDIO_TYPE_1 ) == KErrNotFound )
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                
+                if (spprtAudioTypes.Find( TC5_AUDIO_TYPE_3 ) == KErrNotFound )
+                    {
+                    spprtAudioTypes.Close();
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                spprtAudioTypes.Close();
+                break;                
+                }
+                
+            default:
+                break;
+            }
+        if (prepare)
+            {
+            iPrepareReady = EFalse;
+            iCamc->Record();
+            CTimer::After( iTimeout );
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+        switch (iAction)
+            {
+            
+            //Compare
+            case K_Tc5_SetGainWhenRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->GainL();
+                RDebug::Print(_L("CCamcTest_5::SetGain3 Gain is %d (Should be 1)"), aGain );
+                if (aGain != 1)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+            
+            default:
+                break;
+            }
+        iRecordingReady = EFalse;
+        iCamc->Close();
+        iClosed =1;
+        CTimer::After( 1000 );
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        iPaused = EFalse;
+        iCamc->Record();
+        CTimer::After(10 * TInt32 ( 1E6 ) ); // Continue recording for 10 seconds
+                                             // Then stop the recording
+        }
+    else //timer
+        {
+        TBool stopRecording = ETrue;
+
+        switch (iAction)
+            {
+            case K_Tc5_NumberOfMetaDataEntriesWhenRecording:
+                {
+                TInt aValue;
+                aValue = iCamc->NumberOfMetaDataEntriesL();
+                // aValue should always be 0.
+                if (aValue != 0)
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                break;
+                }
+
+            case K_Tc5_MetaDataEntryWhenRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->MetaDataEntryL( 2 );  
+                // There is a problem if we haven't left already
+                User::Leave(KErrExpectingADifferentValue);       
+                break;
+                }
+
+            case K_Tc5_AddMetaDataEntryWhenRecording:
+                {
+                // 
+                iCamc->AddMetaDataEntryL( *iMMFMetaDataEntry );             
+                break;
+                }
+
+            case K_Tc5_RemoveMetaDataEntryWhenRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->RemoveMetaDataEntryL( 2 );
+                break;
+                }
+
+            case K_Tc5_ReplaceMetaDataEntryWhenRecording:
+                {
+                // Index 2 dosen't exist, should leave
+                iCamc->ReplaceMetaDataEntryL( 2, *iMMFMetaDataEntry );
+                break;
+                }
+
+            case K_Tc5_PauseWhenRecording:
+                {
+                iCamc->PauseL();
+                stopRecording = EFalse;
+                iAction=K_Tc5_none;     
+                CTimer::After(2 * TInt32 ( 1E6 ) ); // Pause for 2 seconds.
+                iPaused=ETrue;
+                break;
+                }
+
+            case K_Tc5_SetGainWhenRecording:
+                {
+                // 
+                iCamc->SetGainL( 1 );
+                break; 
+                }
+
+            case K_Tc5_MaxGainWhenRecording:
+                {
+                TInt aGain;
+                aGain = iCamc->MaxGainL();
+                if ((aGain <= 0) || (aGain >= 100))
+                    {
+                    User::Leave(KErrExpectingADifferentValue);
+                    
+                    }
+                break;
+                }
+                
+            case K_Tc5_StopWhenRecording:
+                {
+                //iCamc->Stop();
+                stopRecording = ETrue;
+                //iAction = K_Tc5_none;
+                break;
+                }
+
+            case K_Tc5_StopWhenRecordingNewPrepareCorrect:
+                {
+                if ( iPrepare2ndTime )
+                    {
+                    // If we are here, the 2nd prepare was NOT ready before the 
+                    // 2s timeout ---> Test failed
+                    User::Leave(KErrExpectingADifferentValue);
+                    }
+                stopRecording = ETrue;
+                break;
+                }
+
+            case K_Tc5_StopWhenRecordingAfterOpenFile:
+                {
+                //iCamc->Stop();
+                stopRecording = ETrue;
+                //iAction = K_Tc5_none;
+                break;
+                }
+            case K_Tc5_StopWhenRecordingAfterOpenFileNew:
+            case K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4:
+                {
+                //iCamc->Stop();
+                stopRecording = ETrue;
+                //iAction = K_Tc5_none;
+                break;
+                }
+            default:
+                break;
+            }
+        if (stopRecording)
+            {
+            
+            iCamc->Stop();
+            // Simulates that iRecording has been completed through the 
+            // MvruoRecordComplete callback
+            iRecordingReady=ETrue;
+            
+            switch (iAction)
+                {
+                case K_Tc5_StopWhenRecordingNewPrepareCorrect:
+                    {
+                    iCamc->Close();
+                    TUid controllerUid = {0x101F8503};	//implementation uid
+                    TUid formatUid = {0};
+                    TRAPD(err,iCamc->OpenFileL( _L("c:\\recordQCIF_2.3gp"), 
+                        iUiLevelCameraHandle, 
+                        controllerUid,
+                        formatUid ));
+
+                    CTimer::After(2 * TInt32 ( 1E6 ) ); // Wait 2 seconds
+                    iPrepare2ndTime = ETrue;
+                    break;
+                    }
+                    
+                default:
+                    {
+                    CTimer::After( 1000 );
+                    break;
+                    }
+                }
+            }    
+        
+        switch (iAction)
+            {
+            case K_Tc5_PauseWhenStopped:
+                {
+                iCamc->PauseL();
+                break;
+                }
+            default:
+                break;
+            }
+        }
+
+    }
+
+
+
+void CCamcTestClient_5::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+
+void CCamcTestClient_5::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_5::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_5::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_5::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_5::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_6.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1390 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_6.h"
+#include "badesca.h"
+#include "camcTest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_6::CCamcTestClient_6 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_6::~CCamcTestClient_6 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_6* CCamcTestClient_6::NewL()
+    {
+    CCamcTestClient_6* self = new(ELeave) CCamcTestClient_6;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_6::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iResumeRecording = EFalse;
+    
+       CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_6::Start_Active_ObjectL ( TestClient6Actions aAction, TInt aCameraHandle )
+    {
+    
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    
+    switch ( iAction )
+        {
+        case K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+        case K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+        case K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+        case K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, camHandle, 
+                controllerUid,
+                formatUid ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            break;    
+            }
+            
+        case K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording :
+            {
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, camHandle, 
+                controllerUid,
+                formatUid,
+                _L8("") ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }
+            break;   
+            }
+            
+        default:
+            {
+            switch ( iAction )
+                {
+                case K_Tc6_ControllerImplementationInformationWhenNotOpen:
+                    {
+                    iCamc->ControllerImplementationInformationL();
+                    // Test case should have left already.    
+                    
+                    // There is a problem if we haven't left already
+                    User::Leave(KErrCorrupt);
+                    break;
+                    }
+                case K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat:
+                    {
+                    TFileName file;
+                    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+                    TRAPD(err,
+                        iCamc->OpenFileL( file, camHandle, 
+                        controllerUid,
+                        formatUid,
+                        _L8("video/mp4v-es"),
+                        TFourCC(' ', 'A', 'M', 'R') ));
+                    
+                    if (err)
+                        {
+                        User::Leave(99);
+                        }
+                    break;
+                    }
+                case K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4:
+                case K_Tc6_SetVideoTypeLWithProfile3:
+                    {
+                    TFileName file;
+                    AddDriveLetterToPath(_L("recordQCIF.mp4"),file);
+                    TRAPD(err,
+                        iCamc->OpenFileL( file, camHandle, 
+                        controllerUid,
+                        formatUid,
+                        _L8("video/mp4v-es; profile-level-id=3"),
+                        TFourCC(' ', 'A', 'M', 'R') ));
+                    
+                    if (err)
+                        {
+                        User::Leave(99);
+                        }
+                    break;
+                    }
+
+                default:
+                    {
+                    TFileName file;
+                    AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+                    TRAPD(err,
+                        iCamc->OpenFileL( file, camHandle, 
+                        controllerUid,
+                        formatUid,
+                        _L8("video/H263-2000"),
+                        TFourCC(' ', 'A', 'M', 'R') ));
+                    
+                    if (err)
+                        {
+                        User::Leave(99);
+                        }
+                    break;
+                    }
+                }
+/*            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"),file);
+            TRAPD(err,
+                iCamc->OpenFileL( file, camHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            
+            if (err)
+                {
+                User::Leave(99);
+                }*/
+            }
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_6::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_6::RunLTrappedL()
+    {
+    
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(EFalse); 
+        
+        TBool prepare = ETrue;
+        switch ( iAction )
+            {
+            case K_Tc6_SetAudioEnabledLWhenControllerReady :
+                {
+                iCamc->SetAudioEnabledL( ETrue );	
+                break;
+                }
+            case K_Tc6_SetMaxClipSizeLWhenControllerReady :
+                {
+                // -55 is invalide size
+                iCamc->SetMaxClipSizeL( -55 );	
+                
+                // Should have left already
+                // Don't go on, to prevent a panic
+                User::Leave(K_Tc6_ErrExpectingToLeave);
+                break;
+                }                
+            case K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecording :   
+                {
+                
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }
+            case K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat :   
+                {
+                
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW] = TC6_VIDEO_TYPES_ARRAY_NEW ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }
+            case K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+            case K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording :
+                {
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }
+                
+            case K_Tc6_AudioTypeLWhenOpenWithfourCCAndNotRecording :
+            case K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+                {
+                TFourCC expectedAudioType = TFourCC( ' ', 'A', 'M', 'R' );
+                TFourCC returnedAudioType = iCamc->AudioTypeL(  );
+                if (expectedAudioType != returnedAudioType)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                break;
+                }                           
+            case K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording:
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE );
+                break;
+                }                
+            case K_Tc6_SetVideoTypeLWhenNotRecording :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_WRONG );
+                break;
+                }               
+            case K_Tc6_SetVideoTypeLWithProfile :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_PROFILE0 );
+                break;
+                }         
+            case K_Tc6_SetVideoTypeLWithProfile8 :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_PROFILE8 );
+
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW] = TC6_VIDEO_TYPES_ARRAY_NEW ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                
+                break;
+                }         
+            case K_Tc6_SetVideoTypeLWithProfile3 :
+                {
+                iCamc->SetVideoTypeL( TC6_VIDEO_TYPE_PROFILE3 );
+
+                TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                TBool found = 0;
+                TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW] = TC6_VIDEO_TYPES_ARRAY_NEW ;
+                for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH_NEW ; i++)
+                    {
+                    if (expectedVideoType[i] == returnedVideoType)
+                        {
+                        found = 1;
+                        }
+                    }
+                if (!found)
+                    {
+                    User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                    }
+                
+                // set CIF size since level = 3
+                iCamc->SetVideoFrameSizeL( TC6_CIF_VIDEO_FRAME_SIZE );
+
+                break;
+                }         
+            case K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+                {
+                iCamc->SetAudioTypeL( TC6_AUDIO_TYPE );
+                break;
+                }       
+            case K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC :
+                {
+                iCamc->SetAudioTypeL( TC6_AAC_AUDIO_TYPE );
+                break;
+                }            
+            case K_Tc6_SetAudioTypeLWhenNotRecording :
+                {
+                iCamc->SetAudioTypeL( TC6_AUDIO_TYPE_WRONG );
+                break;
+                }
+            case K_Tc6_ControllerImplementationInformationWhenOpen:
+                { 
+                const CMMFControllerImplementationInformation & returnedResult = iCamc->ControllerImplementationInformationL();
+                CheckControllerImplementationInformationL ( returnedResult ); 
+                break;
+                }
+            case K_Tc6_ControllerImplementationInformationWhenOpenNew:
+                { 
+                const CMMFControllerImplementationInformation & returnedResult = iCamc->ControllerImplementationInformationL();
+                CheckControllerImplementationInformationNewL ( returnedResult ); 
+                break;
+                }
+            case K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4:
+                { 
+                const CMMFControllerImplementationInformation & returnedResult = iCamc->ControllerImplementationInformationL();
+                CheckControllerImplementationInformationNewMPEG4L ( returnedResult ); 
+
+                // set CIF size since level = 3
+                iCamc->SetVideoFrameSizeL( TC6_CIF_VIDEO_FRAME_SIZE );
+
+                break;
+                }
+            case K_Tc6_DurationWhenRecording:
+                {
+                // Use a more realistic frame rate
+                // The duration test is quite affected by AO scheduling.
+                iCamc->SetVideoFrameRateL(TReal32(5));
+#if ( defined ( __WINS__ ) || defined ( __WINSCW__) )
+                // Give some help to the wins case.
+                iCamc->SetAudioEnabledL(EFalse); 
+#endif
+                break;
+                }
+
+            default:
+                break;
+            }
+            if ( prepare )           
+                {
+                iCamc->Prepare();
+                }
+        }
+        else if ( iPrepareReady ) 
+            {    
+            switch (iAction)
+                {
+                case K_Tc6_SetAudioEnabledLWhenControllerReady :
+                    {
+                    //Compare
+                    TBool aAudioEnabled;
+                    aAudioEnabled = iCamc->AudioEnabledL();
+                    //aSetAudioEnable should be the same with previously set
+                    if (!aAudioEnabled )
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }
+                case K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording :
+                    //Compare
+                    {
+                    TPtrC8 returnedSetVideoType = iCamc->VideoFormatMimeType();
+                    TBool found = 0;
+                    TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                    for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                        {
+                        if (expectedVideoType[i] == returnedSetVideoType)
+                            {
+                            found = 1;
+                            }
+                        }
+                    if (!found)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    
+                    break;
+                    }                
+                case K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording :
+                    //Compare
+                    {
+                    TFourCC returnedSetAudioType;
+                    returnedSetAudioType = iCamc->AudioTypeL( );
+                    if (returnedSetAudioType != TC6_AUDIO_TYPE)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }               
+                case K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC :
+                    //Compare
+                    {
+                    TFourCC returnedSetAudioType;
+                    returnedSetAudioType = iCamc->AudioTypeL( );
+                    if (returnedSetAudioType != TC6_AAC_AUDIO_TYPE)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }
+                case K_Tc6_DurationWhenNotRecording:
+                    {
+                    TTimeIntervalMicroSeconds aValue = iCamc->DurationL();
+                    TTimeIntervalMicroSeconds expected (0);
+                    //aValue should always be 0. 
+                    if (aValue != expected)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    break;
+                    }
+                default:
+                    break;
+                }
+            
+            switch (iAction)
+                {   
+                case K_Tc6_SetMaxClipSizeLWhenPrepareReady :
+                    {
+                    iCamc->SetMaxClipSizeL( TC6_FILE_SIZE_LIMIT );	
+                    iAction = K_Tc6_none;
+                    iCamc->Prepare();
+                    break;
+                    }
+                case K_Tc6_RecordWhenPrepareComplete:
+                    {
+                    iPrepareReady = EFalse;
+                    iCamc->Record();
+                    break;
+                    }
+                case K_Tc6_DurationWhenPaused:
+                    {
+                    iPrepareReady = EFalse;
+                    iCamc->Record();
+                    CTimer::After(5 * TInt32 ( 1E6 ) ); // Record for 5 seconds.
+                    break;
+                    }
+                default:
+                    {
+                    iPrepareReady = EFalse;
+                    iCamc->Record();
+                    if (iSavedAction != K_Tc6_SetMaxClipSizeLWhenPrepareReady)
+                        {
+                        CTimer::After( iTimeout );
+                        }
+                    }
+                }
+        }
+        
+        else if ( iRecordingReady )
+            {
+            switch (iAction)
+                {
+                case K_Tc6_PauseWhenStopped:
+                    {
+                    iCamc->PauseL();
+                    iAction = K_Tc6_none;
+                    break;
+                    }
+                default:   
+                    iRecordingReady = EFalse;                    
+                    iCamc->Close();
+                    iClosed = ETrue;
+                }
+            CTimer::After( 1000 );        
+            }
+        
+        else if ( iPaused ) //resume
+            {
+            switch (iAction)
+                {
+                case K_Tc6_SetVideoFrameSizeLWhenPaused:
+                    {
+                    iCamc->SetVideoFrameSizeL( TC6_VIDEO_FRAME_SIZE );
+                    break;
+                    }
+                case K_Tc6_RecordWhenPaused:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    iPaused = EFalse;
+                    iAction = K_Tc6_none;         
+                    break;
+                    }
+                case K_Tc6_DurationWhenPaused:
+                    {
+                    iNumberOfTimeAsked++;
+                    TTimeIntervalMicroSeconds timeDuration = iCamc->DurationL();                   
+                    if (( iNumberOfTimeAsked != 0) && (iOldDuration > timeDuration))
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    
+                    if (iNumberOfTimeAsked <3)
+                        {
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );
+                        }
+                    else
+                        {
+                        iPaused = EFalse;
+                        iCamc->Record();
+                        iResumeRecording = ETrue;
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );  
+                        }
+                    iOldDuration = timeDuration;
+                    break;
+                    }
+                default:
+                    iPaused = EFalse;
+                    iCamc->Record();
+                }
+            }
+        
+        else //timer
+            {
+            switch (iAction)
+                {
+                case K_Tc6_SetVideoFrameSizeLWhenPaused:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_Tc6_RecordWhenPaused:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_Tc6_VideoTypeLWhenOpenWithMimeAndRecording :
+                    {
+                    TPtrC8 returnedVideoType = iCamc->VideoFormatMimeType();
+                    TBool found = 0;
+                    TPtrC8 expectedVideoType[TC6_VIDEO_TYPES_ARRAY_LENGTH] = TC6_VIDEO_TYPES_ARRAY ;
+                    for (TInt i=0; i<TC6_VIDEO_TYPES_ARRAY_LENGTH ; i++)
+                        {
+                        if (expectedVideoType[i] == returnedVideoType)
+                            {
+                            found = 1;
+                            }
+                        }
+                    if (!found)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    
+                    
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    iAction = K_Tc6_none; 
+                    break;
+                    }               
+                case K_Tc6_AudioTypeLWhenOpenWithfourCCAndRecording :
+                    {
+                    TFourCC expectedAudioType = TFourCC( ' ', 'A', 'M', 'R' );
+                    TFourCC returnedAudioType = iCamc->AudioTypeL(  );
+                    if (expectedAudioType != returnedAudioType)
+                        {
+                        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+                        }
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    iAction = K_Tc6_none; 
+                    break;
+                    }
+                case K_Tc6_DurationWhenRecording:
+                    {
+                    TTimeIntervalMicroSeconds timeDuration = iCamc->DurationL();                   
+#ifdef _DEBUG
+                    TBuf<128> str;
+                    str.Format(_L("Asking for time duration %i:%i"), I64HIGH(timeDuration.Int64()),
+                        I64LOW(timeDuration.Int64()));
+                    RDebug::Print(str);    
+#endif
+                    if (( iNumberOfTimeOut != 0) && (iOldTimeDuration > timeDuration))
+                        {
+                        RDebug::Print(_L("Leaving because not increasing"));
+                        User::Leave(K_Tc6_ValueNotIncreasingErr);
+                        }
+                    
+                    TInt64 expected_duration;
+                    TTime time;
+                    time.UniversalTime(); // Get the real elapsed time
+                    
+                    if (iNumberOfTimeOut == 0)
+                        {
+                        // First wait period is 1.5 seconds.
+                        // The AO are quite inaccurate, especially at the beginning
+                        // We don't check the first run.
+                        }
+                    else
+                        {
+                        // Next wait period are 1 seconds
+                        // But are not accurate, because of low AO priority.
+                        TInt64 delta_time  = time.Int64() - iPreviousTime ;
+                        expected_duration = iOldTimeDuration.Int64() + delta_time;
+                        
+                        TTimeIntervalMicroSeconds kTimeLimit( expected_duration );
+                       
+                        TTimeIntervalMicroSeconds kTimeMargin( 300000 ); //0.3 second
+                        
+                        if ( ( timeDuration > kTimeLimit.Int64() + kTimeMargin.Int64() ) ||
+                            ( timeDuration < kTimeLimit.Int64() - kTimeMargin.Int64() ) ) 
+                            {     
+                            RDebug::Print(_L("Leaving because not within margins"));
+                            TBuf<128> aBuf;
+                            aBuf.Format(_L("Actually elapsed time since last call: %i \nexpected duration: %i:%i "),
+                                I64LOW(delta_time),I64HIGH(expected_duration),
+                                I64LOW(expected_duration));
+                            RDebug::Print(aBuf);
+                            User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+                            }
+                        }
+                    
+                    
+                    iPreviousTime = time.Int64();
+                    iOldTimeDuration = timeDuration;
+                    
+                    
+                    if (iNumberOfTimeOut >20)
+                        {
+                        iCamc->Stop();
+                        // Simulates that iRecording has been completed through the 
+                        // MvruoRecordComplete callback
+                        iRecordingReady=ETrue;				
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );
+                        }
+                    else
+                        {
+                        // Wait  a second and ask for the duration again.
+                        CTimer::After( 1 * TInt32 ( 1E6 ) ); /* a second */
+                        }
+                    iNumberOfTimeOut++;
+                    break;
+                    }
+                case K_Tc6_DurationWhenPaused:
+                    {
+                    if (iResumeRecording)
+                        {
+                        TTimeIntervalMicroSeconds timeDuration = iCamc->DurationL();                   
+                        #ifdef _DEBUG
+                        TBuf<128> str;
+                        str.Format(_L("Time duration %x:%i"), I64HIGH(timeDuration.Int64()),
+                            I64LOW(timeDuration.Int64()));
+                        RDebug::Print(str);    
+                        #endif
+
+                        TInt64 delta_time = 1E6;
+                       
+                        TInt64 expected_duration = iOldDuration.Int64() + delta_time;
+                        
+                        TTimeIntervalMicroSeconds kTimeLimit( expected_duration );
+                       
+                        TTimeIntervalMicroSeconds kTimeMargin( 300000 ); //0.3 second
+                        
+                        if ( ( timeDuration > kTimeLimit.Int64() + kTimeMargin.Int64() ) ||
+                           ( timeDuration < kTimeLimit.Int64() - kTimeMargin.Int64() ) ) 
+                            { 
+                            User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+                            }            
+                        
+                        iAction = K_Tc6_none; 
+                        iCamc->Stop();
+                        iRecordingReady=ETrue;				
+                        CTimer::After( 1 * TInt32 ( 1E6 ) );
+                        }
+                    else
+                        {
+                        iCamc->PauseL();
+                        iRecordingReady = EFalse;
+                        CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause for 5 seconds.
+                        iPaused=ETrue;
+                        iResumeRecording = EFalse;
+                        }
+                    break;
+                    }
+                default:
+                    iCamc->Stop();
+                    // Simulates that iRecording has been completed through the 
+                    // MvruoRecordComplete callback
+                    iRecordingReady=ETrue;				
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+            }
+        }
+        
+        if ( iClosed )
+            {
+            iCamc->Stop();
+            CActiveScheduler::Stop();
+            }
+        
+    }
+    
+void CCamcTestClient_6::CheckControllerImplementationInformationL(const CMMFControllerImplementationInformation & aReturnedResult )
+    {
+    // Check if returned controller implementation information correspond
+    // to what we expect
+    
+    
+    // Check for the supported play formats:
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.PlayFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    // Video recorder doesn't support any Play formats.
+    if ( nbItems != 0 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    // Check for the supported Recorded Formats
+        
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.RecordFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    if ( nbItems !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    TBuf<100> name;
+    // Format name
+    name = formatArray[0]->DisplayName();
+    if ((name != _L("3GPP File Format")))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format UID
+    name = formatArray[0]->Uid().Name();
+    if (name != _L("[101f8504]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format Supplier   
+    name = formatArray[0]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    //Format Version
+    if (formatArray[0]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    // Supported Medias UID by the Format
+    {
+        
+    const RArray<TUid> & supportedUids = formatArray[0]->SupportedMediaIds();
+    // Only one format UID is currently supported
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    
+    //Supported Files extensions
+    {
+    const CDesC8Array & names =
+        formatArray[0]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3gp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    //Supported Mime types
+    {
+    const CDesC8Array & names =
+        formatArray[0]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }   
+    }
+}
+    
+   
+void CCamcTestClient_6::CheckControllerImplementationInformationNewL(const CMMFControllerImplementationInformation & aReturnedResult )
+    {
+    // Check if returned controller implementation information correspond
+    // to what we expect
+    
+    
+    // Check for the supported play formats:
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.PlayFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    // Video recorder doesn't support any Play formats.
+    if ( nbItems != 0 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    // Check for the supported Recorded Formats
+        
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.RecordFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    if ( nbItems !=2 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    TBuf<100> name;
+    // Format name
+    name = formatArray[0]->DisplayName();
+    if ((name != _L("3GPP File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->DisplayName();
+    if ((name != _L("3GPP2 File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format UID
+    name = formatArray[0]->Uid().Name();
+    if (name != _L("[101f8504]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = formatArray[1]->Uid().Name();
+//    if (name != _L("[101F86D6]"))
+//        {
+//        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+//        }
+    
+    //Format Supplier   
+    name = formatArray[0]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    //Format Version
+    if (formatArray[0]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    if (formatArray[1]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+ 
+    
+    // Supported Medias UID by the Format
+    {        
+    const RArray<TUid> & supportedUids = formatArray[0]->SupportedMediaIds();
+    // 3gpp
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    {
+    const RArray<TUid> & supportedUids = formatArray[1]->SupportedMediaIds();
+    // 3gpp2
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    
+
+    //Supported Files extensions
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3gp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3g2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+
+    
+    //Supported Mime types
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }  
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }  
+
+    }
+}
+    
+   
+void CCamcTestClient_6::CheckControllerImplementationInformationNewMPEG4L(const CMMFControllerImplementationInformation & aReturnedResult )
+    {
+    // Check if returned controller implementation information correspond
+    // to what we expect
+    
+    
+    // Check for the supported play formats:
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.PlayFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    // Video recorder doesn't support any Play formats.
+    if ( nbItems != 0 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    }
+    // Check for the supported Recorded Formats
+        
+    {
+    const RMMFFormatImplInfoArray& formatArray = aReturnedResult.RecordFormats();
+    TInt nbItems;
+    nbItems = formatArray.Count();
+    
+    if ( nbItems !=3 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    TBuf<100> name;
+    // Format name
+    name = formatArray[0]->DisplayName();
+    if ((name != _L("3GPP File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->DisplayName();
+    if ((name != _L("3GPP2 File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+ 
+    name = formatArray[2]->DisplayName();
+    if ((name != _L("MPEG-4 File Format"))) 
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    //Format UID
+    name = formatArray[0]->Uid().Name();
+    if (name != _L("[101f8504]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = formatArray[1]->Uid().Name();
+    name = formatArray[2]->Uid().Name();
+//    if (name != _L("[101F86D6]"))
+//        {
+//        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+//        }
+    
+    //Format Supplier   
+    name = formatArray[0]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    name = formatArray[1]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    name = formatArray[2]->Supplier();              
+    if (name != _L("Nokia"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    //Format Version
+    if (formatArray[0]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+
+    if (formatArray[1]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+ 
+    if (formatArray[2]->Version() != 0)           
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    
+    // Supported Medias UID by the Format
+    {        
+    const RArray<TUid> & supportedUids = formatArray[0]->SupportedMediaIds();
+    // 3gpp
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    {
+    const RArray<TUid> & supportedUids = formatArray[1]->SupportedMediaIds();
+    // 3gpp2
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    {
+    const RArray<TUid> & supportedUids = formatArray[2]->SupportedMediaIds();
+    // mp4
+    if (supportedUids.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    name = supportedUids[0].Name();
+    if (name != _L("[101f5d08]"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }
+    
+
+    //Supported Files extensions
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3gp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".3g2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+    {
+    // mp4
+    const CDesC8Array & names =
+        formatArray[2]->SupportedFileExtensions();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8(".mp4"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }
+
+    
+    //Supported Mime types
+    {
+    // 3gpp
+    const CDesC8Array & names =
+        formatArray[0]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    }  
+    {
+    // 3gpp2
+    const CDesC8Array & names =
+        formatArray[1]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/3gpp2"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }  
+    {
+    // mp4
+    const CDesC8Array & names =
+        formatArray[2]->SupportedMimeTypes();
+    if (names.Count() != 1)
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }
+    if (names[0] != _L8("video/mp4"))
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue); 
+        }    
+    }  
+
+    }
+}
+
+void CCamcTestClient_6::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+void CCamcTestClient_6::MvruoOpenComplete( TInt aError )
+    {
+    
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_6::MvruoPrepareComplete( TInt aError )
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_6::MvruoRecordComplete( TInt aError )
+    {
+    
+    if (iAction == K_Tc6_RecordWhenPrepareComplete )
+        {
+        if ( (aError ==  KErrDiskFull) || (aError == KErrCompletion ) ) 
+            {
+            // KErrCompletion if there is more space than needed for 60 min recording.
+            // Otherwise KErrDiskFull
+            aError = KErrNone;
+            }
+        else
+            {
+            aError = KErrGeneral;
+            }
+        }
+    
+    if ( ( aError ) && ( aError != KErrCompletion ) )
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_6::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_6::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+    
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_7.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,588 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_7.h"
+#include "camcTest.h"
+#include <AudioPreference.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_7::CCamcTestClient_7 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_7::~CCamcTestClient_7 ()
+    {
+    Cancel();
+    
+    delete iWaitScheduler;
+    delete iCamc;   
+    iCamc = NULL;
+    delete iCamera;
+    iCamera= NULL;
+    delete iCamera2;
+    iCamera2= NULL;
+    }
+
+CCamcTestClient_7* CCamcTestClient_7::NewL()
+    {
+    CCamcTestClient_7* self = new(ELeave) CCamcTestClient_7;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_7::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    // It takes some time to free the camera.
+    // Wait that it is free.
+    TInt err;
+    do
+        {
+        // Create a new Camera API implementation object, if supported
+        TRAP( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+        if ( err == KErrNotSupported )
+            {
+            PRINT( ( _L( "CCamcTestClient_7::ConstructL() CCamera::New2L return code=%d" ), err ) ); 
+
+            // Create old Camera API implementation object.
+            TRAP( err, iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ ) );
+            }
+        else if ( !err )
+            {
+            PRINT( ( _L( "CCamcTestClient_7::ConstructL() using new MCameraObserver2" )) ); 
+            }
+        }
+        while (err != KErrNone);
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_7::Start_Active_ObjectL ( TestClient_7_Actions aAction )
+    {
+    
+    // This reserve the camera, starts the active object.
+
+    iAction = aAction;    //iAction might be set to NULL after action has been executed
+    //	iTimeout = aTimeout;
+    iTimeout = (TInt) 1E6; /* 1 Second */
+    
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+    // Reserve the Camera.
+    iCamera->Reserve();
+	iWaitScheduler->Start();
+    
+    RDebug::Print(_L("CamcTest_7::Start_Active_ObjectL PowerOn Completed starting CActiveScheduler") );
+    CActiveScheduler::Start();
+    
+
+    // The Active Scheduler has finished.
+    // Any Errors?
+
+    if (iError)
+        {
+        RDebug::Print(_L("CamcTest_7::Start_Active_ObjectL leaves with %d"), iError);
+        User::Leave(iError);
+        }
+    }
+
+
+void CCamcTestClient_7::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        RDebug::Print(_L("CamcTest_7::RunTrappedL leaves with %d"), err);
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_7::RunLTrappedL()
+    {
+    if ( iOpenReady ) 
+        {
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+
+        RDebug::Print(_L("iCamc->Prepare1"));
+        iCamc->Prepare();
+        }
+    else if ( iPrepareReady ) 
+        {
+        RDebug::Print(_L("iCamc->Record1"));
+        iPrepareReady = EFalse;
+        iCamc->Record();
+        CTimer::After( iTimeout );
+        }
+    
+    else if ( iRecordingReady )
+        {
+        RDebug::Print(_L("CamcTest_7::RunTrapped iRecordingReady") );
+        iRecordingReady = EFalse;
+        
+        iClosed=1;
+        
+        }
+    else if ( iPaused ) //resume
+        {
+        RDebug::Print(_L("iCamc->Record1"));
+        iPaused = EFalse;
+        iCamc->Record();
+        
+        }
+    else //timer
+        {
+        
+        switch(iAction)
+            {
+            case K_Tc7_ReleaseCameraWhileRecording:
+                {
+                // We are now recording
+                iCamera->Release();
+                iAction = K_Tc7_none;
+                CTimer::After( (TInt) 10E6 );
+                break;
+                }
+            case K_Tc7_PowerOffCameraWhileRecording:
+                {
+                // We are now recording
+                RDebug::Print(_L("Powering off the camera"));
+                iCamera->PowerOff();
+                iAction = K_Tc7_none;  
+                CTimer::After( (TInt) 20E6 );
+                break;
+                }
+            case K_Tc7_ReleaseCameraCloseRecorderUseCamera:
+                {
+                // We are now recording
+                switch(iCameraReleasedState)
+                    {       
+                    case ENothingReleased:
+                        {
+                        iCamera->Release();
+                        CTimer::After( (TInt) 1E6 );
+                        iCameraReleasedState = ECameraReleased;
+                        break;    
+                        }
+                    case ECameraReleased:
+                        {
+                        iCamc->Close();   
+                        CTimer::After( (TInt) 1E6 );
+                        iCameraReleasedState = ECamcStopped;
+                        break;                   
+                        }
+                    case ECamcStopped:
+                        {
+                        // Try to use the camera   
+                        // Create a new Camera API implementation object, if supported
+                        TRAPD( err, iCamera2 = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+                        if ( err )
+                            {
+                            PRINT( ( _L( "CCamcTestClient_7::RunLTrappedL() CCamera::New2L return code=%d" ), err ) ); 
+
+                            // Create old Camera API implementation object.
+                            iCamera2 = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+                            }
+                        else 
+                            {
+                            PRINT( ( _L( "CCamcTestClient_7::RunLTrappedL() using new MCameraObserver2" )) ); 
+                            }
+                        iCamera2->Reserve();
+                        iAction = K_Tc7_none;
+                        break;
+                        }
+                    default:
+                        break;
+                    }
+                break;
+                }
+
+            default:
+                {
+                RDebug::Print(_L("CamcTest_7::RunTrappedL default"));
+                iCamc->Close();
+                // Simulates that iRecording has been completed through the 
+                // MvruoRecordComplete callback
+                iRecordingReady=ETrue;	
+                iCamera->Release();
+                CTimer::After( (TInt) 1E6 );
+                }
+            }
+        
+
+        
+        }
+    
+    
+    if ( iClosed )
+        {
+        RDebug::Print(_L("CamcTest_7::RunTrappedL iClosed"));
+        iCamc->Close();
+        CActiveScheduler::Stop();
+        }
+    }
+
+
+
+void CCamcTestClient_7::DoCancel()
+    {
+    RDebug::Print(_L("CamcTest_7::DoCancel") );
+    iCamc->Stop();
+    iCamc->Close();
+    //delete iCamc;
+    //iCamc = NULL;
+    }
+
+////////////////////////////////////////////////////////
+// MVideoRecorderUtilityObserver Callback functions
+
+void CCamcTestClient_7::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {
+        RDebug::Print(_L("CamcTest_7::MvruoOpenComplete leaves with %d"), aError );        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_7::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         RDebug::Print(_L("CamcTest_7::MvruoPrepareComplete leaves with %d"), aError );
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_7::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         RDebug::Print(_L("CamcTest_7::MvruoRecordComplete leaves with %d"), aError );
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_7::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+
+////////////////////////////////////////////////////////
+// MCameraObserver Callback functions
+
+
+void CCamcTestClient_7::ReserveComplete(TInt aError)
+    {
+
+    // The Camera is now reserved for us.
+
+    if (aError)
+        {
+            SomethingInActiveObjectIsLeaving(aError);  
+        }
+
+    if (iCamera2 && iWaitScheduler->IsStarted())
+        {
+        iCamera2->PowerOn();
+        }
+    else if (iCamera && iWaitScheduler->IsStarted())
+        {
+        iCamera->PowerOn();
+        }
+    
+    }
+
+void CCamcTestClient_7::PowerOnComplete(TInt aError)
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	}  
+    	     
+    // If no errors, continue tests.
+    switch(iAction)
+        {
+        case K_Tc7_ReleaseCameraWhileRecording:
+        case K_Tc7_PowerOffCameraWhileRecording: 
+        case K_Tc7_ReleaseCameraCloseRecorderUseCamera:
+            {
+              
+            RDebug::Print(_L("CamcTest_7::case1 OpenFileL in"));
+            // Start the Camcorder.
+            TUid controllerUid = {TC7_CONTROLLER_UID};	
+            TUid formatUid = {TC7_VIDEO_FORMAT_UID};
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err, iCamc->OpenFileL(
+                file,	                     	// File
+                iCamera->Handle(),				//CameraHandle
+                controllerUid,					//Controller UID
+                formatUid						//Format UID
+                ));
+
+            if (err)
+                {
+                RDebug::Print(_L("CamcTest_7::case1 OpenFileL leaves with %d"), err); //FIXME
+                SomethingInActiveObjectIsLeaving(err);
+                }
+            RDebug::Print(_L("CamcTest_7::case1 OpenFileL out"));
+            break;
+            }
+        case K_Tc7_OpenFileWhenCameraIsNotAvailable:
+            {  
+           
+            // Start the Camcorder.
+            TUid controllerUid = {TC7_CONTROLLER_UID};	
+            TUid formatUid = {TC7_VIDEO_FORMAT_UID};
+   
+            RDebug::Print(_L("CamcTest_7::case2 OpenFileL in"));
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err, iCamc->OpenFileL(
+                file,	
+                0,			    // CameraHandle = 0 ==> Get a valid camera
+                                // There shouldn't be any left.
+                controllerUid,					
+                formatUid						
+                ));
+
+            if (err)
+                {
+                RDebug::Print(_L("CamcTest_7::case2 OpenFileL leaves with %d"), err); //FIXME
+                SomethingInActiveObjectIsLeaving(err);
+                }
+            RDebug::Print(_L("CamcTest_7::case2 OpenFileL out"));
+            break;
+            }
+        case K_Tc7_OpenFileWithVideoFormatNULL :
+            {
+            // Start the Camcorder.
+            TUid controllerUid = {TC7_CONTROLLER_UID};	
+   
+            TFileName file;
+            AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+            TRAPD(err, iCamc->OpenFileL(
+                file,	
+                 iCamera->Handle(),			 
+                controllerUid,					
+                KNullUid	  // VideoFormat NULL					
+                ));
+
+            if (err)
+                {
+                    SomethingInActiveObjectIsLeaving(err);
+                }
+
+            break;
+            }
+        default:
+            CTimer::After( (TInt) 1E6 );   
+        }
+        
+        
+    }
+void CCamcTestClient_7::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {    
+
+    // do nothing Here
+    }
+void CCamcTestClient_7::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt aError)
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+
+    // If no errors, do nothing
+    }
+void CCamcTestClient_7::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt aError )
+    {
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    
+    // If no errors, do nothing
+    }
+
+
+void CCamcTestClient_7::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTestClient_7::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTestClient_7::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTestClient_7::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTestClient_7::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTestClient_7::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTestClient_7::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTestClient_7::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTestClient_7::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTestClient_7::VideoBufferReady() returning" )));
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_8.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,498 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_8.h"
+#include <e32def.h>
+#include <AudioPreference.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+CCamcTestClient_8::CCamcTestClient_8 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_8::~CCamcTestClient_8 ()
+    {
+    Cancel();
+
+    delete iCamc;   
+    }
+
+CCamcTestClient_8* CCamcTestClient_8::NewL(const TDesC &aFileName, TInt *aError ,
+                                           TInt * aNumberOfOpenedCamc, TInt aCameraHandle )
+    {
+    CCamcTestClient_8* self = new(ELeave) CCamcTestClient_8;
+    CleanupStack::PushL(self);
+    self->ConstructL( aFileName, aError , aNumberOfOpenedCamc, aCameraHandle );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_8::ConstructL( const TDesC &aFileName , TInt *aError ,
+                                   TInt * aNumberOfOpenedCamc, TInt aCameraHandle )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iError = aError;
+
+    // Start the Camcorder.
+    TUid controllerUid = {TC8_CONTROLLER_UID};	
+    TUid formatUid = {TC8_VIDEO_FORMAT_UID};
+    iFileName = aFileName;
+    iNumberOfOpenedCamc = aNumberOfOpenedCamc;
+    // Register to the number of openCam
+    (*aNumberOfOpenedCamc)++; 
+
+    iCamc->OpenFileL(
+        aFileName,		                //File
+        aCameraHandle,				     //CameraHandle
+        controllerUid,					//Controller UID
+        formatUid						//Format UID
+        );
+
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_8::Start_Active_Object ( TestClient_8_Actions aAction,
+                                            CCamcTestClient_8 * aClient )
+    {
+    
+    // This reserve the camera, starts the active object.
+
+    iAction = aAction;    //iAction might be set to NULL after action has been executed
+    //	iTimeout = aTimeout;
+    iTimeout = (TInt) 1E6; /* 1 Second */
+
+    iOtherClient = aClient;
+
+    }
+
+
+void CCamcTestClient_8::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err )
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_8::RunLTrappedL()
+    {
+    TBool closeNow = EFalse;
+    TBuf<128> str;
+    str = iFileName;
+    if ( iOpenReady ) 
+        {         
+#ifdef _DEBUG
+        str.Append(_L(": Opened"));
+        RDebug::Print(str); 
+#endif
+        iOpenReady = EFalse;
+        
+        // Set default parameters. They can be overwritten depending on the test case. 
+        iCamc->SetVideoFrameSizeL(TSize(176,144));
+        iCamc->SetVideoFrameRateL(TReal32(15));
+        iCamc->SetVideoBitRateL(TInt(50000));
+        iCamc->SetAudioEnabledL(ETrue); 
+
+        switch (iAction)
+            {  
+            case K_Tc8_MultipleInstance002_AO2:
+                {
+                // Wait that the instance 1 is in prepared state.
+                WaitForOtherObject();
+                break;
+                }
+            case K_Tc8_MultipleInstance004_AO2:
+                {
+                // Wait that the instance 1 is recording
+                WaitForOtherObject();
+                break;
+                }
+            case K_Tc8_MultipleInstance005_AO2:
+                {
+                // Wait that the instance 1 has finished recording
+                WaitForOtherObject();
+                break;          
+                }
+            case K_Tc8_MultipleInstance006_AO2:
+                {
+                // Wait that the instance 1 is in paused state
+                WaitForOtherObject();
+                break;
+                }
+            default:
+                {
+                iCamc->Prepare();   
+                break;
+                }
+            }
+        }
+    else if ( iPrepareReady ) 
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Prepared"));
+        RDebug::Print(str); 
+#endif
+        iPrepareReady = EFalse;
+
+        switch (iAction)
+             {
+            case K_Tc8_MultipleInstance001_AO1:   
+            case K_Tc8_MultipleInstance002_AO1: 
+            case K_Tc8_MultipleInstance003_AO1:
+                {
+                // Wait forever in that state.
+                ReachedWaitingState();
+                break;           
+                }
+            case K_Tc8_MultipleInstance001_AO2:
+                {
+                // If both instance are prepared, test is passed.
+                WaitForOtherObject();
+                break;
+                }
+            default:
+                {
+                // Start recording
+                iCamc->Record();
+                CTimer::After( 5 * TInt(1E6) );
+                }
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Recording Ready"));
+        RDebug::Print(str); 
+#endif
+        iRecordingReady = EFalse;
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance005_AO1:  
+                {
+                if (!iRecordingReadyTimer)
+                    {
+                    RDebug::Print(_L("CamcTest_8::Multiple5 iRecordingReady in"));
+                    // It takes some time to free the camera.
+                    // Give 10 seconds 
+                      iRecordingReady = ETrue;  
+                      iRecordingReadyTimer = ETrue;
+                      CTimer::After ( 10 * TInt (1E6) );
+                    }
+                else
+                    {
+                    RDebug::Print(_L("CamcTest_8::Multiple5 ReachedWaitingState in"));
+                    // Wait forever
+                    ReachedWaitingState();   
+                    }
+                break; 
+                }
+            default:
+                break;
+            }
+        }
+    else if ( iPaused ) //resume
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Paused"));
+        RDebug::Print(str); 
+#endif
+        iPaused = EFalse;
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance006_AO1:
+                {
+                // Wait forever in that state.
+                ReachedWaitingState();
+                break;     
+                }
+            default:
+                {
+                iCamc->Record();
+                break;
+                }
+            }
+        }
+    else if (  iEmittedRequest )
+        {       
+#ifdef _DEBUG
+        str.Append(_L(": Waiting is over"));
+        RDebug::Print(str); 
+#endif
+        // The request has been fulfilled
+        iEmittedRequest = EFalse;
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance002_AO2:
+                {
+                // Instance 1 has reached the prepared state.
+                // Close both.
+                iOtherClient->Close();
+                closeNow = ETrue;
+                break;          
+                }
+            case K_Tc8_MultipleInstance004_AO2:
+                {
+                // Instance 1 is now recording.
+                // Prepare the 2nd camcorder.
+                iCamc->Prepare();
+                break;
+                }
+            case K_Tc8_MultipleInstance005_AO2:
+                {
+                // Instance 1 has finished recording.
+                // Prepare the 2nd camcorder.
+                RDebug::Print(_L("CamcTest_8::Multiple5 iCamc->Prepare in"));
+
+                iCamc->Prepare();
+                break;       
+                }
+            case K_Tc8_MultipleInstance006_AO2:
+                {
+                // Instance 1 is now paused.
+                // Prepare the 2nd camcorder.
+                iCamc->Prepare();
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(0,User::Panic(_L("Test Client"),1));
+                break;
+                }
+                
+            }
+        }
+    else if ( iClosed )
+        {           
+#ifdef _DEBUG
+        str.Append(_L(": Closed"));
+        RDebug::Print(str); 
+#endif
+        (*iNumberOfOpenedCamc)--;
+        if (*iNumberOfOpenedCamc == 0)
+            {
+            // Everything is closed, we can stop the active scheduler    
+            CActiveScheduler::Stop();
+            }
+        }
+    else //timer
+        {
+#ifdef _DEBUG
+        str.Append(_L(": Recording"));
+        RDebug::Print(str); 
+#endif
+        switch (iAction)
+            {
+            case K_Tc8_MultipleInstance004_AO1:
+                // Wait forever in that state.
+                {
+                ReachedWaitingState();
+                break;     
+                }
+            case K_Tc8_MultipleInstance006_AO1:
+                {
+                iCamc->PauseL();
+                iPaused = ETrue;
+                CTimer::After( (TInt) 1E6 ); // Pause for 1 sec.
+                break;
+                }
+            default:
+                {
+                iCamc->Stop();
+                iRecordingReady = ETrue;
+                CTimer::After( (TInt) 1E6 );
+                }
+            }
+        }
+    
+    
+    if (closeNow)
+        {
+        iCamc->Close();
+        CTimer::After( (TInt) 1E6 );
+        iClosed = ETrue;
+        }
+    
+    }
+
+
+
+void CCamcTestClient_8::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+////////////////////////////////////////////////////////
+// MVideoRecorderUtilityObserver Callback functions
+
+void CCamcTestClient_8::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_8::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_8::MvruoRecordComplete( TInt aError )
+    {
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_8::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+
+void CCamcTestClient_8::Close()
+    {
+    // We are requested by an other object to close.
+        iCamc->Close();
+        CTimer::After( (TInt) 1E6 );
+        iClosed = ETrue;
+    }
+
+
+void CCamcTestClient_8::ReachedWaitingState()
+    {
+    // We have reach a state were we wait for the other object to generate a 
+    // TellMeWhenYourInCorrectState request.
+
+    iReachedWaitingState = ETrue;
+    if (iRequestPending)
+        {
+        // Serve the request
+       // TRequestStatus* status = &iReceivedRequest;
+        User::RequestComplete(iReceivedRequest, KErrNone);
+        }
+
+    }
+
+
+void CCamcTestClient_8::WaitForOtherObject()
+    {
+    // One object (the client) generates a request to the other object
+    iOtherClient->TellMeWhenYouAreInCorrectState(iStatus);
+    SetActive();
+    if (iStatus != KRequestPending)
+        {
+        // If the client was already in correct state, we complete the request ourselves.
+        TRequestStatus * aReq = &iStatus;
+        User::RequestComplete(aReq, KErrNone);
+        }
+    iEmittedRequest = ETrue;
+    }
+
+void CCamcTestClient_8::TellMeWhenYouAreInCorrectState(TRequestStatus &aRequest)
+    {
+    if (iReachedWaitingState)
+        {
+        // Already waiting !
+        aRequest = 0; // Something else then KRequestPending.
+        iRequestPending = EFalse;
+        }
+    else
+        {
+        aRequest = KRequestPending;    
+        iRequestPending = ETrue;        
+        }
+    iReceivedRequest= &aRequest;
+    }
+
+
+void CCamcTestClient_8::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        *iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+    
+    
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_9.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,673 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_9.h"
+#include "CamCControllerCustomCommands.h"
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include <mmf/server/mmffile.h>
+#include <AudioPreference.h>
+#include "camcTest.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+const TInt KMaxVideoLength = 3600;
+
+// MACROS
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTestClient_9::CCamcTestClient_9 () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_9::~CCamcTestClient_9 ()
+    {
+    Cancel();
+    delete iCamc;
+    }
+
+CCamcTestClient_9* CCamcTestClient_9::NewL()
+    {
+    CCamcTestClient_9* self = new(ELeave) CCamcTestClient_9;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_9::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    iNewFileName = EFalse;
+    iRecord2ndTime = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_9::Start_Active_ObjectL ( TestClient9Actions aAction, TInt aCameraHandle )
+    {
+    
+    TFileName file;
+    TInt camHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    iSavedAction = aAction;             //SavedAction will never be changed.
+    //	iTimeout = aTimeout;
+    iTimeout = 1500000;
+    
+    if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat )
+        {
+        AddDriveLetterToPath(_L("recordQCIF.3g2"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUidG2,
+            _L8("video/H263-2000"),
+            TFourCC(' ', 'A', 'M', 'R') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat )
+        {
+        AddDriveLetterToPath(_L("recordQCIF.mp4"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUidMP4,
+            _L8("video/mp4v-es; profile-level-id=3"),
+            TFourCC(' ', 'A', 'A', 'C') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    else
+        {       
+        AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
+        
+        TRAPD(err,
+            iCamc->OpenFileL( file, camHandle, 
+            controllerUid,
+            formatUid,
+            _L8("video/H263-2000"),
+            TFourCC(' ', 'A', 'M', 'R') ));
+        
+        if (err)
+            {
+            User::Leave(99);
+            }
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+
+void CCamcTestClient_9::RunL()
+    {
+    
+    // Trap RunL, to catch if the AO leaves.
+    // A Walkaround...
+    // RunError() should be used in this case, but
+    // Apparently, it is not possible to use the AO RunError() virtual function
+    // for that purpose, it is not called.
+    
+    TRAPD( err,RunLTrappedL() );
+    if ( err ) 
+        {
+        SomethingInActiveObjectIsLeaving(err);
+        }
+    }
+
+void CCamcTestClient_9::RunLTrappedL()
+    {
+    if ( iOpenReady )  
+        { 
+        iOpenReady = EFalse;
+        switch ( iAction )
+            {
+            case K_Tc9_PrepareWhenControllerReadyWhitoutSetting:
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting:
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting:
+                {
+                break;
+                }
+            case K_TC9_NewFileNameWhenInternalStop:
+                {
+                iCamc->SetMaxClipSizeL(TC9_FILE_SIZE_LIMIT) ; 
+                break;
+                }
+            case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat:
+                {
+                iCamc->SetVideoFrameSizeL(TSize(352,288));
+                iCamc->SetVideoFrameRateL(TReal32(15));
+                iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE );
+                iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE_AAC ));
+                break;
+                }
+            default:
+                {
+                // Set default parameters. They can be overwritten depending on the test case. 
+                iCamc->SetVideoFrameSizeL(TSize(176,144));
+                iCamc->SetVideoFrameRateL(TReal32(15));
+                iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE );
+                iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE ));
+                break;
+                }
+
+            }
+        
+        switch ( iAction )
+            {
+            case  K_Tc9_PrepareWhenControllerReadyWhitoutSetting:
+                {
+                break;
+                }
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting:
+                {
+                iCamc->SetVideoBitRateL(TInt(50000));
+                break;
+                }
+            case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting:
+                {
+                iCamc->SetVideoFrameSizeL(TSize(176,144));
+                break;
+                }
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0:
+                {
+                iCamc->SetMaxClipSizeL( 0 );
+                break;
+                }
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize:
+                {
+                iCamc->SetMaxClipSizeL( KMMFNoMaxClipSize );
+                break;
+                }
+            case K_Tc9_OpenFileInAFolderNonExistent:
+                {               
+                AddDriveLetterToPath(_L("non-existent-folder\\recordQCIF.3gp"), iFileName);
+                TMMFFileParams params;
+                params.iPath = iFileName;
+                TPckgC<TMMFFileParams> pckg(params);
+                    
+                TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                if (ret != 0)
+                    {
+                    User::Leave(K_Tc9_ValueNotExpected);
+                    }
+                iAction = K_Tc9_none;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        iCamc->Prepare();
+            
+        }
+    else if ( iPrepareReady ) 
+        {
+        TBool record = EFalse;
+        switch ( iAction )
+            {
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0:
+            case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize:
+                {
+                iPrepareReady = EFalse;
+                iCamc->Record();
+                record = EFalse;
+                break;
+                }
+            case K_TC9_NewFileNameWhenPreparedNotRecording:
+                {
+                if (!iNewFileName)
+                    {
+                    AddDriveLetterToPath(_L("NewFileName.3gp"),iFileName);
+                    
+                    TMMFFileParams params;
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;
+                }
+            case K_TC9_NewFileNameWhenInternalStop :
+                {
+                iPrepareReady = EFalse;
+                iCamc->Record(); // No timer need, will eventually stop because of filesize limit.
+                break;
+                }
+            
+            default:
+                {
+                record = ETrue;
+                break;
+                }
+            }
+        if ( record )
+            {
+            iPrepareReady = EFalse;
+            iCamc->Record();
+            CTimer::After( iTimeout );
+            }
+        }
+    
+    else if ( iRecordingReady )
+        {
+        TBool close = EFalse;
+        iRecordingReady = EFalse;
+
+        TMMFFileParams params;
+        switch ( iAction )
+            {
+            case K_Tc9_RecordTimeAvailWhenRecordingReady:
+                {
+                // Compare if default size limit is correctly returned by 
+                // a RecordTimeAvailableL      
+                TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
+                TInt64 timeRemainingInSec = timeRemaining.Int64()/1E6; //Max time is 3600s = 60min
+                
+                PRINT((_L("CCamCTest_9::RecordTimeAvailable5: timeRemainingInSec: %d "), I64INT(timeRemainingInSec  )));
+                
+                
+                
+                // Duration value depends on available disk drive space.
+                // Get the free space of the disk drive:
+
+                RFs fsSession;
+                fsSession.Connect();
+                TVolumeInfo volumeInfo;
+                TInt err = fsSession.Volume(volumeInfo,EDriveC);
+                fsSession.Close();
+                if (err)
+                    {
+                    User::Leave( KErrGeneral) ;
+                    }
+
+                // Possible duration = available disk space/videobitrate
+                TInt64 calculatedDuration = volumeInfo.iFree / TInt64((TC9_VIDEO_BIT_RATE+TC9_AUDIO_BIT_RATE)/8);
+                
+                // If there is more space than the max length of the video -> 
+                // set the calculatedDuration to max length
+                if ( calculatedDuration > KMaxVideoLength) 
+                    {
+                    calculatedDuration = KMaxVideoLength;
+                    }
+                
+                RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 timeRemaining is %d "), I64INT(timeRemainingInSec ));
+                RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 calculatedDuration is %d "), I64INT(calculatedDuration ) );
+                // Allows 5% error margin:
+                if ( ( timeRemainingInSec > calculatedDuration*1.05 ) ||
+                    ( timeRemainingInSec < calculatedDuration*0.95 ) )
+                    {
+                    RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 is leaving, because timeRemaining != Calculated ") );          
+                    User::Leave( K_Tc9_ValueNotWithinRange ) ; 
+                    }
+                close = ETrue;
+                break;
+                }
+                
+            case K_TC9_NewFileNameWhenRecordSecondTime : 
+                {
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+                    
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;          
+                }
+
+            case K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat : 
+                {
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.3g2"), iFileName );
+                    
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;          
+                }
+
+            case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat : 
+                {
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.mp4"), iFileName );
+                    
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+                    iCamc->Prepare();
+                    iAction = K_Tc9_none;
+                    }
+                break;          
+                }
+
+            case K_TC9_NewFileNameWhenInternalStop : 
+                {             
+                if (!iRecord2ndTime)
+                    {
+                    iRecord2ndTime =ETrue;
+                    AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+
+                    params.iPath = iFileName;
+                    TPckgC<TMMFFileParams> pckg(params);
+                    
+                    TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                    TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                    if (ret != 0)
+                        {
+                        User::Leave(K_Tc9_ValueNotExpected);
+                        }
+
+                    iCamc->Prepare();
+                    }
+                else
+                    {
+                    close = ETrue;
+                    }
+                break;
+
+                }               
+            default:
+                {
+                close = ETrue;
+                break;
+                }
+            }
+        if (close)
+            {
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After( 1000 );
+            }
+        }
+
+    else 
+        {
+          RunLContinuedL();
+        }
+        
+    if ( iClosed )
+        {
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+        }
+    }
+
+void CCamcTestClient_9::RunLContinuedL()
+// This function exist to skip a MS VC6 bug/feature
+// Without this, VC6 would complains about stack abuse. 
+    {
+        if ( iPaused ) //resume
+        {
+        switch ( iAction )
+            {
+            case K_TC9_NewFileNameWhenPaused : 
+                {
+                    
+                AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+                    
+                iAction=K_Tc9_none;     
+                
+                TMMFFileParams params;
+                params.iPath = iFileName;
+                TPckgC<TMMFFileParams> pckg(params);
+                
+                TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                if (err)
+                    {
+                    User::Leave(err);
+                    }
+                break;
+                }
+            default:   
+                iPaused = EFalse;
+                iCamc->Record();
+            }
+        }
+    
+    else //timer
+        {
+        switch ( iAction )
+            {
+            case K_TC9_NewFileNameWhenRecording : 
+                {
+                AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
+                
+                TMMFFileParams params;
+                params.iPath = iFileName;
+                TPckgC<TMMFFileParams> pckg(params);
+                
+                TUid controllerUid = {0x101F8503};	// controller implementation interface uid
+                TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
+                if (err)
+                    {
+                    User::Leave(err);
+                    }
+                break;
+                }            
+            case K_TC9_NewFileNameWhenPaused:
+                {
+                iCamc->PauseL();
+                CTimer::After(2 * TInt32 ( 1E6 ) ); // Pause for 2 seconds.
+                iPaused=ETrue;
+                break;
+                }
+            default:
+                iCamc->Stop();        // Simulates that iRecording has been completed through the 
+                // MvruoRecordComplete callback
+                iRecordingReady=ETrue;				
+                CTimer::After( 1000 );
+            }       
+        }
+    
+    
+    }
+
+
+
+void CCamcTestClient_9::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+
+void CCamcTestClient_9::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL();
+        }
+    }
+
+void CCamcTestClient_9::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL();
+        }
+    }
+
+void CCamcTestClient_9::MvruoRecordComplete( TInt aError )
+    {
+    switch( iAction)
+        {
+        case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0 :
+        case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize :
+            {
+            if ( (aError ==  KErrDiskFull) || (aError == KErrCompletion ) )
+                {
+                // KErrCompletion if there is more space than needed for 60 min recording.
+                // Otherwise KErrDiskFull
+                aError = KErrNone;
+                }
+            else
+                {
+                aError = KErrGeneral;
+                }
+            break;
+            }
+        case K_TC9_NewFileNameWhenInternalStop :
+            {
+            if (aError == KErrCompletion)
+                {
+                // That's expected case.
+                aError = KErrNone;
+                }
+            else
+                {
+                aError = KErrGeneral;
+                }
+            break;
+            }
+        }
+
+    if (aError)
+        {
+         SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL();
+        }
+    }
+
+void CCamcTestClient_9::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_9::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+
+    // Stop the active object scheduler.
+        iError=aError;
+        iCamc->Stop();
+        CActiveScheduler::Stop();
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_visualcheck.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,911 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_visualcheck.h"
+#include <AudioPreference.h>
+
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_visualcheck::CCamcTestClient_visualcheck () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_visualcheck::~CCamcTestClient_visualcheck ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    Cancel();
+    delete iCamc;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    }
+
+CCamcTestClient_visualcheck* CCamcTestClient_visualcheck::NewL()
+    {
+    CCamcTestClient_visualcheck* self = new(ELeave) CCamcTestClient_visualcheck;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_visualcheck::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    i2ndTime = EFalse;
+    iDoublePause = EFalse;
+    iStartRecording2ndTime = EFalse;
+   
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_visualcheck::Start_Active_ObjectL ( TestClientVCActions aAction )
+    {
+    
+    TInt camHandle = 0;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    TBuf<50> fileName;
+    
+#if ( defined (__WINS__) || defined (__WINSCW__) )
+    _LIT(KFileName101,"c:\\recordQCIF_101.3gp");
+    _LIT(KFileName102,"c:\\recordQCIF_102.3gp");
+    _LIT(KFileName103,"c:\\recordQCIF_103.3gp");
+    _LIT(KFileName104,"c:\\recordQCIF_104.3gp");
+    _LIT(KFileName105,"c:\\recordQCIF_105.3gp");
+    _LIT(KFileName106,"c:\\recordQCIF_106.3gp");
+    _LIT(KFileName107,"c:\\recordQCIF_107.3gp");
+    _LIT(KFileName108_a,"c:\\recordQCIF_108_a.3gp");
+    _LIT(KFileName108_b,"c:\\recordQCIF_108_b.3gp");
+    _LIT(KFileName109,"c:\\recordQCIF_109.3gp");
+    _LIT(KFileName110,"c:\\recordQCIF_110.3gp");
+    _LIT(KFileName111,"c:\\recordQCIF_111.3gp");
+    _LIT(KFileName112,"c:\\recordQCIF_112.3gp");
+    _LIT(KFileName113,"c:\\recordQCIF_113.3gp");
+    _LIT(KFileName114,"c:\\recordQCIF_114.3gp");
+    _LIT(KFileName115,"c:\\recordQCIF_115.3gp");
+    _LIT(KFileName116,"c:\\recordQCIF_116.3gp");
+    _LIT(KFileName117,"c:\\recordQCIF_117.3g2");
+    _LIT(KFileName118,"c:\\recordQCIF_118.3g2");
+    _LIT(KFileName119,"c:\\recordQCIF_119.3gp");
+    _LIT(KFileName120,"c:\\recordQCIF_120.3g2");
+    _LIT(KFileName121,"c:\\recordQCIF_121.mp4");
+#else 
+    _LIT(KFileName101,"E:\\recordQCIF_101.3gp");
+    _LIT(KFileName102,"E:\\recordQCIF_102.3gp");
+    _LIT(KFileName103,"E:\\recordQCIF_103.3gp");
+    _LIT(KFileName104,"E:\\recordQCIF_104.3gp");
+    _LIT(KFileName105,"E:\\recordQCIF_105.3gp");
+    _LIT(KFileName106,"E:\\recordQCIF_106.3gp");
+    _LIT(KFileName107,"E:\\recordQCIF_107.3gp");
+    _LIT(KFileName108_a,"E:\\recordQCIF_108_a.3gp");
+    _LIT(KFileName108_b,"E:\\recordQCIF_108_b.3gp");
+    _LIT(KFileName109,"E:\\recordQCIF_109.3gp");
+    _LIT(KFileName110,"E:\\recordQCIF_110.3gp");
+    _LIT(KFileName111,"E:\\recordQCIF_111.3gp");
+    _LIT(KFileName112,"E:\\recordQCIF_112.3gp");
+    _LIT(KFileName113,"E:\\recordQCIF_113.3gp");
+    _LIT(KFileName114,"E:\\recordQCIF_114.3gp");
+    _LIT(KFileName115,"C:\\recordQCIF_115.3gp");
+    _LIT(KFileName116,"E:\\recordQCIF_116.3gp");
+    _LIT(KFileName117,"E:\\recordQCIF_117.3g2");
+    _LIT(KFileName118,"E:\\recordQCIF_118.3g2");
+    _LIT(KFileName119,"E:\\recordQCIF_119.3gp");
+    _LIT(KFileName120,"E:\\recordQCIF_120.3g2");
+    _LIT(KFileName121,"E:\\recordQCIF_121.mp4");
+#endif
+    switch(iAction)
+        {
+        case K_VC_test_case_101:
+            {
+            fileName = KFileName101;
+            break;
+            }
+        case K_VC_test_case_102:
+            {
+            fileName = KFileName102;
+            break;
+            }
+        case K_VC_test_case_103:
+            {
+            fileName = KFileName103;
+            break;
+            }
+        case K_VC_test_case_104:
+            {
+            fileName = KFileName104;
+            break;
+            }
+        case K_VC_test_case_105:
+            {
+            fileName = KFileName105;
+            break;
+            }
+        case K_VC_test_case_106:
+            {
+            fileName = KFileName106;
+            break;
+            }
+        case K_VC_test_case_107:
+            {
+            fileName = KFileName107;
+            break;
+            }
+        case K_VC_test_case_108_a:
+            {
+            fileName = KFileName108_a;
+            break;
+            }
+        case K_VC_test_case_108_b:
+            {
+            fileName = KFileName108_b;
+            break;
+            }
+        case K_VC_test_case_109:
+            {
+            fileName = KFileName109;
+            break;
+            }
+        case K_VC_test_case_110:
+            {
+            fileName = KFileName110;
+            break;
+            }
+        case K_VC_test_case_111:
+            {
+            fileName = KFileName111;
+            break;
+            }
+        case K_VC_test_case_112:
+            {
+            fileName = KFileName112;
+            break;
+            }
+        case K_VC_test_case_113:
+            {
+            fileName = KFileName113;
+            break;
+            }
+        case K_VC_test_case_114:
+            {
+            fileName = KFileName114;
+            break;
+            }
+        case K_VC_test_case_115:
+            {
+            fileName = KFileName115;
+            break;
+            }
+        case K_VC_test_case_116:
+            {
+            fileName = KFileName116;
+            break;
+            }
+        case K_VC_test_case_117:
+            {
+            fileName = KFileName117;
+            break;
+            }
+        case K_VC_test_case_118:
+            {
+            fileName = KFileName118;
+            break;
+            }
+        case K_VC_test_case_119:
+            {
+            fileName = KFileName119;
+            break;
+            }
+        case K_VC_test_case_120:
+            {
+            fileName = KFileName120;
+            break;
+            }
+        case K_VC_test_case_121:
+            {
+            fileName = KFileName121;
+            break;
+            }
+        default:
+            break;
+        }
+    
+        switch(iAction)
+            {
+            case K_VC_test_case_108_a:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/H263-2000; profile=0; level=45"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_117:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUidG2,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/H263-2000"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_118:
+            case K_VC_test_case_120:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUidG2,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/mp4v-es"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_119:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/mp4v-es"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            case K_VC_test_case_121:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/mp4v-es; profile-level-id=3"),
+                    TFourCC(' ', 'A', 'A', 'C') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;
+                }
+            default:
+                {
+                TRAPD(err,
+                    iCamc->OpenFileL( fileName, camHandle, 
+                    controllerUid,
+                    formatUid,
+                    //TFourCC( '2', '6', '3', 'B' ),
+                    _L8("video/H263-2000"),
+                    TFourCC(' ', 'A', 'M', 'R') ));
+                if (err)
+                    {
+                    User::Leave(99);
+                    }
+                break;          
+                }
+          }
+
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+    
+    void CCamcTestClient_visualcheck::RunL()
+        {
+        
+        // Trap RunL, to catch if the AO leaves.
+        // A Walkaround...
+        // RunError() should be used in this case, but
+        // Apparently, it is not possible to use the AO RunError() virtual function
+        // for that purpose, it is not called.
+        
+        TRAPD( err,RunLTrappedL() );
+        if ( err )
+            {
+            SomethingInActiveObjectIsLeaving(err);
+            }
+        }
+    
+    void CCamcTestClient_visualcheck::RunLTrappedL()
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("CamCTestClient VisualCheck:RunL"));
+#endif
+        if ( iOpenReady ) 
+            {
+            iOpenReady = EFalse;
+            
+            switch(iAction)
+                {  
+                case K_VC_test_case_101:
+                    {
+                    break; 
+                    }
+                case K_VC_test_case_102:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(3));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_test_case_103:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(6700); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_test_case_104:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(5150); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break; 
+                    }
+                case K_VC_test_case_105:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(1));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(7400); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_106:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(3));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(4750); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_107:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_test_case_108_a:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(8));
+                    iCamc->SetVideoBitRateL(TInt(128000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break;              
+                    }
+                case K_VC_test_case_108_b:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(1));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break;              
+                    }
+                case K_VC_test_case_109:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(3));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_test_case_110:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(42000));    
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_111:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }
+                case K_VC_test_case_112:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_test_case_113:
+                    {
+                    iCamc->SetMaxClipSizeL(50);
+                    break; 
+                    }
+                case K_VC_test_case_114:
+                    {
+                    break; 
+                    }
+                case K_VC_test_case_115:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    break;
+                    }    
+                case K_VC_test_case_116:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_test_case_117:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }    
+                case K_VC_test_case_118:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_test_case_119:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetMaxClipSizeL(95000);
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(5150); 
+                    break;
+                    }    
+                 case K_VC_test_case_120:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }    
+                case K_VC_test_case_121:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(352,288));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(384000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    break;
+                    }
+               default:
+                    break;
+            }
+            
+            
+            
+            iCamc->Prepare();
+        }
+        else if ( iPrepareReady ) 
+            {
+            iPrepareReady = EFalse;    
+            iCamc->Record();
+            switch(iAction)
+                {
+                case K_VC_test_case_101:
+                    {
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );  // Records for 30 sec
+                    break;
+                    }
+                case K_VC_test_case_102:
+                case K_VC_test_case_103:
+                case K_VC_test_case_104:
+                case K_VC_test_case_105:
+                case K_VC_test_case_106:
+                case K_VC_test_case_108_a:
+                case K_VC_test_case_117:
+                case K_VC_test_case_119:
+                case K_VC_test_case_113:
+                    {
+                    // The timeout will be generated by the SetMaxClipSize.
+                    break;
+                    }
+                case K_VC_test_case_114:
+                    {
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );  // Records for 1 sec
+                    break;
+                    }
+                case K_VC_test_case_116:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );  // Records for 10 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+                default:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;          
+                    }
+                }
+            }
+        else if ( iRecordingReady )
+            {
+            
+            iRecordingReady = EFalse;
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After(1000);
+            }
+        else if (iClosed)
+            {
+            CActiveScheduler::Stop();
+            }
+        else if ( iPaused ) //resume
+            {
+            switch(iAction)
+                {
+                case K_VC_test_case_107:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec.
+                    iPaused = EFalse;
+                    iAction = K_VC_none;         
+                    break;
+                    }
+                case K_VC_test_case_109: 
+                case K_VC_test_case_118: 
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iAction = K_VC_none;
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(  2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_test_case_112:
+                    {
+                    iCamc->Record();
+                    iPaused = EFalse;  
+                    break;
+                    }
+                case K_VC_test_case_115:
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        iAction = K_VC_none;
+                        // Record until disk full
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(   2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_test_case_121:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec.
+                    iPaused = EFalse;
+                    iAction = K_VC_none;         
+                    break;
+                    }
+                default:
+                    break;
+                }
+            }
+        else //timer
+            {
+            switch(iAction)
+                {     
+                case K_VC_test_case_107:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec
+                    break;
+                    }
+                case K_VC_test_case_108_a: 
+                    {
+                    if ( i2ndTime )
+                        {
+                        // Volume down
+                        iCamc->SetGainL( 1 );
+                        iAction = K_VC_none;
+                        }
+                    else 
+                        {                
+                        // Volume Up
+                        TInt aSetGain;
+                        aSetGain = iCamc->MaxGainL();
+                        iCamc->SetGainL( aSetGain );
+                        CTimer::After( 15 * TInt32 ( 1E6 ) );
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_test_case_108_b: 
+                    {
+                    if ( i2ndTime )
+                        {
+                        // Volume down
+                        iCamc->SetGainL( 1 );
+                        iAction = K_VC_none;
+                        }
+                    else 
+                        {                
+                        // Volume Up
+                        TInt aSetGain;
+                        aSetGain = iCamc->MaxGainL();
+                        iCamc->SetGainL( aSetGain );
+                        CTimer::After( 15 * TInt32 ( 1E6 ) );
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_test_case_109:      
+                case K_VC_test_case_115:
+                case K_VC_test_case_118:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;          
+                    
+                    if ( i2ndTime )
+                        {
+                        CTimer::After( 30 * TInt32 ( 1E6 ) ); // Pauses for 30s
+                        }
+                    else 
+                        {                
+                        CTimer::After( 10 * TInt32 ( 1E6 ) ); // Pauses for 10s
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_test_case_110:
+                    {
+                    iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_10  );
+                    break;
+                    }
+                case K_VC_test_case_111:
+                    {
+                    iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_11  );
+                    iAction = K_VC_none;
+                    break;
+                    }
+                case K_VC_test_case_112:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_VC_test_case_116:
+                    {
+                    if(iStartRecording2ndTime)
+                        {
+                        iPrepareReady = ETrue;    
+                        CTimer::After( 10 * TInt32 ( 1E6 ) );
+                        iAction = K_VC_none;    
+                        }
+                    else
+                        {
+                        iCamc->Stop();
+                        CTimer::After( 3 * TInt32 ( 1E6 ) );
+                        iStartRecording2ndTime = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_test_case_120:
+                    {
+                    iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_20  );
+                    iAction = K_VC_none;
+                    break;
+                    }
+                case K_VC_test_case_121:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec
+                    break;
+                    }
+                default:
+                    iCamc->Stop();
+                    // Simulates that iRecording has been completed through the 
+                    // MvruoRecordComplete callback
+                    iRecordingReady=ETrue;				
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    
+                }
+            }
+        
+}
+
+void CCamcTestClient_visualcheck::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+
+void CCamcTestClient_visualcheck::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheck::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheck::MvruoRecordComplete( TInt aError )
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck:Record Complete"));
+#endif
+    if ((aError) && (aError != KErrCompletion))
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheck::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_visualcheck::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: SomethingInActiveObjectIsLeaving "));
+#endif
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+    
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_visualcheckdsp.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,905 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "camctestclient_visualcheckdsp.h"
+#include <AudioPreference.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTestClient_visualcheckdsp::CCamcTestClient_visualcheckdsp () : CTimer(CActive::EPriorityHigh)
+    {
+    }
+
+
+CCamcTestClient_visualcheckdsp::~CCamcTestClient_visualcheckdsp ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    Cancel();
+    delete iCamc;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: Destructor Start"));
+#endif
+    }
+
+CCamcTestClient_visualcheckdsp* CCamcTestClient_visualcheckdsp::NewL()
+    {
+    CCamcTestClient_visualcheckdsp* self = new(ELeave) CCamcTestClient_visualcheckdsp;
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CCamcTestClient_visualcheckdsp::ConstructL( )
+    {
+    iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
+    iOpenReady = EFalse;
+    iPrepareReady = EFalse;
+    iRecordingReady = EFalse;
+    iPaused = EFalse;
+    i2ndTime = EFalse;
+    iDoublePause = EFalse;
+    iStartRecording2ndTime = EFalse;
+    
+    CTimer::ConstructL();
+    iTimeout = 0;
+    iClosed = 0;
+    CActiveScheduler::Add(this);
+    }
+
+
+void CCamcTestClient_visualcheckdsp::Start_Active_ObjectL ( TestClientVCdspActions aAction, TInt aCameraHandle )
+    {
+    
+    iUiLevelCameraHandle = aCameraHandle;
+    TUid controllerUid = {0x101F8503};	//implementation uid
+    TUid formatUid = {0};
+    TUid formatUidG2 = {0x101F86D6};
+    TUid formatUidMP4 = {0x101F873D};
+    
+    
+    iAction = aAction;                  //iAction might be set to NULL after action has been executed
+    TBuf<50> fileName;
+    
+#if ( defined (__WINS__) || defined (__WINSCW__) )
+    _LIT(KFileName1,"c:\\recordQCIF_dsp_1.3gp");
+    _LIT(KFileName2,"c:\\recordQCIF_dsp_2.3gp");
+    _LIT(KFileName3,"c:\\recordQCIF_dsp_3.3gp");
+    _LIT(KFileName4,"c:\\recordQCIF_dsp_4.3gp");
+    _LIT(KFileName5,"c:\\recordQCIF_dsp_5.3gp");
+    _LIT(KFileName6,"c:\\recordQCIF_dsp_6.3gp");
+    _LIT(KFileName7,"c:\\recordQCIF_dsp_7.3gp");
+    _LIT(KFileName8,"c:\\recordQCIF_dsp_8.3gp");
+    _LIT(KFileName9_a,"c:\\recordQCIF_dsp_9_a.3gp");
+    _LIT(KFileName9_b,"c:\\recordQCIF_dsp_9_b.3gp");
+    _LIT(KFileName10,"c:\\recordQCIF_dsp_10.3gp");
+    _LIT(KFileName11,"c:\\recordQCIF_dsp_11.3gp");
+    _LIT(KFileName12,"c:\\recordQCIF_dsp_12.3gp");
+    _LIT(KFileName14,"c:\\recordQCIF_dsp_14.3gp");
+    _LIT(KFileName15,"c:\\recordQCIF_dsp_15.3gp");
+    _LIT(KFileName16,"c:\\recordQCIF_dsp_16.3gp");
+    _LIT(KFileName17,"c:\\recordQCIF_dsp_17.3gp");
+    _LIT(KFileName17_A,"c:\\recordQCIF_dsp_17_a.3gp");
+    _LIT(KFileName18,"c:\\recordQCIF_dsp_18.3g2");
+    _LIT(KFileName19,"c:\\recordQCIF_dsp_19.3g2");
+    _LIT(KFileName20,"c:\\recordQCIF_dsp_20.3g2");
+    _LIT(KFileName21,"c:\\recordQCIF_dsp_21.mp4");
+#else 
+    _LIT(KFileName1,"E:\\recordQCIF_dsp_1.3gp");
+    _LIT(KFileName2,"E:\\recordQCIF_dsp_2.3gp");
+    _LIT(KFileName3,"E:\\recordQCIF_dsp_3.3gp");
+    _LIT(KFileName4,"E:\\recordQCIF_dsp_4.3gp");
+    _LIT(KFileName5,"E:\\recordQCIF_dsp_5.3gp");
+    _LIT(KFileName6,"E:\\recordQCIF_dsp_6.3gp");
+    _LIT(KFileName7,"E:\\recordQCIF_dsp_7.3gp");
+    _LIT(KFileName8,"E:\\recordQCIF_dsp_8.3gp");
+    _LIT(KFileName9_a,"E:\\recordQCIF_dsp_9_a.3gp");
+    _LIT(KFileName9_b,"E:\\recordQCIF_dsp_9_b.3gp");
+    _LIT(KFileName10,"E:\\recordQCIF_dsp_10.3gp");
+    _LIT(KFileName11,"E:\\recordQCIF_dsp_11.3gp");
+    _LIT(KFileName12,"E:\\recordQCIF_dsp_12.3gp");
+    _LIT(KFileName14,"E:\\recordQCIF_dsp_14.3gp");
+    _LIT(KFileName15,"C:\\recordQCIF_dsp_15.3gp");
+    _LIT(KFileName16,"E:\\recordQCIF_dsp_16.3gp");
+    _LIT(KFileName17,"E:\\recordQCIF_dsp_17.3gp");
+    _LIT(KFileName17_A,"E:\\recordQCIF_dsp_17_a.3gp");
+    _LIT(KFileName18,"E:\\recordQCIF_dsp_18.3g2");
+    _LIT(KFileName19,"E:\\recordQCIF_dsp_19.3g2");
+    _LIT(KFileName20,"E:\\recordQCIF_dsp_20.3g2");
+    _LIT(KFileName21,"E:\\recordQCIF_dsp_21.mp4");
+#endif
+    switch(iAction)
+        {
+        case K_VC_dsp_test_case_1:
+            {
+            fileName = KFileName1;
+            break;
+            }
+        case K_VC_dsp_test_case_2:
+            {
+            fileName = KFileName2;
+            break;
+            }
+        case K_VC_dsp_test_case_3:
+            {
+            fileName = KFileName3;
+            break;
+            }
+        case K_VC_dsp_test_case_4:
+            {
+            fileName = KFileName4;
+            break;
+            }
+        case K_VC_dsp_test_case_5:
+            {
+            fileName = KFileName5;
+            break;
+            }
+        case K_VC_dsp_test_case_6:
+            {
+            fileName = KFileName6;
+            break;
+            }
+        case K_VC_dsp_test_case_7:
+            {
+            fileName = KFileName7;
+            break;
+            }
+        case K_VC_dsp_test_case_8:
+            {
+            fileName = KFileName8;
+            break;
+            }
+        case K_VC_dsp_test_case_9_a:
+            {
+            fileName = KFileName9_a;
+            break;
+            }
+        case K_VC_dsp_test_case_9_b:
+            {
+            fileName = KFileName9_b;
+            break;
+            }
+        case K_VC_dsp_test_case_10:
+            {
+            fileName = KFileName10;
+            break;
+            }
+        case K_VC_dsp_test_case_11:
+            {
+            fileName = KFileName11;
+            break;
+            }
+        case K_VC_dsp_test_case_12:
+            {
+            fileName = KFileName12;
+            break;
+            }
+        case K_VC_dsp_test_case_14:
+            {
+            fileName = KFileName14;
+            break;
+            }
+        case K_VC_dsp_test_case_15:
+            {
+            fileName = KFileName15;
+            break;
+            }
+        case K_VC_dsp_test_case_16:
+            {
+            fileName = KFileName16;
+            break;
+            }
+        case K_VC_dsp_test_case_17:
+            {
+            fileName = KFileName17;
+            break;
+            }
+        case K_VC_dsp_test_case_17_a:
+            {
+            fileName = KFileName17_A;
+            break;
+            }
+        case K_VC_dsp_test_case_18:
+            {
+            fileName = KFileName18;
+            break;
+            }
+        case K_VC_dsp_test_case_19:
+            {
+            fileName = KFileName19;
+            break;
+            }
+        case K_VC_dsp_test_case_20:
+            {
+            fileName = KFileName20;
+            break;
+            }
+        case K_VC_dsp_test_case_21:
+            {
+            fileName = KFileName21;
+            break;
+            }
+        default:
+            break;
+        }
+    
+    TInt err = KErrNone;
+    switch ( iAction )
+        {
+        case K_VC_dsp_test_case_9_a :
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000; profile=0; level=45"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            break;
+        case K_VC_dsp_test_case_17 :
+        case K_VC_dsp_test_case_17_a :
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/mp4v-es"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            break;
+        case K_VC_dsp_test_case_18:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidG2,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            break;
+        case K_VC_dsp_test_case_19:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidG2,
+                _L8("video/mp4v-es"),
+                TFourCC(' ', 'Q', '1', '3') ));
+            break;
+        case K_VC_dsp_test_case_20:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidG2,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'Q', '1', '3') ));
+            break;
+        case K_VC_dsp_test_case_21:
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUidMP4,
+                _L8("video/mp4v-es; profile-level-id=3"),
+                TFourCC(' ', 'A', 'A', 'C') ));
+            break;
+        default:
+            {
+            TRAP(err,
+                iCamc->OpenFileL( fileName, iUiLevelCameraHandle, 
+                controllerUid,
+                formatUid,
+                _L8("video/H263-2000"),
+                TFourCC(' ', 'A', 'M', 'R') ));
+            }
+        }
+    if (err)
+        {
+        User::Leave(99);
+        }
+    iOpenReady = EFalse;
+    
+    // Main part of program is a wait loop
+    // This function completes when the scheduler stops
+    CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+        User::Leave( iError );
+        }
+    }
+    
+    void CCamcTestClient_visualcheckdsp::RunL()
+        {
+        
+        // Trap RunL, to catch if the AO leaves.
+        // A Walkaround...
+        // RunError() should be used in this case, but
+        // Apparently, it is not possible to use the AO RunError() virtual function
+        // for that purpose, it is not called.
+        
+        TRAPD( err,RunLTrappedL() );
+        if ( err )
+            {
+            SomethingInActiveObjectIsLeaving(err);
+            }
+        }
+    
+    void CCamcTestClient_visualcheckdsp::RunLTrappedL()
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("CamCTestClient VisualCheck:RunL"));
+#endif
+        if ( iOpenReady ) 
+            {
+            iOpenReady = EFalse;
+            
+            switch(iAction)
+                {  
+                case K_VC_dsp_test_case_1:
+                    {
+                    break; 
+                    }
+                case K_VC_dsp_test_case_2:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_dsp_test_case_3:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(6700); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break; 
+                    }
+                case K_VC_dsp_test_case_4:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(28000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(5150); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break; 
+                    }
+                case K_VC_dsp_test_case_5:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(5));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(7400); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_6:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(4750); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_7:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(42000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_8:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(250000);
+                    break;              
+                    }
+                case K_VC_dsp_test_case_9_a:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(128000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_b:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_10:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(7.5));
+                    iCamc->SetVideoBitRateL(TInt(42000));    
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_11:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(EFalse); 
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    iCamc->SetMaxClipSizeL(95000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_15:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate);
+                    break;
+                    }    
+                case K_VC_dsp_test_case_16:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_dsp_test_case_17:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_dsp_test_case_17_a:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(128,96));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    iCamc->SetMaxClipSizeL(500000);
+                    break;
+                    }
+                case K_VC_dsp_test_case_18:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(12200); 
+                    break;
+                    }    
+                case K_VC_dsp_test_case_19:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(10));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetMaxClipSizeL(300000);
+                    //bitrate setting TBD
+                    iCamc->SetAudioBitRateL(6800); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_20:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(176,144));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(64000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    //bitrate setting TBD
+                    iCamc->SetAudioBitRateL(6800); 
+                    break;
+                    }
+                case K_VC_dsp_test_case_21:
+                    {
+                    iCamc->SetVideoFrameSizeL(TSize(352,288));
+                    iCamc->SetVideoFrameRateL(TReal32(15));
+                    iCamc->SetVideoBitRateL(TInt(384000));
+                    iCamc->SetAudioEnabledL(ETrue); 
+                    iCamc->SetAudioBitRateL(32000); 
+                    break;
+                    }
+                default:
+                    break;
+            }
+            
+            
+            
+            iCamc->Prepare();
+        }
+        else if ( iPrepareReady ) 
+            {
+            iPrepareReady = EFalse;    
+            iCamc->Record();
+            switch(iAction)
+                {
+                case K_VC_dsp_test_case_1:
+                    {
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );  // Records for 30 sec
+                    break;
+                    }
+                case K_VC_dsp_test_case_2:
+                case K_VC_dsp_test_case_3:
+                case K_VC_dsp_test_case_4:
+                case K_VC_dsp_test_case_5:
+                case K_VC_dsp_test_case_6:
+                case K_VC_dsp_test_case_19:
+                    {
+                    // The timeout will be generated by the SetMaxClipSize.
+                    break;
+                    }
+                case K_VC_dsp_test_case_14:
+                    {
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_VC_dsp_test_case_16:
+                case K_VC_dsp_test_case_17:
+                case K_VC_dsp_test_case_17_a:
+                case K_VC_dsp_test_case_18:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );  // Records for 10 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                    {
+                    CTimer::After( 4 * TInt32 ( 1E6 ) );  // Records for 4 sec
+                    iStartRecording2ndTime = EFalse;
+                    }
+                    break;
+                case K_VC_dsp_test_case_20:
+                    {
+                    CTimer::After( 15 * TInt32 ( 1E6 ) );  // Records for 15 sec + pause + another 15 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+                case K_VC_dsp_test_case_21:
+                    {
+                    CTimer::After( 30 * TInt32 ( 1E6 ) );  // Records for 30 sec + pause + another 30 sec
+                    iStartRecording2ndTime = EFalse;
+                    break;
+                    }
+
+                default:
+                    {
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;          
+                    }
+                }
+            }
+        else if ( iRecordingReady )
+            {
+            iRecordingReady = EFalse;
+            iCamc->Close();
+            iClosed = ETrue;
+            CTimer::After(1000);
+            }
+        else if (iClosed)
+            {
+            CActiveScheduler::Stop();
+            }
+        else if ( iPaused ) //resume
+            {
+            switch(iAction)
+                {
+                case K_VC_dsp_test_case_7:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec.
+                    iPaused = EFalse;
+                    iAction = K_VC_dsp_none;         
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_a: 
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iAction = K_VC_dsp_none;
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(  2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_b: 
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iAction = K_VC_dsp_none;
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(  2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                case K_VC_dsp_test_case_19:
+                    {
+                    iCamc->Record();
+                    iPaused = EFalse;  
+                    break;
+                    }
+                case K_VC_dsp_test_case_20:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 15 * TInt32 ( 1E6 ) ); // Records for 15 sec.
+                    iPaused = EFalse;  
+                    iAction = K_VC_dsp_none;
+                    break;
+                    }
+                case K_VC_dsp_test_case_21:
+                    {
+                    iCamc->Record();
+                    CTimer::After( 30 * TInt32 ( 1E6 ) ); // Records for 30 sec.
+                    iPaused = EFalse;  
+                    iAction = K_VC_dsp_none;
+                    break;
+                    }
+                case K_VC_dsp_test_case_15:
+                    {
+                    if ( iDoublePause )
+                        {             
+                        iCamc->Record();
+                        iAction = K_VC_dsp_none;
+                        // Record until disk full
+                        }
+                    else 
+                        {
+                        iCamc->Record();
+                        CTimer::After(   2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes
+                        iPaused = EFalse;
+                        iDoublePause = ETrue;
+                        }
+                    break;
+                    }
+                default:
+                    break;
+                }
+            }
+        else //timer
+            {
+            switch(iAction)
+                {     
+                case K_VC_dsp_test_case_7:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec
+                    break;
+                    }
+                case K_VC_dsp_test_case_8: 
+                    {
+                    if ( i2ndTime )
+                        {
+                        // Volume down
+                        iCamc->SetGainL( 1 );
+                        iAction = K_VC_dsp_none;
+                        }
+                    else 
+                        {                
+                        // Volume Up
+                        TInt aSetGain;
+                        aSetGain = iCamc->MaxGainL();
+                        iCamc->SetGainL( aSetGain );
+                        CTimer::After( 15 * TInt32 ( 1E6 ) );
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_9_a:      
+                case K_VC_dsp_test_case_9_b:      
+                case K_VC_dsp_test_case_15:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;          
+                    
+                    if ( i2ndTime )
+                        {
+                        CTimer::After( 30 * TInt32 ( 1E6 ) ); // Pauses for 30s
+                        }
+                    else 
+                        {                
+                        CTimer::After( 10 * TInt32 ( 1E6 ) ); // Pauses for 10s
+                        i2ndTime = ETrue;            
+                        }
+                    break;
+                    }
+                case K_VC_dsp_test_case_10:
+                    {
+                    iCamc->SetVideoBitRateL( VIDEO_BIT_RATE_10  );
+                    break;
+                    }
+                case K_VC_dsp_test_case_11:
+                case K_VC_dsp_test_case_17:
+                case K_VC_dsp_test_case_17_a:
+                    {
+                    iCamc->SetVideoBitRateL( VIDEO_BIT_RATE_11  );
+                    iAction = K_VC_dsp_none;
+                    break;
+                    }
+                case K_VC_dsp_test_case_12:
+                case K_VC_dsp_test_case_19:
+                case K_VC_dsp_test_case_20:
+                case K_VC_dsp_test_case_21:
+                    {
+                    iCamc->PauseL();
+                    iPaused = ETrue;
+                    CTimer::After( 10 * TInt32 ( 1E6 ) );
+                    break;
+                    }
+                case K_VC_dsp_test_case_16:
+                    {
+                    if(iStartRecording2ndTime)
+                        {
+                        iPrepareReady = ETrue;    
+                        CTimer::After( 10 * TInt32 ( 1E6 ) );
+                        iAction = K_VC_dsp_none;    
+                        }
+                    else
+                        {
+                        iCamc->Stop();
+                        CTimer::After( 3 * TInt32 ( 1E6 ) );
+                        iStartRecording2ndTime = ETrue;
+                        }
+                    break;
+                    }
+                default:
+                    iCamc->Stop();
+                    // Simulates that iRecording has been completed through the 
+                    // MvruoRecordComplete callback
+                    iRecordingReady=ETrue;				
+                    CTimer::After( 1 * TInt32 ( 1E6 ) );
+                    
+                }
+            }
+        
+}
+
+void CCamcTestClient_visualcheckdsp::DoCancel()
+    {
+    iCamc->Stop();
+    iCamc->Close();
+    delete iCamc;
+    iCamc = NULL;
+    }
+
+
+_LIT(KMyPanicDescriptor, "Callback error");
+void CCamcTestClient_visualcheckdsp::MvruoOpenComplete( TInt aError )
+    {
+    if (aError)
+        {        
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iOpenReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheckdsp::MvruoPrepareComplete( TInt aError )
+    {    
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iPrepareReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheckdsp::MvruoRecordComplete( TInt aError )
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck:Record Complete"));
+#endif
+    if ((aError) && (aError != KErrCompletion))
+        {
+        SomethingInActiveObjectIsLeaving(aError);
+        }
+    else
+        {
+        iRecordingReady = ETrue;
+        RunL(); // RunL is trapped, cannot actually leave.
+        }
+    }
+
+void CCamcTestClient_visualcheckdsp::MvruoEvent(const TMMFEvent& /*aEvent*/) 
+    {
+    /* Should be never called ... */  
+    SomethingInActiveObjectIsLeaving(99);
+    }
+
+void CCamcTestClient_visualcheckdsp::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTestClient VisualCheck: SomethingInActiveObjectIsLeaving "));
+#endif
+    // Something in the active object is leaving
+    // or a fatal error has been found.
+    
+    // Stop the active object scheduler.
+    iError=aError;
+    iCamc->Stop();
+    CActiveScheduler::Stop();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTestTop.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+
+
+#include "CamcTestTop.h"
+#include "CamcTest_1.h"
+#include "CamcTest_2.h"
+#include "CamcTest_3.h"
+#include "CamcTest_4.h"
+#include "CamcTest_5.h"
+#include "CamcTest_6.h"
+#include "CamcTest_7.h"
+#include "CamcTest_8.h"
+#include "CamcTest_9.h"
+#include "CamcTest_visualcheckdsp.h"
+#include "CamcTest_visualcheck.h"
+#include <e32des8.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+//////////////////
+// CppUnit things
+//////////////////
+
+#ifndef EKA2
+// Starting point of the DLL (Always needed) 
+GLDEF_C TInt E32Dll(TDllReason)
+    {
+    return(KErrNone);
+    }
+#endif
+// Exactly one exported function returning the suite of 
+// test functions for the test runner in the framework.
+// (Always needed)
+//
+
+
+
+
+EXPORT_C MTest* CreateTopFct ()
+    {
+    MTest * testSuite = NULL;
+    TRAPD(err, testSuite = CCamcTestTop::suiteL() ) ;
+    if (err)
+        {
+        User::Panic(_L("suiteL has left !"), 99);
+        }
+    return ( testSuite );
+    }
+
+ 
+CCamcTestTop::~CCamcTestTop()
+    {
+    }
+
+
+MTest* CCamcTestTop::suiteL ()
+    {
+    CTestSuite *suite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    suite->addTestL(CCamcTest_1::suiteL());
+    suite->addTestL(CCamcTest_2::suiteL());
+    suite->addTestL(CCamcTest_3::suiteL());
+    suite->addTestL(CCamcTest_4::suiteL());
+    suite->addTestL(CCamcTest_5::suiteL());   
+    suite->addTestL(CCamcTest_6::suiteL());
+    suite->addTestL(CCamcTest_7::suiteL());    
+    suite->addTestL(CCamcTest_8::suiteL());
+    suite->addTestL(CCamcTest_9::suiteL());
+
+    // Visual checks are flagged out because tests are very long !
+    
+    // Only one of these suite should be selected, depending on 
+    // HW used for the test.
+    // suite->addTestL(CCamcTest_visualcheckdsp::suiteL()); 
+    // suite->addTestL(CCamcTest_visualcheck::suiteL()); 
+
+    return suite;
+    
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_1.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,827 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_1.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+
+CCamcTest_1::CCamcTest_1 ()
+    {
+    }
+
+
+
+CCamcTest_1::~CCamcTest_1 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_1::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_1::NewL( );
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_1::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_1::setUp() using new MCameraObserver2" )) ); 
+       }
+
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();
+    }
+
+
+void CCamcTest_1::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;
+	REComSession::FinalClose();
+    
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       OpenFileL tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_1::OpenFileL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_001
+    //   Action :
+    //       CtrUid = OK
+    //   Output : 
+    //       OpenFile = OK
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,		//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+
+void CCamcTest_1::OpenFileL_002_L()
+    {
+    
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_002
+    //   
+    //     Action :
+    //        CtrUid = None (0x0)
+    //        FileName = OK
+    //     Output : 
+    //        OpenFile Leaves with KErrNotFound
+    //        or Callback is called with error msg
+    //    Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////   
+    
+    TUid controllerUid = {0x0};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+
+    // Function may leave with KErrNotFound, that's ok
+    if (err==KErrNotFound)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotFound, iCamcTestClient->WaitForCallbackWithErrors() );
+
+    }
+
+void CCamcTest_1::OpenFileL_003_L()
+    {
+    
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_003
+    //   
+    //     Action :
+    //        CtrUid = none
+    //        FileName = Extension not OK to find the controller
+    //     Output : 
+    //        OpenFile = Leave with KErrArgument 
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////    
+    
+    ////////////////////////////////////////
+    // Due to functionality changes, Test case is not relevant anymore
+    ////////////////////////////////////////
+    assertL(0);
+    
+    //TUid controllerUid = {0};	
+    //TUid formatUid = {0};
+    
+    //TRAPD(err,
+    //    iCamcTestClient->Test_OpenFileL(
+    //   _L("c:\\recordQCIF.txt"),		// File
+    //    0,								//CameraHandle
+    //    controllerUid,					//Controller UID
+    //    formatUid,						//Format UID
+    //    //TFourCC('2', '6', '3', 'B'),	//Video Type
+    //    _L8("video/3gpp"),
+    //    KMMFFourCCCodeNULL				//Audio Type
+    //    ));
+    
+    // OpenFile should not succeed...
+    // assertL (err==KErrArgument);
+    }
+
+void CCamcTest_1::OpenFileL_004_L()
+    {
+    
+    ///////////////////////////////////////
+    //	   ID: CAMC_API.OPENFILEL_004
+    //    
+    //     Action :
+    //	        CtrUid  = incorrect
+    //     Output : 
+    //         OpenFile = Leaves 
+    //           or MvruoOpenComplete return with an error
+    //         
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////   
+    
+    TUid controllerUid = {0x101F5023};   // This is a real Controller UID
+    // The Rubik Audio Controller
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+
+    // Function may leave with KErrNotFound, that's ok
+    if (err==KErrNotFound)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotFound, iCamcTestClient->WaitForCallbackWithErrors() );
+    
+    }
+
+void CCamcTest_1::OpenFileL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_005
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        NEW_MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_006_L()
+    {
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_006
+    //
+    //   Action :
+    //      Incorrect Video format UID
+    //   Output : 
+    //      OpenFile = Leaves with KErrNotSupported
+    //           or MvruoOpenComplete return with an error
+    //   Precondition :
+    //      CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {0x101f5c51};  // This is an audio Format, not supported
+    // by the video controller.
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+    // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+
+    }
+
+
+void CCamcTest_1::OpenFileL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_008
+    //   
+    //     Action :
+    //        Video Mime Type Supported
+    //     Output : 
+    //        OpenFile = OK
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_009_L()
+    {
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_009
+    //  
+    //    Action :
+    //       Video Mime Type = Not Present
+    //    Output : 
+    //       OpenFile = OK
+    //    Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid      			    	//Format UID
+        );
+    }
+
+void CCamcTest_1::OpenFileL_010_L()
+    {
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_010
+    //
+    //  Action :
+    //    VideoMimeType Unsupported
+    //  Output : 
+    //    OpenFile Leaves
+    //           or MvruoOpenComplete return with an error
+    //  Precondition :
+    //    CVideoRecorderUtility is ready
+    ///////////////////////////////////////  
+    
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        _L8("video/3gpp"),              //Usupported type...
+        NO_AUDIO_FOURCC				    //Audio Type
+        ));
+    
+     // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+ 
+    }
+
+
+void CCamcTest_1::OpenFileL_011_L()
+    {   
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_011
+    //
+    //  Action :
+    //    Give a valid Camera Handler
+    //  Output : 
+    //    OK
+    //  Precondition :
+    //    Camera already used by someone else
+    ///////////////////////////////////////  
+    
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_1::OpenFileL_011_L CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_1::OpenFileL_011_L() using new MCameraObserver2" )) ); 
+       }
+    
+    
+    CleanupStack::PushL(iCamera);	
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3gp"),		// File
+        iCamera->Handle(),				//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC				    //Audio Type
+        );
+    
+    CleanupStack::PopAndDestroy();
+    
+    }
+
+void CCamcTest_1::OpenFileL_017_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_017
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_NEW};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3g2"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_018_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_018
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_NEW};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.3g2"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        NEW_MIME_VIDEO_FORMAT,
+        NO_AUDIO_FOURCC  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_020_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_020
+    //   Action :
+    //       videoFormat ok
+    //   Output : 
+    //       No leave
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_MP4};
+    
+    iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.mp4"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        MPEG4_MIME_VIDEO_FORMAT,
+        ACC_AUDIO_FORMAT  				//Audio Type
+        );
+    
+    // Succeed, if it doesn't leave.
+    }
+
+void CCamcTest_1::OpenFileL_021_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENFILEL_021
+    //   Action :
+    //       videoFormat Unsupported
+    //   Output : 
+    //    OpenFile Leaves
+    //           or MvruoOpenComplete return with an error
+    //   Precondition :
+    //       CVideoRecorderUtility is ready
+    ///////////////////////////////////////
+    
+    TUid controllerUid = {CONTROLLER_UID};	
+    TUid formatUid = {VIDEO_FORMAT_UID_MP4};
+    
+    TRAPD(err, iCamcTestClient->Test_OpenFileL(
+        _L("recordQCIF.mp4"),		// File
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,      				//Format UID
+        UNSUPPORTED_VIDEO_FORMAT,
+        AMR_AUDIO_FORMAT  				//Audio Type
+        ));
+
+    // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+
+    }
+
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       OpenDescL tests
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_1::OpenDesL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENDESCL_001
+    //   
+    //     Action :
+    //        Call to openDesc
+    //     Output : 
+    //        OpenDesc Leaves, unsupported.
+    //           or MvruoOpenComplete return with an error
+    //     Precondition :
+    //        CVideoRecorderUtility is ready
+    /////////////////////////////////////// 
+    
+    TUid controllerUid = {0x101F8503};   
+    TUid formatUid = {0};
+    TBuf8 <100> myDescriptor;	 
+    TRAPD(err,iCamcTestClient->Test_OpenDesL(
+        myDescriptor,		// Descriptor
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        _L8("video/H263-2000"),
+        KMMFFourCCCodeNULL				//Audio Type
+        ));
+    
+    // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+ 
+    }
+
+// //////////////////////////////////////////////////////////////////
+//                       OpenUrlL tests
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_1::OpenUrlL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.OPENURLL_001
+    //   
+    //     Action :
+    //        Call to openUrl
+    //     Output : 
+    //        OpenDesc Leaves, unsupported.
+    //           or MvruoOpenComplete return with an error
+    //  Precondition :
+    //        CVideoRecorderUtility is ready
+    /////////////////////////////////////// 
+    
+    TUid controllerUid = {0x101F8503};   
+    TUid formatUid = {0};	 
+    TRAPD(err,iCamcTestClient->Test_OpenUrlL(
+        _L("http:\\nokia.com"),		    // Descriptor
+        iUiLevelCameraHandle,								//CameraHandle
+        controllerUid,					//Controller UID
+        formatUid,						//Format UID
+        _L8("video/H263-2000"),
+        KMMFFourCCCodeNULL				//Audio Type
+        ));
+    
+     // Function may leave with KErrNotSupported, that's ok
+    if (err==KErrNotSupported)
+        return;
+    // Otherwise, the MvruoOpenComplete should return with an error
+
+    assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
+ 
+    }
+
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_1::ReserveComplete(TInt aError)
+    {
+    RDebug::Print(_L("CCamcTest_1::ReserveComplete"));
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);  
+        return;
+        }
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+	    }
+    }
+
+void CCamcTest_1::PowerOnComplete(TInt aError)
+    {   
+    RDebug::Print(_L("CCamcTest_1::PowerOnComplete"));
+    if (aError)
+        {
+        SomethingInActiveObjectIsLeaving(aError);  
+        return;
+        } 
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+    	{
+    	 iWaitScheduler->AsyncStop();
+	    }        
+	}
+
+void CCamcTest_1::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_1::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt aError)
+    {    
+    TBuf<128> str;
+    str.Format(_L("CCamcTest_1::ImageReady %i"), aError);
+    RDebug::Print(str);   
+    }
+void CCamcTest_1::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt aError )
+    {
+    TBuf<128> str;
+    str.Format(_L("CCamcTest_1::FrameBufferReady %i"), aError);
+    RDebug::Print(str);  
+    }
+
+void CCamcTest_1::SomethingInActiveObjectIsLeaving (TInt aError)
+    {
+    // Something in the active object is leaving
+    // or a fatal error has been found.  
+    
+    TBuf<128> str;
+    str.Format(_L("CCamcTest_1::Something In Active Object is leaving %i"), aError);
+    RDebug::Print(str);   
+
+    // Stop the active object scheduler.
+    iError=aError;
+    CActiveScheduler::Stop();
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_1::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_1::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_1::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_1::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_1::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_1::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_1::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_1::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_1::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_1::VideoBufferReady() returning" )));
+    }
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_1::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_1"));
+
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_001"), &OpenFileL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_002"), &OpenFileL_002_L));
+    // OPENFILEL_003 is not a valid test case.
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_004"), &OpenFileL_004_L));
+    // OPENFILEL_005 is not relevent in current configuration.
+      
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_005"), &OpenFileL_005_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_006"), &OpenFileL_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_008"), &OpenFileL_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_009"), &OpenFileL_009_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_010"), &OpenFileL_010_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_011"), &OpenFileL_011_L));
+  
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_017"), &OpenFileL_017_L));
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_018"), &OpenFileL_018_L));   
+#endif
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_020"), &OpenFileL_020_L));   
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_021"), &OpenFileL_021_L));   
+#endif
+    
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENDESCL_001"), &OpenDesL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENURLL_001"), &OpenUrlL_001_L));
+    
+    
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_2.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1216 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL, State transition tests
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_2.h"
+#include "camcTest.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_2::CCamcTest_2 ()
+    {
+    }
+
+
+CCamcTest_2::~CCamcTest_2 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_2::setUpL ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest 2: SetUpL"));
+#endif
+    iCamcTestClient = CCamcTestClient_2::NewL( );
+
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_2::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_2::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    }
+
+
+void CCamcTest_2::tearDown ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest 2: TearDown Start"));
+#endif
+    delete iCamcTestClient;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest 2: TearDown Stop"));
+#endif
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;    
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+
+// //////////////////////////////////////////////////////////////////
+//                       Close tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::Close_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_001
+    //   Action :
+    //        Close when controller is open
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_002
+    //  Action :
+    //      Close before the controller has been open
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenControllerNotReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_003
+    //   Action :
+    //        Close when the controller is in prepared state 
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_004
+    //   Action :
+    //        Close after Recording is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenRecordingReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Close_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_005
+    //   Action :
+    //        Close when Recording
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenRecording, iUiLevelCameraHandle);
+
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+
+    AddDriveLetterToPath(_L("recordQCIF.3gp"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    
+    AddDriveLetterToPath(_L("CamcorderTmpDir"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNotFound, err );
+
+    AddDriveLetterToPath(_L("CamcorderTMP"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNotFound, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+
+void CCamcTest_2::Close_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CLOSE_007
+    //   Action :
+    //        Close when the controller is in prepared state 
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KcloseWhenPrepareReadyUsingAACandMPEG4, iUiLevelCameraHandle);
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       Prepare tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::Prepare_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_001
+    //   Action :
+    //        Prepare when controller is open
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Prepare_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_002
+    //   Action :
+    //        Prepare before the controller has been open
+    //   Output : 
+    //        OK
+    //////////////////////////////////////  
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Prepare_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_003
+    //   Action :
+    //        Call Prepare() when already prepared
+    //	      No video attributes set before calling the 2nd prepare.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Prepare_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_004
+    //   Action :
+    //        Prepare after Recording is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenRecordingReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Prepare_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_005
+    //   Action :
+    //       Prepare when Recording
+    //   Output : 
+    //        Should leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Prepare_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_006
+    //   Action :
+    //        Call Prepare() when already prepared
+    //		Set the video attributes before calling the 2nd prepare.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KprepareWhenPrepareReadySetVideoAttributes, iUiLevelCameraHandle);
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       Record tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::Record_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_001
+    //   Action :
+    //        Record when controller is open, but not prepared.
+    //   Output : 
+    //        Leave KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenControllerReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Record_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_002
+    //   Action :
+    //        Record before the controller has been open
+    //   Output : 
+    //        Leave KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenControllerNotReady, iUiLevelCameraHandle)); 
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::Record_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_003
+    //   Action :
+    //        Record when controller is prepared
+    //   Output : 
+    //        OK, file is recorded
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Record_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_004
+    //   Action :
+    //        Record when 1st recording is over.
+    //		No preparation.
+    //		
+    //   Output : 
+    //        Leave
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenRecordingReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::Record_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_005
+    //   Action :
+    //        Record when already recording.
+    //		
+    //   Output : 
+    //        Ignores Record command
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KrecordWhenRecording, iUiLevelCameraHandle);
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetPriorityL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetPriorityL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_001
+    //   Action :
+    //        SetPriorityL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetPriorityL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_002
+    //   Action :
+    //        SetPriorityL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetPriorityL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_003
+    //   Action :
+    //        SetPriorityL when prepare is ready
+    //        Call prepare
+    //        Ask for the value of priority
+    //   Output : 
+    //        OK
+    //////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetPriorityL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_004
+    //   Action :
+    //        SetPriorityL while recording
+    //		
+    //   Output : 
+    //        Leaves with KErrNotReady
+    ////////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetPriorityLWhenRecording, iUiLevelCameraHandle)  );
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoFrameRateL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoFrameRateL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_001
+    //   Action :
+    //        SetVideoFrameRateL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ////////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoFrameRateL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_002
+    //   Action :
+    //        SetVideoFrameRateL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameRateL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_003
+    //   Action :
+    //        SetVideoFrameRateL when prepare is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoFrameRateL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_004
+    //   Action :
+    //        SetVideoFrameRateL while recording
+    //		
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameRateLWhenRecording, iUiLevelCameraHandle);
+    }
+
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoFrameSizeL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoFrameSizeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_001
+    //   Action :
+    //        SetVideoFrameSizeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_002
+    //   Action :
+    //        SetVideoFrameSizeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_003
+    //   Action :
+    //        SetVideoFrameSizeL when prepare is ready
+    //        Start Recording
+    //   Output : 
+    //        Leave with KErrNotReady?
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_004
+    //   Action :
+    //        SetVideoFrameSizeL while recording
+    //		
+    //   Output : 
+    //        Leaves with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoFrameSizeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_007
+    //   Action :
+    //        SetVideoFrameSizeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoFrameSizeLWhenControllerReady_MPEG4, iUiLevelCameraHandle);
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoBitRateL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_001
+    //   Action :
+    //        SetVideoBitRateL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoBitRateL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_002
+    //   Action :
+    //        SetVideoBitRateL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoBitRateL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_003
+    //   Action :
+    //        SetVideoBitRateL when prepare is ready
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoBitRateL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_004
+    //   Action :
+    //        SetVideoBitRateL while recording
+    //		
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoBitRateLWhenRecording, iUiLevelCameraHandle);
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetAudioBitRateL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetAudioBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_001
+    //   Action :
+    //        SetAudioBitRateL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioBitRateL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_002
+    //   Action :
+    //        SetAudioBitRateL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioBitRateL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_003
+    //   Action :
+    //        SetAudioBitRateL when prepare is ready
+    //        Call prepare
+    //        Ask for bit rate.
+    //   Output : 
+    //        Bit rate is same as set.
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenPrepareReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioBitRateL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_004
+    //   Action :
+    //        SetAudioBitRateL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioBitRateLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetAudioEnabledL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetAudioEnabledL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_001
+    //   Action :
+    //        SetAudioEnabledL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioEnabledL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_002
+    //   Action :
+    //        SetAudioEnabledL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    /////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioEnabledL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_003
+    //   Action :
+    //        SetAudioEnabledL when prepare is ready
+    //   Output : 
+    //        Leave with KErrNotReady
+    ////////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioEnabledL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_004
+    //   Action :
+    //        SetAudioEnabledL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioEnabledLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetMaxClipSizeL tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_2::SetMaxClipSizeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_001
+    //   Action :
+    //        SetMaxClipSizeL when controller is open, but not prepared.
+    //   Output : 
+    //        Size is reached. KErrCompletion is received
+    //////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenControllerReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrCompletion, err );
+    }
+
+
+void CCamcTest_2::SetMaxClipSizeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_002
+    //   Action :
+    //        SetMaxClipSizeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetMaxClipSizeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_003
+    //   Action :
+    //        SetMaxClipSizeL when prepare is ready
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetMaxClipSizeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_004
+    //   Action :
+    //        SetMaxClipSizeL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetMaxClipSizeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetVideoTypeL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetVideoTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_001
+    //   Action :
+    //        SetVideoTypeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetVideoTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_002
+    //   Action :
+    //        SetVideoTypeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_003
+    //   Action :
+    //        SetVideoTypeL when prepare is ready
+    //        Record
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetVideoTypeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_004
+    //   Action :
+    //        SetVideoTypeL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    //////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetVideoTypeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+// //////////////////////////////////////////////////////////////////
+//                       SetAudioTypeL tests
+// //////////////////////////////////////////////////////////////////
+
+
+void CCamcTest_2::SetAudioTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_001
+    //   Action :
+    //        SetAudioTypeL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    /////////////////////////////////////// 
+    
+    iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_2::SetAudioTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_002
+    //   Action :
+    //        SetAudioTypeL before the controller has been open
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenControllerNotReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_003
+    //   Action :
+    //        SetAudioTypeL when prepare is ready
+    //        Record
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////   
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenPrepareReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_2::SetAudioTypeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_004
+    //   Action :
+    //        SetAudioTypeL while recording
+    //		
+    //   Output : 
+    //        Leave with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL(
+        CCamcTestClient_2::KSetAudioTypeLWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_2::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_2::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_2::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_2::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_2::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_2::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_2::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_2::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_2::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_2::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_2::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_2::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_2::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_2::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_2::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_2::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_2::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_2::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_2::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_2::VideoBufferReady() returning" )));
+    }
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+MTest* CCamcTest_2::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("State Transition tests (CamcTest2)"));
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_001"), &Close_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_002"), &Close_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_003"), &Close_003_L)); 
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_004"), &Close_004_L)); 
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_005"), &Close_005_L));
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.CLOSE_007"), &Close_007_L)); 
+#endif
+#endif
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_001"), &Prepare_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_002"), &Prepare_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_003"), &Prepare_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_004"), &Prepare_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_005"), &Prepare_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.PREPARE_006"), &Prepare_006_L));
+   
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_001"), &Record_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_002"), &Record_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_003"), &Record_003_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_004"), &Record_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.RECORD_005"), &Record_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_001"), &SetPriorityL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_002"), &SetPriorityL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_003"), &SetPriorityL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETPRIORITYL_004"), &SetPriorityL_004_L));
+    
+  
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_001"), &SetVideoFrameRateL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_002"), &SetVideoFrameRateL_002_L));     
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_003"), &SetVideoFrameRateL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_004"), &SetVideoFrameRateL_004_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_001"), &SetVideoFrameSizeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_002"), &SetVideoFrameSizeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_003"), &SetVideoFrameSizeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_004"), &SetVideoFrameSizeL_004_L));
+
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_007"), &SetVideoFrameSizeL_007_L));
+#endif
+#endif
+   
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_001"), &SetVideoBitRateL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_002"), &SetVideoBitRateL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_003"), &SetVideoBitRateL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_004"), &SetVideoBitRateL_004_L));
+
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_001"), &SetAudioBitRateL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_002"), &SetAudioBitRateL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_003"), &SetAudioBitRateL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_004"), &SetAudioBitRateL_004_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_001"), &SetAudioEnabledL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_002"), &SetAudioEnabledL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_003"), &SetAudioEnabledL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_004"), &SetAudioEnabledL_004_L));
+    
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_001"), &SetMaxClipSizeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_002"), &SetMaxClipSizeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_003"), &SetMaxClipSizeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_004"), &SetMaxClipSizeL_004_L));
+    
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_001"), &SetVideoTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_002"), &SetVideoTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_003"), &SetVideoTypeL_003_L));  
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_004"), &SetVideoTypeL_004_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_001"), &SetAudioTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_002"), &SetAudioTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_003"), &SetAudioTypeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_2>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_004"), &SetAudioTypeL_004_L));
+    
+    return suite;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_3.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL, Tests for memory Failures
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_3.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+///////////////////////////////////////////////////////////////////
+// Tests for memory Failures
+//
+// Should be used together with CppUnit Memory Failure option.
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_3::CCamcTest_3 ()
+    {
+    }
+
+
+
+CCamcTest_3::~CCamcTest_3 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_3::setUpL ()
+    {
+    // Do nothing in the setUp to get Memory Failure functionality
+    }
+
+
+void CCamcTest_3::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       Memory Failure tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_3::NewL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.NEWL_001
+    //   Action :
+    //       CppUnit will generate all possible Memory Failure
+    //       Problems.
+    //   Output : 
+    //       Function should leave gracefully.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+    
+
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_3::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_3::setUp() using new MCameraObserver2" )) ); 
+       }
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+
+    iCamcTestClient = CCamcTestClient_3::NewL( iUiLevelCameraHandle );
+    
+    delete iWaitScheduler;
+    delete iUiLevelCamera;       
+    // Succeed, if it doesn't leave.
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_3::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_3::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_3::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_3::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_3::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_3::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_3::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_3::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_3::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_3::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_3::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_3::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_3::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_3::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_3::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_3::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_3::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_3::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_3::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_3::VideoBufferReady() returning" )));
+    }
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_3::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_3"));
+    
+    suite->addTestL(CTestCaller<CCamcTest_3>::NewL(_L8("CAMC_API.NEWL_001"), &NewL_001_L));
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_4.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,361 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL, State transition tests
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_4.h"
+#include "camcTest.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+///////////////////////////////////////////////////////////////////
+// Automated API Tests 
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_4::CCamcTest_4 ()
+    {
+    }
+
+
+
+CCamcTest_4::~CCamcTest_4 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_4::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_4::NewL( );
+
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_4::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_4::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();       
+    }
+
+
+void CCamcTest_4::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;      
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       RecordTimeAvailableL tests
+// //////////////////////////////////////////////////////////////////
+
+// Allows a 10% margin for the filesize
+#define TC4_ALLOWED_MARGIN ( TC4_FILE_SIZE_LIMIT * 0.1 )
+
+void CCamcTest_4::RecordTimeAvailableL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_001
+    //   Action :
+    //       Ask time available frequently using timer
+    //   Output : 
+    //       Value is decreasing all the time
+    //   Precondition :
+    //       File Size limit set.
+    //       Recording
+    ///////////////////////////////////////
+
+
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailSizeLimit, iUiLevelCameraHandle );
+
+    /* Check if size is according to previously set Size limit */
+    RFile file; 
+    TInt filesize;
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    err = file.Size(filesize);
+    
+    file.Close();
+    fsSession.Close();
+
+    if ( ( filesize > TC4_FILE_SIZE_LIMIT + TC4_ALLOWED_MARGIN ) ||
+        (filesize < TC4_FILE_SIZE_LIMIT - TC4_ALLOWED_MARGIN ) )
+        {
+        assertL(0);
+        }
+    }
+
+
+void CCamcTest_4::RecordTimeAvailableL_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_002
+    //   Action :
+    //       Ask time available frequently using timer
+    //   Output : 
+    //       Value is decreasing all the time
+    //   Precondition :
+    //       File Size limit is NOT set.
+    //       Recording
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailNoSizeLimit, iUiLevelCameraHandle  );
+
+    }
+
+void CCamcTest_4::RecordTimeAvailableL_003_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_003
+    //   Action :
+    //       Not recording, size limit set
+    //       Asking RecordTimeAvailable()
+    //   Output : 
+    //       Value is proportional to size limit set
+    //   Precondition :
+    //       File Size limit is set.
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailNotRecordingSizeLimit, iUiLevelCameraHandle  );
+
+    }
+
+void CCamcTest_4::RecordTimeAvailableL_004_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_004
+    //   Action :    
+    //       Asking RecordTimeAvailable()
+    //   Output : 
+    //       Value is acceptable
+    //   Precondition :    
+    //       Not recording, size limit NOT set
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailNotRecordingNoSizeLimit, iUiLevelCameraHandle  );
+
+    }
+
+void CCamcTest_4::RecordTimeAvailableL_006_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_006
+    //   Action :    
+    //       Asking RecordTimeAvailable(), every seconds,
+    //       and keep in memory last value for Time Remaining
+    //   Output : 
+    //       Value is acceptable. Last value of Time Remaining <= 5 sec.
+    //   Precondition :    
+    //       Recording, size limit NOT set
+    ///////////////////////////////////////
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL( 
+        CCamcTestClient_4::K4RecordTimeAvailUntilDiskFull, iUiLevelCameraHandle  ));
+    assertTIntsEqualL( KErrDiskFull, err );
+
+    }
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_4::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_4::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_4::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_4::PowerOnComplete"));
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_4::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_4::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_4::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_4::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_4::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_4::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_4::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_4::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_4::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_4::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_4::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_4::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_4::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_4::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_4::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_4::VideoBufferReady() returning" )));
+    }
+
+
+
+MTest* CCamcTest_4::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_4"));
+
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_001"), &RecordTimeAvailableL_001_L));
+#if ! (defined (__WINS__) || defined (__WINSCW__) )
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_002"), &RecordTimeAvailableL_002_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_003"), &RecordTimeAvailableL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_004"), &RecordTimeAvailableL_004_L));
+
+    // RecordTimeAvailableL_006, only to be tested on HW
+    // Removed from MuDo tests
+#if ! (defined (__WINS__) || defined (__WINSCW__) )
+//    suite->addTestL(CTestCaller<CCamcTest_4>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLE_006"), &RecordTimeAvailableL_006_L));
+#endif
+  
+    return suite;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_5.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,995 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_5.h"
+#include "camcTest.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_5::CCamcTest_5 ()
+    {
+    }
+
+CCamcTest_5::~CCamcTest_5 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_5::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_5::NewL( );
+    
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_5::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_5::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    }
+
+
+void CCamcTest_5::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;        
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       Memory Failure tests
+// //////////////////////////////////////////////////////////////////
+
+/******************************/
+/*NUMBER OF META DATA ENTRIES */
+/******************************/
+
+void CCamcTest_5::NumberOfMetaDataEntriesL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.NUMBEROFMETADATAENTRIESL_001
+    //   Action :
+    //       Call NumberOfMetaDataEntriesL() when not recording
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       Not recording
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_NumberOfMetaDataEntriesWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::NumberOfMetaDataEntriesL_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.NUMBEROFMETADATAENTRIESL_002
+    //   Action :
+    //       Call NumberOfMetaDataEntriesL() when recording
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       Recording
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_NumberOfMetaDataEntriesWhenRecording, iUiLevelCameraHandle);
+    }
+
+/*******************************/
+/*      META DATA ENTRY        */
+/*******************************/
+
+void CCamcTest_5::MetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.METADATAENTRYL_001
+    //   Action :
+    //        Call MetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrNotSupported
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_MetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_5::MetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.METADATAENTRYL_002
+    //   Action :
+    //        Call MetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrNotSupported
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_MetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+/*******************************/
+/*    ADD META DATA ENTRY      */
+/*******************************/
+
+void CCamcTest_5::AddMetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.ADDMETADATAENTRYL_001
+    //   Action :
+    //        Call AddMetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_AddMetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_5::AddMetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.ADDMETADATAENTRYL_002
+    //   Action :
+    //        Call AddMetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_AddMetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+/********************************/
+/*    REMOVE META DATA ENTRY    */
+/********************************/
+
+void CCamcTest_5::RemoveMetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REMOVEMETADATAENTRYL_001
+    //   Action :
+    //        Call RemoveMetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_RemoveMetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+void CCamcTest_5::RemoveMetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REMOVEMETADATAENTRYL_002
+    //   Action :
+    //        Call RemoveMetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_RemoveMetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/*********************************/
+/*    REPLACE META DATA ENTRY    */
+/*********************************/
+
+void CCamcTest_5::ReplaceMetaDataEntryL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REPLACEMETADATAENTRYL_001
+    //   Action :
+    //        Call ReplaceMetaDataEntryL() when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_ReplaceMetaDataEntryWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+void CCamcTest_5::ReplaceMetaDataEntryL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.REPLACEMETADATAENTRYL_002
+    //   Action :
+    //        Call ReplaceMetaDataEntryL() when recording
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_ReplaceMetaDataEntryWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*        SET PRIORITY            */
+/**********************************/
+
+void CCamcTest_5::SetPriorityL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETPRIORITYL_005
+    //   Action :
+    //        Set wrong SetPriorityL() 
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetPriorityWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*         GET PRIORITY           */
+/**********************************/
+
+void CCamcTest_5::GetPriorityL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.GETPRIORITYL_001
+    //   Action :
+    //       Call GetPriorityL() when not set
+    //   Output : 
+    //       
+    //   Precondition :
+    //       Not set
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetPriorityWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*         SET VIDEO FRAME RATE   */
+/**********************************/
+
+void CCamcTest_5::SetVideoFrameRateL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMERATEL_005
+    //   Action :
+    //        Set wrong SetVideoFrameRateL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetVideoFrameRateWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*         VIDEO FRAME RATE       */
+/**********************************/
+
+void CCamcTest_5::VideoFrameRateL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VIDEOFRAMERATEL_001
+    //   Action :
+    //       Call VideoFrameRateL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_VideoFrameRateWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET VIDEO BIT RATE      */
+/**********************************/
+
+void CCamcTest_5::SetVideoBitRateL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOBITRATEL_005
+    //   Action :
+    //        Set wrong SetVideoBitRateL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetVideoBitRateWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*         VIDEO BIT RATE         */
+/**********************************/
+
+void CCamcTest_5::VideoBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VIDEOBITRATEL_001
+    //   Action :
+    //       Call VideoBitRateL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_VideoBitRateWhenNotSet, iUiLevelCameraHandle);
+
+    }
+
+/**********************************/
+/*        SET AUDIO BIT RATE      */
+/**********************************/
+
+void CCamcTest_5::SetAudioBitRateL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOBITRATEL_005
+    //   Action :
+    //        Set wrong SetAudioBitRateL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetAudioBitRateWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*        AUDIO BIT RATE          */
+/**********************************/
+
+void CCamcTest_5::AudioBitRateL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.AUDIOBITRATEL_001
+    //   Action :
+    //       Call AudioBitRateL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_AudioBitRateWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET AUDIO ENABLED       */
+/**********************************/
+
+void CCamcTest_5::SetAudioEnabledL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_005
+    //   Action :
+    //        SetAudioEnabledL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetAudioEnabledWhenOpenNotPrepared, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        AUDIO ENABLED           */
+/**********************************/
+
+void CCamcTest_5::AudioEnabledL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOENABLEDL_001
+    //   Action :
+    //        AudioEnabledL when not set
+    //   Output : 
+    //        
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_AudioEnabledWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET VIDEO FRAME SIZE    */
+/**********************************/
+
+void CCamcTest_5::SetVideoFrameSizeL_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_006
+    //   Action :
+    //        Set wrong SetVideoFrameSizeL()
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetVideoFrameSizeWhenOpenNotPrepared, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*        GET VIDEO FRAME SIZE    */
+/**********************************/
+
+void CCamcTest_5::GetVideoFrameSizeL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.GETVIDEOFRAMESIZEL_001
+    //   Action :
+    //       Call GetVideoFrameSizeL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetVideoFrameSizeWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*            PAUSE               */
+/**********************************/
+
+void CCamcTest_5::PauseL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PAUSEL_001
+    //   Action :
+    //        Pauses recording per request when recording
+    //   Output : 
+    //        Leave?
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_PauseWhenRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::PauseL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PAUSEL_001
+    //   Action :
+    //        Ignores request to pause when not recording
+    //   Output : 
+    //        Leave?
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_PauseWhenStopped, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*        SET MAX CLIP SIZE    */
+/**********************************/
+
+void CCamcTest_5::SetMaxClipSizeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_005
+    //   Action :
+    //        Set invalid size for SetMaxClipSizeL when not recording
+    //   Output : 
+    //        Leave with KErrArgument
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetMaxClipSizeLWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+/**********************************/
+/*          SET GAIN              */
+/**********************************/
+
+void CCamcTest_5::SetGainL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETGAINL_001
+    //   Action :
+    //        Set acceptable & ask, SetGainL when not recording.
+    //   Output : 
+    //        compare
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetGainWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::SetGainL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETGAINL_002
+    //   Action :
+    //        Set wrong SetGainL()
+    //   Output : 
+    //        The value is corrected inside the Video Recorder, 
+    //        the user is not warned of his error.
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetGainWhenNotRecordingAndSetWrong, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::SetGainL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETGAINL_003
+    //   Action :
+    //        Set acceptable & ask, SetGainL when recording.
+    //   Output : 
+    //        compare
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_SetGainWhenRecording, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*              GAIN              */
+/**********************************/
+
+void CCamcTest_5::GainL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.GAINL_001
+    //   Action :
+    //       Call GainL() when not set
+    //   Output : 
+    //       Function should retrun 0.
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_GainWhenNotSet, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*           MAX GAIN             */
+/**********************************/
+
+void CCamcTest_5::MaxGainL_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.MAXGAINL_001
+    //   Action :
+    //       Call MaxGainL() when not recording
+    //   Output : 
+    //       Function should retrun 0???
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_MaxGainWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::MaxGainL_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.MAXGAINL_002
+    //   Action :
+    //       Call MaxGainL() when recording
+    //   Output : 
+    //       Function should retrun 0???
+    //   Precondition :
+    //       
+    ///////////////////////////////////////
+
+        iCamcTestClient->Start_Active_ObjectL(K_Tc5_MaxGainWhenRecording, iUiLevelCameraHandle);
+    }
+
+/**********************************/
+/*             STOP               */
+/**********************************/
+
+void CCamcTest_5::Stop_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_001
+    //   Action :
+    //        Call stop when recording
+    //   Output : 
+    //        Video Recording is stopped.
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::Stop_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_002
+    //   Action :
+    //        Call Stop when not recording or paused
+    //   Output : 
+    //        Nothing
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::Stop_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_003
+    //   Action :
+    //        Stop + start timer + close + prepare
+    //   Output : 
+    //        New prepare complete, Prepare ready in 2 seconds
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingNewPrepareCorrect, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::Stop_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_004
+    //   Action :
+    //        Stop + close + open file
+    //   Output : 
+    //        File can be opened for reading
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingAfterOpenFile, iUiLevelCameraHandle);
+
+/* File can be opened for reading */
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::Stop_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_005
+    //   Action :
+    //        Stop + close + open file
+    //   Output : 
+    //        File can be opened for reading
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingAfterOpenFileNew, iUiLevelCameraHandle);
+
+/* File can be opened for reading */
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3g2"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::Stop_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.STOP_007
+    //   Action :
+    //        Stop + close + open file
+    //   Output : 
+    //        File can be opened for reading
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_StopWhenRecordingAfterOpenFileNew_MPEG4, iUiLevelCameraHandle);
+
+/* File can be opened for reading */
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.mp4"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_5::GetSupportedVideoTypes_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDVIDEOTYPESL_001
+    //   Action :
+    //        GetSupportedVideoTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedVideoTypesWhenOpenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::GetSupportedVideoTypes_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDVIDEOTYPESL_002
+    //   Action :
+    //        GetSupportedVideoTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedVideoTypesWhenOpenNotRecordingNew, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::GetSupportedAudioTypes_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDAUDIOTYPESL_001
+    //   Action :
+    //        GetSupportedAudioTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAMR, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_5::GetSupportedAudioTypes_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.GETSUPPORTEDAUDIOTYPESL_003
+    //   Action :
+    //        GetSupportedAudioTypesL when open, not recording
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc5_GetSupportedAudioTypesWhenOpenNotRecordingAAC, iUiLevelCameraHandle);
+    }
+    
+    
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_5::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_5::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_5::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_5::PowerOnComplete"));
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_5::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_5::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_5::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+  
+// -----------------------------------------------------------------------------
+// CCamcTest_5::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_5::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_5::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_5::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_5::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_5::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_5::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_5::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_5::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_5::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_5::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_5::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_5::VideoBufferReady() returning" )));
+    }
+
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_5::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_5"));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.NUMBEROFMETADATAENTRIESL_001"), &NumberOfMetaDataEntriesL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.NUMBEROFMETADATAENTRIESL_002"), &NumberOfMetaDataEntriesL_002_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.METADATAENTRYL_001"), &MetaDataEntryL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.METADATAENTRYL_002"), &MetaDataEntryL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.ADDMETADATAENTRYL_001"), &AddMetaDataEntryL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.ADDMETADATAENTRYL_002"), &AddMetaDataEntryL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REMOVEMETADATAENTRYL_001"), &RemoveMetaDataEntryL_001_L));   
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REMOVEMETADATAENTRYL_002"), &RemoveMetaDataEntryL_002_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REPLACEMETADATAENTRYL_001"), &ReplaceMetaDataEntryL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.REPLACEMETADATAENTRYL_002"), &ReplaceMetaDataEntryL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETPRIORITYL_005"), &SetPriorityL_005_L));     
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETPRIORITYL_001"), &GetPriorityL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETVIDEOFRAMERATEL_005"), &SetVideoFrameRateL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.VIDEOFRAMERATEL_001"), &VideoFrameRateL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETVIDEOBITRATEL_005"), &SetVideoBitRateL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.VIDEOBITRATEL_001"), &VideoBitRateL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETAUDIOBITRATEL_005"), &SetAudioBitRateL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.AUDIOBITRATEL_001"), &AudioBitRateL_001_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_005"), &SetAudioEnabledL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.AUDIOENABLEDL_001"), &AudioEnabledL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_006"), &SetVideoFrameSizeL_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETVIDEOFRAMESIZEL_001"), &GetVideoFrameSizeL_001_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.PAUSEL_001"), &PauseL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.PAUSEL_002"), &PauseL_002_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_005"), &SetMaxClipSizeL_005_L));
+     
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETGAINL_001"), &SetGainL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETGAINL_002"), &SetGainL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.SETGAINL_003"), &SetGainL_003_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GAINL_001"), &GainL_001_L));
+   
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.MAXGAINL_001"), &MaxGainL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.MAXGAINL_002"), &MaxGainL_002_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_001"), &Stop_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_002"), &Stop_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_003"), &Stop_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_004"), &Stop_004_L));
+    
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_005"), &Stop_005_L));
+#endif
+#ifndef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDVIDEOTYPESL_001"), &GetSupportedVideoTypes_001_L));
+#else
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDVIDEOTYPESL_002"), &GetSupportedVideoTypes_002_L));
+#endif
+
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    // MP4 AAC + AMR
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDAUDIOTYPESL_003"), &GetSupportedAudioTypes_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.STOP_007"), &Stop_007_L));
+#endif
+    // AMR-only
+    suite->addTestL(CTestCaller<CCamcTest_5>::NewL(_L8("CAMC_API.GETSUPPORTEDAUDIOTYPESL_001"), &GetSupportedAudioTypes_001_L));
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_6.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,989 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_6.h"
+#include "camcTest.h"
+#include <bldvariant.hrh>
+
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+CCamcTest_6::CCamcTest_6 ()
+    {
+    }
+
+
+
+CCamcTest_6::~CCamcTest_6 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_6::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_6::NewL( );
+    
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_6::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_6::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    }
+
+
+void CCamcTest_6::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;      
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+/***************************/
+/*           PAUSE         */
+/***************************/
+
+void CCamcTest_6::PauseL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PAUSEL_003
+    //   Action :
+    //        Call pause when stopped
+    //   Output : 
+    //        Leave?
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_PauseWhenStopped, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*  SET VIDEO FRAME SIZE  */
+/**************************/
+
+void CCamcTest_6::SetVideoFrameSizeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOFRAMESIZEL_005
+    //   Action :
+    //        SetVideoFrameSizeL when paused
+    //		
+    //   Output : 
+    //        Leaves with KErrNotReady
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoFrameSizeLWhenPaused, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+/**************************/
+/*    SET AUDIO ENABLED   */
+/**************************/
+
+void CCamcTest_6::SetAudioEnabledL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOENABLEDL_005
+    //   Action :
+    //        SetAudioEnabledL when controller is open, but not prepared.
+    //   Output : 
+    //        OK
+    //////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioEnabledLWhenControllerReady, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*   SET MAX CLIP SIZE    */
+/**************************/ 
+
+void CCamcTest_6::SetMaxClipSizeL_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_006
+    //   Action :
+    //        Set invalid size for SetMaxClipSizeL when controller open
+    //   Output : 
+    //        Leave with KErrNotReady??
+    //////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetMaxClipSizeLWhenControllerReady, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrArgument, err );
+    }
+
+// Allows a 10% margin for the filesize
+#define TC6_ALLOWED_MARGIN 0.1 
+
+void CCamcTest_6::SetMaxClipSizeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_007
+    //   Action :
+    //        SetMaxClipSizeL when prepare is ready
+    //   Output : 
+    //        Check file size 
+    ///////////////////////////////////////    
+    
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetMaxClipSizeLWhenPrepareReady, iUiLevelCameraHandle);
+    
+/* Check if size is according to previously set Size limit */
+    RFile file; 
+    TInt filesize;
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TInt err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    err = file.Size(filesize);
+    file.Close();
+    fsSession.Close();
+    if ( ( filesize > TC6_FILE_SIZE_LIMIT * (1 + TC6_ALLOWED_MARGIN ) ) ||
+        ( filesize < TC6_FILE_SIZE_LIMIT * (1 - TC6_ALLOWED_MARGIN ) ) )
+        {
+        assertL(0);
+        }
+    }
+
+/**************************/
+/*       RECORD           */
+/**************************/ 
+
+void CCamcTest_6::Record_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_006
+    //   Action :
+    //        Record when PrepareComplete, no size limit
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_RecordWhenPrepareComplete, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::Record_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.RECORD_007
+    //   Action :
+    //        Record when paused
+    //   Output : 
+    //        OK, No error in callback ???
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_RecordWhenPaused, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*       VIDEO TYPE       */
+/**************************/ 
+
+void CCamcTest_6::VideoTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_001
+    //   Action :
+    //        Call VideoType when opened with specified type, not recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_002
+    //   Action :
+    //        Call VideoType when opened Without Specifying VideoType, not recording
+    //   Output : 
+    //        must be sensible ??
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_003
+    //   Action :
+    //        Call VideoType when opened with specified type, recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithMimeAndRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_004
+    //   Action :
+    //        Call VideoType when open with NULL, not recording. 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithNULLAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::VideoTypeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.VIDEOTYPEL_005
+    //   Action :
+    //        Call VideoType 
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_VideoTypeLWhenOpenWithMimeAndNotRecordingNewFormat, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*       AUDIO TYPE       */
+/**************************/ 
+
+void CCamcTest_6::AudioTypeL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOTYPEL_001
+    //   Action :
+    //        Call AudioType when open with fourCC, not recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_AudioTypeLWhenOpenWithfourCCAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::AudioTypeL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOTYPEL_002
+    //   Action :
+    //        Call AudioType when open without specifying the audio type, not recording
+    //   Output : 
+    //        must be sensible ??
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_AudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::AudioTypeL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.AUDIOTYPEL_003
+    //   Action :
+    //        Call AudioType when open with fourCC, recording
+    //   Output : 
+    //        compare
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_AudioTypeLWhenOpenWithfourCCAndRecording, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*     SET VIDEO TYPE     */
+/**************************/ 
+
+void CCamcTest_6::SetVideoTypeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_005
+    //   Action :
+    //        Call SetVideoType when open without specifying the videoType. 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWhenOpenWithoutSpecifyingVideoTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetVideoTypeL_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_006
+    //   Action : 
+    //        SetVideoTypeL called with "video/mp4v-es; profile=8" 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWithProfile8, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetVideoTypeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_007
+    //   Action :
+    //        SetVideoType when not recording, set wrong 
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_6::SetVideoTypeL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_008
+    //   Action :
+    //        SetVideoTypeL called with "video/H263-2000; profile=0" 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWithProfile, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetVideoTypeL_009_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETVIDEOTYPEL_009
+    //   Action :
+    //        SetVideoTypeL called with "video/mp4v-es; profile-level-id=3" 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetVideoTypeLWithProfile3, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*     SET AUDIO TYPE     */
+/**************************/ 
+
+void CCamcTest_6::SetAudioTypeL_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_005
+    //   Action :
+    //        Call SetAudioType when open Without Specifying Audio Type, not recording. 
+    //   Output : 
+    //        compare (seted acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioTypeLWhenOpenWithoutSpecifyingAudioTypeAndNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::SetAudioTypeL_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_007
+    //   Action :
+    //        SetAudioType when not recording, set wrong 
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioTypeLWhenNotRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotSupported, err );
+    }
+
+void CCamcTest_6::SetAudioTypeL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETAUDIOTYPEL_008
+    //   Action :
+    //        Call SetAudioType when open with fourCC, not recording. 
+    //   Output : 
+    //        compare (seted different acceptable)
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_SetAudioTypeLWhenOpenWithfourCCAndNotRecording_AAC, iUiLevelCameraHandle);
+    }
+
+
+/***************************************/
+/*CONTROLLER IMPLEMENTATION INFORMATION*/
+/***************************************/
+
+void CCamcTest_6::ControllerImplementationInformationL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_001
+    //   Action :
+    //        ControllerImplementationInformationL when not open
+    //   Output : 
+    //        Leave with KErrArgument
+    ///////////////////////////////////////   
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenNotOpen, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_6::ControllerImplementationInformationL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_002
+    //   Action :
+    //        ControllerImplementationInformationL when open
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenOpen, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::ControllerImplementationInformationL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_003
+    //   Action :
+    //        ControllerImplementationInformationL when open
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenOpenNew, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::ControllerImplementationInformationL_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_004
+    //   Action :
+    //        ControllerImplementationInformationL when open
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_ControllerImplementationInformationWhenOpenNew_MPEG4, iUiLevelCameraHandle);
+    }
+
+
+
+/**************************/
+/*         DURATION       */
+/**************************/ 
+
+void CCamcTest_6::DurationL_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.DURATIONL_001
+    //   Action :
+    //        DurationL when recording
+    //   Output : 
+    //        Must be close to timeout*n time
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_DurationWhenRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::DurationL_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.DURATIONL_002
+    //   Action :
+    //        DurationL when not recording
+    //   Output : 
+    //        Value must be 0
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_DurationWhenNotRecording, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_6::DurationL_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.DURATIONL_003
+    //   Action :
+    //        Recording paused then resumed 
+    //   Output : 
+    //        Pause, Resume and Ask Duration frequently using timer
+    ///////////////////////////////////////   
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc6_DurationWhenPaused, iUiLevelCameraHandle);
+    }
+
+
+/**************************/
+/*     Registration       */
+/**************************/ 
+
+
+void CCamcTest_6::MMFRegistration_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_001
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationL ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+void CCamcTest_6::MMFRegistration_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_002
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for :Controller UID, Version, Supplier, 
+    //        Supported Media UIDs and Formats
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp2"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewL ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+void CCamcTest_6::MMFRegistration_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_003
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewL ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+void CCamcTest_6::MMFRegistration_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_004
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/mp4"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewMPEG4L ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+
+void CCamcTest_6::MMFRegistration_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_005
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp2"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewMPEG4L ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+
+void CCamcTest_6::MMFRegistration_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.MMFREGISTRATION_006
+    //   Action :
+    //        Check that camcorder registration was sucessfull.
+    //        Ask for Controller UID, Version, Supplier, Supported media UID
+    //        and Formats.
+    //   Output : 
+    //        must be sensible
+    ///////////////////////////////////////   
+    
+    /////////////////////////////////////////////////////
+    // Retrieve a list of possible controllers from ECOM
+    CMMFControllerPluginSelectionParameters * cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters * fSelect = CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL(_L8("video/3gpp"));
+    cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+    
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL(controllers);
+    cSelect->ListImplementationsL(controllers);
+    
+    // Only one Controller is expected to be found
+    // This might change in the future.
+    if (controllers.Count() !=1 )
+        {
+        User::Leave(K_Tc6_ErrExpectingADifferentValue);
+        }
+    iCamcTestClient->CheckControllerImplementationInformationNewMPEG4L ( *controllers[0] );
+
+    CleanupStack::PopAndDestroy(3);
+
+    }
+
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_6::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_6::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_6::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_6::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_6::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_6::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_6::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+  
+// -----------------------------------------------------------------------------
+// CCamcTest_6::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_6::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_6::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_6::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_6::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_6::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_6::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_6::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_6::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_6::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_6::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_6::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_6::VideoBufferReady() returning" )));
+    }
+
+
+
+/*********************************************************************************************/
+
+
+MTest* CCamcTest_6::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_6")); 
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.PAUSEL_003"), &PauseL_003_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOFRAMESIZEL_005"), &SetVideoFrameSizeL_005_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOENABLEDL_005"), &SetAudioEnabledL_005_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_006"), &SetMaxClipSizeL_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_007"), &SetMaxClipSizeL_007_L));
+
+    // Record_006, only to be tested on HW
+    // Removed from MuDo tests
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+//    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.RECORD_006"), &Record_006_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.RECORD_007"), &Record_007_L));
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_001"), &VideoTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_002"), &VideoTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_003"), &VideoTypeL_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_004"), &VideoTypeL_004_L));
+   
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.VIDEOTYPEL_005"), &VideoTypeL_005_L));
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.AUDIOTYPEL_001"), &AudioTypeL_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.AUDIOTYPEL_002"), &AudioTypeL_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.AUDIOTYPEL_003"), &AudioTypeL_003_L));
+ 
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_005"), &SetVideoTypeL_005_L));
+   
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_006"), &SetVideoTypeL_006_L));
+#endif
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_007"), &SetVideoTypeL_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_008"), &SetVideoTypeL_008_L));
+
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETVIDEOTYPEL_009"), &SetVideoTypeL_009_L));
+#endif
+#endif
+    
+    
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_005"), &SetAudioTypeL_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_007"), &SetAudioTypeL_007_L));   
+
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.SETAUDIOTYPEL_008"), &SetAudioTypeL_008_L));
+#endif
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_001"), &ControllerImplementationInformationL_001_L));   
+#ifndef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_003"), &ControllerImplementationInformationL_003_L));   
+#else
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.CONTROLLERIMPLEMENTATIONINFORMATIONL_004"), &ControllerImplementationInformationL_004_L));   
+#endif
+
+#ifndef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_002"), &MMFRegistration_002_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_003"), &MMFRegistration_003_L));   
+#else
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_004"), &MMFRegistration_004_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_005"), &MMFRegistration_005_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.MMFREGISTRATION_006"), &MMFRegistration_006_L));   
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.DURATIONL_001"), &DurationL_001_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.DURATIONL_002"), &DurationL_002_L));   
+    suite->addTestL(CTestCaller<CCamcTest_6>::NewL(_L8("CAMC_API.DURATIONL_003"), &DurationL_003_L));   
+
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_7.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_7.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+///////////////////////////////////////////////////////////////////
+// Tests for Cooperation with Camera API
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_7::CCamcTest_7 ()
+    {
+    }
+
+
+
+CCamcTest_7::~CCamcTest_7 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_7::setUpL ()
+    {
+    iCamcTestClient = CCamcTestClient_7::NewL( );
+    }
+
+
+void CCamcTest_7::tearDown ()
+    {   
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+void CCamcTest_7::OpenFileL_007_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.OPENFILEL_007
+    //
+    //   Action :
+    //      Video Format UID = NULL
+	//   Output : 
+    //      Recording works, Doesn't leave.
+    //   Precondition :
+    //      CVideoRecorderUtility is ready
+    /////////////////////////////////////// 
+    
+    iCamcTestClient->Start_Active_ObjectL( K_Tc7_OpenFileWithVideoFormatNULL );
+    }
+
+void CCamcTest_7::OpenFileL_013_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.OPENFILE_13
+    //   Action :
+    //       Application release the camera while Camcorder still
+    //       records
+    //   Output : 
+    //       Recording continues till the end.
+    //   Precondition :
+    //       Camera Reserved, CamC recording
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc7_ReleaseCameraWhileRecording);
+ 
+    }
+
+void CCamcTest_7::OpenFileL_014_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.OPENFILE_014
+    //   Action :
+    //       Application powers off the camera while Camcorder still
+    //       records
+    //   Output : 
+    //       Recording stops with KErrNotReady.
+    //   Precondition :
+    //       Camera Reserved, CamC recording
+    ///////////////////////////////////////
+    
+    TRAPD(err, 
+        iCamcTestClient->Start_Active_ObjectL( K_Tc7_PowerOffCameraWhileRecording ) );
+    assertTIntsEqualL( KErrNotReady, err );
+
+    }
+
+void CCamcTest_7::OpenFileL_015_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.OPENFILE_015
+    //   Action :
+    //       Camera is used by an other application,
+    //       Call to OpenFileL()
+    //   Output : 
+    //       Should leave.
+    //   Precondition :
+    //       Camera Reserved by an other application.
+    ///////////////////////////////////////
+    
+    TRAPD(err,iCamcTestClient->Start_Active_ObjectL( K_Tc7_OpenFileWhenCameraIsNotAvailable ));
+    assertTIntsEqualL( KErrInUse, err );
+    
+    }
+
+void CCamcTest_7::Close_006_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.CLOSE_006
+    //   Action :
+    //       Application release the camera while Camcorder still
+    //       records
+    //       Camcorder is Closed
+    //   Output : 
+    //       The Camera can be used by somebody else.
+    //   Precondition :
+    //       Camera Reserved, CamC recording
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL( K_Tc7_ReleaseCameraCloseRecorderUseCamera);
+
+    
+    // Succeed, if it doesn't leave.
+    }
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+MTest* CCamcTest_7::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_7"));   
+    
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_007"), &OpenFileL_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_013"), &OpenFileL_013_L));
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_014"), &OpenFileL_014_L));
+    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.OPENFILEL_015"), &OpenFileL_015_L));
+// Removed from MuDo tests
+//    suite->addTestL(CTestCaller<CCamcTest_7>::NewL(_L8("CAMC_API.CLOSE_006"), &Close_006_L));
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_8.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,471 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_8.h"
+#include "camcTest.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+///////////////////////////////////////////////////////////////////
+// Tests for Cooperation with Camera API
+//
+///////////////////////////////////////////////////////////////////
+
+CCamcTest_8::CCamcTest_8 ()
+    {
+    }
+
+
+
+CCamcTest_8::~CCamcTest_8 ()
+    {
+    delete iCamcTestClient1; // To mute PCLINT
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; // To mute PCLINT
+    iCamcTestClient2 = NULL;
+    }
+
+
+void CCamcTest_8::setUpL ()
+    {
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_8::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_8::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();        
+    }
+
+
+void CCamcTest_8::tearDown ()
+    {   
+    delete iWaitScheduler;
+    delete iUiLevelCamera;    
+        
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+void CCamcTest_8::MultipleInstance_001_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_001
+    //
+    //   Action :
+    //      1 Camcorder is in Prepared state
+    //      A 2nd Camcorder is instanciated with same file name.
+	//   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError,&numberOfCamcOpen, iUiLevelCameraHandle);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError,&numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance001_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance001_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1;      
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+
+    }
+
+
+void CCamcTest_8::MultipleInstance_002_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_002
+    //
+    //   Action :
+    //      1 Camcorder is in Prepared state
+    //      A 2nd Camcorder is instanciated with different file name.
+    //   Output : 
+    //      OK
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file ,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance002_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance002_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+    assertTIntsEqualL( KErrNone, iError );
+    delete iCamcTestClient1;      
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2;   
+    iCamcTestClient2 = NULL;
+    }
+
+void CCamcTest_8::MultipleInstance_003_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_003
+    //
+    //   Action :
+    //      1 Camcorder is in Prepared state
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+    
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance003_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance003_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1;       
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2;   
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    }
+
+
+
+void CCamcTest_8::MultipleInstance_004_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_004
+    //
+    //   Action :
+    //      1 Camcorder is Recording
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+    
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance004_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance004_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1; 
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    }
+
+
+
+void CCamcTest_8::MultipleInstance_005_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_005
+    //
+    //   Action :
+    //      1 Camcorder has finished Recording
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leaves with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file ,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance005_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance005_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+    
+    delete iCamcTestClient1; 
+    iCamcTestClient1 = NULL;
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    assertTIntsEqualL( KErrHardwareNotAvailable, iError );
+    }
+
+
+void CCamcTest_8::MultipleInstance_006_L()
+    {
+    
+    ///////////////////////////////////////
+    //  ID: CAMC_API.MULTIPLEINSTANCE_006
+    //
+    //   Action :
+    //      1 Camcorder is Recording
+    //      A 2nd Camcorder calls prepare.
+    //   Output : 
+    //      Leave with KErrInUse
+    /////////////////////////////////////// 
+    TInt numberOfCamcOpen = 0;
+
+    
+    TFileName file;
+    AddDriveLetterToPath(_L("recordQCIF1.3gp"),file);
+
+    iCamcTestClient1 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+    AddDriveLetterToPath(_L("recordQCIF2.3gp"),file);
+    iCamcTestClient2 = CCamcTestClient_8::NewL( file,
+        &iError, &numberOfCamcOpen, iUiLevelCameraHandle);
+
+
+    iCamcTestClient1->Start_Active_Object( K_Tc8_MultipleInstance006_AO1 ,
+        iCamcTestClient2);    
+    iCamcTestClient2->Start_Active_Object( K_Tc8_MultipleInstance006_AO2 ,
+        iCamcTestClient1); 
+
+    // Start the active scheduler
+    CActiveScheduler::Start();
+
+    delete iCamcTestClient1;  
+    iCamcTestClient1 = NULL;      
+    delete iCamcTestClient2; 
+    iCamcTestClient2 = NULL;
+    assertTIntsEqualL( KErrInUse, iError );
+    }
+    
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_8::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_8::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_8::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_8::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_8::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_8::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_8::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+    
+  
+// -----------------------------------------------------------------------------
+// CCamcTest_8::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_8::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_8::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_8::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_8::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_8::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_8::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_8::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_8::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_8::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_8::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_8::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_8::VideoBufferReady() returning" )));
+    }
+
+
+
+
+MTest* CCamcTest_8::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_8"));   
+
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_001"), &MultipleInstance_001_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_002"), &MultipleInstance_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_003"), &MultipleInstance_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_004"), &MultipleInstance_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_005"), &MultipleInstance_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_8>::NewL(_L8("CAMC_API.MULTIPLEINSTANCE_006"), &MultipleInstance_006_L));
+    
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_9.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,629 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_9.h"
+#include "camcTest.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// Allows a 10% margin for the filesize
+#define TC9_ALLOWED_MARGIN ( TC9_FILE_SIZE_LIMIT * 0.1 )
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+CCamcTest_9::CCamcTest_9 ()
+    {
+    }
+
+
+
+CCamcTest_9::~CCamcTest_9 ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_9::setUpL ()
+    {
+        {
+        iCamcTestClient = CCamcTestClient_9::NewL( );
+        }
+    // Do nothing in the setUp to get Memory Failure functionality
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_9::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_9::setUp() using new MCameraObserver2" )) ); 
+       }
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();     
+    }
+
+
+void CCamcTest_9::tearDown ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;     
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       Prepare tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_9::Prepare_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_007
+    //   Action :
+    //        Prepare when controller is open.
+    //        Call prepare, without setting anything (using all defaults)
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_PrepareWhenControllerReadyWhitoutSetting, iUiLevelCameraHandle);
+    }
+    
+void CCamcTest_9::Prepare_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_008
+    //   Action :
+    //        Prepare when controller is open. Call prepare, setting 
+    //        only VideoBitRate (using defaults for the other parameters)
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_9::Prepare_009_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.PREPARE_009
+    //   Action :
+    //        Prepare when controller is open. Call prepare, setting 
+    //        only VideoFrameSize (using defaults for the other parameters)
+    //   Output : 
+    //        OK
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_9::RecordTimeAvailableL_005_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.RECORDTIMEAVAILABLEL_005
+    //   Action :    
+    //       Asking RecordTimeAvailable()
+    //       Once Recording is ready
+    //   Output : 
+    //       Value must be sensible
+    ///////////////////////////////////////
+    
+    iCamcTestClient->Start_Active_ObjectL( K_Tc9_RecordTimeAvailWhenRecordingReady, iUiLevelCameraHandle );
+    }
+
+/**************************/
+/*   SET MAX CLIP SIZE    */
+/**************************/ 
+
+void CCamcTest_9::SetMaxClipSizeL_008_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_008
+    //   Action :
+    //        SetMaxClipSizeL when controller is open. Set size = 0
+    //   Output : 
+    //        Must record until disk full.
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_SetMaxClipSizeLWhenControllerReadySize0, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_9::SetMaxClipSizeL_009_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.SETMAXCLIPSIZEL_009
+    //   Action :
+    //        SetMaxClipSizeL when controller is open. Set size = KMMFNoMaxClipSize
+    //   Output : 
+    //        Must record until disk full.
+    ///////////////////////////////////////    
+    
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize, iUiLevelCameraHandle);
+    }
+
+/**************************/
+/*     NEW FILE NAME      */
+/**************************/ 
+
+void CCamcTest_9::NewFileName_001_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_001
+    //   Action :
+    //        Set NewFileName when prepared, not recording 
+    //   Output : 
+    //        New video, which have new name.
+    ///////////////////////////////////////    
+    TInt err;
+
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    
+    TFileName fileName;
+    AddDriveLetterToPath(_L("NewFileName.3gp"),fileName);
+    err = fsSession.Delete( fileName );
+
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenPreparedNotRecording, iUiLevelCameraHandle);
+
+    err = file.Open(fsSession,fileName,EFileShareAny);    
+    file.Close();
+    fsSession.Close();
+    assertTIntsEqualL( KErrNone, err );
+    }
+
+void CCamcTest_9::NewFileName_002_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_002
+    //   Action :
+    //        Set NewFileName when recorded ready 
+    //   Output : 
+    //        Record two videos, and the second one have new name.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.3gp"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTime, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+void CCamcTest_9::NewFileName_003_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_003
+    //   Action :
+    //        Set NewFileName when recording 
+    //   Output : 
+    //        Leave.
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecording, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_9::NewFileName_004_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_004
+    //   Action :
+    //        Set NewFileName when paused 
+    //   Output : 
+    //        Leave.
+    ///////////////////////////////////////    
+    
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenPaused, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrNotReady, err );
+    }
+
+void CCamcTest_9::NewFileName_005_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_005
+    //   Action :
+    //        One video is recorded. It ends because of filesize reached.
+    //        A second video is recorded, changing the filename using custom
+    //        command, no OpenFile(). 
+    //   Output : 
+    //        FileSize of both video is ok.
+    ///////////////////////////////////////    
+       
+    RFile file; 
+    TInt filesize,err;
+    RFs fsSession;
+    fsSession.Connect();
+    TFileName fileName1, fileName2;
+  
+    TRAPD(leavingCode,
+        {
+        AddDriveLetterToPath(_L("recordQCIF.3gp"),fileName1);
+        err = fsSession.Delete( fileName1 ); 
+        AddDriveLetterToPath(_L("NewFileName.3gp"),fileName2);
+        err = fsSession.Delete( fileName2 ); 
+        
+        // Start the test case
+        iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenInternalStop, iUiLevelCameraHandle);
+        
+        // Check if size of files is according to previously set Size limit 
+        err = file.Open(fsSession,fileName1,EFileShareAny);
+        assertTIntsEqualL( KErrNone, err );
+        err = file.Size(filesize);
+        file.Close();
+        
+        if ( ( filesize > TC9_FILE_SIZE_LIMIT + TC9_ALLOWED_MARGIN ) ||
+            (filesize < TC9_FILE_SIZE_LIMIT - TC9_ALLOWED_MARGIN ) )
+            {
+            assertL(0);
+            }
+
+        err = file.Open(fsSession,fileName2,EFileShareAny);
+        assertTIntsEqualL( KErrNone, err );
+        err = file.Size(filesize);
+        file.Close();
+        
+        if ( ( filesize > TC9_FILE_SIZE_LIMIT + TC9_ALLOWED_MARGIN ) ||
+            (filesize < TC9_FILE_SIZE_LIMIT - TC9_ALLOWED_MARGIN ) )
+            {
+            assertL(0);
+            }
+        } ); //End of TRAPD
+    
+    fsSession.Close();
+    User::LeaveIfError(leavingCode);
+    }
+
+void CCamcTest_9::NewFileName_006_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_006
+    //   Action :
+    //        Custom command sent, prepare(), and record() 
+    //   Output : 
+    //        2nd recorded file has the name 
+    //        requested in the custom command.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.3g2"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.3g2"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+void CCamcTest_9::NewFileName_007_L()
+    {
+    ///////////////////////////////////////
+    //   ID: CAMC_API.NEWFILENAME_007
+    //   Action :
+    //        Custom command sent, prepare(), and record() 
+    //   Output : 
+    //        2nd recorded file has the name 
+    //        requested in the custom command.
+    ///////////////////////////////////////    
+   
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("recordQCIF.mp4"),fileName);
+    TFileName newfile;
+    AddDriveLetterToPath(_L("NewFileName.mp4"),newfile);
+    err = fsSession.Delete( fileName ); 
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    err = fsSession.Delete( newfile );
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    iCamcTestClient->Start_Active_ObjectL(K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat, iUiLevelCameraHandle);
+
+
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+    err = file.Open(fsSession,newfile,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+
+
+/*****************************/
+/*      OPEN FILE            */
+/*****************************/
+
+void CCamcTest_9::OpenFileL_016_L()
+    {
+    
+    ///////////////////////////////////////
+    //	 ID: CAMC_API.OPENFILEL_016
+    //    
+    //   Action :FileOpen with FileName "foo/filename.3gp", ie a folder
+    //             that doesn't exists. Then normal recording procedure.
+    //	        
+    //   Output :Folder is created, video is correctly recorded. 
+    //             (Existence of the video checked)
+    ///////////////////////////////////////   
+
+    iCamcTestClient->Start_Active_ObjectL(K_Tc9_OpenFileInAFolderNonExistent, iUiLevelCameraHandle);  
+    
+    RFile file; 
+    RFs fsSession;
+    fsSession.Connect();
+    TInt err;
+    TFileName fileName;
+    AddDriveLetterToPath(_L("non-existent-folder\\recordQCIF.3gp"), fileName);
+    err = file.Open(fsSession,fileName,EFileShareAny);
+    assertTIntsEqualL( KErrNone, err );
+
+    file.Close();
+    fsSession.Close();
+    }
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_9::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_9::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_9::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_9::PowerOnComplete"));
+
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_9::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_9::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_9::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_9::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_9::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_9::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_9::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_9::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_9::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_9::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_9::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_9::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_9::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_9::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_9::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_9::VideoBufferReady() returning" )));
+    }
+
+
+MTest* CCamcTest_9::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_9"));
+
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.PREPARE_007"), &Prepare_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.PREPARE_008"), &Prepare_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.PREPARE_009"), &Prepare_009_L));
+    
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.RECORDTIMEAVAILABLEL_005"), &RecordTimeAvailableL_005_L));
+    
+    // SetMaxClipSizeL_008 and SetMaxClipSizeL_009, only to be tested on HW
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_008"), &SetMaxClipSizeL_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.SETMAXCLIPSIZEL_009"), &SetMaxClipSizeL_009_L));
+#endif
+    
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_001"), &NewFileName_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_002"), &NewFileName_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_003"), &NewFileName_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_004"), &NewFileName_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_005"), &NewFileName_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_006"), &NewFileName_006_L));
+    
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+#if ((!defined __WINS__) || (!defined __WINSCW__)) // AAC supported only in HW
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.NEWFILENAME_007"), &NewFileName_007_L));
+#endif
+#endif
+
+    suite->addTestL(CTestCaller<CCamcTest_9>::NewL(_L8("CAMC_API.OPENFILEL_016"), &OpenFileL_016_L));
+   
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_visualcheck.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,698 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_visualcheck.h"
+#include <bldvariant.hrh>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_visualcheck::CCamcTest_visualcheck ()
+    {
+    }
+
+
+
+CCamcTest_visualcheck::~CCamcTest_visualcheck ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_visualcheck::setUpL ()
+    {
+#ifdef _DEBUG
+      RDebug::Print(_L("CamCTest VisualCheck: SetUpL"));
+#endif
+      iCamcTestClient = CCamcTestClient_visualcheck::NewL( );
+    // Do nothing in the setUp to get Memory Failure functionality
+    }
+
+
+void CCamcTest_visualcheck::tearDown ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheck: TearDown Start"));
+#endif
+    delete iCamcTestClient;
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheck: TearDown Stop"));
+#endif
+    iCamcTestClient = NULL;
+	REComSession::FinalClose();
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//           Visual check tests for NON HW accelerated encoder
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_visualcheck::VisualCheck_101_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_101
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              30s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_101);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_102_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_102
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    3
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_102);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_103_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_103
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    5
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      6.7
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_103);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_104_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_104
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    10
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      5.15
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_104);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_105_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_105
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    1
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      7.4
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_105);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_106_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_106
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    3
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      4.75
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_106);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_107_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_107
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              60s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_107);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_108_A_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_108_A
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      128000
+    //       Video Frame-Rate:    8
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    Volume up
+    //       Dynamic change 2:    Volume down
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_108_a);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_108_B_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_108_B
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    1
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    Volume up
+    //       Dynamic change 2:    Volume down
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_108_b);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_109_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_109_B
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    3
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_109);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_110_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_110
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 64000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_110);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_111_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_111
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 500
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_111);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_112_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_112
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    5
+    //       Picture size:        subQCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_112);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_113_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_113
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): 50 bytes
+    //       Length:              None
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    //
+    //   !!! Obsolete Test !!!
+    //
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_113);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_114_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_114
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              1s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_114);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_115_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_115
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): None
+    //       Length:              Until disk "full"
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_115));
+    assertTIntsEqualL( KErrDiskFull, err );
+    }
+
+void CCamcTest_visualcheck::VisualCheck_116_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_116
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              -
+    //       Dynamic change 1:    Stop Recording + Start a new record without prepare
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_116);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_117_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_117
+    //   Action :
+    //       Format:              3g2
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_117);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_118_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_118
+    //   Action :
+    //       Format:              3g2
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + resume
+    //       Dynamic change 2:    Pause + resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_118);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_119_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_119
+    //   Action :
+    //       Format:              3gp
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    7
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      5,15
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_119);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_120_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_120
+    //   Action :
+    //       Format:              3g2
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    10
+    //       Picture size:        subQCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 500
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_120);
+    }
+
+void CCamcTest_visualcheck::VisualCheck_121_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_121
+    //   Action :
+    //       Format:              mp4
+    //       Video:               video/mp4v-es; profile-level-id=3
+    //       Video Bit-rate:      384000
+    //       Video Frame-Rate:    15
+    //       Picture size:        CIF
+    //       Audio:               AAC
+    //       Audio Bit-rate:      None
+    //       Size limit (kbytes): None
+    //       Length:              60s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_test_case_121);
+    }
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_visualcheck::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_visualcheck"));
+
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_101"), &VisualCheck_101_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_102"), &VisualCheck_102_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_103"), &VisualCheck_103_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_104"), &VisualCheck_104_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_105"), &VisualCheck_105_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_106"), &VisualCheck_106_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_107"), &VisualCheck_107_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_108_A"), &VisualCheck_108_A_L));
+    //Old Test VisualCheck_108
+    //suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_108_B"), &VisualCheck_108_B_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_109"), &VisualCheck_109_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_110"), &VisualCheck_110_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_111"), &VisualCheck_111_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_112"), &VisualCheck_112_L));
+    // Test 113 considered as obsolete.
+    //  suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_113"), &VisualCheck_113_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_114"), &VisualCheck_114_L));
+  
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+     suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_115"), &VisualCheck_115_L));
+#endif   
+     
+     suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_116"), &VisualCheck_116_L));
+
+     suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_117"), &VisualCheck_117_L));
+     
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_118"), &VisualCheck_118_L));
+#endif
+
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_119"), &VisualCheck_119_L));
+#endif
+
+#ifdef __MPEG4_VIDEO_ENCODING
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_120"), &VisualCheck_120_L));
+#endif  
+    
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_visualcheck>::NewL(_L8("CAMC_API.VISUALCHECK_121"), &VisualCheck_121_L));
+#endif
+
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_api/tsrc/src/camcTest_visualcheckdsp.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,805 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder MMF API Test DLL
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "camcTest_visualcheckdsp.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES 
+ 
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+CCamcTest_visualcheckdsp::CCamcTest_visualcheckdsp ()
+    {
+    }
+
+
+
+CCamcTest_visualcheckdsp::~CCamcTest_visualcheckdsp ()
+    {
+    delete iCamcTestClient;
+    iCamcTestClient = NULL;
+    }
+
+
+void CCamcTest_visualcheckdsp::setUpL ()
+    {
+#ifdef _DEBUG
+      RDebug::Print(_L("CamCTest VisualCheckDsp: SetUpL"));
+#endif
+      iCamcTestClient = CCamcTestClient_visualcheckdsp::NewL( );
+
+    // Do nothing in the setUp to get Memory Failure functionality
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
+    if ( err )
+        {
+        PRINT( ( _L( "CCamcTest_visualcheckdsp::setUpL CCamera::New2L return code=%d" ), err ) ); 
+        // Create old Camera API implementation object.
+        iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
+        }
+    else 
+       {
+       PRINT( ( _L( "CCamcTest_visualcheckdsp::setUp() using new MCameraObserver2" )) ); 
+       }
+
+
+	iUiLevelCameraHandle = iUiLevelCamera->Handle();
+	iUiLevelCamera->Reserve();
+	iWaitScheduler->Start();    
+    
+    }
+
+
+void CCamcTest_visualcheckdsp::tearDown ()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheckDsp: TearDown Start"));
+#endif
+    delete iCamcTestClient;
+
+    iCamcTestClient = NULL;
+    delete iWaitScheduler;
+    delete iUiLevelCamera;  
+	REComSession::FinalClose();
+#ifdef _DEBUG
+    RDebug::Print(_L("CamCTest VisualCheckDsp: TearDown Stop"));
+#endif
+    }
+
+
+//
+// Own test functions.
+//
+
+// //////////////////////////////////////////////////////////////////
+//                       visual check tests
+// //////////////////////////////////////////////////////////////////
+
+void CCamcTest_visualcheckdsp::VisualCheck_001_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_001
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              30s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_1, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_002_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_002
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    5
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_2, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_003_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_003
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      6.7
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_3, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_004_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_004
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      28000
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      5.15
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_4, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_005_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_005
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      7.4
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_5, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_006_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_006
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      4.75
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_6, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_007_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_007
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              60s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_7, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_008_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_008
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 250
+    //       Length:              -
+    //       Dynamic change 1:    Volume up
+    //       Dynamic change 2:    Volume down
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_8, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_009_A_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_009_A
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      128000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_9_a, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_009_B_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_009_B
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              5min
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_9_b, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_010_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_010
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      42000
+    //       Video Frame-Rate:    7.5
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 64000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_10, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_011_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_011
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               None
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 500
+    //       Length:              -
+    //       Dynamic change 1:    Bit-rate 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_11, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_012_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_012
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): 95
+    //       Length:              -
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_12, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_013_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_013
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): 50 bytes
+    //       Length:              None
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    //
+    //   !!! Obsolete Test !!!
+    //
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_13, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_014_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_014
+    //   Action :
+    //       Format:              Default
+    //       Video:               Default
+    //       Video Bit-rate:      Default
+    //       Video Frame-Rate:    Default
+    //       Picture size:        Default
+    //       Audio:               Default
+    //       Audio Bit-rate:      Default
+    //       Size limit (kbytes): None
+    //       Length:              1s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_14, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_015_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_015
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      var
+    //       Video Frame-Rate:    15
+    //       Picture size:        QCIF
+    //       Audio:               -
+    //       Audio Bit-rate:      -
+    //       Size limit (kbytes): None
+    //       Length:              Until disk "full"
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    Pause + Resume
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    TRAPD(err, iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_15, iUiLevelCameraHandle));
+    assertTIntsEqualL( KErrDiskFull, err );
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_016_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_016
+    //   Action :
+    //       Format:              3gp
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    10
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              -
+    //       Dynamic change 1:    Stop Recording + Start a new record without prepare
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_16, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_017_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_017
+    //   Action :
+    //       Format:              3gp
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              10 s
+    //       Dynamic change 1:    Bitrate to 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_17, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_017_A_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_017_A
+    //   Action :
+    //       Format:              3gp
+    //       Video:               MPEG4
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    15
+    //       Picture size:        subQCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): 500
+    //       Length:              10 s
+    //       Dynamic change 1:    Bitrate to 28000
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_17_a, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_018_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_018
+    //   Action :
+    //       Format:              3g2
+    //       Video:               263b
+    //       Video Bit-rate:      64000
+    //       Video Frame-Rate:    10
+    //       Picture size:        QCIF
+    //       Audio:               AMR
+    //       Audio Bit-rate:      12.2
+    //       Size limit (kbytes): None
+    //       Length:              10 s
+    //       Dynamic change 1:    None
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_18, iUiLevelCameraHandle);
+    }
+
+void CCamcTest_visualcheckdsp::VisualCheck_021_L()
+    {
+    ///////////////////////////////////////
+	//   ID: CAMC_API.VISUALCHECK_021
+    //   Action :
+    //       Format:              mp4
+    //       Video:               video/mp4v-es; profile-level-id=3
+    //       Video Bit-rate:      384000
+    //       Video Frame-Rate:    15
+    //       Picture size:        CIF
+    //       Audio:               AAC
+    //       Audio Bit-rate:      32000
+    //       Size limit (kbytes): None
+    //       Length:              60 s
+    //       Dynamic change 1:    Pause + Resume
+    //       Dynamic change 2:    None
+    //   Output : 
+    //       The video clip is ok, and inspected _visually by a (human) operator.
+    //   Precondition :
+    //       None
+    ///////////////////////////////////////
+
+    iCamcTestClient->Start_Active_ObjectL(K_VC_dsp_test_case_21, iUiLevelCameraHandle);
+    }
+// //////////////////////////////////////////////////////////////////
+//   Dummy Camera API callback functions
+// //////////////////////////////////////////////////////////////////
+void CCamcTest_visualcheckdsp::ReserveComplete(TInt /*aError*/)
+    {
+    RDebug::Print(_L("CCamcTest_5::ReserveComplete"));
+        
+    // UI level camera is being initialized        
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iUiLevelCamera->PowerOn();
+    	 return;
+	    }
+    }
+
+void CCamcTest_visualcheckdsp::PowerOnComplete(TInt /*aError*/)
+    {   
+    RDebug::Print(_L("CCamcTest_5::PowerOnComplete"));
+        
+    // UI level camera is being initialized
+    if (iWaitScheduler->IsStarted())
+	    {
+    	 iWaitScheduler->AsyncStop();
+    	 return;
+    	}        
+    }
+
+void CCamcTest_visualcheckdsp::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+    {
+    }
+void CCamcTest_visualcheckdsp::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt /*aError*/)
+    {    
+    }
+void CCamcTest_visualcheckdsp::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt /*aError*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCamcTest_visualcheckdsp::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    CFbsBitmap *buffer = NULL;
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ViewFinderFrameReady( *buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    ImageReady( NULL, NULL, aError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCamcTest_visualcheckdsp::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCamcTest_visualcheckdsp::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCamcTest_visualcheckdsp::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
+    MFrameBuffer* buffer = NULL;
+	
+    if ( !aError )
+        {
+        aCameraBuffer.Release();
+        }
+    // Call old Camera-API observer handler
+    FrameBufferReady( buffer, aError );
+    
+    PRINT(( _L( "CCamcTest_visualcheckdsp::VideoBufferReady() returning" )));
+    }
+
+
+
+
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCamcTest_visualcheckdsp::suiteL ()
+    {
+    // Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_visualcheckdsp"));
+
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_001"), &VisualCheck_001_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_002"), &VisualCheck_002_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_003"), &VisualCheck_003_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_004"), &VisualCheck_004_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_005"), &VisualCheck_005_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_006"), &VisualCheck_006_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_007"), &VisualCheck_007_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_008"), &VisualCheck_008_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_009_A"), &VisualCheck_009_A_L));
+    //Old Test VisualCheck_009
+    //suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_009_B"), &VisualCheck_009_B_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_010"), &VisualCheck_010_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_011"), &VisualCheck_011_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_012"), &VisualCheck_012_L));
+    // Test 113 considered as obsolete.
+    //suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_013"), &VisualCheck_013_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_014"), &VisualCheck_014_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_016"), &VisualCheck_016_L));
+
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+ //   suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_015"), &VisualCheck_015_L));
+#endif   
+
+#ifdef __MPEG4_VIDEO_ENCODING
+//    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_017"), &VisualCheck_017_L));
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_017_A"), &VisualCheck_017_A_L));
+#endif
+#ifdef MP4_FILE_FORMAT_SUPPORTED
+    suite->addTestL(CTestCaller<CCamcTest_visualcheckdsp>::NewL(_L8("CAMC_API.VISUALCHECK_021"), &VisualCheck_021_L));
+#endif
+
+    
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_sink_api/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Media Recorder Sink API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CCMRMediaSink.h     MW_LAYER_PLATFORM_EXPORT_PATH(CCMRMediaSink.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_sink_api/inc/CCMRMediaSink.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definitions for a media sink object
+*
+*/
+
+
+#ifndef CCMRMEDIASINK_H
+#define CCMRMEDIASINK_H
+
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+*  Buffer class used in MCMRMediaSink
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class CCMRMediaBuffer : public CBase
+    {
+    public:  // Constants
+
+        // Buffer type
+        enum TBufferType 
+            {
+            EAudioAMRNB = 0,
+            EAudioAMRWB,            
+            EVideoH263,
+            EVideoMPEG4,
+            EVideoMPEG4DecSpecInfo,
+            EAudioDecSpecInfo = 6,
+            EAudioMPEG4AAC,
+            EVideoH264NAL,
+            EVideoH264Bytestream,
+            EVideoH264NALDecSpecInfo,
+            EVideoH264BytestreamDecSpecInfo
+            };        
+
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructors. The 1st creates a buffer to be initialized later with Set, 
+        * and the 2nd one initializes it already here
+        */
+
+        inline CCMRMediaBuffer() {}
+
+        inline CCMRMediaBuffer(const TPtrC8& aBuffer, 
+                        const TBufferType aType, 
+                        const TInt aSize, 
+                        const TBool aRandomAccessPoint,
+                        const TTimeIntervalMicroSeconds& aTimeStamp) 
+                        : iType(aType), iSize(aSize), iRandomAccessPoint(aRandomAccessPoint), iTimeStamp(aTimeStamp), iPtr(aBuffer) {}
+
+        /**
+        * Destructor.
+        */
+        inline ~CCMRMediaBuffer() {}
+
+    public:  // New functions
+
+        /**                     
+        * Set the buffer parameters. This enables reusing the buffer
+        * @since 2.1
+        * @param const TPtrC8& aBuffer                          Data buffer
+        * @param const TBufferType aType                        Buffer type
+        * @param const TInt aSize                               Buffer size (in bytes)
+        * @param const TBool aRandomAccessPoint                 ETrue if buffer has a video random access point
+        * @param const TTimeIntervalMicroSeconds& aTimeStamp    Timestamp of the buffer
+        * @return void
+        */
+        inline void Set(const TPtrC8& aBuffer, 
+                        const TBufferType aType, 
+                        const TInt aSize, 
+                        const TBool aRandomAccessPoint,
+                        const TTimeIntervalMicroSeconds& aTimeStamp)
+            {
+            iType = aType;
+            iSize = aSize;
+            iRandomAccessPoint = aRandomAccessPoint;
+            iTimeStamp = aTimeStamp;
+            iPtr.Set(aBuffer);
+            }
+
+        /**                     
+        * Return the data pointer
+        * @since 2.1
+        * @return TPtrC8 pointer
+        */
+        inline TPtrC8 Data() const { return iPtr; }
+
+        /**
+        * Return buffer type
+        * @since 2.1
+        * @return TInt Error code
+        */
+        inline TBufferType Type() const { return iType; } 
+
+        /**
+        * Write Return buffer size
+        * @since 2.1
+        * @return TInt Error code
+        */
+        inline TInt BufferSize() const { return iSize; }
+
+        /**
+        * Query whether this buffer contains a frame that can be used as a random-access point
+        * @since 2.1
+        * @return TBool ETrue if this is a random access point
+        */
+        inline TBool RandomAccessPoint() const { return iRandomAccessPoint; } 
+
+        /**
+        * Write a buffer to sink
+        * @since 2.1
+        * @return TTimeIntervalMicroSeconds Timestamp
+        */
+        inline TTimeIntervalMicroSeconds TimeStamp() const { return iTimeStamp; }
+
+    private:  // Data
+
+        // media type
+        TBufferType iType;         
+
+        // media buffer size in bytes
+        TInt iSize;                
+
+        // ETrue if the media contained in this buffer
+        // can be used as random access point in playback        
+        TBool iRandomAccessPoint;  
+                                   
+        // time stamp in microseconds counting from the beginning of rec.
+        TTimeIntervalMicroSeconds iTimeStamp;           
+
+        // descriptor for returning the data pointer
+        TPtrC8 iPtr;               
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract Media sink interface
+*
+*  @lib CAMCMEDIARECORDER.LIB
+*  @since 2.1
+*/
+class MCMRMediaSink
+    {
+        
+    public:
+
+        /**
+        * Write a buffer to sink
+        * @since 2.1
+        * @param CCMRMediaBuffer* aBuffer   The buffer to write
+        * @return TInt                      Error code
+        */
+        virtual void WriteBufferL(CCMRMediaBuffer* aBuffer) = 0;
+
+        /**
+        * Inform video frame size to sink
+        * @since 2.1
+        * @param TSize aSize    Video frame size
+        * @return TInt          Error code
+        */
+        virtual TInt SetVideoFrameSize(TSize aSize) = 0;
+
+        /**
+        * Inform average video bitrate to sink
+        * @since 2.1
+        * @param TInt aBitRate  Average video bitrate
+        * @return TInt          Error code
+        */
+        virtual TInt SetAverageVideoBitRate(TInt aBitRate) = 0;
+
+        /**
+        * Inform maximum video bitrate to sink
+        * @since 2.1
+        * @param TInt aBitRate  Maximum expected video bitrate
+        * @return TInt          Error code
+        */
+        virtual TInt SetMaxVideoBitRate(TInt aBitRate) = 0;
+
+        /**
+        * Inform average audio bitrate to sink
+        * @since 2.1
+        * @param TInt aBitRate  Average audio bitrate
+        * @return TInt          Error code
+        */
+        virtual TInt SetAverageAudioBitRate(TInt aBitRate) = 0;
+    };
+
+
+#endif // CCMRMEDIASINK_H
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/media_recorder_sink_api/media_recorder_sink_api.metaxml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="80ffb4d35e0885ccfb82531ca2fd7863" dataversion="2.0">
+<name>Media Recorder Sink API</name>
+<description>Abstract Sink API to where Media Recorder writes audio and video data.</description>
+<type>c++</type>
+<collection>CamcorderMMFPlugin</collection>
+<libs></libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Imaging Configuration Manager
+*
+*/
+
+
+
+#include "../imagingconfigmanager/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/Bwins/imagingconfigmanagerU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	?GetCamcorderMMFPluginSettings@CImagingConfigManager@@QBEHAAVTCamcorderMMFPluginSettings@@@Z @ 1 NONAME ; int CImagingConfigManager::GetCamcorderMMFPluginSettings(class TCamcorderMMFPluginSettings &) const
+	?GetImageQualityLevelsL@CImagingConfigManager@@QAEHAAV?$CArrayFixFlat@I@@I@Z @ 2 NONAME ; int CImagingConfigManager::GetImageQualityLevelsL(class CArrayFixFlat<unsigned int> &, unsigned int)
+	?GetImageQualitySet@CImagingConfigManager@@QAEHAAVTImageQualitySet@@ABVTSize@@I@Z @ 3 NONAME ; int CImagingConfigManager::GetImageQualitySet(class TImageQualitySet &, class TSize const &, unsigned int)
+	?GetImageQualitySet@CImagingConfigManager@@QAEHAAVTImageQualitySet@@HI@Z @ 4 NONAME ; int CImagingConfigManager::GetImageQualitySet(class TImageQualitySet &, int, unsigned int)
+	?GetVideoQualityLevelsL@CImagingConfigManager@@QAEHAAV?$CArrayFixFlat@I@@I@Z @ 5 NONAME ; int CImagingConfigManager::GetVideoQualityLevelsL(class CArrayFixFlat<unsigned int> &, unsigned int)
+	?GetVideoQualitySet@CImagingConfigManager@@QAEHAAVTVideoQualitySet@@ABVTSize@@ABVTDesC8@@IIVTFourCC@@I@Z @ 6 NONAME ; int CImagingConfigManager::GetVideoQualitySet(class TVideoQualitySet &, class TSize const &, class TDesC8 const &, unsigned int, unsigned int, class TFourCC, unsigned int)
+	?GetVideoQualitySet@CImagingConfigManager@@QAEHAAVTVideoQualitySet@@HI@Z @ 7 NONAME ; int CImagingConfigManager::GetVideoQualitySet(class TVideoQualitySet &, int, unsigned int)
+	?NewL@CImagingConfigManager@@SAPAV1@XZ @ 8 NONAME ; class CImagingConfigManager * CImagingConfigManager::NewL(void)
+	?NewLC@CImagingConfigManager@@SAPAV1@XZ @ 9 NONAME ; class CImagingConfigManager * CImagingConfigManager::NewLC(void)
+	?NumberOfImageQualityLevels@CImagingConfigManager@@QBEHXZ @ 10 NONAME ; int CImagingConfigManager::NumberOfImageQualityLevels(void) const
+	?NumberOfVideoQualityLevels@CImagingConfigManager@@QBEHXZ @ 11 NONAME ; int CImagingConfigManager::NumberOfVideoQualityLevels(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/EABI/imagingconfigmanagerU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,15 @@
+EXPORTS
+	_ZN21CImagingConfigManager18GetImageQualitySetER16TImageQualitySetRK5TSizej @ 1 NONAME
+	_ZN21CImagingConfigManager18GetImageQualitySetER16TImageQualitySetij @ 2 NONAME
+	_ZN21CImagingConfigManager18GetVideoQualitySetER16TVideoQualitySetRK5TSizeRK6TDesC8jj7TFourCCj @ 3 NONAME
+	_ZN21CImagingConfigManager18GetVideoQualitySetER16TVideoQualitySetij @ 4 NONAME
+	_ZN21CImagingConfigManager22GetImageQualityLevelsLER13CArrayFixFlatIjEj @ 5 NONAME
+	_ZN21CImagingConfigManager22GetVideoQualityLevelsLER13CArrayFixFlatIjEj @ 6 NONAME
+	_ZN21CImagingConfigManager4NewLEv @ 7 NONAME
+	_ZN21CImagingConfigManager5NewLCEv @ 8 NONAME
+	_ZNK21CImagingConfigManager26NumberOfImageQualityLevelsEv @ 9 NONAME
+	_ZNK21CImagingConfigManager26NumberOfVideoQualityLevelsEv @ 10 NONAME
+	_ZNK21CImagingConfigManager29GetCamcorderMMFPluginSettingsER27TCamcorderMMFPluginSettings @ 11 NONAME
+	_ZTI21CImagingConfigManager @ 12 NONAME ; #<TI>#
+	_ZTV21CImagingConfigManager @ 13 NONAME ; #<VT>#
+
Binary file configmanagers/imagingconfigmanager/cenrep/keys_imagingconfigmanager.xls has changed
Binary file configmanagers/imagingconfigmanager/conf/imagingconfigmanager.confml has changed
Binary file configmanagers/imagingconfigmanager/conf/imagingconfigmanager_10282EDC.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Imaging Configuration
+*                Manager
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../conf/imagingconfigmanager.confml        MW_LAYER_CONFML(imagingconfigmanager.confml)
+../conf/imagingconfigmanager_10282EDC.crml MW_LAYER_CRML(imagingconfigmanager_10282EDC.crml)
+
+../rom/imagingconfigmanagerstub.SIS /epoc32/data/z/system/install/imagingconfigmanagerstub.sis
+
+../rom/imagingconfigmanager.iby CORE_MW_LAYER_IBY_EXPORT_PATH(imagingconfigmanager.iby)
+
+PRJ_MMPFILES
+imagingconfigmanager.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/group/imagingconfigmanager.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*    Configuration manager using Central Repositary for retrieving settings
+*    for clients such as CamcorderMMFPlugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          imagingconfigmanager.dll
+TARGETTYPE      dll
+DEFFILE         imagingconfigmanager.DEF
+
+UID             0x1000008d 0x10282EDB   //KSharedLibraryUid
+VENDORID        VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+
+SOURCEPATH      ../src
+SOURCE          imagingconfigmanager.cpp
+
+USERINCLUDE     ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Symbian OS libraries
+LIBRARY     euser.lib
+LIBRARY     centralrepository.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/inc/icmcenrepkeys.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Imaging Configuration Manager Private CenRep keys
+*
+*/
+
+
+#ifndef ICMCENREPKEYS_H
+#define ICMCENREPKEYS_H
+
+// Imaging Configuration Manager API
+
+const TUid KCRUidImagingConfigManager = { 0x10282EDC };
+
+// The following values are mainly for reference as they are actually parsed
+// dynamically according to
+// S60_3_2_Imaging_Configuration_Manager_Central_Repository_Guidance_C.doc
+
+const TUint32 KICMVideoQualitySet001         = 0x00010001;
+const TUint32 KICMVideoQualitySet002         = 0x00010002;
+const TUint32 KICMVideoQualitySet003         = 0x00010003;
+// etc...
+
+const TUint32 KICMCamcorderMMFPluginSettings = 0x00020001;
+
+const TUint32 KICMImageQualitySet001         = 0x00030001;
+const TUint32 KICMImageQualitySet002         = 0x00030002;
+const TUint32 KICMImageQualitySet003         = 0x00030003;
+// etc...
+
+#endif      // ICMCENREPKAYS_H
+          
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/rom/imagingconfigmanager.iby	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Iby file for Imaging Congifuration Manager
+*
+*/
+
+
+#ifndef __IMAGINGCONFIGMANAGER_IBY__
+#define __IMAGINGCONFIGMANAGER_IBY__
+
+// Imaging Configuration Manager
+file=ABI_DIR\BUILD_DIR\IMAGINGCONFIGMANAGER.DLL		SHARED_LIB_DIR\IMAGINGCONFIGMANAGER.DLL
+
+//data=ZSYSTEM\install\imagingconfigmanagerstub.sis   system\install\imagingconfigmanagerstub.sis
+
+#endif
Binary file configmanagers/imagingconfigmanager/rom/imagingconfigmanagerstub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/rom/imagingconfigmanagerstub.pkg	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,35 @@
+;
+; Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:  Package file for project imagingconfigmanager
+;
+
+; Languages
+&EN
+
+; Header
+#{"imagingconfigmanager"}, (0x10282EDB), 1, 0, 0
+
+;Supports Series 60 v 3.0
+;[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\imagingconfigmanager.dll"
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/src/imagingconfigmanager.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1027 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Configuration manager using Central Repositary for retrieving
+*                settings for clients such as CamcorderMMFPlugin
+*
+*/
+
+
+#include <centralrepository.h>
+#include "imagingconfigmanager.h"
+#include "icmcenrepkeys.h"
+
+/*
+* These constant literals are used for parsing the Central Repository strings
+*
+*/
+_LIT( KPeriod, "." );
+
+_LIT( KComma, "," );
+_LIT( KQualitySetLevel, "QualitySetLevel" );
+_LIT( KVideoFileMimeType, "VideoFileMimeType" );
+_LIT( KVideoCodecMimeType, "VideoCodecMimeType" );
+_LIT( KVideoWidth, "VideoWidth" );
+_LIT( KVideoHeight, "VideoHeight" );
+_LIT( KVideoFrameRate, "VideoFrameRate" );
+_LIT( KVideoBitRate, "VideoBitRate" );
+_LIT( KVideoEncoderUID, "VideoEncoderUID=0" ); // "=0" there is a way to
+                                             // ignore the "0x" from the
+                                             // beginning of hex-number
+_LIT( KRandomAccessRate, "RandomAccessRate" );
+_LIT( KVideoPixelAspectRatioNum, "VideoPixelAspectRatioNum" );
+_LIT( KVideoPixelAspectRatioDenom, "VideoPixelAspectRatioDenom" );
+_LIT( KPreferredSupplier, "PreferredSupplier" );
+_LIT( KAudioFourCCType, "AudioFourCCType" );
+_LIT( KAudioBitrate, "AudioBitrate" );
+_LIT( KAudioSamplingRate, "AudioSamplingRate" );
+_LIT( KAudioChannels, "AudioChannels" );
+_LIT( KAudioEncoderUID, "AudioEncoderUID=0" ); // "=0" there is a way to
+                                             // ignore the "0x" from the
+                                             // beginning of hex-number
+_LIT( KAVSyncStartDelay, "AVSyncStartDelay" );
+_LIT( KAVSyncResumeDelay, "AVSyncResumeDelay" );
+_LIT( KCameraDisplayId, "CameraDisplayId" );
+_LIT( KCamcorderVisible, "CamcorderVisible" );
+_LIT( KVideoNightFrameRate, "VideoNightFrameRate" );
+_LIT( KCMRAvgVideoBitRateScaler, "CMRAvgVideoBitRateScaler" );
+_LIT( KVideoComplexitySetting, "VideoComplexitySetting" );
+_LIT( KCMRLatencyQualityTradeoff, "CMRLatencyQualityTradeoff" );
+_LIT( KCMRPictureQuality, "CMRPictureQuality" );
+_LIT( KCMRQualityTemporalTradeoff, "CMRQualityTemporalTradeoff" );
+_LIT( KCMRNumCameraBuffers, "CMRNumCameraBuffers" );
+_LIT( KCMRNumCameraBuffersARM, "CMRNumCameraBuffersARM" );
+_LIT( KCMRMinNumOutputBuffers, "CMRMinNumOutputBuffers" );
+_LIT( KImageFileMimeType, "ImageFileMimeType" );
+_LIT( KImageWidth, "ImageWidth" );
+_LIT( KImageHeight, "ImageHeight" );
+_LIT( KImageFileExtension, "ImageFileExtension" );
+_LIT( KImageEncoderUID, "ImageEncoderUID=0" ); // "=0" there is a way to
+                                             // ignore the "0x" from the
+                                             // beginning of hex-number
+_LIT( KCompressionQuality, "CompressionQuality" );
+_LIT( KEstimatedSize, "EstimatedSize" );
+
+// Constants used in Central Repository parsing and granularity
+const TInt KGranularity = 1;
+const TUint32 KRowMask = 0xFFFF0000;
+const TUint32 KRowVideo = 1 << 16;  // VideoQualitySets' offset
+const TUint32 KRowCCor = 2 << 16;   // CamcorderMMFPluginSettings' offset
+const TUint32 KRowImage = 3 << 16;  // ImageQualitySets' offset
+const TText8 KZero = '\0';          // null-termination mark of strings
+const TInt KInitBufSize = 1;        // Initial size of reserved buffer
+const TInt KUndefined = -1;         // used as initial undefined value
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor of CImagingConfigManager
+// ---------------------------------------------------------------------------
+//
+CImagingConfigManager::CImagingConfigManager()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor of CImagingConfigManager
+// ---------------------------------------------------------------------------
+//
+CImagingConfigManager::~CImagingConfigManager()
+    {
+    if( iVideoQualitySets )
+        {
+        iVideoQualitySets->Reset();
+        delete iVideoQualitySets;
+        }
+    if( iImageQualitySets )
+        {
+        iImageQualitySets->Reset();
+        delete iImageQualitySets;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL() of CImagingConfigManager
+// ---------------------------------------------------------------------------
+//
+void CImagingConfigManager::ConstructL()
+    {
+    RArray< TUint32 > foundCols; // This is used for fetching the columns of
+                                 // data from Central Repository
+    TInt buffersize = KInitBufSize; // buffer variable's size
+    HBufC* buffer = NULL;        // Common buffer to be used for temporary
+                                 // storage for reads from Central Repository
+    TInt keyCount;               // Number of keys found from CenRep
+    TUint uidtemp = 0;           // Temp TUint storage for UIDs
+
+    // Create the repository
+    CRepository *repository = CRepository::NewLC( KCRUidImagingConfigManager );
+
+    // Alloc quality sets
+    iVideoQualitySets =
+            new ( ELeave ) CArrayFixFlat< TVideoQualitySet >( KGranularity );
+    iImageQualitySets =
+            new ( ELeave ) CArrayFixFlat< TImageQualitySet >( KGranularity );
+    
+    // Find video quality setting sets by using the KRowMask
+    User::LeaveIfError( repository->FindL( KRowVideo, KRowMask, foundCols ) );
+
+    buffer = HBufC::NewLC( buffersize );
+    keyCount = foundCols.Count();
+    
+    // For each key, parse the settings into the TVideoQualitySet
+    for ( TInt i = 0 ; i < keyCount ; i++ )
+        {
+        TVideoQualitySet tmpVideoQualitySet;
+        TPtr ptr = buffer->Des();
+        buffersize = 0;
+        // String with settings is fetched from CenRep
+        TInt ret = repository->Get( foundCols[ i ], ptr, buffersize );
+        // KErrOverFlow is returned if and when 1 is not big enough size
+        // for buffer
+        if ( ret == KErrOverflow )
+            {
+            // More space is reserved
+            CleanupStack::PopAndDestroy(); // buffer
+            buffer = HBufC::NewLC( buffersize );
+            ptr.Set( buffer->Des() );
+            User::LeaveIfError( repository->Get( foundCols[ i ], ptr ) );
+            }
+        else
+            {
+            User::LeaveIfError( ret );
+            }
+        // Fetched string is parsed right and left and the value is stored
+        // to suitable form into the TVideoQualitySet
+        TPtrC temp = GetRightPartL( ptr, KQualitySetLevel() );
+        TLex lextemp = GetLeftPart( temp );
+        TBuf<1024> treal;
+        User::LeaveIfError( lextemp.Val(
+                    tmpVideoQualitySet.iVideoQualitySetLevel, EDecimal ) );
+        
+        temp.Set( GetRightPartL( ptr, KVideoFileMimeType() ) );
+        temp.Set( GetLeftPart( temp ) );
+        SetTextStringL( temp, tmpVideoQualitySet.iVideoFileMimeType );
+        
+        temp.Set( GetRightPartL( ptr, KVideoCodecMimeType() ) );
+        temp.Set( GetLeftPart( temp ) );
+        SetTextStringL( temp, tmpVideoQualitySet.iVideoCodecMimeType );
+        
+        temp.Set( GetRightPartL( ptr, KVideoWidth() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iVideoWidth ) );
+        
+        temp.Set( GetRightPartL( ptr, KVideoHeight() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iVideoHeight ) );
+        
+        temp.Set( GetRightPartL( ptr, KVideoFrameRate() ) );
+        temp.Set( GetLeftPart( temp ) );
+        treal = temp;
+        TLocale tlocale;
+        TChar ch = tlocale.DecimalSeparator();
+        if( temp.Find( KPeriod ) >= 0 )
+            {
+            treal[temp.Find( KPeriod )] = ch;
+            }
+        lextemp = treal;
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iVideoFrameRate ) );
+        
+        temp.Set( GetRightPartL( ptr, KVideoBitRate() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iVideoBitRate ) );
+        
+        temp.Set( GetRightPartL( ptr, KVideoEncoderUID() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( uidtemp, EHex ) );
+        tmpVideoQualitySet.iVideoEncoderUID.iUid = uidtemp;
+        
+        temp.Set( GetRightPartL( ptr, KRandomAccessRate() ) );
+        temp.Set( GetLeftPart( temp ) );
+        treal = temp;
+        if( temp.Find( KPeriod ) >= 0 )
+            {
+            treal[temp.Find( KPeriod )] = ch;
+            }
+        lextemp = treal;
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iRandomAccessRate ) );
+        
+        temp.Set( GetRightPartL( ptr, KVideoPixelAspectRatioNum() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val(
+                    tmpVideoQualitySet.iVideoPixelAspectRatioNum ) );
+        
+        temp.Set( GetRightPartL( ptr, KVideoPixelAspectRatioDenom() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val(
+                    tmpVideoQualitySet.iVideoPixelAspectRatioDenom ) );
+        
+        temp.Set( GetRightPartL( ptr, KPreferredSupplier() ) );
+        temp.Set( GetLeftPart( temp ) );
+        SetTextStringL( temp, tmpVideoQualitySet.iPreferredSupplier );
+        
+        temp.Set( GetRightPartL( ptr, KAudioFourCCType() ) );
+        temp.Set( GetLeftPart( temp ) );
+        TBuf8<4> fourccbuf8;
+        fourccbuf8.Copy(temp);
+        tmpVideoQualitySet.iAudioFourCCType.Set(fourccbuf8);
+        
+        TUint32 intti = tmpVideoQualitySet.iAudioFourCCType.FourCC();
+        
+        temp.Set( GetRightPartL( ptr, KAudioBitrate() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iAudioBitRate ) );
+        
+        temp.Set( GetRightPartL( ptr, KAudioSamplingRate() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val(
+                    tmpVideoQualitySet.iAudioSamplingRate ) );
+        
+        temp.Set( GetRightPartL( ptr, KAudioChannels() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iAudioChannels ) );
+        
+        temp.Set( GetRightPartL( ptr, KAudioEncoderUID() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( uidtemp, EHex ) );
+        tmpVideoQualitySet.iAudioEncoderUID.iUid = uidtemp;
+        
+        temp.Set( GetRightPartL( ptr, KAVSyncStartDelay() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iAVSyncStartDelay ) );
+        
+        temp.Set( GetRightPartL( ptr, KAVSyncResumeDelay() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val(
+                    tmpVideoQualitySet.iAVSyncResumeDelay ) );
+        
+        temp.Set( GetRightPartL( ptr, KCameraDisplayId() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iCameraDisplayId ) );
+        
+        temp.Set( GetRightPartL( ptr, KCamcorderVisible() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpVideoQualitySet.iCamcorderVisible ) );
+        
+        iVideoQualitySets->AppendL( tmpVideoQualitySet );
+        }
+
+    for( TInt i = foundCols.Count() - 1 ; i >= 0 ; i-- )
+        {
+        foundCols.Remove( i );
+        }
+    User::LeaveIfError( repository->FindL( KRowCCor, KRowMask, foundCols ) );
+    keyCount = foundCols.Count();
+    for ( TInt i = 0 ; i < keyCount ; i++ )
+        {
+        TPtr ptr = buffer->Des();
+        buffersize = 0;
+        TInt ret = repository->Get( foundCols[ i ], ptr, buffersize );
+        if ( ret == KErrOverflow )
+            {
+            CleanupStack::PopAndDestroy(); // buffer
+            buffer = HBufC::NewLC( buffersize );
+            ptr.Set( buffer->Des() );
+            User::LeaveIfError( repository->Get( foundCols[ i ], ptr ) );
+            }
+        else if( ret != KErrNone )
+            {
+            User::LeaveIfError( ret );
+            }
+        else
+            {
+            }
+        
+        TBuf<1024> treal;    
+        TPtrC temp = GetRightPartL( ptr, KVideoNightFrameRate() );
+        temp.Set( GetLeftPart( temp ) );
+        treal = temp;
+        TLocale tlocale;
+        TChar ch = tlocale.DecimalSeparator();
+        if( temp.Find( KPeriod ) >= 0 )
+            {
+            treal[temp.Find( KPeriod )] = ch;
+            }
+        TLex lextemp(treal);
+        User::LeaveIfError( lextemp.Val(
+                    iCamcorderMMFPluginSettings.iVideoNightFrameRate ) );
+        
+        temp.Set( GetRightPartL( ptr, KCMRAvgVideoBitRateScaler() ) );
+        temp.Set( GetLeftPart( temp ) );
+        treal = temp;
+        if( temp.Find( KPeriod ) >= 0 )
+            {
+            treal[temp.Find( KPeriod )] = ch;
+            }
+        lextemp = treal;
+        User::LeaveIfError( lextemp.Val(
+                    iCamcorderMMFPluginSettings.iCMRAvgVideoBitRateScaler ) );
+        
+        temp.Set( GetRightPartL(ptr, KVideoComplexitySetting() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val(
+                    iCamcorderMMFPluginSettings.iVideoComplexitySetting ) );
+        
+        temp.Set( GetRightPartL( ptr, KCMRLatencyQualityTradeoff() ) );
+        temp.Set( GetLeftPart( temp ) );
+        treal = temp;
+        if( temp.Find( KPeriod ) >= 0 )
+            {
+            treal[temp.Find( KPeriod )] = ch;
+            }
+        lextemp = treal;
+        User::LeaveIfError( lextemp.Val(
+                    iCamcorderMMFPluginSettings.iCMRLatencyQualityTradeoff ) );
+        
+        temp.Set( GetRightPartL( ptr, KCMRPictureQuality() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val(
+                    iCamcorderMMFPluginSettings.iCMRPictureQuality ) );
+        
+        temp.Set( GetRightPartL( ptr, KCMRQualityTemporalTradeoff() ) );
+        temp.Set( GetLeftPart( temp ) );
+        treal = temp;
+        if( temp.Find( KPeriod ) >= 0 )
+            {
+            treal[temp.Find( KPeriod )] = ch;
+            }
+        lextemp = treal;
+        User::LeaveIfError( lextemp.Val(
+                    iCamcorderMMFPluginSettings.iCMRQualityTemporalTradeoff ) );
+        
+        if(ptr.Find(KCMRNumCameraBuffers()) >= 0)
+            {
+            temp.Set( GetRightPartL( ptr, KCMRNumCameraBuffers() ) );
+            lextemp = GetLeftPart( temp );
+            User::LeaveIfError( lextemp.Val(
+                        iCamcorderMMFPluginSettings.iCMRNumCameraBuffers ) );
+            
+            temp.Set( GetRightPartL( ptr, KCMRNumCameraBuffersARM() ) );
+            lextemp = GetLeftPart( temp );
+            User::LeaveIfError( lextemp.Val(
+                        iCamcorderMMFPluginSettings.iCMRNumCameraBuffersARM ) );
+            
+            temp.Set( GetRightPartL( ptr, KCMRMinNumOutputBuffers() ) );
+            lextemp = GetLeftPart( temp );
+            User::LeaveIfError( lextemp.Val(
+                        iCamcorderMMFPluginSettings.iCMRMinNumOutputBuffers ) );
+            }
+        else
+            {
+            // To ensure backwards compatibility we give these three new
+            // settings default values of 2, 1 and 4 respectively according
+            // to old implementation in MMFPlug-in
+            iCamcorderMMFPluginSettings.iCMRNumCameraBuffers = 2;
+            iCamcorderMMFPluginSettings.iCMRNumCameraBuffersARM = 1;
+            iCamcorderMMFPluginSettings.iCMRMinNumOutputBuffers = 4;
+            }
+        }
+
+    for( TInt i = foundCols.Count() - 1 ; i >= 0 ; i-- )
+        {
+        foundCols.Remove( i );
+        }
+    User::LeaveIfError( repository->FindL( KRowImage, KRowMask, foundCols ) );
+    keyCount = foundCols.Count();
+    for (TInt i = 0 ; i < keyCount ; i++)
+        {
+        TPtr ptr = buffer->Des();
+        buffersize = 0;
+        TInt ret = repository->Get( foundCols[ i ], ptr, buffersize );
+        if ( ret == KErrOverflow )
+            {
+            CleanupStack::PopAndDestroy(); // buffer
+            buffer = HBufC::NewLC( buffersize );
+            ptr.Set( buffer->Des() );
+            User::LeaveIfError( repository->Get( foundCols[ i ], ptr ) );
+            }
+        else if( ret != KErrNone )
+            {
+            User::LeaveIfError( ret );
+            }
+        else
+            {
+            }
+
+        TImageQualitySet tmpImageQualitySet;
+
+        TPtrC temp = GetRightPartL( ptr, KQualitySetLevel() );
+        TLex lextemp( GetLeftPart( temp ) );
+        User::LeaveIfError( lextemp.Val( tmpImageQualitySet.iImageQualitySetLevel,
+                                       EDecimal ) );
+
+        temp.Set( GetRightPartL( ptr, KImageFileMimeType() ) );
+        temp.Set( GetLeftPart( temp ) );
+        SetTextStringL( temp, tmpImageQualitySet.iImageFileMimeType );
+
+        temp.Set( GetRightPartL( ptr, KImageWidth() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpImageQualitySet.iImageWidth ) );
+
+        temp.Set( GetRightPartL( ptr, KImageHeight() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpImageQualitySet.iImageHeight ) );
+
+        temp.Set( GetRightPartL( ptr, KImageFileExtension() ) );
+        temp.Set( GetLeftPart( temp ) );
+        SetTextStringL( temp, tmpImageQualitySet.iImageFileExtension );
+
+        temp.Set( GetRightPartL( ptr, KImageEncoderUID() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( uidtemp, EHex ) );
+        tmpImageQualitySet.iImageEncoderUID.iUid = uidtemp;
+        
+        temp.Set( GetRightPartL( ptr, KCompressionQuality() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpImageQualitySet.iCompressionQuality ) );
+
+        temp.Set( GetRightPartL( ptr, KEstimatedSize() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpImageQualitySet.iEstimatedSize ) );
+        
+        temp.Set( GetRightPartL( ptr, KCameraDisplayId() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpImageQualitySet.iCameraDisplayId ) );
+        
+        temp.Set( GetRightPartL( ptr, KCamcorderVisible() ) );
+        lextemp = GetLeftPart( temp );
+        User::LeaveIfError( lextemp.Val( tmpImageQualitySet.iCamcorderVisible ) );
+        
+        iImageQualitySets->AppendL( tmpImageQualitySet );
+        }
+
+    foundCols.Close();
+    CleanupStack::PopAndDestroy(); // buffer
+    CleanupStack::PopAndDestroy( repository );
+    }
+
+// ---------------------------------------------------------------------------
+// CheckIfNegative( TInt aValue ) of CImagingConfigManager, private method
+// ---------------------------------------------------------------------------
+//
+TBool CImagingConfigManager::CheckIfNegative( const TInt aValue ) const
+    {
+    TBool retval = EFalse;
+    if( aValue < 0 )
+        {
+        retval = ETrue;
+        }
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// GetRightPartL( TPtr aPtr, const TDesC& aSearchable ) of 
+// CImagingConfigManager, private method
+// ---------------------------------------------------------------------------
+//
+TPtrC CImagingConfigManager::GetRightPartL( const TPtr& aPtr,
+                                            const TDesC& aSearchable ) const
+    {
+    // First verify the values so that we know if they aren't legal
+    if( CheckIfNegative( aPtr.Find( aSearchable ) ) ||
+        CheckIfNegative( ( ( aPtr.Length() -
+                             aPtr.Find( aSearchable ) ) -
+                           aSearchable.Length() ) - 1 ) )
+        {
+        User::Leave( KErrGeneral );
+        }
+    return aPtr.Right( ( ( aPtr.Length() -
+                           aPtr.Find( aSearchable ) ) -
+                         aSearchable.Length() ) - 1 );
+    }
+
+// ---------------------------------------------------------------------------
+// GetLeftPartL( TPtrC aPtrc ) of CImagingConfigManager, private method
+// ---------------------------------------------------------------------------
+//
+TPtrC CImagingConfigManager::GetLeftPart( const TPtrC& aPtrc ) const
+    {
+    if( CheckIfNegative( aPtrc.Find( KComma ) ) )
+        {
+        return aPtrc;
+        }
+    return aPtrc.Left( aPtrc.Find( KComma ) );
+    }
+
+// ---------------------------------------------------------------------------
+// SetTextStringL( TPtrC& aPtr, TText8& aStringToFill ) of
+// CImagingConfigManager,private method
+// ---------------------------------------------------------------------------
+//
+void CImagingConfigManager::SetTextStringL( const TPtrC& aPtr,
+                                            TText8* aStringToFill ) const
+    {
+    if( static_cast< TUint >( aPtr.Length() ) > KMaxStringLength )
+        {
+        User::Leave( KErrOverflow );
+        }
+    if( aStringToFill == NULL )
+        {
+        User::Leave( KErrGeneral );
+        }
+    for( TInt j = 0 ; j < aPtr.Length() ; j++ )
+        {
+        aStringToFill[ j ] = ( aPtr[ j ] & 0xff);
+        }
+    for( TUint j = aPtr.Length() ; j < KMaxStringLength ; j++ )
+        {
+        aStringToFill[ j ] = KZero;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// NewL() of CImagingConfigManager
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImagingConfigManager* CImagingConfigManager::NewL()
+    {
+    CImagingConfigManager* self = CImagingConfigManager::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NelLC() of CImagingConfigManager
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImagingConfigManager* CImagingConfigManager::NewLC()
+    {
+    CImagingConfigManager* self = new( ELeave ) CImagingConfigManager;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Get number of defined video quality levels. This is always at least
+// KNumberOfNominalLevels but can be higher
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::NumberOfVideoQualityLevels() const
+    {
+    TInt retval = 0;
+    if( iVideoQualitySets )
+        {
+        retval = iVideoQualitySets->Count();
+        }
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// Get an array of video quality levels that are in use with the current
+// product with given Camera/Display ID. If the ID is zero, then all levels
+// dispite of the ID value are returned.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::GetVideoQualityLevelsL(
+                                        CArrayFixFlat<TUint>& aLevels,
+                                        TUint aCameraDisplayID )
+    {
+    TKeyArrayFix key(0,ECmpTUint);
+    aLevels.Reset();
+    // We know the total size beforehand so reserve all the space at once
+    aLevels.SetReserveL( iVideoQualitySets->Count() );
+    for( TInt i = 0 ; i < iVideoQualitySets->Count() ; i++ )
+        {
+        if( aCameraDisplayID == 0 ||
+            iVideoQualitySets->At( i ).iCameraDisplayId == aCameraDisplayID )
+            {
+            aLevels.AppendL(
+                iVideoQualitySets->At( i ).iVideoQualitySetLevel );
+            }
+        }
+    User::LeaveIfError(aLevels.Sort(key));
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Get video quality set associated with the given level and Camera/Display ID
+// if it is nonzero. If the ID is zero, smallest matching ID set is returned.
+// If there is no set associated with given intermediate
+// level, then set from a nearest nominal level is returned (dividable by
+// KBasicQualityGranularity).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::GetVideoQualitySet(
+                                        TVideoQualitySet& aSet,
+                                        TInt aLevel,
+                                        TUint aCameraDisplayID )
+    {
+    for( TUint i = 0 ; i < KMaxStringLength ; i++ )
+        {
+        aSet.iVideoFileMimeType[ i ] = NULL;
+        aSet.iVideoCodecMimeType[ i ] = NULL;
+        aSet.iPreferredSupplier[ i ] = NULL;
+        }
+    aSet.iVideoQualitySetLevel = 0;
+    aSet.iVideoWidth = 0;
+    aSet.iVideoHeight = 0;
+    aSet.iVideoFrameRate = 0.0;
+    aSet.iVideoBitRate = 0;
+    aSet.iVideoEncoderUID.iUid = 0;
+    aSet.iRandomAccessRate = 0;
+    aSet.iVideoPixelAspectRatioNum = 0;
+    aSet.iVideoPixelAspectRatioDenom = 0;
+    aSet.iAudioFourCCType = 0;
+    aSet.iAudioBitRate = 0;
+    aSet.iAudioSamplingRate = 0;
+    aSet.iAudioChannels = 0;
+    aSet.iAudioEncoderUID.iUid = 0;
+    aSet.iAVSyncStartDelay = 0;
+    aSet.iAVSyncResumeDelay = 0;
+    aSet.iCameraDisplayId = 0;
+    aSet.iCamcorderVisible = 0;
+    
+    TInt diff; // This is used to get the nearest nominal level if the exact
+               // level isn't available
+    TInt min = KMaxTInt; // set to as big number as possible initially
+    TInt minIndex = KUndefined;
+    TBool paramSet = EFalse;
+    TUint smallestCameraDisplayID = KMaxTUint;
+    
+    for( TInt i = 0 ;
+         i < iVideoQualitySets->Count() && aCameraDisplayID == 0 ;
+         i++ )
+        {
+        if(iVideoQualitySets->At( i ).iCameraDisplayId < smallestCameraDisplayID)
+            {
+            smallestCameraDisplayID =
+               iVideoQualitySets->At( i ).iCameraDisplayId;
+            }
+        }
+
+    for( TInt i = 0 ; i < iVideoQualitySets->Count() && paramSet == EFalse ; i++ )
+        {
+        if( ( aCameraDisplayID == 0 &&
+              iVideoQualitySets->At( i ).iCameraDisplayId ==
+                   smallestCameraDisplayID ) ||
+            iVideoQualitySets->At( i ).iCameraDisplayId == aCameraDisplayID )
+            {
+            if( iVideoQualitySets->At( i ).iVideoQualitySetLevel == aLevel )
+                {
+                aSet = iVideoQualitySets->At( i );
+                paramSet = ETrue;
+                }
+            else
+                {
+                diff = iVideoQualitySets->At( i ).iVideoQualitySetLevel - aLevel;
+                if( static_cast< TInt >(
+                       iVideoQualitySets->At( i ).iVideoQualitySetLevel )
+                       < aLevel )
+                    {
+                    diff = - diff;
+                    }
+                if( min > diff )
+                    {
+                    min = diff;
+                    minIndex = i;
+                    }
+                else if( min == diff && i > minIndex )
+                    {
+                    //If the difference is the same between two sets from the
+                    //asked set, let's take the bigger one. Eg. 101 over 99
+                    //if 100 was asked, but isn't present
+                    minIndex = i;
+                    }
+                }
+            }
+        }
+    if( minIndex != KUndefined && paramSet == EFalse )
+        {
+        aSet = iVideoQualitySets->At( minIndex );
+        }
+    else
+        {
+        return KErrGeneral; // No Quality sets were read from CenRep
+        }
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Get quality set associated with the given video resolution, its MIME-type,
+// audio fourCC and Camera/Display ID (which can be zero for all possible ID
+// values). All of these are needed to be uniquely able to select
+// a single quality setting set. If certain pixel aspect ratio is wanted for
+// the video, it can be requested with aVideoPixelAspectRatioNum and
+// aVideoPixelAspectRatioDenom parameters. Otherwise they should be set to
+// zero.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::GetVideoQualitySet(
+                                    TVideoQualitySet& aSet,
+                                    const TSize& aVideoResolution,
+                                    const TDesC8& aVideoCodecMimeType,
+                                    TUint aVideoPixelAspectRatioNum,
+                                    TUint aVideoPixelAspectRatioDenom,
+                                    TFourCC aAudioFourCCType,
+                                    TUint aCameraDisplayID )
+    {
+    for( TUint i = 0 ; i < KMaxStringLength ; i++ )
+        {
+        aSet.iVideoFileMimeType[ i ] = NULL;
+        aSet.iVideoCodecMimeType[ i ] = NULL;
+        aSet.iPreferredSupplier[ i ] = NULL;
+        }
+    aSet.iVideoQualitySetLevel = 0;
+    aSet.iVideoWidth = 0;
+    aSet.iVideoHeight = 0;
+    aSet.iVideoFrameRate = 0.0;
+    aSet.iVideoBitRate = 0;
+    aSet.iVideoEncoderUID.iUid = 0;
+    aSet.iRandomAccessRate = 0;
+    aSet.iVideoPixelAspectRatioNum = 0;
+    aSet.iVideoPixelAspectRatioDenom = 0;
+    aSet.iAudioFourCCType = 0;
+    aSet.iAudioBitRate = 0;
+    aSet.iAudioSamplingRate = 0;
+    aSet.iAudioChannels = 0;
+    aSet.iAudioEncoderUID.iUid = 0;
+    aSet.iAVSyncStartDelay = 0;
+    aSet.iAVSyncResumeDelay = 0;
+    aSet.iCameraDisplayId = 0;
+    aSet.iCamcorderVisible = 0;
+    
+    TBool paramSet = EFalse;
+    TUint smallestCameraDisplayID = KMaxTUint;
+    
+    for( TInt i = 0 ;
+         i < iVideoQualitySets->Count() && aCameraDisplayID == 0 ;
+         i++ )
+        {
+        if(iVideoQualitySets->At( i ).iCameraDisplayId < smallestCameraDisplayID)
+            {
+            smallestCameraDisplayID =
+               iVideoQualitySets->At( i ).iCameraDisplayId;
+            }
+        }
+    
+    for( TInt i = 0 ;
+         i < iVideoQualitySets->Count() && paramSet == EFalse ;
+         i++ )
+        {
+        // videoCodecMimeTypeLength & audioFourCCTypeLength are used with
+        // memcompare to compare strings
+        TUint videoCodecMimeTypeLength = KMaxStringLength;
+        for( TUint j = 0 ;
+             j < KMaxStringLength &&
+             videoCodecMimeTypeLength == KMaxStringLength ;
+             j++ )
+            {
+            if( iVideoQualitySets->At( i ).iVideoCodecMimeType[ j ] == KZero )
+                {
+                videoCodecMimeTypeLength = j;
+                }
+            }
+
+        // Check that all given parameters match with the current set
+        if( iVideoQualitySets->At( i ).iVideoWidth ==
+                aVideoResolution.iWidth &&
+            iVideoQualitySets->At( i ).iVideoHeight ==
+                aVideoResolution.iHeight &&
+           memcompare( iVideoQualitySets->At( i ).iVideoCodecMimeType,
+                videoCodecMimeTypeLength,
+                aVideoCodecMimeType.Ptr(),
+                aVideoCodecMimeType.Length() ) == 0 &&
+           (iVideoQualitySets->At( i ).iAudioFourCCType.FourCC() == aAudioFourCCType.FourCC() ) &&
+           ( ( aCameraDisplayID == 0 &&
+               iVideoQualitySets->At( i ).iCameraDisplayId ==
+                   smallestCameraDisplayID ) ||
+             iVideoQualitySets->At( i ).iCameraDisplayId == aCameraDisplayID ) )
+            {
+            if( aVideoPixelAspectRatioNum == 0 &&
+                aVideoPixelAspectRatioDenom == 0 )
+                {
+                aSet = iVideoQualitySets->At( i );
+                paramSet = ETrue;
+                }
+            else if( iVideoQualitySets->At( i ).iVideoPixelAspectRatioNum ==
+                        aVideoPixelAspectRatioNum &&
+                    iVideoQualitySets->At( i ).iVideoPixelAspectRatioDenom ==
+                        aVideoPixelAspectRatioDenom )
+                {
+                aSet = iVideoQualitySets->At( i );
+                paramSet = ETrue;
+                }
+            else
+                {
+                }
+            }
+        }
+    if(paramSet == EFalse)
+        {
+        return KErrGeneral;
+        }
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Get all settings for Camcorder
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::GetCamcorderMMFPluginSettings(
+                                TCamcorderMMFPluginSettings& aSet ) const
+    {
+    aSet = iCamcorderMMFPluginSettings;
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Get number of defined image quality levels. This is always at least
+// KNumberOfNominalLevels but can be higher
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::NumberOfImageQualityLevels() const
+    {
+    TInt retval = 0;
+    if( iImageQualitySets )
+    {
+        retval = iImageQualitySets->Count();
+    }
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// Get an array of image quality levels that are in use with the current
+// product with given Camera/Display ID. If the ID is zero, then all levels
+// dispite of the ID value are returned.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::GetImageQualityLevelsL(
+                                        CArrayFixFlat<TUint>& aLevels,
+                                        TUint aCameraDisplayID )
+    {
+    TKeyArrayFix key(0,ECmpTUint);
+    aLevels.Reset();
+    for( TInt i = 0 ; i < iImageQualitySets->Count() ; i++ )
+        {
+        if( aCameraDisplayID == 0 ||
+            iImageQualitySets->At( i ).iCameraDisplayId == aCameraDisplayID )
+            {
+            aLevels.AppendL(
+                iImageQualitySets->At( i ).iImageQualitySetLevel );
+            }
+        }
+    User::LeaveIfError(aLevels.Sort(key));
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Get image quality set associated with the given level and Camera/Display ID
+// if it is nonzero. If the ID is zero, smallest matching ID set is returned.
+// If there is no set associated with given intermediate
+// level, then set from a nearest level is returned (dividable by
+// KBasicQualityGranularity).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::GetImageQualitySet(
+                                        TImageQualitySet& aSet,
+                                        TInt aLevel,
+                                        TUint aCameraDisplayID )
+    {
+    for( TUint i = 0 ; i < KMaxStringLength ; i++ )
+        {
+        aSet.iImageFileMimeType[ i ] = NULL;
+        aSet.iImageFileExtension[ i ] = NULL;
+        }
+    aSet.iImageQualitySetLevel = 0;
+    aSet.iImageWidth = 0;
+    aSet.iImageHeight = 0;
+    aSet.iImageEncoderUID.iUid = 0;
+    aSet.iCompressionQuality = 0;
+    aSet.iEstimatedSize = 0;
+    aSet.iCameraDisplayId = 0;
+    aSet.iCamcorderVisible = 0;
+
+    TInt diff;
+    TInt min = KMaxTInt; // set to as big number as possible initially
+    TInt minIndex = KUndefined;
+    TBool paramSet = EFalse;
+    TUint smallestCameraDisplayID = KMaxTUint;
+    
+    for( TInt i = 0 ;
+         i < iImageQualitySets->Count() && aCameraDisplayID == 0 ;
+         i++ )
+        {
+        if(iImageQualitySets->At( i ).iCameraDisplayId < smallestCameraDisplayID)
+            {
+            smallestCameraDisplayID =
+               iImageQualitySets->At( i ).iCameraDisplayId;
+            }
+        }
+    
+    for( TInt i = 0 ; i < iImageQualitySets->Count() && paramSet == EFalse ; i++ )
+        {
+        if( ( aCameraDisplayID == 0 &&
+              iImageQualitySets->At( i ).iCameraDisplayId ==
+                   smallestCameraDisplayID ) ||
+            iImageQualitySets->At( i ).iCameraDisplayId == aCameraDisplayID )
+            {
+            if( iImageQualitySets->At( i ).iImageQualitySetLevel == aLevel )
+                {
+                aSet = iImageQualitySets->At( i );
+                paramSet = ETrue;
+                }
+            else
+                {
+                diff = iImageQualitySets->At( i ).iImageQualitySetLevel - aLevel;
+                if( static_cast< TInt >( iImageQualitySets->At( i ).iImageQualitySetLevel ) < aLevel )
+                    {
+                    diff = -diff;
+                    }
+                if( min > diff )
+                    {
+                    min = diff;
+                    minIndex = i;
+                    }
+                else if( min == diff && i > minIndex )
+                    {
+                    //If the difference is the same between two sets from the
+                    //asked set, let's take the bigger one. Eg. 101 over 99
+                    //if 100 was asked, but isn't present
+                    minIndex = i;
+                    }
+                }
+            }
+        }
+    if( minIndex != KUndefined && paramSet == EFalse )
+        {
+        aSet = iImageQualitySets->At( minIndex );
+        }
+    else
+        {
+        return KErrGeneral; // No Quality sets were read from CenRep
+        }
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Get quality set associated with the given image resolution and its
+// Camera/Display ID (which can be zero for all possible ID
+// values). All of these are needed to be uniquely able to select
+// a single quality setting set.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CImagingConfigManager::GetImageQualitySet(
+                    TImageQualitySet& aSet,
+                    const TSize& aImageResolution,
+                    TUint aCameraDisplayID )
+    {
+    for( TUint i = 0 ; i < KMaxStringLength ; i++ )
+        {
+        aSet.iImageFileMimeType[ i ] = NULL;
+        aSet.iImageFileExtension[ i ] = NULL;
+        }
+    aSet.iImageQualitySetLevel = 0;
+    aSet.iImageWidth = 0;
+    aSet.iImageHeight = 0;
+    aSet.iImageEncoderUID.iUid = 0;
+    aSet.iCompressionQuality = 0;
+    aSet.iEstimatedSize = 0;
+    aSet.iCameraDisplayId = 0;
+    aSet.iCamcorderVisible = 0;
+
+    TBool paramSet = EFalse;
+    TUint smallestCameraDisplayID = KMaxTUint;
+    
+    for( TInt i = 0 ;
+         i < iImageQualitySets->Count() && aCameraDisplayID == 0 ;
+         i++ )
+        {
+        if(iImageQualitySets->At( i ).iCameraDisplayId < smallestCameraDisplayID)
+            {
+            smallestCameraDisplayID =
+               iImageQualitySets->At( i ).iCameraDisplayId;
+            }
+        }
+    
+    for( TInt i = 0 ; i < iImageQualitySets->Count() && paramSet == EFalse; i++ )
+        {
+        if( iImageQualitySets->At( i ).iImageWidth ==
+            aImageResolution.iWidth &&
+            iImageQualitySets->At( i ).iImageHeight ==
+            aImageResolution.iHeight &&
+            ( ( aCameraDisplayID == 0 &&
+               iImageQualitySets->At( i ).iCameraDisplayId ==
+                   smallestCameraDisplayID ) ||
+              iImageQualitySets->At( i ).iCameraDisplayId == aCameraDisplayID ) )
+            {
+            aSet = iImageQualitySets->At( i );
+            paramSet = ETrue;
+            }
+        }
+    if(paramSet == EFalse)
+        {
+        return KErrGeneral;
+        }
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/Bmarm/ICMSTIFU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/Bwins/ICMSTIFU.DEF	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/EABI/ICMSTIFU.def	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/group/ICMSTIF.mmp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Imaging Configuration Manager
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          ICMSTIF.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+DEFFILE         ICMSTIF.def
+
+VENDORID        VID_DEFAULT
+
+CAPABILITY      CAP_GENERAL_DLL
+
+SOURCEPATH      ../src
+SOURCE          ICMSTIF.cpp
+
+USERINCLUDE     ../inc 
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         imagingconfigmanager.lib
+
+LANG            SC
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Imaging Configuration Manager
+*
+*/
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+ICMSTIF.mmp
+
+// Makefile for ATS manual runs
+//GNUMAKEFILE ICMTests_CreateATSTestDrop.make
+
+// Makefile for ATS automated scripts
+gnumakefile testcollector.mk
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/group/testcollector.mk	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  GNU Makefile that updates the ATS3 drop for a test set.
+#
+TESTTYPE=STIF
+DLLS=ICMSTIF.dll
+DLLDIR=..\$(TESTTYPE)_temp
+
+
+BUILD_DIR=\epoc32\RELEASE\$(PLATFORM)\$(CFG)
+
+UPDATE_BINARIES := $(foreach DLL, $(DLLS), \
+                   & xcopy /Q /Y /F "$(BUILD_DIR)\$(DLL)" "$(DLLDIR)")
+UPDATE_BINARIES := $(wordlist 2, 1000, $(UPDATE_BINARIES))
+
+
+
+# For these targets we shall not do anything.
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES FINAL SAVESPACE:
+
+# BLD target of this Makefile is executed after Symbian BLD target
+# so the binaries are ready.
+BLD: 
+	echo Preparing Test collection...
+	-mkdir "$(DLLDIR)" 2> NUL
+	$(UPDATE_BINARIES)
+
+# Clean the copied binaries from the ATS drop.
+CLEAN:
+	echo Cleaning Test collection...
+	-rd /s /q "$(DLLDIR)" 2> NUL
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/inc/ICMSTIF.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ICMSTIF test module.
+*
+*/
+
+
+
+#ifndef ICMSTIF_H
+#define ICMSTIF_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include "imagingconfigmanager.h"
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+// Function pointer related internal definitions
+// Hack around known GCC bug.
+#ifndef __GCC32__
+#define GETPTR
+#else
+#define GETPTR &
+#endif  
+#define ENTRY(str,func) {(TText*)L##str, GETPTR func}
+
+
+// Logging path
+_LIT( KICMSTIFLogPath, "\\logs\\testframework\\ICMSTIF\\" ); 
+// Log file
+_LIT( KICMSTIFLogFile, "ICMSTIF.txt" ); 
+
+// FORWARD DECLARATIONS
+class CICMSTIF;
+
+// DATA TYPES
+typedef TInt (CICMSTIF::* TestFunction)(TTestResult&);    
+
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText* iCaseName;
+        TestFunction iMethod;
+    };
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;    
+        TestFunction iMethod;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {        
+        };
+
+    };
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// CLASS DECLARATION
+
+/**
+*  This a ICMSTIF class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CICMSTIF) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CICMSTIF* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CICMSTIF();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the ICMSTIF. 
+        *       It is called once for every instance of ICMSTIF after
+        *       its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of ICMSTIF.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from ICMSTIF. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& /* aFailureType */,
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; User may add implementation for OOM test 
+        * environment initialization. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL. User may add implementation 
+        * for OOM test warning handling. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */);
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CICMSTIF();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        /**
+        * Test cases
+        */
+		TInt TestCase_001L( TTestResult& aResult );
+		TInt TestCase_002L( TTestResult& aResult );
+		TInt TestCase_003L( TTestResult& aResult );
+		TInt TestCase_004L( TTestResult& aResult );
+		TInt TestCase_005L( TTestResult& aResult );
+		TInt TestCase_006L( TTestResult& aResult );
+		TInt TestCase_007L( TTestResult& aResult );
+		TInt TestCase_008L( TTestResult& aResult );
+		TInt TestCase_009L( TTestResult& aResult );
+		TInt TestCase_010L( TTestResult& aResult );
+		TInt TestCase_OOML( TTestResult& aResult );
+		
+		
+		void AllocFailureSimulation (TBool aSwitchedOn);
+		void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+
+    public:     // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        CStifLogger * iLog;
+        RHeap::TAllocFail iAllocFailureType;
+        TInt iAllocFailureRate;
+        TInt iCurrentAllocFailureRate;
+        TBool iMemTestEnabled;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // ICMSTIF_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configmanagers/imagingconfigmanager/tsrc/public/basic/src/ICMSTIF.cpp	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,1094 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ICMSTIF class member functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <Stiftestinterface.h>
+#include "ICMSTIF.h"
+
+#include <e32debug.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::CICMSTIF
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CICMSTIF::CICMSTIF()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::ConstructL
+// Symbian 2nd phase constructor can leave.
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CICMSTIF::ConstructL()
+    {
+    iLog = CStifLogger::NewL( KICMSTIFLogPath, 
+                          KICMSTIFLogFile);
+/*    // SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+    iMemTestEnabled = ETrue;*/
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CICMSTIF* CICMSTIF::NewL()
+    {
+    CICMSTIF* self = new (ELeave) CICMSTIF;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CICMSTIF::~CICMSTIF()
+    { 
+    delete iLog;
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CICMSTIF::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo CICMSTIF::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    ICMSTIF.cpp file and to ICMSTIF.h 
+    *    header file.
+    * 2) Add entry to following KCases array either by using FUNCENTRY or 
+    *    ENTRY macro. 
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    * FUNCENTRY macro takes only test case function name as a parameter and uses
+    * that as a test case name and test case function name.
+    */
+    
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+		ENTRY( "TestCase001", TestCase_001L ),
+		ENTRY( "TestCase002", TestCase_002L ),
+        ENTRY( "TestCase003", TestCase_003L ),
+        ENTRY( "TestCase004", TestCase_004L ),
+        ENTRY( "TestCase005", TestCase_005L ),
+        ENTRY( "TestCase006", TestCase_006L ),
+        ENTRY( "TestCase007", TestCase_007L ),
+        ENTRY( "TestCase008", TestCase_008L ),
+        ENTRY( "TestCase009", TestCase_009L ),
+        ENTRY( "TestCase010", TestCase_010L ),
+        ENTRY( "TestOOM", TestCase_OOML )
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        return null;
+        }
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    return tmp;
+     
+    }
+    
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_001L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//     
+TInt CICMSTIF::TestCase_001L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+	delete icm;
+	CImagingConfigManager* icm2 = CImagingConfigManager::NewLC();
+	CleanupStack::Pop( icm2 );
+    aResult.iResult = KErrNone;
+    aResult.iResultDes = _L("CImagingConfigManager creations with NewL and NewLC succeeded both.");
+
+    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_002L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_002L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    if(icm->NumberOfVideoQualityLevels() != 8)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("NumberOfVideoQualityLevels() didn't return 8 as expected.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+		aResult.iResultDes = _L("NumberOfVideoQualityLevels() OK.");
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_003L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_003L( TTestResult& aResult )
+	{
+	_LIT8(KFileMime, "video/3gpp");
+	_LIT8(KVideoCodecMimeType, "video/H263-2000");
+	_LIT8(KPreferredSupplier, "Nokia");
+	const TUint32 KAudioFourCCType = 0x524D4120;
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    CArrayFixFlat<TUint>* levels = new( ELeave ) CArrayFixFlat< TUint >( 1 );
+    TVideoQualitySet videoset;
+    icm->GetVideoQualityLevelsL(*levels);
+    
+    if(levels->Count() != 8 || levels->At(0) != 98
+                             || levels->At(1) != 99 || levels->At(2) != 200
+                             || levels->At(3) != 201 || levels->At(4) != 202 || levels->At(5) != 203
+                             || levels->At(6) != 301 || levels->At(7) != 302)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetVideoQualityLevelsL() didn't return the expected values.");
+        }
+    else
+        {
+        icm->GetVideoQualitySet( videoset, 100/*levels->At(0)*/ );
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        TInt length3 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoCodecMimeType[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iPreferredSupplier[i] == '\0')
+                {
+                length3 = i;
+                break;
+                }
+            }
+        if( videoset.iVideoQualitySetLevel != 99 ||
+            memcompare(videoset.iVideoFileMimeType, length1, KFileMime().Ptr(), KFileMime().Length()) ||
+            memcompare(videoset.iVideoCodecMimeType, length2, KVideoCodecMimeType().Ptr(), KVideoCodecMimeType().Length()) ||
+            videoset.iVideoWidth != 176 ||
+            videoset.iVideoHeight != 144 ||
+            videoset.iVideoFrameRate != 15.0 ||
+            videoset.iVideoBitRate != 60000 ||
+            videoset.iVideoEncoderUID.iUid != 0 ||
+            videoset.iRandomAccessRate != 0.2 ||
+            videoset.iVideoPixelAspectRatioNum != 12 ||
+            videoset.iVideoPixelAspectRatioDenom != 11 ||
+            memcompare(videoset.iPreferredSupplier, length3, KPreferredSupplier().Ptr(), KPreferredSupplier().Length()) ||
+            videoset.iAudioFourCCType.FourCC() != KAudioFourCCType ||
+            videoset.iAudioBitRate != 12200 ||
+            videoset.iAudioSamplingRate != 8000 ||
+            videoset.iAudioChannels != 1 ||
+            videoset.iAudioEncoderUID.iUid != 0 ||
+            videoset.iAVSyncStartDelay != -200 ||
+            videoset.iAVSyncResumeDelay != 0 ||
+            videoset.iCameraDisplayId != 2 ||
+            videoset.iCamcorderVisible != 100)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetVideoQualitySetL() OK.");
+            }
+        }
+    delete levels;
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_004L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_004L( TTestResult& aResult )
+	{
+	_LIT8(KFileMime, "video/3gpp");
+	_LIT8(KVideoCodecMimeType, "video/H263-2000");
+	_LIT8(KPreferredSupplier, "Nokia");
+	const TUint32 KAudioFourCCType = 0x524D4120;
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TVideoQualitySet videoset;
+    TSize resolution(176,144);
+    icm->GetVideoQualitySet(videoset, resolution, KVideoCodecMimeType(), 0, 0, TFourCC(KAudioFourCCType));
+    
+    if(videoset.iVideoHeight != resolution.iHeight ||
+       videoset.iVideoWidth != resolution.iWidth ||
+       videoset.iVideoQualitySetLevel != 99)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected value.");
+        }
+    else
+        {
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        TInt length3 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoCodecMimeType[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iPreferredSupplier[i] == '\0')
+                {
+                length3 = i;
+                break;
+                }
+            }
+        if( memcompare(videoset.iVideoFileMimeType, length1, KFileMime().Ptr(), KFileMime().Length()) ||
+            memcompare(videoset.iVideoCodecMimeType, length2, KVideoCodecMimeType().Ptr(), KVideoCodecMimeType().Length()) ||
+            videoset.iVideoWidth != 176 ||
+            videoset.iVideoHeight != 144 ||
+            videoset.iVideoFrameRate != 15.0 ||
+            videoset.iVideoBitRate != 60000 ||
+            videoset.iVideoEncoderUID.iUid != 0 ||
+            videoset.iRandomAccessRate != 0.2 ||
+            videoset.iVideoPixelAspectRatioNum != 12 ||
+            videoset.iVideoPixelAspectRatioDenom != 11 ||
+            memcompare(videoset.iPreferredSupplier, length3, KPreferredSupplier().Ptr(), KPreferredSupplier().Length()) ||
+            videoset.iAudioFourCCType.FourCC() != KAudioFourCCType ||
+            videoset.iAudioBitRate != 12200 ||
+            videoset.iAudioSamplingRate != 8000 ||
+            videoset.iAudioChannels != 1 ||
+            videoset.iAudioEncoderUID.iUid != 0 ||
+            videoset.iAVSyncStartDelay != -200 ||
+            videoset.iAVSyncResumeDelay != 0 ||
+            videoset.iCameraDisplayId != 2 ||
+            videoset.iCamcorderVisible != 100)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetVideoQualitySetL() OK.");
+            }
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_005L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_005L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TCamcorderMMFPluginSettings ccorSettings;
+    icm->GetCamcorderMMFPluginSettings(ccorSettings);
+    
+    if(ccorSettings.iVideoNightFrameRate != 5.00 ||
+       ccorSettings.iCMRAvgVideoBitRateScaler != 0.9 ||
+       ccorSettings.iVideoComplexitySetting != 1 ||
+       ccorSettings.iCMRLatencyQualityTradeoff != 1.0 ||
+       ccorSettings.iCMRPictureQuality != 50 ||
+       ccorSettings.iCMRQualityTemporalTradeoff != 0.8 ||
+       ccorSettings.iCMRNumCameraBuffers != 2 ||
+       ccorSettings.iCMRNumCameraBuffersARM != 1 ||
+       ccorSettings.iCMRMinNumOutputBuffers != 4)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetCamcorderMMFPluginSettingsL() didn't return expected value.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+    	aResult.iResultDes = _L("GetCamcorderMMFPluginSettingsL() OK.");
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_006L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_006L( TTestResult& aResult )
+	{
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    if(icm->NumberOfImageQualityLevels() != 27)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("NumberOfImageQualityLevels() didn't return 27 as expected.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+		aResult.iResultDes = _L("NumberOfImageQualityLevels() OK.");
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_007L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_007L( TTestResult& aResult )
+	{
+	_LIT8(KImageFileMimeType, "image/jpeg");
+	_LIT8(KImageFileExtension, ".jpg");
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    CArrayFixFlat<TUint>* levels = new( ELeave ) CArrayFixFlat< TUint >( 1 );
+    TImageQualitySet imageset;
+    icm->GetImageQualityLevelsL(*levels, 2);
+    
+    if(levels->Count() != 24 || levels->At(0) != 99 || levels->At(1) != 100 || levels->At(2) != 101
+                           || levels->At(3) != 102 || levels->At(4) != 103 || levels->At(5) != 104
+                           || levels->At(6) != 105 || levels->At(7) != 106 || levels->At(8) != 199
+                           || levels->At(9) != 200 || levels->At(10) != 201 || levels->At(11) != 202
+                           || levels->At(12) != 203 || levels->At(13) != 204 || levels->At(14) != 205
+                           || levels->At(15) != 206 || levels->At(16) != 299 || levels->At(17) != 300
+                           || levels->At(18) != 301 || levels->At(19) != 302 || levels->At(20) != 303
+                           || levels->At(21) != 304 || levels->At(22) != 305 || levels->At(23) != 306)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetImageQualityLevelsL() didn't return expected value.");
+        }
+    else
+        {
+        icm->GetImageQualitySet( imageset, levels->At(1) );
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileExtension[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        if( memcompare(imageset.iImageFileMimeType, length1, KImageFileMimeType().Ptr(), KImageFileMimeType().Length()) ||
+            memcompare(imageset.iImageFileExtension, length2, KImageFileExtension().Ptr(), KImageFileExtension().Length()) ||
+            imageset.iImageWidth != 640 ||
+            imageset.iImageHeight != 480 ||
+            imageset.iImageEncoderUID.iUid != 0 ||
+            imageset.iCompressionQuality != 50 ||
+            imageset.iEstimatedSize != 28590 ||
+            imageset.iCameraDisplayId != 2 ||
+            imageset.iCamcorderVisible != 100)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetImageQualityLevelsL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetImageQualityLevelsL() OK.");
+            }
+        }
+    delete levels;
+	delete icm;
+    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_008L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_008L( TTestResult& aResult )
+	{
+	_LIT8(KImageFileMimeType, "image/jpeg");
+	_LIT8(KImageFileExtension, ".jpg");
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TImageQualitySet imageset;
+    TSize resolution(1280,960);
+    icm->GetImageQualitySet(imageset, resolution, 2);
+    
+    if(imageset.iImageHeight != resolution.iHeight ||
+       imageset.iImageWidth != resolution.iWidth ||
+       imageset.iImageQualitySetLevel != 103)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetImageQualitySetL() didn't return expected value.");
+        }
+    else
+        {
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(imageset.iImageFileExtension[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        if( memcompare(imageset.iImageFileMimeType, length1, KImageFileMimeType().Ptr(), KImageFileMimeType().Length()) ||
+            memcompare(imageset.iImageFileExtension, length2, KImageFileExtension().Ptr(), KImageFileExtension().Length()) ||
+            imageset.iImageEncoderUID.iUid != 0 ||
+            imageset.iCompressionQuality != 50 ||
+            imageset.iEstimatedSize != 114370 ||
+            imageset.iCameraDisplayId != 2 ||
+            imageset.iCamcorderVisible != 0)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetImageQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetImageQualitySetL() OK.");
+            }
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_009L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_009L( TTestResult& aResult )
+	{
+	_LIT8(KFileMime, "video/3gpp");
+	_LIT8(KVideoCodecMimeType, "video/H263-2000");
+	_LIT8(KPreferredSupplier, "Nokia");
+	const TUint32 KAudioFourCCType = 0x524D4120;
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TVideoQualitySet videoset;
+    TSize resolution(176,144);
+    icm->GetVideoQualitySet( videoset, 125 );// This should return video set num 99
+    
+    if(videoset.iVideoHeight != resolution.iHeight ||
+       videoset.iVideoWidth != resolution.iWidth ||
+       videoset.iVideoQualitySetLevel != 99)
+        {
+        aResult.iResult = KErrGeneral;
+		aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected value.");
+        }
+    else
+        {
+        TInt length1 = KMaxStringLength;
+        TInt length2 = KMaxStringLength;
+        TInt length3 = KMaxStringLength;
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoFileMimeType[i] == '\0')
+                {
+                length1 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iVideoCodecMimeType[i] == '\0')
+                {
+                length2 = i;
+                break;
+                }
+            }
+        for( TInt i=0; i<KMaxStringLength; i++)
+            {
+            if(videoset.iPreferredSupplier[i] == '\0')
+                {
+                length3 = i;
+                break;
+                }
+            }
+        if( memcompare(videoset.iVideoFileMimeType, length1, KFileMime().Ptr(), KFileMime().Length()) ||
+            memcompare(videoset.iVideoCodecMimeType, length2, KVideoCodecMimeType().Ptr(), KVideoCodecMimeType().Length()) ||
+            videoset.iVideoWidth != 176 ||
+            videoset.iVideoHeight != 144 ||
+            videoset.iVideoFrameRate != 15.0 ||
+            videoset.iVideoBitRate != 60000 ||
+            videoset.iVideoEncoderUID.iUid != 0 ||
+            videoset.iRandomAccessRate != 0.2 ||
+            videoset.iVideoPixelAspectRatioNum != 12 ||
+            videoset.iVideoPixelAspectRatioDenom != 11 ||
+            memcompare(videoset.iPreferredSupplier, length3, KPreferredSupplier().Ptr(), KPreferredSupplier().Length()) ||
+            videoset.iAudioFourCCType.FourCC() != KAudioFourCCType ||
+            videoset.iAudioBitRate != 12200 ||
+            videoset.iAudioSamplingRate != 8000 ||
+            videoset.iAudioChannels != 1 ||
+            videoset.iAudioEncoderUID.iUid != 0 ||
+            videoset.iAVSyncStartDelay != -200 ||
+            videoset.iAVSyncResumeDelay != 0 ||
+            videoset.iCameraDisplayId != 2 ||
+            videoset.iCamcorderVisible != 100)
+            {
+            aResult.iResult = KErrGeneral;
+		    aResult.iResultDes = _L("GetVideoQualitySetL() didn't return expected values.");
+            }
+        else
+            {
+            aResult.iResult = KErrNone;
+    		aResult.iResultDes = _L("GetVideoQualitySetL() OK.");
+            }
+        }
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_010L
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_010L( TTestResult& aResult )
+	{
+	_LIT8(KImageFileMimeType, "image/jpeg");
+	_LIT8(KImageFileExtension, ".jpg");
+	CImagingConfigManager* icm = CImagingConfigManager::NewL();
+    TImageQualitySet imageset;
+
+    icm->GetImageQualitySet( imageset, 305 );
+    TInt length1 = KMaxStringLength;
+    TInt length2 = KMaxStringLength;
+    for( TInt i=0; i<KMaxStringLength; i++)
+        {
+        if(imageset.iImageFileMimeType[i] == '\0')
+            {
+            length1 = i;
+            break;
+            }
+        }
+    for( TInt i=0; i<KMaxStringLength; i++)
+        {
+        if(imageset.iImageFileExtension[i] == '\0')
+            {
+            length2 = i;
+            break;
+            }
+        }
+    if( memcompare(imageset.iImageFileMimeType, length1, KImageFileMimeType().Ptr(), KImageFileMimeType().Length()) ||
+        memcompare(imageset.iImageFileExtension, length2, KImageFileExtension().Ptr(), KImageFileExtension().Length()) ||
+        imageset.iImageWidth != 2048 ||
+        imageset.iImageHeight != 1536 ||
+        imageset.iImageEncoderUID.iUid != 0 ||
+        imageset.iCompressionQuality != 85 ||
+        imageset.iEstimatedSize != 430100 ||
+        imageset.iCameraDisplayId != 2 ||
+        imageset.iCamcorderVisible != 300)
+        {
+        aResult.iResult = KErrGeneral;
+	    aResult.iResultDes = _L("GetImageQualityLevelsL() didn't return expected values.");
+        }
+    else
+        {
+        aResult.iResult = KErrNone;
+		aResult.iResultDes = _L("GetImageQualityLevelsL() OK.");
+        }
+
+	delete icm;
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::TestCase_OOML
+//
+// <INSERT DESCRIPTION HERE>
+//
+// Pre-Condition: <INSERT PRE-CONDITIONS HERE>
+// -----------------------------------------------------------------------------
+//    
+TInt CICMSTIF::TestCase_OOML( TTestResult& aResult )
+    {
+    TInt error = KErrNone;
+    _LIT(KTestCase, "TestCase0??");
+    
+    for( TInt i = 0; Case(i).iMethod != NULL && !error; i++ )
+        {
+        // Get the pointer to test case function
+        TCaseInfo tmp = Case(i);
+        if(KErrNotFound == tmp.iCaseName.Match(KTestCase()))
+            {
+            break;
+            }
+        SetAllocFailureSimulation( RHeap::EDeterministic, 1 ); // Enable OOM test loop
+        aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+        for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+            {      
+            // Switches on alloc failure simulation if the parameters are set for it
+            AllocFailureSimulation( ETrue ); 
+            RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+
+            iMethod = tmp.iMethod;        
+            
+            TRAP( error, ( this->*iMethod )( aResult ) );
+            if ( error == KErrNoMemory )
+                {
+                error = KErrNone;
+                }
+            }
+        AllocFailureSimulation( EFalse );
+        }
+
+    SetAllocFailureSimulation( RHeap::ENone, 1 ); // Disable OOM test loop
+    User::LeaveIfError( error );
+    return KErrNone;
+    }
+
+
+/*
+*/    
+
+void CICMSTIF::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CICMSTIF::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CICMSTIF::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CICMSTIF::RunTestCaseL(
+    const TInt aCaseNumber ,
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        execStatus  = ( this->*iMethod )( aResult );                  
+        }
+    else
+        {        
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+TBool CICMSTIF::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& /* aFirstMemFailure */, 
+                                TInt& /* aLastMemFailure */ ) 
+    {
+    _LIT( KOOMTestQueryL, "CICMSTIF::OOMTestQueryL" );
+    iLog->Log( KOOMTestQueryL ); 
+
+    return EFalse;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CICMSTIF::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CICMSTIF::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CICMSTIF::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//                  
+void CICMSTIF::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CICMSTIF::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, 
+                                TUint32& aParameterValid )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 2*16384; // 32K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    aTestModuleParam = param;
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// E32Dll is a DLL entry point function
+// Returns: KErrNone: No error
+// -----------------------------------------------------------------------------
+//
+#ifndef EKA2 // Hide Dll entry point to EKA2
+GLDEF_C TInt E32Dll(
+    TDllReason /*aReason*/) // Reason
+    {
+    return(KErrNone);
+
+    }
+#endif // EKA2
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  camerasrv bld.inf
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../camerasrv_plat/group/bld.inf"
+
+#include "../configmanagers/group/bld.inf"
+#include "../camappengine/Build/bld.inf"
+#include "../camcordermmfplugin/Build/bld.inf"
+
+PRJ_EXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/CamCControllerCustomCommands.h	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camcorder controller plugin custom commands
+*
+*/
+
+
+
+#ifndef CAMCCONTROLLERCUSTOMCOMMANDS_H
+#define CAMCCONTROLLERCUSTOMCOMMANDS_H
+
+// Controller UId, can be used by the client to identify the controller, e.g. if the custom command can be used
+const TUid KCamCControllerImplementationUid = {0x101F8503};
+
+// TMMFEvent UIDs for Async stop
+const TUid KCamCControllerCCVideoRecordStopped = {0x2000E546};
+const TUid KCamCControllerCCVideoFileComposed = {0x2000E547};
+
+
+// Custom command for setting a new filename without closing & reopening the controller
+enum TCamCControllerCustomCommands
+    {   
+    ECamCControllerCCNewFilename = 0,
+    ECamCControllerCCVideoStopAsync
+    };
+
+#endif      // CAMCCONTROLLERCUSTOMCOMMANDS_H  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.50.xml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "s60/mw/camerasrv" >
+]>
+
+<SystemDefinition name="camerasrv" schema="1.4.0">
+  <systemModel>
+    <layer name="mw_layer">
+      <module name="camerasrv">
+        <unit unitID="imm.camerasrv" mrp="" bldFile="&layer_real_source_path;/group" name="camerasrv" />
+      </module>
+    </layer>
+    
+    <layer name="api_test_layer">
+      <module name="camerasrv_api_tests">
+      	<unit unitID="imm.camerasrv.asynchronous_file_saving_queue_api" mrp="" bldFile="s60/mw/camerasrv/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group"  name="asynchronous_file_saving_queue_api"  />
+      	<unit unitID="imm.camerasrv.camera_application_engine_api" mrp="" bldFile="s60/mw/camerasrv/camerasrv_plat/camera_application_engine_api/tsrc/group"  name="camera_application_engine_api"  />
+      	<unit unitID="imm.camerasrv.imaging_configuration_manager_api" mrp="" bldFile="s60/mw/camerasrv/camerasrv_plat/imaging_configuration_manager_api/tsrc/group"  name="imaging_configuration_manager_api"  />
+      	<unit unitID="imm.camerasrv.media_recorder_api" mrp="" bldFile="s60/mw/camerasrv/camerasrv_plat/media_recorder_api/tsrc/group"  name="media_recorder_api"  />
+      </module>
+    </layer>
+    
+    <layer name="unit_test_layer">
+      <module name="camerasrv_unit_tests">
+      </module>
+    </layer>
+    
+  </systemModel>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/mw/camerasrv" >
+]>
+
+<SystemDefinition name="camerasrv" schema="1.4.0">
+  <systemModel>
+    <layer name="mw_layer">
+      <module name="camerasrv">
+        <unit unitID="imm.camerasrv" mrp="" bldFile="&layer_real_source_path;/group" name="camerasrv" />
+      </module>
+    </layer>
+    
+    <layer name="api_test_layer">
+      <module name="camerasrv_api_tests">
+      	<unit unitID="imm.camerasrv.asynchronous_file_saving_queue_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group"  name="asynchronous_file_saving_queue_api"  />
+      	<unit unitID="imm.camerasrv.camera_application_engine_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/camera_application_engine_api/tsrc/group"  name="camera_application_engine_api"  />
+      	<unit unitID="imm.camerasrv.imaging_configuration_manager_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/imaging_configuration_manager_api/tsrc/group"  name="imaging_configuration_manager_api"  />
+      	<unit unitID="imm.camerasrv.media_recorder_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/media_recorder_api/tsrc/group"  name="media_recorder_api"  />
+      </module>
+    </layer>
+    
+    <layer name="unit_test_layer">
+      <module name="camerasrv_unit_tests">
+      </module>
+    </layer>
+    
+  </systemModel>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+  <package id="camerasrv" name="Camera Services" levels="plugin fw api">
+    <collection id="camappengine" name="Camera App Engine" level="fw">
+      <component id="stillconverter" filter="s60" name="Still Image Converter">
+        <!-- <unit bldFile="camappengine/stillconverter/group"/> -->
+      </component>
+      <component id="camappengine_engine" filter="s60" name="Camera App Engine">
+		<!-- should separate this from parent engine's bld.inf  -->
+        <!-- <unit bldFile="camappengine/engine/group"/> -->
+      </component>
+      <component id="asynchfilesavequeue" filter="s60" name="Asynch File Save Queue">
+        <unit bldFile="camappengine/asynchfilesavequeue/group"/>
+		<!-- should next bld.inf be #included in previous? -->
+        <!-- <unit bldFile="camappengine/asynchfilesavequeue/tsrc/public/basic/group"/> -->
+      </component>
+      <component id="camappengine_build" filter="s60" name="Camera App Engine Build">
+        <unit bldFile="camappengine/build"/>
+      </component>
+    </collection>
+    <collection id="camcordermmfplugin" name="Camcorder MMF Plugin" level="plugin">
+      <component id="mediarecorder" filter="s60" name="Camcorder Media Recorder">
+        <!-- <unit bldFile="camcordermmfplugin/mediarecorder/group"/> -->
+      </component>
+      <component id="filecomposer" filter="s60" name="File Composer">
+        <!-- <unit bldFile="camcordermmfplugin/filecomposer/group"/> -->
+      </component>
+      <component id="camcordermmfplugin_controller" filter="s60" name="Camcorder Controller MMF Plugin" class="plugin">
+        <!-- <unit bldFile="camcordermmfplugin/controller/group"/> -->
+      </component>
+      <component id="camcordermmfplugin_test" filter="s60" name="Camcorder MMF Plugin Test" purpose="development">
+        <!-- <unit bldFile="camcordermmfplugin/tsrc/public/basic/group"/> -->
+      </component>
+      <component id="camcordermmfplugin_build" filter="s60" name="Camcorder MMF Plugin Build">
+		<!-- should split this into individual bld.inf files for the above components, or collapse all into a single component? -->
+        <unit bldFile="camcordermmfplugin/build"/>
+      </component>
+    </collection>
+    <collection id="configmanagers" name="Config Managers" level="api">
+      <component id="imagingconfigmanager" filter="s60" name="Imaging Config Manager">
+        <unit bldFile="configmanagers/imagingconfigmanager/group"/>
+		<!-- should this test be #included in the above? -->
+        <!-- <unit bldFile="configmanagers/imagingconfigmanager/tsrc/public/basic/group"/> -->
+      </component>
+    </collection>
+    <collection id="camerasrv_info" name="Camera Services Info" level="api">
+      <component id="camerasrv_plat" filter="s60" name="Camera Services Platform Interfaces" class="api">
+        <unit bldFile="camerasrv_plat/group"/>
+		<!-- should below tests be #included? -->
+        <!-- <unit bldFile="camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group"/> -->
+        <!-- <unit bldFile="camerasrv_plat/camera_application_engine_api/tsrc/group"/> -->
+        <!-- <unit bldFile="camerasrv_plat/imaging_configuration_manager_api/tsrc/group"/> -->
+        <!-- <unit bldFile="camerasrv_plat/media_recorder_api/tsrc/group"/> -->
+      </component>
+      <component id="camerasrv_build" filter="s60" name="Camera Services Build">
+		<!-- should split into individual bld.infs -->
+        <unit bldFile="group"/>
+      </component>
+    </collection>
+  </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Thu Dec 17 08:51:24 2009 +0200
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>